|
|
|
|
@ -208,7 +208,7 @@
|
|
|
|
|
:label="item.dictLabel" |
|
|
|
|
> |
|
|
|
|
<!-- 复选框展示 --> |
|
|
|
|
<el-checkbox :model-value="model.involveProblemIdList.includes(item.dictValue)"> |
|
|
|
|
<el-checkbox :model-value="(model.involveProblemIdList || []).includes(item.dictValue)"> |
|
|
|
|
{{ item.dictLabel }} |
|
|
|
|
</el-checkbox> |
|
|
|
|
</el-option> |
|
|
|
|
@ -328,7 +328,7 @@
|
|
|
|
|
<template #footer> |
|
|
|
|
<div class="dialog-footer"> |
|
|
|
|
<el-button @click="visibleProxy = false" size="large">取消</el-button> |
|
|
|
|
<el-button type="primary" @click="onSubmit" size="large"> |
|
|
|
|
<el-button type="primary" @click="onSubmit" size="large" :loading="submitLoading"> |
|
|
|
|
{{ mode === 'add' ? '添加' : '修改' }} |
|
|
|
|
</el-button> |
|
|
|
|
</div> |
|
|
|
|
@ -352,14 +352,69 @@
|
|
|
|
|
|
|
|
|
|
<script setup> |
|
|
|
|
import {computed, ref, watch} from "vue"; |
|
|
|
|
import {maileRepeatt} from "@/api/data/complaintCollection.ts"; |
|
|
|
|
import { WarningFilled } from '@element-plus/icons-vue' |
|
|
|
|
import {maileRepeatt, getComplaintCollectionDetail, updateComplaintCollection} from "@/api/data/complaintCollection.ts"; |
|
|
|
|
import dayjs from "dayjs"; |
|
|
|
|
import feedback from "@/utils/feedback.ts"; |
|
|
|
|
import Complaint_detail from "@/components/data/complaint_detail.vue"; |
|
|
|
|
import DuplicateDrawerWithDetail from "@/views/data/DuplicateDrawerWithDetail.vue"; |
|
|
|
|
import useUserStore from "@/stores/modules/user.ts"; |
|
|
|
|
import {secondList, listByFirstHost} from "@/api/system/depart"; |
|
|
|
|
import useCatchStore from "@/stores/modules/catch"; |
|
|
|
|
const catchStore = useCatchStore(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 1. 用 computed 包装 storeDict |
|
|
|
|
const storeDict = computed(() => |
|
|
|
|
catchStore.getDicts([ |
|
|
|
|
"businessType", |
|
|
|
|
"suspectProblem", |
|
|
|
|
"specialSupervision", |
|
|
|
|
"checkStatus", |
|
|
|
|
"policeType", |
|
|
|
|
"timeLimit", |
|
|
|
|
"approvalFlow", |
|
|
|
|
"sfssSourceTable", |
|
|
|
|
"sfssTags", |
|
|
|
|
]) || {} |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// 2. 本地静态字典 |
|
|
|
|
const localDict = { |
|
|
|
|
yesNo: [ |
|
|
|
|
{id: 1, dictLabel: "是", dictValue: "1"}, |
|
|
|
|
{id: 2, dictLabel: "否", dictValue: "0"}, |
|
|
|
|
], |
|
|
|
|
handleMethodType: [ |
|
|
|
|
{id: 1, dictLabel: "自办", dictValue: "0"}, |
|
|
|
|
{id: 2, dictLabel: "下发", dictValue: "1"}, |
|
|
|
|
], |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// 3. sourceTableAndLevel 依赖 storeDict.value |
|
|
|
|
const sourceTableAndLevel = computed(() => { |
|
|
|
|
const list = storeDict.value?.sfssSourceTable || []; |
|
|
|
|
if (!list || list.length === 0) return []; |
|
|
|
|
// 一级:remark 为空 |
|
|
|
|
const parents = list.filter(d => !d.remark); |
|
|
|
|
// 二级:remark 有值 |
|
|
|
|
const children = list.filter(d => d.remark); |
|
|
|
|
return parents.map(p => ({ |
|
|
|
|
label: p.dictLabel, |
|
|
|
|
value: String(p.dictValue), |
|
|
|
|
children: children |
|
|
|
|
.filter(c => String(c.remark) === String(p.dictValue)) |
|
|
|
|
.map(c => ({ |
|
|
|
|
label: c.dictLabel, |
|
|
|
|
value: String(c.dictValue), |
|
|
|
|
})), |
|
|
|
|
})); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// 4. dict 合并 |
|
|
|
|
const dict = computed(() => ({ |
|
|
|
|
...storeDict.value, |
|
|
|
|
...localDict, |
|
|
|
|
sourceTableAndLevel: sourceTableAndLevel.value, |
|
|
|
|
})); |
|
|
|
|
|
|
|
|
|
const HostLevel = { |
|
|
|
|
FIRST: '1', |
|
|
|
|
@ -373,13 +428,16 @@ const props = defineProps({
|
|
|
|
|
modelValue: Boolean, |
|
|
|
|
mode: { type: String, default: "add" }, |
|
|
|
|
model: { type: Object, required: true }, |
|
|
|
|
dict: { type: Object, required: true }, |
|
|
|
|
rules: { type: Object, required: true }, |
|
|
|
|
id: { type: String, default: "" }, |
|
|
|
|
loading: { type: Boolean, default: false }, |
|
|
|
|
negativeId: { type: String, default: "" }, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
const emit = defineEmits(["update:modelValue", "submit"]); |
|
|
|
|
const emit = defineEmits(["update:modelValue", "submit", "updateSuccess"]); |
|
|
|
|
|
|
|
|
|
const formRef = ref(); |
|
|
|
|
const submitLoading = ref(false); |
|
|
|
|
|
|
|
|
|
const visibleProxy = computed({ |
|
|
|
|
get: () => props.modelValue, |
|
|
|
|
@ -388,7 +446,7 @@ const visibleProxy = computed({
|
|
|
|
|
|
|
|
|
|
watch( |
|
|
|
|
() => visibleProxy.value, |
|
|
|
|
(v) => { |
|
|
|
|
async (v) => { |
|
|
|
|
if (v) { |
|
|
|
|
props.model.originIdSkip = false |
|
|
|
|
props.model.responderNameSkip = false |
|
|
|
|
@ -404,6 +462,47 @@ watch(
|
|
|
|
|
duplicateList.value = [] |
|
|
|
|
|
|
|
|
|
getDeparts() |
|
|
|
|
|
|
|
|
|
if (props.mode === 'edit' && (props.id || props.negativeId)) { |
|
|
|
|
try { |
|
|
|
|
const res = await getComplaintCollectionDetail({ id: props.id, negativeId: props.negativeId }); |
|
|
|
|
const r = res?.data ?? res ?? {}; |
|
|
|
|
|
|
|
|
|
props.model.id = r.id ?? ''; |
|
|
|
|
props.model.sourceTable = r.sourceTable ?? ''; |
|
|
|
|
props.model.sourceTableSubOne = r.sourceTableSubOne ?? ''; |
|
|
|
|
props.model.sourcePath = [r.sourceTable, r.sourceTableSubOne].filter(Boolean); |
|
|
|
|
props.model.originId = r.originId ?? ''; |
|
|
|
|
props.model.discoveryTime = r.discoveryTime ?? ''; |
|
|
|
|
props.model.responderName = r.responderName ?? ''; |
|
|
|
|
props.model.responderIdCode = r.responderIdCode ?? ''; |
|
|
|
|
props.model.responderPhone = r.responderPhone ?? ''; |
|
|
|
|
props.model.secondDepartId = r.secondDepartId ?? ''; |
|
|
|
|
props.model.secondDepartName = r.secondDepartName ?? ''; |
|
|
|
|
props.model.thingDesc = r.thingDesc ?? ''; |
|
|
|
|
props.model.repeatt = r.repeatt ?? ''; |
|
|
|
|
props.model.leadApproval = r.leadApproval ?? ''; |
|
|
|
|
props.model.handleMethod = r.handleMethod ?? ''; |
|
|
|
|
props.model.involveProblemIdList = splitToArray(r.involveProblemIdList ?? r.involveProblem); |
|
|
|
|
props.model.tags = splitToArray(r.tags ?? r.tag); |
|
|
|
|
props.model.businessTypeName = r.businessTypeName ?? ''; |
|
|
|
|
props.model.businessTypeCode = r.businessTypeCode ?? ''; |
|
|
|
|
props.model.thingFiles = normalizeThingFiles(r.thingFiles); |
|
|
|
|
props.model.hostLevel = r.hostLevel ?? '3'; |
|
|
|
|
props.model.departId = r.departId ?? ''; |
|
|
|
|
props.model.departName = r.departName ?? ''; |
|
|
|
|
props.model.timeLimit = r.timeLimit ?? ''; |
|
|
|
|
props.model.maxSignDuration = r.maxSignDuration ?? null; |
|
|
|
|
props.model.maxHandleDuration = r.maxHandleDuration ?? null; |
|
|
|
|
props.model.maxExtensionDuration = r.maxExtensionDuration ?? null; |
|
|
|
|
props.model.approvalFlow = r.approvalFlow ?? ''; |
|
|
|
|
props.model.negativeId = r.negativeId ?? ''; |
|
|
|
|
} catch (e) { |
|
|
|
|
console.error("获取详情失败", e); |
|
|
|
|
feedback.notifyError("获取数据失败,请重试"); |
|
|
|
|
visibleProxy.value = false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
@ -470,15 +569,86 @@ watch(
|
|
|
|
|
|
|
|
|
|
function fillFiledName() { |
|
|
|
|
const code = props.model.businessTypeCode; |
|
|
|
|
const hit = props.dict.businessType?.find( |
|
|
|
|
const hit = dict.value?.businessType?.find( // 添加可选链 |
|
|
|
|
(d) => String(d.dictValue) === String(code) |
|
|
|
|
); |
|
|
|
|
props.model.businessTypeName = hit?.dictLabel || ""; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function splitToArray(val) { |
|
|
|
|
if (!val) return []; |
|
|
|
|
if (Array.isArray(val)) return val; |
|
|
|
|
if (typeof val === 'string') { |
|
|
|
|
return val.split(/[,,]/).map(s => s.trim()).filter(Boolean); |
|
|
|
|
} |
|
|
|
|
return []; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function normalizeThingFiles(val) { |
|
|
|
|
if (!val) return []; |
|
|
|
|
if (Array.isArray(val)) return val.map(f => ({...f, loading: false, percent: 100})); |
|
|
|
|
if (typeof val === 'string' && val.trim().startsWith('[')) { |
|
|
|
|
try { |
|
|
|
|
return JSON.parse(val).map(f => ({...f, loading: false, percent: 100})); |
|
|
|
|
} catch {} |
|
|
|
|
} |
|
|
|
|
if (typeof val === 'string') { |
|
|
|
|
return val.split(/[,,]/).map(s => s.trim()).filter(Boolean).map(p => ({ |
|
|
|
|
filePath: p, |
|
|
|
|
fileName: p.split('/').pop() || p, |
|
|
|
|
loading: false, |
|
|
|
|
percent: 100, |
|
|
|
|
})); |
|
|
|
|
} |
|
|
|
|
return []; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async function onSubmit() { |
|
|
|
|
fillFiledName(); |
|
|
|
|
emit("submit"); |
|
|
|
|
|
|
|
|
|
// 添加模式:保持原样,emit 事件让父组件处理 |
|
|
|
|
if (props.mode === 'add') { |
|
|
|
|
emit("submit"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 修改模式:内部处理 API 调用 |
|
|
|
|
submitLoading.value = true; |
|
|
|
|
try { |
|
|
|
|
const body = { |
|
|
|
|
id: props.model.id, |
|
|
|
|
sourceTable: props.model.sourceTable, |
|
|
|
|
sourceTableSubOne: props.model.sourceTableSubOne, |
|
|
|
|
originId: props.model.originId, |
|
|
|
|
originIdSkip: props.model.originIdSkip, |
|
|
|
|
discoveryTime: props.model.discoveryTime, |
|
|
|
|
responderName: props.model.responderName, |
|
|
|
|
responderNameSkip: props.model.responderNameSkip, |
|
|
|
|
responderIdCode: props.model.responderIdCode, |
|
|
|
|
responderIdCodeSkip: props.model.responderIdCodeSkip, |
|
|
|
|
responderPhone: props.model.responderPhone, |
|
|
|
|
responderPhoneSkip: props.model.responderPhoneSkip, |
|
|
|
|
secondDepartId: props.model.secondDepartId, |
|
|
|
|
secondDepartName: props.model.secondDepartName, |
|
|
|
|
thingDesc: props.model.thingDesc, |
|
|
|
|
repeatt: props.model.repeatt, |
|
|
|
|
handleMethod: props.model.handleMethod, |
|
|
|
|
involveProblemIdList: props.model.involveProblemIdList || [], |
|
|
|
|
tags: props.model.tags || [], |
|
|
|
|
businessTypeCode: props.model.businessTypeCode, |
|
|
|
|
businessTypeName: props.model.businessTypeName, |
|
|
|
|
negativeId: props.model.negativeId |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
await updateComplaintCollection(body); |
|
|
|
|
feedback.msgSuccess("修改成功"); |
|
|
|
|
visibleProxy.value = false; |
|
|
|
|
emit("updateSuccess"); |
|
|
|
|
} catch (e) { |
|
|
|
|
console.error("修改失败", e); |
|
|
|
|
} finally { |
|
|
|
|
submitLoading.value = false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 查重 |
|
|
|
|
|