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/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..7554b9af 100644 --- a/src/views/base/equipmentPlcConnect/index.vue +++ b/src/views/base/equipmentPlcConnect/index.vue @@ -1,209 +1,349 @@ 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 @@ 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"