Browse Source

fix(bugs): 修改问题

tangning 3 years ago
parent
commit
afa3083022

+ 2 - 2
.env.development

@@ -7,8 +7,8 @@ VITE_PUBLIC_PATH = /
 # Cross-domain proxy, you can configure multiple
 # Cross-domain proxy, you can configure multiple
 # Please note that no line breaks
 # Please note that no line breaks
 # http://192.168.0.38:8190/shop
 # http://192.168.0.38:8190/shop
-# VITE_PROXY = [["/basic-api","https://cszfb.4dkankan.com/basic-api"],["/upload","http://localhost:3300/upload"],["/zfb-api","https://cszfb.4dkankan.com"]]
-VITE_PROXY = [["/basic-api","http://192.168.0.47:8190"],["/upload","http://localhost:3300/upload"],["/zfb-api","http://192.168.0.47:7081"]]
+VITE_PROXY = [["/basic-api","https://cszfb.4dkankan.com/basic-api"],["/upload","http://localhost:3300/upload"],["/zfb-api","https://cszfb.4dkankan.com"]]
+# VITE_PROXY = [["/basic-api","http://192.168.0.47:8190"],["/upload","http://localhost:3300/upload"],["/zfb-api","http://192.168.0.47:7081"]]
 #["/zfb-api","http://192.168.0.47:7081"]]
 #["/zfb-api","http://192.168.0.47:7081"]]
 # VITE_PROXY=[["/api","https://vvbin.cn/test"]]
 # VITE_PROXY=[["/api","https://vvbin.cn/test"]]
 
 

+ 1 - 1
src/views/corporation/AddModal.vue

@@ -132,10 +132,10 @@
           emit('submit', {
           emit('submit', {
             phone: values.phone,
             phone: values.phone,
             memoName: values.memoName,
             memoName: values.memoName,
+            roleId: values.roleId,
           });
           });
           resetFields();
           resetFields();
           closeModal();
           closeModal();
-          createMessage.success(t('layout.setting.operatingTitle'));
         } else {
         } else {
           createMessage.error('员工账号已被绑定');
           createMessage.error('员工账号已被绑定');
         }
         }

+ 57 - 8
src/views/corporation/SubaccountModal.vue

@@ -4,7 +4,7 @@
     @register="register"
     @register="register"
     :title="t('routes.devices.title')"
     :title="t('routes.devices.title')"
     @ok="saveTable"
     @ok="saveTable"
-    width="600px"
+    width="700px"
     @visible-change="handleVisibleChange"
     @visible-change="handleVisibleChange"
   >
   >
     <div class="pt-3px pr-3px">
     <div class="pt-3px pr-3px">
@@ -35,7 +35,11 @@
             style="width: 260px; text-align: center"
             style="width: 260px; text-align: center"
             class="justify-center suNum"
             class="justify-center suNum"
             :min="0"
             :min="0"
-            @blur="numOnChange.bind(null, field)"
+            @blur="
+              () => {
+                numOnChange(true, field);
+              }
+            "
             :max="999"
             :max="999"
           >
           >
             <template #addonBefore>
             <template #addonBefore>
@@ -83,7 +87,7 @@
                 // },
                 // },
                 {
                 {
                   icon: 'mdi:account-multiple-remove-outline',
                   icon: 'mdi:account-multiple-remove-outline',
-                  label: t('common.unbind'),
+                  label: '删除',
                   onClick: handleDelete.bind(null, record, 'unbond'),
                   onClick: handleDelete.bind(null, record, 'unbond'),
                 },
                 },
               ]"
               ]"
@@ -160,6 +164,17 @@
           dataIndex: 'userName',
           dataIndex: 'userName',
         },
         },
         {
         {
+          title: '角色',
+          width: 150,
+          dataIndex: 'roleName',
+        },
+        {
+          title: 'roleId',
+          width: 150,
+          ifShow: false,
+          dataIndex: 'roleId',
+        },
+        {
           title: t('common.operating'),
           title: t('common.operating'),
           dataIndex: '',
           dataIndex: '',
           slots: { customRender: 'action' },
           slots: { customRender: 'action' },
@@ -305,9 +320,13 @@
           addeduser: total?.length || 0,
           addeduser: total?.length || 0,
         });
         });
       }
       }
-      function numOnChange(data) {
-        let { lookNum } = getFieldsValue();
-        modelRef.subNum = lookNum + data;
+      async function numOnChange() {
+        // await setFieldsValue({
+        //   [name]: data,
+        // });
+        let { shotNum, lookNum } = getFieldsValue();
+        modelRef.subNum = lookNum + shotNum;
+        validateFields(['lookNum', 'shotNum']);
       }
       }
       async function numsOnChange(data, type) {
       async function numsOnChange(data, type) {
         let formdata = getFieldsValue();
         let formdata = getFieldsValue();
@@ -384,17 +403,47 @@
         // });
         // });
         callback(tableList);
         callback(tableList);
       }
       }
+      // function formatRoleName(val) {
+
+      // },
       function handleAddUser(newUser) {
       function handleAddUser(newUser) {
+        let DataSource = getDataSource();
+        let { shotNum, lookNum } = getFieldsValue();
+        const total = DataSource?.length;
+        let look = 0,
+          shoot = 0;
+        DataSource.map((ele) => {
+          if (ele.roleId == 8) {
+            look++;
+            shoot++;
+          } else if (ele.roleId == 81) {
+            look++;
+          } else if (ele.roleId == 82) {
+            shoot++;
+          }
+        });
+        console.log('look', look, shoot, 'shotNum, lookNum', shotNum, lookNum);
+        if (!(look < lookNum)) {
+          return createMessage.error('可带看员工数不足');
+        } else if (!(shoot < shotNum)) {
+          return createMessage.error('可拍摄员工数不足');
+        }
+        let obj = {
+          8: '带看&拍摄员工',
+          81: '带看员工',
+          82: '拍摄员工',
+        };
         insertTableDataRecord({
         insertTableDataRecord({
           nickName: newUser.memoName,
           nickName: newUser.memoName,
           userName: newUser.phone,
           userName: newUser.phone,
           phone: newUser.phone,
           phone: newUser.phone,
+          roleName: obj[newUser.roleId],
+          roleId: newUser.roleId,
         });
         });
-        const total = getDataSource()?.length;
         setFieldsValue({
         setFieldsValue({
           addeduser: total || 0,
           addeduser: total || 0,
         });
         });
-        // modelRef.subNum = total
+        createMessage.success(t('layout.setting.operatingTitle'));
       }
       }
       return {
       return {
         register,
         register,

+ 15 - 9
src/views/staff/list.vue

@@ -10,7 +10,10 @@
         >
         >
       </template>
       </template>
       <template #headerTop v-if="getCheckRole([RoleEnum.COMPANY_ADMIN])">
       <template #headerTop v-if="getCheckRole([RoleEnum.COMPANY_ADMIN])">
-        <Alert :message="`可添加员工数为${surplusSubNum}人`" type="info" />
+        <Alert
+          :message="`可新增带看员工为 ${surplusSubNum.lookNum} 个、拍摄员工为 ${surplusSubNum.shotNum} 个`"
+          type="info"
+        />
       </template>
       </template>
       <template #role="{ record }">
       <template #role="{ record }">
         {{ renderRoleType(record.role) }}
         {{ renderRoleType(record.role) }}
@@ -81,7 +84,10 @@
     },
     },
     setup() {
     setup() {
       const [register, { openModal }] = useModal();
       const [register, { openModal }] = useModal();
-      const surplusSubNum = ref(0);
+      const surplusSubNum = ref({
+        lookNum: 0,
+        shotNum: 0,
+      });
       const [registerDetail, { openModal: openDetaileModal }] = useModal();
       const [registerDetail, { openModal: openDetaileModal }] = useModal();
       const [registerDelList, { openModal: openDelListeModal }] = useModal();
       const [registerDelList, { openModal: openDelListeModal }] = useModal();
       const { createConfirm, createMessage } = useMessage();
       const { createConfirm, createMessage } = useMessage();
@@ -218,7 +224,11 @@
         openModal(true, record);
         openModal(true, record);
       }
       }
       function handleCreate() {
       function handleCreate() {
-        if (getCheckRole([RoleEnum.COMPANY_ADMIN]) && surplusSubNum.value == 0) {
+        if (
+          getCheckRole([RoleEnum.COMPANY_ADMIN]) &&
+          surplusSubNum.value.lookNum == 0 &&
+          surplusSubNum.value.shotNum == 0
+        ) {
           return createMessage.error('新增失败,可添加员工数量为0个');
           return createMessage.error('新增失败,可添加员工数量为0个');
         }
         }
         openDetaileModal(true, {});
         openDetaileModal(true, {});
@@ -228,12 +238,8 @@
       }
       }
       function getNumByStaffData() {
       function getNumByStaffData() {
         getNumByStaff({}).then((res) => {
         getNumByStaff({}).then((res) => {
-          let { totalSubNum = 0 } = res;
-          try {
-            surplusSubNum.value = res.subNum - totalSubNum;
-          } catch (error) {
-            surplusSubNum.value = 0;
-          }
+          surplusSubNum.value.lookNum = res.lookNum;
+          surplusSubNum.value.shotNum = res.shotNum;
         });
         });
       }
       }
       async function handleDelete(record) {
       async function handleDelete(record) {