|
@@ -12,31 +12,35 @@
|
|
|
<t-row :gutter="[20, 0]">
|
|
|
<t-col :span="6">
|
|
|
<t-form-item label="服务单元"
|
|
|
- >{{ dispatchInfo.service }}
|
|
|
+ >{{ requestInfo.serviceUnitName }}
|
|
|
</t-form-item>
|
|
|
</t-col>
|
|
|
<t-col :span="6">
|
|
|
- <t-form-item label="项目单号">{{ dispatchInfo.crmNo }} </t-form-item>
|
|
|
+ <t-form-item label="项目单号">{{ requestInfo.crmNo }} </t-form-item>
|
|
|
</t-col>
|
|
|
<t-col :span="6">
|
|
|
<t-form-item label="客户类型"
|
|
|
- >{{ customerTypeFilter(dispatchInfo.customType) }}
|
|
|
+ >{{ customerTypeFilter(requestInfo.customType) }}
|
|
|
</t-form-item>
|
|
|
</t-col>
|
|
|
<t-col :span="6">
|
|
|
- <t-form-item label="客户名称">{{ dispatchInfo.custom }} </t-form-item>
|
|
|
+ <t-form-item label="客户名称"
|
|
|
+ >{{ requestInfo.customName }}
|
|
|
+ </t-form-item>
|
|
|
</t-col>
|
|
|
<t-col :span="6">
|
|
|
- <t-form-item label="服务档位"></t-form-item>
|
|
|
+ <t-form-item label="服务档位">{{ requestInfo.level }} </t-form-item>
|
|
|
</t-col>
|
|
|
<t-col :span="12">
|
|
|
<t-form-item label="客户地址">
|
|
|
- <!-- <t-space>
|
|
|
- <span>{{ formData.province }}</span>
|
|
|
- <span>{{ formData.city }}</span>
|
|
|
- <span>{{ formData.area }}</span>
|
|
|
- <span>{{ formData.address }}</span>
|
|
|
- </t-space> -->
|
|
|
+ <t-space>
|
|
|
+ <span>
|
|
|
+ <span>{{ requestInfo.customProvince }}</span>
|
|
|
+ <span>{{ requestInfo.customCity }}</span>
|
|
|
+ <span>{{ requestInfo.customArea }}</span>
|
|
|
+ </span>
|
|
|
+ <span>{{ requestInfo.customAddress }}</span>
|
|
|
+ </t-space>
|
|
|
</t-form-item>
|
|
|
</t-col>
|
|
|
<t-col :span="12">
|
|
@@ -49,16 +53,34 @@
|
|
|
:data="tableData"
|
|
|
bordered
|
|
|
>
|
|
|
- <template #users="{ row }">
|
|
|
- <select-free-engineer
|
|
|
- v-model="row.userIdList"
|
|
|
- :type="row.roleType"
|
|
|
- :unit-id="dispatchInfo.serviceId"
|
|
|
- :crm-no="dispatchInfo.crmNo"
|
|
|
+ <template #key="{ row }">
|
|
|
+ <t-select
|
|
|
+ v-if="row.key === 'REGION_COORDINATOR'"
|
|
|
+ v-model="formData.allocationParams[0].userIdList"
|
|
|
+ :options="options1"
|
|
|
+ placeholder="请选择"
|
|
|
+ multiple
|
|
|
+ :keys="{ label: 'name', value: 'userId' }"
|
|
|
+ />
|
|
|
+ <t-select
|
|
|
+ v-if="row.key === 'PROJECT_MANAGER'"
|
|
|
+ v-model="formData.allocationParams[1].userIdList"
|
|
|
+ :options="options2"
|
|
|
+ placeholder="请选择"
|
|
|
multiple
|
|
|
- :min-collapsed-num="10"
|
|
|
- :max="row.roleType === 'REGION_COORDINATOR' ? 1 : 0"
|
|
|
- ></select-free-engineer>
|
|
|
+ :keys="{ label: 'name', value: 'userId' }"
|
|
|
+ />
|
|
|
+ <t-select
|
|
|
+ v-if="row.key === 'ENGINEER'"
|
|
|
+ v-model="formData.allocationParams[2].userIdList"
|
|
|
+ :options="options3"
|
|
|
+ placeholder="请选择"
|
|
|
+ multiple
|
|
|
+ :keys="{ label: 'name', value: 'userId' }"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ <template #history="{ row }">
|
|
|
+ {{ row.history.join('、') }}
|
|
|
</template>
|
|
|
</t-table>
|
|
|
</div>
|
|
@@ -78,58 +100,117 @@
|
|
|
import { computed, onMounted, ref, watch } from 'vue';
|
|
|
import { MessagePlugin } from 'tdesign-vue-next';
|
|
|
import { MinusCircleFilledIcon } from 'tdesign-icons-vue-next';
|
|
|
-import useAuthenRole from '@/hooks/useAuthenRole';
|
|
|
-import {
|
|
|
- personAllocateDeployApi,
|
|
|
- personAllocateRoleDetailApi,
|
|
|
-} from '@/api/resource-guard';
|
|
|
+import {} from '@/api/resource-guard';
|
|
|
import { customerTypeFilter } from '@/utils/filter';
|
|
|
import { cloneDeep } from 'lodash-es';
|
|
|
-
|
|
|
+import {
|
|
|
+ getAllocationInfoApi,
|
|
|
+ saveAllocationInfoApi,
|
|
|
+} from '@/api/service-unit';
|
|
|
+import useClearDialog from '@/hooks/useClearDialog';
|
|
|
const emit = defineEmits(['update:visible', 'success']);
|
|
|
const props = defineProps({
|
|
|
visible: Boolean,
|
|
|
curRow: Object,
|
|
|
dispatchInfo: { type: Object, default: () => {} },
|
|
|
});
|
|
|
-
|
|
|
+const requestInfo = ref({});
|
|
|
const formRef = ref(null);
|
|
|
+const init = () => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ sopRoleType: 'REGION_COORDINATOR',
|
|
|
+ userIdList: [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ sopRoleType: 'PROJECT_MANAGER',
|
|
|
+ userIdList: [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ sopRoleType: 'ENGINEER',
|
|
|
+ userIdList: [],
|
|
|
+ },
|
|
|
+ ];
|
|
|
+};
|
|
|
+const { formData, isEdit } = useClearDialog(
|
|
|
+ {
|
|
|
+ crmDetailId: '',
|
|
|
+ allocationParams: init(),
|
|
|
+ },
|
|
|
+ props,
|
|
|
+ formRef,
|
|
|
+ () => {
|
|
|
+ formData.crmDetailId = props.curRow?.id;
|
|
|
+ formData.allocationParams = init();
|
|
|
+ getOptions();
|
|
|
+ }
|
|
|
+);
|
|
|
|
|
|
-const { roleList, getRoleList } = useAuthenRole();
|
|
|
+const options1 = ref([]);
|
|
|
+const options2 = ref([]);
|
|
|
+const options3 = ref([]);
|
|
|
+const getOptions = () => {
|
|
|
+ getAllocationInfoApi({
|
|
|
+ crmDetailId: props.curRow?.id,
|
|
|
+ }).then((res) => {
|
|
|
+ requestInfo.value = res;
|
|
|
+ tableData.value[0].history = res.regionCoordinatorInfo.historicalList;
|
|
|
+ tableData.value[1].history = res.projectManagerInfo.historicalList;
|
|
|
+ tableData.value[2].history = res.engineerInfo.historicalList;
|
|
|
+ options1.value = [
|
|
|
+ ...(res.regionCoordinatorInfo.allocatedList || []),
|
|
|
+ ...(res.regionCoordinatorInfo.canChooseList || []),
|
|
|
+ ];
|
|
|
+ options2.value = [
|
|
|
+ ...(res.projectManagerInfo.allocatedList || []),
|
|
|
+ ...(res.projectManagerInfo.canChooseList || []),
|
|
|
+ ];
|
|
|
+ options3.value = [
|
|
|
+ ...(res.engineerInfo.allocatedList || []),
|
|
|
+ ...(res.engineerInfo.canChooseList || []),
|
|
|
+ ];
|
|
|
+ formData.allocationParams[0].userIdList = (
|
|
|
+ res.regionCoordinatorInfo.allocatedList || []
|
|
|
+ ).map((item) => item.userId);
|
|
|
+ formData.allocationParams[1].userIdList = (
|
|
|
+ res.projectManagerInfo.allocatedList || []
|
|
|
+ ).map((item) => item.userId);
|
|
|
+ formData.allocationParams[2].userIdList = (
|
|
|
+ res.engineerInfo.allocatedList || []
|
|
|
+ ).map((item) => item.userId);
|
|
|
+ });
|
|
|
+};
|
|
|
|
|
|
const tableData = ref([
|
|
|
{
|
|
|
roleName: '区域协调人',
|
|
|
- users: [],
|
|
|
- history: '',
|
|
|
- roleType: 'REGION_COORDINATOR',
|
|
|
+ history: [],
|
|
|
+ key: 'REGION_COORDINATOR',
|
|
|
},
|
|
|
{
|
|
|
roleName: '项目经理',
|
|
|
- users: [],
|
|
|
- history: '',
|
|
|
- roleType: 'REGION_MANAGER',
|
|
|
+ history: [],
|
|
|
+ key: 'PROJECT_MANAGER',
|
|
|
},
|
|
|
{
|
|
|
roleName: '工程师',
|
|
|
- users: [],
|
|
|
- history: '',
|
|
|
- roleType: 'EFFECT_ENGINEER,ASSISTANT_ENGINEER',
|
|
|
+ history: [],
|
|
|
+ key: 'ENGINEER',
|
|
|
},
|
|
|
]);
|
|
|
const roleColumns = [
|
|
|
{ colKey: 'roleName', title: '角色', width: 120 },
|
|
|
- { colKey: 'users', title: '人员', cell: 'users' },
|
|
|
- { colKey: 'history', title: '', width: 60 },
|
|
|
+ { colKey: 'key', title: '人员', cell: 'key' },
|
|
|
+ { colKey: 'history', title: '历史人员记录', cell: 'history', width: 200 },
|
|
|
];
|
|
|
|
|
|
const save = async () => {
|
|
|
- MessagePlugin.success('保存成功');
|
|
|
- emit('update:visible', false);
|
|
|
- emit('success');
|
|
|
+ saveAllocationInfoApi(formData).then(() => {
|
|
|
+ MessagePlugin.success('保存成功');
|
|
|
+ emit('update:visible', false);
|
|
|
+ emit('success');
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
-onMounted(() => {
|
|
|
- getRoleList();
|
|
|
-});
|
|
|
+onMounted(() => {});
|
|
|
</script>
|