zhangjie 1 year ago
parent
commit
477270d96b

+ 0 - 2
src/components/common/select-customer/index.vue

@@ -74,8 +74,6 @@ watch(
   (val, oldval) => {
     if (val !== oldval) {
       search();
-      emit('update:modelValue', null);
-      emit('change', isMultiple.value ? [] : null);
     }
   }
 );

+ 10 - 1
src/views/service-unit/dispatch/dispatch-manage/add-dispatch-dialog.vue

@@ -40,7 +40,7 @@
         </t-col>
         <t-col :span="6">
           <t-form-item label="客户类型" name="customType">
-            <t-select v-model="formData.customType">
+            <t-select v-model="formData.customType" @change="customTypeChange">
               <t-option
                 v-for="(val, key) in CUSTOMER_TYPE"
                 :key="key"
@@ -88,7 +88,12 @@
         <t-col :span="6">
           <t-form-item label="服务单元">
             <select-service-unit
+              v-if="visible"
               v-model="formData.serviceId"
+              :filterParams="{
+                statusList: ['PUBLISH'],
+                type: formData.customType,
+              }"
             ></select-service-unit>
           </t-form-item>
         </t-col>
@@ -212,6 +217,10 @@ const rules = {
   ],
 };
 
+const customTypeChange = () => {
+  formData.customId = null;
+};
+
 const save = async () => {
   const valid = await formRef.value.validate();
   if (valid !== true) return;

+ 25 - 9
src/views/service-unit/dispatch/dispatch-manage/index.vue

@@ -79,6 +79,7 @@
           <div class="table-operations" @click.stop>
             <template v-if="perm.LINK_Delimit || perm.LINK_ReDelimit">
               <t-link
+                v-if="row.serviceUnitStatus !== 'FINISH'"
                 theme="primary"
                 hover="color"
                 @click="handleDelineation(row)"
@@ -86,14 +87,16 @@
                 {{ row.serviceId ? '重新划定' : '划定' }}
               </t-link>
             </template>
-            <t-link
-              v-if="perm.LINK_Update"
-              theme="primary"
-              hover="color"
-              @click="handleEdit(row)"
-            >
-              修改
-            </t-link>
+            <template v-if="perm.LINK_Update">
+              <t-link
+                v-if="row.serviceUnitStatus !== 'FINISH'"
+                theme="primary"
+                hover="color"
+                @click="handleEdit(row)"
+              >
+                修改
+              </t-link>
+            </template>
           </div>
         </template>
       </t-table>
@@ -112,6 +115,7 @@
       "
       v-model:visible="showMultDelineationDialog"
       :crm-ids="curCrmIds"
+      :custom-type="curCrmCustomType"
       :dialog-title="curRow?.serviceId ? '重新划定服务单元' : undefined"
       @success="refresh"
     >
@@ -195,12 +199,15 @@ import { timestampFilter, customerTypeFilter } from '@/utils/filter';
 const showMultDelineationDialog = ref(false);
 const curRow = ref(null);
 const curCrmIds = ref([]);
+const curCrmCustomType = ref('');
 const showAddDispatchDialog = ref(false);
 let waitCount = ref(0);
 
 const selectedRowKeys = ref([]);
-const selectChange = (value) => {
+const selectedRows = ref([]);
+const selectChange = (value, { selectedRowData }) => {
   selectedRowKeys.value = value;
+  selectedRows.value = selectedRowData;
 };
 
 const fields = ref([
@@ -367,8 +374,15 @@ const handleMultDelineation = () => {
     MessagePlugin.error('请选择要划定的记录');
     return;
   }
+
+  const customType = selectedRows.value[0].customType;
+  if (selectedRows.value.some((item) => item.customType !== customType)) {
+    MessagePlugin.error('只能操作统一客户类型的数据');
+    return;
+  }
   curRow.value = null;
   curCrmIds.value = selectedRowKeys.value;
+  curCrmCustomType.value = customType;
   showMultDelineationDialog.value = true;
 };
 const handleDelineation = (row) => {
@@ -382,12 +396,14 @@ const handleDelineation = (row) => {
         confirmDia.hide();
         curRow.value = row;
         curCrmIds.value = [curRow.value.id];
+        curCrmCustomType.value = curRow.customType;
         showMultDelineationDialog.value = true;
       },
     });
   } else {
     curRow.value = row;
     curCrmIds.value = [curRow.value.id];
+    curCrmCustomType.value = curRow.customType;
     showMultDelineationDialog.value = true;
   }
 };

+ 9 - 1
src/views/service-unit/dispatch/dispatch-manage/mult-delineation-dialog.vue

@@ -13,7 +13,14 @@
       <t-row :gutter="[0, 20]">
         <t-col :span="12">
           <t-form-item label="服务单元" name="serviceUnitId">
-            <select-service-unit v-model="formData.serviceUnitId">
+            <select-service-unit
+              v-if="visible"
+              v-model="formData.serviceUnitId"
+              :filterParams="{
+                statusList: ['PUBLISH'],
+                type: customType,
+              }"
+            >
             </select-service-unit>
           </t-form-item>
         </t-col>
@@ -38,6 +45,7 @@ const formRef = ref(null);
 const props = defineProps({
   visible: Boolean,
   crmIds: Array,
+  customType: String,
   dialogWidth: { type: Number, default: 640 },
   dialogTitle: { type: String, default: '划定服务单元' },
 });

+ 1 - 1
src/views/service-unit/service-unit-manage/range-manage/index.vue

@@ -53,7 +53,7 @@
         <template #operate="{ row }">
           <div class="table-operations">
             <t-link
-              v-if="perm.LINK_Delete"
+              v-if="perm.LINK_Delete && row.serviceUnitStatus !== 'FINISH'"
               theme="danger"
               hover="color"
               @click="handleDelete(row)"

+ 6 - 1
src/views/service-unit/service-unit-manage/regional-planning/add-region-dialog.vue

@@ -10,7 +10,12 @@
   >
     <t-form ref="formRef" :data="formData" :rules="rules" label-width="80px">
       <t-form-item label="服务单元" name="serviceUnitId">
-        <select-service-unit v-model="formData.serviceUnitId">
+        <select-service-unit
+          v-model="formData.serviceUnitId"
+          :filterParams="{
+            statusList: ['PUBLISH'],
+          }"
+        >
         </select-service-unit>
       </t-form-item>
       <t-form-item label="大区经理" name="leadId">

+ 4 - 1
src/views/service-unit/service-unit-manage/regional-planning/index.vue

@@ -39,7 +39,10 @@
         v-loading="tableLoading"
       >
         <template #operate="{ row }">
-          <div class="table-operations">
+          <div
+            v-if="row.serviceUnitStatus !== 'FINISH'"
+            class="table-operations"
+          >
             <t-link
               v-if="perm.LINK_Update"
               theme="primary"

+ 1 - 1
src/views/sop/sop-manage/quality-issue/index.vue

@@ -264,7 +264,7 @@ const curFormConfig = computed(() => {
 watch(curFormConfig, (val) => {
   formData.value = val.reduce((obj, item) => {
     if (needValueCodes.includes(item.code)) {
-      obj[item.formName] = '';
+      obj[item.formName] = item.value || null;
     }
     return obj;
   }, {});