From b23b5256f94e34e9ac74dd4e43b3ce5354a9c560 Mon Sep 17 00:00:00 2001 From: lb Date: Fri, 1 Sep 2023 10:39:54 +0800 Subject: [PATCH 1/3] =?UTF-8?q?update=20=E8=AE=BE=E5=A4=87=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=87=87=E9=9B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + src/components/DialogForm/index.vue | 8 +- src/views/base/equipmentPlc/index.vue | 584 ++++++++++++++++---------- yarn.lock | 12 + 4 files changed, 382 insertions(+), 223 deletions(-) diff --git a/package.json b/package.json index b7ef11cc..33285ef4 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ "js-beautify": "1.13.0", "jsencrypt": "3.3.1", "min-dash": "3.5.2", + "mockjs": "^1.1.0", "moment": "^2.29.4", "nprogress": "0.2.0", "qrcode.vue": "^1.7.0", diff --git a/src/components/DialogForm/index.vue b/src/components/DialogForm/index.vue index c459b29d..03c05be4 100644 --- a/src/components/DialogForm/index.vue +++ b/src/components/DialogForm/index.vue @@ -63,6 +63,12 @@ {{ col.uploadTips || '只能上传jpg/png文件,大小不超过2MB' }} + -
+
+ + - - - - - - - - - - 搜索 - 重置 - - + + + + - - - - 新增 - - - 导出 - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ + + + +
diff --git a/yarn.lock b/yarn.lock index 17999661..ea7b06e2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3059,6 +3059,11 @@ combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6: dependencies: delayed-stream "~1.0.0" +commander@*: + version "11.0.0" + resolved "https://registry.npmmirror.com/commander/-/commander-11.0.0.tgz#43e19c25dbedc8256203538e8d7e9346877a6f67" + integrity sha512-9HMlXtt/BNoYr8ooyjjNRdIilOTkVJXB+GhxMTtOKwk0R4j4lS4NpjuqmRxroBfnfTSHQIHQB7wryHhXarNjmQ== + commander@2.17.x: version "2.17.1" resolved "https://registry.npmmirror.com/commander/-/commander-2.17.1.tgz" @@ -6826,6 +6831,13 @@ mkdirp@^1.0.3, mkdirp@^1.0.4: resolved "https://registry.npmmirror.com/mkdirp/-/mkdirp-1.0.4.tgz" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== +mockjs@^1.1.0: + version "1.1.0" + resolved "https://registry.npmmirror.com/mockjs/-/mockjs-1.1.0.tgz#e6a0c378e91906dbaff20911cc0273b3c7d75b06" + integrity sha512-eQsKcWzIaZzEZ07NuEyO4Nw65g0hdWAyurVol1IPl1gahRwY+svqzfgfey8U8dahLwG44d6/RwEzuK52rSa/JQ== + dependencies: + commander "*" + moddle-xml@^9.0.6: version "9.0.6" resolved "https://registry.npmmirror.com/moddle-xml/-/moddle-xml-9.0.6.tgz" From 63206d47695c9a6e6ed072d3eb6a510392c0b4ad Mon Sep 17 00:00:00 2001 From: lb Date: Fri, 1 Sep 2023 15:08:36 +0800 Subject: [PATCH 2/3] =?UTF-8?q?add=20mockdata=20&=20update=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E9=87=87=E9=9B=86=E9=85=8D=E7=BD=AE**?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/base/equipmentPlcConnect/http.js | 78 +++ src/views/base/equipmentPlcConnect/index.vue | 520 ++++++++++++------- 2 files changed, 400 insertions(+), 198 deletions(-) create mode 100644 src/views/base/equipmentPlcConnect/http.js diff --git a/src/views/base/equipmentPlcConnect/http.js b/src/views/base/equipmentPlcConnect/http.js new file mode 100644 index 00000000..16544450 --- /dev/null +++ b/src/views/base/equipmentPlcConnect/http.js @@ -0,0 +1,78 @@ +import Mock from 'mockjs'; + +const baseURL = 'http://192.168.1.49:48080/admin-api'; + +Mock.setup({ + timeout: 200, +}); + +// @database +const list = Mock.mock({ + 'data|1-10': [ + { + 'id|+1': 1, + productionLine: (options) => { + // console.log('otpsion', options.context.currentContext); + return `EQ${options.context.currentContext.id}`; + }, + workshopSection: ({ context: { currentContext } }) => + `EQ${currentContext.id}_WS${Mock.Random.integer(1, 10)}`, + equipmentName: ({ context: { currentContext } }) => + `设备${currentContext.id}`, + equipmentCode: ({ context: { currentContext } }) => + `${currentContext.equipmentName}_Code`, + plcCode: ({ context: { currentContext } }) => + `PLC_TABLE_CODE_${currentContext.id}`, + plcTableName: ({ context: { currentContext } }) => + `PLC_TABLE_${currentContext.id}`, + plcName: ({ context: { currentContext } }) => `PLC_${currentContext.id}`, + 'bindingParameters|1-10': 1, + }, + ], +}); + +// @page +Mock.mock( + RegExp(baseURL + '/base/equipment-plc-connect/page' + '.*'), + 'get', + (options) => { + console.log('[Mock url]', options.url, list); + return { + code: 0, + data: { + list: list.data, + total: list.data.length, + }, + }; + } +); + +// @create +Mock.mock(baseURL + '/base/equipment-plc-connect/create', 'post', (options) => { + console.log('options', options); + const { url, type, body } = options; + const newItem = JSON.parse(body); + list.data.push(newItem); + return { + code: 0, + data: null, + msg: 'success', + }; +}); + +// @update +Mock.mock( + baseURL + '/admin-api/base/equipment-plc-connect/update', + 'put', + (options) => { + const { url, type, body } = options; + const { id } = JSON.parse(body); + const newItem = list.data.find((item) => item.id == id); + newItem = { ...newItem, ...JSON.parse(body) }; + return { + code: 0, + msg: 'success', + data: null, + }; + } +); diff --git a/src/views/base/equipmentPlcConnect/index.vue b/src/views/base/equipmentPlcConnect/index.vue index c94dc250..eb6cfe62 100644 --- a/src/views/base/equipmentPlcConnect/index.vue +++ b/src/views/base/equipmentPlcConnect/index.vue @@ -1,209 +1,333 @@ From 31dbc025c87060c5ea8cb36853af9100187b4edb Mon Sep 17 00:00:00 2001 From: lb Date: Fri, 1 Sep 2023 17:05:05 +0800 Subject: [PATCH 3/3] =?UTF-8?q?done=20=E8=AE=BE=E5=A4=87=E6=95=B0=E9=87=87?= =?UTF-8?q?=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/base/equipmentPlcConnect/index.vue | 20 +- src/views/base/equipmentPlcParam/index.vue | 683 ++++++++++++------- 2 files changed, 457 insertions(+), 246 deletions(-) diff --git a/src/views/base/equipmentPlcConnect/index.vue b/src/views/base/equipmentPlcConnect/index.vue index eb6cfe62..7554b9af 100644 --- a/src/views/base/equipmentPlcConnect/index.vue +++ b/src/views/base/equipmentPlcConnect/index.vue @@ -53,7 +53,7 @@ import { } from '@/api/base/equipmentPlcConnect'; import moment from 'moment'; import basicPageMixin from '@/mixins/lb/basicPageMixin'; -import './http'; +// import './http'; export default { name: 'EquipmentPlcConnect', @@ -214,7 +214,23 @@ export default { switch (action) { case 'params-bind': this.reset(); - console.log('Cha看绑定参数弹窗') + const { + id, + equipmentName, + equipmentId, + plcId, + plcName, + plcTableName, + } = payload; + // console.log('Cha看绑定参数弹窗', id, equipmentName, plcTableName); + this.$router.push({ + name: 'EquipmentPlcParam', + params: { + id, + equipmentName, + plcTableName, + }, + }); break; } }, diff --git a/src/views/base/equipmentPlcParam/index.vue b/src/views/base/equipmentPlcParam/index.vue index 7c854ef1..161b1b76 100644 --- a/src/views/base/equipmentPlcParam/index.vue +++ b/src/views/base/equipmentPlcParam/index.vue @@ -1,255 +1,450 @@