feat: 对接任务调度增删查改功能

This commit is contained in:
jy
2025-06-06 15:23:27 +08:00
parent e34b2bbdae
commit a5c65af987
11 changed files with 2321 additions and 158 deletions

View File

@ -8,6 +8,7 @@
size="small"
:loading="loading"
@click="submit"
v-if="typeOf == 'edit' || typeOf == 'add' || typeOf == 'report'"
>保存</el-button
>
<el-button size="small" @click="close">关闭</el-button>
@ -22,7 +23,11 @@
>
<!-- 上报人员-->
<template #sbRyId>
<el-button @click="openDialog('01', 'ry')">选择</el-button>
<el-button
@click="openDialog('01', 'ry')"
v-if="typeOf == 'edit' || typeOf == 'add'"
>选择</el-button
>
<div class="boxlist">
<MyTable
:tableData="tableDate.ryList"
@ -37,14 +42,23 @@
</template>
<!-- 操作 -->
<template #controls="{ row }">
<el-link type="danger" @click="delDict(row.id)">删除</el-link>
<el-link
type="danger"
@click="delDict(row.id)"
v-if="typeOf == 'edit' || typeOf == 'add'"
>删除</el-link
>
</template>
</MyTable>
</div>
</template>
<!-- 人员标签模型-->
<template #bqList>
<el-button @click="openDialog('01', 'bq')">选择</el-button>
<el-button
@click="openDialog('01', 'bq')"
v-if="typeOf == 'edit' || typeOf == 'add'"
>选择</el-button
>
<div class="boxlist">
<MyTable
:tableData="tableDate.bqList"
@ -65,14 +79,82 @@
</template>
<!-- 操作 -->
<template #controls="{ row }">
<el-link type="danger" @click="delDictItem(row.bqId)"
<el-link
type="danger"
@click="delDictItem(row.bqId)"
v-if="typeOf == 'edit' || typeOf == 'add'"
>删除</el-link
>
</template>
</MyTable>
</div>
</template></FormMessage
>
</template>
<!-- 上报单位代码 -->
<template #sbDwDm>
<el-select
v-model="listQuery.sbDwDm"
placeholder="请选择上报单位代码"
style="width: 240px"
>
<el-option
v-for="item in deptList"
:key="item.value"
:label="item.label"
:value="item.value.toString()"
/>
</el-select>
</template>
<!-- 抄送单位代码 -->
<template #csDwDm>
<el-select
v-model="listQuery.csDwDm"
placeholder="请选择抄送单位代码"
style="width: 240px"
>
<el-option
v-for="item in deptList"
:key="item.value"
:label="item.label"
:value="item.value.toString()"
/>
</el-select>
</template>
<!-- 编制单位代码 -->
<template #bzDwDm>
<el-select
v-model="listQuery.bzDwDm"
placeholder="请选择编制单位代码"
style="width: 240px"
>
<el-option
v-for="item in deptList"
:key="item.value"
:label="item.label"
:value="item.value.toString()"
/>
</el-select>
</template>
<!-- 汇编报刊-->
<template #hbBk>
<div style="border: 1px solid #ccc">
<Toolbar
style="border-bottom: 1px solid #ccc"
:editor="editorRef"
:defaultConfig="toolbarConfig"
mode="default"
/>
<Editor
style="height: 500px; overflow-y: hidden"
v-model="valueHtml"
:defaultConfig="editorConfig"
mode="default"
@onCreated="handleCreated"
/>
</div>
</template>
</FormMessage>
</div>
<!-- 标签列表弹窗 -->
<TagSelectorDialog
@ -103,7 +185,9 @@ import { qcckGet, qcckPost, qcckPut } from "@/api/qcckApi.js";
import * as rule from "@/utils/rules.js";
import TagSelectorDialog from "@/components/aboutTable/TagSelectorDialog.vue";
import DialogList from "./dialogList.vue";
import "@wangeditor/editor/dist/css/style.css"; // 引入 css
import { Editor, Toolbar } from "@wangeditor/editor-for-vue";
import { selectUserDeptPage } from "@/api/user-manage";
import {
ref,
defineExpose,
@ -111,7 +195,10 @@ import {
onMounted,
defineEmits,
getCurrentInstance,
nextTick
nextTick,
shallowRef,
onBeforeUnmount,
watch
} from "vue";
const emit = defineEmits(["updateDate"]);
const props = defineProps({
@ -129,7 +216,9 @@ const {
D_GS_ZDQT_LB,
D_GS_XS_FXDJ,
D_BZ_MZ,
D_GS_XS_LX
D_GS_XS_LX,
D_GS_RLQB_BJSB_BSZT,
D_BZ_SF
} = proxy.$dict(
"D_GS_BQ_LB",
"D_GS_BQ_ZL",
@ -138,7 +227,9 @@ const {
"D_GS_ZDQT_LB",
"D_GS_XS_FXDJ",
"D_BZ_MZ",
"D_GS_XS_LX"
"D_GS_XS_LX",
"D_GS_RLQB_BJSB_BSZT",
"D_BZ_SF"
); //获取字典数据
const ryDialog = ref(false); //选择弹窗
@ -175,63 +266,290 @@ const tableDate = reactive({
]
});
const dialogForm = ref(false); //弹窗
const formData = ref([
{ label: "标签列表", prop: "bqList", type: "slot", width: "80%" },
{
label: "上报人员",
prop: "sbRyId",
type: "slot",
width: "80%"
},
{
label: "上报人员类型",
prop: "sbRyLx",
type: "select",
options: D_GS_XS_SBRYLX,
disabled: true
},
{ label: "线索标题", prop: "xsBt", type: "input" },
const title = ref(""); //弹窗标题
const typeOf = ref(""); //弹窗类型
const formData = ref([]);
const deptList = ref([]); //部门列表
// 更新 formData 的函数
const updateFormData = () => {
const isReport = typeOf.value === "report";
const isReportDetails = typeOf.value === "reportDetails";
const isLeadDetails = typeOf.value === "leadDetails";
// 判断是否应该全部禁用reportDetails 或 leadDetails
const shouldDisableAll = isReportDetails || isLeadDetails;
const baseFields = isReportDetails
? [] // reportDetails 模式下不显示 baseFields
: [
{
label: "标签列表",
prop: "bqList",
type: "slot",
width: "80%",
disabled: isReport || shouldDisableAll // report 或详情模式时禁用
},
{
label: "上报人员",
prop: "sbRyId",
type: "slot",
width: "80%",
disabled: isReport || shouldDisableAll // report 或详情模式时禁用
},
{
label: "上报人员类型",
prop: "sbRyLx",
type: "select",
options: D_GS_XS_SBRYLX,
disabled: true // 原本就禁用的保持不变
},
{
label: "线索标题",
prop: "xsBt",
type: "input",
disabled: isReport || shouldDisableAll // report 或详情模式时禁用
},
{
label: "线索编号",
prop: "xsBh",
type: "input",
disabled: isReport || shouldDisableAll // report 或详情模式时禁用
},
{
label: "线索类型",
prop: "xsLx",
type: "select",
options: D_GS_XS_LX,
disabled: isReport || shouldDisableAll // report 或详情模式时禁用
},
{
label: "线索开始日期",
prop: "xsRqKs",
type: "date",
disabled: isReport || shouldDisableAll // report 或详情模式时禁用
},
{
label: "线索截止日期",
prop: "xsRqJs",
type: "date",
disabled: isReport || shouldDisableAll // report 或详情模式时禁用
},
{
label: "指向地点",
prop: "xsZxdd",
type: "input",
disabled: isReport || shouldDisableAll // report 或详情模式时禁用
},
{
label: "群体名称",
prop: "xsQtmc",
type: "input",
disabled: isReport || shouldDisableAll // report 或详情模式时禁用
},
{
label: "群体类型",
prop: "xsQtlx",
type: "select",
options: D_GS_ZDQT_LB,
disabled: isReport || shouldDisableAll // report 或详情模式时禁用
},
{
label: "风险等级",
prop: "xsFxdj",
type: "select",
options: D_GS_XS_FXDJ,
disabled: isReport || shouldDisableAll // report 或详情模式时禁用
},
{
label: "线索名称",
prop: "xsMc",
type: "input",
disabled: isReport || shouldDisableAll // report 或详情模式时禁用
},
{
label: "线索内容",
prop: "xsNr",
type: "textarea",
width: "100%",
disabled: isReport || shouldDisableAll // report 或详情模式时禁用
}
];
const conditionalFields =
isReport || isReportDetails
? [
{
label: "报送编号",
prop: "bsBh",
type: "input",
disabled: isReportDetails
},
{
label: "报送日期",
prop: "bsRq",
type: "date",
disabled: isReportDetails
},
{
label: "是否初报",
prop: "bsSfCb",
type: "radio",
options: D_BZ_SF,
disabled: isReportDetails
},
{
label: "报送状态",
prop: "bsZt",
type: "select",
options: D_GS_RLQB_BJSB_BSZT,
disabled: isReportDetails
},
{
label: "上报单位",
prop: "sbDwMc",
type: "input",
disabled: isReportDetails
},
{
label: "上报单位代码",
prop: "sbDwDm",
type: "slot",
disabled: isReportDetails
},
{
label: "抄送单位",
prop: "csDwMc",
type: "input",
disabled: isReportDetails
},
{
label: "抄送单位代码",
prop: "csDwDm",
type: "slot",
disabled: isReportDetails
},
{
label: "编制单位",
prop: "bzDwMc",
type: "input",
disabled: isReportDetails
},
{
label: "编制单位代码",
prop: "bzDwDm",
type: "slot",
disabled: isReportDetails
},
{
label: "承办人",
prop: "cbrXm",
type: "input",
disabled: isReportDetails
},
{
label: "承办人身份证号",
prop: "cbrSfzh",
type: "input",
disabled: isReportDetails
},
{
label: "审核人",
prop: "shrXm",
type: "input",
disabled: isReportDetails
},
{
label: "审核人身份证号",
prop: "shrSfzh",
type: "input",
disabled: isReportDetails
},
{
label: "签发人",
prop: "qfrXm",
type: "input",
disabled: isReportDetails
},
{
label: "签发人身份证号",
prop: "qfrSfzh",
type: "input",
disabled: isReportDetails
},
{
label: "报送内容",
prop: "bsNr",
type: "textarea",
width: "100%",
disabled: isReportDetails
},
{
label: "汇编报刊",
prop: "hbBk",
type: "slot",
width: "100%",
disabled: isReportDetails
}
]
: [];
// 最终表单数据
formData.value = [...baseFields, ...conditionalFields];
};
// 编辑器实例,必须用 shallowRef
const editorRef = shallowRef();
// 内容 HTML
const valueHtml = ref("<p>hello</p>");
const toolbarConfig = {};
const editorConfig = ref({ placeholder: "请输入内容...", readOnly: false });
{ label: "线索编号", prop: "xsBh", type: "input" },
{ label: "线索类型", prop: "xsLx", type: "select", options: D_GS_XS_LX },
// { label: "线索来源", prop: "xsly", type: "input" },
{ label: "线索开始日期", prop: "xsRqKs", type: "date" },
{ label: "线索截止日期", prop: "xsRqJs", type: "date" },
{ label: "指向地点", prop: "xsZxdd", type: "input" },
{ label: "群体名称", prop: "xsQtmc", type: "input" },
{ label: "群体类型", prop: "xsQtlx", type: "select", options: D_GS_ZDQT_LB },
{ label: "风险等级", prop: "xsFxdj", type: "select", options: D_GS_XS_FXDJ },
// { label: "是否初报", prop: "qtmc", type: "input" },
{ label: "线索名称", prop: "xsMc", type: "input" },
{ label: "线索内容", prop: "xsNr", type: "textarea", width: "100%" }
// { label: "报送编号", prop: "bsbh", type: "input" },
// { label: "上报单位", prop: "sbdw", type: "input" },
// { label: "抄送单位", prop: "csdw", type: "input" },
// { label: "承办人", prop: "cbr", type: "input" },
// { label: "审核人", prop: "shr", type: "input" },
// { label: "签发人", prop: "qfr", type: "input" }
]);
const listQuery = ref({ sbRyLx: "06", xsLy: "02" }); //表单
const loading = ref(false);
const elform = ref();
const title = ref("");
const tagDialog = ref();
const TYPE_TO_TITLE = {
add: "新增",
report: "上报",
edit: "编辑",
leadDetails: "详情", // 保持原逻辑
reportDetails: "上报详情" // 保持原逻辑
};
const rules = reactive({
xsbt: [{ required: true, message: "请输入线索标题", trigger: "blur" }]
});
const editpeo = ref();
onMounted(() => {});
onMounted(() => {
getdepartmentList();
});
// 获取部门列表
const getdepartmentList = () => {
selectUserDeptPage().then((res) => {
deptList.value = res?.records.map((item) => ({
label: item.deptName,
value: item.deptId
}));
});
};
// 初始化数据
const init = (type, row) => {
dialogForm.value = true;
title.value = type == "add" ? "新增" : "编辑";
title.value = TYPE_TO_TITLE[type] || "新增"; // 安全回退
typeOf.value = type;
if (typeOf == "reportDetails") {
editorRef.value.disable(); // 禁用
editorConfig.readOnly = true; // 禁用
}
if (row) getDataById(row.id);
if (row.sbRyId) getDataRyId(row.sbRyId);
};
// 根据id查询详情
const getDataById = (id) => {
qcckGet({}, "/mosty-gsxt/tbGsxtXs/selectVoById/" + id).then((res) => {
// 根据 typeOf 的值决定调用哪个接口
const apiUrl =
typeOf.value === "reportDetails"
? "/mosty-gsxt/tbGsxtRlqbBjsb/selectVoByXsId/" + id
: "/mosty-gsxt/tbGsxtXs/selectVoById/" + id;
qcckGet({}, apiUrl).then((res) => {
listQuery.value = res;
tableDate.bqList = listQuery.value.bqList;
});
@ -247,12 +565,60 @@ const getDataRyId = (id) => {
// 提交
const submit = () => {
elform.value.submit((data) => {
// 定义仅在 report 模式下需要的字段
const reportFields = [
"bsBh",
"bsNr",
"bsRq",
"bsSfCb",
"bsZt",
"sbDwDm",
"sbDwMc",
"csDwMc",
"csDwDm",
"bzDwMc",
"bzDwDm",
"cbrXm",
"cbrSfzh",
"shrXm",
"shrSfzh",
"qfrXm",
"qfrSfzh",
"hbBk",
"xsId" // 新增 xsId
];
// 准备最终提交数据
let submitData;
if (typeOf.value === "report") {
// report 模式:只提交 reportFields 里的字段 + hbBk富文本
submitData = {
...Object.fromEntries(
Object.entries(data).filter(([key]) => reportFields.includes(key))
),
hbBk: valueHtml.value, // 强制覆盖富文本字段
xsId: listQuery.value.id // 强制添加 xsId
};
} else {
// 非 report 模式:提交除 reportFields 外的所有字段
submitData = {
...Object.fromEntries(
Object.entries(data).filter(([key]) => !reportFields.includes(key))
)
};
}
// 根据 title 决定请求 URL
let url =
title.value == "新增"
? "/mosty-gsxt/tbGsxtXs/save"
: title.value == "上报"
? "/mosty-gsxt/tbGsxtRlqbBjsb/save"
: "/mosty-gsxt/tbGsxtXs/update";
let params = { ...data };
qcckPost(params, url)
// 发起请求
qcckPost(submitData, url)
.then((res) => {
proxy.$message({ type: "success", message: title.value + "成功" });
emit("getList");
@ -309,6 +675,22 @@ const close = () => {
dialogForm.value = false;
loading.value = false;
};
const handleCreated = (editor) => {
editorRef.value = editor; // 记录 editor 实例,重要!
};
// 组件销毁时,也及时销毁编辑器
onBeforeUnmount(() => {
const editor = editorRef.value;
if (editor == null) return;
editor.destroy();
});
// 初始化调用一次
updateFormData();
// 监听 title 变化
watch(title, () => {
updateFormData();
});
defineExpose({ init });
</script>

View File

@ -54,7 +54,26 @@
<el-link size="small" type="success" @click="addEdit('edit', row)"
>编辑</el-link
>
<el-link size="small" type="primary">上报</el-link>
<el-link
size="small"
type="plain"
@click="addEdit('leadDetails', row)"
>线索详情</el-link
>
<el-link
size="small"
type="warning"
@click="addEdit('reportDetails', row)"
v-if="row.sfBjsb == 1"
>上报详情</el-link
>
<el-link
size="small"
type="primary"
@click="addEdit('report', row)"
v-if="row.sfBjsb == 0"
>上报</el-link
>
<el-link size="small" type="danger" @click="deleteRow(row)"
>删除</el-link
>
@ -172,7 +191,8 @@ const pageData = reactive({
reportUnit: "林芝公安局",
reportTime: "2025/05/05",
involvedCount: 2,
status: "未处置"
status: "未处置",
xsZt: "01"
},
{
clueNo: "GBJD01",
@ -220,7 +240,7 @@ const pageData = reactive({
pageSize: 20,
pageCurrent: 1
},
controlsWidth: 220,
controlsWidth: 350,
tableColumn: [
{ label: "线索编号", prop: "xsBh" },
{ label: "线索名称", prop: "xsMc" },