Lijy hace 5 meses
padre
commit
3453cb99ac

+ 44 - 27
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/components/common/pullDownSelector.vue

@@ -5,47 +5,53 @@
         @update:model-value="debouncedSearchOptions" />
     </div>
     <div class="flex-1 my-2 overflow-y-auto">
-      <!-- 加载 -->
-      <template v-if="listLoading">
-        <van-skeleton :row="10" />
+      <template v-if="renderingOptions.length == 1 && renderingOptions[0] && !renderingOptions[0].label">
+        <van-empty />
       </template>
+
       <template v-else>
-        <template v-if="!multipleChoice">
-          <!-- 单选 -->
-          <van-radio-group v-model="selectChecked">
-            <template v-for="item in renderingOptions">
+        <!-- 加载 -->
+        <template v-if="listLoading">
+          <van-skeleton :row="10" />
+        </template>
+        <template v-else>
+          <template v-if="!multipleChoice">
+            <!-- 单选 -->
+            <van-radio-group v-model="selectChecked">
+              <template v-for="item in renderingOptions">
+                <van-cell-group inset>
+                  <van-cell clickable @click="selectChecked = item.value">
+                    <template #right-icon>
+                      <van-radio :name="item.value" />
+                    </template>
+                    <template #title>
+                      <TranslationComponent :openId="item.label" />
+                    </template>
+                  </van-cell>
+                </van-cell-group>
+              </template>
+            </van-radio-group>
+          </template>
+          <!-- 多选 -->
+          <template v-if="multipleChoice">
+            <van-checkbox-group v-model="selectChecked">
               <van-cell-group inset>
-                <van-cell clickable @click="selectChecked = item.value">
+                <van-cell v-for="(item, index) in renderingOptions" clickable :key="index" @click="toggle(index)">
                   <template #right-icon>
-                    <van-radio :name="item.value" />
+                    <van-checkbox :name="item.value" :ref="(el) => (checkboxRefs[index] = el)" @click.stop />
                   </template>
                   <template #title>
                     <TranslationComponent :openId="item.label" />
                   </template>
                 </van-cell>
               </van-cell-group>
-            </template>
-          </van-radio-group>
-        </template>
-        <!-- 多选 -->
-        <template v-if="multipleChoice">
-          <van-checkbox-group v-model="selectChecked">
-            <van-cell-group inset>
-              <van-cell v-for="(item, index) in renderingOptions" clickable :key="index" @click="toggle(index)">
-                <template #right-icon>
-                  <van-checkbox :name="item.value" :ref="(el) => (checkboxRefs[index] = el)" @click.stop />
-                </template>
-                <template #title>
-                  <TranslationComponent :openId="item.label" />
-                </template>
-              </van-cell>
-            </van-cell-group>
-          </van-checkbox-group>
+            </van-checkbox-group>
+          </template>
         </template>
       </template>
     </div>
     <div class="w-full pb-2 px-4">
-      <van-button type="primary" round class="w-full" :disabled="multipleChoice ? !selectChecked.length : !selectChecked" @click="confirmClick">确定</van-button>
+      <van-button type="primary" round class="w-full" :disabled="multipleChoice ? !selectChecked.length : (!selectChecked && selectChecked != 0)" @click="confirmClick">确定</van-button>
     </div>
   </div>
 </template>
@@ -88,6 +94,17 @@ const renderingOptions = ref([]);
 
 const debouncedSearchOptions = useDebounce(searchOptions, 500);
 
+watch(() => props.options, (newValue) => {
+  selectChecked.value = props.multipleChoice ? [] : null;
+  const isItAnArray = Array.isArray(newValue);
+  if (isItAnArray && newValue.length > 0) {
+    renderingOptions.value = manualCopying(newValue);
+    allOptions.value = manualCopying(newValue);
+  } else {
+    obtainPersonnelData();
+  }
+})
+
 function searchOptions(val) {
   listLoading.value = true
   if (!props.doYouNeedTranslation) {

+ 7 - 2
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/hooks/useApi.js

@@ -6,10 +6,13 @@ export const GET_CUSTOM_FORM_JSON = `/sys-form/getListByCode` // 获取自定义
 export const GET_ALL_PERSONNEL = `/user/getSimpleActiveUserListNew` // 获取所有人员
 
 export const GET_A_LIST_OF_BUSINESS_OPPORTUNITIES = '/business-opportunity/list' // 获取商机列表
+export const GET_ALL_BUSINESS_OPPORTUNITIES = '/business-opportunity/getAll' // 获取所有商机
 export const GET_A_LIST_OF_CLUES = '/clue/listClue' // 获取线索列表
+export const GET_OBTAIN_ALL_CLUES = '/clue/getAll' // 获取所有线索
 export const GET_CONTACT_LIST = '/contacts/pageContacts' // 获取联系人列表
 export const GET_CUSTOMER_LIST = '/custom/list' // 获取客户列表
-export const GET_ALL_CUSTOMERS = `/custom/getAllCustom` // 获取所有客户
+export const GET_ALL_CUSTOMERS = `/custom/getAllCustom` // 获取客户列表
+export const GET_ALL_CUSTOMERSLIST = `/custom/getAll` // 获取所有客户列表 
 export const GET_TASK_LIST = '/tasks/pageTask' // 获取任务列表
 export const GET_PRODUCT_LIST = '/product/list' // 获取产品列表
 export const GET_CONTRACT_LIST = '/contract/getContractPage' // 获取合同列表
@@ -50,4 +53,6 @@ export const OBTAIN_SALES_ORDERS_RELATED_TO_THE_PRODUCT = `/product/orderWithPro
 export const GET_ORDER_RELATED_TASKS = `/order/taskWithOrder` // 获取销售订单关联任务
 export const OBTAIN_ORDER_RELATED_PRODUCTS = `/order/productWithOrder` // 获取销售订单关联产品
 
-export const SELL_AND_OBTAIN_RELATED_PRODUCTS = `/product/orderWithProduct` // 销售订单关联产品
+export const SELL_AND_OBTAIN_RELATED_PRODUCTS = `/product/orderWithProduct` // 销售订单关联产品
+
+export const GET_CONTACTS_WITH_MORE_I_DS = `/contacts/getAllContacts` // 更具Id获取联系人

+ 0 - 3
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/moduleList/moduleList.vue

@@ -203,9 +203,6 @@ function topMounted(row) {
 }
 
 function toDetail(item) {
-  if(queryParameters.value.key == 'tasks') {
-    return
-  }
   router.navigateTo({
     pathName: 'details',
     success: () => {

+ 181 - 2
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/tasks/addEditor.vue

@@ -1,6 +1,66 @@
 <template>
   <div class="w-full h-full flex flex-col">
     <div class="flex-1 overflow-y-auto">
+      <van-form ref="vanFormRef" show-error :show-error-message="false" label-align="left" input-align="right"
+        class="bg-white" @submit="onSubmit">
+        <van-field v-model="vantFormVal.taskName" name="taskName" rows="2" label="任务名称" maxlength="100" required
+          show-word-limit type="textarea" placeholder="请输入" />
+        <van-field v-model="vantFormVal.priority" name="priority" label="优先级" placeholder="请选择" is-link readonly
+          required @click="showSelectionBox('priority', fixedFieldPriority)">
+          <template #input v-if="vantFormVal.priority || vantFormVal.priority == 0">
+            {{ vantFormVal.priorityName }}
+          </template>
+        </van-field>
+        <van-field v-model="vantFormVal.taskType" name="taskType" label="任务类型" placeholder="请选择" is-link readonly
+          @click="showSelectionBox('taskType', fixedFieldTaskType)" class="resetStyles">
+          <template #input v-if="vantFormVal.taskType || vantFormVal.taskType == 0">
+            {{ vantFormVal.taskTypeName }}
+          </template>
+        </van-field>
+        <!-- 客户选择 -->
+        <template v-if="vantFormVal.taskType == 0">
+          <van-field v-model="vantFormVal.customId" name="customId" label="客户" placeholder="请选择" is-link readonly
+            @click="showSelectionBox('customId', allCustomersList)" class="resetStyles">
+            <template #input v-if="vantFormVal.customId">
+              {{ vantFormVal.customIdName }}
+            </template>
+          </van-field>
+        </template>
+        <!-- 商机选择 -->
+        <template v-if="vantFormVal.taskType == 1">
+          <van-field v-model="vantFormVal.businessOpportunityId" name="businessOpportunityId" label="商机"
+            placeholder="请选择" is-link readonly class="resetStyles"
+            @click="showSelectionBox('businessOpportunityId', allBusinessOpportunities)">
+            <template #input v-if="vantFormVal.businessOpportunityId">
+              {{ vantFormVal.businessOpportunityIdName }}
+            </template>
+          </van-field>
+        </template>
+        <!-- 销售订单选择 -->
+        <template v-if="vantFormVal.taskType == 2">
+          <van-field v-model="vantFormVal.orderId" name="orderId" label="销售订单" placeholder="请选择" is-link readonly
+            class="resetStyles" @click="showSelectionBox('orderId', allSalesOrdersList)">
+            <template #input v-if="vantFormVal.orderId">
+              {{ vantFormVal.orderIdName }}
+            </template>
+          </van-field>
+        </template>
+        <!-- 线索选择 -->
+        <template v-if="vantFormVal.taskType == 3">
+          <van-field v-model="vantFormVal.clueId" name="clueId" label="线索" placeholder="请选择" is-link readonly
+            class="resetStyles" @click="showSelectionBox('clueId', allCluesList)">
+            <template #input v-if="vantFormVal.clueId">
+              {{ vantFormVal.clueIdName }}
+            </template>
+          </van-field>
+        </template>
+        <van-field v-model="vantFormVal.contactsId" name="contactsId" label="联系人" placeholder="请选择" is-link readonly :disabled="contactDisabled" v-if="fixedFieldTaskType.find(v => v.value == (vantFormVal.taskType || '1'))?.show"
+          class="resetStyles" @click="showSelectionBox('contactsId', allContactsList)">
+          <template #input v-if="vantFormVal.contactsId">
+            {{ vantFormVal.contactsIdName }}
+          </template>
+        </van-field>
+      </van-form>
       <CustomerForm ref="formFormRef" :formJson="formJson" :formValue="formVal"></CustomerForm>
     </div>
     <div class="mar-20px ">
@@ -8,12 +68,24 @@
         {{ Object.keys(formVal).length > 0 ? '确定修改' : '确定添加' }}
       </van-button>
     </div>
+
+    <!-- 选择器 -->
+    <div>
+      <!-- 正常下拉框选择 -->
+      <van-popup v-model:show="showSelectionFlag" destroy-on-close position="bottom" :style="{ height: '80%' }">
+        <PullDownSelector :options="showSelectionArray" :doYouNeedTranslation="false" @change="selectChange" />
+      </van-popup>
+    </div>
   </div>
 </template>
 
 <script setup>
-import { ref, onActivated } from 'vue';
+import { ref, onActivated, computed } from 'vue';
 import { useLifecycle } from '@hooks/useCommon.js';
+import { fixedFieldTaskType, fixedFieldPriority } from '@utility/defaultData.js';
+import { GET_ALL_CUSTOMERSLIST, GET_ALL_BUSINESS_OPPORTUNITIES, GET_SALES_ORDER_LIST, GET_OBTAIN_ALL_CLUES, GET_CONTACTS_WITH_MORE_I_DS } from "@hooks/useApi";
+import requests from "@common/requests";
+import PullDownSelector from '@components/common/pullDownSelector.vue'
 import CustomerForm from '@components/common/formForm/formView.vue'
 
 const props = defineProps({
@@ -22,7 +94,28 @@ const props = defineProps({
 });
 
 const formFormRef = ref(null)
+const vantFormVal = ref({
+  taskType: 0,
+  taskTypeName: '客户'
+})
 const formVal = ref({})
+const allBusinessOpportunities = ref([])
+const allCustomersList = ref([])
+const allCluesList = ref([])
+const allSalesOrdersList = ref([])
+const allContactsList = ref([])
+const showSelectionFlag = ref(false)
+const showSelectionFiled = ref([])
+const showSelectionArray = ref([])
+const taskTypeFiled = ['customId', 'businessOpportunityId', 'orderId', 'clueId']
+
+const contactDisabled = computed(() => {
+  const taskType = vantFormVal.value?.taskType
+  if(!taskType && taskType != 0) {
+    return true
+  }
+  return false
+})
 
 function onSubmit() {
   formFormRef.value.getJsonData().then((res) => {
@@ -30,17 +123,103 @@ function onSubmit() {
   })
 }
 
+function selectChange(value, label) {
+  if (taskTypeFiled.includes(showSelectionFiled.value)) {
+    const item = fixedFieldTaskType.find(item => item.value == vantFormVal.value.taskType)
+    console.log(item, value, )
+    if (item && item.show) {
+      getContactData(showSelectionFiled.value, value)
+    }
+  }
+  vantFormVal.value[showSelectionFiled.value] = value
+  vantFormVal.value[`${showSelectionFiled.value}Name`] = label
+  showSelectionFlag.value = false
+}
+
+function showSelectionBox(filed, list = [], event) {
+  if (taskTypeFiled.includes(filed)) {
+    const fileds = taskTypeFiled.filter(item => item !== filed)
+    fileds.forEach(item => {
+      vantFormVal.value[item] = ''
+      vantFormVal.value[`${item}Name`] = ''
+    })
+    vantFormVal.value.contactsId = ''
+    vantFormVal.value[`contactsIdName`] = ''
+  }
+  showSelectionFiled.value = filed
+  showSelectionArray.value = list
+  showSelectionFlag.value = true
+}
+
+function getContactData(filed, value) {
+  const urlType = {
+    'customId': 'customerId',
+    'businessOpportunityId': 'businessId',
+    'orderId': 'salesId',
+  }
+  const url = `${GET_CONTACTS_WITH_MORE_I_DS}?${urlType[filed]}=${value}`
+  requests.get(url).then(({ data = [] }) => {
+    let list = data.map(item => {
+      return {
+        label: item.name,
+        value: item.id,
+      }
+    })
+    if(!allContactsList.value.length) {
+      list = [{}]
+    }
+    allContactsList.value = list
+  })
+}
+
+function getAllListData() {
+  requests.post(GET_ALL_CUSTOMERSLIST, {}).then(res => {
+    allCustomersList.value = res.data.map(item => {
+      return {
+        label: item.customName,
+        value: item.id,
+      }
+    })
+  })
+  requests.post(GET_ALL_BUSINESS_OPPORTUNITIES, {}).then(res => {
+    allBusinessOpportunities.value = res.data.map(item => {
+      return {
+        label: item.name,
+        value: item.id,
+      }
+    })
+  })
+  requests.post(GET_SALES_ORDER_LIST, { pageIndex: -1, pageSize: -1 }).then(({ data }) => {
+    allSalesOrdersList.value = (data.record || []).map(item => {
+      return {
+        label: item.orderName,
+        value: item.id,
+      }
+    })
+  })
+  requests.post(GET_OBTAIN_ALL_CLUES, {}).then(res => {
+    allCluesList.value = res.data.map(item => {
+      return {
+        label: item.clueName,
+        value: item.id,
+      }
+    })
+  })
+}
+
 useLifecycle({
   load: () => {
     formVal.value = props.formValue
+    getAllListData()
   },
   init: () => {
     formVal.value = props.formValue
+    getAllListData()
   }
 });
 
 onActivated(() => {
-  
+
 })
 </script>
 

+ 21 - 0
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/tasks/tasksInfo.vue

@@ -0,0 +1,21 @@
+<template>
+  <Page title='任务详情'>
+    <template v-slot:body>
+    </template>
+  </Page>
+</template>
+
+<script setup>
+import { ref } from 'vue';
+import { useLifecycle } from '@hooks/useCommon.js';
+
+useLifecycle({
+  load: () => {
+    // 添加加载逻辑
+  }
+});
+</script>
+
+<style lang='scss' scoped>
+  /* 样式代码 */
+</style>