刘洋 1 年之前
父節點
當前提交
e0a2d00764

+ 12 - 2
src/components/common/upload-button/index.vue

@@ -24,6 +24,7 @@ import { request } from '@/utils/request.js';
 import { getFileMD5 } from '@/utils/crypto.js';
 
 const props = defineProps({
+  failRule: Function,
   accept: {
     type: String,
   },
@@ -118,8 +119,17 @@ const upload = async (file) => {
   }).catch(() => {});
 
   if (res) {
-    MessagePlugin.success(props.successText);
-    return { status: 'success', response: res };
+    if (props.failRule) {
+      if (props.failRule(res)) {
+        return { status: 'fail', error: res.error };
+      } else {
+        MessagePlugin.success(props.successText);
+        return { status: 'success', response: res };
+      }
+    } else {
+      MessagePlugin.success(props.successText);
+      return { status: 'success', response: res };
+    }
   } else {
     return { status: 'fail', error: '上传失败' };
   }

+ 8 - 1
src/views/service-unit/dispatch/dispatch-manage/allocation-dialog.vue

@@ -90,7 +90,7 @@
                   />
                 </template>
                 <template #history="{ row }">
-                  {{ row.history.join('、') }}
+                  {{ buildHistoryStr(row.history) }}
                 </template>
               </t-table>
             </div>
@@ -119,6 +119,13 @@ import {
 } from '@/api/service-unit';
 import { saveAllocationApi } from '@/api/sop';
 import useClearDialog from '@/hooks/useClearDialog';
+
+const buildHistoryStr = (arr) => {
+  return arr
+    .map((item) => `${item.name}_${item.supplierName}_${item.city}`)
+    .join('、');
+};
+
 const emit = defineEmits(['update:visible', 'success']);
 const props = defineProps({
   visible: Boolean,

+ 6 - 0
src/views/service-unit/dispatch/dispatch-manage/create-sop.vue

@@ -91,6 +91,7 @@
           :format="['xls', 'xlsx']"
           :uploadData="{ crmNo: props.dispatchInfo.crmNo }"
           @onSuccess="fetchData"
+          :failRule="uploadFailRule"
         >
           <t-button variant="outline">
             <template #icon><svg-icon name="import" color="#262626" /></template
@@ -201,6 +202,11 @@ import { dateFormat } from '@/utils/tool';
 import DynamicFormItem from '../../../sop/components/dynamic-form-item/index.vue';
 import { DialogPlugin, MessagePlugin } from 'tdesign-vue-next';
 import { cloneDeep } from 'lodash-es';
+
+const uploadFailRule = (res) => {
+  return res.error !== '无';
+};
+
 const fullWidthCodes = ref([
   'TABLE',
   'FORM_GROUP_TITLE',

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

@@ -105,7 +105,15 @@ const rules = {
   leadId: [
     {
       required: true,
-      message: '未选择大区经理',
+      message: '未指定大区经理',
+      type: 'error',
+      trigger: 'change',
+    },
+  ],
+  leadType: [
+    {
+      required: true,
+      message: '请选择大区经理',
       type: 'error',
       trigger: 'change',
     },

+ 8 - 3
src/views/sop/components/dynamic-form-item/SELECT.vue

@@ -6,7 +6,6 @@
     :disabled="!config.writable"
     filterable
     @change="emitChange"
-    :keys="keys"
   ></t-select>
 </template>
 <script setup name="SELECT">
@@ -26,12 +25,10 @@ const isMultiple = computed(() => {
 });
 
 const options = ref([]);
-const keys = ref({ label: 'label', value: 'value' });
 const getOptionsApi = () => {
   let dataGrid = props.config?.dataGrid;
   if (props.config?.formId === 'engineer_users_id_1') {
     dataGrid = dataGrid.replace('#{id}', props.sop?.crmDetailId);
-    keys.value = { label: 'name', value: 'userId' };
   }
   return request({
     url: dataGrid,
@@ -52,6 +49,14 @@ const getOptions = async () => {
   const data = await getOptionsApi();
   console.log('data', data);
   options.value = data || [];
+  if (props.config?.formId === 'engineer_users_id_1') {
+    options.value = options.value.map((item) => {
+      return {
+        label: `${item.name}_${item.supplierName}`,
+        value: item.userId,
+      };
+    });
+  }
 };
 
 onMounted(() => {