Browse Source

提交代码

Lijy 5 months ago
parent
commit
4dc3b94786

+ 10 - 3
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/components/common/pullDownSelector.vue

@@ -70,7 +70,7 @@ const props = defineProps({
   },
   value: {
     type: [String, Array],
-    default: () => null,
+    default: () => [],
   },
   doYouNeedTranslation: {
     type: Boolean,
@@ -86,7 +86,7 @@ const emit = defineEmits(["change"]);
 const fixedData = useFixedData();
 
 const listLoading = ref(false);
-const selectChecked = ref();
+const selectChecked = ref([]);
 const checkboxRefs = ref([]);
 const searchForValue = ref("");
 const allOptions = ref([]);
@@ -105,6 +105,10 @@ watch(() => props.options, (newValue) => {
   }
 })
 
+watch(() => props.value, (newValue) => {
+  selectChecked.value = newValue
+})
+
 function searchOptions(val) {
   listLoading.value = true
   if (!props.doYouNeedTranslation) {
@@ -168,7 +172,7 @@ function confirmClick() {
 onBeforeUpdate(() => {
   checkboxRefs.value = [];
 });
-console.log(props, '<=== ')
+
 onMounted(() => {
   selectChecked.value = props.multipleChoice ? [] : null;
   const isItAnArray = Array.isArray(props.options);
@@ -178,5 +182,8 @@ onMounted(() => {
   } else {
     obtainPersonnelData();
   }
+  if(props.value) {
+    selectChecked.value = props.multipleChoice ? props.value.split(',') : props.value
+  }
 });
 </script>

+ 19 - 7
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/tasks/addEditor.vue

@@ -62,8 +62,8 @@
             {{ vantFormVal.contactsIdName }}
           </template>
         </van-field>
-        <van-field v-model="vantFormVal.executorId" name="executorId" label="执行人" placeholder="请选择" is-link readonly class="resetStyles" :disabled="!vantFormVal.priority && vantFormVal.priority != 0"
-          @click="showSelectionBox('executorId', allContactsList)">
+        <van-field v-model="vantFormVal.executorId" name="executorId" label="执行人" placeholder="请选择" is-link readonly class="resetStyles"
+          @click="showSelectionToBox('executorId')">
           <template #input v-if="vantFormVal.executorIdName && vantFormVal.executorIdName.length > 0">
             <TranslationComponent :openId="vantFormVal.executorIdName" />
           </template>
@@ -165,7 +165,11 @@
     <div>
       <!-- 下拉框选择 -->
       <van-popup v-model:show="showSelectionFlag" destroy-on-close position="bottom" :style="{ height: '80%' }">
-        <PullDownSelector :options="showSelectionArray" :doYouNeedTranslation="false" @change="selectChange" :multiple-choice="selectMultipleChoice" />
+        <PullDownSelector :options="showSelectionArray" :doYouNeedTranslation="false" @change="selectChange" />
+      </van-popup>
+
+      <van-popup v-model:show="showSelectionToFlag" destroy-on-close position="bottom" :style="{ height: '80%' }">
+        <PullDownSelector :value="showSelectionToValue" @change="selectChange" :multiple-choice="true" />
       </van-popup>
 
       <!-- 选择日期 -->
@@ -216,7 +220,8 @@ const showDatePicker = ref(false)
 const showDatePickerVal = ref(dayjs().format("YYYY-MM-DD").split("-"))
 const showDatePickerFiled = ref('')
 const customeDate = ref([])
-const selectMultipleChoice = ref(false)
+const showSelectionToFlag = ref(false)
+const showSelectionToValue = ref([])
 const taskTypeFiled = ['customId', 'businessOpportunityId', 'orderId', 'clueId']
 
 const contactDisabled = computed(() => {
@@ -293,6 +298,12 @@ function selectChange(value, label) {
   showSelectionFlag.value = false
 }
 
+function showSelectionToBox(filed) {
+  showSelectionFiled.value = filed
+  showSelectionToValue.value = vantFormVal.value[filed] || []
+  showSelectionToFlag.value = true
+}
+
 function showSelectionBox(filed, list = [], event) {
   if (taskTypeFiled.includes(filed)) {
     const fileds = taskTypeFiled.filter(item => item !== filed)
@@ -303,7 +314,6 @@ function showSelectionBox(filed, list = [], event) {
     vantFormVal.value.contactsId = ''
     vantFormVal.value[`contactsIdName`] = ''
   }
-  selectMultipleChoice.value = filed == 'executorId' ? true : false
   showSelectionFiled.value = filed
   showSelectionArray.value = filed == 'executorId' ? [] : list
   showSelectionFlag.value = true
@@ -348,7 +358,7 @@ function getContactData(filed, value) {
         value: item.id,
       }
     })
-    if (!allContactsList.value.length) {
+    if (!list.length) {
       list = [{}]
     }
     allContactsList.value = list
@@ -432,7 +442,9 @@ function initializeData() {
   if((taskType || taskType == 0) && taskType != 3) {
     const filed = taskType == 0 ? 'customId' : taskType == 1 ? 'businessOpportunityId' : taskType == 2 ? 'orderId' : 'clueId'
     const value = taskType == 0 ? customId : taskType == 1 ? businessOpportunityId : taskType == 2 ? orderId : clueId
-    getContactData(filed, value)
+    if(value) {
+      getContactData(filed, value)
+    }
   }
 }