From 24b00a82a34eb11c6ec1bc1ce018a6e969e791d0 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期五, 15 十二月 2023 17:32:11 +0800 Subject: [PATCH] 1. 新增自动评估记录的获取和展示; 2. 新增评估记录排序功能; 3. 新增评估任务界面; --- package-lock.json | 24 + src/stores/loadingStore.js | 21 + src/views/fysp/evaluation/ResultManage.vue | 129 ++++++++++-- src/components.d.ts | 3 src/constants/envCreditCode.js | 26 ++ src/constants/index.js | 3 src/views/fytz/user/components/CompUserInfo.vue | 126 +++++++----- src/views/fytz/user/UserInfo.vue | 29 +- src/components/form/FYForm.vue | 20 +- src/constants/menu.js | 4 src/views/fysp/evaluation/DataSource.vue | 22 + src/components/table/FYTable.vue | 1 src/views/baseinfo/fysp/scene/SceneInfo.vue | 2 package.json | 2 src/views/fysp/evaluation/components/CompPreCheck.vue | 176 ++++++----------- src/components/core/SiderMenu.vue | 2 .prettierrc.json | 2 17 files changed, 338 insertions(+), 254 deletions(-) diff --git a/.prettierrc.json b/.prettierrc.json index 66e2335..5eb97e4 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,6 +1,6 @@ { "$schema": "https://json.schemastore.org/prettierrc", - "semi": false, + "semi": true, "tabWidth": 2, "singleQuote": true, "printWidth": 100, diff --git a/package-lock.json b/package-lock.json index 19baa43..9407446 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@vueuse/core": "^9.7.0", "axios": "^1.2.1", "dayjs": "^1.11.10", - "element-plus": "^2.2.26", + "element-plus": "^2.4.3", "pinia": "^2.0.26", "vue": "^3.2.45", "vue-router": "^4.1.6" @@ -1838,8 +1838,9 @@ } }, "node_modules/@element-plus/icons-vue": { - "version": "2.0.10", - "license": "MIT", + "version": "2.3.1", + "resolved": "https://registry.npmmirror.com/@element-plus/icons-vue/-/icons-vue-2.3.1.tgz", + "integrity": "sha512-XxVUZv48RZAd87ucGS48jPf6pKu0yV5UCg9f4FFwtrYxXOwWuVJo6wOvSLKEoMQKjv8GsX/mhP6UsC1lRwbUWg==", "peerDependencies": { "vue": "^3.2.0" } @@ -3729,11 +3730,12 @@ "license": "ISC" }, "node_modules/element-plus": { - "version": "2.2.26", - "license": "MIT", + "version": "2.4.3", + "resolved": "https://registry.npmmirror.com/element-plus/-/element-plus-2.4.3.tgz", + "integrity": "sha512-b3q26j+lM4SBqiyzw8HybybGnP2pk4MWgrnzzzYW5qKQUgV6EG1Zg7nMCfgCVccI8tNvZoTiUHb2mFaiB9qT8w==", "dependencies": { "@ctrl/tinycolor": "^3.4.1", - "@element-plus/icons-vue": "^2.0.6", + "@element-plus/icons-vue": "^2.3.1", "@floating-ui/dom": "^1.0.1", "@popperjs/core": "npm:@sxzz/popperjs-es@^2.11.7", "@types/lodash": "^4.14.182", @@ -8693,7 +8695,9 @@ } }, "@element-plus/icons-vue": { - "version": "2.0.10", + "version": "2.3.1", + "resolved": "https://registry.npmmirror.com/@element-plus/icons-vue/-/icons-vue-2.3.1.tgz", + "integrity": "sha512-XxVUZv48RZAd87ucGS48jPf6pKu0yV5UCg9f4FFwtrYxXOwWuVJo6wOvSLKEoMQKjv8GsX/mhP6UsC1lRwbUWg==", "requires": {} }, "@eslint-community/eslint-utils": { @@ -9942,10 +9946,12 @@ "dev": true }, "element-plus": { - "version": "2.2.26", + "version": "2.4.3", + "resolved": "https://registry.npmmirror.com/element-plus/-/element-plus-2.4.3.tgz", + "integrity": "sha512-b3q26j+lM4SBqiyzw8HybybGnP2pk4MWgrnzzzYW5qKQUgV6EG1Zg7nMCfgCVccI8tNvZoTiUHb2mFaiB9qT8w==", "requires": { "@ctrl/tinycolor": "^3.4.1", - "@element-plus/icons-vue": "^2.0.6", + "@element-plus/icons-vue": "^2.3.1", "@floating-ui/dom": "^1.0.1", "@popperjs/core": "npm:@sxzz/popperjs-es@^2.11.7", "@types/lodash": "^4.14.182", diff --git a/package.json b/package.json index 647b599..50001b6 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "@vueuse/core": "^9.7.0", "axios": "^1.2.1", "dayjs": "^1.11.10", - "element-plus": "^2.2.26", + "element-plus": "^2.4.3", "pinia": "^2.0.26", "vue": "^3.2.45", "vue-router": "^4.1.6" diff --git a/src/components.d.ts b/src/components.d.ts index b1cd8a8..0f89be9 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -10,7 +10,6 @@ BaseContentLayout: typeof import('./components/core/BaseContentLayout.vue')['default'] BasePanelLayout: typeof import('./components/core/BasePanelLayout.vue')['default'] Content: typeof import('./components/core/Content.vue')['default'] - copy: typeof import('./components/search-option/FYOptionScene copy.vue')['default'] ElAside: typeof import('element-plus/es')['ElAside'] ElAvatar: typeof import('element-plus/es')['ElAvatar'] ElBacktop: typeof import('element-plus/es')['ElBacktop'] @@ -56,6 +55,7 @@ ElTabPane: typeof import('element-plus/es')['ElTabPane'] ElTabs: typeof import('element-plus/es')['ElTabs'] ElTag: typeof import('element-plus/es')['ElTag'] + ElText: typeof import('element-plus/es')['ElText'] ElTooltip: typeof import('element-plus/es')['ElTooltip'] ElTransfer: typeof import('element-plus/es')['ElTransfer'] ElTree: typeof import('element-plus/es')['ElTree'] @@ -72,7 +72,6 @@ FYTable: typeof import('./components/table/FYTable.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'] SearchBar: typeof import('./components/SearchBar.vue')['default'] diff --git a/src/components/core/SiderMenu.vue b/src/components/core/SiderMenu.vue index 1cbb4b5..d4541a2 100644 --- a/src/components/core/SiderMenu.vue +++ b/src/components/core/SiderMenu.vue @@ -60,7 +60,7 @@ </template> <script> -import { MENU_FYSP, MENU_FYTZ, MENU_FYPW } from '../../constants/index' +import { MENU_FYSP, MENU_FYTZ, MENU_FYPW } from '@/constants/index' export default { name: 'CoreSiderMenu', diff --git a/src/components/form/FYForm.vue b/src/components/form/FYForm.vue index 0d68089..c4919dd 100644 --- a/src/components/form/FYForm.vue +++ b/src/components/form/FYForm.vue @@ -8,12 +8,8 @@ label-width="150px" > <slot name="form-item" :formObj="formObj"></slot> - <el-form-item> - <el-button - :disabled="!edit" - type="primary" - @click="onSubmit" - :loading="loading" + <el-form-item v-if="showButtons"> + <el-button :disabled="!edit" type="primary" @click="onSubmit" :loading="loading" >鎻愪氦</el-button > <el-button :disabled="!edit" @click="onReset">閲嶇疆</el-button> @@ -38,12 +34,16 @@ formInfo: Object, //琛ㄥ崟妫�楠岃鍒� rules: Object, + showButtons: { + type: Boolean, + default: true + }, //鍙栨秷鎸夐挳鏄惁鍙敤 enableCancelBtn: Boolean, //瑙﹀彂閲嶇疆 reset: Boolean, //閫氱煡缂栬緫鐘舵�� - isEdit: Boolean, + isEdit: Boolean }); //瑙﹀彂鍑芥暟锛屾彁浜ゅ拰鍙栨秷 @@ -52,11 +52,11 @@ //琛ㄥ崟鎿嶄綔鍑芥暟 const { formObj, formRef, edit, onSubmit, onCancel, onReset } = useFormConfirm({ submit: { - do: submit, + do: submit }, cancel: { - do: cancel, - }, + do: cancel + } }); //鍔犺浇鐘舵�� diff --git a/src/components/table/FYTable.vue b/src/components/table/FYTable.vue index 0e6e982..c519077 100644 --- a/src/components/table/FYTable.vue +++ b/src/components/table/FYTable.vue @@ -15,6 +15,7 @@ table-layout="fixed" :row-class-name="tableRowClassName" :height="tableHeight" + border > <slot name="table-column"></slot> </el-table> diff --git a/src/constants/envCreditCode.js b/src/constants/envCreditCode.js new file mode 100644 index 0000000..184d7af --- /dev/null +++ b/src/constants/envCreditCode.js @@ -0,0 +1,26 @@ +// 鐜俊鐮佽浆鎹� + +function envCreditCode(score) { + const s = parseInt(score) + if (s <= 59) { + return { + value: 2, + name: '绾㈢爜', + color: '#db2828' + }; + } else if (s <= 89) { + return { + value: 1, + name: '榛勭爜', + color: '#f7a62c' + }; + } else { + return { + value: 0, + name: '缁跨爜', + color: '#21ba45' + }; + } +} + +export { envCreditCode }; diff --git a/src/constants/index.js b/src/constants/index.js index 51c825e..293b045 100644 --- a/src/constants/index.js +++ b/src/constants/index.js @@ -1 +1,2 @@ -export { MENU_FYSP, MENU_FYTZ, MENU_FYPW } from './menu' +export { MENU_FYSP, MENU_FYTZ, MENU_FYPW } from './menu'; +export { envCreditCode } from './envCreditCode'; diff --git a/src/constants/menu.js b/src/constants/menu.js index edc83a5..afb67dd 100644 --- a/src/constants/menu.js +++ b/src/constants/menu.js @@ -36,12 +36,12 @@ { path: '/fysp/evaluation/datasource', icon: 'MessageBox', - name: '璇勪及鏁版嵁婧�', + name: '璇勪及浠诲姟', }, { path: '/fysp/evaluation/resultManage', icon: 'Tickets', - name: '璇勪及绠$悊', + name: '璇勪及璁板綍', }, ], }, diff --git a/src/stores/loadingStore.js b/src/stores/loadingStore.js index d8b2d1c..d69e666 100644 --- a/src/stores/loadingStore.js +++ b/src/stores/loadingStore.js @@ -1,23 +1,26 @@ // 鍔犺浇鐘舵�佺殑閫昏緫绠$悊 -import { defineStore } from 'pinia' +import { defineStore } from 'pinia'; export const useLoadingStore = defineStore('loading', { state: () => { return { loadingStatus: [] - } + }; }, actions: { + pushLoading(func) { + const timeout = setTimeout(func, 3000); + this.loadingStatus.push({ t: timeout, f: func }); + }, clearLoading() { - this.loadingStatus.forEach(l => { - if (typeof l === 'function') { - l() - } - }); if (this.loadingStatus.length > 0) { - this.loadingStatus = [] + this.loadingStatus.forEach((obj) => { + clearTimeout(obj.t) + obj.f() + }); + this.loadingStatus = []; } } } -}) \ No newline at end of file +}); diff --git a/src/views/baseinfo/fysp/scene/SceneInfo.vue b/src/views/baseinfo/fysp/scene/SceneInfo.vue index 535e602..b3e7682 100644 --- a/src/views/baseinfo/fysp/scene/SceneInfo.vue +++ b/src/views/baseinfo/fysp/scene/SceneInfo.vue @@ -107,7 +107,7 @@ }, itemEdit(scope) { scope.row.loading1 = true; - this.loadingStore.loadingStatus.push(() => (scope.row.loading1 = false)); + this.loadingStore.pushLoading(() => (scope.row.loading1 = false)); this.$router.push(`sceneEdit/${scope.row.guid}`); }, itemActive(scope) { diff --git a/src/views/fysp/evaluation/DataSource.vue b/src/views/fysp/evaluation/DataSource.vue index 9f57df9..61476d4 100644 --- a/src/views/fysp/evaluation/DataSource.vue +++ b/src/views/fysp/evaluation/DataSource.vue @@ -1,14 +1,28 @@ <template> - <div>DataSource</div> + <el-row :gutter="16"> + <el-col :span="16"> + <CompPreCheck></CompPreCheck> + </el-col> + <el-col :span="8"> + <div class="radius"></div> + </el-col> + </el-row> </template> <script> +import CompPreCheck from "./components/CompPreCheck.vue"; export default { name: 'DataSource', + components: { CompPreCheck }, data() { - return { - - } + return {}; } }; </script> +<style scoped> +.radius { + height: 80vh; + border: 1px solid var(--el-border-color); + border-radius: var(--el-border-radius-base); +} +</style> diff --git a/src/views/fysp/evaluation/ResultManage.vue b/src/views/fysp/evaluation/ResultManage.vue index 0a3a198..da2c668 100644 --- a/src/views/fysp/evaluation/ResultManage.vue +++ b/src/views/fysp/evaluation/ResultManage.vue @@ -1,7 +1,7 @@ <template> <!-- <CompPreCheck @pre-check="autoEvaluate"></CompPreCheck> --> - <FYTable @search="onSearch" :pagination="false"> + <FYTable @search="onSearch" :pagination="false" ref="tableRef"> <template #options> <!-- 鍖哄幙 --> <FYOptionLocation @@ -25,14 +25,8 @@ </template> <template #table-column> - <el-table-column - type="index" - fixed="left" - prop="sceneName" - label="鍚嶇О" - width="400" - > - <template #default="{row}"> + <el-table-column type="index" fixed="left" prop="sceneName" label="鍚嶇О" width="300"> + <template #default="{ row }"> <el-tooltip effect="dark" :content="row.sceneName" @@ -43,42 +37,78 @@ </el-tooltip> </template> </el-table-column> - + <el-table-column + prop="subTaskTime" + label="宸℃煡鏃ユ湡" + width="110" + sortable + :formatter="timeFormat" + /> + <el-table-column + prop="evaluation.resultscorebef" + label="寰楀垎" + width="90" + sortable + :sort-method="sortScore" + /> + <el-table-column prop="evaluation.resultscorebef" label="鐜俊鐮�" width="100"> + <template #default="{ row }"> + <span :style="`color: ${toCode(row).color};`">{{ toCode(row).name }}</span> + </template> + </el-table-column> + <el-table-column prop="dname" label="鍖哄幙" width="90" /> - <el-table-column prop="tname" label="琛楅亾" width="110" /> + <el-table-column + prop="tname" + label="琛楅亾" + width="110" + :filters="townFilters" + :filter-method="filterHandler" + /> <el-table-column prop="evaluation.scenseaddress" label="鍦板潃" /> <!-- <el-table-column prop="biArea" label="闆嗕腑鍖�" width="110" /> <el-table-column prop="biManagementCompany" label="鐗╀笟" min-width="110"/> --> - <el-table-column prop="evaluation.resultscorebef" label="寰楀垎" width="110" /> + <el-table-column fixed="right" align="right" label="鎿嶄綔" width="160"> + <template #header> + <el-button icon="DocumentAdd" size="default" type="success" @click="drawer = true" + >鑷姩璇勪及</el-button + > + </template> + <template #default="{ row }"> + <el-button type="primary" size="small" @click="editRow(row)">鏌ョ湅</el-button> + </template> + </el-table-column> </template> </FYTable> </template> <script> -import CompPreCheck from './components/CompPreCheck.vue' -import evaluateApi from '@/api/fysp/evaluateApi' -import dayjs from 'dayjs' -import CompQuickSet from './components/CompQuickSet.vue' +import dayjs from 'dayjs'; +import evaluateApi from '@/api/fysp/evaluateApi'; +import { envCreditCode } from '@/constants/index'; +import CompQuickSet from './components/CompQuickSet.vue'; export default { name: 'ResultManage', - components: { CompPreCheck, CompQuickSet }, + components: { CompQuickSet }, data() { return { formSearch: { locations: {}, scenetype: {}, time: dayjs().add(-1, 'M').date(1).toDate() - } - } + }, + townFilters: [] + }; }, methods: { setOptions(param) { - this.formSearch.locations = param.locations - this.formSearch.scenetype = param.scenetype + this.formSearch.locations = param.locations; + this.formSearch.scenetype = param.scenetype; + this.$refs.tableRef.onSearch() }, onSearch(page, func) { - const { locations, scenetype, time } = this.formSearch + const { locations, scenetype, time } = this.formSearch; const area = { provincecode: locations.pCode, provincename: locations.pName, @@ -88,15 +118,56 @@ districtname: locations.dName, starttime: dayjs(time).format('YYYY-MM-DD'), scensetypeid: scenetype.value - } + }; evaluateApi.fetchAutoEvaluation(area).then((res) => { - if (res) { - func({ - data: res.data - }) + if (typeof func === 'function') { + func({ data: res.data }); } - }) + if (res.data) { + this.getFilters(res.data); + } + }); + }, + getFilters(data) { + const townList = []; + data.forEach((e) => { + if (townList.indexOf(e.tname) == -1) { + townList.push(e.tname); + } + }); + this.townFilters = townList.map((v) => { + return { text: v, value: v }; + }); + }, + toCode(row, column) { + if (row.evaluation) { + return envCreditCode(row.evaluation.resultscorebef); + } else { + return ''; + } + }, + timeFormat(row, column) { + const time = row.subTaskTime; + if (time) { + return dayjs(time).format('MM-DD'); + } else { + return ''; + } + }, + filterHandler(value, row, column) { + const property = column['property']; + return row[property] === value; + }, + sortScore(a, b) { + const s1 = a.evaluation ? parseInt(a.evaluation.resultscorebef) : 0; + const s2 = b.evaluation ? parseInt(b.evaluation.resultscorebef) : 0; + return s1 - s2; } } -} +}; </script> +<style scoped> +.a { + color: #f7a62c; +} +</style> diff --git a/src/views/fysp/evaluation/components/CompPreCheck.vue b/src/views/fysp/evaluation/components/CompPreCheck.vue index 0199703..f99b60b 100644 --- a/src/views/fysp/evaluation/components/CompPreCheck.vue +++ b/src/views/fysp/evaluation/components/CompPreCheck.vue @@ -1,117 +1,76 @@ <template> - <FYSearchBar @search="preCheck"> - <template #options> - <!-- 鍖哄幙 --> - <FYOptionLocation - :allOption="false" - :level="3" - :checkStrictly="false" - v-model:value="formSearch.locations" - ></FYOptionLocation> - <!-- 鍦烘櫙绫诲瀷 --> - <FYOptionScene - :allOption="false" - :type="2" - v-model:value="formSearch.scenetype" - ></FYOptionScene> - <!-- 鏃堕棿 --> - <FYOptionTime :initValue="false" type="month" v-model:value="formSearch.time"></FYOptionTime> + <el-steps :active="stepIndex" finish-status="success" style="" align-center> + <el-step title="璇勪及鑼冨洿" /> + <el-step title="鏁版嵁婧愭鏌�" /> + <el-step title="璞佸厤鏉$洰" /> + <el-step title="鑷姩璇勪及" /> + </el-steps> + + <el-card v-if="stepIndex == 0" shadow="never"> + <template #header> + <div><el-text tag="b" size="large">閫夋嫨璇勪及鑼冨洿</el-text></div> + <el-text size="small" type="info">鍖呮嫭鍖哄幙銆佸満鏅被鍨嬩互鍙婃湀浠�</el-text> </template> - </FYSearchBar> - <el-row> - <span>蹇嵎閫夋嫨</span> - <el-button v-for="(v, i) in quickSetting" :key="i" type="primary" @click="quickSet(v)">{{ - v.name - }}</el-button> - </el-row> + <FYForm :form-info="evaConditon" :rules="evaConditionRules" :showButtons="false"> + <template #form-item="{ formObj }"> + <!-- 鍖哄幙 --> + <FYOptionLocation + :allOption="false" + :level="3" + :checkStrictly="false" + v-model:value="formObj.locations" + ></FYOptionLocation> + <!-- 鍦烘櫙绫诲瀷 --> + <FYOptionScene + :allOption="false" + :type="2" + v-model:value="formObj.scenetype" + ></FYOptionScene> + <!-- 鏃堕棿 --> + <FYOptionTime + :initValue="true" + type="month" + v-model:value="formObj.time" + ></FYOptionTime> + </template> + </FYForm> + <template #footer> + <el-row justify="space-around"> + <el-button type="primary" size="default">涓嬩竴姝�</el-button> + </el-row> + </template> + </el-card> + <el-card v-if="stepIndex == 1" shadow="never"> Never2 </el-card> + <el-card v-if="stepIndex == 2" shadow="never"> Never3 </el-card> + <el-card v-if="stepIndex == 3" shadow="never"> Never4 </el-card> </template> <script> -import dayjs from 'dayjs' +import dayjs from 'dayjs'; /** * 鑷姩璇勪及鏉′欢鍚堣鎬ф鏌� */ export default { name: 'CompPreCheck', - props: { - quickSetting: { - type: Array, - default: () => { - return [ - { - name: '闈欏畨宸ュ湴', - locations: { - pCode: '31', - pName: '涓婃捣甯�', - cCode: '3100', - cName: '涓婃捣甯�', - dCode: '310106', - dName: '闈欏畨鍖�' - }, - scenetype: { label: '宸ュ湴', value: '1' } - }, - { - name: '寰愭眹椁愰ギ', - locations: { - pCode: '31', - pName: '涓婃捣甯�', - cCode: '3100', - cName: '涓婃捣甯�', - dCode: '310104', - dName: '寰愭眹鍖�' - }, - scenetype: { label: '椁愰ギ', value: '5' } - }, - { - name: '閲戝北宸ュ湴', - locations: { - pCode: '31', - pName: '涓婃捣甯�', - cCode: '3100', - cName: '涓婃捣甯�', - dCode: '310116', - dName: '閲戝北鍖�' - }, - scenetype: { label: '宸ュ湴', value: '1' } - }, - { - name: '閲戝北鐮佸ご', - locations: { - pCode: '31', - pName: '涓婃捣甯�', - cCode: '3100', - cName: '涓婃捣甯�', - dCode: '310116', - dName: '閲戝北鍖�' - }, - scenetype: { label: '鐮佸ご', value: '2' } - }, - { - name: '閲戝北鎼呮媽绔�', - locations: { - pCode: '31', - pName: '涓婃捣甯�', - cCode: '3100', - cName: '涓婃捣甯�', - dCode: '310116', - dName: '閲戝北鍖�' - }, - scenetype: { label: '鎼呮媽绔�', value: '3' } - } - ] - } - } - }, + props: {}, emits: ['preCheck'], data() { return { - formSearch: { - locations: {}, - scenetype: {}, - time: dayjs().add(-1, 'M').date(1).toDate() + // 鎿嶄綔姝ラ涓嬫爣 + stepIndex: 0, + // 璇勪及浠诲姟鑼冨洿 + evaConditon: {}, + evaConditionRules: { + acountname: [ + { + required: true, + message: '璐︽埛鍚嶄笉鑳戒负绌�', + trigger: 'blur' + } + ] } - } + }; }, methods: { /** @@ -119,23 +78,8 @@ * 妫�鏌ユ墍閫夎寖鍥村唴鍚勯」璇勪及鏁版嵁婧愭槸鍚﹀畬鏁� */ preCheck() { - const param = { - locations: this.formSearch.locations, - scenetype: this.formSearch.scenetype, - time: dayjs(this.formSearch.time).format('YYYY-MM-DD') - } - this.$emit('preCheck', param) - }, - - /** - * 蹇�熻缃潯浠� - */ - quickSet(set) { - this.formSearch.locations = set.locations - this.formSearch.scenetype = set.scenetype - - // this.preCheck() + // this.$emit('preCheck', param) } } -} +}; </script> diff --git a/src/views/fytz/user/UserInfo.vue b/src/views/fytz/user/UserInfo.vue index 27d814e..2d9bcd2 100644 --- a/src/views/fytz/user/UserInfo.vue +++ b/src/views/fytz/user/UserInfo.vue @@ -52,7 +52,7 @@ </template> </el-table-column> <el-table-column prop="userInfo.usertype" label="鐢ㄦ埛绫诲瀷" width="90" /> - <el-table-column fixed="right" align="right" label="鎿嶄綔" width="140"> + <el-table-column fixed="right" align="right" label="鎿嶄綔" width="160"> <template #header> <el-button icon="DocumentAdd" @@ -70,13 +70,13 @@ @click="editRow(scope)" >鏌ョ湅</el-button > - <!-- <el-button + <el-button :loading="scope.row.loading2" - :type="scope.row.extension1 != '0' ? 'danger' : 'primary'" + :type="scope.row.userInfo.isenable != '0' ? 'danger' : 'primary'" size="small" @click="itemActive(scope)" - >{{ scope.row.extension1 != '0' ? '涓嬬嚎' : '涓婄嚎' }}</el-button - > --> + >{{ scope.row.userInfo.isenable != '0' ? '涓嬬嚎' : '涓婄嚎' }}</el-button + > </template> </el-table-column> </template> @@ -147,24 +147,25 @@ }, editRow(scope) { scope.row.loading1 = true; - this.loadingStore.loadingStatus.push(() => (scope.row.loading1 = false)); - this.$router.push(`userEdit/${scope.row.biGuid}`); + this.loadingStore.pushLoading(() => (scope.row.loading1 = false)); + this.$router.push(`userEdit/${scope.row.userInfo.guid}`); }, itemActive(scope) { - const rb = {}; - rb.guid = scope.row.guid; - rb.extension1 = scope.row.extension1 != '0' ? '0' : '1'; - const msg = scope.row.extension1 != '0' ? '涓嬬嚎' : '涓婄嚎'; + const param = { + guid: scope.row.userInfo.guid, + isenable: !scope.row.userInfo.isenable + } + const msg = scope.row.userInfo.isenable ? '涓嬬嚎' : '涓婄嚎'; useMessageBoxTip({ confirmMsg: `纭${msg}璇ュ満鏅紵`, confirmTitle: msg, onConfirm: () => { scope.row.loading2 = true; return userApi - .updateScene(rb) + .updateUserInfo(param) .then((res) => { - if (res == 1) { - scope.row.extension1 = rb.extension1; + if (res.success) { + scope.row.userInfo.isenable = param.isenable; } }) .finally(() => { diff --git a/src/views/fytz/user/components/CompUserInfo.vue b/src/views/fytz/user/components/CompUserInfo.vue index e8be54c..1270998 100644 --- a/src/views/fytz/user/components/CompUserInfo.vue +++ b/src/views/fytz/user/components/CompUserInfo.vue @@ -33,9 +33,7 @@ </el-col> <el-col :span="6" v-if="!create"> <el-row justify="end"> - <el-button type="danger" @click="onResetPw" :loading="pwLoading" - >閲嶇疆瀵嗙爜</el-button - > + <el-button type="danger" @click="onResetPw" :loading="pwLoading">閲嶇疆瀵嗙爜</el-button> </el-row> </el-col> </el-form-item> @@ -54,20 +52,13 @@ </el-form-item> --> <el-form-item label="鏄惁鍙敤" prop="isenable"> <el-switch v-model="formObj.isenable" /> - <span style="margin-left: 16px">{{ - formObj.isenable ? '鍙敤' : '涓嶅彲鐢�' - }}</span> + <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-input clearable type="tel" v-model="formObj.telephone" placeholder="鎵嬫満" /> </el-form-item> <!-- <el-form-item label="鐪�/甯�/鍖�/闀�" prop="_locations"> <el-cascader @@ -94,6 +85,7 @@ import { getSceneName } from '@/enum/scene'; import { enumLocation } from '@/enum/location'; import userApi from '@/api/fytz/userApi'; +import { useMessageBoxTip } from '@/composables/messageBox'; const props = defineProps({ //鍩烘湰淇℃伅 @@ -101,36 +93,37 @@ isEdit: Boolean, create: { type: Boolean, - default: false, + default: false }, active: { type: Boolean, - default: false, - }, + default: false + } }); const emit = defineEmits(['onSubmit', 'onCancel', 'update:isEdit']); const _formInfo = ref(); +const _formObject = { value: {} }; const _edit = ref(false); const locations = enumLocation(false); const locationsProps = reactive({ - checkStrictly: true, + checkStrictly: true }); const rules = reactive({ acountname: [ { required: true, message: '璐︽埛鍚嶄笉鑳戒负绌�', - trigger: 'blur', - }, + trigger: 'blur' + } ], realname: [ { required: true, message: '鐢ㄦ埛鏄电О涓嶈兘涓虹┖', - trigger: 'blur', - }, + trigger: 'blur' + } ], // password: [ // { @@ -143,30 +136,30 @@ { required: true, message: '鐢ㄦ埛绫诲瀷涓嶈兘涓虹┖', - trigger: 'change', - }, + trigger: 'change' + } ], _locations: [ { required: props.create, message: '鐪�/甯�/鍖�/闀囦笉鑳戒负绌�', - trigger: 'change', - }, + trigger: 'change' + } ], _scenetype: [ { required: true, message: '鍦烘櫙绫诲瀷涓嶈兘涓虹┖', - trigger: 'change', - }, - ], + trigger: 'change' + } + ] }); // 鐢ㄦ埛鍩烘湰淇℃伅鏍煎紡鍖� function parseUserInfo(s) { s._usertype = { label: s.usertype, - value: s.usertypeid + '', + value: s.usertypeid + '' }; s._scenetype = getSceneName(s.extension2, 1); @@ -176,6 +169,19 @@ return s; } +function parseUserInfoReverse(formObj) { + // 鐢ㄦ埛绫诲瀷淇℃伅濉厖 + 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 formObj; +} + function createUser(formObj, func) { return userApi .createUser(formObj.value) @@ -183,6 +189,7 @@ emit('onSubmit', formObj); }) .finally(() => { + _formObject.value = formObj.value; func(); }); } @@ -194,38 +201,32 @@ emit('onSubmit', formObj); }) .finally(() => { - func(); + _formObject.value = formObj.value; + if (func) func(); }); } function submit(formObj, func) { // 琛屾斂鍖哄垝淇℃伅濉厖 - 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 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; + parseUserInfoReverse(formObj); return props.create ? createUser(formObj, func) : updateUser(formObj, func); } @@ -238,6 +239,7 @@ () => props.formInfo, (nValue) => { _formInfo.value = parseUserInfo(nValue); + _formObject.value = _formInfo.value; } ); @@ -245,5 +247,21 @@ emit('update:isEdit', nValue); }); + +// 閲嶇疆瀵嗙爜 + const pwLoading = ref(false); + +function onResetPw() { + useMessageBoxTip({ + confirmMsg: '鏄惁閲嶇疆璇ュ満鏅瘑鐮侊紵', + confirmTitle: '閲嶇疆瀵嗙爜', + onConfirm: async () => { + pwLoading.value = true + _formObject.value.password = '123456'; + await updateUser(_formObject); + pwLoading.value = false + } + }); +} </script> -- Gitblit v1.9.3