Преглед на файлове

用户管理 添加新增/修改用户弹窗,修改表格数据渲染

lm преди 6 дни
родител
ревизия
ef0c670a75

+ 12 - 6
src/baseComponents/FormDialog.vue

@@ -41,8 +41,11 @@
             <el-input v-if="item.type=='input'" v-model="formData[item.key]"  :disabled="item.disabled" :placeholder="item.placeholder"/>
             <el-input v-else-if="item.type=='password'" type="password" v-model="formData[item.key]"  :disabled="item.disabled"/>
             <el-input v-else-if="item.type=='textarea'" :autosize="{ minRows: item.rows, maxRows: item.rows }" v-model="formData[item.key]" type="textarea" :rows="item.rows"  :disabled="item.disabled" :placeholder="item.placeholder"/>
-            <el-input v-else-if="item.type=='number'" type="number"  v-model="formData[item.key]" :rows="item.rows"  :disabled="item.disabled" :placeholder="item.placeholder"/>
             
+            <template  v-else-if="item.type=='number'" > 
+              <el-input :style="{width: item.unit ? '80%' : '100%'}" type="number"  v-model="formData[item.key]" :rows="item.rows"  :disabled="item.disabled" :placeholder="item.placeholder"/>
+              <span v-if="item.unit" style="margin-left: 10px;">{{ item.unit }} </span>
+            </template>
             <el-radio-group 
               v-else-if="item.type=='radio'"  
               v-model="formData[item.key]" 
@@ -466,10 +469,12 @@
           </template>
 
           <template v-else>
-            <el-input v-if="item.type!=='file' && item.type!=='url' &&  
-                            item.type!=='unionSelect' && item.type !== 'dateTimePicker'" 
-                      class="readonly_input" 
-                      v-model="formData[item.key]" :readonly="true" />
+            <template  v-if="item.type!=='file' && item.type!=='url' &&  
+                    item.type!=='unionSelect' && item.type !== 'dateTimePicker'" >
+                <el-input  :style="{width: item.unit ? '80%' : '100%'}" class="readonly_input" 
+                  v-model="formData[item.key]" :readonly="true" />
+                <span v-if="item.unit" style="margin-left: 10px;">{{ item.unit }} </span>
+            </template>
 
             <span  v-else-if="item.type=='unionSelect' " style="display: flex;width: 100%;gap:20px">
               <el-input  
@@ -539,7 +544,7 @@ import {Loading} from '@element-plus/icons-vue'
 
 import closeFillImg from '@/assets/icon/close_fill.svg'
 
-import { ElMessage } from 'element-plus'
+import { ElMessage, imageEmits } from 'element-plus'
 
 import fileIcon from '@/assets/icon/file.png'
 
@@ -564,6 +569,7 @@ interface formItemProperty {
   key: String,
   label: String,
   type?:ItemType,
+  unit?:String,
   limit?:Number, // 文件上传限制的数量
   uploadTips?:String,
   acceptType?:[],

+ 2 - 1
src/views/userPrivilegeManagement/index.vue

@@ -9,8 +9,9 @@
             <div class="page_solid_line" />
             <div class="page_jg_20" />
 
-            <!-- 不同的模块 -->
+            <!-- 用户管理 -->
             <UserManage  v-if="defaultTabKey == 'userManage'"/>
+            <!-- 分组管理 -->
             <GroupManage  v-if="defaultTabKey == 'groupManage'"/>
 
 

+ 83 - 0
src/views/userPrivilegeManagement/userManage/formDialog.ts

@@ -0,0 +1,83 @@
+import { ref } from "vue";
+
+export const formItemList = ref([
+  {
+    key: 'account',
+    label: '账号',
+    type: 'input',
+    placeholder: '请输入手机号',
+    rules: [{ required: true, message: '请输入账号', trigger: 'blur' }], 
+    custom: false,
+    style: {},
+  },
+  {
+    key: 'name',
+    label: '姓名',
+    type: 'input',
+    placeholder: '请输入姓名',
+    rules: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
+    custom: false,
+    style: {},
+  },
+  {
+    key: 'gender',
+    label: '性别',
+    type: 'radio',
+    selectList: [
+      { label: '男', value: '1' },
+      { label: '女', value: '0' }
+    ],
+    custom: false,
+    style: {},
+  },
+  {
+    key: 'phone',
+    label: '手机号',
+    type: 'input',
+    placeholder: '请输入手机号',
+    rules: [{ required: true, message: '请输入手机号', trigger: 'blur' }],
+    custom: false,
+    style: {},
+  },
+  {
+    key: 'publicSeaFollowRecord',
+    label: '公海跟进记录',
+    type: 'switch',
+    custom: false,
+    style: {},
+  },
+  {
+    key: 'historyFollowRecord',
+    label: '历史跟进记录',
+    type: 'switch',
+    custom: false,
+    style: {},
+  },
+  {
+    key: 'customerHoldLimit',
+    label: '客户持有上限',
+    type: 'number',
+    placeholder: '请输入',
+    custom: false,
+    unit:'个',
+    style: {},
+  },
+  {
+    key: 'dailyManualReturnLimit',
+    label: '每日手动退回公海上限',
+    type: 'number',
+    placeholder: '请输入',
+    custom: false,
+    unit:'个',
+    style: {},
+  },
+  {
+    key: 'noFollowAutoReturnDays',
+    label: '无跟进自动退回公海天数',
+    type: 'number',
+    placeholder: '请输入',
+    custom: false,
+    unit:'天',
+    style: {},
+  }
+])

+ 141 - 13
src/views/userPrivilegeManagement/userManage/index.vue

@@ -3,12 +3,11 @@
         <div class="page_search">
             <div class="search_content">
                 <div class="content_left">
-                    <el-button class="button_background">启用用户</el-button>
-                    <el-button class="button_refresh">禁用用户</el-button>
+                    <TabSearch tabType="box" :tabList="tabList" :defaultTabKey="defaultUserType" />
                     <FormSearchGroup :searchList="formSearhList"></FormSearchGroup>
                 </div>
                 <div class="content_right">
-                    <el-button class="button_border">新增用户</el-button>
+                    <el-button class="button_border" @click="OpenUserFormDialog()">新增用户</el-button>
                 </div>
             </div>
         </div>
@@ -19,8 +18,51 @@
             <template #num="{row,currentIndex}">
                 {{ (currentIndex - 1 ) * pageSize + pageNum }}
             </template>
+
+            <template #gender="{row}">
+                {{row.gender === '0' ? '女' : '男'  }}
+            </template>
+            <template #status="{row}">
+                <TableRowStatus :statusMsg="statusMsg" :useStatus="row.status" />
+            </template>
+
+            <template #publicSeaFollowRecord="{row}">
+                <el-switch
+                    :model-value="Boolean(row.publicSeaFollowRecord)"
+                    @change="(val)=>HandleCardSwitchOnOff({id:row.id,onOffVal:val})"
+                    style="--el-switch-on-color: #2e64fa; --el-switch-off-color: #bbbbbb"
+                />
+            </template>
+
+            <template #historyFollowRecord="{row}">
+                <el-switch
+                    :model-value="Boolean(row.historyFollowRecord)"
+                    @change="(val)=>HandleCardSwitchOnOff({id:row.id,onOffVal:val})"
+                    style="--el-switch-on-color: #2e64fa; --el-switch-off-color: #bbbbbb"
+                />
+            </template>
+
+            <template #operation="{row}">
+                <div class="table_row_option">
+                    <span class="option_button_editor" @click="OpenUserFormDialog(row)">编辑</span>
+                    <span class="option_button_editor">重置密码</span>
+                    <span class="option_button_editor">禁用</span>
+                    <span class="el_button_delete">删除</span>
+                </div>
+            </template>
         </Table>
+
+         <FormDialog  width="500px"
+            :formItemList="formItemList" :defaultFormData="defaultUserFormData" 
+            :title="userFormDialogTitle" 
+            :submitLoading="userFormDialogSubmiting" 
+            :visible="userFormDialogVisible"
+            @close="CloseUserFormDialog"
+            @confirm="HandleUserFormDialogConfirm">
+        </FormDialog>
     </div>
+
+   
 </template>
 
 
@@ -29,31 +71,117 @@ import { ref } from 'vue';
 import FormSearchGroup from '@/baseComponents/FormSearchGroup.vue';
 import {formSearhList} from './formSearch'
 import Table from '@/baseComponents/Table.vue';
-
 import {tableColumns} from './table'
+import TableRowStatus from '@/baseComponents/TableRowStatus.vue';
+import TabSearch from '@/baseComponents/TabSearch.vue';
+import {tabList} from './tabSearch'
+import FormDialog from '@/baseComponents/FormDialog.vue';
+import {formItemList} from './formDialog'
 
+// 表格 有关数据
 const pageNum = ref(1)
 const pageSize = ref(20)
 const totalNum = ref(0)
 
 const userTableData = ref([
     {
+        id:'1',
         account:'xxx',
         name:'xxx',
-        gender:'xxx',
+        gender:'1',
         phone:'xxx',
-        status:'xxx',
-        publicFollow:'xxx',
-        historyFollow:'xxx',
-        holdLimit:'xxx',
-        dailyReturnLimit:'xxx',
-        returnDays:'xxx',
-        action:'xxx',
-    }
+        status:0,
+        publicSeaFollowRecord:true,
+        historyFollowRecord:false,
+
+        customerHoldLimit:40,
+        dailyManualReturnLimit:16,
+        noFollowAutoReturnDays:10,
+    },
+    {
+        id:'2',
+        account:'xxx',
+        name:'xxx',
+        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',
+    },
+])
+// more展示的用户类型
+const defaultUserType = ref('onlinePeople')
+
+// 新增用户弹窗相关数据
+const userFormDialogVisible = ref(false)
+const userFormDialogSubmiting = ref(false)
+const userFormDialogTitle = ref('')
+const defaultUserFormData = ref({
+    customerHoldLimit:100,
+    dailyManualReturnLimit:15,
+    noFollowAutoReturnDays:15,
+
+})
+// 打开新增/修改用户弹窗
+const OpenUserFormDialog = (row?:any)=>{
+    if(row?.id){
+        userFormDialogTitle.value = '修改用户'
+        defaultUserFormData.value = {...row}
+        console.log('当前赋值的form表单值',defaultUserFormData.value)
+    }else{
+        userFormDialogTitle.value = '新增用户'
+    }
+    userFormDialogVisible.value = true
+}
+// 关闭新增/修改用户弹窗
+const CloseUserFormDialog = ()=>{
+    userFormDialogVisible.value = false
+    defaultUserFormData.value = {
+        customerHoldLimit:100,
+        dailyManualReturnLimit:15,
+        noFollowAutoReturnDays:15,
+    }
+}
+// 保存新增/修改用户弹窗
+const HandleUserFormDialogConfirm = ()=>{
+    CloseUserFormDialog()
+}
 </script>
 
 
 <style lang="scss" scoped>
 
+.search_content{
+    :deep(.box_tab){
+        gap:10px;
+        .selected + span{
+            border-left: 1px solid  #dcdfe6;
+        }
+        >span:nth-child(n):not(:last-child):not(.selected){
+            border-right: 1px solid  #dcdfe6;
+        }
+        > span{
+            border-radius: 4px !important ;
+        }
+    }
+}
+
 </style>

+ 12 - 0
src/views/userPrivilegeManagement/userManage/tabSearch.ts

@@ -0,0 +1,12 @@
+import { ref } from "vue";
+
+export const tabList = ref([
+    {
+        label:'启用用户',
+        key:'onlinePeople',
+    },
+    {
+        label:'禁用用户',
+        key:'deadlinePeople',
+    }
+])

+ 10 - 10
src/views/userPrivilegeManagement/userManage/table.ts

@@ -37,7 +37,7 @@ export const tableColumns = ref([
         fixed: '',
         align: 'center',
         minWidth: '',
-        custom: false,
+        custom: true,
     },
     {
         name: 'phone',
@@ -55,28 +55,28 @@ export const tableColumns = ref([
         fixed: '',
         align: 'center',
         minWidth: '',
-        custom: false,
+        custom: true,
     },
     {
-        name: 'publicFollow',
+        name: 'publicSeaFollowRecord',
         label: '公海跟进',
         width: '100',
         fixed: '',
         align: 'center',
         minWidth: '',
-        custom: false,
+        custom: true,
     },
     {
-        name: 'historyFollow',
+        name: 'historyFollowRecord',
         label: '历史跟进',
         width: '100',
         fixed: '',
         align: 'center',
         minWidth: '',
-        custom: false,
+        custom: true,
     },
     {
-        name: 'holdLimit',
+        name: 'customerHoldLimit',
         label: '持有上限',
         width: '100',
         fixed: '',
@@ -85,7 +85,7 @@ export const tableColumns = ref([
         custom: false,
     },
     {
-        name: 'dailyReturnLimit',
+        name: 'dailyManualReturnLimit',
         label: '日退上限',
         width: '100',
         fixed: '',
@@ -94,7 +94,7 @@ export const tableColumns = ref([
         custom: false,
     },
     {
-        name: 'returnDays',
+        name: 'noFollowAutoReturnDays',
         label: '退回公海天数',
         width: '120',
         fixed: '',
@@ -109,6 +109,6 @@ export const tableColumns = ref([
         fixed: 'right', 
         align: 'center',
         minWidth: '',
-        custom: false,
+        custom: true,
     },
 ])