From e5875000e60d4976f159f287ae3773f1d11960b3 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期五, 22 十二月 2023 17:36:56 +0800 Subject: [PATCH] 调整FYForm表单逻辑 --- src/views/fytz/user/UserInfo.vue | 165 +++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 105 insertions(+), 60 deletions(-) diff --git a/src/views/fytz/user/UserInfo.vue b/src/views/fytz/user/UserInfo.vue index 2d9bcd2..759ad03 100644 --- a/src/views/fytz/user/UserInfo.vue +++ b/src/views/fytz/user/UserInfo.vue @@ -3,10 +3,14 @@ <template #options> <FYOptionLocation :allOption="true" - :level="4" + :level="5" v-model:value="formSearch._locations" ></FYOptionLocation> - <FYOptionText label="鍏抽敭瀛�" placeholder="杈撳叆鍚嶇О鍏抽敭瀛�" v-model:value="formSearch.searchText"></FYOptionText> + <FYOptionText + label="鍏抽敭瀛�" + placeholder="杈撳叆鍚嶇О鍏抽敭瀛�" + v-model:value="formSearch.searchText" + ></FYOptionText> <FYOptionScene :allOption="true" :type="1" @@ -19,13 +23,7 @@ </template> <template #table-column> - <el-table-column - type="index" - fixed="left" - prop="userInfo.realname" - label="鍚嶇О" - width="400" - > + <el-table-column type="index" fixed="left" prop="userInfo.realname" label="鍚嶇О" width="400"> <template #default="scope"> <el-tooltip effect="dark" @@ -38,54 +36,84 @@ </template> </el-table-column> <el-table-column prop="userInfo.acountname" label="璐﹀彿" width="110" /> - <el-table-column prop="sceneTypeName" label="绫诲瀷" width="130" /> - <el-table-column prop="biProvinceName" label="鐪�" width="90" /> - <el-table-column prop="biCityName" label="甯�" width="90" /> + <el-table-column prop="sceneTypeName" label="绫诲瀷" width="100" /> + <el-table-column prop="biProvinceName" label="鐪�" width="80" /> + <el-table-column prop="biCityName" label="甯�" width="80" /> <!-- <el-table-column prop="districtname" label="鍖哄幙" width="90" /> --> - <el-table-column prop="userInfo.extension1" label="鍖哄幙" width="90" /> + <el-table-column prop="userInfo.extension1" label="鍖哄幙" width="80" /> <el-table-column prop="biTownName" label="琛楅亾" width="110" /> <el-table-column prop="biArea" label="闆嗕腑鍖�" width="110" /> - <el-table-column prop="biManagementCompany" label="鐗╀笟" min-width="110"/> + <el-table-column prop="biManagementCompany" label="鐗╀笟" min-width="110" /> <el-table-column prop="userInfo.isenable" label="鐘舵��" width="90"> - <template #default="scope"> - {{ scope.row.userInfo.isenable ? '涓婄嚎涓�' : '宸蹭笅绾�' }} + <template #default="{ row }"> + {{ row.userInfo.isenable ? '涓婄嚎涓�' : '宸蹭笅绾�' }} </template> </el-table-column> <el-table-column prop="userInfo.usertype" label="鐢ㄦ埛绫诲瀷" width="90" /> - <el-table-column fixed="right" align="right" label="鎿嶄綔" width="160"> + <el-table-column fixed="right" align="right" label="鎿嶄綔" width="190"> <template #header> - <el-button - icon="DocumentAdd" - size="default" - type="success" - @click="drawer = true" + <el-button icon="DocumentAdd" size="default" type="success" @click="drawer = true" >鏂板鐢ㄦ埛</el-button > </template> - <template #default="scope"> - <el-button - :loading="scope.row.loading1" - type="primary" - size="small" - @click="editRow(scope)" - >鏌ョ湅</el-button - > - <el-button - :loading="scope.row.loading2" - :type="scope.row.userInfo.isenable != '0' ? 'danger' : 'primary'" - size="small" - @click="itemActive(scope)" - >{{ scope.row.userInfo.isenable != '0' ? '涓嬬嚎' : '涓婄嚎' }}</el-button - > + <template #default="{ row }"> + <el-space> + <el-button + :loading="row.loading2" + :type="row.userInfo.isenable != '0' ? 'danger' : 'primary'" + size="small" + @click="itemActive(row)" + >{{ row.userInfo.isenable != '0' ? '涓嬬嚎' : '涓婄嚎' }}</el-button + > + <el-button-group> + <el-button type="primary" :loading="row.loading1" size="small" @click="editRow(row)" + >鏌ョ湅</el-button + > + <el-dropdown @command="handleCommand" trigger="click"> + <el-button + type="primary" + :loading="row.downloadLoading" + size="small" + :icon="row.downloadLoading ? '' : 'ArrowDown'" + ></el-button> + <template #dropdown> + <el-dropdown-menu> + <el-dropdown-item icon="Download" :command="{ c: 1, p: row }" + >涓嬭浇鐜俊鐮�</el-dropdown-item + > + </el-dropdown-menu> + </template> + </el-dropdown> + </el-button-group> + <!-- <el-dropdown + split-button + :loading="row.loading1" + size="small" + type="primary" + @click="editRow(row)" + @command="handleCommand" + trigger="click" + > + 鏌ョ湅 + <template #dropdown> + <el-dropdown-menu> + <el-dropdown-item icon="Download" :command="{ c: 1, p: row }" + >涓嬭浇鐜俊鐮�</el-dropdown-item + > + </el-dropdown-menu> + </template> + </el-dropdown> --> + </el-space> </template> </el-table-column> </template> </FYTable> - <CompUserInfoAddDrawer v-model:drawer="drawer"></CompUserInfoAddDrawer> + <CompUserInfoAddDrawer v-model="drawer"></CompUserInfoAddDrawer> </template> <script> import userApi from '@/api/fytz/userApi'; +import creditApi from '@/api/fytz/creditApi'; import { useLoadingStore } from '@/stores/loadingStore'; import { mapStores } from 'pinia'; import { useMessageBoxTip } from '@/composables/messageBox'; @@ -93,34 +121,36 @@ export default { components: { - CompUserInfoAddDrawer, + CompUserInfoAddDrawer }, data() { return { + // 鏌ヨ鏉′欢 formSearch: { _locations: {}, searchText: '', scensetype: {}, - online: {}, + online: {} }, - drawer: false, + // 鏂板鐢ㄦ埛寮瑰嚭妗� + drawer: false }; }, computed: { - ...mapStores(useLoadingStore), + ...mapStores(useLoadingStore) }, methods: { onSearch(page, func) { const f = this.formSearch; const area = {}; // 琛屾斂鍖哄垝 - area.provinceCode = f._locations.pCode ? f._locations.pCode + '0000' : undefined + area.provinceCode = f._locations.pCode; area.provinceName = f._locations.pName; if (area.provinceCode == null) { area.provinceCode = null; area.provinceName = null; } - area.cityCode = f._locations.cCode ? f._locations.cCode.substring(0, 3) + '100' : undefined + area.cityCode = f._locations.cCode; area.cityName = f._locations.cName; area.districtCode = f._locations.dCode; area.districtName = f._locations.dName; @@ -140,44 +170,59 @@ if (res) { func({ data: res.data, - total: res.head.totalCount, + total: res.head.totalCount }); } }); }, - editRow(scope) { - scope.row.loading1 = true; - this.loadingStore.pushLoading(() => (scope.row.loading1 = false)); - this.$router.push(`userEdit/${scope.row.userInfo.guid}`); + editRow(row) { + row.loading1 = true; + this.loadingStore.pushLoading(() => (row.loading1 = false)); + this.$router.push(`userEdit/${row.userInfo.guid}`); }, - itemActive(scope) { + itemActive(row) { const param = { - guid: scope.row.userInfo.guid, - isenable: !scope.row.userInfo.isenable - } - const msg = scope.row.userInfo.isenable ? '涓嬬嚎' : '涓婄嚎'; + guid: row.userInfo.guid, + isenable: !row.userInfo.isenable + }; + const msg = row.userInfo.isenable ? '涓嬬嚎' : '涓婄嚎'; useMessageBoxTip({ confirmMsg: `纭${msg}璇ュ満鏅紵`, confirmTitle: msg, - onConfirm: () => { - scope.row.loading2 = true; + onConfirm: async () => { + row.loading2 = true; return userApi .updateUserInfo(param) .then((res) => { if (res.success) { - scope.row.userInfo.isenable = param.isenable; + row.userInfo.isenable = param.isenable; } }) .finally(() => { - scope.row.loading2 = false; + row.loading2 = false; }); - }, + } }); }, tableRowClassName({ row }) { return row.userInfo.isenable ? 'online-row' : 'offline-row'; }, - }, + handleCommand(e) { + const userId = e.p.userInfo.guid; + switch (e.c) { + // 涓嬭浇鐜俊鐮� + case 1: + e.p.downloadLoading = true; + creditApi.downloadCode(userId).finally(() => { + e.p.downloadLoading = false; + }); + break; + + default: + break; + } + } + } }; </script> <style></style> -- Gitblit v1.9.3