diff --git a/src/api/oceanus.js b/src/api/oceanus.js new file mode 100644 index 0000000000000000000000000000000000000000..60aa291fe79c93edec80d8c79eeddfae57f5df3c --- /dev/null +++ b/src/api/oceanus.js @@ -0,0 +1,13 @@ +import { delReq, getReq, postReq, putReq } from '@/utils'; + +function getOceanusTreeApi(data) { + return getReq('/oceanus/api/v1/categories', data); +} +function addOceanusTreeApi(data) { + return postReq('/oceanus/api/v1/categories', data); +} + +export default { + getOceanusTree: getOceanusTreeApi, + addOceanusTree: addOceanusTreeApi, +}; diff --git a/src/components/FormMixin/index.js b/src/components/FormMixin/index.js index 370edc973636e39a7988954741f2b11e571b4be2..e48125d1089d3d995d94b83533655f7359ec5e20 100644 --- a/src/components/FormMixin/index.js +++ b/src/components/FormMixin/index.js @@ -3,6 +3,7 @@ export default { return { type: 0, form: {}, + title: '', }; }, computed: { @@ -29,7 +30,15 @@ export default { setData(data, type) { this.form = { ...data }; this.type = type; - console.log(data, type); + if (type === 0) { + this.title = '新增'; + } else if (type === 1) { + this.title = '编辑'; + } else if (type === 2) { + this.title = '查看'; + } else { + this.title = ''; + } }, }, }; diff --git a/src/pages/oceanus/category/components/OceanusTree.vue b/src/pages/oceanus/category/components/OceanusTree.vue new file mode 100644 index 0000000000000000000000000000000000000000..1723ec8a16b6211fdba03d8378e9aa27260369c5 --- /dev/null +++ b/src/pages/oceanus/category/components/OceanusTree.vue @@ -0,0 +1,41 @@ + + + diff --git a/src/pages/oceanus/category/index.vue b/src/pages/oceanus/category/index.vue new file mode 100644 index 0000000000000000000000000000000000000000..b2c0440dfb378f4d96fe922685b7e99b1aa51808 --- /dev/null +++ b/src/pages/oceanus/category/index.vue @@ -0,0 +1,91 @@ + + + + diff --git a/src/pages/oceanus/equipment/index.vue b/src/pages/oceanus/equipment/index.vue new file mode 100644 index 0000000000000000000000000000000000000000..c699d32707f22be7e73929acd7b28dbad67685f8 --- /dev/null +++ b/src/pages/oceanus/equipment/index.vue @@ -0,0 +1,7 @@ + + + diff --git a/src/pages/system/view/organization/components/OrganizationTree.vue b/src/pages/system/view/organization/components/OrganizationTree.vue index 89cad82f91ccbadaf9427fb8dcb80c2b2bad805a..14ab59d5b9569bbeb762c68eb18ea43d94b9e3a8 100644 --- a/src/pages/system/view/organization/components/OrganizationTree.vue +++ b/src/pages/system/view/organization/components/OrganizationTree.vue @@ -37,9 +37,13 @@ export default { }; }, async mounted() { - this.rawData = await api.getOrganizationList(); + const rawData = await api.getOrganizationList(); + const newData = rawData.map((i) => ({ + ...i, + selectable: i.orgType === 'DEPARTMENT', + })); const newArr = new arrayToTree({ - data: this.rawData, + data: newData, rootValue: 0, parentKey: 'parentOrgId', key: 'orgId', diff --git a/src/pages/system/view/organization/orgmanagement/Org.vue b/src/pages/system/view/organization/orgmanagement/Org.vue index e3c4dbcb01262c552451070a4eb6b2380eb3ea0d..82b1b23825286f98eba1be581d9677666fc9f895 100644 --- a/src/pages/system/view/organization/orgmanagement/Org.vue +++ b/src/pages/system/view/organization/orgmanagement/Org.vue @@ -52,8 +52,13 @@ export default { }); }, formatData(data) { + const newData = data.map((i) => ({ + ...i, + selectable: i.orgType === 'DEPARTMENT', + })); + const newArr = new arrayToTree({ - data: data, + data: newData, rootValue: 0, parentKey: 'parentOrgId', key: 'orgId', diff --git a/src/router/config.js b/src/router/config.js index 2e676be6bd92ee37d223019061abafe86256329d..79a061ca464a94d8914ce71fb28b31739f406674 100644 --- a/src/router/config.js +++ b/src/router/config.js @@ -143,6 +143,26 @@ const hasAuthorityRoutes = [ }, ], }, + { + path: 'oceanus', + name: '设备管理', + meta: { + icon: 'control', + }, + component: PageTemplateView, + children: [ + { + path: 'category', + name: '分类配置', + component: () => import('@/pages/oceanus/category/index.vue'), + }, + { + path: 'equipment', + name: '设备台账', + component: () => import('@/pages/oceanus/equipment/index.vue'), + }, + ], + }, { path: 'user', name: '个人中心', diff --git a/src/utils/index.js b/src/utils/index.js index e8fc267782349b57794037099a7c804d4c7ae068..dbd57c20207e6172753bb392466eb5113b595e0f 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -85,7 +85,6 @@ export function arrayToTree(options) { const THISDATA = JSON.parse(JSON.stringify(this.data)); for (let i = 0; i < this.data.length; i++) { let currentElement = this.data[i]; - currentElement.selectable = currentElement.orgType === 'DEPARTMENT'; let tempCurrentElementParent = this.indexStorage[currentElement[this.parentKey]]; // 临时变量里面的当前元素的父元素 if (tempCurrentElementParent) { // 如果存在父元素 diff --git a/src/utils/requestUtil.js b/src/utils/requestUtil.js index f961ef030c264b09ec4b47194005f55683a54aba..fca6e639fef2d4512b5aafdae9dd4957c0f27d66 100644 --- a/src/utils/requestUtil.js +++ b/src/utils/requestUtil.js @@ -11,6 +11,8 @@ axios.defaults.withCredentials = true; axios.defaults.xsrfHeaderName = xsrfHeaderName; axios.defaults.xsrfCookieName = xsrfHeaderName; +axios.defaults.baseURL = '/api'; + /** * @param {*} info 提示函数 */ diff --git a/vue.config.js b/vue.config.js index 663d87db35e4d75ed7637aa5abbd7e6b2fd0d64e..7b2497a088cf50554b1a445484fd90442a4a3124 100644 --- a/vue.config.js +++ b/vue.config.js @@ -193,14 +193,14 @@ const assetsCDN = { module.exports = { devServer: { proxy: { - '/api': { + '/api/': { //此处要与 /services/api.js 中的 API_PROXY_PREFIX 值保持一致 // target: process.env.VUE_APP_API_BASE_URL, target: 'http://platform.kuopu.net:9300', changeOrigin: true, - // pathRewrite: { - // '^/api': '' - // } + pathRewrite: { + '^/api/': '', + }, }, }, },