From 3cbb9eb9e6f594721239bde5754db6df924472a6 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期六, 27 八月 2022 10:33:06 +0800
Subject: [PATCH] 1.工序检验记录开发完成

---
 src/views/zlgl/gxjy.vue   |   10 +-
 src/views/zlgl/gxjyjl.vue |   12 ++
 src/views/sbgl/djbz.vue   |  138 +++++++++++++++++++++++-----------
 src/views/zlgl/gxjybz.vue |   49 +++--------
 4 files changed, 123 insertions(+), 86 deletions(-)

diff --git a/src/views/sbgl/djbz.vue b/src/views/sbgl/djbz.vue
index e4d0130..4ab6079 100644
--- a/src/views/sbgl/djbz.vue
+++ b/src/views/sbgl/djbz.vue
@@ -155,8 +155,8 @@
       :close-on-click-modal="false"
       top="8vh"
       @closed="handleClose"
-      @close="handleClose"
     >
+      <!--      @close="handleClose"-->
       <div>
         <i class="el-icon-s-operation" style="color:#42b983;margin: -20px 10px 20px 0" />璁惧鐐规鏍囧噯淇℃伅
       </div>
@@ -415,7 +415,7 @@
 import { getCookie } from '@/utils/auth'
 import ImportPicker from '@/components/ImportPicker'
 import {
-  AddUpdateDeviceCheckStandArd,
+  AddUpdateDeviceCheckStandArd, DeleteDeviceCheckStaned,
   DeviceCheckItemSelect,
   DeviceCheckStandArdSearch,
   ViewDeviceCheckStanedSearch
@@ -488,9 +488,9 @@
         ]
       },
       tableDataDialog: [], // 琛ㄦ牸鏁版嵁
-      tableDataDialogSelected: [], // 宸查�塩ode
+      // tableDataDialogSelected: [], // 宸查�塩ode
       checkItemSelectArr: [],
-
+      checkItemIsCancel: true,
       dialogVisibleEqp: false,
 
       dialogFormEqp: {
@@ -523,6 +523,8 @@
   mounted() {
     window.addEventListener('resize', this.getHeight)
     this.getHeight()
+
+    this.getDeviceCheckItemSelect()
   },
   methods: {
     async getDeviceCheckStandArdSearch() {
@@ -558,10 +560,9 @@
     },
     // 閲嶇疆
     reset() {
-      this.form.OrgCode = ''
-      this.form.OrgName = ''
-      this.form.OrgType = ''
-      this.form.UserName = ''
+      this.form.checkstandcode = ''
+      this.form.checkstandname = ''
+      this.form.checkcontr = ''
       this.getDeviceCheckStandArdSearch()
     },
 
@@ -574,25 +575,46 @@
     add(operation) {
       this.operation = operation
       this.dialogVisible = true
-      this.getDeviceCheckItemSelect()
+      // this.getDeviceCheckItemSelect()
       this.$nextTick(() => {
         this.$refs.tableDataDialogRef.doLayout()
       })
     },
     // 淇敼鎸夐挳
     edit(operation, row) {
+      // this.getDeviceCheckItemSelect()
       this.operation = operation
+      this.getViewDeviceCheckStanedSearch(row.code)
       this.dialogVisible = true
-      this.getDeviceCheckItemSelect()
+
       this.$nextTick(() => {
         this.$refs.tableDataDialogRef.doLayout()
       })
-      this.$nextTick(() => {
-        this.dialogForm.code = row.code
-        this.dialogForm.name = row.name
-        this.dialogForm.enable = row.enable
-        this.dialogForm.description = row.description
+      // this.$nextTick(() => {
+      //   this.dialogForm.code = row.code
+      //   this.dialogForm.name = row.name
+      //   this.dialogForm.enable = row.enable
+      //   this.dialogForm.description = row.description
+      // })
+    },
+    // 淇敼鍓嶈姹傛帴鍙�
+    async getViewDeviceCheckStanedSearch(checkstand_code) {
+      const { data: res } = await ViewDeviceCheckStanedSearch({ checkstand_code })
+      this.tableDataDialog = res.Data
+
+      this.dialogForm.code = res.code
+      this.dialogForm.name = res.name
+      this.dialogForm.enable = res.enable
+      this.dialogForm.description = res.description
+
+      this.tableDataDialog.forEach(item => {
+        item.isVisible = 0
+        item.checkitem_code = item.code
+        item.checkitem_name = item.name
+        item.checkitem_descr = item.chkdesc
       })
+
+      this.checkItemSelectArr = [...this.checkItemSelectArr].filter(x => [...this.tableDataDialog].every(y => y.checkitem_code !== x.code))
     },
     // 鍒犻櫎鎸夐挳
     async del(row) {
@@ -601,7 +623,7 @@
         cancelButtonText: '鍙栨秷',
         type: 'warning'
       }).then(() => {
-        DeleteOrganization({ orgid: row.code }).then(res => {
+        DeleteDeviceCheckStaned({ checkstand_code: row.code }).then(res => {
           if (res.code === '200') {
             this.$message.success('鍒犻櫎鎴愬姛!')
             this.getDeviceCheckStandArdSearch()
@@ -611,10 +633,7 @@
         this.$message.info('宸插彇娑堝垹闄�')
       })
     },
-    // 淇敼鍓嶈姹傛帴鍙�
-    // async    getViewDeviceCheckStanedSearch(checkstand_code) {
-    //   const { data: res } = await ViewDeviceCheckStanedSearch()
-    // },
+
     // 瀵硅瘽妗嗗叧闂簨浠�
     handleClose() {
       this.dialogForm.code = ''
@@ -622,6 +641,7 @@
       this.dialogForm.enable = 'Y'
       this.dialogForm.description = ''
       this.tableDataDialog = []
+      this.getDeviceCheckItemSelect()
       this.$refs.dialogForm.clearValidate()
     },
     // 瀵硅瘽妗嗗彇娑�
@@ -632,6 +652,14 @@
     dialogVisibleConfirm() {
       this.$refs.dialogForm.validate(valid => {
         if (valid) {
+          // this.tableDataDialog.forEach((item, index) => { // 鍘绘帀姝e湪缂栬緫涓旀槸绌篶heckitem_code
+          //   if (item.isVisible === 1 && item.checkitem_code === '') {
+          //     this.tableDataDialog.splice(index, 1)
+          //   }
+          // })
+
+          this.tableDataDialog.filter(item => item.checkitem_code !== '')
+
           let Data = []
           // 鏁扮粍涓璞$浉鍚岀殑鍘婚噸
           Data = this.tableDataDialog.filter((currentValue, currentIndex, selfArr) => {
@@ -669,16 +697,6 @@
       row.checkitem_descr = res.description
       row.checkitem_code = res.code
       row.checkitem_name = res.name
-      // row.checkitem_descr = this.checkItemSelectArr.find(item => {
-      //   return item.code === val || item.name === val
-      // }).description
-      //
-      // row.checkitem_code = this.checkItemSelectArr.find(item => {
-      //   return item.code === val || item.name === val
-      // }).code
-      // row.checkitem_name = this.checkItemSelectArr.find(item => {
-      //   return item.code === val || item.name === val
-      // }).name
     },
     // 鏂板琛�
     addRow() {
@@ -700,12 +718,25 @@
         cycle: 'D',
         isVisible: 1
       })
+
+      this.checkItemIsCancel = false
     },
     editRow(row) {
-      this.tableDataDialogSelected.forEach((item, index) => {
-        if (item === row.checkitem_code) {
-          this.tableDataDialogSelected.splice(index, 1)
+      let flag = false
+      this.tableDataDialog.forEach((item, index) => {
+        if (item.isVisible === 1) {
+          flag = true
         }
+      })
+      if (flag) {
+        return this.$message.info('璇峰厛纭鎴栧彇娑堝叾瀹冭锛�')
+      }
+
+      this.checkItemIsCancel = false
+      this.checkItemSelectArr.splice(0, 0, {
+        code: row.checkitem_code,
+        name: row.checkitem_name,
+        description: row.checkitem_descr
       })
 
       this.tableDataDialog.forEach((item, index) => {
@@ -722,30 +753,45 @@
       })
     },
     delRow(row) {
+      console.log(row)
+      this.checkItemSelectArr.splice(0, 0, {
+        code: row.checkitem_code,
+        name: row.checkitem_name,
+        description: row.checkitem_descr
+      })
       this.tableDataDialog.forEach((item, index) => {
         if (item.checkitem_code === row.checkitem_code) {
           this.tableDataDialog.splice(index, 1)
         }
       })
-
-      this.tableDataDialogSelected.forEach((item, index) => {
-        if (item === row.checkitem_code) {
-          this.tableDataDialogSelected.splice(index, 1)
+    },
+    saveRow(row) {
+      if (row.checkitem_code === '' && row.checkitem_name === '') {
+        return this.$message.info('鐐规閮ㄤ綅涓嶈兘涓虹┖锛�')
+      }
+      row.isVisible = 0
+      this.checkItemSelectArr.forEach((item, index) => {
+        if (item.code === row.checkitem_code) {
+          this.checkItemSelectArr.splice(index, 1)
         }
       })
     },
-    saveRow(row) {
-      if (this.tableDataDialogSelected.includes(row.checkitem_code)) {
-        return this.$message.info('鐐规閮ㄤ綅涓嶈兘閫夋嫨鐩稿悓锛�')
-      }
-      this.tableDataDialogSelected.push(row.checkitem_code)
-      row.isVisible = 0
-      console.log(this.tableDataDialog)
-    },
     cancelRow(row) {
+      // this.checkItemSelectArr.forEach((item, index) => {
+      //   if (item.code === row.checkitem_code) {
+      if (this.checkItemIsCancel) {
+        this.checkItemSelectArr.splice(0, 0, {
+          code: row.checkitem_code,
+          name: row.checkitem_name,
+          description: row.checkitem_descr
+        })
+      }
+      this.JYIsCancel = true
+      // }
+      // })
+
       this.tableDataDialog.forEach((item, index) => {
         if (item.checkitem_code === row.checkitem_code && item.isVisible === 1) {
-          console.log(item)
           row.isVisible = 0
           this.tableDataDialog.splice(index, 1)
         }
diff --git a/src/views/zlgl/gxjy.vue b/src/views/zlgl/gxjy.vue
index e5ef964..effdc69 100644
--- a/src/views/zlgl/gxjy.vue
+++ b/src/views/zlgl/gxjy.vue
@@ -128,7 +128,7 @@
             <div style="color: red;width:10px">*</div>
             妫�楠屾暟閲忥細
           </div>
-          <el-input v-model="checkCount" oninput="value=value.replace(/[^0-9]/g,'')" style="width: 200px" />
+          <el-input v-model="checkqty" oninput="value=value.replace(/[^0-9]/g,'')" style="width: 200px" />
         </div>
 
         <!--   妫�楠岀粨鏋�   鍜�  妫�楠屽娉�      -->
@@ -380,7 +380,7 @@
       checkStandard: '', // 妫�楠屾爣鍑�
       checkStandardSelect: [], // 妫�楠屾爣鍑嗕笅鎷夋暟缁�
       checkUser: '', // 妫�楠屼汉鍛�
-      checkCount: 0, // 妫�楠屾暟閲�
+      checkqty: 0, // 妫�楠屾暟閲�
       checkUserSelect: [], // 妫�楠屼汉鍛樹笅鎷夋暟缁�
       checkResult: '', // 妫�楠岀粨鏋�
       checkResultSelect: [
@@ -605,7 +605,7 @@
         if (this.checkUser.length < 1) {
           return this.$message.info('妫�楠屼汉鍛樹笉鑳戒负绌猴紒')
         }
-        if (parseFloat(this.checkCount) > 0) {
+        if (parseFloat(this.checkqty) <= 0) {
           return this.$message.info('妫�楠屾暟閲忓繀椤昏澶т簬闆讹紒')
         }
         if (this.JYTableData.length < 1) {
@@ -622,6 +622,7 @@
           type: 'warning'
         }).then(() => {
           const arr = []
+          this.JYTableData = this.JYTableData.filter(item => item.code !== '')
           this.JYTableData.forEach((item, index) => {
             arr.push({
               code: item.code,
@@ -637,6 +638,7 @@
             'stepcode': this.form.stepcode, // 宸ュ簭缂栫爜
             'checkstanedcode': this.checkStandard, // 妫�楠屾爣鍑嗙紪鐮�
             'checkusercode': this.checkUser, // 妫�楠屼汉鍛樼紪鐮�
+            'checkqty': this.checkqty, // 妫�楠屾暟閲�
             'checktypecode': val, // 妫�楠岀被鍨嬬紪鐮�
             'checkresult': this.checkResult, // 妫�楠岀粨鏋�(OK(鍚堟牸) NG(涓嶈壇))
             'checkdescr': this.checkdescr, // 妫�楠屾弿杩�
@@ -665,7 +667,7 @@
       this.multipleSelection = []
       this.checkdescr = ''
       this.checkUser = ''
-      this.checkCount = 0
+      this.checkqty = 0
       this.checkResult = ''
       this.checkStandard = ''
       this.form.orderstepqrcode = ''
diff --git a/src/views/zlgl/gxjybz.vue b/src/views/zlgl/gxjybz.vue
index 59176f3..29e8212 100644
--- a/src/views/zlgl/gxjybz.vue
+++ b/src/views/zlgl/gxjybz.vue
@@ -127,8 +127,8 @@
       :top="isIpad?'5vh':'15vh'"
       :close-on-click-modal="false"
       @closed="handleClose"
-      @close="handleClose"
     >
+      <!--      @close="handleClose"-->
       <div style="margin-bottom: 10px">
         <i class="el-icon-s-comment" style="color:#42b983;" /> 鏍囧噯淇℃伅锛�
       </div>
@@ -159,7 +159,7 @@
         <i class="el-icon-s-comment" style="color:#42b983;" /> 妫�楠岄」淇℃伅锛�
       </div>
       <div style="margin-bottom: 10px">
-        <el-button v-if="operation==='add'" type="primary" @click="JYadd">鏂板</el-button>
+        <el-button v-if="operation==='add'||operation==='edit'" type="primary" @click="JYadd">鏂板</el-button>
       </div>
       <div>
         <el-table
@@ -179,33 +179,6 @@
             width="100"
             fixed
           />
-          <!--          <el-table-column-->
-          <!--            prop="code"-->
-          <!--            label="妫�楠屾爣鍑嗙紪鐮�(鍚嶇О)"-->
-          <!--          >-->
-          <!--            <template slot-scope="{row}">-->
-          <!--              <div v-if="row.isVisible===0" style="display: flex;">-->
-          <!--                <div>{{ row.code }}</div>-->
-          <!--                <div style="margin-left: 10px">{{ row.name }}</div>-->
-          <!--              </div>-->
-          <!--              <el-select-->
-          <!--                v-if="row.isVisible===1"-->
-          <!--                v-model="row.code"-->
-          <!--                filterable-->
-          <!--                :popper-append-to-body="false"-->
-          <!--                style="width: 400px;"-->
-          <!--                placeholder="璇烽�夋嫨"-->
-          <!--                @change="val=>changeCode(val,row)"-->
-          <!--              >-->
-          <!--                <el-option-->
-          <!--                  v-for="item in JYSelectArr"-->
-          <!--                  :key="item.code"-->
-          <!--                  :label="item.code+''+item.name"-->
-          <!--                  :value="item.code"-->
-          <!--                />-->
-          <!--              </el-select>-->
-          <!--            </template>-->
-          <!--          </el-table-column>-->
           <el-table-column
             prop="code"
             label="妫�楠屾爣鍑嗙紪鐮�"
@@ -445,6 +418,8 @@
       this.$nextTick(() => {
         this.$refs.JYTableData.doLayout()
       })
+
+      this.JYSelectArr = [...this.JYSelectArr].filter(x => [...this.JYTableData].every(y => y.code !== x.code))
     },
     // 鍒犻櫎鎸夐挳
     async del(row) {
@@ -482,6 +457,7 @@
       this.$refs.dialogForm.validate(valid => {
         if (valid) {
           const tableData = []
+          this.JYTableData = this.JYTableData.filter(item => item.code !== '')
           this.JYTableData.forEach((item, index) => {
             tableData.push({
               STEPCHECKITEM_SEQ: (index + 1),
@@ -524,11 +500,6 @@
       const { data: res } = await StepCheckItemSelect()
       this.JYSelectArr = res
     },
-    // 妫�楠屾爣鍑嗙紪鐮佸�兼敼鍙�
-    // changeCode(val, row) {
-    //   row.name = this.JYSelectArr.find(it => it.code === val).name
-    //   row.descr = this.JYSelectArr.find(it => it.code === val).descr
-    // },
     // 妫�楠屾爣鍑嗗悕绉板�兼敼鍙�
     changeName(val, row) {
       const res = this.JYSelectArr.find(item => {
@@ -551,6 +522,16 @@
       this.JYIsCancel = false
     },
     JYedit(row) {
+      let flag = false
+      this.JYTableData.forEach((item, index) => {
+        if (item.isVisible === 1) {
+          flag = true
+        }
+      })
+      if (flag) {
+        return this.$message.info('璇峰厛纭鎴栧彇娑堝叾瀹冭锛�')
+      }
+
       this.JYIsCancel = false
       this.JYSelectArr.splice(0, 0, {
         code: row.code,
diff --git a/src/views/zlgl/gxjyjl.vue b/src/views/zlgl/gxjyjl.vue
index f217996..647f9bc 100644
--- a/src/views/zlgl/gxjyjl.vue
+++ b/src/views/zlgl/gxjyjl.vue
@@ -195,12 +195,20 @@
           <el-table-column
             label="鎿嶄綔"
             fixed="right"
-            width="120"
+            width="80"
           >
             <template slot-scope="{row}">
               <div class="operationClass">
-                <el-button type="text" @click="check(row)">鏌ョ湅</el-button>
+                <!--                <el-button type="text" @click="check(row)">鏌ョ湅</el-button>-->
                 <!--                <el-button type="text" @click="del(row)">鍒犻櫎</el-button>-->
+
+                <el-tooltip class="item" effect="dark" content="鏌ョ湅" placement="top">
+                  <i
+                    class="el-icon-view"
+                    style="color: #42b983;cursor: pointer;margin-right: 15px;"
+                    @click="check(row)"
+                  />
+                </el-tooltip>
               </div>
             </template>
           </el-table-column>

--
Gitblit v1.9.3