diff --git a/.env.dev b/.env.dev index 90ad311e..924e1dab 100644 --- a/.env.dev +++ b/.env.dev @@ -14,7 +14,8 @@ VUE_APP_TITLE = MES系统 # 芋道管理系统/开发环境 # VUE_APP_BASE_API = 'http://100.64.0.26:48082' # VUE_APP_BASE_API = 'http://10.70.2.2:8080' -VUE_APP_BASE_API = 'http://192.168.0.33:48082' +VUE_APP_BASE_API = 'http://192.168.1.47:48082' +# VUE_APP_BASE_API = 'http://192.168.0.33:48082' # VUE_APP_BASE_API = 'http://192.168.4.173:48080' # VUE_APP_BASE_API = 'http://192.168.2.173:48080' # VUE_APP_BASE_API = 'http://192.168.1.49:48082' diff --git a/src/mixins/lb/basicPageMixin.js b/src/mixins/lb/basicPageMixin.js index 3fe2557f..ca1ed6e6 100644 --- a/src/mixins/lb/basicPageMixin.js +++ b/src/mixins/lb/basicPageMixin.js @@ -106,6 +106,8 @@ export default { case 'detail': this.handleDetail(data); break; + default: + this.handleTableActions({data, type}); } }, // 处理搜索栏按钮 diff --git a/src/views/specialEquipment/maintain/PlanConfig--add.vue b/src/views/specialEquipment/maintain/PlanConfig--add.vue index d4c993d5..34f9f437 100644 --- a/src/views/specialEquipment/maintain/PlanConfig--add.vue +++ b/src/views/specialEquipment/maintain/PlanConfig--add.vue @@ -15,34 +15,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { this.equipmentOptions = this.equipmentList @@ -224,8 +330,33 @@ export default { }, }, mounted() { - this.getEquipmentList(); - this.getCode('/base/equipment-maintain-plan/getCode'); + !this.edit && this.getCode('/base/equipment-maintain-plan/getCode'); + this.getList('maintainer'); + this.getList('department'); + this.getList('line'); + }, + computed: { + departmentOptions() { + return (this.departmentList || []).map((item) => ({ + id: item.id, + label: item.name, + value: item.id, + })); + }, + lineOptions() { + return (this.lineList || []).map((item) => ({ + id: item.id, + label: item.name, + value: item.id, + })); + }, + maintainerOptions() { + return (this.maintainerList || []).map((item) => ({ + id: item.id, + label: item.name, + value: item.name, + })); + }, }, methods: { /** 模拟透传 ref */ @@ -253,6 +384,29 @@ export default { })); this.formLoading = false; }, + async getList(source = 'department') { + const urls = [ + '/base/core-production-line/listAll', + '/base/core-department/listAll', + '/base/core-worker/listAll', + ]; + let res; + switch (source) { + case 'department': + res = await this.$axios(urls[1]); + this.departmentList = res.data || []; + break; + case 'maintainer': + res = await this.$axios(urls[2]); + this.maintainerList = res.data || []; + break; + case 'line': + res = await this.$axios(urls[0]); + this.lineList = res.data || []; + break; + } + this.formLoading = false; + }, // handlers handleEqTypeChange(type) { diff --git a/src/views/specialEquipment/maintain/PlanConfig.vue b/src/views/specialEquipment/maintain/PlanConfig.vue index c4559687..b8b77183 100644 --- a/src/views/specialEquipment/maintain/PlanConfig.vue +++ b/src/views/specialEquipment/maintain/PlanConfig.vue @@ -24,7 +24,7 @@ v-if="tableBtn.length" slot="handleBtn" label="操作" - :width="120" + :width="180" :method-list="tableBtn" @clickBtn="handleTableBtnClick" /> @@ -44,7 +44,7 @@ @close="cancel" @cancel="cancel" @confirm="submitForm"> - + @@ -64,11 +64,15 @@ export default { const t = new Date(); const [y, m, d] = [t.getFullYear(), t.getMonth(), t.getDate()]; return { - searchBarKeys: ['equipmentName', 'specialType', 'createTime'], + searchBarKeys: ['planName'], // 'specialType', 'equipmentName', 'createTime'], tableBtn: [ + // { + // type: 'detail', + // btnName: '保养记录', + // }, { - type: 'detail', - btnName: '保养记录', + type: 'addContent', + btnName: '添加内容', }, this.$auth.hasPermi('equipment:plan-config:update') ? { @@ -84,6 +88,23 @@ export default { : undefined, ].filter((v) => v), tableProps: [ + { prop: 'name', label: '计划名称' }, + { prop: 'departmentName', label: '部门' }, + { width: 144, prop: 'lineName', label: '产线名' }, + { width: 144, prop: 'maintenancePeriod', label: '保养频率(天/次)' }, + { width: 144, prop: 'firstMaintenanceTime', label: '首次保养时间' }, + { width: 144, prop: 'maintainDuration', label: '保养时长' }, + { prop: 'maintainer', label: '计划保养人员' }, + { + width: 144, + prop: 'confirmTimeLimit', + label: '确认时限', + filter: (val) => + val != null && val > 24 + ? `${(val - (val % 24)) / 24}天${val % 24}小时` + : `${val}小时`, + }, + { prop: 'remark', label: '备注' }, // { // prop: 'createTime', // label: '添加时间', @@ -91,59 +112,64 @@ export default { // width: 180, // filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'), // }, - { prop: 'name', label: '计划名称' }, - { prop: 'code', label: '计划编号' }, - { - prop: 'enabled', - label: '启用状态', - filter: (val) => ['停用', '启用'][val], - }, - { prop: 'lineName', label: '产线' }, - { - prop: 'equipmentCategory', - label: '设备大类', - filter: (val) => - val != null ? ['-', '安全', '消防', '特种'][val] : '-', - }, - { prop: 'equipmentName', label: '设备名称' }, - { width: 144, prop: 'maintainDuration', label: '计划保养用时(h)' }, - { width: 144, prop: 'maintenancePeriod', label: '保养频率(天/次)' }, - { - prop: 'maintainType', - label: '保养类型', - filter: publicFormatter('maintain_type'), - }, - { prop: 'remark', label: '备注' }, + // { prop: 'code', label: '计划编号' }, + // { + // prop: 'enabled', + // label: '启用状态', + // filter: (val) => ['停用', '启用'][val], + // }, + // { + // prop: 'equipmentCategory', + // label: '设备大类', + // filter: (val) => + // val != null ? ['-', '安全', '消防', '特种'][val] : '-', + // }, + // { prop: 'equipmentName', label: '设备名称' }, + // { width: 144, prop: 'maintainDuration', label: '计划保养用时(h)' }, + // { + // prop: 'maintainType', + // label: '保养类型', + // filter: publicFormatter('maintain_type'), + // }, ], searchBarFormConfig: [ - { - type: 'select', - label: '设备大类', - selectOptions: [ - { id: 1, name: '安全设备' }, - { id: 2, name: '消防设备' }, - { id: 3, name: '特种设备' }, - ], - placeholder: '请选择设备大类', - param: 'specialType', - }, + // { + // type: 'select', + // label: '设备大类', + // selectOptions: [ + // { id: 1, name: '安全设备' }, + // { id: 2, name: '消防设备' }, + // { id: 3, name: '特种设备' }, + // ], + // placeholder: '请选择设备大类', + // param: 'specialType', + // }, { type: 'input', - label: '设备名', - placeholder: '请输入设备名称', - param: 'equipmentName', - }, - { - type: 'datePicker', - label: '时间段', - dateType: 'daterange', - format: 'yyyy-MM-dd', - valueFormat: 'yyyy-MM-dd HH:mm:ss', - rangeSeparator: '-', - startPlaceholder: '开始时间', - endPlaceholder: '结束时间', - param: 'createTime', + label: '保养计划名称', + placeholder: '请输入保养计划名称', + param: 'planName', + // selectOptions: [ + // {name: 1, id: 1} + // ] }, + // { + // type: 'input', + // label: '设备名', + // placeholder: '请输入设备名称', + // param: 'equipmentName', + // }, + // { + // type: 'datePicker', + // label: '时间段', + // dateType: 'daterange', + // format: 'yyyy-MM-dd', + // valueFormat: 'yyyy-MM-dd HH:mm:ss', + // rangeSeparator: '-', + // startPlaceholder: '开始时间', + // endPlaceholder: '结束时间', + // param: 'createTime', + // }, { type: 'button', btnName: '查询', @@ -271,9 +297,10 @@ export default { queryParams: { pageNo: 1, pageSize: 10, - equipmentName: null, - createTime: null, + // equipmentName: null, + // createTime: null, specialType: null, + planName: null, }, // 表单参数 form: {}, @@ -311,19 +338,33 @@ export default { /** 表单重置 */ reset() { this.form = { + id: null, code: null, name: null, - equipmentId: null, - enabled: null, + // equipmentId: null, + maintainer: null, + lineId: null, + departmentId: null, + // enabled: null, maintenancePeriod: null, maintainDuration: null, maintainType: null, remark: null, - enabled: 1, - equipmentCategory: null, + confirmTimeLimit: null, + firstMaintenanceTime: null, + speical: false, + // equipmentCategory: null, }; this.resetForm('form'); }, + handleTableActions({data, type}) { + switch(type) { + case 'addContent': + // 添加内容 + alert('添加内容...') + break; + } + }, /** 搜索按钮操作 */ handleQuery() { this.queryParams.pageNo = 1; @@ -364,7 +405,6 @@ export default { const id = row.id; this.info({ id }).then((response) => { this.form = response.data; - debugger; this.open = true; this.title = '修改保养计划'; }); @@ -377,7 +417,10 @@ export default { } // 修改的提交 if (this.form.id != null) { - this.put(this.form).then((response) => { + this.put({ + ...this.form, + maintainer: this.form.maintainer.join(','), + }).then((response) => { this.$modal.msgSuccess('修改成功'); this.open = false; this.getList(); @@ -385,7 +428,11 @@ export default { return; } // 添加的提交 - this.post(this.form).then((response) => { + this.post({ + ...this.form, + special: true, + maintainer: this.form.maintainer.join(','), + }).then((response) => { this.$modal.msgSuccess('新增成功'); this.open = false; this.getList();