diff --git a/src/components/DialogForm/index.vue b/src/components/DialogForm/index.vue index a290ce95..e55394de 100644 --- a/src/components/DialogForm/index.vue +++ b/src/components/DialogForm/index.vue @@ -10,6 +10,8 @@ ref="form" :model="form" :label-width="`${labelWidth}px`" + :size="size" + :label-position="labelPosition" v-loading="formLoading"> @@ -119,7 +121,15 @@ export default { disabled: { type: Boolean, default: false, - } + }, + labelPosition: { + type: String, + default: 'right', + }, + size: { + type: String, + default: '', + }, }, data() { return { diff --git a/src/views/base/equipmentPlcConnect/components/BasicDrawer.vue b/src/views/base/equipmentPlcConnect/components/BasicDrawer.vue index 740f6b71..ddb8ce35 100644 --- a/src/views/base/equipmentPlcConnect/components/BasicDrawer.vue +++ b/src/views/base/equipmentPlcConnect/components/BasicDrawer.vue @@ -151,7 +151,7 @@ export default { name: '', plcParamName: '', unit: '', - collection: '', + collection: 1, minValue: '', maxValue: '', defaultValue: '', @@ -370,7 +370,7 @@ export default { name: '', plcParamName: '', unit: '', - collection: '', + collection: 1, minValue: '', maxValue: '', defaultValue: '', diff --git a/src/views/core/base/equipment/components/EquipmentDrawer.vue b/src/views/core/base/equipment/components/EquipmentDrawer.vue index 445ac334..bd418137 100644 --- a/src/views/core/base/equipment/components/EquipmentDrawer.vue +++ b/src/views/core/base/equipment/components/EquipmentDrawer.vue @@ -35,6 +35,7 @@ key="drawer-dialog-form" v-if="showForm" ref="form" + label-position="top" :dataForm="form" :rows="formRows" /> @@ -46,6 +47,8 @@ :page="section.pageNo || 1" :limit="section.pageSize || 10" :table-data="list" + :add-button-show="mode.includes('detail') ? null : '添加属性'" + @emitButtonClick="handleAddAttr" @emitFun="handleEmitFun"> @@ -177,13 +176,14 @@ export default { ...col, style: { left: 0, - right: 'unset' - } - } + right: 'unset', + }, + }; } return { ...col, bind: { + ...col.bind, // 详情 模式下,禁用各种输入 disabled: this.mode == 'detail', }, @@ -210,7 +210,6 @@ export default { this.form = data; this.showForm = true; this.infoQuery = query; - console.log('setting form: ', this.form, data); } else if (section.key == 'attrs') { this.attrQuery = query; this.list = data.list; @@ -331,33 +330,44 @@ export default { }, // 提交属性表 - async submitAttrForm() { - this.$refs['attrForm'].validate((valid) => { + submitAttrForm() { + this.$refs['attrForm'].validate(async (valid) => { if (!valid) { return; } - }); - console.log('this.attrform', this.attrForm); - const isEdit = this.attrForm.id != null; - this.attrFormSubmitting = true; - const res = await this.$axios({ - url: isEdit ? this.sections[1].urlUpdate : this.sections[1].urlCreate, - method: isEdit ? 'put' : 'post', - data: this.attrForm, - }); - if (res.code == 0) { - this.closeAttrForm(); - this.$message({ - message: `${isEdit ? '更新' : '创建'}成功`, - type: 'success', - duration: 1500, - onClose: () => { - this.getAttrList(); - }, - }); - } - this.attrFormSubmitting = false; + try { + const isEdit = this.attrForm.id != null; + this.attrFormSubmitting = true; + const res = await this.$axios({ + url: isEdit + ? this.sections[1].urlUpdate + : this.sections[1].urlCreate, + method: isEdit ? 'put' : 'post', + data: this.attrForm, + }); + + if (res.code == 0) { + this.closeAttrForm(); + this.$message({ + message: `${isEdit ? '更新' : '创建'}成功`, + type: 'success', + duration: 1500, + onClose: () => { + this.getAttrList(); + }, + }); + } + this.attrFormSubmitting = false; + } catch (err) { + this.$message({ + message: err, + type: 'error', + duration: 1500, + }); + this.attrFormSubmitting = false; + } + }); }, closeAttrForm() { diff --git a/src/views/core/base/equipment/index.vue b/src/views/core/base/equipment/index.vue index 37aaaac1..4c5b32cd 100644 --- a/src/views/core/base/equipment/index.vue +++ b/src/views/core/base/equipment/index.vue @@ -36,11 +36,14 @@ :dialogVisible="open" @close="cancel" @cancel="cancel" + width="60%" @confirm="submitForm"> @@ -155,7 +158,7 @@ export default { filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'), }, { prop: 'name', label: '设备名称' }, - { width: 256, prop: 'code', label: '检测编码' }, + { width: 256, prop: 'code', label: '设备编码' }, { prop: 'equipmentType', label: '设备类型' }, { prop: 'enName', label: '英文名称' }, { prop: 'abbr', label: '缩写' }, @@ -239,8 +242,6 @@ export default { prop: 'code', url: '/base/equipment/getCode', }, - ], - [ { input: true, label: '英文名称', @@ -250,6 +251,8 @@ export default { // disabled: true, // some condition, like detail mode... // } }, + ], + [ { input: true, label: '缩写', @@ -259,13 +262,15 @@ export default { // disabled: true, // some condition, like detail mode... // } }, - ], - [ + { select: true, label: '设备类型', prop: 'equipmentTypeId', url: '/base/equipment-type/page?pageNo=1&pageSize=100', + bind: { + filterable: true, + }, }, // { // select: true, @@ -286,8 +291,6 @@ export default { label: '进厂日期', prop: 'enterTime', }, - ], - [ { input: true, prop: 'tvalue', @@ -302,11 +305,14 @@ export default { }, ], }, + ], + [ { input: true, - label: '产品加工时间', + label: '产品加工时间(s)', prop: 'processingTime', rules: [ + { required: true, message: '不能为空', trigger: 'blur' }, { type: 'number', message: '请输入正确的数字值', @@ -315,8 +321,7 @@ export default { }, ], }, - ], - [ + { input: true, label: '制造商', @@ -524,7 +529,6 @@ export default { }, // overwrite basicPageMixin 里的 处理表格按钮 方法 handleTableBtnClick({ data, type }) { - console.log('[handleTableBtnClick]', data, type); switch (type) { case 'edit': this.reset(); diff --git a/src/views/core/base/equipmentType/index.vue b/src/views/core/base/equipmentType/index.vue index 70633ce6..14297f79 100644 --- a/src/views/core/base/equipmentType/index.vue +++ b/src/views/core/base/equipmentType/index.vue @@ -267,7 +267,7 @@ export default { handleDelete(row) { const id = row.id; this.$modal - .confirm('是否确认删除设备类型编号为"' + id + '"的数据项?') + .confirm('是否确认删除设备类型"' + row.name + '"?') .then(function () { return deleteEquipmentType(id); }) diff --git a/src/views/equipment/timing-diagram/components/gantt.js b/src/views/equipment/timing-diagram/components/gantt.js deleted file mode 100644 index fcbc6fba..00000000 --- a/src/views/equipment/timing-diagram/components/gantt.js +++ /dev/null @@ -1,191 +0,0 @@ - -// filename: gantt.vue -// author: liubin -// date: 2023 -09 - 25 14: 28: 12 -// description: 甘特图 - - -import * as echarts from 'echarts'; - -/** - * - * @param {*} params - * @param {*} api - * - * https://echarts.apache.org/zh/option.html#series-custom.renderItem.arguments.params - */ -function renderItem(params, api) { } - -export default class Gantt { - constructor(el) { - this.chart = echarts.init(el); - let options = { - series: [ - { - type: 'custom', - coordinateSystem: 'cartesian2d', - renderItem: renderItem, - } - ] - } - this.chart.setOption(options); - } - - update(options) { - this.chart.setOption(options); - } - - resize() { - // todo - } - - destroy() { - this.chart.dispose(); - } -} - - - -var data = []; -var categories = ['设备1', '设备2', '设备3']; -var types = [ - { name: '运行', color: '#7b9ce1' }, - { name: '故障', color: '#bd6d6c' }, - { name: '停机', color: '#75d874' }, -]; -// return new Date(new Date(timestamp).toLocaleDateString()).getTime() -// })(1691568181000)) -function getStartTime(timestamp) { - return new Date(new Date(timestamp).toLocaleDateString()).getTime() -} - - -data.push({ - name: 'running', - value: [0, 1691568181000, 1691568181000 + 60 * 60 * 1000, 60], - itemStyle: { - normal: { - color: types[0].color - } - } -}) - - - -function renderItem(params, api) { - var categoryIndex = api.value(0); - var start = api.coord([api.value(1), categoryIndex]); - var end = api.coord([api.value(2), categoryIndex]); - var height = api.size([0, 1])[1] * 0.8; - var rectShape = echarts.graphic.clipRectByRect( - { - x: start[0], - y: start[1] - height / 2, - width: end[0] - start[0], - height: height - }, - { - x: params.coordSys.x, - y: params.coordSys.y, - width: params.coordSys.width, - height: params.coordSys.height - } - ); - return ( - rectShape && { - type: 'rect', - transition: ['shape'], - shape: rectShape, - style: api.style() - } - ); -} - -option = { - tooltip: { - // show: false, - formatter: function (params) { - return params.marker + params.name + ': ' + new Date(params.value[1]).toLocaleTimeString() + ' - ' + new Date(params.value[2]).toLocaleTimeString(); - } - }, - // title: { - // text: 'Profile', - // left: 'center' - // }, - // dataZoom: [ - // { - // type: 'slider', - // filterMode: 'weakFilter', - // showDataShadow: false, - // top: 400, - // labelFormatter: '' - // }, - // { - // type: 'inside', - // filterMode: 'weakFilter' - // } - // ], - grid: { - height: 300 - }, - xAxis: { - type: 'time', - min: getStartTime(1691568181000), - max: getStartTime(1691568181000 + 3600 * 24 * 1000), - splitNumber: 10, - // interval: 60*3600*1000, - // scale: true, - axisLabel: { - // rotate: -15, - formatter: function (val) { - return new Date(val).toLocaleTimeString() - } - }, - axisTick: { - show: true - }, - splitLine: { - show: false, - } - }, - yAxis: [{ - axisLine: { - // show: false, - lineStyle: { - color: '' - } - }, - axisLabel: { - fontSize: 14, - }, - axisTick: { - show: false, - }, - splitLine: { - show: true - }, - data: categories - }, { - axisLine: { - // show: false, - lineStyle: { - color: '' - } - }, - data: [] - }], - series: [ - { - type: 'custom', - renderItem: renderItem, - itemStyle: { - opacity: 0.8 - }, - encode: { - x: [1, 2], - y: 0 - }, - data: data - } - ] -}; \ No newline at end of file diff --git a/src/views/equipment/timing-diagram/output/index.vue b/src/views/equipment/timing-diagram/output/index.vue index 829bf109..d1a495ae 100644 --- a/src/views/equipment/timing-diagram/output/index.vue +++ b/src/views/equipment/timing-diagram/output/index.vue @@ -74,7 +74,7 @@ - - - - \ No newline at end of file