From 363678a54142e62fdd4ca39a0db5c54af1a704dc Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期四, 29 二月 2024 15:39:59 +0800
Subject: [PATCH] 生产调度修改

---
 src/views/equipment/mould/index.vue |  353 +++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 226 insertions(+), 127 deletions(-)

diff --git a/src/views/equipment/mould/index.vue b/src/views/equipment/mould/index.vue
index 9ed8bab..ed98b27 100644
--- a/src/views/equipment/mould/index.vue
+++ b/src/views/equipment/mould/index.vue
@@ -1,140 +1,239 @@
 <template>
-    <div class="mod-config">
-        <basic-container>
-        <!-- <ttable
+  <div class="mod-config">
+      <basic-container>
+        <ttable
+        @handleSelectionChange="handleSelectionChange"
         :table="table"
-        :isShowHide="true"
+        :uploadInfo="uploadInfo"
         :ajaxFun="ajaxFun"
         :prelang="prelang"
-        :options="options" 
-        ref="processconfiguration"
-        > -->
-        <!-- <template #toolbar></template>
-        </ttable> -->
-        <div>寮�鍙戜腑銆傘�傘��</div>
-        </basic-container>
-    </div>
+        :options="options"
+        ref="mouldTable"
+        class="mouldTable"
+        >
+        <template #toolbar></template>
+        </ttable>
+      </basic-container>
+      <el-dialog
+        :title="editRow==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-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 { fetchList, } from '@/api/quality/finishedDelivery'
-
+import * as fecha from 'element-ui/lib/utils/date'
+import { fetchList,addMould,updateMould,delById } from '@/api/equipment/moulde'
+import { mapGetters } from 'vuex'
 export default {
-    data(){
-        return {
-            ajaxFun: fetchList,
-            prelang: 'operation',
-            dataListLoading: false,
-            options: {
-                height: 300, // 榛樿楂樺害-涓轰簡琛ㄥご鍥哄畾
-                stripe: true, // 鏄惁涓烘枒椹汗 table
-                highlightCurrentRow: false, // 鏄惁瑕侀珮浜綋鍓嶈
-                border: true, // 鏄惁鏈夌旱鍚戣竟妗�
-                lazy: false, // 鏄惁闇�瑕佹噿鍔犺浇
-                fit: true, // 鍒楃殑瀹藉害鏄惁鑷拺寮�
-                multiSelect: true, //
-                seqNo: true,
-                isShowHide: true, // 鏄惁鏄剧ず鏄惧奖鎸夐挳
-                isRefresh: true, // 鏄惁鏄剧ず鍒锋柊鎸夐挳
-                isSearch: true, // 楂樼骇鏌ヨ鎸夐挳
-                defaultOrderBy: { column: 'createTime', direction: 'desc' }
-            },
-            table: {
-                total: 0,
-                currentPage: 1,
-                pageSize: 20,
-                data: [],
-                // 鏍囬
-                column: [
-                  {
-                    minWidth: '140',
-                    prop: 'packageNo',
-                    label: '鍖呰缂栧彿',
-                    isTrue: true,
-                    isSearch: true,
-                    searchInfoType: 'text',
-                  },{
-                    minWidth: '140',
-                    prop: 'outBatchNo',
-                    label: '鎵规鍙�',
-                    isTrue: true,
-                    isSearch: true,
-                    searchInfoType: 'text',
-                  },
-                  {
-                    minWidth: '140',
-                    prop: 'partNo',
-                    label: '浜у搧缂栧彿',
-                    isTrue: true,
-                    isSearch: true,
-                    searchInfoType: 'text',
-                  },
-                  {
-                    minWidth: '140',
-                    prop: 'partName',
-                    label: '浜у搧鍚嶇О',
-                    isTrue: true,
-                    isSearch: true,
-                    searchInfoType: 'text',
-                  },
-                  {
-                    minWidth: '140',
-                    prop: 'specs',
-                    label: '瑙勬牸鍨嬪彿',
-                    isTrue: true,
-                    isSearch: true,
-                    searchInfoType: 'text',
-                  },
-                  {
-                    minWidth: '140',
-                    prop: 'unit',
-                    label: '鍗曚綅',
-                    isTrue: true,
-                    isSearch: true,
-                    searchInfoType: 'text',
-                  },
-                  {
-                    minWidth: '140',
-                    prop: 'number',
-                    label: '鏁伴噺',
-                    isTrue: true,
-                    isSearch: true,
-                    searchInfoType: 'text',
-                  },
-                  {
-                    minWidth: '130',
-                    prop: 'createTime',
-                    label: '鍏ュ簱鏃堕棿',
-                    sort: true,
-                    isTrue: true,
-                    isSearch: true,
-                    searchInfoType: 'datetimerange',
-                    formatter: this.formatDateTime,
-                  },
-                  {
-                    minWidth: '130',
-                    prop: 'createUser',
-                    label: '鍒涘缓浜�',
-                    sort: true,
-                    isTrue: true,
-                    isSearch: true,
-                    searchInfoType: 'text',
-                  },
-                ],
-                toolbar: [],
-                // operator: [],
-                // operatorConfig: {}
-            },
-       }
+  data(){
+      return {
+          diaPrintTab: false,
+          editRules: {
+            code: [{required:true,message:'璇疯緭鍏ユā鍏风紪鍙�',trigger:'blur'}],
+            name: [{required:true,message:'璇疯緭鍏ユā鍏峰悕绉�',trigger:'blur'}]
+          },
+          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
+              highlightCurrentRow: false, // 鏄惁瑕侀珮浜綋鍓嶈
+              border: true, // 鏄惁鏈夌旱鍚戣竟妗�
+              lazy: false, // 鏄惁闇�瑕佹噿鍔犺浇
+              fit: true, // 鍒楃殑瀹藉害鏄惁鑷拺寮�
+              multiSelect: true, //
+              seqNo: true,
+              isShowHide: true, // 鏄惁鏄剧ず鏄惧奖鎸夐挳
+              isRefresh: true, // 鏄惁鏄剧ず鍒锋柊鎸夐挳
+              isSearch: true, // 楂樼骇鏌ヨ鎸夐挳
+              defaultOrderBy: { column: 'createTime', direction: 'desc' }
+          },
+          table: {
+              total: 0,
+              currentPage: 1,
+              pageSize: 20,
+              data: [],
+              // 鏍囬
+              column: [
+                {
+                  minWidth: '140px',
+                  prop: 'code',
+                  label: '妯″叿缂栧彿',
+                  isTrue: true,
+                  isSearch: true,
+                  searchInfoType: 'text',
+                  render: { fun: this.addOrUpdateHandle }
+                },
+                {
+                  minWidth: '140px',
+                  prop: 'name',
+                  label: '妯″叿鍚嶇О',
+                  isTrue: true,
+                  isSearch: true,
+                  searchInfoType: 'text',
+                },
+                {
+                  minWidth: '140px',
+                  prop: 'createUser',
+                  label: '璐d换浜�',
+                  isTrue: true,
+                  isSearch: true,
+                  searchInfoType: 'text',
+                },
+                {
+                  minWidth: '140px',
+                  prop: 'status',
+                  label: '妯″叿鐘舵��',
+                  isTrue: true,
+                  isSearch: true,
+                  searchInfoType: 'text',
+                },
+                {
+                  minWidth: '140px',
+                  prop: 'createTime',
+                  label: '鍒涘缓鏃堕棿',
+                  isTrue: true,
+                  isSearch: true,
+                  searchInfoType: 'date',
+                  formatter: this.formatDateTime
+                },
+              ],
+              toolbar: [],
+              operator: null,
+              operatorConfig: {
+                fixed: 'right',
+                label: '鎿嶄綔',
+                width: 100,
+                minWidth: 100
+              },
+          },
+     }
+  },
+  computed: {
+    ...mapGetters(['permissions'])
+  },
+  components: {
+    ttable,
+  },
+  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
+        }]
+    }
+  },
+  mounted(){
+
+  },
+  methods: {
+    handleSelectionChange(val) {
+      this.multipleSelection = val
     },
-    components: {
-      ttable
+    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()
+          })
     },
-    medthods: {
-      formatDateTime(row, column, cellValue) {
-          return cellValue ? fecha.format(new Date(cellValue), 'yyyy-MM-dd') : ''
-      },
+    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
+            }
+        })
     },
+    addOrUpdateHandle(row){
+        if(row){
+            this.editRow = row
+        }
+        this.dialogVisible = true
+    },
+    formatDateTime(row, column, cellValue) {
+        return cellValue ? fecha.format(new Date(cellValue), 'yyyy-MM-dd HH:mm:ss') : ''
+    },
+    getData() {
+      this.$refs.mouldTable.getDataList()
+    },
+  },
 }
-</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