From 54d62d0f92610efb58a4451026778a4b7e3fe471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=B5=A9=E7=8E=AE?= Date: Wed, 7 Jul 2021 17:04:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/oceanus.js | 25 +++ src/components/action_button/index.vue | 8 +- src/components/table/drawer.vue | 2 + src/components/table/index.vue | 19 +- src/components/table/my_item.vue | 10 +- .../oceanus/category/components/LeftTree.vue | 149 +++++++++++++++ .../category/components/OceanusTree.vue | 41 ---- .../category/components/RightTable.vue | 179 ++++++++++++++++++ .../category/components/TreeDrawer.vue | 54 ++++++ src/pages/oceanus/category/index.vue | 82 +------- .../oceanus/equipment/components/LeftTree.vue | 167 ++++++++++++++++ .../equipment/components/RightTable.vue | 179 ++++++++++++++++++ .../equipment/components/TreeDrawer.vue | 54 ++++++ src/pages/oceanus/equipment/index.vue | 22 ++- .../view/organization/usermanagement/User.vue | 20 +- .../Certificate/CertificateItem.vue | 15 +- .../view/organization/usermanagement/form.vue | 4 +- 17 files changed, 892 insertions(+), 138 deletions(-) create mode 100644 src/pages/oceanus/category/components/LeftTree.vue delete mode 100644 src/pages/oceanus/category/components/OceanusTree.vue create mode 100644 src/pages/oceanus/category/components/RightTable.vue create mode 100644 src/pages/oceanus/category/components/TreeDrawer.vue create mode 100644 src/pages/oceanus/equipment/components/LeftTree.vue create mode 100644 src/pages/oceanus/equipment/components/RightTable.vue create mode 100644 src/pages/oceanus/equipment/components/TreeDrawer.vue diff --git a/src/api/oceanus.js b/src/api/oceanus.js index 60aa291..603577e 100644 --- a/src/api/oceanus.js +++ b/src/api/oceanus.js @@ -6,8 +6,33 @@ function getOceanusTreeApi(data) { function addOceanusTreeApi(data) { return postReq('/oceanus/api/v1/categories', data); } +function updateOceanusTreeApi(data) { + return putReq('/oceanus/api/v1/categories', data); +} +function delOceanusTreeApi(data) { + return putReq(`/oceanus/api/v1/categories/${data.categoryId}`, data); +} +function addAttributesApi(data) { + return postReq('/oceanus/api/v1/categories/attributes', data); +} +function updateAttributesApi(data) { + return putReq('/oceanus/api/v1/categories/attributes', data); +} +function movementAttributesApi(data) { + return putReq('/oceanus/api/v1/categories/attributes/movement', data); +} + +function getEquipmentsTreeApi(data) { + return getReq(`/oceanus/api/v1/equipments/catalogs/${data.catalogId}`, data); +} export default { getOceanusTree: getOceanusTreeApi, addOceanusTree: addOceanusTreeApi, + updateOceanusTree: updateOceanusTreeApi, + delOceanusTree: delOceanusTreeApi, + addAttributes: addAttributesApi, + updateAttributes: updateAttributesApi, + movementAttributes: movementAttributesApi, + getEquipmentsTree: getEquipmentsTreeApi, }; diff --git a/src/components/action_button/index.vue b/src/components/action_button/index.vue index 9bd580d..df13270 100644 --- a/src/components/action_button/index.vue +++ b/src/components/action_button/index.vue @@ -6,7 +6,7 @@ v-if="btn.type === 'confirm'" :cb="btn.after" :title="btn.title" - :onOk="btn.onOk" + :onOk="() => btn.onOk && btn.onOk(row)" :label="btn.label" /> {{ btn.label }} @@ -23,7 +23,7 @@ v-if="btn.type === 'confirm'" :cb="btn.after" :title="btn.title" - :onOk="btn.onOk" + :onOk="() => btn.onOk && btn.onOk(row)" :label="btn.label" /> {{ btn.label }} @@ -77,10 +77,10 @@ export default { return url; }, init() { - this.buttons.map(i => { + this.buttons.map((i) => { i.__hidden__ = i.isHidden && i.isHidden(this.row); }); - this.buttonsArr = this.buttons.filter(i => !i.__hidden__); + this.buttonsArr = this.buttons.filter((i) => !i.__hidden__); }, }, }; diff --git a/src/components/table/drawer.vue b/src/components/table/drawer.vue index 96f313c..04baaf6 100644 --- a/src/components/table/drawer.vue +++ b/src/components/table/drawer.vue @@ -32,6 +32,7 @@ export default { props: { oncancel: Function, onOk: Function, + colesAfter: Function, value: Boolean, width: { type: Number, default: 600 }, }, @@ -72,6 +73,7 @@ export default { // TODO } this.loading = false; + this.colesAfter && this.colesAfter(); }, }, }; diff --git a/src/components/table/index.vue b/src/components/table/index.vue index b8055f0..dec5748 100644 --- a/src/components/table/index.vue +++ b/src/components/table/index.vue @@ -15,7 +15,7 @@ - + {{ addBtn.text || '新建' }} @@ -89,11 +89,16 @@ export default { formatData: Function, noPage: Boolean, rowSelection: Object, // radio OR checkbox + tableParam: { + type: Object, + default: () => ({}), + }, }, data() { return { initQuery: { ...initQuery, + ...this.tableParam, }, title: '新增', data: [], @@ -126,6 +131,9 @@ export default { addVisible(val) { if (!val && this?.addBtn?.onCancel) this.addBtn.onCancel(); }, + tableParam(val) { + this.reset(); + }, }, mounted() { this.getData(); @@ -165,14 +173,14 @@ export default { }, async getDataNoPage() { const res = await request(this.url, METHOD.GET, this.queryForm); - if (this.formatData) this.data = this.formatData(res); + if (this.formatData) this.data = await this.formatData(res); else this.data = res; }, async getDataWithPage() { const res = await request(this.url, METHOD.GET, { ...this.initQuery, ...this.queryForm }); this.total = res.total; - if (this.formatData) this.data = this.formatData(res); + if (this.formatData) this.data = await this.formatData(res); else this.data = res.records; }, @@ -214,7 +222,7 @@ export default { }, reset() { this.queryForm = {}; - this.initQuery = { ...initQuery }; + this.initQuery = { ...initQuery, ...this.tableParam }; this.getData(); }, pageChange(page) { @@ -236,6 +244,9 @@ export default { getTableData() { return this.data; }, + setTableData(data) { + this.data = data; + }, }, }; diff --git a/src/components/table/my_item.vue b/src/components/table/my_item.vue index e27e742..4176eb5 100644 --- a/src/components/table/my_item.vue +++ b/src/components/table/my_item.vue @@ -1,5 +1,5 @@