|
|
@@ -3,8 +3,11 @@
|
|
|
<div class="page_search">
|
|
|
<div class="search_content">
|
|
|
<div class="content_left">
|
|
|
- <TabSearch tabType="box" :tabList="tabList" :defaultTabKey="defaultUserType" />
|
|
|
- <FormSearchGroup :searchList="formSearhList"></FormSearchGroup>
|
|
|
+ <TabSearch tabType="box" :tabList="tabList"
|
|
|
+ :defaultTabKey="searchParams.defaultUserType"
|
|
|
+ @tabChange="HandleUserTypeChange"/>
|
|
|
+ <FormSearchGroup :searchList="formSearhList"
|
|
|
+ @searchChange="HandleBlurSearch" />
|
|
|
</div>
|
|
|
<div class="content_right">
|
|
|
<el-button class="button_border" @click="OpenUserFormDialog()">新增用户</el-button>
|
|
|
@@ -14,29 +17,29 @@
|
|
|
|
|
|
<div class="page_jg_20" />
|
|
|
<Table :tableColumns="tableColumns" :tableData="userTableData"
|
|
|
- :pageNum = "pageNum" :pageSize = "pageSize" :totalNum = "totalNum">
|
|
|
+ :currentPage = "currentPage" :pageSize = "pageSize" :totalNum = "totalNum">
|
|
|
<template #num="{row,currentIndex}">
|
|
|
- {{ (pageNum - 1 ) * pageSize + currentIndex }}
|
|
|
+ {{ (currentPage - 1 ) * pageSize + currentIndex }}
|
|
|
</template>
|
|
|
|
|
|
<template #gender="{row}">
|
|
|
- {{row.gender === '0' ? '女' : '男' }}
|
|
|
+ {{ genderNumToName(row.gender) }}
|
|
|
</template>
|
|
|
<template #status="{row}">
|
|
|
- <TableRowStatus :statusMsg="statusMsg" :useStatus="row.status" />
|
|
|
+ <TableRowStatus :statusMsg="accountStatusMsg" :useStatus="row.status" />
|
|
|
</template>
|
|
|
|
|
|
- <template #publicSeaFollowRecord="{row}">
|
|
|
+ <template #publicFollowStatus="{row}">
|
|
|
<el-switch
|
|
|
- :model-value="Boolean(row.publicSeaFollowRecord)"
|
|
|
+ :model-value="Boolean(row.publicFollowStatus)"
|
|
|
@change="(val)=>HandleCardSwitchOnOff({id:row.id,onOffVal:val})"
|
|
|
style="--el-switch-on-color: #2e64fa; --el-switch-off-color: #bbbbbb"
|
|
|
/>
|
|
|
</template>
|
|
|
|
|
|
- <template #historyFollowRecord="{row}">
|
|
|
+ <template #historyFollowStatus="{row}">
|
|
|
<el-switch
|
|
|
- :model-value="Boolean(row.historyFollowRecord)"
|
|
|
+ :model-value="Boolean(row.historyFollowStatus)"
|
|
|
@change="(val)=>HandleCardSwitchOnOff({id:row.id,onOffVal:val})"
|
|
|
style="--el-switch-on-color: #2e64fa; --el-switch-off-color: #bbbbbb"
|
|
|
/>
|
|
|
@@ -86,7 +89,7 @@
|
|
|
:submitLoading="forbiddenDialogLoading"
|
|
|
@close="HandleForbiddenDialogClose"
|
|
|
@confirm="HandleForbiddenDialogConfirm">
|
|
|
- 请确认是否{{currentOperationType == 'delete' ? '删除' : '禁用'}} 【{{currentEditRow?.name}}】 {{ currentEditRow?.account }}
|
|
|
+ 请确认是否{{currentOperationType == 'delete' ? '删除' : '禁用'}} 【{{currentEditRow?.username}}】 {{ currentEditRow?.account }}
|
|
|
</Dialog>
|
|
|
|
|
|
|
|
|
@@ -94,7 +97,7 @@
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { ref } from 'vue';
|
|
|
+import { onMounted, ref } from 'vue';
|
|
|
import FormSearchGroup from '@/baseComponents/FormSearchGroup.vue';
|
|
|
import {formSearhList} from './formSearch'
|
|
|
import Table from '@/baseComponents/Table.vue';
|
|
|
@@ -106,58 +109,35 @@ import FormDialog from '@/baseComponents/FormDialog.vue';
|
|
|
import {userFormItemList, resetPasswordFormItemList} from './formDialog'
|
|
|
import Dialog from '@/baseComponents/Dialog.vue';
|
|
|
|
|
|
+
|
|
|
+import {
|
|
|
+ addUserApi,
|
|
|
+ editUserApi,
|
|
|
+ deleteUserApi,
|
|
|
+ getUserListApi,
|
|
|
+ openOrCloseUserAccountApi,
|
|
|
+ resetUserPasswordApi,
|
|
|
+ openOrCloseUserFollowStatusApi,
|
|
|
+} from '@/api/userManage'
|
|
|
+
|
|
|
+import {genderNumToName, accountStatusMsg} from '@/components/dict'
|
|
|
+import { historyFollowSearchList } from '@/views/myCustomer/myCustomerDetail/customerStatusOverview/searchBlock';
|
|
|
+import { ElMessage } from 'element-plus';
|
|
|
+
|
|
|
/**
|
|
|
* 1. 表格 有关数据
|
|
|
*/
|
|
|
-const pageNum = ref(1)
|
|
|
+const currentPage = ref(1)
|
|
|
const pageSize = ref(20)
|
|
|
const totalNum = ref(0)
|
|
|
|
|
|
-const userTableData = ref([
|
|
|
- {
|
|
|
- id:'1',
|
|
|
- account:'43434',
|
|
|
- name:'xx1',
|
|
|
- gender:'1',
|
|
|
- phone:'xxx',
|
|
|
- status:0,
|
|
|
- publicSeaFollowRecord:true,
|
|
|
- historyFollowRecord:false,
|
|
|
-
|
|
|
- customerHoldLimit:40,
|
|
|
- dailyManualReturnLimit:16,
|
|
|
- noFollowAutoReturnDays:10,
|
|
|
- },
|
|
|
- {
|
|
|
- id:'2',
|
|
|
- account:'545',
|
|
|
- name:'xx2',
|
|
|
- gender:'0',
|
|
|
- phone:'xxx',
|
|
|
- status:1,
|
|
|
- publicSeaFollowRecord:false,
|
|
|
- historyFollowRecord:true,
|
|
|
-
|
|
|
- customerHoldLimit:50,
|
|
|
- dailyManualReturnLimit:20,
|
|
|
- noFollowAutoReturnDays:30,
|
|
|
- },
|
|
|
-])
|
|
|
-
|
|
|
-const statusMsg = ref([
|
|
|
- {
|
|
|
- statusFlag:0,
|
|
|
- title:'禁用',
|
|
|
- themeClass: 'not_included_icon',
|
|
|
- },
|
|
|
- {
|
|
|
- statusFlag:1,
|
|
|
- title:'启用',
|
|
|
- themeClass: 'normal_icon',
|
|
|
- },
|
|
|
-])
|
|
|
-// 默认展示的用户类型
|
|
|
-const defaultUserType = ref('onlinePeople')
|
|
|
+const userTableData = ref([])
|
|
|
+
|
|
|
+
|
|
|
+const searchParams = ref({
|
|
|
+ defaultUserType:1, // 默认展示的用户类型
|
|
|
+ queryStr:"",
|
|
|
+})
|
|
|
|
|
|
/**
|
|
|
* 2. 新增用户弹窗相关数据
|
|
|
@@ -166,17 +146,21 @@ const userFormDialogVisible = ref(false)
|
|
|
const userFormDialogSubmiting = ref(false)
|
|
|
const userFormDialogTitle = ref('')
|
|
|
const defaultUserFormData = ref({
|
|
|
- publicSeaFollowRecord:true,
|
|
|
- historyFollowRecord:true,
|
|
|
- customerHoldLimit:100,
|
|
|
- dailyManualReturnLimit:15,
|
|
|
- noFollowAutoReturnDays:15,
|
|
|
+ publicFollowStatus:true,
|
|
|
+ historyFollowStatus:true,
|
|
|
+ holdTopCount:100,
|
|
|
+ dayBackTopCount:15,
|
|
|
+ backPublicDayCount:15,
|
|
|
})
|
|
|
// 打开新增/修改用户弹窗
|
|
|
const OpenUserFormDialog = (row?:any)=>{
|
|
|
if(row?.id){
|
|
|
userFormDialogTitle.value = '修改用户'
|
|
|
- defaultUserFormData.value = {...row}
|
|
|
+ defaultUserFormData.value = {
|
|
|
+ ...row,
|
|
|
+ publicFollowStatus:Boolean(row.publicFollowStatus),
|
|
|
+ historyFollowStatus:Boolean(row.historyFollowStatus)
|
|
|
+ }
|
|
|
console.log('当前赋值的form表单值',defaultUserFormData.value)
|
|
|
}else{
|
|
|
userFormDialogTitle.value = '新增用户'
|
|
|
@@ -186,17 +170,44 @@ const OpenUserFormDialog = (row?:any)=>{
|
|
|
// 关闭新增/修改用户弹窗
|
|
|
const CloseUserFormDialog = ()=>{
|
|
|
userFormDialogVisible.value = false
|
|
|
+ userFormDialogSubmiting.value = false
|
|
|
defaultUserFormData.value = {
|
|
|
- publicSeaFollowRecord:true,
|
|
|
- historyFollowRecord:true,
|
|
|
- customerHoldLimit:100,
|
|
|
- dailyManualReturnLimit:15,
|
|
|
- noFollowAutoReturnDays:15,
|
|
|
+ publicFollowStatus:true,
|
|
|
+ historyFollowStatus:true,
|
|
|
+ holdTopCount:100,
|
|
|
+ dayBackTopCount:15,
|
|
|
+ backPublicDayCount:15,
|
|
|
}
|
|
|
}
|
|
|
// 保存新增/修改用户弹窗
|
|
|
-const HandleUserFormDialogConfirm = ()=>{
|
|
|
- CloseUserFormDialog()
|
|
|
+const HandleUserFormDialogConfirm = async (params)=>{
|
|
|
+ userFormDialogSubmiting.value = true
|
|
|
+
|
|
|
+ const { formData,formRef } = params
|
|
|
+ let transferParams = {
|
|
|
+ ...formData,
|
|
|
+ publicFollowStatus:formData.publicFollowStatus ? 1 : 0,
|
|
|
+ historyFollowStatus:formData.historyFollowStatus ? 1 : 0,
|
|
|
+ }
|
|
|
+ let res = undefined
|
|
|
+
|
|
|
+ try{
|
|
|
+ if(formData.id){
|
|
|
+ // 修改
|
|
|
+ res = await editUserApi(formData.id,transferParams)
|
|
|
+ }else{
|
|
|
+ // 新增
|
|
|
+ res = await addUserApi(transferParams)
|
|
|
+ }
|
|
|
+ }catch{}
|
|
|
+
|
|
|
+ if(res?.code == 200){
|
|
|
+ ElMessage.success(res?.msg)
|
|
|
+ CloseUserFormDialog()
|
|
|
+ GetUserList()
|
|
|
+ }else{
|
|
|
+ userFormDialogSubmiting.value = false
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -243,6 +254,38 @@ const OpenForbiddenDialog = (row,type)=>{
|
|
|
forbiddenDialogVisible.value = true
|
|
|
}
|
|
|
|
|
|
+const HandleUserTypeChange = (val)=>{
|
|
|
+ searchParams.value.defaultUserType = val
|
|
|
+ GetUserList()
|
|
|
+}
|
|
|
+
|
|
|
+const HandleBlurSearch = (params,key)=>{
|
|
|
+ searchParams.value = {
|
|
|
+ ...searchParams.value,
|
|
|
+ ...params,
|
|
|
+ }
|
|
|
+ GetUserList()
|
|
|
+}
|
|
|
+// 获取 启用/禁用 用户
|
|
|
+const GetUserList = async()=>{
|
|
|
+ let params = {
|
|
|
+ queryStr: searchParams.value.queryStr,
|
|
|
+ "status": searchParams.value.defaultUserType,
|
|
|
+ pageNum: currentPage.value,
|
|
|
+ pageSize: pageSize.value
|
|
|
+ }
|
|
|
+ let res = await getUserListApi(params)
|
|
|
+ if(res?.code == 200){
|
|
|
+ userTableData.value = res.data.records
|
|
|
+ totalNum.value = res.data.total
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+onMounted(()=>{
|
|
|
+ GetUserList()
|
|
|
+})
|
|
|
+
|
|
|
+
|
|
|
</script>
|
|
|
|
|
|
|