Browse Source

2022-9-24 17:00

codeMan 2 years ago
parent
commit
fa6c044b39

+ 30 - 4
src/HDrpManagement/ProductGroupMag/index.vue

@@ -1,13 +1,28 @@
 <template>
   <div>
-    <div class="container normal-panel normal-margin">
-      <add type="add" @addSuccess="addSuccess" :productData="productList" :brandData="brandList"></add>
+    <div class="container normal-panel normal-margin" style="display:flex">
+      <add type="add" @addSuccess="$refs.list.listData()" :productData="productList" :brandData="brandList" v-if="tool.checkAuth($route.name,'update')"></add>
+      <!-- <all-del style="margin-left:16px" type="group" @deleteSuccess="$refs.list.listData()" :checkboxData="checkboxData" v-if="Object.keys(checkboxData).length > 0"></all-del> -->
+      <Up type="all" style="margin-left:16px" @upSuccess="$refs.list.listData()" :id="checkboxData.map(item => item.sa_itemgroupid)" v-if="Object.keys(checkboxData).length > 0 && checkboxData[0].isonsale == 0 && tool.checkAuth($route.name,'up_sales')"></Up>
+      <Down type="all" style="margin-left:16px" @downSuccess="$refs.list.listData()" :id="checkboxData.map(item => item.sa_itemgroupid)" v-if="Object.keys(checkboxData).length > 0 && checkboxData[0].isonsale == 1 && tool.checkAuth($route.name,'down_sales')"></Down>
     </div>
     <div class="container normal-panel normal-margin">
-      <list ref="list">
+      <list ref="list" @checkboxCallBack="checkboxCallBack">
         <template v-slot:detail="scope">
           <el-button type="text" size="small" @click="$router.push({path:'/projectTarget_edit',query:{id:scope.data.sa_salestargetbillid,type:'onlyread'}})">详 情</el-button>
         </template>
+        <template v-slot:edit="scope">
+          <add v-if="tool.checkAuth($route.name,'update')" type="edit" @addSuccess="$refs.list.listData()" :productData="productList" :brandData="brandList" :groupData="scope.data"></add>
+        </template>
+        <template v-slot:del="scope">
+          <Del v-if="tool.checkAuth($route.name,'delete')" type="group" @deleteSuccess="$refs.list.listData()" :id="scope.data.sa_itemgroupid"></Del>
+        </template>
+        <template v-slot:up="scope">
+          <Up type="one" @upSuccess="$refs.list.listData()" :id="[scope.data.sa_itemgroupid]" v-if="scope.data.isonsale == 0 && tool.checkAuth($route.name,'up_sales')"></Up>
+        </template>
+        <template v-slot:down="scope">
+          <Down type="one" @downSuccess="$refs.list.listData()" :id="[scope.data.sa_itemgroupid]" v-if="scope.data.isonsale == 1 && tool.checkAuth($route.name,'down_sales')"></Down>
+        </template>
       </list>
     </div>
   </div>
@@ -17,13 +32,19 @@
 import list from './modules/list'
 
 import add from './modules/add'
+import Del from './modules/delete'
+import Up from './modules/up'
+import Down from './modules/down'
 import detail from './modules/details.vue'
 export default {
   name:"index",
   components:{
     list,
     add,
-    detail
+    detail,
+    Del,
+    Up,
+    Down,
   },
   data() {
     return {
@@ -31,6 +52,7 @@ export default {
       productList:'',
       /* 品牌列表数据 */
       brandList:'',
+      checkboxData:{}
     }
   },
   created() {
@@ -72,6 +94,10 @@ export default {
     },
     /* 新增/编辑成功 */
     addSuccess() {
+      
+    },
+    checkboxCallBack(data) {
+      this.checkboxData = data
     }
   }
 }

+ 67 - 4
src/HDrpManagement/ProductGroupMag/modules/add.vue

@@ -38,7 +38,25 @@
           </el-col>
           <el-col :span="24">
             <el-form-item label="自定义标签" prop="tag">
-              <!-- <el-input v-model="form.tag"></el-input> -->
+              <el-tag
+                :key="tag"
+                v-for="tag in form.tag"
+                closable
+                :disable-transitions="false"
+                @close="handleClose(tag)">
+                {{tag}}
+              </el-tag>
+              <el-input
+                class="input-new-tag"
+                v-if="inputVisible"
+                v-model="inputValue"
+                ref="saveTagInput"
+                size="small"
+                @keyup.enter.native="handleInputConfirm"
+                @blur="handleInputConfirm"
+              >
+              </el-input>
+              <el-button v-else class="button-new-tag" size="small" @click="showInput">+ New 标签</el-button>
             </el-form-item>
           </el-col>
         </el-form>
@@ -61,11 +79,13 @@ export default {
       dialogTableVisible:false,
       /* 当前选择的组 */
       seleteGroup:'',
+      inputVisible: false,
+      inputValue: '',
       form:{
         sa_brandid:'',
         groupname:'',
         itemno:'',
-        // tag:
+        tag:[]
       },
       rules:{
         sa_brandid: [
@@ -84,11 +104,13 @@ export default {
   watch: {
     seleteGroup: {
       handler(val) {
+        console.log(val);
+        
         this.form = {
           sa_brandid:val.sa_brandid,
           groupname:val.groupname,
           itemno:val.itemno,
-          // tag:
+          tag:val.tag1
         }
       }
     }
@@ -108,7 +130,7 @@ export default {
                 "sa_brandid":this.form.sa_brandid,
                 "groupname":this.form.groupname,
                 "itemno":this.form.itemno,
-                "tag": []
+                "tag": this.form.tag
             }
           })
           console.log(res);
@@ -122,6 +144,23 @@ export default {
     editBtn() {
       this.dialogTableVisible = true
       this.seleteGroup = this.groupData
+    },
+    handleClose(tag) {
+      this.form.tag.splice(this.form.tag.indexOf(tag), 1);
+    },
+    showInput() {
+      this.inputVisible = true;
+      this.$nextTick(_ => {
+        this.$refs.saveTagInput.$refs.input.focus();
+      });
+    },
+    handleInputConfirm() {
+      let inputValue = this.inputValue;
+      if (inputValue) {
+        this.form.tag.push(inputValue);
+      }
+      this.inputVisible = false;
+      this.inputValue = '';
     }
   }
 }
@@ -135,4 +174,28 @@ export default {
 /deep/.dialog-footer {
   margin-top: 10px !important;
 }
+/deep/.el-form-item__content {
+  width: calc(100% - 100px) !important;
+}
+/deep/.el-select {
+  width: 100% !important;
+}
+/deep/.el-form-item {
+  width: 100% !important;
+}
+.el-tag + .el-tag {
+  margin-left: 10px;
+}
+.button-new-tag {
+  margin-left: 10px;
+  height: 32px;
+  line-height: 30px;
+  padding-top: 0;
+  padding-bottom: 0;
+}
+.input-new-tag {
+  width: 90px;
+  margin-left: 10px;
+  vertical-align: bottom;
+}
 </style>

+ 1 - 1
src/HDrpManagement/ProductGroupMag/modules/delete.vue

@@ -1,5 +1,5 @@
 <template>
-  <div style="display:inline;margin:0 16px">
+  <div style="display:inline">
     <el-popconfirm title="确定删除当前数据吗?" @confirm="deleteRow()">
       <el-button slot="reference" size="small" type="text">删 除</el-button>
     </el-popconfirm>

+ 11 - 4
src/HDrpManagement/ProductGroupMag/modules/down.vue

@@ -1,6 +1,9 @@
 <template>
   <div>
-    <el-button size="small" type="text" @click="upSubmit">下 架</el-button>
+    <el-popconfirm title="确定删除当前数据吗?" @confirm="deleteRow()">
+      <el-button slot="reference" size="small" type="text" v-if="type=='one'">下 架</el-button>
+      <el-button slot="reference" size="small" type="warning" v-else>批量下架</el-button>
+    </el-popconfirm>
   </div>
 </template>
 
@@ -9,22 +12,26 @@ export default {
   name: '',
   data() {
     return {
-      sa_itemgroupids:[]
     };
   },
   computed:{
   },
   watch:{
   },
+  props:['id','type'],
   methods: {
-    async upSubmit() {
+    async deleteRow() {
       let res = await this.$api.requested({
         "id": "20220923143703",
         "version":1,
         "content": {
-          "sa_itemgroupids": this.sa_itemgroupids
+          "sa_itemgroupids": this.id
         }
       })
+      console.log(res);
+      this.tool.showMessage(res,() => {
+        this.$emit('downSuccess')
+      })
     }
   },
 };

+ 13 - 3
src/HDrpManagement/ProductGroupMag/modules/list.vue

@@ -1,13 +1,19 @@
 <template>
   <div>
-    <tableLayout :layout="tablecols" :data="list" :opwidth="200" :custom="true" :height="tableHieght">
+    <table1 :layout="tablecols" :data="list" :opwidth="200" :custom="true" :height="tableHieght" :checkbox="true" v-on="$listeners">
       <template v-slot:customcol="scope">
         <p >{{scope.column.data[scope.column.columnname]}}</p>
       </template>
       <template v-slot:opreation="scope">
-        <slot name="detail" :data="scope.data"></slot>
+        <div style="display:flex;justify-content:space-around">
+          <slot name="detail" :data="scope.data"></slot>
+          <slot name="edit" :data="scope.data"></slot>
+          <slot name="up" :data="scope.data"></slot>
+          <slot name="down" :data="scope.data"></slot>
+          <slot name="del" :data="scope.data"></slot>
+        </div>
       </template>
-    </tableLayout>
+    </table1>
     <div style="margin-top:16px;text-align:right">
       <el-pagination
           background
@@ -24,6 +30,7 @@
 </template>
 
 <script>
+import table1 from './table'
 export default {
   name: "list",
   data() {
@@ -36,6 +43,7 @@ export default {
         "id": "20220922164403",
         "version":1,
         "content": {
+          "nocache":true,
           "where":{
             "condition":""
           }
@@ -43,6 +51,7 @@ export default {
       }
     }
   },
+  components:{table1},
   mounted() {
     this.listData();
   },
@@ -74,4 +83,5 @@ export default {
 
 </script>
 <style>
+
 </style>

+ 74 - 0
src/HDrpManagement/ProductGroupMag/modules/table.vue

@@ -0,0 +1,74 @@
+<template>
+  <div>
+    <el-table ref="tables" :row-class-name="tableClassName" v-loading="loading" highlight-current-row :data="data" :header-cell-style="{background:'#EEEEEE',color:'#333'}" size="mini" :height="height" @row-click="rowClick" style="width:100%" @selection-change="handleSelectionChange"  border>
+      <el-table-column
+        type="selection"
+        width="55" @handleSelectionChange="handleSelectionChange" @select-all="selectAll" v-if="checkbox" :selectable="isCheck">
+      </el-table-column>
+      <el-table-column :show-overflow-tooltip="col.title == '来源' || col.title == '地址' || col.title == '备注'" v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="col.width">
+        <template slot-scope="scope">
+          <!-- 自定义表格显示内容 -->
+          <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>
+          <!-- 否则就是默认 -->
+          <span v-else>{{scope.row[col.columnname]}}</span>
+          <!-- 操作结构内容 -->
+          <slot v-if="col.columnname === 'operation'" name="opreation" :data="scope.row"></slot>
+        </template>
+      </el-table-column>
+    </el-table>
+  </div>
+</template>
+
+<script>
+import {mapGetters} from "vuex"
+export default {
+  /*
+    layout:表结构数据;
+    data:表渲染数据;
+    custom:是否启用自定义结构;
+    opwidth:操作列宽度
+  */
+  props:['layout','data','custom','height','checkbox'],
+  data () {
+    return {
+      list:[],
+      upOrDown:''
+    }
+  },
+  computed:{
+    ...mapGetters({
+      loading:'loading'
+    })
+  },
+  methods:{
+    rowClick (row) {
+      this.$emit('rowClick',row)
+    },
+    tableClassName ({row,rowIndex}) {
+      row.index = rowIndex
+    },
+    handleSelectionChange(val) {
+      this.upOrDown = val[0] ? val[0].isonsale : ''
+      console.log(this.upOrDown);
+      this.$emit('checkboxCallBack',val)      
+    },
+    selectAll(val) {
+      this.upOrDown = val[0] ? val[0].isonsale : ''
+    },
+    isCheck(row,rowIndex) {
+      if(this.upOrDown === '') return true
+      if( row.isonsale != this.upOrDown ) {
+        return false
+      } else {
+        return true
+      }
+    }
+  },
+  mounted () {
+    // this.listData()
+  }
+}
+
+</script>
+<style>
+</style>

+ 11 - 5
src/HDrpManagement/ProductGroupMag/modules/up.vue

@@ -1,6 +1,9 @@
 <template>
   <div>
-    <el-button size="small" type="text" @click="upSubmit">上 架</el-button>
+    <el-popconfirm title="确定删除当前数据吗?" @confirm="deleteRow()">
+      <el-button slot="reference" size="small" type="text" v-if="type=='one'">上 架</el-button>
+    <el-button slot="reference" size="small" type="warning" v-else>批量上架</el-button>
+    </el-popconfirm>
   </div>
 </template>
 
@@ -9,23 +12,26 @@ export default {
   name: '',
   data() {
     return {
-      sa_itemgroupids:[]
     };
   },
   computed:{
   },
   watch:{
   },
+  props:['id','type'],
   methods: {
-    async upSubmit() {
+    async deleteRow() {
       let res = await this.$api.requested({
         "id": "20220923143603",
         "version":1,
         "content": {
-          "sa_itemgroupids": this.sa_itemgroupids
-
+          "sa_itemgroupids": this.id
         }
       })
+      console.log(res);
+      this.tool.showMessage(res,() => {
+        this.$emit('upSuccess')
+      })
     }
   },
 };

+ 1 - 1
src/SManagement/orderclue/components/list.vue

@@ -21,7 +21,7 @@
         </div>
       </div>
       <table1 :layout="tablecols" :custom="true" :checkbox="true" :data="list" :height="tableHieght"
-        @checkboxCallBack="checkboxCallBack" v-if="tool.checkAuth($route.name,'read')">
+        @checkboxCallBack="checkboxCallBack">
         <template v-slot:customcol="scope">
           <div v-if="scope.column.columnname == 'rowindex'" style="display:flex;align-items: center;">
             <p>{{ scope.column.data[scope.column.columnname] }}</p>