瀏覽代碼

Merge branch 'master' of http://47.100.37.243:10191/wutt/manHourHousekeeper

Min 1 年之前
父節點
當前提交
639131c553

+ 18 - 8
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/business/component/stageSetting.vue

@@ -6,7 +6,7 @@
                     <h4 :id="titleId">阶段设置</h4>
                     <div>
                         <el-button type="primary" @click="addStage(false)">新增</el-button>
-                        <el-button type="primary" @click="saveState()" v-loading="allLoading.saveLoading">保存</el-button>
+                        <el-button type="primary" @click="saveState()" :loading="allLoading.saveLoading">保存</el-button>
                         <el-button @click="cancel()">取消</el-button>
                     </div>
                 </div>
@@ -139,7 +139,7 @@ function editState(flag: boolean) {
         globalPopup?.showWarning('请输入阶段名称')
         return
     }
-    const listIndex = stageTableList.value.findIndex((item: stageFormType) => item.name == stageForm.name)
+    const listIndex = stageTableList.value.findIndex((item: stageFormType) => item.seq == stageForm.seq)
     const newStage = {
         ...stageForm,
         plan: stageForm.plan,
@@ -158,14 +158,19 @@ function editState(flag: boolean) {
 
 function addStage(item: any) {
     const row = JSON.parse(JSON.stringify(item))
+    console.log(item)
     if (!item) {
         resetStage()
     } else {
-        Object.assign(stageForm, {
+        let newData: any = {
             name: row.name,
             plan: row.plan,
-            seq: row.seq
-        })
+            seq: row.seq,
+            ...(row.id && { id: row.id }),
+            ...(row.companyId && { companyId: row.companyId }),
+            ...(row.isFinish && { isFinish: row.isFinish })
+        }
+        Object.assign(stageForm, newData)
     }
     allVisible.editVisible = true
 }
@@ -173,11 +178,16 @@ function addStage(item: any) {
 function resetStage() {
     let newData = JSON.parse(JSON.stringify(stageTableList.value))
     let maxnum = newData.sort((a: any, b: any) => { return b.seq - a.seq; })[0];
-    Object.assign(stageForm, {
+    console.log(maxnum)
+    let formVal = {
         name: '',
         plan: 0,
-        seq: +maxnum + 1
-    })
+        seq: +maxnum.seq + 1
+    }
+    delete stageForm.id
+    delete stageForm.isFinish
+    Object.assign(stageForm, formVal);
+    console.log(stageForm, '<=== 新增的数据', formVal)
 }
 
 function moveStage(index: number, stageType: moveStageType) {

+ 27 - 10
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/business/index.vue

@@ -47,7 +47,7 @@
     <div class="flex-1 p-5 overflow-auto">
       <div class="bg-white w-full h-full p-3 shadow-md rounded-md flex flex-col">
         <div class="flex justify-end pb-3">
-          <el-button type="primary" @click="showVisible('newBusinessisible')">新建商机</el-button>
+          <el-button type="primary" @click="editNewBusiness(false)">新建商机</el-button>
           <el-button type="primary" @click="showVisible('batchTransferVisible')"
             :disabled="batchTableData.length <= 0">批量转移</el-button>
           <el-button type="primary" @click="batchDeteleItem()" :disabled="batchTableData.length <= 0">批量删除</el-button>
@@ -69,7 +69,7 @@
             <el-table-column label="操作" fixed="right" width="200">
               <template #default="scope">
                 <el-button link type="primary" size="large"
-                  @click="editShowVisible('newBusinessisible', scope.row)">编辑</el-button>
+                  @click="editNewBusiness(scope.row)">编辑</el-button>
                 <el-button link type="primary" size="large" @click="newTask(scope.row)">新建任务</el-button>
                 <el-button link type="danger" size="large"
                   @click="businessDeteleItem(scope.row.id, scope.row.name)">删除</el-button>
@@ -98,8 +98,8 @@
           </div>
         </div>
       </template>
-      <div class="h-[60vh] overflow-y-auto scroll-bar pt-3">
-        <GenerateForm ref="generateForm" :data="generateFormData" />
+      <div class="h-[60vh] overflow-y-auto scroll-bar pt-3" v-loading="allLoading.generateFormLading">
+        <GenerateForm ref="businessTemplateRef" :data="businessTemplate" :value="businessTemplateValue" :key="businessTemplateKey" />
         <div>相关产品</div>
         <RelatedProducts ref="relatedProductsRef" :productTableList="productTableList" />
       </div>
@@ -182,9 +182,11 @@ const router = useRouter()
 const globalPopup = inject<GlobalPopup>('globalPopup')
 const businessTableRef = ref<InstanceType<typeof ElTable>>() // 商机table dom
 const businessTotalTable = ref(0)
-const generateForm = ref<typeof GenerateForm>() // 自定义表单dom
+const businessTemplateRef = ref<typeof GenerateForm>() // 自定义表单dom
 const relatedProductsRef = ref<typeof RelatedProducts>()
-const generateFormData = ref({
+const businessTemplateValue = ref({})
+const businessTemplateKey = ref(1)
+const businessTemplate = ref({
   config: {},
   list: []
 }) // 自定义表单数据
@@ -196,6 +198,7 @@ const allLoading = reactive({
   transferLoading: false,
   importLoading: false,
   exoprtLoading: false,
+  generateFormLading: false
 })
 const allVisible = reactive({
   newBusinessisible: false,
@@ -236,7 +239,7 @@ const productTableList = ref([])
 
 
 function editBusiness(visibles: boolean) {
-  generateForm.value?.getData().then((res: any) => {
+  businessTemplateRef.value?.getData().then((res: any) => {
     let productTableListData = relatedProductsRef?.value?.returnData()
     let newForm = {
       ...res,
@@ -257,9 +260,23 @@ function editBusiness(visibles: boolean) {
   })
 }
 
-function editShowVisible(type: keyof typeof allVisible, item: any) {
+function editNewBusiness(item: any) {
   console.log(item, '选择数据')
-  showVisible(type)
+  showVisible('newBusinessisible')
+  allLoading.generateFormLading = true
+  if (item) {
+    businessTemplateValue.value = item
+    allText.newBusinessisibleText = '编辑商机'
+  }
+  if (!item) {
+    businessTemplateValue.value = {}
+    allText.newBusinessisibleText = '新建产品'
+  }
+  setTimeout(() => {
+    businessTemplateRef.value && businessTemplateRef.value.reset()
+    businessTemplateKey.value++
+    allLoading.generateFormLading = false
+  }, 500)
 }
 
 function newTask(item: any) {
@@ -419,7 +436,7 @@ async function getSystemField() {
   })
 
   const res = await get(GETGENERATEFOEM)
-  generateFormData.value = JSON.parse(res.data[0].config)
+  businessTemplate.value = JSON.parse(res.data[0].config)
 }
 
 function toBusinessTableDetail(row: any) {

+ 1 - 0
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/product/index.vue

@@ -250,6 +250,7 @@ function editProduct(item: any) {
   }
   if (!item) {
     genereditForm.value = {}
+    allText.editClueText = '新建产品'
   }
   setTimeout(() => {
     generateForm.value && generateForm.value.reset()