From 0ac076bd5d4b37a63e250eb461c2cb6e9ea73eb6 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期五, 13 十月 2023 11:22:31 +0800
Subject: [PATCH] 1.模具清单100%  2.模具点检项100%

---
 src/views/mouldManager/mouldList.vue |  112 +++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 95 insertions(+), 17 deletions(-)

diff --git a/src/views/mouldManager/mouldList.vue b/src/views/mouldManager/mouldList.vue
index 5517990..73800c4 100644
--- a/src/views/mouldManager/mouldList.vue
+++ b/src/views/mouldManager/mouldList.vue
@@ -3,8 +3,9 @@
     <div class="body" :style="{height:mainHeight+'px'}">
       <div class="bodyTopButtonGroup" style="justify-content: space-between">
         <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button>
+        <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=12')">瀵煎叆</el-button>
         <!--        <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</el-button>-->
-        <!--        <el-button v-waves icon="el-icon-download" @click="upload">瀵煎叆</el-button>-->
+
       </div>
 
       <div class="bodyTopFormGroup">
@@ -27,7 +28,7 @@
               </el-select>
             </el-form-item>
             <el-form-item label="浣跨敤鐘舵��" style=" display: flex;">
-              <el-select v-model="form.onstate" style="width: 200px" placeholder="璇烽�夋嫨">
+              <el-select v-model="form.usestatus" style="width: 200px" placeholder="璇烽�夋嫨">
                 <el-option
                   v-for="item in onstateArr"
                   :key="item.code"
@@ -118,16 +119,17 @@
             sortable="custom"
           >
             <template slot-scope="{row}">
-              {{ row.status === 'Y' ? '姝e父' : '鏁呴殰' }}
+              <el-tag v-if="row.status==='Y'" size="small" type="success">姝e父</el-tag>
+              <el-tag v-if="row.status==='N'" size="small" type="danger">鏁呴殰</el-tag>
             </template>
           </el-table-column>
           <el-table-column
-            prop="onstate"
+            prop="usestatus"
             label="浣跨敤鐘舵��"
             sortable="custom"
           >
             <template slot-scope="{row}">
-              {{ onstateArr.find(i => parseFloat(i.code) === parseFloat(row.usestaus)).name }}
+              {{ onstateArr.find(i => parseFloat(i.code) === parseFloat(row.usestatus)).name }}
             </template>
           </el-table-column>
           <el-table-column
@@ -144,7 +146,11 @@
             prop="spec"
             label="瑙勬牸鍨嬪彿"
             sortable="custom"
-          />
+          >
+            <template slot-scope="{row}">
+              {{ row.spec ? row.spec : '/' }}
+            </template>
+          </el-table-column>
           <el-table-column
             prop="warehousename"
             label="浠撳簱鍚嶇О"
@@ -203,7 +209,7 @@
                   <i
                     class="el-icon-edit-outline"
                     :style="{color:$store.state.settings.theme}"
-                    @click="edit('edit',row)"
+                    @click="edit(row)"
                   />
                 </el-tooltip>
                 <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">
@@ -327,9 +333,10 @@
   ProductionScheduleReportExcelSearch,
   ProductionScheduleReportSearch
 } from '@/api/ReportManager'
-import { MouldMangerSearch } from '@/api/MouldManager'
+import { AddUpdateMouldManger, DeleteMouldManger, MouldMangerSearch } from '@/api/MouldManager'
 import { InventoryTreePermissions, WareHouse } from '@/api/GeneralBasicData'
 import arrayToTree from 'array-to-tree'
+import { TCunstomerDelete } from '@/api/basicSettings'
 
 export default {
   name: 'Zzjg',
@@ -345,7 +352,7 @@
       tableHeight: 0,
       form: {
         mouldstaus: '', // 妯″叿鐘舵��
-        onstate: '', // 浣跨敤鐘舵��
+        usestatus: '', // 浣跨敤鐘舵��
         mouldcode: '', // 妯″叿缂栫爜
         mouldname: '', // 妯″叿鍚嶇О
         mouldspec: '', // 妯″叿瑙勬牸鍨嬪彿
@@ -405,9 +412,9 @@
       },
 
       Inventory: [
-        { code: '-1',
-          name: '鍏ㄩ儴'
-        }
+        // { code: '-1',
+        //   name: '鍏ㄩ儴'
+        // }
       ],
 
       wareHouseArr: []
@@ -430,13 +437,13 @@
     this.getHeight()
   },
   methods: {
-    async  getInventoryTreePermissions() {
+    async getInventoryTreePermissions() {
       const res = await InventoryTreePermissions()
       res.data.forEach(i => {
         i.name = i.code + ' ' + i.name
       })
 
-      this.Inventory = arrayToTree(this.Inventory.concat(res.data), {
+      this.Inventory = arrayToTree(res.data, {
         parentProperty: 'parentid',
         customID: 'code',
         childrenProperty: 'children'
@@ -512,7 +519,7 @@
     // 閲嶇疆
     reset() {
       this.form.mouldstaus = ''
-      this.form.onstate = ''
+      this.form.usestatus = ''
       this.form.mouldcode = ''
       this.form.mouldname = ''
 
@@ -524,17 +531,88 @@
 
     add() {
       this.operation = 'add'
+      this.dialogForm.opertype = 'Add'
       this.dialogVisible = true
     },
+    edit(row) {
+      this.operation = 'edit'
+      this.dialogVisible = true
+      this.dialogForm.opertype = 'Update'
 
+      this.$nextTick(() => {
+        this.dialogForm.mouldcode = row.code
+        this.dialogForm.mouldname = row.name
+        this.dialogForm.mouldspec = row.spec
+        this.dialogForm.warehousecode = row.warehousecode
+        this.dialogForm.surplife = row.surp_life
+        this.dialogForm.resilife = row.resi_life
+        this.dialogForm.status = row.status
+        this.dialogForm.mouldpart = row.partcode ? row.partcode.split(',') : []
+        this.$refs.tree.setCheckedKeys(this.dialogForm.mouldpart)
+      })
+    },
+    del(row) {
+      this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', {
+        confirmButtonText: '纭畾',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning'
+      }).then(() => {
+        DeleteMouldManger({ mouldcode: row.code }).then(res => {
+          if (res.code === '200') {
+            this.$notify.success('鍒犻櫎鎴愬姛!')
+            this.getMouldMangerSearch()
+          }
+        })
+      }).catch(() => {
+        this.$notify.info('宸插彇娑堝垹闄�')
+      })
+    },
     handleClose() {
-
+      this.dialogForm = {
+        mouldcode: '',
+        mouldname: '',
+        mouldspec: '',
+        warehousecode: '',
+        surplife: '',
+        resilife: '',
+        status: 'Y',
+        mouldpart: '',
+        opertype: ''
+      }
+      this.$refs.dialogForm.clearValidate()
     },
     dialogVisibleCancel() {
       this.dialogVisible = false
     },
     dialogVisibleConfirm() {
-      console.log(this.$refs.tree.getCheckedKeys())
+      this.$refs.dialogForm.validate(valid => {
+        if (valid) {
+          const checkData = this.$refs.tree.getCheckedNodes()
+          this.dialogForm.mouldpart = []
+          checkData.forEach(item => {
+            if (!Object.keys(item).includes('children')) {
+              this.dialogForm.mouldpart.push(item.code)
+            }
+          })
+          if (this.dialogForm.mouldpart.length === 0) {
+            return this.$message.info('鍏宠仈浜у搧涓嶈兘涓虹┖锛�')
+          }
+          this.$store.state.app.buttonIsDisabled = true
+          AddUpdateMouldManger(this.dialogForm).then(res => {
+            if (res.code === '200') {
+              this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�')
+              this.$refs.tree.setCheckedKeys([])
+
+              this.dialogVisible = false
+              this.$store.state.app.buttonIsDisabled = false
+              this.getMouldMangerSearch()
+            } else {
+              this.$store.state.app.buttonIsDisabled = false
+              this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�')
+            }
+          })
+        }
+      })
     },
     filterNode(value, data) {
       if (!value) return true

--
Gitblit v1.9.3