浏览代码

Merge branch 'v2.0' into debug

yujinwen 2 月之前
父节点
当前提交
19d816eeb7

+ 1 - 0
src/views/AutoLogin.vue

@@ -27,6 +27,7 @@ function init(){
         if(res.Ret===200){
             sessionStorage.setItem('token',res.Data.Authorization)
             sessionStorage.setItem('userInfo',JSON.stringify(res.Data))
+            sessionStorage.setItem('Role',res.Data.RoleTypeCode)
             handleNavigation()
         }
     })

+ 109 - 2
src/views/business_manage/addBusiness.vue

@@ -96,7 +96,7 @@
         </div>
       </template>
       <template v-if="currentStep === 2">
-        <div class="second-step-form-wrap">
+        <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">
@@ -109,6 +109,24 @@
             </div>
           </t-form>
         </div>
+        <div class="second-step-form-wrap" v-else>
+          <t-button theme="primary" type="submit"
+            style="margin: 20px;"
+            @click="handleShowRenewal()">添加续约</t-button>
+            <t-table
+            :columns="tableColOpts"
+            :data="recordData"
+            row-key="EtaBusinessContractId"
+            :bordered="true"
+            :table-layout="'auto'"
+          >
+            <template #opt="{row}">
+              <t-button variant="text" theme="primary" size="small" @click="editRenewal(row)">编辑</t-button>
+              <t-button variant="text" theme="primary" size="small" class="color-hint" 
+                @click="deleteRenewal(row)">删除</t-button>
+            </template>
+          </t-table>
+        </div>
       </template>
       <template v-if="currentStep === 3">
         <div class="second-step-form-wrap tree">
@@ -139,6 +157,15 @@
     <template v-if="currentRoute === 'businessDetail' || currentRoute === 'editBusiness'">
       <EditBox :EtaBusinessId="businessId" :currentRoute="currentRoute" @editEtaBusiness="editEtaBusiness" />
     </template>
+    <!-- 添加续约 -->
+    <t-dialog
+      :header="renewalDiaTitle"
+      :visible.sync="showRenewal"
+      :footer="false"
+      @close="showRenewal = false"
+    >
+      <AddRenewal @addRenewal="handleAddRenewal" @close="showRenewal = false" :renewalForm="modifyData" />
+    </t-dialog>
   </div>
 </template>
 <script setup>
@@ -149,6 +176,7 @@ import EditBox from "./components/EditBox.vue";
 import { customInterence, roadshowInterence, businessCustomInterence } from '@/api/api.js';
 import { locationOptions } from '@/utils/location';
 import countryData from "@/utils/countryData";
+import AddRenewal from './components/AddRenewal.vue';
 import { useRoute, useRouter } from 'vue-router'
 
 const router = useRouter()
@@ -170,6 +198,11 @@ const PermissionList = ref([]);
 const allCheckedList = ref([]);
 const handleEtaBusinessId = ref(0);
 const isPermissionSearch = ref(false);
+
+// 编辑商家
+const renewalDiaTitle = ref('添加续约');
+const modifyData = ref(null);
+const showRenewal = ref(false);
 const firstFormData = reactive({
   areaType: '国内',
   name: '',
@@ -213,6 +246,25 @@ const teamSizeOpts = reactive([
     label: '超过200人'
   }
 ])
+const tableColOpts = ref([
+  {
+    colKey:'SigningTime',
+    title:'运维时间',
+    align: 'center'
+  },{
+    colKey:'ExpiredTime',
+    title:'到期时间',
+    align: 'center'
+  },{
+    colKey:'ExpireDay',
+    title:'到期天数',
+    align: 'center'
+  },
+  {
+    align: 'center', colKey: 'opt', title: '操作'
+  }
+])
+
 const tradeArr = ref([]); // 需要在getIndustry方法中赋值
 const salesArr = ref([]); // 需要在getSale方法中赋值
 const rules = {
@@ -483,7 +535,8 @@ const changeActiveStep = (index) => {
 // 编辑
 const editEtaBusiness = async () => {
   const {creditCode, province, city, decisionMaker,industry,nation,teamSize} = firstFormData;
-  console.log('editEtaBusiness', firstFormData);
+  const {signDate,expirationDate} = secondFormData;
+  console.log('editEtaBusiness', secondFormData);
   
   const IndustryName = tradeArr.value.find(item => item.IndustryId === industry)?.IndustryName || '';
   const query = {
@@ -496,12 +549,66 @@ const editEtaBusiness = async () => {
     IndustryId:Number(industry),
     Province:province,
     City:city,
+    SigningTime: signDate || '',
+    ExpiredTime: expirationDate || '',
   }
   const res = await businessCustomInterence.editBusiness(query);
   if (res.Ret !== 200) return;
   handleAddBusiness('edit')
 }
 
+// 编辑签约信息
+const handleShowRenewal = (data) => {
+  showRenewal.value = true;
+};
+
+// 删除续约
+const deleteRenewal = async (row) => {
+  try {
+    const confirmResult = await confirm('是否确认删除该签约信息?', '提示', {
+      confirmButtonText: '确认',
+      cancelButtonText: '取消',
+      type: 'warning',
+    });
+    if (confirmResult) {
+      const res = await businessCustomInterence.removeContract({ EtaBusinessContractId: row.EtaBusinessContractId });
+      if (res.Ret === 200) {
+        MessagePlugin.success("删除成功");
+        await getTableData();
+        await getTimeLineData();
+      }
+    }
+  } catch (error) {
+    console.error('删除续约失败:', error);
+  }
+};
+
+// 编辑续约
+const editRenewal = (row) => {
+  renewalDiaTitle.value = "编辑续约";
+  console.log('editRenewal', row);
+  
+  modifyData.value = {
+    id: row.EtaBusinessContractId,
+    signDate: row.SigningTime,
+    expirationDate: row.ExpiredTime
+  };
+  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()
+  })
+};
 </script>
 <style lang="scss" scoped>
 .add-business-box {

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

@@ -58,7 +58,7 @@ const validateRef = ref(null);
 watch(
   () => props.renewalForm,
   (newValue) => {
-    if (newValue.id) {
+    if (newValue && newValue.id) {
       ruleForm.value.id = newValue.id || 0;
       ruleForm.value.signDate = newValue.signDate || '';
       ruleForm.value.expirationDate = newValue.expirationDate || '';

+ 1 - 1
src/views/customer/user/components/ConfirmImportUser.vue

@@ -53,7 +53,7 @@ async function handleSave(){
         <span>{{row.CountryCode}}-{{row.Mobile}}</span>
       </template>
       <template #DepartmentName="{ row }">
-        <span>{{row.Position}}-{{row.DepartmentName}}</span>
+        <span>{{row.Position}}{{row.Position&&row.DepartmentName?' - ':''}}{{row.DepartmentName}}</span>
       </template>
       <template #PositionStatus="{ row }">
         <t-tag 

+ 4 - 4
src/views/etaTrial/addApproval.vue

@@ -34,11 +34,11 @@
         </div>
       </template>
       <!-- 操作 -->
-      <template #opt="{ row, index }">
+      <template #opt="row">
         <t-button variant="text" theme="primary" size="small" @click="addTableData">添加</t-button>
           <t-button variant="text" theme="primary" size="small" class="color-hint" 
-            @click="deleteTableData($index)"
-            v-if="(tableData.length>1&&!row.isApply)">删除</t-button>
+            @click="deleteTableData(row)"
+            v-if="(tableData.length>1&&!row.row.isApply)">删除</t-button>
       </template>
     </t-table>
     <div class="btn-wrap">
@@ -100,7 +100,7 @@ function addTableData() {
 }
 
 function deleteTableData(index) {
-  tableData.value.splice(index, 1);
+  tableData.value.splice(index.rowIndex, 1);
 }
 
 function tableRowClassName({ row }) {

+ 1 - 1
src/views/etaTrial/etaTrialList.vue

@@ -198,7 +198,7 @@ const moveInfo = reactive({
 const selectedRowKeys = ref([1]);
 
 // 计算属性
-const Role = computed(() => localStorage.getItem('Role'));
+const Role = computed(() => sessionStorage.getItem('Role'));
 const selectedTotal = computed(() => {
   if (isSelectAll.value) {
     return total.value - selectList.value.length;