From 0959c095ad9715633d6ccdf10eb3b3d52f0bede1 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期二, 09 五月 2023 09:31:46 +0800 Subject: [PATCH] 2023.5.9前所有小改动版本记录 --- src/views/baseinfo/fysp/scene/CompSceneConstructionInfo.vue | 2 src/views/fytz/user/UserEdit.vue | 181 ++++++ src/components.d.ts | 6 src/components/core/MenuItems.vue | 61 ++ src/views/fytz/user/components/CompUserInfo.vue | 305 ++++++++++ src/api/fytz/noticeApi.js | 38 src/composables/formConfirm.js | 35 src/views/fytz/user/UserInfo.vue | 295 ++++++++++ src/views/common/CompTransfer.vue | 114 ++++ src/views/baseinfo/fysp/user/CompUserInfo.vue | 2 src/views/common/UserMatch.vue | 19 src/views/baseinfo/fysp/scene/SceneEdit.vue | 4 src/views/notice/NoticeManage.vue | 2 src/api/index.js | 17 src/api/fysp/sceneApi.js | 32 src/views/baseinfo/fysp/scene/SceneInfo.vue | 2 src/views/notice/CompNoticeAdd.vue | 4 src/api/fysp/taskApi.js | 37 + src/components/SearchBar.vue | 2 src/components/core/SiderMenu.vue | 99 --- src/api/fytz/userApi.js | 45 + src/views/notice/CompNoticeAddDrawer.vue | 2 src/views/fysp/night-construction/NightConstruction.vue | 0 src/enum/user.js | 6 src/views/baseinfo/fysp/scene/CompSceneDeviceInfo.vue | 6 src/api/fysp/problemApi.js | 22 src/api/fysp/userApi.js | 33 + src/router/index.js | 22 src/components/ProblemCard.vue | 75 + /dev/null | 31 - src/components/core/Content.vue | 12 src/enum/scene.js | 21 src/views/fytz/user/components/CompUserInfoAddDrawer.vue | 67 ++ src/App.vue | 1 src/views/baseinfo/fysp/scene/CompSceneBaseInfo.vue | 13 src/views/check/ProCheck.vue | 51 + 36 files changed, 1,420 insertions(+), 244 deletions(-) diff --git a/src/App.vue b/src/App.vue index b3366b0..d8dfe8b 100644 --- a/src/App.vue +++ b/src/App.vue @@ -4,7 +4,6 @@ <el-aside class="el-aside" ><SiderMenu :collapse="isCollapsed" - @collapsed-sider="collapsedSider" @nav-page="navPage" ></SiderMenu ></el-aside> diff --git a/src/api/fysp/problemApi.js b/src/api/fysp/problemApi.js new file mode 100644 index 0000000..747067c --- /dev/null +++ b/src/api/fysp/problemApi.js @@ -0,0 +1,22 @@ +import { $fysp } from '../index'; + +const id = 'IF3DgsgKxSWvTM3M'; +const name = 'pcheck'; + +export default { + /** + * 鑾峰彇瀛愪换鍔$粺璁′俊鎭� + * @param {Number} action 0锛氶棶棰橀�氳繃锛�1锛氶棶棰樹笉閫氳繃锛�2锛氭暣鏀归�氳繃锛�3鏁存敼涓嶉�氳繃 + */ + checkProblem({ pId, action, remark = '', userId = id, userName = name }) { + return $fysp + .post('problemlist/check', { + pId: pId, + action: action, + remark: remark, + userId: userId, + userName: userName, + }) + .then((res) => res.data); + }, +}; diff --git a/src/api/sceneApi.js b/src/api/fysp/sceneApi.js similarity index 67% rename from src/api/sceneApi.js rename to src/api/fysp/sceneApi.js index 89b112e..d17004d 100644 --- a/src/api/sceneApi.js +++ b/src/api/fysp/sceneApi.js @@ -1,4 +1,4 @@ -import { $fysp } from './index'; +import { $fysp } from '../index'; export default { /** @@ -7,7 +7,7 @@ */ searchScene(area, page = 1, perPage = 20) { const params = `page=${page}&per_page=${perPage}`; - return $fysp.post(`scense/find?${params}`, area); + return $fysp.post(`scense/find?${params}`, area).then((res) => res.data); }, /** @@ -16,11 +16,13 @@ * @returns 鍦烘櫙璇︽儏 */ getSceneDetail(sId) { - return $fysp.get(`scense/detail`, { - params: { - sceneId: sId, - }, - }); + return $fysp + .get(`scense/detail`, { + params: { + sceneId: sId, + }, + }) + .then((res) => res.data); }, /** @@ -33,21 +35,27 @@ subScene: subScene ? JSON.stringify(subScene) : null, sceneDevice: sceneDevice ? sceneDevice : null, }; - return $fysp.post(`scense/detail/update?${params}`, rb); + return $fysp + .post(`scense/detail/update?${params}`, rb) + .then((res) => res.data); }, /** * 鏇存柊鍦烘櫙棰濆淇℃伅 */ updateSubScene(typeId, subScene) { - return this.updateSceneDetail(typeId, { subScene: subScene }); + return this.updateSceneDetail(typeId, { subScene: subScene }).then( + (res) => res.data + ); }, /** * 鏇存柊鍦烘櫙璁惧淇℃伅 */ updateSceneDevice(typeId, sceneDevice) { - return this.updateSceneDetail(typeId, { sceneDevice: sceneDevice }); + return this.updateSceneDetail(typeId, { sceneDevice: sceneDevice }).then( + (res) => res.data + ); }, /** @@ -55,7 +63,7 @@ * @param {Object} scene */ createScene(scene) { - return $fysp.put('scense', scene); + return $fysp.put('scense', scene).then((res) => res.data); }, /** @@ -63,6 +71,6 @@ * @param {Object} scene */ updateScene(scene) { - return $fysp.post('scense', scene); + return $fysp.post('scense', scene).then((res) => res.data); }, }; diff --git a/src/api/fysp/taskApi.js b/src/api/fysp/taskApi.js new file mode 100644 index 0000000..787e520 --- /dev/null +++ b/src/api/fysp/taskApi.js @@ -0,0 +1,37 @@ +import { $fysp } from '../index'; + +export default { + /** + * 鑾峰彇椤跺眰浠诲姟 + */ + getTopTask() { + return $fysp.get('task/alltask/0').then((res) => res.data); + }, + + /** + * 鑾峰彇瀛愪换鍔$粺璁′俊鎭� + */ + getSubtaskSummary({ topTaskId = undefined, sceneTypeId = undefined }) { + return $fysp + .get('subtask/summary', { + params: { + topTaskId: topTaskId, + sceneTypeId: sceneTypeId, + }, + }) + .then((res) => res.data); + }, + + /** + * 鑾峰彇瀛愪换鍔¢棶棰樿鎯� + */ + getProBySubtask(id) { + return $fysp + .get('problemlist/subtask', { + params: { + stGuid: id, + }, + }) + .then((res) => res.data); + }, +}; diff --git a/src/api/fysp/userApi.js b/src/api/fysp/userApi.js new file mode 100644 index 0000000..838d799 --- /dev/null +++ b/src/api/fysp/userApi.js @@ -0,0 +1,33 @@ +import { $fysp } from '../index'; + +export default { + /** + * 鑾峰彇鐢ㄦ埛璇︽儏 + */ + getUserById(id) { + return $fysp.get(`userinfo/${id}`).then((res) => res.data); + }, + + /** + * 鏇存柊鐢ㄦ埛璇︽儏 + */ + updateUser(user) { + return $fysp.post(`userinfo`, user).then((res) => res.data); + }, + + /** + * 鑾峰彇鍦烘櫙鐨勭敤鎴疯鎯� + */ + getUserByScene(sId) { + return $fysp + .get(`userinfo/scene/get?sceneId=${sId}`) + .then((res) => res.data); + }, + + /** + * 鑷姩鍒涘缓璐︽埛 + */ + autoCreateAccount(sId) { + return $fysp.post(`userinfo/create?sceneId=${sId}`).then((res) => res.data); + }, +}; diff --git a/src/api/noticeApi.js b/src/api/fytz/noticeApi.js similarity index 64% rename from src/api/noticeApi.js rename to src/api/fytz/noticeApi.js index 70f9b98..175bd98 100644 --- a/src/api/noticeApi.js +++ b/src/api/fytz/noticeApi.js @@ -1,6 +1,6 @@ -import { $fytz } from './index'; +import { $fytz } from '../index'; -const id = 'IF3DgsgKxSWvTM3M'; +const id = 'BbEfZ4izeR4TEZ2N'; const name = 'pcheck'; export default { @@ -9,23 +9,27 @@ */ getNoticeHistory({ type, subtype = null, page = 1, perPage = 20 }) { const params = `userId=${id}&page=${page}&per_page=${perPage}`; - return $fytz.post(`notifications/history?${params}`, { - ecNoticetype: type, - ecNoticesubtype: subtype, - }); + return $fytz + .post(`notifications/history?${params}`, { + ecNoticetype: type, + ecNoticesubtype: subtype, + }) + .then((res) => res.data); }, /** * 鑾峰彇鐢ㄦ埛鏈閫氱煡 */ getNotification() { - return $fytz.get('notifications', { - params: { - userId: id, - page: 1, - per_page: 30, - }, - }); + return $fytz + .get('notifications', { + params: { + userId: id, + page: 1, + per_page: 30, + }, + }) + .then((res) => res.data); }, /** @@ -60,8 +64,10 @@ } */ releaseNotice(notice) { - notice.authorId = id - notice.authorName = name - return $fytz.post(`notifications/${id}/release2`, notice); + notice.authorId = id; + notice.authorName = name; + return $fytz + .post(`notifications/${id}/release2`, notice) + .then((res) => res.data); }, }; diff --git a/src/api/fytz/userApi.js b/src/api/fytz/userApi.js new file mode 100644 index 0000000..bcbf56b --- /dev/null +++ b/src/api/fytz/userApi.js @@ -0,0 +1,45 @@ +import { $fytz } from '../index'; + +export default { + /** + * 鎼滅储鐢ㄦ埛 + * @param {String} userId + * @param {Number} page + * @param {Number} per_page + * @param {Object} data + * @returns + */ + fetchUser(userId, page = 1, per_page = 20, data) { + const params = `page=${page}&per_page=${per_page}`; + return $fytz.post(`userInfo/searchUser/${userId}?${params}`, data); + }, + + /** + * 鑾峰彇鐢ㄦ埛鍩烘湰淇℃伅 + * @param {String} userId + * @returns + */ + fetchUserBaseInfo(userId) { + return $fytz + .get(`userInfo/baseInfo?userId=${userId}`) + .then((res) => res.data); + }, + + /** + * 鏇存柊鐢ㄦ埛璐︽埛淇℃伅 + * @param {*} data + * @returns + */ + updateUserInfo(data) { + return $fytz.post('userInfo', data).then((res) => res.data); + }, + + /** + * 鏂板鐢ㄦ埛 + * @param {*} data + * @returns + */ + createUser(data) { + return $fytz.put('userInfo', data).then((res) => res.data); + } +}; diff --git a/src/api/index.js b/src/api/index.js index 92b4ad8..f6755aa 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -4,8 +4,8 @@ const ip1 = 'http://47.100.191.150:9005/'; // const ip1 = 'http://192.168.1.12:8080/'; // const ip2 = 'http://47.100.191.150:9006/'; -// const ip2 = 'http://192.168.1.14:8080/'; -const ip2 = 'https://fyami.com.cn/' +// const ip2 = 'http://192.168.1.6:8080/'; +const ip2 = 'https://fyami.com.cn/'; //椋炵窘鐩戠 const $fysp = axios.create({ @@ -30,6 +30,9 @@ // 鍦ㄥ彂閫佽姹備箣鍓嶅仛浜涗粈涔� console.log('==>璇锋眰寮�濮�'); console.log(`${config.baseURL}${config.url}`); + if (config.data) { + console.log('==>璇锋眰鏁版嵁', config.data); + } return config; }, function (error) { @@ -52,7 +55,15 @@ console.log(response); console.log('==>璇锋眰缁撴潫'); if (response.status == 200) { - return response.data + if (response.data.success != undefined && response.data.success != null) { + if (response.data.success == true) { + return response; + } else { + return Promise.reject(response.data.message); + } + } else { + return response; + } } else { return Promise.reject(response); } diff --git a/src/api/problemApi.js b/src/api/problemApi.js deleted file mode 100644 index 8b17649..0000000 --- a/src/api/problemApi.js +++ /dev/null @@ -1,26 +0,0 @@ -import { $fysp } from './index'; - -const id = 'IF3DgsgKxSWvTM3M'; -const name = 'pcheck'; - -export default { - /** - * 鑾峰彇瀛愪换鍔$粺璁′俊鎭� - * @param {Number} action 0锛氶棶棰橀�氳繃锛�1锛氶棶棰樹笉閫氳繃锛�2锛氭暣鏀归�氳繃锛�3鏁存敼涓嶉�氳繃 - */ - checkProblem({ - pId, - action, - remark = '', - userId = id, - userName = name, - }) { - return $fysp.post('problemlist/check', { - pId: pId, - action: action, - remark: remark, - userId: userId, - userName: userName, - }); - }, -}; diff --git a/src/api/taskApi.js b/src/api/taskApi.js deleted file mode 100644 index c84e0f6..0000000 --- a/src/api/taskApi.js +++ /dev/null @@ -1,33 +0,0 @@ -import { $fysp } from './index'; - -export default { - /** - * 鑾峰彇椤跺眰浠诲姟 - */ - getTopTask() { - return $fysp.get('task/alltask/0'); - }, - - /** - * 鑾峰彇瀛愪换鍔$粺璁′俊鎭� - */ - getSubtaskSummary({ topTaskId = undefined, sceneTypeId = undefined }) { - return $fysp.get('subtask/summary',{ - params: { - topTaskId: topTaskId, - sceneTypeId: sceneTypeId - } - }) - }, - - /** - * 鑾峰彇瀛愪换鍔¢棶棰樿鎯� - */ - getProBySubtask(id) { - return $fysp.get('problemlist/subtask',{ - params: { - stGuid: id, - } - }) - } -}; diff --git a/src/api/userApi.js b/src/api/userApi.js deleted file mode 100644 index 726e4ca..0000000 --- a/src/api/userApi.js +++ /dev/null @@ -1,31 +0,0 @@ -import { $fysp } from './index'; - -export default { - /** - * 鑾峰彇鐢ㄦ埛璇︽儏 - */ - getUserById(id) { - return $fysp.get(`userinfo/${id}`); - }, - - /** - * 鏇存柊鐢ㄦ埛璇︽儏 - */ - updateUser(user) { - return $fysp.post(`userinfo`, user); - }, - - /** - * 鑾峰彇鍦烘櫙鐨勭敤鎴疯鎯� - */ - getUserByScene(sId) { - return $fysp.get(`userinfo/scene/get?sceneId=${sId}`); - }, - - /** - * 鑷姩鍒涘缓璐︽埛 - */ - autoCreateAccount(sId) { - return $fysp.post(`userinfo/create?sceneId=${sId}`); - }, -}; diff --git a/src/components.d.ts b/src/components.d.ts index 24267d7..385c905 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -45,16 +45,22 @@ ElScrollbar: typeof import('element-plus/es')['ElScrollbar'] ElSelect: typeof import('element-plus/es')['ElSelect'] ElSpace: typeof import('element-plus/es')['ElSpace'] + ElStep: typeof import('element-plus/es')['ElStep'] + ElSteps: typeof import('element-plus/es')['ElSteps'] ElSubMenu: typeof import('element-plus/es')['ElSubMenu'] ElSwitch: typeof import('element-plus/es')['ElSwitch'] ElTable: typeof import('element-plus/es')['ElTable'] ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] + ElTabPane: typeof import('element-plus/es')['ElTabPane'] + ElTabs: typeof import('element-plus/es')['ElTabs'] ElTag: typeof import('element-plus/es')['ElTag'] ElTooltip: typeof import('element-plus/es')['ElTooltip'] + ElTransfer: typeof import('element-plus/es')['ElTransfer'] ElTree: typeof import('element-plus/es')['ElTree'] Footer: typeof import('./components/core/Footer.vue')['default'] FormCol: typeof import('./components/layout/FormCol.vue')['default'] Header: typeof import('./components/core/Header.vue')['default'] + MenuItems: typeof import('./components/core/MenuItems.vue')['default'] ProblemCard: typeof import('./components/ProblemCard.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] diff --git a/src/components/ProblemCard.vue b/src/components/ProblemCard.vue index 3fea957..82064d0 100644 --- a/src/components/ProblemCard.vue +++ b/src/components/ProblemCard.vue @@ -1,20 +1,24 @@ <template> <el-card class="layout" shadow="hover"> - <!-- <el-steps :active="active" finish-status="success" style=""> - <el-step title="Step 1" style=""/> - <el-step title="Step 2" /> - <el-step title="Step 3" /> - </el-steps> --> - <el-descriptions :column="3" size="small" > + <el-steps :active="active" finish-status="success" style="" simple> + <el-step v-for="(s, i) in getSteps" :key="i" :title="s" /> + </el-steps> + + <el-descriptions :column="3" size="small"> <template #title> <span class="d-index">{{ index + 1 }}</span> <span class="d-title">{{ title }}</span> </template> <template #extra> <!-- <span class="d-extra">{{ status }}</span> --> - <el-tag style="font-size: 16px;line-height: 16px;padding: 14px;" :type="status.type" effect="plain" size="large" round>{{ - status.name - }}</el-tag> + <el-tag + style="font-size: 16px; line-height: 16px; padding: 14px" + :type="status.type" + effect="plain" + size="large" + round + >{{ status.name }}</el-tag + > </template> <el-descriptions-item label-class-name="descriptions-label-1" @@ -86,8 +90,8 @@ type: Object, default: () => { return { - name: "", - type: "", + name: '', + type: '', }; }, }, @@ -95,8 +99,8 @@ type: Array, default: () => [ { - name: "", - value: "", + name: '', + value: '', }, ], }, @@ -104,7 +108,7 @@ type: Array, default: () => [ { - title: "", + title: '', path: [], }, ], @@ -113,23 +117,52 @@ type: Array, default: () => [ { - name: "primary", - color: "primary", + name: 'primary', + color: 'primary', }, ], }, + // active: { + // type: Number, + // default: 3, + // }, }, emits: ['buttonClick'], data() { return { - active: 1 - } + active: 3, + steps: [ + { + bef: '闂寰呭鏍�', + aft: '闂宸插鏍�', + }, + { + bef: '闂寰呮暣鏀�', + aft: '闂宸叉暣鏀�', + }, + { + bef: '鏁存敼寰呭鏍�', + aft: '鏁存敼宸插鏍�', + }, + ], + }; + }, + computed: { + getSteps() { + return this.steps.map((v, i) => { + if (i >= this.active) { + return v.bef; + } else { + return v.aft; + } + }); + }, }, methods: { onButtonClick(i) { - this.$emit('buttonClick', this.index, i) - } - } + this.$emit('buttonClick', this.index, i); + }, + }, }; </script> <style scoped> diff --git a/src/components/SearchBar.vue b/src/components/SearchBar.vue index 2562c97..d2533eb 100644 --- a/src/components/SearchBar.vue +++ b/src/components/SearchBar.vue @@ -37,7 +37,7 @@ </template> <script> -import taskApi from '@/api/taskApi'; +import taskApi from '@/api/fysp/taskApi'; import { enumScene_2NA } from "@/enum/scene"; export default { diff --git a/src/components/core/Content.vue b/src/components/core/Content.vue index 5e69198..9ea18ea 100644 --- a/src/components/core/Content.vue +++ b/src/components/core/Content.vue @@ -1,10 +1,14 @@ <template> <router-view v-slot="{ Component, route }"> <!-- <transition :name="route.meta.transition || 'fade'"> --> - <keep-alive> - <component v-if="route.meta.keepAlive" :is="Component" /> - </keep-alive> - <component v-if="!route.meta.keepAlive" :is="Component" /> + <keep-alive> + <component + v-if="route.meta.keepAlive" + :is="Component" + :key="route.name" + /> + </keep-alive> + <component v-if="!route.meta.keepAlive" :is="Component" :key="route.name" /> <!-- </transition> --> </router-view> </template> diff --git a/src/components/core/MenuItems.vue b/src/components/core/MenuItems.vue new file mode 100644 index 0000000..74efbc9 --- /dev/null +++ b/src/components/core/MenuItems.vue @@ -0,0 +1,61 @@ +<template> + <template v-for="(item, i) in routes" :key="`${i}`"> + <el-sub-menu v-if="item.children" :index="`${i}`"> + <template #title> + <el-icon> + <component :is="item.icon"></component> + </el-icon> + <span>{{ item.name }}</span> + </template> + + <template v-for="(child, i2) in item.children" :key="`${i}-${i2}`"> + <el-menu-item-group v-if="child.group" :title="child.name"> + <el-menu-item + v-for="(child2, i3) in child.children" + :key="`${i}-${i2}-${i3}`" + :index="child2.path" + @click="navPage(item, child, child2)" + > + <el-icon v-if="child2.icon"> + <component :is="child2.icon"></component> + </el-icon> + <template #title>{{ child2.name }}</template> + </el-menu-item> + </el-menu-item-group> + <el-menu-item v-else :index="child.path" @click="navPage(item, child)"> + <el-icon v-if="child.icon"> + <component :is="child.icon"></component> + </el-icon> + <template #title>{{ child.name }}</template> + </el-menu-item> + </template> + </el-sub-menu> + + <el-menu-item v-else :index="item.path" @click="navPage(item)"> + <el-icon> + <component :is="item.icon"></component> + </el-icon> + <template #title>{{ item.name }}</template> + </el-menu-item> + </template> +</template> + +<script> +export default { + name: 'CoreMenuItem', + props: { + routes: { + type: Array, + }, + }, + emits: ['navPage'], + methods: { + navPage(...item) { + // const titles = item.map((value) => { + // return value.name; + // }); + this.$emit('navPage', ...item); + }, + }, +}; +</script> diff --git a/src/components/core/SiderMenu.vue b/src/components/core/SiderMenu.vue index 0b4d213..6e3eeeb 100644 --- a/src/components/core/SiderMenu.vue +++ b/src/components/core/SiderMenu.vue @@ -17,95 +17,11 @@ </el-space> </el-row> <el-scrollbar :height="menuHeight" v-if="!collapse"> - <template v-for="(item, i) in routes" :key="`${i}`"> - <el-sub-menu v-if="item.children" :index="`${i}`"> - <template #title> - <el-icon> - <component :is="item.icon"></component> - </el-icon> - <span>{{ item.name }}</span> - </template> - - <template v-for="(child, i2) in item.children" :key="`${i}-${i2}`"> - <el-menu-item-group v-if="child.group" :title="child.name"> - <el-menu-item - v-for="(child2, i3) in child.children" - :key="`${i}-${i2}-${i3}`" - :index="child2.path" - @click="navPage(item, child, child2)" - > - <el-icon v-if="child2.icon"> - <component :is="child2.icon"></component> - </el-icon> - <template #title>{{ child2.name }}</template> - </el-menu-item> - </el-menu-item-group> - <el-menu-item - v-else - :index="child.path" - @click="navPage(item, child)" - > - <el-icon v-if="child.icon"> - <component :is="child.icon"></component> - </el-icon> - <template #title>{{ child.name }}</template> - </el-menu-item> - </template> - </el-sub-menu> - - <el-menu-item v-else :index="item.path" @click="navPage(item)"> - <el-icon> - <component :is="item.icon"></component> - </el-icon> - <template #title>{{ item.name }}</template> - </el-menu-item> - </template> + <MenuItems :routes="routes" @navPage="navPage"> </MenuItems> </el-scrollbar> <template v-else> - <template v-for="(item, i) in routes" :key="`${i}`"> - <el-sub-menu v-if="item.children" :index="`${i}`"> - <template #title> - <el-icon> - <component :is="item.icon"></component> - </el-icon> - <span>{{ item.name }}</span> - </template> - - <template v-for="(child, i2) in item.children" :key="`${i}-${i2}`"> - <el-menu-item-group v-if="child.group" :title="child.name"> - <el-menu-item - v-for="(child2, i3) in child.children" - :key="`${i}-${i2}-${i3}`" - :index="child2.path" - @click="navPage(item, child, child2)" - > - <el-icon v-if="child2.icon"> - <component :is="child2.icon"></component> - </el-icon> - <template #title>{{ child2.name }}</template> - </el-menu-item> - </el-menu-item-group> - <el-menu-item - v-else - :index="child.path" - @click="navPage(item, child)" - > - <el-icon v-if="child.icon"> - <component :is="child.icon"></component> - </el-icon> - <template #title>{{ child.name }}</template> - </el-menu-item> - </template> - </el-sub-menu> - - <el-menu-item v-else :index="item.path" @click="navPage(item)"> - <el-icon> - <component :is="item.icon"></component> - </el-icon> - <template #title>{{ item.name }}</template> - </el-menu-item> - </template> + <MenuItems :routes="routes" @navPage="navPage"> </MenuItems> </template> <el-row ref="subTitleRef" class="sub-title" justify="center"> @@ -126,7 +42,6 @@ emits: ['navPage'], data() { return { - isCollapsed: this.collapse, menuHeight: '600px', title: '鐢熸�佺幆澧冪嚎涓婄洃绠�', subTitle: '漏涓婃捣椋炵窘鐜繚绉戞妧鏈夐檺鍏徃', @@ -244,10 +159,14 @@ icon: 'Search', name: '鎺掓薄鎶借繍', }, + { + path: '/common/userMatch', + icon: 'Connection', + name: '璐︽埛鍖归厤', + }, ], }; }, - watch: {}, computed: { homePage() { return this.routes[0].children @@ -258,10 +177,6 @@ methods: { handleOpen() {}, handleClose() {}, - collapsedSider() { - this.isCollapsed = !this.isCollapsed; - this.$emit('collapsedSider', this.isCollapsed); - }, navPage(...item) { const titles = item.map((value) => { return value.name; diff --git a/src/composables/formConfirm.js b/src/composables/formConfirm.js index 786cc6a..5f43ccf 100644 --- a/src/composables/formConfirm.js +++ b/src/composables/formConfirm.js @@ -4,10 +4,14 @@ import { useMessageBoxTip, useMessageBox } from './messageBox'; export function useFormConfirm({ + defaultForm = undefined, submit = { do: () => {}, }, cancel = { + do: () => {}, + }, + reset = { do: () => {}, }, }) { @@ -17,7 +21,7 @@ if (!cancel.msg) cancel.msg = '鏄惁鏀惧純宸茬紪杈戠殑鍐呭锛�'; //琛ㄥ崟鍐呭 - const formObj = ref({}); + const formObj = ref(defaultForm ? defaultForm : {}); let formObjClone = useCloned(formObj, { manual: true }); //琛ㄥ崟缁勪欢寮曠敤 const formRef = ref(null); @@ -59,7 +63,7 @@ ); // 閲嶇疆琛ㄥ崟 - const reset = function () { + const _reset = function () { edit.value = false; isReset = true; formObj.value = useCloned(formObjClone.cloned, { @@ -116,19 +120,24 @@ }; // 閲嶇疆琛ㄥ崟 - const onReset = function () { + const onReset = function (tips) { if (edit.value) { - // 寮瑰嚭纭妗� - useMessageBox({ - confirmMsg: '鏄惁閲嶇疆琛ㄥ崟鍐呭锛�', - confirmTitle: '閲嶇疆琛ㄥ崟', - onConfirm: () => { - reset(); - return cancel.do(); - }, - }); + if (tips) { + // 寮瑰嚭纭妗� + useMessageBox({ + confirmMsg: '鏄惁閲嶇疆琛ㄥ崟鍐呭锛�', + confirmTitle: '閲嶇疆琛ㄥ崟', + onConfirm: () => { + _reset(); + return reset.do(); + }, + }); + } else { + _reset(); + reset.do(); + } } else { - cancel.do(); + reset.do(); } }; diff --git a/src/enum/scene.js b/src/enum/scene.js index fafa846..a62b681 100644 --- a/src/enum/scene.js +++ b/src/enum/scene.js @@ -1,7 +1,7 @@ // 鍦烘櫙绫诲瀷鏋氫妇 // 椋炵窘鐜绯荤粺 -function enumScene_1 () { +function enumScene_1() { return [ { label: '鍏ㄩ儴', @@ -42,9 +42,16 @@ l.shift(); return l; } +function getSceneName_1(value) { + enumScene_1().find((v) => { + if (v.value == value) { + return v; + } + }); +} // 椋炵窘鐩戠绯荤粺 -function enumScene_2 () { +function enumScene_2() { return [ { label: '鍏ㄩ儴', @@ -91,7 +98,13 @@ function enumScene_2NA() { const l = enumScene_2(); l.shift(); - return l + return l; } -export { enumScene_1, enumScene_1NA, enumScene_2, enumScene_2NA }; +export { + enumScene_1, + enumScene_1NA, + getSceneName_1, + enumScene_2, + enumScene_2NA, +}; diff --git a/src/enum/user.js b/src/enum/user.js index 2284e6c..a2c114b 100644 --- a/src/enum/user.js +++ b/src/enum/user.js @@ -11,15 +11,15 @@ value: '0', }, { - label: '鍐呴儴鐢ㄦ埛', + label: '鍐呴儴浜哄憳', value: '1', }, { - label: '鏀垮簻鐢ㄦ埛', + label: '鏀垮簻閮ㄩ棬', value: '2', }, { - label: '浼佷笟鐢ㄦ埛', + label: '浼佷笟', value: '3', }, ]; diff --git a/src/router/index.js b/src/router/index.js index ba6758f..4a6d578 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -77,7 +77,7 @@ component: () => import('@/views/notice/NoticeManage.vue'), }, - // 椋炵窘鐩戠 + /**********************************椋炵窘鐩戠***********************************************/ { //璐︽埛绠$悊 name: 'fyspUser', @@ -108,12 +108,28 @@ meta: { transition: 'slide-left' }, }, - // 椋炵窘鐜 + /**********************************椋炵窘鐜***********************************************/ { //璐︽埛绠$悊 name: 'fytzUser', path: '/fytz/userInfo', - component: () => import('@/views/baseinfo/fytz/user/UserInfo.vue'), + component: () => import('@/views/fytz/user/UserInfo.vue'), + meta: { keepAlive: true }, + }, + { + //璐︽埛缂栬緫 + name: 'fytzUserEdit', + path: '/fytz/userEdit/:userId', + component: () => import('@/views/fytz/user/UserEdit.vue'), + meta: { transition: 'slide-left' }, + }, + + /**********************************閫氱敤妯″潡***********************************************/ + { + //璐︽埛鍖归厤 + name: 'userMatch', + path: '/common/userMatch', + component: () => import('@/views/common/UserMatch.vue'), }, ]; diff --git a/src/views/baseinfo/fysp/scene/CompSceneBaseInfo.vue b/src/views/baseinfo/fysp/scene/CompSceneBaseInfo.vue index 1472786..7e44c39 100644 --- a/src/views/baseinfo/fysp/scene/CompSceneBaseInfo.vue +++ b/src/views/baseinfo/fysp/scene/CompSceneBaseInfo.vue @@ -72,7 +72,9 @@ <el-form-item label="鑱旂郴鐢佃瘽" prop="contactst"> <el-input type="tel" v-model="formObj.contactst" placeholder="鑱旂郴鐢佃瘽"> <template #prepend> - <el-icon><Iphone /></el-icon> + <el-icon> + <Iphone /> + </el-icon> </template> </el-input> </el-form-item> @@ -83,12 +85,7 @@ }}</span> </el-form-item> <el-form-item label="缂栧彿" prop="index"> - <el-input-number - readonly - v-model="formObj.index" - :step="1" - :min="0" - /> + <el-input-number readonly v-model="formObj.index" :step="1" :min="0" /> </el-form-item> <el-form-item> @@ -108,7 +105,7 @@ import { defineProps, defineEmits, reactive, ref, watch } from 'vue'; import { enumScene_2NA } from '@/enum/scene'; import { enumLocationNA } from '@/enum/location'; -import sceneApi from '@/api/sceneApi'; +import sceneApi from '@/api/fysp/sceneApi'; import { useFormConfirm } from '@/composables/formConfirm'; const props = defineProps({ diff --git a/src/views/baseinfo/fysp/scene/CompSceneConstructionInfo.vue b/src/views/baseinfo/fysp/scene/CompSceneConstructionInfo.vue index ef5304d..2eae0ba 100644 --- a/src/views/baseinfo/fysp/scene/CompSceneConstructionInfo.vue +++ b/src/views/baseinfo/fysp/scene/CompSceneConstructionInfo.vue @@ -167,7 +167,7 @@ import { defineProps, defineEmits, reactive, ref, watch } from 'vue'; import { useDateFormat } from '@vueuse/core'; import { enumStatusNA, enumStageNA } from '@/enum/construction'; -import sceneApi from '@/api/sceneApi'; +import sceneApi from '@/api/fysp/sceneApi'; import { useFormConfirm } from '@/composables/formConfirm'; const props = defineProps({ diff --git a/src/views/baseinfo/fysp/scene/CompSceneDeviceInfo.vue b/src/views/baseinfo/fysp/scene/CompSceneDeviceInfo.vue index ae18e95..25eaef2 100644 --- a/src/views/baseinfo/fysp/scene/CompSceneDeviceInfo.vue +++ b/src/views/baseinfo/fysp/scene/CompSceneDeviceInfo.vue @@ -77,7 +77,7 @@ import { defineProps, defineEmits, reactive, ref, watch } from 'vue'; import { useFormConfirm } from '@/composables/formConfirm'; import { enumOnlineStatusNA } from '@/enum/onlineStatus'; -import sceneApi from '@/api/sceneApi'; +import sceneApi from '@/api/fysp/sceneApi'; const props = defineProps({ //鍦烘櫙鍩烘湰淇℃伅 @@ -134,9 +134,9 @@ () => props.formInfo, (nValue) => { if (nValue) { - formObj.value = nValue; + formObj.value = nValue; } - }, + } ); </script> diff --git a/src/views/baseinfo/fysp/scene/SceneEdit.vue b/src/views/baseinfo/fysp/scene/SceneEdit.vue index 9c5b98f..429cc87 100644 --- a/src/views/baseinfo/fysp/scene/SceneEdit.vue +++ b/src/views/baseinfo/fysp/scene/SceneEdit.vue @@ -40,8 +40,8 @@ </template> <script> -import sceneApi from '@/api/sceneApi'; -import userApi from '@/api/userApi'; +import sceneApi from '@/api/fysp/sceneApi'; +import userApi from '@/api/fysp/userApi'; // import FormCol from '../../../../components/layout/FormCol.vue'; import CompSceneBaseInfo from './CompSceneBaseInfo.vue'; import CompSceneConstructionInfo from './CompSceneConstructionInfo.vue'; diff --git a/src/views/baseinfo/fysp/scene/SceneInfo.vue b/src/views/baseinfo/fysp/scene/SceneInfo.vue index ccd5899..3f7d8c5 100644 --- a/src/views/baseinfo/fysp/scene/SceneInfo.vue +++ b/src/views/baseinfo/fysp/scene/SceneInfo.vue @@ -109,7 +109,7 @@ import { enumScene_2 } from '@/enum/scene'; import { enumLocation } from '@/enum/location'; import { enumOnlineStatus } from '@/enum/onlineStatus'; -import sceneApi from '@/api/sceneApi'; +import sceneApi from '@/api/fysp/sceneApi'; import { useLoadingStore } from '@/stores/loadingStore'; import { mapStores } from 'pinia'; import { useMessageBoxTip } from '@/composables/messageBox'; diff --git a/src/views/baseinfo/fysp/user/CompUserInfo.vue b/src/views/baseinfo/fysp/user/CompUserInfo.vue index aca87d1..d711a15 100644 --- a/src/views/baseinfo/fysp/user/CompUserInfo.vue +++ b/src/views/baseinfo/fysp/user/CompUserInfo.vue @@ -78,7 +78,7 @@ import { defineProps, defineEmits, reactive, ref, watch } from 'vue'; import { enumUserNA } from '@/enum/user'; import { useFormConfirm } from '@/composables/formConfirm'; -import userApi from '@/api/userApi'; +import userApi from '@/api/fysp/userApi'; const props = defineProps({ //鍩烘湰淇℃伅 diff --git a/src/views/check/ProCheck.vue b/src/views/check/ProCheck.vue index 66ad8d3..2bb34b1 100644 --- a/src/views/check/ProCheck.vue +++ b/src/views/check/ProCheck.vue @@ -21,7 +21,11 @@ </SearchBar> </template> <template #aside> - <SideList :items="subtasks" :loading="sideLoading" @item-click="chooseSubtask"></SideList> + <SideList + :items="subtasks" + :loading="sideLoading" + @item-click="chooseSubtask" + ></SideList> </template> <template #main> <ToolBar @@ -30,7 +34,11 @@ :buttons="buttons" :loading="mainLoading" ></ToolBar> - <el-scrollbar v-if="proPicsCard.length > 0" class="el-scrollbar" v-loading="mainLoading"> + <el-scrollbar + v-if="proPicsCard.length > 0" + class="el-scrollbar" + v-loading="mainLoading" + > <ProblemCard v-for="(p, i) in proPicsCard" :key="i" @@ -38,14 +46,14 @@ @button-click="onProButtonClick" ></ProblemCard> </el-scrollbar> - <el-empty v-else description="鏆傛棤璁板綍" v-loading="mainLoading"/> + <el-empty v-else description="鏆傛棤璁板綍" v-loading="mainLoading" /> </template> </BaseContentLayout> </template> <script> -import taskApi from '@/api/taskApi'; -import problemApi from '@/api/problemApi'; +import taskApi from '@/api/fysp/taskApi'; +import problemApi from '@/api/fysp/problemApi'; import ProCheckProxy from './ProCheckProxy'; import { ElMessageBox, ElNotification, ElMessage } from 'element-plus'; @@ -183,10 +191,10 @@ methods: { //鏌ヨ瀛愪换鍔$粺璁′俊鎭� onSubmit(formSearch) { - this.sideLoading = true - this.mainLoading = true - this.curProList = [] - this.curSubtask = {} + this.sideLoading = true; + this.mainLoading = true; + this.curProList = []; + this.curSubtask = {}; taskApi.getSubtaskSummary(formSearch).then((res) => { const list = []; res.forEach((s) => { @@ -200,8 +208,8 @@ }); this.subtasks = list; if (list.length == 0) { - this.sideLoading = false - this.mainLoading = false + this.sideLoading = false; + this.mainLoading = false; } }); }, @@ -221,15 +229,18 @@ }, //鐐瑰嚮宸︿晶鑿滃崟浠诲姟浜嬩欢 chooseSubtask(s) { - this.sideLoading = false - this.mainLoading = true - this.curSubtask = s; + this.sideLoading = false; + this.mainLoading = true; // const controller = new AbortController(); - taskApi.getProBySubtask(s.data.stGuid).then((res) => { - this.curProList = res; - }).finally(() => { - this.mainLoading = false - }); + taskApi + .getProBySubtask(s.data.stGuid) + .then((res) => { + this.curProList = res; + this.curSubtask = s; + }) + .finally(() => { + this.mainLoading = false; + }); }, // 闂鍗$墖鍐呴儴鎸夐挳鐐瑰嚮浜嬩欢 @@ -270,7 +281,7 @@ title: '瀹℃牳鎴愬姛', message: `璇ラ棶棰樺凡${doneMsg}`, type: 'success', - offset: 170 + offset: 170, }); }) .catch(() => { diff --git a/src/views/common/CompTransfer.vue b/src/views/common/CompTransfer.vue new file mode 100644 index 0000000..55ca580 --- /dev/null +++ b/src/views/common/CompTransfer.vue @@ -0,0 +1,114 @@ +<template> + <el-row justify="center" class="t-title">{{ title }}</el-row> + <el-row justify="center"> + <el-transfer + class="t-transfer" + v-model="rightData" + filterable + :titles="titles" + :button-texts="buttonTexts" + :format="{ + noChecked: '${total}', + hasChecked: '${checked}/${total}', + }" + :data="leftData" + target-order="push" + @change="handleChange" + > + <template #default="{ option }"> + <div class="t-transfer-item"> + <span>{{ option.label }}</span> + <div> + <el-icon><ArrowUp /></el-icon> + <el-icon><ArrowDown /></el-icon> + </div> + </div> + </template> + <!-- <template #left-footer> + <el-button class="transfer-footer" size="small">Operation</el-button> + </template> + <template #right-footer> + <el-button class="transfer-footer" size="small">Operation</el-button> + </template> --> + </el-transfer> + </el-row> +</template> + +<script> +export default { + props: { + title: { + type: String, + default: '鏍囬', + }, + titleJustify: { + type: String, + default: 'start', + }, + leftValue: { + type: Array, + }, + rightValue: { + type: Array, + }, + }, + data() { + return { + leftData: [], + rightData: [], + }; + }, + watch: { + leftValue(nV) { + this.leftData = nV; + }, + rightValue(nV) { + this.rightData = nV; + }, + }, + computed: { + titles() { + return this.titleJustify == 'left' + ? ['鍦烘櫙鍒楄〃', '宸查�夋嫨'] + : ['宸查�夋嫨', '鍦烘櫙鍒楄〃']; + }, + buttonTexts() { + return this.titleJustify == 'left' ? ['绉婚櫎', '娣诲姞'] : ['娣诲姞', '绉婚櫎']; + }, + }, + methods: { + handleChange(value, direction, movedKeys) { + console.log(value, direction, movedKeys); + }, + }, + created() { + const data = []; + for (let i = 1; i <= 15; i++) { + data.push({ + key: i, + label: `Option ${i}`, + disabled: i % 4 === 0, + }); + } + this.leftData = data; + }, +}; +</script> +<style> +.t-title { + font-size: 20px; + margin-bottom: 10px; +} + +.t-transfer { + /* background-color: aliceblue; */ + --el-transfer-panel-width: 300px; + --el-transfer-panel-body-height: 600px; +} + +.t-transfer-item { + background-color: aliceblue; + display: flex; + justify-content: space-between; +} +</style> diff --git a/src/views/common/UserMatch.vue b/src/views/common/UserMatch.vue new file mode 100644 index 0000000..f262ad7 --- /dev/null +++ b/src/views/common/UserMatch.vue @@ -0,0 +1,19 @@ +<template> + <el-row :gutter="0"> + <el-col :span="12" + ><CompTransfer title="椋炵窘鐩戠" title-justify="left"></CompTransfer + ></el-col> + <el-col :span="12" + ><CompTransfer title="椋炵窘鐜" title-justify="right"></CompTransfer + ></el-col> + </el-row> +</template> + +<script> +import CompTransfer from './CompTransfer.vue'; +export default { + components: { + CompTransfer, + }, +}; +</script> diff --git a/src/views/fysp/night-construction/NightConstruction.vue b/src/views/fysp/night-construction/NightConstruction.vue new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/views/fysp/night-construction/NightConstruction.vue diff --git a/src/views/fytz/user/UserEdit.vue b/src/views/fytz/user/UserEdit.vue new file mode 100644 index 0000000..60e1399 --- /dev/null +++ b/src/views/fytz/user/UserEdit.vue @@ -0,0 +1,181 @@ +<template> + <el-page-header @back="onBack"> + <template #content> + <span> 璐︽埛淇℃伅缂栬緫 </span> + </template> + </el-page-header> + <el-divider /> + <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick"> + <el-tab-pane label="鍩烘湰淇℃伅" name="first"> + <div class="sub-title">鐢ㄦ埛淇℃伅</div> + <FormCol> + <CompUserInfo :form-info="formUser" /> + </FormCol> + <el-divider /> + <div class="sub-title">鐢ㄦ埛淇℃伅琛�</div> + <FormCol> + <!-- <CompUserInfos :form-info="formUserInfos" /> --> + </FormCol> + <el-divider /> + <div class="sub-title">浼佷笟淇℃伅</div> + <FormCol> + <!-- <CompPanyInfo :form-info="formVehicleBaseInfo" /> --> + </FormCol> + <!-- <template v-if="formAnyInfo.typeid == 1"> + <div class="sub-title">娌圭儫鍑�鍖栬缃�</div> + <FormCol> + <CompFumePurifyDevice :form-info="formFumePurifyDevice" /> + </FormCol> + </template> + + + <template v-if="formAnyInfo.typeid == 1"> + <div class="sub-title">椁愰ギ鍩虹淇℃伅琛�</div> + <FormCol> + <CompRestaurantBaseInfo :form-info="formRestaurantBaseInfo" /> + </FormCol> + </template> + + <template v-if="formAnyInfo.typeid == 7"> + <div class="sub-title">姹戒慨鍩虹淇℃伅琛�</div> + <FormCol> + <CompVehicleBaseInfo :form-info="formVehicleBaseInfo" /> + </FormCol> + </template> --> + </el-tab-pane> + <el-tab-pane label="璁惧绠$悊" name="second"> + <el-row> + <el-col :span="18"> + <div class="sub-title">鐩戞祴璁惧淇℃伅</div> + <!-- <CompDeviceInfo :form-info="formDevice" /> --> + </el-col> + <el-col :span="6"> + <el-row justify="end" align="middle" style="height: 80px"> + <el-button type="success" @click="drawer = true" + >鏂板璁惧</el-button + > + </el-row> + </el-col> + </el-row> + </el-tab-pane> + + <el-tab-pane label="鍗卞簾鎺掓薄" name="third"> + <div class="sub-title">鍗卞簾鎺掓薄娓呭崟</div> + <FormCol> + <!-- <CompHazardousWasteFile :form-info="formHazardousWasteFile" /> --> + </FormCol> + <div class="sub-title">鍗卞簾鎺掓薄璁板綍</div> + <FormCol> + <!-- <CompHazardousWasteRecord :form-info="formHazardousWasteRecord" /> --> + </FormCol> + </el-tab-pane> + + <el-tab-pane label="琛屾斂澶勭綒" name="fourth"> + <div class="sub-title">琛屾斂澶勭綒琛�</div> + <FormCol> + <!-- <CompPunishment :form-info="formProblem" /> --> + </FormCol> + </el-tab-pane> + + <el-tab-pane label="淇¤鎶曡瘔" name="fifth"> + <div class="sub-title">淇¤鎶曡瘔</div> + <FormCol> + <!-- <CompLaint :form-info="formLaint" /> --> + </FormCol> + </el-tab-pane> + + <el-tab-pane label="宸℃煡闂琛�" name="sixth"> + <div class="sub-title">宸℃煡闂琛�</div> + <FormCol> + <!-- <CompProblem :form-info="formProblem" /> --> + </FormCol> + </el-tab-pane> + </el-tabs> + + <!-- <ComBaseInformation v-model="drawer"></ComBaseInformation> --> +</template> + +<script> +import userApi from '@/api/fytz/userApi'; +// import ComBaseInformation from '@/views/baseinfo/fytz/scene/ComBaseInformation.vue'; +import CompUserInfo from './components/CompUserInfo.vue'; +// import CompLaint from '@/views/baseinfo/fytz/scene/CompLaint.vue'; +// import CompDeviceInfo from "@/views/baseinfo/fytz/scene/CompDeviceInfo.vue"; +// import CompPanyInfo from '@/views/baseinfo/fytz/scene/CompPanyInfo.vue'; +// import CompFumePurifyDevice from '@/views/baseinfo/fytz/scene/CompFumePurifyDevice.vue'; +// import CompHazardousWasteFile from '@/views/baseinfo/fytz/scene/CompHazardousWasteFile.vue'; +// import CompHazardousWasteRecord from '@/views/baseinfo/fytz/scene/CompHazardousWasteRecord.vue'; +// import CompProblem from '@/views/baseinfo/fytz/scene/CompProblem.vue'; +// import CompPunishment from '@/views/baseinfo/fytz/scene/CompPunishment.vue'; +// import CompRestaurantBaseInfo from '@/views/baseinfo/fytz/scene/CompRestaurantBaseInfo.vue'; +// import CompVehicleBaseInfo from '@/views/baseinfo/fytz/scene/CompVehicleBaseInfo.vue'; +// import CompUserInfos from '@/views/baseinfo/fytz/scene/CompUserInfos.vue'; + +export default { + components: { + // ComBaseInformation, + // CompLaint, + CompUserInfo, + // CompDeviceInfo, + // CompPanyInfo, + // CompFumePurifyDevice, + // CompHazardousWasteFile, + // CompHazardousWasteRecord, + // CompProblem, + // CompPunishment, + // CompRestaurantBaseInfo, + // CompVehicleBaseInfo, + // CompUserInfos, + }, + data() { + return { + drawer: false, + formUser: {}, + // formSubScene: {}, + formLaint: {}, + // formDevice: {}, + formPanyInfo: {}, + formFumePurifyDevice: {}, + formHazardousWasteFile: {}, + formHazardousWasteRecord: {}, + formProblem: {}, + formPunishment: {}, + formRestaurantBaseInfo: {}, + formVehicleBaseInfo: {}, + formUserInfos: {}, + activeName: 'first', + scroll: '', + }; + }, + beforeRouteEnter(to, from, next) { + userApi.fetchUserBaseInfo(to.params.userId).then((res) => { + next((vm) => { + if (res.userInfo) { + vm.formUser = res.userInfo; + } else { + vm.formUser = { + guid: to.params.userId, + }; + } + }); + }); + }, + methods: { + handleClick(tab) { + console.log('tab', tab); + }, + // 鍥為��椤甸潰 + onBack() { + this.$router.back(); + }, + }, +}; +</script> +<style scoped> +.sub-title { + font-size: var(--el--font--size--large); + margin-bottom: 30px; + margin-top: 30px; + margin-left: 20px; +} +</style> diff --git a/src/views/fytz/user/UserInfo.vue b/src/views/fytz/user/UserInfo.vue new file mode 100644 index 0000000..50acda9 --- /dev/null +++ b/src/views/fytz/user/UserInfo.vue @@ -0,0 +1,295 @@ +<template> + <el-row ref="searchRef"> + <el-col> + <el-form :inline="true" :model="formSearch"> + <el-form-item label="鐪�/甯�/鍖�/闀�" prop="_locations"> + <el-cascader + v-model="formSearch._locations" + :options="locations" + placeholder="鐪�/甯�/鍖�/闀�" + :props="props" + style="width: 280px" + /> + </el-form-item> + <el-form-item label="鍦烘櫙鍚嶇О" prop="searchText"> + <el-input + clearable + v-model="formSearch.searchText" + placeholder="杈撳叆鎼滅储鍦烘櫙鍚嶇О" + /> + </el-form-item> + <el-form-item label="鐢ㄦ埛绫诲瀷" prop="scensetypeid"> + <el-select + v-model="formSearch.scensetypeid" + placeholder="鐢ㄦ埛绫诲瀷" + style="width: 75px" + > + <el-option + v-for="s in sceneTypes" + :key="s.value" + :label="s.label" + :value="s.value" + /> + </el-select> + </el-form-item> + <el-form-item label="涓婄嚎鐘舵��" prop="online"> + <el-select + v-model="formSearch.online" + placeholder="鍏ㄩ儴" + style="width: 75px" + > + <el-option + v-for="s in onlineStatus" + :key="s.value" + :label="s.label" + :value="s.value" + /> + </el-select> + </el-form-item> + <el-form-item> + <el-button icon="Search" type="primary" @click="onSearch" + >鏌ヨ</el-button + > + </el-form-item> + </el-form> + </el-col> + </el-row> + <el-table + :data="tableData" + v-loading="loading" + table-layout="fixed" + :row-class-name="tableRowClassName" + :height="tableHeight" + > + <el-table-column prop="realname" label="鍏徃" align="center"> + <template #default="scope"> + <el-tooltip + effect="dark" + :content="scope.row.realname" + placement="top-start" + :show-after="500" + > + {{ scope.row.realname }} + </el-tooltip> + </template> + </el-table-column> + <el-table-column prop="telephone" label="鐢佃瘽" align="center" /> + <el-table-column + prop="extension1" + label="鍖哄幙" + width="120" + align="center" + /> + <el-table-column prop="usertype" label="绫诲瀷" align="center" /> + <el-table-column prop="departmentname" label="鍚嶇О"> + <template #default="scope"> + <el-tooltip + effect="dark" + :content="scope.row.departmentname" + placement="top-start" + :show-after="500" + > + {{ scope.row.departmentname }} + </el-tooltip> + </template> + </el-table-column> + <el-table-column fixed="right" label="鎿嶄綔" width="140"> + <template #header> + <el-button icon="DocumentAdd" type="success" @click="drawer = true" + >鏂板鐢ㄦ埛</el-button + > + </template> + <template #default="scope"> + <el-button + :loading="scope.row.loading1" + type="default" + size="small" + @click="editRow(scope)" + >缂栬緫</el-button + > + <el-button + :loading="scope.row.loading2" + :type="scope.row.extension1 != '0' ? 'danger' : 'primary'" + size="small" + @click="itemActive(scope)" + >{{ scope.row.extension1 != '0' ? '涓嬬嚎' : '涓婄嚎' }}</el-button + > + </template> + </el-table-column> + </el-table> + + <el-pagination + ref="paginationRef" + class="el-pagination" + v-model:current-page="currentPage" + v-model:page-size="pageSize" + :page-sizes="[10, 20, 50, 100]" + :background="true" + layout="total, sizes, prev, pager, next, jumper" + :total="total" + /> + + <CompUserInfoAddDrawer v-model:drawer="drawer"></CompUserInfoAddDrawer> +</template> + +<script> +import { enumScene_1 } from '@/enum/scene'; +import { enumLocation } from '@/enum/location'; +import { enumOnlineStatus } from '@/enum/onlineStatus'; +import userApi from '@/api/fytz/userApi'; +import { useLoadingStore } from '@/stores/loadingStore'; +import { mapStores } from 'pinia'; +import { useMessageBoxTip } from '@/composables/messageBox'; +import CompUserInfoAddDrawer from './components/CompUserInfoAddDrawer.vue'; + +export default { + components: { + CompUserInfoAddDrawer, + }, + data() { + return { + locations: enumLocation(), + sceneTypes: enumScene_1(), + onlineStatus: enumOnlineStatus(), + formSearch: { + _locations: [], + searchText: '', + scensetypeid: '', + online: '', + }, + + props: { + checkStrictly: true, + }, + + tableData: [], + tableHeight: '500', + loading: false, + + currentPage: 1, + pageSize: 20, + total: 0, + + drawer: false, + }; + }, + watch: { + currentPage(nValue, oValue) { + if (nValue != oValue) { + this.onSearch(); + } + }, + pageSize(nValue, oValue) { + if (nValue != oValue) { + this.onSearch(); + } + }, + }, + computed: { + ...mapStores(useLoadingStore), + }, + methods: { + onSearch() { + this.loading = true; + const f = this.formSearch; + const area = {}; + // 琛屾斂鍖哄垝 + f._locations.length > 0 + ? ([area.provinceCode, area.provinceName] = f._locations[0]) + : ([area.provinceCode, area.provinceName] = [null, null]); + if (area.provinceCode == '0') + [area.provinceCode, area.provinceName] = [null, null]; + f._locations.length > 1 + ? (area.citycode = f._locations[1][0]) + : (area.citycode = null); + f._locations.length > 2 + ? ([area.districtCode, area.districtName] = f._locations[2]) + : ([area.districtCode, area.districtName] = [null, null]); + f._locations.length > 3 + ? (area.towncode = f._locations[3][0]) + : (area.towncode = null); + // 鍦烘櫙绫诲瀷 + area.scensetypeid = f.scensetypeid; + if (area.scensetypeid == '0') area.scensetypeid = null; + // 涓婁笅绾跨姸鎬� + area.online = f.online; + // 鍏抽敭瀛� + area.searchText = f.searchText; + + userApi + .fetchUser('00EQQVnE9QFvbkQr', this.currentPage, this.pageSize, area) + .then((res) => { + if (res) { + this.tableData = res.data; + this.currentPage = res.headers.currentPage; + console.log(res.headers); + this.total = parseInt(res.headers.totalPage) * this.pageSize; + } + }) + .finally(() => { + this.loading = false; + }); + }, + calcTableHeight() { + const h1 = this.$refs.searchRef.$el.offsetHeight; + const h2 = this.$refs.paginationRef.$el.offsetHeight; + // return `calc(100vh - ${h1}px - ${h2}px - var(--el-main-padding) * 2 - var(--el-header-height))`; + return `calc(100vh - ${h1}px - ${h2}px - 60px - var(--el-main-padding) * 2)`; + }, + editRow(scope) { + scope.row.loading1 = true; + this.loadingStore.loadingStatus.push(() => (scope.row.loading1 = false)); + this.$router.push(`userEdit/${scope.row.guid}`); + }, + itemActive(scope) { + const rb = {}; + rb.guid = scope.row.guid; + rb.extension1 = scope.row.extension1 != '0' ? '0' : '1'; + const msg = scope.row.extension1 != '0' ? '涓嬬嚎' : '涓婄嚎'; + useMessageBoxTip({ + confirmMsg: `纭${msg}璇ュ満鏅紵`, + confirmTitle: msg, + onConfirm: () => { + scope.row.loading2 = true; + userApi + .updateScene(rb) + .then((res) => { + if (res == 1) { + scope.row.extension1 = rb.extension1; + } + }) + .finally(() => { + scope.row.loading2 = false; + }); + }, + }); + }, + tableRowClassName({ row }) { + return row.extension1 != '0' ? 'online-row' : 'offline-row'; + }, + }, + mounted() { + this.formSearch.scensetypeid = this.sceneTypes[0].value; + this.formSearch._locations = [this.locations[0].value]; + this.formSearch.online = this.onlineStatus[0].value; + this.tableHeight = this.calcTableHeight(); + this.onSearch(); + }, +}; +</script> +<style> +.el-table .offline-row { + background-color: var(--el-disabled-bg-color); + color: var(--el-disabled-text-color); +} +.el-table .cell { + white-space: nowrap; + color: var(--el-disabled-text-color); +} +.el-pagination { + background-color: var(--el-color-white); + padding-top: 20px; + border-top: 1px solid rgba(0, 0, 0, 0.096); + /* margin-top: 2px; */ +} +</style> diff --git a/src/views/fytz/user/components/CompUserInfo.vue b/src/views/fytz/user/components/CompUserInfo.vue new file mode 100644 index 0000000..0f9a433 --- /dev/null +++ b/src/views/fytz/user/components/CompUserInfo.vue @@ -0,0 +1,305 @@ +<template> + <el-form + :inline="false" + :model="formObj" + ref="formRef" + :rules="rules" + label-position="right" + label-width="150px" + > + <!-- <el-form-item label="id" prop="GUID"> + <el-input clearable v-model="formObj.GUID" placeholder="id" /> + </el-form-item> --> + <!-- <el-form-item label="澶村儚url" prop="HeadIconUrl"> + <el-input clearable v-model="formObj.HeadIconUrl" placeholder="澶村儚url" /> + </el-form-item> --> + <el-form-item label="璐︽埛鍚�" prop="acountname"> + <el-input clearable v-model="formObj.acountname" placeholder="璐︽埛鍚�" /> + </el-form-item> + <el-form-item label="鐢ㄦ埛鏄电О" prop="realname"> + <el-input clearable v-model="formObj.realname" placeholder="鐢ㄦ埛鏄电О" /> + </el-form-item> + <el-form-item label="瀵嗙爜" prop="password"> + <el-input + clearable + type="password" + v-model="formObj.password" + placeholder="榛樿瀵嗙爜123456" + /> + </el-form-item> + <!-- <el-form-item label="鐢ㄦ埛绫诲瀷id" prop="UserTypeID"> + <el-input + clearable + v-model="formObj.UserTypeID" + placeholder="鐢ㄦ埛绫诲瀷id" + /> + </el-form-item> --> + <el-form-item label="鐢ㄦ埛绫诲瀷" prop="_usertype"> + <el-select v-model="formObj._usertype" placeholder="鐢ㄦ埛绫诲瀷"> + <el-option + v-for="s in userTypes" + :key="s.value" + :label="s.label" + :value="s" + /> + </el-select> + </el-form-item> + <el-form-item label="鎵�灞炰紒涓�" prop="departmentname"> + <el-input + clearable + v-model="formObj.departmentname" + placeholder="鎵�灞炰紒涓�" + disabled + /> + </el-form-item> + <el-form-item label="鏄惁鍙敤" prop="isenable"> + <el-switch v-model="formObj.isenable" /> + <span style="margin-left: 16px">{{ + formObj.isenable ? '鍙敤' : '涓嶅彲鐢�' + }}</span> + </el-form-item> + <el-form-item label="宸ュ彿" prop="workno"> + <el-input clearable v-model="formObj.workno" placeholder="宸ュ彿" /> + </el-form-item> + + <el-form-item label="鎵嬫満" prop="telephone"> + <el-input + clearable + type="tel" + v-model="formObj.telephone" + placeholder="鎵嬫満" + /> + </el-form-item> + <!-- <el-form-item label="寰俊id" prop="WechatID"> + <el-input clearable v-model="formObj.WechatID" placeholder="寰俊id" /> + </el-form-item> --> + <el-form-item label="鐪�/甯�/鍖�/闀�" prop="_locations"> + <el-cascader + v-model="formObj._locations" + :options="locations" + placeholder="鐪�/甯�/鍖�/闀�" + :props="locationsProps" + style="width: 280px" + :disabled="!create" + /> + </el-form-item> + <el-form-item label="鍦烘櫙绫诲瀷" prop="_scenetype"> + <el-select + v-model="formObj._scenetype" + placeholder="鍦烘櫙绫诲瀷" + > + <el-option + v-for="s in sceneTypes" + :key="s.value" + :label="s.label" + :value="s" + /> + </el-select> + </el-form-item> + <el-form-item> + <el-button + :disabled="!edit" + type="primary" + @click="onSubmit" + :loading="loading" + >鎻愪氦</el-button + > + <el-button :disabled="!edit" @click="onReset">閲嶇疆</el-button> + </el-form-item> + </el-form> +</template> + +<script setup> +import { defineProps, defineEmits, reactive, ref, watch } from 'vue'; +import { useFormConfirm } from '@/composables/formConfirm'; +import { enumUserNA } from '@/enum/user'; +import { enumScene_1NA, getSceneName_1 } from '@/enum/scene'; +import { enumLocationNA } from '@/enum/location'; +import userApi from '@/api/fytz/userApi'; + +const props = defineProps({ + //鍩烘湰淇℃伅 + formInfo: Object, + isEdit: Boolean, + create: { + type: Boolean, + default: false, + }, + active: { + type: Boolean, + default: false, + }, +}); + +const emit = defineEmits(['onSubmit', 'onCancel', 'update:isEdit']); + +const { formObj, formRef, edit, onSubmit, onReset } = useFormConfirm({ + defaultForm: { + isenable: true, + }, + submit: { + do: submit, + }, + cancel: { + do: cancel, + }, +}); + +const userTypes = reactive(enumUserNA()); +const sceneTypes = reactive(enumScene_1NA()); +const locations = enumLocationNA(); +const locationsProps = reactive({ + checkStrictly: true, +}); +const loading = ref(false); + +const rules = reactive({ + acountname: [ + { + required: true, + message: '璐︽埛鍚嶄笉鑳戒负绌�', + trigger: 'blur', + }, + ], + realname: [ + { + required: true, + message: '鐢ㄦ埛鏄电О涓嶈兘涓虹┖', + trigger: 'blur', + }, + ], + password: [ + { + required: props.create, + message: '瀵嗙爜涓嶈兘涓虹┖', + trigger: 'blur', + }, + ], + _usertype: [ + { + required: true, + message: '鐢ㄦ埛绫诲瀷涓嶈兘涓虹┖', + trigger: 'change', + }, + ], + _locations: [ + { + required: props.create, + message: '鐪�/甯�/鍖�/闀囦笉鑳戒负绌�', + trigger: 'change', + }, + ], + _scenetype: [ + { + required: true, + message: '鍦烘櫙绫诲瀷涓嶈兘涓虹┖', + trigger: 'change', + }, + ], +}); + +// 鐢ㄦ埛鍩烘湰淇℃伅鏍煎紡鍖� +function parseUserInfo(s) { + s._usertype = { + label: s.usertype, + value: s.usertypeid + '', + }; + + s._scenetype = { + label: getSceneName_1(s.extension2), + value: s.extension2, + }; + + s._locations = []; + // if (s.provincecode && s.provincecode.length > 0) + // s._locations.push([s.provincecode, s.provincename]); + // if (s.citycode && s.citycode.length > 0) + // s._locations.push([s.citycode, s.cityname]); + // if (s.districtcode && s.districtcode.length > 0) + // s._locations.push([s.districtcode, s.districtname]); + // if (s.towncode && s.towncode.length > 0) + // s._locations.push([s.towncode, s.townname]); + + return s; +} + +function createUser() { + loading.value = true; + return userApi + .createUser(formObj.value) + .then(() => { + emit('onSubmit', formObj); + }) + .finally(() => { + loading.value = false; + }); +} + +function updateUser() { + loading.value = true; + return userApi + .updateUserInfo(formObj.value) + .then(() => { + emit('onSubmit', formObj); + }) + .finally(() => { + loading.value = false; + }); +} + +function submit() { + // 琛屾斂鍖哄垝淇℃伅濉厖 + const a = formObj.value._locations; + if (a[0]) { + formObj.value.provincecode = a[0][0]; + formObj.value.provincename = a[0][1]; + } + if (a[1]) { + formObj.value.citycode = a[1][0]; + formObj.value.cityname = a[1][1]; + } + if (a[2]) { + formObj.value.districtcode = a[2][0]; + formObj.value.extension1 = a[2][1]; + } + if (a[3]) { + formObj.value.towncode = a[3][0]; + formObj.value.townname = a[3][1]; + } + + // 鐢ㄦ埛绫诲瀷淇℃伅濉厖 + const b = formObj.value._usertype; + formObj.value.usertypeid = b.value; + formObj.value.usertype = b.label; + + // 鍦烘櫙绫诲瀷淇℃伅濉厖 + const c = formObj.value._scenetype; + formObj.value.extension2 = c.value; + + return props.create ? createUser() : updateUser(); +} + +function cancel() { + emit('onCancel'); +} + +watch( + () => props.formInfo, + (nValue) => { + formObj.value = parseUserInfo(nValue); + } +); + +watch( + () => props.active, + (nValue) => { + if (!nValue) { + onReset(); + } + } +); + +watch(edit, (nValue) => { + emit('update:isEdit', nValue); +}); +</script> diff --git a/src/views/fytz/user/components/CompUserInfoAddDrawer.vue b/src/views/fytz/user/components/CompUserInfoAddDrawer.vue new file mode 100644 index 0000000..cbd243a --- /dev/null +++ b/src/views/fytz/user/components/CompUserInfoAddDrawer.vue @@ -0,0 +1,67 @@ +<template> + <el-drawer + v-model="drawer_" + title="鏂板鐢ㄦ埛" + direction="rtl" + :before-close="onDrawerClose" + > + <CompUserInfo + :create="true" + :active="drawer" + v-model:is-edit="drawerEdit" + @on-submit="onDrawerSubmit" + @on-cancel="onDrawerCancel" + ></CompUserInfo> + </el-drawer> +</template> + +<script> +import CompUserInfo from './CompUserInfo.vue'; +import { useMessageBox } from '@/composables/messageBox'; + +export default { + components: { CompUserInfo }, + props: ['drawer'], + emits: ['update:drawer'], + data() { + return { + drawer_: this.drawer, + drawerEdit: false, + }; + }, + watch: { + drawer(nValue) { + this.drawer_ = nValue; + }, + drawer_(nValue) { + this.$emit('update:drawer', nValue); + }, + }, + methods: { + onDrawerSubmit() { + // 鍏抽棴寮瑰嚭妗� + this.drawer_ = false; + }, + onDrawerClose(done) { + if (this.drawerEdit) { + // 寮瑰嚭纭妗� + useMessageBox({ + confirmMsg: '鏄惁鏀惧純宸茬紪杈戠殑鍐呭锛�', + confirmTitle: '鍙栨秷', + onConfirm: () => { + done(); + }, + }); + } else { + // 鐩存帴鍏抽棴 + done(); + } + }, + onDrawerCancel() { + this.onDrawerClose(() => { + this.drawer_ = false; + }); + }, + }, +}; +</script> diff --git a/src/views/notice/CompNoticeAdd.vue b/src/views/notice/CompNoticeAdd.vue index 71dac41..4a83d87 100644 --- a/src/views/notice/CompNoticeAdd.vue +++ b/src/views/notice/CompNoticeAdd.vue @@ -92,7 +92,7 @@ //閫氱煡鍐呭 content: '', //閫氱煡鍥剧墖 - picUrl: '', + picUrl: null, //閫氱煡閾炬帴 bodyUrl: '', //鏄惁闇�瑕佺鏀� @@ -102,7 +102,7 @@ //鎺ュ彈鐢ㄦ埛鍖哄幙 district: '0', //鎺ュ彈鐢ㄦ埛id - receiverId: '', + receiverId: null, }, rules: { title: [ diff --git a/src/views/notice/CompNoticeAddDrawer.vue b/src/views/notice/CompNoticeAddDrawer.vue index 9d9a990..a10f11e 100644 --- a/src/views/notice/CompNoticeAddDrawer.vue +++ b/src/views/notice/CompNoticeAddDrawer.vue @@ -16,7 +16,7 @@ </template> <script> -import noticeApi from '@/api/noticeApi'; +import noticeApi from '@/api/fytz/noticeApi'; import CompNoticeAdd from './CompNoticeAdd.vue'; import { useMessageBoxTip, useMessageBox } from '@/composables/messageBox'; diff --git a/src/views/notice/NoticeManage.vue b/src/views/notice/NoticeManage.vue index 1a6e822..8dcd7df 100644 --- a/src/views/notice/NoticeManage.vue +++ b/src/views/notice/NoticeManage.vue @@ -138,7 +138,7 @@ </template> <script> -import noticeApi from '@/api/noticeApi'; +import noticeApi from '@/api/fytz/noticeApi'; import { useDateFormat } from '@vueuse/core'; import { enumScene_1 } from '@/enum/scene'; import { enumDistrict } from '@/enum/district'; -- Gitblit v1.9.3