From 2ecf3363eca41ed38f4bf9f50d62cdd14d75d166 Mon Sep 17 00:00:00 2001 From: Fixiaobai <fixiaobai@163.com> Date: 星期一, 06 十一月 2023 10:53:54 +0800 Subject: [PATCH] Merge branch 'master' of http://114.132.189.42:9002/r/mes-ocea-before --- src/views/equipment/metering/index.vue | 268 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 268 insertions(+), 0 deletions(-) diff --git a/src/views/equipment/metering/index.vue b/src/views/equipment/metering/index.vue new file mode 100644 index 0000000..bbc96a2 --- /dev/null +++ b/src/views/equipment/metering/index.vue @@ -0,0 +1,268 @@ +<template> + <div class="mod-config"> + <basic-container> + <ttable + :table="table" + @handleSelectionChange="handleSelectionChange" + :uploadInfo="uploadInfo" + :prelang="prelang" + :options="options" + :ajaxFun="ajaxFun" + ref="equipmentTable" + > + <template #toolbar></template> + </ttable> + <!-- 寮圭獥, 鏂板 / 淇敼 --> + <table-form + v-if="addOrUpdateVisible" + ref="addOrUpdate" + @refreshDataList="getData" + ></table-form> + </basic-container> + </div> + </template> + + <script> + import { delObj, fetchList,pullEquip } from '@/api/equipment/metering' + import TableForm from './metering-form' + import ttable from '@/views/common/ztt-table.vue' + import { mapGetters } from 'vuex' + import * as fecha from 'element-ui/lib/utils/date' + import { remote } from '../../../api/admin/dict' + export default { + data() { + return { + ajaxFun: fetchList, + multipleSelection: [], + uploadInfo: { + // 鏄惁灞曠ず涓婁紶EXCEL浠ュ強瀵瑰簲鐨剈rl + isShow: true, + url: '/mes/equipment/upload' + }, + prelang: 'workstation', + options: { + height: 300, // 榛樿楂樺害-涓轰簡琛ㄥご鍥哄畾 + stripe: true, // 鏄惁涓烘枒椹汗 table + highlightCurrentRow: false, // 鏄惁瑕侀珮浜綋鍓嶈 + border: true, // 鏄惁鏈夌旱鍚戣竟妗� + lazy: false, // 鏄惁闇�瑕佹噿鍔犺浇 + fit: true, // 鍒楃殑瀹藉害鏄惁鑷拺寮� + multiSelect: true, // + seqNo: true, + isRefresh: true, // 鏄惁鏄剧ず鍒锋柊鎸夐挳 + isShowHide: true, // 鏄惁鏄剧ず鏄惧奖鎸夐挳 + isSearch: false, // 楂樼骇鏌ヨ鎸夐挳 + defaultOrderBy: { column: 'manufactureDate', direction: 'desc' } + }, + table: { + total: 0, + currentPage: 1, + pageSize: 20, + data: [], + // 鏍囬 + column: [ + // 璁惧缂栧彿 + { + minWidth: '30', + prop: 'code', + label: '璁惧缂栧彿', + sort: true, + isTrue: true, + formatter: (row, column, cellValue) => { + return cellValue + }, + isSearch: true, + searchInfoType: 'text' + }, + // 璁惧鍚嶇О + { + minWidth: '30', + prop: 'name', + label: '璁惧鍚嶇О', + sort: true, + isTrue: true, + isSearch: true, + searchInfoType: 'text' + }, + // 宸ュ巶 + // { + // minWidth: '30', + // prop: 'factoryName', + // label: '宸ュ巶', + // sort: true, + // isTrue: true, + // isSearch: true, + // searchInfoType: 'text' + // }, + { + minWidth: '30', + prop: 'type', + label: '璁惧绫诲瀷', + // sort: true, + isTrue: true, + isSearch: true, + // searchInfoType: 'select', + formatter: this.workShopFormatter, + // optList: () => { + // return this.workshopList + // } + }, + // 鍨嬪彿瑙勬牸 + { + minWidth: '30', + prop: 'supplier', + label: '鍘傚', + sort: true, + isTrue: true, + isSearch: false, + searchInfoType: 'text' + }, + // 鐘舵�� + { + minWidth: '30', + prop: 'status', + label: '鐘舵��', + sort: true, + isTrue: true, + isSearch: true, + searchInfoType: 'text' + }, + // 鍒堕�犳棩鏈� + { + minWidth: '150', + width: '250', + prop: 'createTime', + label: '鍒涘缓鏃堕棿', + sort: true, + isTrue: true, + formatter: this.formatReceiveTime, + isSearch: true, + searchInfoType: 'datetime' + }, + + { + minWidth: '150', + width: '250', + prop: 'updateTime', + label: '淇敼鏃堕棿', + sort: true, + isTrue: true, + formatter: this.formatReceiveTime, + isSearch: true, + searchInfoType: 'datetime' + }, + ], + toolbar: [ + { + text: '鏂板', + type: 'primary', + fun: this.addOrUpdateHandle + }, + // { + // text: '鍚屾', + // type: 'primary', + // loading: false, + // fun: this.pullEquipFun + // } + ], + operator: [ + { + text: '淇敼', + icon: 'el-icon-edit', + type: 'text', + size: 'small', + fun: this.addOrUpdateHandle + }, + { + text: '鍒犻櫎', + icon: 'el-icon-delete', + type: 'text', + size: 'small', + fun: this.deleteHandle + } + ], + operatorConfig: { + fixed: 'right', + label: '鎿嶄綔', + width: 130, + minWidth: 130 + } + }, + addOrUpdateVisible: false, + workshopList: [] + } + }, + components: { + ttable, + TableForm + }, + computed: { + ...mapGetters(['permissions']) + }, + created() { + remote('work_shop').then((response) => { + if (response.data.code === 0) { + this.workshopList = response.data.data + } else { + this.workshopList = [] + } + }) + }, + methods: { + pullEquipFun(){ + this.table.toolbar.find((e) => e.text === '鍚屾').loading = true + pullEquip().then(res=>{ + this.$message.success(res.data.data.msg) + this.table.toolbar.find((e) => e.text === '鍚屾').loading = false + }).catch(error=>{ + this.$message.error("鍚屾澶辫触",error) + this.getData() + this.table.toolbar.find((e) => e.text === '鍚屾').loading = false + }) + }, + workShopFormatter(row, column, cellValue) { + if(cellValue==='鍘熸潗鏂欐楠�'){ + cellValue=="鍘熸潗鏂欐楠�" + } + if(cellValue==='杩囩▼妫�楠�'){ + cellValue=="杩囩▼妫�楠�" + } + return cellValue + }, + // 鑾峰彇鏁版嵁鍒楄〃 + getData() { + this.$refs.equipmentTable.getDataList() + }, + formatReceiveTime(row, column, cellValue) { + return cellValue ? fecha.format(new Date(cellValue), 'yyyy-MM-dd HH:mm:ss') : '' + }, + handleSelectionChange(val) { + this.multipleSelection = val + }, + // 鏂板 / 淇敼 + addOrUpdateHandle(row) { + this.addOrUpdateVisible = true + this.$nextTick(() => { + this.$refs.addOrUpdate.init(row == null ? null : row.id) + }) + }, + // 鍒犻櫎 + deleteHandle(row) { + this.$confirm('鏄惁纭鍒犻櫎璁惧鍚嶇О涓�' + row.name, '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + closeOnClickModal: false, + type: 'warning' + }) + .then(function() { + return delObj(row.id) + }) + .then((data) => { + this.$message.success('鍒犻櫎鎴愬姛') + this.getData() + }) + } + } + } + </script> + \ No newline at end of file -- Gitblit v1.9.3