Browse Source

feat:投诉举报修改和删除接入综合查询

feature/tsjb-1.0
buaixuexideshitongxue 4 weeks ago
parent
commit
ce74335f24
  1. 10
      src/api/data/complaintCollection.ts
  2. 190
      src/components/data/complaintformdialog.vue
  3. 127
      src/views/data/ComplaintCollection.vue
  4. 36
      src/views/work/Query.vue

10
src/api/data/complaintCollection.ts

@ -127,4 +127,14 @@ export function forceTermination(body) {
}); });
} }
/**
*
*/
export function getComplaintCollectionDetail(body) {
return request.post({
url: `/data/complaintCollection/getComplaintCollectionDetail`,
body
});
}

190
src/components/data/complaintformdialog.vue

@ -208,7 +208,7 @@
:label="item.dictLabel" :label="item.dictLabel"
> >
<!-- 复选框展示 --> <!-- 复选框展示 -->
<el-checkbox :model-value="model.involveProblemIdList.includes(item.dictValue)"> <el-checkbox :model-value="(model.involveProblemIdList || []).includes(item.dictValue)">
{{ item.dictLabel }} {{ item.dictLabel }}
</el-checkbox> </el-checkbox>
</el-option> </el-option>
@ -328,7 +328,7 @@
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
<el-button @click="visibleProxy = false" size="large">取消</el-button> <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' ? '添加' : '修改' }} {{ mode === 'add' ? '添加' : '修改' }}
</el-button> </el-button>
</div> </div>
@ -352,14 +352,69 @@
<script setup> <script setup>
import {computed, ref, watch} from "vue"; import {computed, ref, watch} from "vue";
import {maileRepeatt} from "@/api/data/complaintCollection.ts"; import {maileRepeatt, getComplaintCollectionDetail, updateComplaintCollection} from "@/api/data/complaintCollection.ts";
import { WarningFilled } from '@element-plus/icons-vue'
import dayjs from "dayjs"; import dayjs from "dayjs";
import feedback from "@/utils/feedback.ts"; import feedback from "@/utils/feedback.ts";
import Complaint_detail from "@/components/data/complaint_detail.vue";
import DuplicateDrawerWithDetail from "@/views/data/DuplicateDrawerWithDetail.vue"; import DuplicateDrawerWithDetail from "@/views/data/DuplicateDrawerWithDetail.vue";
import useUserStore from "@/stores/modules/user.ts"; import useUserStore from "@/stores/modules/user.ts";
import {secondList, listByFirstHost} from "@/api/system/depart"; 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 = { const HostLevel = {
FIRST: '1', FIRST: '1',
@ -373,13 +428,16 @@ const props = defineProps({
modelValue: Boolean, modelValue: Boolean,
mode: { type: String, default: "add" }, mode: { type: String, default: "add" },
model: { type: Object, required: true }, model: { type: Object, required: true },
dict: { type: Object, required: true },
rules: { 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 formRef = ref();
const submitLoading = ref(false);
const visibleProxy = computed({ const visibleProxy = computed({
get: () => props.modelValue, get: () => props.modelValue,
@ -388,7 +446,7 @@ const visibleProxy = computed({
watch( watch(
() => visibleProxy.value, () => visibleProxy.value,
(v) => { async (v) => {
if (v) { if (v) {
props.model.originIdSkip = false props.model.originIdSkip = false
props.model.responderNameSkip = false props.model.responderNameSkip = false
@ -404,6 +462,47 @@ watch(
duplicateList.value = [] duplicateList.value = []
getDeparts() 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() { function fillFiledName() {
const code = props.model.businessTypeCode; const code = props.model.businessTypeCode;
const hit = props.dict.businessType?.find( const hit = dict.value?.businessType?.find( //
(d) => String(d.dictValue) === String(code) (d) => String(d.dictValue) === String(code)
); );
props.model.businessTypeName = hit?.dictLabel || ""; 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() { async function onSubmit() {
fillFiledName(); 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;
}
} }
// //

127
src/views/data/ComplaintCollection.vue

@ -377,7 +377,6 @@
v-model="addShow" v-model="addShow"
mode="add" mode="add"
:model="addForm" :model="addForm"
:dict="dict"
:rules="addRules" :rules="addRules"
@submit="submitAdd" @submit="submitAdd"
/> />
@ -387,8 +386,9 @@
v-model="updateShow" v-model="updateShow"
mode="edit" mode="edit"
:model="updateForm" :model="updateForm"
:dict="dict"
:rules="addRules" :rules="addRules"
:id="updateId"
:loading="updateLoading"
@submit="submitUpdate" @submit="submitUpdate"
/> />
@ -622,114 +622,17 @@ watch(
// region // region
const updateShow = ref(false); const updateShow = ref(false);
const updateId = ref("");
const updateLoading = ref(false);
const updateForm = ref({ const updateForm = ref({
// 3
sourcePath: [],
sourceTable: "",
sourceTableSubOne: "",
// v-model undefined
id: "", id: "",
originId: "", });
discoveryTime: "",
responderName: "",
responderIdCode: "",
responderPhone: "",
secondDepartId: "",
secondDepartName: "",
thingDesc: "",
repeatt: "",
leadApproval: "",
handleMethod: "",
involveProblemIdList: [],
tags: [],
thingFiles: [],
//
hostLevel: '3',
departId: '',
departName: '',
//
timeLimit: '',
maxSignDuration: null,
maxHandleDuration: null,
maxExtensionDuration: null,
//
approvalFlow: '',
})
function normalizeThingFiles(val) {
if (!val) return []
if (Array.isArray(val)) return val
// JSON
if (typeof val === 'string' && val.trim().startsWith('[')) {
try {
return JSON.parse(val)
} catch { /* ignore */
}
}
// "path1,path2"
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 []
}
// //
const handleUpdate = async (row) => { const handleUpdate = (row) => {
const r = JSON.parse(JSON.stringify(row || {})) debugger
console.log(r) updateId.value = row.id;
updateForm.value = { updateShow.value = true;
// id
id: r.id ?? '',
// cascader sourcePath
sourceTable: r.sourceTable ?? '',
sourceTableSubOne: r.sourceTableSubOne ?? '',
sourcePath: [r.sourceTable, r.sourceTableSubOne].filter(Boolean),
//
originId: r.originId ?? '',
discoveryTime: r.discoveryTime ?? '',
responderName: r.responderName ?? '',
responderIdCode: r.responderIdCode ?? '',
responderPhone: r.responderPhone ?? '',
secondDepartId: r.secondDepartId ?? '',
secondDepartName: r.secondDepartName ?? '',
thingDesc: r.thingDesc ?? '',
repeatt: r.repeatt ?? '',
leadApproval: r.leadApproval ?? '',
handleMethod: r.handleMethod ?? '',
//
involveProblemIdList: splitToArray(r.involveProblemIdList ?? r.involveProblem),
tags: splitToArray(r.tags ?? r.tag),
businessTypeName: r.businessTypeName ?? '',
businessTypeCode: r.businessTypeCode ?? '',
thingFiles: normalizeThingFiles(r.thingFiles).map(f => ({
...f,
loading: false,
percent: 100,
uid: f.uid || `${f.filePath}-${Math.random()}`,
})),
//
hostLevel: r.hostLevel ?? '3',
departId: r.departId ?? '',
departName: r.departName ?? '',
//
timeLimit: r.timeLimit ?? '',
maxSignDuration: r.maxSignDuration ?? null,
maxHandleDuration: r.maxHandleDuration ?? null,
maxExtensionDuration: r.maxExtensionDuration ?? null,
//
approvalFlow: r.approvalFlow ?? '',
negativeId: r.negativeId ?? ''
};
updateShow.value = true
} }
const submitUpdate = async () => { const submitUpdate = async () => {
const body = { const body = {
@ -743,18 +646,6 @@ const submitUpdate = async () => {
} }
} }
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 []
}
// endregion // endregion

36
src/views/work/Query.vue

@ -1106,6 +1106,17 @@
</footer> </footer>
</el-dialog> </el-dialog>
<data-complaintformdialog
v-model="complaintEditShow"
mode="edit"
:negativeId="complaintEditId"
:model="complaintModel"
:dict="dict"
:rules="complaintRules"
@updateSuccess="getList"
/>
</template> </template>
<script setup> <script setup>
import moment from "moment"; import moment from "moment";
@ -1128,6 +1139,7 @@ import {computed, watch} from "vue";
import {getListData} from "@/api/superviseReport/superviseReport"; import {getListData} from "@/api/superviseReport/superviseReport";
import {ArrowDown, ArrowUp} from "@element-plus/icons-vue"; import {ArrowDown, ArrowUp} from "@element-plus/icons-vue";
import useUserStore from "@/stores/modules/user.ts"; import useUserStore from "@/stores/modules/user.ts";
import {delComplaintCollection} from "@/api/data/complaintCollection.ts";
const userStore = useUserStore(); const userStore = useUserStore();
const catchStore = useCatchStore(); const catchStore = useCatchStore();
@ -1288,8 +1300,15 @@ async function handleReportGenerate() {
async function handleDel(row) { async function handleDel(row) {
await feedback.confirm(`确定删除该数据?`); await feedback.confirm(`确定删除该数据?`);
if (row.sourceType == '2') {
const body = {
negativeId: row.id
}
await delComplaintCollection(body)
}else {
await delNegative(row.id); await delNegative(row.id);
}
feedback.msgSuccess("操作成功"); feedback.msgSuccess("操作成功");
getList(); getList();
} }
@ -1299,7 +1318,13 @@ const formData = ref({});
const formRef = ref(null); const formRef = ref(null);
function handleEdit(row) { function handleEdit(row) {
console.log(row); debugger
console.log(row.sourceType);
if (row.sourceType == '2') {
complaintEditShow.value = true;
complaintEditId.value = row.id;
complaintModel.value = { ...row };
}else {
editShow.value = true; editShow.value = true;
formData.value = { ...row }; formData.value = { ...row };
if (row.involveProblem) { if (row.involveProblem) {
@ -1308,6 +1333,7 @@ function handleEdit(row) {
} else { } else {
formData.value.involveProblem = []; formData.value.involveProblem = [];
} }
}
} }
async function handleSumbit() { async function handleSumbit() {
@ -1399,6 +1425,12 @@ function handleChangeProblem(node, problem) {
problem.twoLevelContent = node.parent.label; problem.twoLevelContent = node.parent.label;
} }
} }
//
const complaintEditShow = ref(false);
const complaintEditId = ref("");
const complaintModel = ref({});
const complaintRules = ref({}); //
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
:deep() { :deep() {

Loading…
Cancel
Save