Parcourir la source

自测bug修复

刘洋 il y a 1 an
Parent
commit
ffd1435b47

+ 18 - 4
src/views/service-unit/dispatch/dispatch-manage/allocation-dialog.vue

@@ -53,6 +53,14 @@
                 :data="tableData"
                 bordered
               >
+                <template #roleName="{ row }">
+                  <span v-if="row.roleName === '区域协调人'">{{
+                    row.roleName
+                  }}</span>
+                  <span v-else
+                    ><span style="color: red">* </span>{{ row.roleName }}</span
+                  >
+                </template>
                 <template #key="{ row }">
                   <t-select
                     v-if="row.key === 'REGION_COORDINATOR'"
@@ -60,6 +68,7 @@
                     :options="options1"
                     placeholder="请选择"
                     multiple
+                    :max="1"
                     :keys="{ label: 'name', value: 'userId' }"
                   />
                   <t-select
@@ -68,6 +77,7 @@
                     :options="options2"
                     placeholder="请选择"
                     multiple
+                    :max="1"
                     :keys="{ label: 'name', value: 'userId' }"
                   />
                   <t-select
@@ -112,7 +122,6 @@ const emit = defineEmits(['update:visible', 'success']);
 const props = defineProps({
   visible: Boolean,
   curRow: Object,
-  dispatchInfo: { type: Object, default: () => {} },
 });
 const requestInfo = ref({});
 const formRef = ref(null);
@@ -140,7 +149,7 @@ const { formData, isEdit } = useClearDialog(
   props,
   formRef,
   () => {
-    formData.crmDetailId = props.curRow?.id;
+    formData.crmDetailId = props.curRow?.crmDetailId || props.curRow?.id; //两种场景使用了人员调配,一个是菜单页面的SOP列表,一个是创建sop里的sop列表
     formData.allocationParams = init();
     getOptions();
   }
@@ -151,7 +160,7 @@ const options2 = ref([]);
 const options3 = ref([]);
 const getOptions = () => {
   getAllocationInfoApi({
-    crmDetailId: props.curRow?.id,
+    crmDetailId: props.curRow?.crmDetailId || props.curRow?.id,
   }).then((res) => {
     requestInfo.value = res;
     tableData.value[0].history = res.regionCoordinatorInfo.historicalList;
@@ -199,12 +208,17 @@ const tableData = ref([
   },
 ]);
 const roleColumns = [
-  { colKey: 'roleName', title: '角色', width: 120 },
+  { colKey: 'roleName', title: '角色', width: 120, cel: 'roleName' },
   { colKey: 'key', title: '人员', cell: 'key' },
   { colKey: 'history', title: '历史人员记录', cell: 'history', width: 200 },
 ];
 
 const save = async () => {
+  if (!formData.allocationParams[1].userIdList?.length) {
+    return MessagePlugin.error('大区经理必选,且只能选择一个');
+  } else if (!formData.allocationParams[2].userIdList?.length) {
+    return MessagePlugin.error('工程师必选');
+  }
   saveAllocationInfoApi(formData).then(() => {
     MessagePlugin.success('保存成功');
     emit('update:visible', false);

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

@@ -176,7 +176,7 @@
     <AllocationDialog
       v-model:visible="showAllocationDialog"
       :curRow="curRow"
-      :dispatchInfo="dispatchInfo"
+      @success="fetchData"
     ></AllocationDialog>
   </my-drawer>
 </template>

+ 21 - 1
src/views/sop/sop-manage/office-sop/index.vue

@@ -123,6 +123,14 @@
 
         <template #operate="{ row }">
           <div class="table-operations">
+            <t-link
+              theme="primary"
+              hover="color"
+              @click="allocation(row)"
+              :disabled="row.sopStatus === 'START'"
+            >
+              人员调配
+            </t-link>
             <template v-if="perm.LINK_Fill">
               <t-link
                 :disabled="
@@ -223,6 +231,11 @@
       v-model:visible="showDeviceManage"
       :sop="curSopData"
     ></DeviceManageNew>
+    <AllocationDialog
+      v-model:visible="showAllocationDialog"
+      :curRow="curSopData"
+      @success="search"
+    ></AllocationDialog>
   </div>
 </template>
 
@@ -248,6 +261,13 @@ import DeviceManageNew from '@/components/common/device-manage-new';
 import { omit } from 'lodash-es';
 import bus from '@/utils/bus';
 import { metadataListApi } from '@/api/sop';
+import AllocationDialog from '../../../service-unit/dispatch/dispatch-manage/allocation-dialog.vue';
+
+const showAllocationDialog = ref(false);
+const allocation = (row) => {
+  curSopData.value = row;
+  showAllocationDialog.value = true;
+};
 
 const allFormWidgetMetadataViewList = ref([]);
 const getMergeMetaList = async () => {
@@ -380,7 +400,7 @@ const columns = computed(() => {
       title: '管理',
       colKey: 'operate',
       fixed: 'right',
-      width: 450,
+      width: 520,
     },
   ];
 

+ 21 - 1
src/views/sop/sop-manage/student-sop/index.vue

@@ -119,6 +119,14 @@
         </template>
         <template #operate="{ row }">
           <div class="table-operations" @click.stop>
+            <t-link
+              theme="primary"
+              hover="color"
+              @click="allocation(row)"
+              :disabled="row.sopStatus === 'START'"
+            >
+              人员调配
+            </t-link>
             <template v-if="perm.LINK_Fill">
               <t-link
                 :disabled="
@@ -219,6 +227,11 @@
       v-model:visible="showDeviceManage"
       :sop="curSopData"
     ></DeviceManageNew>
+    <AllocationDialog
+      v-model:visible="showAllocationDialog"
+      :curRow="curSopData"
+      @success="search"
+    ></AllocationDialog>
   </div>
 </template>
 
@@ -244,6 +257,13 @@ import DeviceManageNew from '@/components/common/device-manage-new';
 import { omit } from 'lodash-es';
 import bus from '@/utils/bus';
 import { metadataListApi } from '@/api/sop';
+import AllocationDialog from '../../../service-unit/dispatch/dispatch-manage/allocation-dialog.vue';
+
+const showAllocationDialog = ref(false);
+const allocation = (row) => {
+  curSopData.value = row;
+  showAllocationDialog.value = true;
+};
 
 const allFormWidgetMetadataViewList = ref([]);
 const getMergeMetaList = async () => {
@@ -393,7 +413,7 @@ const columns = computed(() => {
       title: '管理',
       colKey: 'operate',
       fixed: 'right',
-      width: 450,
+      width: 520,
     },
   ];