Browse Source

Merge branch 'v2.0' into debug

yujinwen 2 months ago
parent
commit
0f98304875

+ 1 - 1
src/views/AutoLogin.vue

@@ -11,7 +11,7 @@ async function handleNavigation(){
     if(res.Ret!==200) return
     const arr=res.Data.List||[]
     if(arr.length===0){
-        MessagePlugin.waring('无任何菜单权限,请联系管理员')
+        MessagePlugin.warning('无任何菜单权限,请联系管理员')
         return
     }
     const path=arr[0].children[0].path

+ 31 - 22
src/views/business_manage/addBusiness.vue

@@ -87,7 +87,7 @@
             </div>
             <div class="form-line">
               <t-form-item label="所属销售" name="saller">
-                <t-cascader :disabled="currentRoute === 'businessDetail'" v-model:modelValue="firstFormData.saller"
+                <t-cascader :disabled="currentRoute !== 'addBusiness'" v-model:modelValue="firstFormData.saller"
                   :options="salesArr" :show-all-levels="false" :keys="cascaderProps" filterable @change="changeSaller"
                   clearable placeholder="请选择销售" />
               </t-form-item>
@@ -96,15 +96,15 @@
         </div>
       </template>
       <template v-if="currentStep === 2">
-        <div class="second-step-form-wrap" v-if="currentRoute !== 'editBusiness'"">
+        <div class="second-step-form-wrap" v-if="currentRoute !== 'editBusiness'">
           <t-form :data="secondFormData" :rules="rules" ref="formRef" label-width="120px" inline
             class="second-step-form">
             <div class="form-line">
               <t-form-item label="签约日期" name="signDate">
-                <t-date-picker v-model="secondFormData.signDate" placeholder="选择日期" />
+                <t-date-picker :disabled="currentRoute === 'businessDetail'" v-model="secondFormData.signDate" placeholder="选择日期" />
               </t-form-item>
               <t-form-item label="到期日期" name="expirationDate">
-                <t-date-picker v-model="secondFormData.expirationDate" placeholder="选择日期" />
+                <t-date-picker :disabled="currentRoute === 'businessDetail'" v-model="secondFormData.expirationDate" placeholder="选择日期" />
               </t-form-item>
             </div>
           </t-form>
@@ -169,7 +169,7 @@
   </div>
 </template>
 <script setup>
-import { ref, reactive, onMounted, useTemplateRef } from 'vue';
+import { ref, reactive, onMounted, useTemplateRef, nextTick } from 'vue';
 import Steps from "./components/Steps.vue";
 import SetPermission from "./components/SetPermission.vue";
 import EditBox from "./components/EditBox.vue";
@@ -198,6 +198,7 @@ const PermissionList = ref([]);
 const allCheckedList = ref([]);
 const handleEtaBusinessId = ref(0);
 const isPermissionSearch = ref(false);
+const permissionCheckeds = ref([])
 
 // 编辑商家
 const renewalDiaTitle = ref('添加续约');
@@ -529,21 +530,28 @@ const getSale = async () => {
 };
 
 const changeActiveStep = (index) => {
+  if (index !== 2 && permissionRef.value) {
+    permissionCheckeds.value = permissionRef.value && permissionRef.value.actuallyAllChecked
+  }
   currentStep.value = index + 1
+  nextTick(() => {
+    if (index === 2 && permissionRef.value && permissionCheckeds.value.length !== 0 ) {
+      permissionRef.value.actuallyAllChecked = permissionCheckeds.value || []
+    }
+  })
 }
 
 // 编辑
 const editEtaBusiness = async () => {
-  const {creditCode, province, city, decisionMaker,industry,nation,teamSize} = firstFormData;
+  const {fundsize, province, city, decisionMaker,industry,nation,teamSize} = firstFormData;
   const {signDate,expirationDate} = secondFormData;
-  console.log('editEtaBusiness', secondFormData);
   
   const IndustryName = tradeArr.value.find(item => item.IndustryId === industry)?.IndustryName || '';
   const query = {
     EtaBusinessId: businessId.value,
     Leader: decisionMaker,
     IndustryName,
-    CapitalScale:creditCode||'',
+    CapitalScale:fundsize||'',
     ResearchTeamSize: teamSize||'',
     Nation: nation,
     IndustryId:Number(industry),
@@ -559,6 +567,7 @@ const editEtaBusiness = async () => {
 
 // 编辑签约信息
 const handleShowRenewal = (data) => {
+  renewalDiaTitle.value = "添加续约";
   showRenewal.value = true;
 };
 
@@ -586,8 +595,7 @@ const deleteRenewal = async (row) => {
 // 编辑续约
 const editRenewal = (row) => {
   renewalDiaTitle.value = "编辑续约";
-  console.log('editRenewal', row);
-  
+
   modifyData.value = {
     id: row.EtaBusinessContractId,
     signDate: row.SigningTime,
@@ -596,18 +604,19 @@ const editRenewal = (row) => {
   showRenewal.value = true;
 };
 
-const handleAddRenewal = ({ signDate, expirationDate }) => {
-  // 处理添加续约逻辑
-  businessCustomInterence.addNewContract({
-      EtaBusinessId: businessId.value,
-      SigningTime: signDate,
-      ExpiredTime: expirationDate
-  }).then(res=>{
-      if(res.Ret!==200) return 
-      MessagePlugin.success('添加续约成功')
-      showRenewal.value = false
-      getTableData()
-  })
+const handleAddRenewal = async ({ signDate, expirationDate, id }) => {
+  // 处理续约逻辑
+  const params = {
+    EtaBusinessContractId: id || 0,
+    EtaBusinessId: businessId.value,
+    SigningTime: signDate,
+    ExpiredTime: expirationDate
+  }
+  const res = renewalDiaTitle.value === '编辑续约' ? await businessCustomInterence.editContract(params) : await businessCustomInterence.addNewContract(params);
+  if(res.Ret!==200) return 
+  MessagePlugin.success(renewalDiaTitle.value === '编辑续约' ? '编辑续约成功' : '添加续约成功')
+  showRenewal.value = false
+  getTableData()
 };
 </script>
 <style lang="scss" scoped>

+ 1 - 2
src/views/business_manage/components/AddRenewal.vue

@@ -80,9 +80,8 @@ const handleSave = async () => {
 };
 
 const initForm = () => {
-  ruleForm.value = { id: 0, signDate: '', expirationDate: '' };
   nextTick(() => {
-    // validateRef.value.resetFields(); // 重置表单验证状态
+    validateRef.value?.reset({ fields: ['signDate', 'expirationDate'] }); // 重置表单验证状态
   });
 };
 

+ 7 - 1
src/views/business_manage/components/ModifySaller.vue

@@ -74,6 +74,12 @@ const changeSaller = (value, {node}) => {
   }
 };
 
+const filterSales = (value, option) => {
+  console.log('filterSales', value, option);
+  
+  // return option.label.includes(value);
+};
+
 const handleSave = async () => {
   const valid = await ruleFormRef.value.validate()
   if (valid !== true) return
@@ -89,7 +95,7 @@ const handleSave = async () => {
 
 const initForm = () => {
   ruleForm.saller = '';
-//   ruleFormRef.value.resetFields();
+  ruleFormRef.value?.reset({ fields: ['saller'] }); // 重置表单验证状态
 };
 
 const handleClose = () => {

+ 61 - 5
src/views/business_manage/components/SetPermission.vue

@@ -33,6 +33,9 @@
 <script setup>
 import { ref, watch, nextTick } from 'vue';
 import { SearchIcon } from 'tdesign-icons-vue-next';
+import { useRoute } from 'vue-router'
+
+const route = useRoute()
 const props = defineProps({
   isShowFoot: {
     type: Boolean,
@@ -78,12 +81,58 @@ const treeKeys = reactive({
     label: 'ChartClassifyName',
 });
 
+// 用于存储ChartClassifyId到节点引用的映射
+const nodeMap = new Map();
+// 构建nodeIdMap的函数
+const buildNodeMap = (arr) => {
+  arr.forEach(node => {
+    nodeMap.set(node.ChartClassifyId, node);
+    if (node.Children && node.Children.length) {
+      buildNodeMap(node.Children);
+    }
+  });
+};
+const filterNodes = (arr) => {
+  // 构建nodeIdMap
+  buildNodeMap(arr);
+  // 遍历数组并处理节点的函数
+  const processNodes = (nodes) => {
+    nodes.forEach(node => {
+      // 检查当前节点的ChartClassifyId是否在allCheckedList中
+      if (props.allCheckedList.includes(node.ChartClassifyId)) {
+        // 标记当前节点为expanded
+        node.expanded = true;
+
+        // 标记所有父节点为expanded
+        let parentId = node.ParentId;
+        while (parentId) {
+          const parentNode = nodeMap.get(parentId);
+          if (parentNode) {
+            parentNode.expanded = true;
+          }
+          parentId = parentNode ? parentNode.ParentId : null; // 更新parentId为当前父节点的父节点ID
+        }
+      }
+
+      // 如果当前节点有子节点,则递归处理子节点
+      if (node.Children && node.Children.length) {
+        processNodes(node.Children);
+      }
+    });
+  };
+  // 调用函数
+  processNodes(arr);
+  return arr;
+};
+
 // 监听renewalForm的变化
 watch(
   () => props.PermissionList,
   (newValue) => {
-    treeList.value = newValue;
-    if (!props.isSearch) {                           // 如果不是搜索,则直接把后端返回的赋值为选中项
+    console.log('newValue', newValue);
+    treeList.value = newValue.length !== 0 ? filterNodes(newValue) : [];
+    
+    if (!props.isSearch && newValue.length > 0) {                           // 如果不是搜索,则直接把后端返回的赋值为选中项
       allChecked.value = props.allCheckedList;
       actuallyAllChecked.value = props.allCheckedList;
     } else {                                         // 如果是搜索,则把本地选中项赋值为实际上选中的值
@@ -92,10 +141,14 @@ watch(
   },
   { immediate: true }
 );
+
+
+
+
 watch(
   () => props.currentStep,
   (newValue) => {
-    if (newValue === 3) {
+    if (newValue === 3 && route.name !== 'addBusiness') {
       emit('getSearch', searchTxt.value);
     }
   },
@@ -114,7 +167,10 @@ watch(
 
 // tree相关
 const onChange = (checked, context) => {
-  // console.info('onChange checked:', checked, 'context:', context);
+  // console.info('context:', );
+  // tree.value.setItem('12', {
+  //   expanded: true,
+  // })
   const { node } = context;
   if (node.checked) {
     if (node.data.Children.length) {                    // 如果当前节点有子节点,则把所有子节点的id都加上去  
@@ -123,7 +179,7 @@ const onChange = (checked, context) => {
     } else {                                            // 如果当前节点有子节点,则直接加上该节点的id
       actuallyAllChecked.value = [...new Set([...actuallyAllChecked.value, node.value])];                                                  
     }
-  } else {    
+  } else {
     if (node.data.Children.length) {                    // 如果当前节点有子节点,则直接去掉该节点和子节点的所有id 
       const temp = [...getAllChildIds(node.data.Children), node.value];
       allChecked.value = removeChildren(allChecked.value, temp);

+ 65 - 104
src/views/etaTrial/etaTrialList.vue

@@ -38,7 +38,7 @@
             <div class="tips">*账号用于登录ETA试用平台:https://exptest.hzinsights.com/</div>
             <div class="right-header">
               <span>已选{{ selectedTotal }}</span>
-              <t-checkbox :indeterminate="isIndeterminate" v-model="isCheckAll" @change="listCheckAllChange" style="margin-left: 40px;">列表全选</t-checkbox>
+              <t-checkbox :indeterminate="indeterminate" v-model="checkAll" @change="handleClickCheckAll" style="margin-left: 40px;">列表全选</t-checkbox>
             </div>
           </template>
         </template>
@@ -59,8 +59,17 @@
       </div>
     </div>
     <div class="table-wrap">
-      <t-table :data="tableData" @sort-change="sortChangeHandle" :selected-row-keys="selectedRowKeys"
-      @select-change="selectionChange" :columns="columnList" ref="dataRef" :bordered="true" :table-layout="'auto'" rowKey="EtaTrialId" v-loading="tableLoading" @select="selectHandles" @select-all="selectAllHandle">
+      <t-table
+      :data="tableData"
+      v-model:selectedRowKeys="selectedRowKeys"
+      @sort-change="tableSelectChange"
+      @select-change="tableSelectChange"
+      :columns="columnList"
+      ref="dataRef"
+      :bordered="true"
+      :table-layout="'auto'"
+      row-key="EtaTrialId"
+      v-loading="tableLoading">
         <!-- <template #approveType="{ row }">
           <span >
             {{ row['approveType'] === 0 ? '申请账号' : '申请启用' }}
@@ -183,10 +192,8 @@ const total = ref(1);
 const isApplyApprovalDialogShow = ref(false);
 const isAddApplyHintShow = ref(false);
 const showDetailDialogShow = ref(false);
-const isIndeterminate = ref(false);
-const isCheckAll = ref(false);
-const isSelectAll = ref(false);
-const selectList = ref([]);
+const indeterminate = ref(false);
+const checkAll = ref(false);
 const choiceIdList = ref([]);
 const tableDataIds = ref([]);
 const isMoveShow = ref(false);
@@ -195,15 +202,17 @@ const moveInfo = reactive({
   salesArr: [], // 销售列表
   selectArr: [], // 已选择的id
 });
-const selectedRowKeys = ref([1]);
+const selectedRowKeys = ref([]);
+const AlltableData = ref([]);
+const cancelKeys = ref([]);
 
 // 计算属性
 const Role = computed(() => sessionStorage.getItem('Role'));
 const selectedTotal = computed(() => {
-  if (isSelectAll.value) {
-    return total.value - selectList.value.length;
+  if (checkAll.value) {
+    return total.value - cancelKeys.value.length;
   } else {
-    return selectList.value.length;
+    return selectedRowKeys.value.length;
   }
 });
 
@@ -260,20 +269,18 @@ const getTableData = async (type) => {
   });
   if (res.Ret !== 200) return;
   const { List, Paging, ApprovalNum } = res.Data;
+  AlltableData.value = [...List, ...AlltableData.value]
   tableData.value = List || [];
   total.value = Paging.Totals;
   approvalNum.value = ApprovalNum || 0;
   tableLoading.value = false;
-  if (tableData.value.length > 0) {
-    tableDataIds.value = tableData.value.map(it => it.EtaTrialId);
-  } else {
-    tableDataIds.value = [];
-  }
-  if (type === 'search') {
-    selectList.value = [];
-    listCheckAllChange(false);
-  } else {
-    adjustSelection();
+  if(checkAll.value){
+    //全选了去除之前记录被手动取消勾选的项
+    tableData.value.forEach(item=>{
+      if(!selectedRowKeys.value.includes(item.EtaTrialId)&&!cancelSelectRowKeys.includes(item.EtaTrialId)){
+        selectedRowKeys.value.push(item.EtaTrialId)
+      }
+    })
   }
 };
 
@@ -316,90 +323,43 @@ const handleCurrentChange = (pageNo) => {
   getTableData();
 };
 
-const adjustSelection = () => {
-  if (!isSelectAll.value) {
-    tableData.value.forEach(it => {
-      if (selectList.value.includes(it.EtaTrialId)) {
-        // toggleRowSelection(it, true);
-      }
-    });
-  } else {
-    tableData.value.forEach(it => {
-      if (!selectList.value.includes(it.EtaTrialId)) {
-        // toggleRowSelection(it, true);
-      }
-    });
-  }
-};
-
-const listCheckAllChange = (value) => {
-  selectList.value = [];
-  isSelectAll.value = value;
-  // clearSelection();
-  if (value) {
-    // toggleAllSelection();
-  }
-};
-
-const selectionChange = (selection) => {
-  setTimeout(() => {
-    const duplicateArr = Array.from(new Set(selectList.value));
-    if ((duplicateArr.length === total.value && !isSelectAll.value) || (duplicateArr.length === 0 && isSelectAll.value)) {
-      isCheckAll.value = true;
-      isIndeterminate.value = false;
-    } else if ((duplicateArr.length === 0 && !isSelectAll.value) || (duplicateArr.length === total.value && isSelectAll.value)) {
-      isCheckAll.value = false;
-      isIndeterminate.value = false;
-    } else {
-      isCheckAll.value = false;
-      isIndeterminate.value = true;
-    }
-  }, 1);
-};
-
-const selectHandles = (selection, row) => {
-  let check = false;
-  if (selection.some(it => it.EtaTrialId === row.EtaTrialId)) {
-    if (isSelectAll.value) {
-      check = false;
+let cancelSelectRowKeys=[]//取消选择的keys
+function tableSelectChange(value, ctx) {
+  
+  if (ctx.type === 'uncheck') {
+    if (ctx.currentRowKey === 'CHECK_ALL_BOX') {
+      tableData.value.forEach(i => cancelSelectRowKeys.push(i.EtaTrialId));
     } else {
-      check = true;
+      cancelSelectRowKeys.push(ctx.currentRowKey);
     }
-  } else {
-    if (isSelectAll.value) {
-      check = true;
+    indeterminate.value = selectedRowKeys.value.length > 0;
+    checkAll.value = selectedRowKeys.value.length === 0 ? false : checkAll.value;
+  } else if (ctx.type === 'check') {
+    indeterminate.value = true;
+    if (selectedRowKeys.value.length === total.value) {
+      checkAll.value = true;
+      indeterminate.value = false;
+      cancelSelectRowKeys = [];
     } else {
-      check = false;
+      cancelSelectRowKeys = cancelSelectRowKeys.filter(i => selectedRowKeys.value.includes(i));
     }
   }
-  if (check) {
-    selectList.value.push(row.EtaTrialId);
-  } else {
-    selectList.value = selectList.value.filter(it => it !== row.EtaTrialId);
-  }
-};
+  cancelKeys.value = cancelSelectRowKeys
+}
 
-const selectAllHandle = (selection) => {
-  let check = false;
-  if (selection && selection.length > 0) {
-    if (isSelectAll.value) {
-      check = false;
-    } else {
-      check = true;
-    }
-  } else {
-    if (isSelectAll.value) {
-      check = true;
-    } else {
-      check = false;
-    }
-  }
-  if (check) {
-    selectList.value = [...selectList.value, ...tableDataIds.value];
-  } else {
-    selectList.value = selectList.value.filter(it => !tableDataIds.value.includes(it));
+function handleClickCheckAll(check) {
+  if(!check&&indeterminate.value){
+    selectedRowKeys.value=[...selectedRowKeys.value,...cancelSelectRowKeys]
+    cancelSelectRowKeys=[]
+    indeterminate.value = false;
+    checkAll.value=true
+    return
   }
-};
+  indeterminate.value = false;
+  selectedRowKeys.value = check ? tableData.value.map(item => item.EtaTrialId) : [];
+  cancelSelectRowKeys = [];
+  cancelKeys.value = cancelSelectRowKeys
+}
 
 const getApplyInfo = (type, data) => {
   const temp = { applyType: 1, applyData: [] };
@@ -482,7 +442,7 @@ const moveConfirm = (data) => {
   const params = {
     currentSellerId,
     EtaTrialIdList: selectArr,
-    IsCheckAll: type === 1 ? false : isSelectAll.value,
+    IsCheckAll: type === 1 ? false : checkAll.value,
     CurrentSellerName: findElementByAdminId(moveInfo.salesArr, currentSellerId).RealName,
   };
   etaTrialInterence.accountTransfer(params).then(res => {
@@ -520,23 +480,24 @@ const Move = (row) => {
 };
 
 const batchMove = () => {
-  if (selectList.value.length === 0) {
+  if (selectedRowKeys.value.length === 0) {
     MessagePlugin.warning('请至少选择一个客户');
     return;
   }
   moveInfo.type = 2;
-  moveInfo.selectArr = selectList.value;
+  moveInfo.selectArr = selectedRowKeys.value;
   isMoveShow.value = true;
 };
 
 const batchOperate = async () => {
-  if (getMobileList(tableData.value, selectList.value).length === 0) {
+
+  if ([...new Set(getMobileList(AlltableData.value, selectedRowKeys.value))].length === 0) {
     MessagePlugin.warning('请至少选择一个客户');
     return;
   }
   const res = await etaTrialInterence.applyEnable({
-    MobileList: getMobileList(tableData.value, selectList.value),
-    IsCheckAll: isSelectAll.value,
+    MobileList: [...new Set(getMobileList(AlltableData.value, checkAll.value ? cancelSelectRowKeys : selectedRowKeys.value))],
+    IsCheckAll: checkAll.value,
   });
   if (res.Ret !== 200) return;
   getTableData();

+ 1 - 1
src/views/training/modifyVideoPage.vue

@@ -39,7 +39,7 @@
             <t-form-item label="上传视频" name="VideoUrl">
               <div style="display: block;">
                   <t-upload accept=".mp4" 
-                      :request-method="handleUploadVideo" :show-file-list="false" :disabled="isVideoUploading">
+                      :request-method="handleUploadVideo" theme="custom" :show-file-list="false" :disabled="isVideoUploading">
                       <t-button theme="primary" :loading="isVideoUploading">点击上传</t-button>
                       <span style="color:#999999;margin-left: 5px;" @click.stop>仅支持mp4格式</span>
                   </t-upload>