Przeglądaj źródła

川北lis系统对接调整

shenqilong 9 miesięcy temu
rodzic
commit
632ca31db8

+ 90 - 32
src/views/component/sampleDisposalRecords/sampleDisposalRecordsbc.vue

@@ -1,14 +1,28 @@
 <template>
 <template>
   <div>
   <div>
     <el-row type="flex">
     <el-row type="flex">
-      <el-col :span="4">
+      <el-col :span="5">
+        <el-form-item label="查询日期">
+          <el-date-picker
+            :disabled="isdisabled"
+            v-model="formSearch.chaxunrqi"
+            type="date"
+            value-format="yyyy-MM-dd"
+            format="yyyy-MM-dd"
+            placeholder="请选择"
+            @change="searchClick"
+            :clearable="false"
+          />
+        </el-form-item>
+      </el-col>
+      <el-col :span="5">
         <el-form-item label="专业组">
         <el-form-item label="专业组">
           <el-select
           <el-select
             v-model="formSearch.group"
             v-model="formSearch.group"
             placeholder="请选择"
             placeholder="请选择"
             value-key="GROUPCODE"
             value-key="GROUPCODE"
             :disabled="isdisabled"
             :disabled="isdisabled"
-            clearable
+            @change="searchClick"
           >
           >
             <el-option
             <el-option
               v-for="item in configList"
               v-for="item in configList"
@@ -45,20 +59,8 @@
           </el-input>
           </el-input>
         </el-form-item>
         </el-form-item>
       </el-col>
       </el-col>
-      <el-col :span="4">
-        <el-form-item label="查询日期">
-          <el-date-picker
-            :disabled="isdisabled"
-            v-model="formSearch.chaxunrqi"
-            type="date"
-            value-format="yyyy-MM-dd"
-            format="yyyy-MM-dd"
-            placeholder="请选择"
-            :clearable="true"
-          />
-        </el-form-item>
-      </el-col>
-      <el-col :span="3"> </el-col>
+
+      <el-col :span="1"> </el-col>
       <el-col :span="1">
       <el-col :span="1">
         <el-button type="primary" size="mini" plain @click="searchClick">
         <el-button type="primary" size="mini" plain @click="searchClick">
           查询
           查询
@@ -69,6 +71,7 @@
     <el-row type="flex">
     <el-row type="flex">
       <el-col>
       <el-col>
         <el-table
         <el-table
+          v-loading="loading"
           row-key="INSPECTION_ID"
           row-key="INSPECTION_ID"
           ref="listable"
           ref="listable"
           :data="lisDataFilter"
           :data="lisDataFilter"
@@ -188,7 +191,9 @@ export default {
       formSearchOld: {
       formSearchOld: {
         group: {},
         group: {},
         chaxunrqi: ''
         chaxunrqi: ''
-      }
+      },
+      allList: [],
+      loading: false
     }
     }
   },
   },
   created() {
   created() {
@@ -197,7 +202,6 @@ export default {
   },
   },
   computed: {
   computed: {
     lisDataFilter() {
     lisDataFilter() {
-      console.log(this.lisData)
       return this.lisData.slice(
       return this.lisData.slice(
         (this.requestPage.pageNo - 1) * this.requestPage.limit,
         (this.requestPage.pageNo - 1) * this.requestPage.limit,
         (this.requestPage.pageNo - 1) * this.requestPage.limit +
         (this.requestPage.pageNo - 1) * this.requestPage.limit +
@@ -233,6 +237,42 @@ export default {
           this.getConfigList()
           this.getConfigList()
         }
         }
       }
       }
+    },
+    'formSearch.tiaomahao': {
+      handler(value, old) {
+        if (value && !this.formSearch.group.GROUPCODE) {
+          this.formSearch.tiaomahao = ''
+          this.$message({
+            message: '请先选择专业组',
+            type: 'warning'
+          })
+        }
+      },
+      deep: true
+    },
+    'formSearch.xingming': {
+      handler(value, old) {
+        if (value && !this.formSearch.group.GROUPCODE) {
+          this.formSearch.xingming = ''
+          this.$message({
+            message: '请先选择专业组',
+            type: 'warning'
+          })
+        }
+      },
+      deep: true
+    },
+    'formSearch.yizhu': {
+      handler(value, old) {
+        if (value && !this.formSearch.group.GROUPCODE) {
+          this.formSearch.yizhu = ''
+          this.$message({
+            message: '请先选择专业组',
+            type: 'warning'
+          })
+        }
+      },
+      deep: true
     }
     }
   },
   },
   mounted() {},
   mounted() {},
@@ -247,18 +287,19 @@ export default {
               return (item.GROUPCODE = this.sumData[0].zhuanYeZuCode)
               return (item.GROUPCODE = this.sumData[0].zhuanYeZuCode)
             })
             })
             this.formSearch.chaxunrqi = this.sumData[0].baoCunShiJian
             this.formSearch.chaxunrqi = this.sumData[0].baoCunShiJian
+
             this.searchClick()
             this.searchClick()
           }
           }
         })
         })
         .catch((error) => {
         .catch((error) => {
-          reject(error)
+          // reject(error)
         })
         })
     },
     },
     //获取lis信息
     //获取lis信息
     async searchClick() {
     async searchClick() {
       if (!this.formSearch.group?.GROUPCODE) {
       if (!this.formSearch.group?.GROUPCODE) {
         this.$message({
         this.$message({
-          message: '请选择专业组',
+          message: '请选择专业组',
           type: 'warning'
           type: 'warning'
         })
         })
         return
         return
@@ -272,7 +313,7 @@ export default {
       }
       }
       this.requestPage.limit = 10
       this.requestPage.limit = 10
       this.requestPage.pageNo = 1
       this.requestPage.pageNo = 1
-
+      this.loading = true
       await getSampleList([
       await getSampleList([
         {
         {
           STATE: this.isdisabled ? '1,2' : '1', //编辑 1,2   添加 1
           STATE: this.isdisabled ? '1,2' : '1', //编辑 1,2   添加 1
@@ -285,19 +326,26 @@ export default {
         }
         }
       ])
       ])
         .then((res) => {
         .then((res) => {
+          this.loading = false
           this.lisData = res.data
           this.lisData = res.data
           if (
           if (
             this.formSearchOld.group != this.formSearch.group ||
             this.formSearchOld.group != this.formSearch.group ||
             this.formSearchOld.chaxunrqi != this.formSearch.chaxunrqi
             this.formSearchOld.chaxunrqi != this.formSearch.chaxunrqi
           ) {
           ) {
+            this.lisData = res.data || []
+            this.allList = this.lisData.map((item, index) => {
+              return item.INSPECTION_ID
+            })
             this.$refs.listable.clearSelection()
             this.$refs.listable.clearSelection()
             this.multipleSelection = []
             this.multipleSelection = []
+            this.sumData[0].tiaoMaHao = ''
           }
           }
           this.formSearchOld.group = this.formSearch.group
           this.formSearchOld.group = this.formSearch.group
           this.formSearchOld.chaxunrqi = this.formSearch.chaxunrqi
           this.formSearchOld.chaxunrqi = this.formSearch.chaxunrqi
         })
         })
         .catch((error) => {
         .catch((error) => {
-          reject(error)
+          this.loading = false
+          // reject(error)
         })
         })
 
 
       this.sumData[0].heJi = this.multipleSelection.length
       this.sumData[0].heJi = this.multipleSelection.length
@@ -309,27 +357,32 @@ export default {
         this.formSearch.chaxunrqi,
         this.formSearch.chaxunrqi,
         Number(this.formSearch.group.SAVEDAY || 0)
         Number(this.formSearch.group.SAVEDAY || 0)
       )
       )
-      this.sumData[0].tiaoMaHao = this.multipleSelection
-        .map((obj, index) => {
-          return obj.INSPECTION_ID
-        })
-        .join(',')
+      // this.sumData[0].tiaoMaHao = this.multipleSelection
+      //   .map((obj, index) => {
+      //     return obj.INSPECTION_ID
+      //   })
+      //   .join(',')
     },
     },
 
 
     handleSelectionChange(val) {
     handleSelectionChange(val) {
       this.multipleSelection = val
       this.multipleSelection = val
       // console.log(this.multipleSelection)
       // console.log(this.multipleSelection)
       this.sumData[0].heJi = this.multipleSelection.length
       this.sumData[0].heJi = this.multipleSelection.length
-      this.sumData[0].tiaoMaHao = this.multipleSelection
-        .map((obj, index) => {
+      // this.sumData[0].tiaoMaHao = this.multipleSelection
+      //   .map((obj, index) => {
+      //     return obj.INSPECTION_ID
+      //   })
+      //   .join(',')
+
+      this.sumData[0].tiaoMaHao = this.arrayDifferenceWithSet(
+        this.allList,
+        this.multipleSelection.map((obj, index) => {
           return obj.INSPECTION_ID
           return obj.INSPECTION_ID
         })
         })
-        .join(',')
+      ).join(',')
     },
     },
     //全选事件
     //全选事件
     handleSelectAll(selection) {
     handleSelectAll(selection) {
-      console.log(this.multipleSelection.length)
-
       if (this.multipleSelection.length > 0) {
       if (this.multipleSelection.length > 0) {
         this.lisData.forEach((row) => {
         this.lisData.forEach((row) => {
           const select = this.$refs.listable.selection.find((select) => {
           const select = this.$refs.listable.selection.find((select) => {
@@ -368,6 +421,11 @@ export default {
       const month = String(date.getMonth() + 1).padStart(2, '0')
       const month = String(date.getMonth() + 1).padStart(2, '0')
       const day = String(date.getDate()).padStart(2, '0')
       const day = String(date.getDate()).padStart(2, '0')
       return `${year}-${month}-${day}`
       return `${year}-${month}-${day}`
+    },
+
+    arrayDifferenceWithSet(mainArray, excludeArray) {
+      const excludeSet = new Set(excludeArray) // 将排除数组转为Set对象(查找更快)
+      return mainArray.filter((item) => !excludeSet.has(item)) // 使用Set的has方法判断是否存在
     }
     }
   }
   }
 }
 }

+ 60 - 33
src/views/component/sampleDisposalRecords/sampleDisposalRecordsqz.vue

@@ -1,14 +1,26 @@
 <template>
 <template>
   <div>
   <div>
     <el-row type="flex">
     <el-row type="flex">
-      <el-col :span="4">
+      <el-col :span="5">
+        <el-form-item label="查询日期">
+          <el-date-picker
+            :disabled="isdisabled"
+            v-model="formSearch.chaxunrqi"
+            type="date"
+            value-format="yyyy-MM-dd"
+            format="yyyy-MM-dd"
+            placeholder="请选择"
+            :clearable="false"
+          />
+        </el-form-item>
+      </el-col>
+      <el-col :span="5">
         <el-form-item label="专业组">
         <el-form-item label="专业组">
           <el-select
           <el-select
             v-model="formSearch.group"
             v-model="formSearch.group"
             placeholder="请选择"
             placeholder="请选择"
             value-key="GROUPCODE"
             value-key="GROUPCODE"
             :disabled="isdisabled"
             :disabled="isdisabled"
-            clearable
           >
           >
             <el-option
             <el-option
               v-for="item in configList"
               v-for="item in configList"
@@ -45,20 +57,8 @@
           </el-input>
           </el-input>
         </el-form-item>
         </el-form-item>
       </el-col>
       </el-col>
-      <el-col :span="4">
-        <el-form-item label="查询日期">
-          <el-date-picker
-            :disabled="isdisabled"
-            v-model="formSearch.chaxunrqi"
-            type="date"
-            value-format="yyyy-MM-dd"
-            format="yyyy-MM-dd"
-            placeholder="请选择"
-            :clearable="true"
-          />
-        </el-form-item>
-      </el-col>
-      <el-col :span="3"> </el-col>
+
+      <el-col :span="1"> </el-col>
       <el-col :span="1">
       <el-col :span="1">
         <el-button type="primary" size="mini" plain @click="searchClick">
         <el-button type="primary" size="mini" plain @click="searchClick">
           查询
           查询
@@ -69,6 +69,7 @@
     <el-row type="flex">
     <el-row type="flex">
       <el-col>
       <el-col>
         <el-table
         <el-table
+          v-loading="loading"
           row-key="INSPECTION_ID"
           row-key="INSPECTION_ID"
           ref="listable"
           ref="listable"
           :data="lisDataFilter"
           :data="lisDataFilter"
@@ -169,7 +170,7 @@ export default {
     }
     }
   },
   },
   data() {
   data() {
-    console.log(this.formData, this.readonly, this.params)
+    // console.log(this.formData, this.readonly, this.params)
     const { bizKey = '' } = this.params
     const { bizKey = '' } = this.params
     return {
     return {
       bizKey,
       bizKey,
@@ -194,7 +195,9 @@ export default {
       formSearchOld: {
       formSearchOld: {
         group: {},
         group: {},
         chaxunrqi: ''
         chaxunrqi: ''
-      }
+      },
+      allList: [],
+      loading: false
     }
     }
   },
   },
   created() {
   created() {
@@ -260,7 +263,7 @@ export default {
           }
           }
         })
         })
         .catch((error) => {
         .catch((error) => {
-          reject(error)
+          // reject(error)
         })
         })
     },
     },
     //获取lis信息
     //获取lis信息
@@ -281,7 +284,7 @@ export default {
       }
       }
       this.requestPage.limit = 10
       this.requestPage.limit = 10
       this.requestPage.pageNo = 1
       this.requestPage.pageNo = 1
-
+      this.loading = true
       await getSampleList([
       await getSampleList([
         {
         {
           STATE: this.isread ? '2,4' : '2', //查阅 2,4   弃置 2
           STATE: this.isread ? '2,4' : '2', //查阅 2,4   弃置 2
@@ -294,18 +297,24 @@ export default {
         }
         }
       ])
       ])
         .then((res) => {
         .then((res) => {
-          this.lisData = res.data
+          this.loading = false
+          this.lisData = res.data || []
           if (
           if (
             this.formSearchOld.group != this.formSearch.group ||
             this.formSearchOld.group != this.formSearch.group ||
             this.formSearchOld.chaxunrqi != this.formSearch.chaxunrqi
             this.formSearchOld.chaxunrqi != this.formSearch.chaxunrqi
           ) {
           ) {
             this.multipleSelection = []
             this.multipleSelection = []
+            this.allList = this.lisData.map((item, index) => {
+              return item.INSPECTION_ID
+            })
+            this.sumData[0].tiaoMaHao = ''
           }
           }
           this.formSearchOld.group = this.formSearch.group
           this.formSearchOld.group = this.formSearch.group
           this.formSearchOld.chaxunrqi = this.formSearch.chaxunrqi
           this.formSearchOld.chaxunrqi = this.formSearch.chaxunrqi
         })
         })
         .catch((error) => {
         .catch((error) => {
-          reject(error)
+          this.loading = false
+          // reject(error)
         })
         })
     },
     },
     handleSelectionChange(val) {
     handleSelectionChange(val) {
@@ -313,28 +322,41 @@ export default {
       // console.log(this.multipleSelection)
       // console.log(this.multipleSelection)
       this.sumData[0].chuLiShuLiang =
       this.sumData[0].chuLiShuLiang =
         this.yiqizhishuliang + this.multipleSelection.length
         this.yiqizhishuliang + this.multipleSelection.length
-      this.sumData[0].qiZhiTiaoMaHao = this.multipleSelection
-        .map((obj, index) => {
+
+      // this.sumData[0].qiZhiTiaoMaHao = this.multipleSelection
+      //   .map((obj, index) => {
+      //     return obj.INSPECTION_ID
+      //   })
+      //   .join(',')
+
+      this.sumData[0].qiZhiTiaoMaHao = this.arrayDifferenceWithSet(
+        this.allList,
+        this.multipleSelection.map((obj, index) => {
           return obj.INSPECTION_ID
           return obj.INSPECTION_ID
         })
         })
-        .join(',')
+      ).join(',')
+
       this.sumData[0].shiFouGuoShen =
       this.sumData[0].shiFouGuoShen =
         Number(this.sumData[0].heJi || 0) >
         Number(this.sumData[0].heJi || 0) >
         Number(this.sumData[0].chuLiShuLiang || 0)
         Number(this.sumData[0].chuLiShuLiang || 0)
           ? '待弃置'
           ? '待弃置'
           : '已弃置'
           : '已弃置'
     },
     },
-    //全选事件
+
     //全选事件
     //全选事件
     handleSelectAll(selection) {
     handleSelectAll(selection) {
-      this.lisData.forEach((row) => {
-        const select = this.$refs.listable.selection.find((select) => {
-          return select.INSPECTION_ID === row.INSPECTION_ID
+      if (this.multipleSelection.length > 0) {
+        this.lisData.forEach((row) => {
+          const select = this.$refs.listable.selection.find((select) => {
+            return select.INSPECTION_ID === row.INSPECTION_ID
+          })
+          if (!select) {
+            this.$refs.listable.toggleRowSelection(row)
+          }
         })
         })
-        if (!select) {
-          this.$refs.listable.toggleRowSelection(row, true)
-        }
-      })
+      } else {
+        this.$refs.listable.clearSelection()
+      }
     },
     },
     // 当前页码改变
     // 当前页码改变
     handleCurrentChange(val) {
     handleCurrentChange(val) {
@@ -353,6 +375,11 @@ export default {
       const month = String(date.getMonth() + 1).padStart(2, '0')
       const month = String(date.getMonth() + 1).padStart(2, '0')
       const day = String(date.getDate()).padStart(2, '0')
       const day = String(date.getDate()).padStart(2, '0')
       return `${year}-${month}-${day}`
       return `${year}-${month}-${day}`
+    },
+
+    arrayDifferenceWithSet(mainArray, excludeArray) {
+      const excludeSet = new Set(excludeArray) // 将排除数组转为Set对象(查找更快)
+      return mainArray.filter((item) => !excludeSet.has(item)) // 使用Set的has方法判断是否存在
     }
     }
   }
   }
 }
 }