|
@@ -117,11 +117,13 @@ import {
|
|
|
getAllocationInfoApi,
|
|
|
saveAllocationInfoApi,
|
|
|
} from '@/api/service-unit';
|
|
|
+import { saveAllocationApi } from '@/api/sop';
|
|
|
import useClearDialog from '@/hooks/useClearDialog';
|
|
|
const emit = defineEmits(['update:visible', 'success']);
|
|
|
const props = defineProps({
|
|
|
visible: Boolean,
|
|
|
curRow: Object,
|
|
|
+ fromSop: Boolean,
|
|
|
});
|
|
|
const requestInfo = ref({});
|
|
|
const formRef = ref(null);
|
|
@@ -149,7 +151,9 @@ const { formData, isEdit } = useClearDialog(
|
|
|
props,
|
|
|
formRef,
|
|
|
() => {
|
|
|
- formData.crmDetailId = props.curRow?.crmDetailId || props.curRow?.id; //两种场景使用了人员调配,一个是菜单页面的SOP列表,一个是创建sop里的sop列表
|
|
|
+ formData.crmDetailId = props.fromSop
|
|
|
+ ? props.curRow?.crmDetailId
|
|
|
+ : props.curRow?.id; //两种场景使用了人员调配,一个是菜单页面的SOP列表,一个是创建sop里的sop列表
|
|
|
formData.allocationParams = init();
|
|
|
getOptions();
|
|
|
}
|
|
@@ -160,7 +164,7 @@ const options2 = ref([]);
|
|
|
const options3 = ref([]);
|
|
|
const getOptions = () => {
|
|
|
getAllocationInfoApi({
|
|
|
- crmDetailId: props.curRow?.crmDetailId || props.curRow?.id,
|
|
|
+ crmDetailId: props.fromSop ? props.curRow?.crmDetailId : props.curRow?.id,
|
|
|
}).then((res) => {
|
|
|
requestInfo.value = res;
|
|
|
tableData.value[0].history = res.regionCoordinatorInfo.historicalList;
|
|
@@ -219,11 +223,21 @@ const save = async () => {
|
|
|
} else if (!formData.allocationParams[2].userIdList?.length) {
|
|
|
return MessagePlugin.error('工程师必选');
|
|
|
}
|
|
|
- saveAllocationInfoApi(formData).then(() => {
|
|
|
- MessagePlugin.success('保存成功');
|
|
|
- emit('update:visible', false);
|
|
|
- emit('success');
|
|
|
- });
|
|
|
+ if (props.fromSop) {
|
|
|
+ saveAllocationApi({ ...formData, flowId: props.curRow?.flowId }).then(
|
|
|
+ () => {
|
|
|
+ MessagePlugin.success('保存成功');
|
|
|
+ emit('update:visible', false);
|
|
|
+ emit('success');
|
|
|
+ }
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ saveAllocationInfoApi(formData).then(() => {
|
|
|
+ MessagePlugin.success('保存成功');
|
|
|
+ emit('update:visible', false);
|
|
|
+ emit('success');
|
|
|
+ });
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
onMounted(() => {});
|