From db5f18c8d02881bbf8b8b43d45236bc59bd2f958 Mon Sep 17 00:00:00 2001
From: 石广澎 <shiguangpeng@163.com>
Date: 星期三, 13 十二月 2023 18:36:49 +0800
Subject: [PATCH] feat: 物品规格管理 接口对接

---
 admin-web/src/views/foundation/material/specs/list.vue |   47 +++++++++++++++++++++++++++++++++++------------
 1 files changed, 35 insertions(+), 12 deletions(-)

diff --git a/admin-web/src/views/foundation/material/specs/list.vue b/admin-web/src/views/foundation/material/specs/list.vue
index 63e01c7..3ac7c61 100644
--- a/admin-web/src/views/foundation/material/specs/list.vue
+++ b/admin-web/src/views/foundation/material/specs/list.vue
@@ -1,7 +1,7 @@
 <template>
   <win-md title="瑙勬牸鍨嬪彿" @close="close" :width="'800px'">
     <!--鍒楄〃-->
-    <my-table-v2 ref="myTable" :table="table"/>
+    <my-table-v2 ref="myTable" :filter="{goodsTemplatesId: setting.goodsTemplatesId}" :table="table"/>
     <div slot="footer" align="center" class="dialog-footer">
       <my-button name="鍙栨秷" site="form" @click="close"/>
     </div>
@@ -12,7 +12,7 @@
 <script>
 import winMd from '@/components/win/win-md'
 import myButton from '@/components/myButton/myButton'
-import {delSpecs} from "@/api/foudation/material";
+import {delSpecs, updSpecsStatus} from "@/api/foudation/material";
 import specsAdd from "@/views/foundation/material/specs/specsAdd.vue";
 import {mapGetters} from 'vuex'
 import MyTableV2 from "@/components/myTable/myTableV2.vue";
@@ -37,6 +37,7 @@
       },
       // 琛ㄦ牸鏁版嵁
       table: {
+        autoLoad: false,
         showIndex: true, // 鏄惁鏄剧ず搴忓彿
         expand: false, // 鏄惁鏄剧ず璇︽儏鏁版嵁
         dataIndex: 'goodsTemplatesId',
@@ -61,8 +62,8 @@
         },
         // 鍒椾俊鎭�
         columns: [
-          {title: '瑙勬牸鍨嬪彿', field: 'goodsCode', align: 'left', minWidth: 120},
-          {title: '鍗曚綅', field: 'classification', align: 'center', width: 100},
+          {title: '瑙勬牸鍨嬪彿', field: 'modelName', align: 'left', minWidth: 120},
+          {title: '鍗曚綅', field: 'unit', align: 'center', width: 100},
           {
             field: 'states',
             title: '鐘舵��',
@@ -105,7 +106,7 @@
           ],
         },
         paging: {
-          show: true, // 鏄剧ず鍒嗛〉
+          show: false, // 鏄剧ず鍒嗛〉
           // 鍒嗛〉淇℃伅
           page: {
             small: false,
@@ -120,23 +121,45 @@
   computed: {
     ...mapGetters(['userInfo'])
   },
-  created() {
+  mounted() {
+    this.$nextTick(() => {
+      this.search()
+    })
+
   },
   methods: {
-    showAdd(){
-      this.specsSetting.mid = this.setting.id;//鐗╁搧ID
+    showAdd() {
+      this.specsSetting.goodsTemplatesId = this.setting.goodsTemplatesId;//鐗╁搧ID
       this.specsSetting.show = true;
+    },
+    updState(row) {
+      let vm = this
+      let text = row.states == 0 ? "鍚敤" : "绂佺敤";
+      vm.$modal.confirm('纭瑕�' + text + '"' + row.modelName + '"瑙勬牸鍚楋紵').then(function () {
+        let params = Object.assign({}, row)
+        params.states = row.states == 1 ? 0 : 1
+        updSpecsStatus(params).then(res => {
+          if (res) {
+            row.states = row.states === 1 ? 0 : 1
+            vm.$modal.msgSuccess(text + "鎴愬姛");
+            vm.search()
+          }
+        })
+      })
     },
     del(row) {
       this.$modal
-        .confirm('鏄惁纭鍒犻櫎鍚嶇О涓�"' + row.categoryName + '"鐨勬満鏋勫悧锛�')
+        .confirm('鏄惁纭鍒犻櫎鍚嶇О涓�"' + row.modelName + '"鐨勮鏍煎悧锛�')
         .then(function () {
-          delSpecs({ id: row.id }).then((res) => {});
+          delSpecs({id: row.id}).then((res) => {
+          });
         })
         .then((res) => {
-          this.$message.success('鍒犻櫎鎴愬姛锛�');this.$refs.myTable.search();
+          this.$message.success('鍒犻櫎鎴愬姛锛�');
+          this.$refs.myTable.search();
         })
-        .catch(() => {});
+        .catch(() => {
+        });
     },
     close() {
       this.$emit('close')

--
Gitblit v1.9.1