From eabd16cc605204e4cc03d714c9b3a45131bd4269 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期四, 28 三月 2024 17:23:48 +0800
Subject: [PATCH] 标签

---
 src/views/equipment/mould/index.vue |  488 +++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 428 insertions(+), 60 deletions(-)

diff --git a/src/views/equipment/mould/index.vue b/src/views/equipment/mould/index.vue
index 852675f..2bfd999 100644
--- a/src/views/equipment/mould/index.vue
+++ b/src/views/equipment/mould/index.vue
@@ -1,33 +1,183 @@
 <template>
   <div class="mod-config">
       <basic-container>
-      <ttable
-      :table="table"
-      :isShowHide="true"
-      :ajaxFun="ajaxFun"
-      :prelang="prelang"
-      :options="options" 
-      ref="processconfiguration"
-      >
-      <template #toolbar></template>
-      </ttable>
+        <ttable
+        @handleSelectionChange="handleSelectionChange"
+        :table="table"
+        :uploadInfo="uploadInfo"
+        :ajaxFun="ajaxFun"
+        :prelang="prelang"
+        :options="options"
+        ref="mouldTable"
+        class="mouldTable"
+        >
+        <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>
-      <table-form
-        v-if="addOrUpdateVisible"
-      ></table-form>
+      <el-dialog
+        :title="editRow.id==null ? '鏂板':'淇敼'"
+        :visible.sync="dialogVisible"
+        width="40%">
+            <el-form :model="editRow" label-position="right" label-width="100px" ref="editForm" :rules="editRules">
+                <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>
   </div>
 </template>
 
 <script>
 import ttable from '@/views/common/ztt-table.vue'
-import { page, } from '@/api/equipment/mould'
-import TableForm from './mould-from.vue'
+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'
 export default {
   data(){
       return {
-          ajaxFun: page,
-          prelang: 'operation',
-          addOrUpdateVisible: false,
+          diaPrintTab: false,
+          editRules: {
+            model: [{required:true,message:'璇疯緭鍏ユā鍏峰瀷鍙�',trigger:'blur'}],
+            name: [{required:true,message:'璇疯緭鍏ユā鍏峰悕绉�',trigger:'blur'}],
+            status: [{required:true,message:'璇烽�夋嫨妯″叿鐘舵��',trigger:'change'}]
+          },
+          editRow: {
+            code: null,
+            name: null,
+          },
+          uploadInfo: {
+            // 鏄惁灞曠ず涓婁紶EXCEL浠ュ強瀵瑰簲鐨剈rl
+            isShow: true,
+            url: '/mes/mould/upload',
+            download: true,
+            fileName: '妯″叿缁熻琛�'
+          },
+          dialogVisible: false,
+          ajaxFun: fetchList,
+          prelang: 'moudle',
+          multipleSelection: [],
+          dataListLoading: false,
           options: {
               height: 300, // 榛樿楂樺害-涓轰簡琛ㄥご鍥哄畾
               stripe: true, // 鏄惁涓烘枒椹汗 table
@@ -50,86 +200,304 @@
               // 鏍囬
               column: [
                 {
-                  minWidth: '140',
-                  prop: 'packageNo',
-                  label: '璁惧',
-                  isTrue: true,
-                  isSearch: true,
-                  searchInfoType: 'text',
-                },{
-                  minWidth: '140',
-                  prop: 'outBatchNo',
+                  minWidth: '140px',
+                  prop: 'code',
                   label: '妯″叿缂栧彿',
                   isTrue: true,
                   isSearch: true,
                   searchInfoType: 'text',
-                 
+                  render: { fun: this.addOrUpdateHandle }
                 },
                 {
-                  minWidth: '140',
-                  prop: 'partNo',
+                  minWidth: '140px',
+                  prop: 'name',
                   label: '妯″叿鍚嶇О',
                   isTrue: true,
                   isSearch: true,
                   searchInfoType: 'text',
                 },
                 {
-                  minWidth: '140',
-                  prop: 'partName',
-                  label: '宸ュ簭',
+                  minWidth: '140px',
+                  prop: 'drawingNo',
+                  label: '妯″叿鍥惧彿',
                   isTrue: true,
                   isSearch: true,
                   searchInfoType: 'text',
                 },
                 {
-                  minWidth: '140',
-                  prop: 'specs',
-                  label: '宸ユ',
+                  minWidth: '140px',
+                  prop: 'status',
+                  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: '140',
-                  prop: 'unit',
-                  label: '瀵垮懡杞崲绯绘暟',
+                  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',
+                  label: '鍒涘缓鏃堕棿',
+                  isTrue: true,
+                  isSearch: true,
+                  searchInfoType: 'date',
+                  formatter: this.formatDateTime
                 },
               ],
-              toolbar: [{
-                text: '鏂板',
-                type: 'primary',
-                fun: this.addOrUpdateHandle
-                }],
-              operator: [{
-                text: '鍒犻櫎',
-                type: 'text',
-                size: 'small',
-                fun: this.deleteHandle
-              }],
+              toolbar: [],
+              operator: null,
               operatorConfig: {
                 fixed: 'right',
                 label: '鎿嶄綔',
                 width: 100,
                 minWidth: 100
-                },
+              },
           },
+          optList:[
+            {
+                value:'姝e父',
+                label:'姝e父',
+                type:'success'
+            },
+            {
+                value:'寮傚父',
+                label:'寮傚父',
+                type:'danger'
+            },
+            {
+                value:'杩斾慨',
+                label:'杩斾慨',
+                type:'warning'
+            },
+            {
+                value:'鎶ュ簾',
+                label:'鎶ュ簾',
+                type:'info'
+            },
+            ],
+        workshopList: []
      }
   },
-  // computed: {
-  //   ...mapGetters(['permissions'])
-  // },
+  computed: {
+    ...mapGetters(['permissions'])
+  },
   components: {
     ttable,
-    TableForm
+  },
+  watch: {
+    dialogVisible(newVal){
+        if(!newVal){
+            this.editRow = {
+                code: null,
+                name: null,
+            }
+        }
+    }
+  },
+  created(){
+    if(this.permissions.equipment_mould_add){
+        this.table.toolbar.push({
+            text: '鏂板',
+            type: 'primary',
+            fun: this.addOrUpdateHandle
+        })
+    }
+    if(this.permissions.equipment_mould_del){
+        this.table.operator = [{
+            text: '鍒犻櫎',
+            type: 'text',
+            fun: this.deleteHandle
+        }]
+    }
+    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: {
-        addOrUpdateHandle() {
-          this.addOrUpdateVisible = true
-          console.log(this.addOrUpdateVisible,"--=--");
-        },
+    handleSelectionChange(val) {
+      this.multipleSelection = val
+    },
+    deleteHandle(row){
+        this.$confirm('鏄惁纭鍒犻櫎妯″叿鍚嶇О涓�' + row.name, '鎻愮ず', {
+          confirmButtonText: '纭畾',
+          cancelButtonText: '鍙栨秷',
+          closeOnClickModal: false,
+          type: 'warning'
+        })
+          .then(function() {
+            return delById(row.id)
+          }).then((data) => {
+            this.$message.success('鍒犻櫎鎴愬姛')
+            this.getData()
+          })
+    },
+    confirmSaveOrUpdateMould(){
+        this.$refs.editForm.validate(valid=>{
+            if(valid){
+                if(this.editRow.id){
+                    updateMould(this.editRow).then(res=>{
+                        if(res.status===200){
+                            this.$message.success("淇敼鎴愬姛")
+                            this.getData()
+                        }
+                    }).catch(error=>{
+                        console.error(error)
+                    })
+                }else{
+                    addMould(this.editRow).then(res=>{
+                        if(res.status===200){
+                            this.$message.success("鏂板鎴愬姛")
+                            this.getData()
+                        }
+                    }).catch(error=>{
+                        console.error(error)
+                    })
+                }
+                this.dialogVisible = false
+            }
+        })
+    },
+    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') : ''
+    },
+    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('璇烽�夋嫨妯″叿')
+      }
+    },
   },
 }
-</script>
\ No newline at end of file
+</script>
+<style scoped>
+.mouldTable >>>.el-table__fixed-right .el-table__fixed-body-wrapper {
+  top: 74px !important;
+}
+</style>

--
Gitblit v1.9.3