From d55f094797f9a3552c4d196f69ae188e1222b7a6 Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期六, 11 五月 2024 16:29:48 +0800
Subject: [PATCH] 修改

---
 src/views/equipment/mould/index.vue |  368 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 355 insertions(+), 13 deletions(-)

diff --git a/src/views/equipment/mould/index.vue b/src/views/equipment/mould/index.vue
index ed98b27..2b486b8 100644
--- a/src/views/equipment/mould/index.vue
+++ b/src/views/equipment/mould/index.vue
@@ -11,26 +11,173 @@
         ref="mouldTable"
         class="mouldTable"
         >
-        <template #toolbar></template>
+        <template #toolbar>
+            <el-dropdown
+            @command="handleCommand"
+          >
+            <el-button>
+              鐘舵�佹敼鍙�<i class="el-icon-arrow-down el-icon--right"></i>
+            </el-button>
+            <el-dropdown-menu slot="dropdown">
+              <el-dropdown-item
+                :command="item.value"
+                v-for="item in optList"
+                >{{ item.label }}</el-dropdown-item
+              >
+            </el-dropdown-menu>
+          </el-dropdown>
+        </template>
         </ttable>
       </basic-container>
       <el-dialog
-        :title="editRow==null ? '鏂板':'淇敼'"
+        :title="editRow.id==null ? '鏂板':'淇敼'"
         :visible.sync="dialogVisible"
         width="40%">
             <el-form :model="editRow" label-position="right" label-width="100px" ref="editForm" :rules="editRules">
-                <el-form-item prop="code" label="妯″叿缂栫爜">
-                    <el-input v-model="editRow.code" placeholder="璇疯緭鍏ユā鍏风紪鐮佺О"></el-input>
-                </el-form-item>
-                <el-form-item prop="name" label="妯″叿鍚嶇О">
-                    <el-input v-model="editRow.name" placeholder="璇疯緭鍏ユā鍏峰悕绉�"></el-input>
-                </el-form-item>
+                <el-row :gutter="16">
+                    <el-col :span="12">
+                        <el-form-item prop="model" label="妯″叿鍨嬪彿">
+                            <el-input v-model="editRow.model" placeholder="璇疯緭鍏ユā鍏峰瀷鍙�" :disabled="editRow.id"></el-input>
+                        </el-form-item>
+                    </el-col>
+                    <el-col :span="12">
+                        <el-form-item prop="name" label="妯″叿鍚嶇О">
+                            <el-input v-model="editRow.name" placeholder="璇疯緭鍏ユā鍏峰悕绉�"></el-input>
+                        </el-form-item>
+                    </el-col>
+                </el-row>
+                <el-row :gutter="16">
+                    <el-col :span="12">
+                        <el-form-item prop="status" label="妯″叿鐘舵��">
+                            <el-select v-model="editRow.status" placeholder="璇烽�夋嫨妯″叿鐘舵��" style="width: 100%;">
+                                <el-option
+                                v-for="item in optList"
+                                :key="item.value"
+                                :label="item.label"
+                                :value="item.value">
+                                </el-option>
+                            </el-select>
+                        </el-form-item>
+                    </el-col>
+                    <el-col :span="12">
+                        <el-form-item prop="drawingNo" label="妯″叿鍥惧彿">
+                            <el-input v-model="editRow.drawingNo" placeholder="璇疯緭鍏ユā鍏峰浘鍙�"></el-input>
+                        </el-form-item>
+                    </el-col>
+                </el-row>
+                <el-row :gutter="16">
+                    <el-col :span="12">
+                        <el-form-item prop="workShop" label="杞﹂棿">
+                            <el-select v-model="editRow.workShop" placeholder="璇烽�夋嫨杞﹂棿" style="width: 100%;">
+                                <el-option
+                                v-for="item in workshopList"
+                                :key="item.value"
+                                :label="item.label"
+                                :value="item.value">
+                                </el-option>
+                            </el-select>
+                        </el-form-item>
+                    </el-col>
+                    <el-col :span="12">
+                        <el-form-item prop="shelfNo" label="璐ф灦鍙�">
+                            <el-input v-model="editRow.shelfNo" placeholder="璇疯緭鍏ヨ揣鏋跺彿"></el-input>
+                        </el-form-item>
+                    </el-col>
+                </el-row>
+                <el-row :gutter="16">
+                    <el-col :span="12">
+                        <el-form-item prop="erpOrder" label="ERP璁㈠崟鍙�">
+                            <el-input v-model="editRow.erpOrder" placeholder="璇疯緭鍏RP璁㈠崟鍙�"></el-input>
+                        </el-form-item>
+                    </el-col>
+                    <el-col :span="12">
+                        <el-form-item prop="texture" label="鏉愯川">
+                            <el-input v-model="editRow.texture" placeholder="璇疯緭鍏ユ潗璐�"></el-input>
+                        </el-form-item>
+                    </el-col>
+                </el-row>
+                <el-row :gutter="16">
+                    <el-col :span="12">
+                        <el-form-item prop="supplier" label="渚涘簲鍟�">
+                            <el-input v-model="editRow.supplier" placeholder="璇疯緭鍏ヤ緵搴斿晢"></el-input>
+                        </el-form-item>
+                    </el-col>
+                    <el-col :span="12">
+                        <el-form-item prop="userTime" label="鎶曞叆浣跨敤鏃ユ湡">
+                            <el-date-picker
+                            v-model="editRow.userTime"
+                            type="datetime"
+                            placeholder="璇锋姇鍏ヤ娇鐢ㄦ棩鏈�"
+                            value-format="yyyy-MM-dd HH:mm:ss"
+                            format="yyyy-MM-dd HH:mm:ss" style="width: 100%;">
+                            </el-date-picker>
+                        </el-form-item>
+                    </el-col>
+                </el-row>
+                <el-row :gutter="16">
+                    <el-col :span="12">
+                        <el-form-item prop="serviceLife" label="浣跨敤瀵垮懡">
+                            <el-input v-model="editRow.serviceLife" placeholder="璇疯緭鍏ヤ娇鐢ㄥ鍛�"></el-input>
+                        </el-form-item>
+                    </el-col>
+                    <el-col :span="12">
+                        <el-form-item prop="number" label="宸蹭娇鐢ㄦ鏁�">
+                            <el-input v-model="editRow.number" placeholder="璇疯緭鍏ュ凡浣跨敤娆℃暟"></el-input>
+                        </el-form-item>
+                    </el-col>
+                </el-row>
+                <el-row :gutter="16">
+                    <el-col :span="12">
+                        <el-form-item prop="person" label="璐d换浜�">
+                            <el-input v-model="editRow.person" placeholder="璇疯緭鍏ヨ矗浠讳汉"></el-input>
+                        </el-form-item>
+                    </el-col>
+                    <el-col :span="12">
+                        <el-form-item prop="remark" label="澶囨敞">
+                            <el-input v-model="editRow.remark" placeholder="璇疯緭鍏ュ娉�" type="textarea" :rows="3"></el-input>
+                        </el-form-item>
+                    </el-col>
+                </el-row>
             </el-form>
         <span slot="footer" class="dialog-footer">
             <el-button @click="dialogVisible = false">鍙� 娑�</el-button>
             <el-button type="primary" @click="confirmSaveOrUpdateMould">纭� 瀹�</el-button>
         </span>
         </el-dialog>
+        <el-dialog title="鏍囩鍒楄〃" :visible.sync="diaPrintTab" width="500px" top="5vh">
+      <div style="width:100%;height:400px;overflow-y: auto;">
+        <div class="dia_body" id="printRaw">
+          <el-card class="box-card" v-for="(tem, i) in multipleSelection" :key="i" style="margin-bottom: 10px; font-size: 16px !important;page-break-before:always;page-break-after: always;">
+            <!-- <el-row>
+              <el-col :span="8" :offset="1">搴忓彿锛�</el-col>
+              <el-col :span="7" style="font-weight: bold;">{{ tem.id }}</el-col>
+            </el-row> -->
+            <el-row>
+              <el-col :span="6" :offset="1">缂栧彿锛�</el-col>
+              <el-col :span="12" style="font-weight: bold;">{{ tem.code }}</el-col>
+            </el-row>
+            <el-row>
+              <el-col :span="6" :offset="1">妯″叿鍚嶇О锛�</el-col>
+              <el-col :span="12" style="font-weight: bold;">{{ tem.name }}</el-col>
+            </el-row>
+            <el-row>
+              <el-col :span="6" :offset="1">妯″叿浣嶇疆锛�</el-col>
+              <el-col :span="12" style="font-weight: bold;">{{ tem.workShop }}-{{tem.shelfNo}}</el-col>
+            </el-row>
+            <el-row>
+              <el-col :span="6" :offset="1">妯″叿浜岀淮鐮侊細</el-col>
+              <el-col :span="7">
+                <vueQr :text="tem.code" :size="80" :margin="2"></vueQr>
+              </el-col>
+            </el-row>
+          </el-card>
+        </div>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="diaPrintTab = false">鍙� 娑�</el-button>
+        <el-button type="primary" @click="printFun">鎵� 鍗�</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
@@ -39,13 +186,17 @@
 import * as fecha from 'element-ui/lib/utils/date'
 import { fetchList,addMould,updateMould,delById } from '@/api/equipment/moulde'
 import { mapGetters } from 'vuex'
+import { remote } from '@/api/admin/dict'
+import vueQr from 'vue-qr'
+import PrintJS from 'print-js'
 export default {
   data(){
       return {
           diaPrintTab: false,
           editRules: {
-            code: [{required:true,message:'璇疯緭鍏ユā鍏风紪鍙�',trigger:'blur'}],
-            name: [{required:true,message:'璇疯緭鍏ユā鍏峰悕绉�',trigger:'blur'}]
+            model: [{required:true,message:'璇疯緭鍏ユā鍏峰瀷鍙�',trigger:'blur'}],
+            name: [{required:true,message:'璇疯緭鍏ユā鍏峰悕绉�',trigger:'blur'}],
+            status: [{required:true,message:'璇烽�夋嫨妯″叿鐘舵��',trigger:'change'}]
           },
           editRow: {
             code: null,
@@ -103,8 +254,8 @@
                 },
                 {
                   minWidth: '140px',
-                  prop: 'createUser',
-                  label: '璐d换浜�',
+                  prop: 'drawingNo',
+                  label: '妯″叿鍥惧彿',
                   isTrue: true,
                   isSearch: true,
                   searchInfoType: 'text',
@@ -115,8 +266,99 @@
                   label: '妯″叿鐘舵��',
                   isTrue: true,
                   isSearch: true,
+                  isTags:true,
+                  searchInfoType: 'select',
+                  formatter: this.workShopFormatter,
+                  optList: () => {
+                    return this.optList
+                  },
+                },
+                {
+                  minWidth: '140px',
+                  prop: 'model',
+                  label: '妯″叿鍨嬪彿',
+                  isTrue: true,
+                  isSearch: true,
                   searchInfoType: 'text',
                 },
+                {
+                  minWidth: '140px',
+                  prop: 'workShop',
+                  label: '杞﹂棿',
+                  isTrue: true,
+                  isSearch: true,
+                  searchInfoType: 'select',
+                  formatter: this.workShopFormatter,
+                  optList: () => {
+                    return this.workshopList
+                  }
+                },
+                {
+                  minWidth: '140px',
+                  prop: 'shelfNo',
+                  label: '璐ф灦鍙�',
+                  isTrue: true,
+                  isSearch: true,
+                  searchInfoType: 'text',
+                },
+                {
+                  minWidth: '140px',
+                  prop: 'erpOrder',
+                  label: 'ERP璁㈠崟鍙�',
+                  isTrue: true,
+                  isSearch: true,
+                  searchInfoType: 'text',
+                },
+                {
+                  minWidth: '140px',
+                  prop: 'texture',
+                  label: '鏉愯川',
+                  isTrue: true,
+                  isSearch: true,
+                  searchInfoType: 'text',
+                },
+                {
+                  minWidth: '140px',
+                  prop: 'supplier',
+                  label: '渚涘簲鍟�',
+                  isTrue: true,
+                  isSearch: true,
+                  searchInfoType: 'text',
+                },
+                {
+                  minWidth: '140px',
+                  prop: 'userTime',
+                  label: '鎶曞叆浣跨敤鏃ユ湡',
+                  isTrue: true,
+                  isSearch: true,
+                  searchInfoType: 'date',
+                  formatter: this.formatDateTime
+                },
+                {
+                  minWidth: '140px',
+                  prop: 'serviceLife',
+                  label: '浣跨敤瀵垮懡',
+                  isTrue: true,
+                  isSearch: true,
+                  searchInfoType: 'text'
+                },
+                {
+                  minWidth: '140px',
+                  prop: 'number',
+                  label: '宸蹭娇鐢ㄦ鏁�',
+                  isTrue: true,
+                  isSearch: true,
+                  searchInfoType: 'text',
+                },
+                {
+                  minWidth: '140px',
+                  prop: 'person',
+                  label: '璐d换浜�',
+                  isTrue: true,
+                  isSearch: true,
+                  searchInfoType: 'text',
+                },
+
                 {
                   minWidth: '140px',
                   prop: 'createTime',
@@ -136,6 +378,29 @@
                 minWidth: 100
               },
           },
+          optList:[
+            {
+                value:'姝e父',
+                label:'姝e父',
+                type:'success'
+            },
+            {
+                value:'寮傚父',
+                label:'寮傚父',
+                type:'danger'
+            },
+            {
+                value:'杩斾慨',
+                label:'杩斾慨',
+                type:'warning'
+            },
+            {
+                value:'鎶ュ簾',
+                label:'鎶ュ簾',
+                type:'info'
+            },
+            ],
+        workshopList: []
      }
   },
   computed: {
@@ -143,6 +408,7 @@
   },
   components: {
     ttable,
+    vueQr,
   },
   watch: {
     dialogVisible(newVal){
@@ -169,9 +435,23 @@
             fun: this.deleteHandle
         }]
     }
+    if(this.permissions.equipment_mould_labelprint){
+      this.table.toolbar.push({
+              text: '鏍囩鎵撳嵃',
+              type: 'primary',
+              fun: this.labelPrint
+            })
+    }
+    this.table.operator = arr.length>0 ? arr : null
   },
   mounted(){
-
+    remote('work_shop').then((response) => {
+      if (response.data.code === 0) {
+        this.workshopList = response.data.data
+      } else {
+        this.workshopList = []
+      }
+    })
   },
   methods: {
     handleSelectionChange(val) {
@@ -217,11 +497,20 @@
             }
         })
     },
+    workShopFormatter(row, column, cellValue) {
+      this.workshopList.forEach((obj) => {
+        if (obj.value == cellValue) {
+          cellValue = obj.label
+        }
+      })
+      return cellValue
+    },
     addOrUpdateHandle(row){
         if(row){
             this.editRow = row
         }
         this.dialogVisible = true
+        this.$refs["editForm"].clearValidate()
     },
     formatDateTime(row, column, cellValue) {
         return cellValue ? fecha.format(new Date(cellValue), 'yyyy-MM-dd HH:mm:ss') : ''
@@ -229,6 +518,59 @@
     getData() {
       this.$refs.mouldTable.getDataList()
     },
+    // 鏍囪鐘舵��
+    handleCommand(event) {
+      if (this.multipleSelection && this.multipleSelection.length > 0) {
+        this.multipleSelection.forEach((item) => {
+            item.status = event;
+            updateMould(item).then(res=>{
+                if(res.status===200){
+                    // this.$message.success("淇敼鎴愬姛")
+                    this.getData()
+                }
+            }).catch(error=>{
+                console.error(error)
+            })
+        })
+        this.$message.success('鏀瑰彉' + event + '鎴愬姛')
+      } else {
+        this.$message.error('璇烽�夋嫨妯″叿')
+      }
+    },
+    labelPrint(){
+        if(this.multipleSelection.length==0){
+          this.$message.warning('璇烽�夋嫨涓�鏉℃暟鎹�')
+          return
+        }
+        this.diaPrintTab = true
+    },
+    printFun() {
+        // this.printDialogVisible = false;
+        this.diaPrintTab = false;
+        PrintJS({
+            printable: 'printRaw',//椤甸潰
+            type: "html",//鏂囨。绫诲瀷
+                maxWidth:450,
+                targetStyles:['*'],
+                style: `@page {
+                margin:0;
+                padding: 0;
+                size: 360px 170px landscape;
+                }
+                html{
+                zoom:100%;
+                }
+                @media print{
+                width: 360px;
+                height: 170px;
+                margin:0;
+                padding: 0;
+                }`,
+                onPrintDialogClose: this.erexcel=false,
+                targetStyles: ["*"], // 浣跨敤dom鐨勬墍鏈夋牱寮忥紝寰堥噸瑕�
+                font_size: '',
+        });
+    },
   },
 }
 </script>

--
Gitblit v1.9.3