From e20c8cf7ad6d2a85817c5627fc9ee7c755884d5b Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期四, 02 十一月 2023 09:22:53 +0800
Subject: [PATCH] 1.统计报表  加上车间名称的查询条件

---
 src/views/mouldManager/mouldList.vue |  235 ++++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 161 insertions(+), 74 deletions(-)

diff --git a/src/views/mouldManager/mouldList.vue b/src/views/mouldManager/mouldList.vue
index 73800c4..fcb2010 100644
--- a/src/views/mouldManager/mouldList.vue
+++ b/src/views/mouldManager/mouldList.vue
@@ -3,7 +3,13 @@
     <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="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>-->
 
       </div>
@@ -129,7 +135,8 @@
             sortable="custom"
           >
             <template slot-scope="{row}">
-              {{ onstateArr.find(i => parseFloat(i.code) === parseFloat(row.usestatus)).name }}
+              {{ row.usestatus?onstateArr.find(i => parseFloat(i.code) === parseFloat(row.usestatus)).name:'/' }}
+              <!--              {{ onstateArr.find(i => parseFloat(i.code) === parseFloat(row.usestatus)).name }}-->
             </template>
           </el-table-column>
           <el-table-column
@@ -155,22 +162,48 @@
             prop="warehousename"
             label="浠撳簱鍚嶇О"
             sortable="custom"
-          />
+          >
+            <template slot-scope="{row}">
+              {{ row.warehousename ? row.warehousename : '/' }}
+            </template>
+          </el-table-column>
           <el-table-column
-            prop="surp_life"
-            label="棰勮瀵垮懡"
+            prop="location_name"
+            label="搴撲綅鍚嶇О"
             sortable="custom"
-          />
+          >
+            <template slot-scope="{row}">
+              {{ row.location_name ? row.location_name : '/' }}
+            </template>
+          </el-table-column>
           <el-table-column
             prop="is_part"
             label="浜у搧鍏宠仈"
             sortable="custom"
           >
             <template slot-scope="{row}">
-              <el-tag v-if="row.is_part==='Y'" size="small" type="success">鏄�</el-tag>
-              <el-tag v-if="row.is_part==='N'" size="small" type="danger">鍚�</el-tag>
+              <!--              <el-tag v-if="row.is_part==='Y'" size="small" type="success">鏄�</el-tag>-->
+              <!--              <el-tag v-if="row.is_part==='N'" size="small" type="danger">鍚�</el-tag>-->
+              <i
+                v-if="row.is_part==='Y'"
+                :style="{color:$store.state.settings.theme}"
+                class="el-icon-share"
+                style="cursor: pointer"
+                @click="connectClick(row)"
+              />
+              <i
+                v-if="row.is_part==='N'"
+                class="el-icon-share"
+                style="color: rgb(180 ,181, 185);cursor:pointer;"
+                @click="connectClick(row)"
+              />
             </template>
           </el-table-column>
+          <el-table-column
+            prop="surp_life"
+            label="棰勮瀵垮懡"
+            sortable="custom"
+          />
           <el-table-column
             prop="serlife"
             label="浣跨敤瀵垮懡"
@@ -234,17 +267,25 @@
 
     <el-dialog
       v-el-drag-dialog
-      :title="operation==='add'?'鏂板':'缂栬緫'"
+      :title="operation==='add'?'鏂板':(operation==='edit'?'缂栬緫':'浜у搧鍏宠仈')"
       :visible.sync="dialogVisible"
       width="800px"
       :close-on-click-modal="false"
-      top="7vh"
+      :top="operation!=='connect'? '7vh':'15vh'"
       class="dialogFormClass"
       @closed="handleClose"
       @close="handleClose"
     >
 
-      <el-form ref="dialogForm" class="" inline :rules="dialogFormRules" :model="dialogForm" label-width="110px">
+      <el-form
+        v-if="operation!=='connect'"
+        ref="dialogForm"
+        class=""
+        inline
+        :rules="dialogFormRules"
+        :model="dialogForm"
+        label-width="110px"
+      >
         <el-divider content-position="left">鍩烘湰淇℃伅</el-divider>
         <el-form-item label="妯″叿缂栫爜" prop="mouldcode">
           <el-input v-model="dialogForm.mouldcode" :disabled="operation!=='add'" style="width: 200px" />
@@ -256,38 +297,39 @@
           <el-input v-model="dialogForm.mouldspec" style="width: 200px" />
         </el-form-item>
 
-        <el-form-item label="浠撳簱淇℃伅" prop="warehousecode">
-          <el-select
-            v-model="dialogForm.warehousecode"
-            style="width:200px"
-            placeholder="璇烽�夋嫨"
-            filterable
-            :popper-append-to-body="false"
-          >
-            <el-option
-              v-for="item in wareHouseArr"
-              :key="item.code"
-              :label="item.name"
-              :value="item.code"
-            />
-          </el-select>
-        </el-form-item>
-
-        <el-form-item label="棰勮瀵垮懡">
-          <el-input v-model="dialogForm.surplife" style="width: 200px" />
-        </el-form-item>
-        <el-form-item label="鍓╀綑瀵垮懡">
-          <el-input v-model="dialogForm.resilife" style="width: 200px" />
-        </el-form-item>
-
-        <el-form-item required label="浣跨敤鐘舵��">
+        <el-form-item required label="妯″叿鐘舵��">
           <el-radio-group v-model="dialogForm.status">
             <el-radio label="Y">姝e父</el-radio>
             <el-radio label="N">鏁呴殰</el-radio>
           </el-radio-group>
         </el-form-item>
+
+        <!--        <el-form-item label="浠撳簱淇℃伅" prop="warehousecode">-->
+        <!--          <el-select-->
+        <!--            v-model="dialogForm.warehousecode"-->
+        <!--            style="width:200px"-->
+        <!--            placeholder="璇烽�夋嫨"-->
+        <!--            filterable-->
+        <!--            :popper-append-to-body="false"-->
+        <!--          >-->
+        <!--            <el-option-->
+        <!--              v-for="item in wareHouseArr"-->
+        <!--              :key="item.code"-->
+        <!--              :label="item.name"-->
+        <!--              :value="item.code"-->
+        <!--            />-->
+        <!--          </el-select>-->
+        <!--        </el-form-item>-->
+
+        <el-form-item label="棰勮瀵垮懡">
+          <el-input v-model="dialogForm.surplife" oninput="value=value.replace(/[^0-9]/g,'')" style="width: 200px" />
+        </el-form-item>
+        <el-form-item label="鍓╀綑瀵垮懡">
+          <el-input v-model="dialogForm.resilife" oninput="value=value.replace(/[^0-9]/g,'')" style="width: 200px" />
+        </el-form-item>
+
       </el-form>
-      <el-divider content-position="left">鍏宠仈浜у搧</el-divider>
+      <el-divider v-if="operation!=='connect'" content-position="left">鍏宠仈浜у搧</el-divider>
 
       <el-input
         v-model="filterText"
@@ -359,7 +401,7 @@
 
         createuser: '', // 鍒涘缓浜哄憳
         createdate: '', // 鍗曟嵁鏃ユ湡
-        prop: 'code', // 鎺掑簭瀛楁
+        prop: 'lm_date', // 鎺掑簭瀛楁
         order: 'desc', // 鎺掑簭瀛楁
         page: 1, // 绗嚑椤�
         rows: 20 // 姣忛〉澶氬皯鏉�
@@ -374,8 +416,11 @@
         { code: 1, name: '鍑哄簱' },
         { code: 2, name: '涓婃満' },
         { code: 3, name: '涓嬫満' },
-        { code: 4, name: '缁翠慨' },
-        { code: 5, name: '澶栧��' }
+        { code: 4, name: '寰呯淮淇�' },
+        { code: 5, name: '宸茬淮淇�' },
+        { code: 6, name: '宸查獙璇�' },
+        { code: 7, name: '澶栧��' },
+        { code: 8, name: '褰掕繕' }
       ],
 
       total: 10,
@@ -387,7 +432,7 @@
         mouldcode: '',
         mouldname: '',
         mouldspec: '',
-        warehousecode: '',
+        // warehousecode: '',
         surplife: '',
         resilife: '',
         status: 'Y',
@@ -400,10 +445,10 @@
         ],
         mouldname: [
           { required: true, message: '璇疯緭鍏ユā鍏峰悕绉�', trigger: ['blur', 'change'] }
-        ],
-        warehousecode: [
-          { required: true, message: '璇疯緭鍏ラ�夋嫨浠撳簱淇℃伅', trigger: ['blur', 'change'] }
         ]
+        // warehousecode: [
+        //   { required: true, message: '璇疯緭鍏ラ�夋嫨浠撳簱淇℃伅', trigger: ['blur', 'change'] }
+        // ]
       },
       filterText: '',
       defaultProps: {
@@ -543,7 +588,24 @@
         this.dialogForm.mouldcode = row.code
         this.dialogForm.mouldname = row.name
         this.dialogForm.mouldspec = row.spec
-        this.dialogForm.warehousecode = row.warehousecode
+        // 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)
+      })
+    },
+    connectClick(row) {
+      this.operation = 'connect'
+      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
@@ -572,47 +634,72 @@
         mouldcode: '',
         mouldname: '',
         mouldspec: '',
-        warehousecode: '',
+        // warehousecode: '',
         surplife: '',
         resilife: '',
         status: 'Y',
         mouldpart: '',
         opertype: ''
       }
-      this.$refs.dialogForm.clearValidate()
+      if (this.operation !== 'connect') {
+        this.$refs.dialogForm.clearValidate()
+      }
     },
     dialogVisibleCancel() {
       this.dialogVisible = false
     },
     dialogVisibleConfirm() {
-      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([])
+      if (this.operation !== 'connect') {
+        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' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�')
-            }
-          })
-        }
-      })
+                this.dialogVisible = false
+                this.$store.state.app.buttonIsDisabled = false
+                this.getMouldMangerSearch()
+              } else {
+                this.$store.state.app.buttonIsDisabled = false
+                this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�')
+              }
+            })
+          }
+        })
+      } else {
+        const checkData = this.$refs.tree.getCheckedNodes()
+        this.dialogForm.mouldpart = []
+        checkData.forEach(item => {
+          if (!Object.keys(item).includes('children')) {
+            this.dialogForm.mouldpart.push(item.code)
+          }
+        })
+        this.$store.state.app.buttonIsDisabled = true
+        AddUpdateMouldManger(this.dialogForm).then(res => {
+          if (res.code === '200') {
+            this.$notify.success('鍏宠仈鎴愬姛锛�')
+            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('鍏宠仈澶辫触锛�')
+          }
+        })
+      }
     },
     filterNode(value, data) {
       if (!value) return true

--
Gitblit v1.9.3