diff --git a/src/api/oceanus.js b/src/api/oceanus.js index 60aa291fe79c93edec80d8c79eeddfae57f5df3c..603577e82a21fc831c6029a948f6a2eb4e0bc747 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 9bd580d041555a596ac398cf814d3959c6f4b0e9..df1327062c59b4494c71538d30a02531bd92b208 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 96f313cc6b867ba72d2ec75688e724450e611c5d..04baaf6e167b702fbb244d144934e60ffc0e12bd 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 b8055f064884e77ed2f32fbccfb7c26d06ea7c5a..dec57485c6b3a750067ade70db0364405871f6e4 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 e27e74263dc0f1f5924634de8e53624ed86315da..4176eb52b471a8be5a116bc1e3c2754859308b4c 100644 --- a/src/components/table/my_item.vue +++ b/src/components/table/my_item.vue @@ -1,5 +1,5 @@