From 90c0598af73f776bb2ad4899c3d2db575a7b71e4 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Mon, 9 Dec 2019 15:35:57 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=AE=A2=E5=8D=95=E9=A1=B5=E9=9D=A2=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/index.js | 4 ++- src/store/modules/order.js | 28 ++++++++++++++++++++ src/views/orderauthor/order/addGoods.vue | 33 +++++++++++++++++++----- src/views/orderauthor/order/draft.vue | 5 ++++ 4 files changed, 62 insertions(+), 8 deletions(-) create mode 100644 src/store/modules/order.js diff --git a/src/store/index.js b/src/store/index.js index 4dec2dc70..6feaf3b5f 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -14,6 +14,7 @@ import runPlan from './modules/runplan'; import socket from './modules/socket'; import scriptRecord from './modules/scriptRecord'; import ibp from './modules/ibp'; +import order from './modules/order'; import getters from './getters'; @@ -34,7 +35,8 @@ const store = new Vuex.Store({ runPlan, socket, scriptRecord, - ibp + ibp, + order }, getters }); diff --git a/src/store/modules/order.js b/src/store/modules/order.js new file mode 100644 index 000000000..b85a0ddf6 --- /dev/null +++ b/src/store/modules/order.js @@ -0,0 +1,28 @@ +/** + * 实训状态数据 + */ +const order = { + namespaced: true, + state: { + orderList: [] // 选中的商品列表, + }, + getters: { + orderList: (state)=>{ + return state.orderList; + } + }, + mutations: { + setOrderList: (state, orderList) => { + state.orderList = orderList; + } + }, + actions: { + /** + * 设置选中的商品列表 + */ + setOrderList: ({ commit }, orderList) => { + commit('setOrderList', orderList); + } + } +}; +export default order; diff --git a/src/views/orderauthor/order/addGoods.vue b/src/views/orderauthor/order/addGoods.vue index 3a50fff64..2338682c5 100644 --- a/src/views/orderauthor/order/addGoods.vue +++ b/src/views/orderauthor/order/addGoods.vue @@ -122,19 +122,38 @@ export default { name: this.$t('global.append'), handleClick: this.handlePut, type: '', - showControl: (row) => { return !row.isPut; } + showControl: (row) => { + const orderList = this.$store.state.order.orderList; + if (orderList.length > 0) { + const order = orderList.find(item=>{ return item.goodsId == row.id; }); + if (order) { + return false; + } else { + return true; + } + } else { + return !row.isPut; + } + } }, { name: this.$t('global.delete'), handleClick: this.handlePop, type: 'warning', - showControl: (row) => { return row.isPut; } + showControl: (row) => { + const orderList = this.$store.state.order.orderList; + if (orderList.length > 0) { + const order = orderList.find(item=>{ return item.goodsId == row.id; }); + if (order) { + return true; + } else { + return false; + } + } else { + return row.isPut; + } + } } - // { - // name: this.$t('orderAuthor.select'), - // type: 'primary', - // handleClick: this.handleAdd - // } ] } ], diff --git a/src/views/orderauthor/order/draft.vue b/src/views/orderauthor/order/draft.vue index f943bf7eb..76969a3d4 100644 --- a/src/views/orderauthor/order/draft.vue +++ b/src/views/orderauthor/order/draft.vue @@ -318,12 +318,15 @@ export default { 'goodsPrice':row.price }; this.formModel.detailCreateVOList.push(data); + this.$store.dispatch('order/setOrderList', this.formModel.detailCreateVOList); }, removeGoods(data) { this.formModel.detailCreateVOList = this.formModel.detailCreateVOList.filter(({ goodsId }) => goodsId !== data.goodsId); + this.$store.dispatch('order/setOrderList', this.formModel.detailCreateVOList); }, deleteGoods(index, row) { this.formModel.detailCreateVOList = this.formModel.detailCreateVOList.filter(({ goodsId }) => goodsId !== row.id); + this.$store.dispatch('order/setOrderList', this.formModel.detailCreateVOList); }, initLoadPage() { // 加载字典数据 @@ -519,6 +522,7 @@ export default { this.loading = true; createOrder(this.buildModel()).then(response => { this.turnback(); + this.$store.dispatch('order/setOrderList', []); this.loading = false; this.$message.success(this.$t('tip.creatingSuccessful')); }).catch(() => { @@ -542,6 +546,7 @@ export default { }); }, turnback() { + this.$store.dispatch('order/setOrderList', []); this.$router.go(-1); } } From b7fd5b7475000d6ceb1e6d2f3827ebe94e5441bd Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Mon, 9 Dec 2019 16:52:01 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E9=A1=B5=E9=9D=A2=E4=BB=A3=E7=A0=81=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/management/goods.js | 7 ++ src/views/orderauthor/order/detail.vue | 108 +++++++++---------------- src/views/orderauthor/order/list.vue | 23 +++--- 3 files changed, 57 insertions(+), 81 deletions(-) diff --git a/src/api/management/goods.js b/src/api/management/goods.js index 245f16864..ae1a9ff6a 100644 --- a/src/api/management/goods.js +++ b/src/api/management/goods.js @@ -148,3 +148,10 @@ export function postCreatePackage(data) { data: data }); } +// 获取订单对应的商品列表 +export function getGoodsListByOrderId(id) { + return request({ + url: `/api/order/${id}`, + method: 'get' + }); +} diff --git a/src/views/orderauthor/order/detail.vue b/src/views/orderauthor/order/detail.vue index 33413e6fe..3d6b83434 100644 --- a/src/views/orderauthor/order/detail.vue +++ b/src/views/orderauthor/order/detail.vue @@ -1,89 +1,61 @@ diff --git a/src/views/newMap/newMapdraft/mapoperate/switch.vue b/src/views/newMap/newMapdraft/mapoperate/switch.vue index f3b0e4eb3..7012a1381 100644 --- a/src/views/newMap/newMapdraft/mapoperate/switch.vue +++ b/src/views/newMap/newMapdraft/mapoperate/switch.vue @@ -479,53 +479,55 @@ export default { const models = []; const switchList = [...this.switchList, ...list]; if (list && list.length && sectionLists && sectionLists.length) { - const sectionList = []; - const addSectionList = []; + const sectionList = []; const addSectionList = []; const switchSectionList = []; list.forEach(elem => { const sectionb = this.findSectionData(sectionLists, elem.sectionBCode); const sectiona = this.findSectionData(sectionLists, elem.sectionACode); const sectionc = this.findSectionData(sectionLists, elem.sectionCCode); const parentSectionModel = this.$store.getters['map/getDeviceByCode'](sectiona.parentCode); if (!parentSectionModel) { // 找不到父元素删除 - let uid; - if (!elem['uid']) { - uid = getUID('T', [...this.sectionList, ...addSectionList]); - elem['uid'] = uid; + if (switchSectionList.indexOf(elem.code) == -1) { + let uid; + if (!elem['uid']) { + uid = getUID('T', [...this.sectionList, ...addSectionList]); + elem['uid'] = uid; + } + addSectionList.push({ code: elem.uid }); + sectiona.parentCode = elem['uid']; + sectionb.parentCode = elem['uid']; + sectionc.parentCode = elem['uid']; + elem['relevanceSectionList'] = [elem.sectionACode, elem.sectionBCode, elem.sectionCCode]; + sectionList.push(elem); + switchList.forEach(ele => { + const sectiona1 = this.findSectionData(sectionLists, ele.sectionACode); + const sectionc1 = this.findSectionData(sectionLists, ele.sectionCCode); + const sectionb1 = this.findSectionData(sectionLists, ele.sectionBCode); + if (sectionb1.points[sectionb1.points.length - 1].x == sectionb.points[0].x && sectionb1.points[sectionb1.points.length - 1].y == sectionb.points[0].y) { + ele['uid'] = uid; + elem['relevanceSectionList'] = [elem.sectionACode, elem.sectionBCode, elem.sectionCCode, ele.sectionACode, ele.sectionBCode, ele.sectionCCode]; + sectiona1.parentCode = uid; + sectionb1.parentCode = uid; + sectionc1.parentCode = uid; + switchSectionList.push(ele.code); + sectionList.forEach((item, index) => { + if (item.code == ele.code) { + sectionList.splice(index, 1); + } + }); + } + // if (sectiona1.points[sectiona1.points.length - 1].x == sectiona.points[0].x && sectiona1.points[sectiona1.points.length - 1].y == sectiona.points[0].y) { + // elem['relevanceSectionList'] = [elem.sectionACode, elem.sectionBCode, elem.sectionCCode, ele.sectionACode, ele.sectionBCode, ele.sectionCCode]; + // sectiona1.parentCode = uid; + // sectionb1.parentCode = uid; + // sectionc1.parentCode = uid; + // sectionList.forEach((item, index) => { + // if (item.code == elem.code) { + // sectionList.splice(index, 1); + // } + // }); + // } + }); } - addSectionList.push({ code: elem.uid }); - sectiona.parentCode = elem['uid']; - sectionb.parentCode = elem['uid']; - sectionc.parentCode = elem['uid']; - elem['relevanceSectionList'] = elem['relevanceSectionList'] || [elem.sectionACode, elem.sectionBCode, elem.sectionCCode]; - sectionList.push(elem); - switchList.forEach(ele => { - const sectiona1 = this.findSectionData(sectionLists, ele.sectionACode); - const sectionc1 = this.findSectionData(sectionLists, ele.sectionCCode); - const sectionb1 = this.findSectionData(sectionLists, ele.sectionBCode); - if (sectionb1.points[sectionb1.points.length - 1].x == sectionb.points[0].x && sectionb1.points[sectionb1.points.length - 1].y == sectionb.points[0].y) { - ele['uid'] = uid; - elem['relevanceSectionList'] = [elem.sectionACode, elem.sectionBCode, elem.sectionCCode, ele.sectionACode, ele.sectionBCode, ele.sectionCCode]; - sectiona1.parentCode = uid; - sectionb1.parentCode = uid; - sectionc1.parentCode = uid; - sectionList.forEach((item, index) => { - if (item.code == elem.code) { - sectionList.splice(index, 1); - } - }); - } - if (sectiona1.points[sectiona1.points.length - 1].x == sectiona.points[0].x && sectiona1.points[sectiona1.points.length - 1].y == sectiona.points[0].y) { - elem['relevanceSectionList'] = [elem.sectionACode, elem.sectionBCode, elem.sectionCCode, ele.sectionACode, ele.sectionBCode, ele.sectionCCode]; - sectiona1.parentCode = uid; - sectionb1.parentCode = uid; - sectionc1.parentCode = uid; - sectionList.forEach((item, index) => { - if (item.code == elem.code) { - sectionList.splice(index, 1); - } - }); - } - }); } else { parentSectionModel.relevanceSectionList.push(elem.sectionACode); parentSectionModel.relevanceSectionList.push(elem.sectionBCode); From 6d26e8e21735cc6132bffc0d26e3b99325b20538 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Mon, 9 Dec 2019 18:54:11 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E8=BF=9B=E8=B7=AF=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E5=85=88=E9=94=81=E9=97=AD=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/QueryListPage/DataForm.vue | 2 +- src/i18n/langs/en/map.js | 3 ++- src/i18n/langs/zh/map.js | 3 ++- .../newMapdraft/dataRelation/routeoperate/route.vue | 8 ++++++++ src/views/orderauthor/order/draft.vue | 5 +---- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/components/QueryListPage/DataForm.vue b/src/components/QueryListPage/DataForm.vue index 0eb2f62b0..c23734a1b 100644 --- a/src/components/QueryListPage/DataForm.vue +++ b/src/components/QueryListPage/DataForm.vue @@ -236,7 +236,7 @@
{{ item.buttontip }} - +