新建dj巡视整改台账

This commit is contained in:
wsm
2026-05-18 15:44:50 +08:00
parent 0d4d3b0c09
commit e0f77f2e76
5 changed files with 611 additions and 44 deletions
@@ -4,15 +4,15 @@ import { useMessage } from "/@/hooks/web/useMessage";
const { createConfirm } = useMessage();
enum Api {
list = '/rectifylist/djInspectionRectifyList/rootList',
save='/rectifylist/djInspectionRectifyList/add',
edit='/rectifylist/djInspectionRectifyList/edit',
deleteDjInspectionRectifyList = '/rectifylist/djInspectionRectifyList/delete',
importExcel = '/rectifylist/djInspectionRectifyList/importExcel',
exportXls = '/rectifylist/djInspectionRectifyList/exportXls',
loadTreeData = '/rectifylist/djInspectionRectifyList/loadTreeRoot',
getChildList = '/rectifylist/djInspectionRectifyList/childList',
getChildListBatch = '/rectifylist/djInspectionRectifyList/getChildListBatch',
list = '/dj/inspectimprove/djInspectImprove/rootList',
save='/dj/inspectimprove/djInspectImprove/add',
edit='/dj/inspectimprove/djInspectImprove/edit',
deleteDjInspectImprove = '/dj/inspectimprove/djInspectImprove/delete',
importExcel = '/dj/inspectimprove/djInspectImprove/importExcel',
exportXls = '/dj/inspectimprove/djInspectImprove/exportXls',
loadTreeData = '/dj/inspectimprove/djInspectImprove/loadTreeRoot',
getChildList = '/dj/inspectimprove/djInspectImprove/childList',
getChildListBatch = '/dj/inspectimprove/djInspectImprove/getChildListBatch',
}
/**
@@ -34,8 +34,8 @@ export const list = (params) =>
/**
*
*/
export const deleteDjInspectionRectifyList = (params,handleSuccess) => {
return defHttp.delete({url: Api.deleteDjInspectionRectifyList, params}, {joinParamsToUrl: true}).then(() => {
export const deleteDjInspectImprove = (params,handleSuccess) => {
return defHttp.delete({url: Api.deleteDjInspectImprove, params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
@@ -43,7 +43,7 @@ export const deleteDjInspectionRectifyList = (params,handleSuccess) => {
*
* @param params
*/
export const batchDeleteDjInspectionRectifyList = (params, handleSuccess) => {
export const batchDeleteDjInspectImprove = (params, handleSuccess) => {
createConfirm({
iconType: 'warning',
title: '确认删除',
@@ -51,7 +51,7 @@ export const batchDeleteDjInspectionRectifyList = (params, handleSuccess) => {
okText: '确认',
cancelText: '取消',
onOk: () => {
return defHttp.delete({url: Api.deleteDjInspectionRectifyList, data: params}, {joinParamsToUrl: true}).then(() => {
return defHttp.delete({url: Api.deleteDjInspectImprove, data: params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
@@ -0,0 +1,252 @@
import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
import { filterDictTextByCache } from '/@/utils/dict/JDictSelectUtil';
//列表数据
export const columns: BasicColumn[] = [
{
title: '树形表单父id',
align: 'center',
dataIndex: 'pid'
},
{
title: '问题分类',
align: 'center',
dataIndex: 'questionCategory',
customRender: ({text}) => filterDictTextByCache('inspect_improve_type', text),
},
{
title: '面上问题',
align: 'center',
dataIndex: 'mianshangQuestion'
},
{
title: '具体问题',
align: 'left',
dataIndex: 'specicalQuestion'
},
{
title: '巡视建议',
align: 'center',
dataIndex: 'inspectAdvice'
},
{
title: '整改措施',
align: 'center',
dataIndex: 'improveMeasure'
},
{
title: '完成时限',
align: 'center',
dataIndex: 'deadline',
customRender:({text}) =>{
text = !text ? "" : (text.length > 10 ? text.substr(0,10) : text);
return text;
},
},
{
title: '目标节点',
align: 'center',
dataIndex: 'targetNode'
},
{
title: '问题责任领导',
align: 'center',
dataIndex: 'questionResLeader'
},
{
title: '问题责任部门',
align: 'center',
dataIndex: 'questionResDept'
},
{
title: '措施责任领导',
align: 'center',
dataIndex: 'measureResLeader'
},
{
title: '措施责任部门',
align: 'center',
dataIndex: 'measureResDept'
},
{
title: '整改交付成果',
align: 'center',
dataIndex: 'rectificationEvidence'
},
{
title: '成效评价标准',
align: 'center',
dataIndex: 'evaluationCriterion'
},
{
title: '工作进展',
align: 'center',
dataIndex: 'workProgress'
},
{
title: '检查情况',
align: 'center',
dataIndex: 'inspectionStatus'
},
{
title: '监督意见',
align: 'center',
dataIndex: 'supervisoryOpinion'
},
{
title: '措施数量',
align: 'center',
dataIndex: 'measureCount'
},
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
{
label: '树形表单父id',
field: 'pid',
component: 'JTreeSelect',
componentProps: {
dict: "dj_inspect_improve,specical_question,id",
pidField: "pid",
pidValue: "0",
hasChildField: "has_child",
},
},
{
label: '问题分类',
field: 'questionCategory',
component: 'JDictSelectTag',
componentProps: {
dictCode: 'inspect_improve_type',
stringToNumber: true,
},
},
{
label: '面上问题',
field: 'mianshangQuestion',
component: 'Input',
},
{
label: '具体问题',
field: 'specicalQuestion',
component: 'Input',
},
{
label: '巡视建议',
field: 'inspectAdvice',
component: 'Input',
},
{
label: '整改措施',
field: 'improveMeasure',
component: 'Input',
},
{
label: '完成时限',
field: 'deadline',
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD'
},
},
{
label: '目标节点',
field: 'targetNode',
component: 'Input',
},
{
label: '问题责任领导',
field: 'questionResLeader',
component: 'Input',
},
{
label: '问题责任部门',
field: 'questionResDept',
component: 'Input',
},
{
label: '措施责任领导',
field: 'measureResLeader',
component: 'Input',
},
{
label: '措施责任部门',
field: 'measureResDept',
component: 'Input',
},
{
label: '整改交付成果',
field: 'rectificationEvidence',
component: 'Input',
},
{
label: '成效评价标准',
field: 'evaluationCriterion',
component: 'Input',
},
{
label: '工作进展',
field: 'workProgress',
component: 'Input',
},
{
label: '检查情况',
field: 'inspectionStatus',
component: 'Input',
},
{
label: '监督意见',
field: 'supervisoryOpinion',
component: 'Input',
},
{
label: '措施数量',
field: 'measureCount',
component: 'InputNumber',
},
// TODO 主键隐藏字段,目前写死为ID
{
label: '',
field: 'id',
component: 'Input',
show: false
},
];
// 高级查询数据
export const superQuerySchema = {
pid: {title: '树形表单父id',order: 0,view: 'text', type: 'string',},
questionCategory: {title: '问题分类',order: 1,view: 'number', type: 'number',},
mianshangQuestion: {title: '面上问题',order: 2,view: 'text', type: 'string',},
specicalQuestion: {title: '具体问题',order: 3,view: 'text', type: 'string',},
inspectAdvice: {title: '巡视建议',order: 4,view: 'text', type: 'string',},
improveMeasure: {title: '整改措施',order: 5,view: 'text', type: 'string',},
deadline: {title: '完成时限',order: 6,view: 'date', type: 'string',},
targetNode: {title: '目标节点',order: 7,view: 'text', type: 'string',},
questionResLeader: {title: '问题责任领导',order: 8,view: 'text', type: 'string',},
questionResDept: {title: '问题责任部门',order: 9,view: 'text', type: 'string',},
measureResLeader: {title: '措施责任领导',order: 10,view: 'text', type: 'string',},
measureResDept: {title: '措施责任部门',order: 11,view: 'text', type: 'string',},
rectificationEvidence: {title: '整改交付成果',order: 12,view: 'text', type: 'string',},
evaluationCriterion: {title: '成效评价标准',order: 13,view: 'text', type: 'string',},
workProgress: {title: '工作进展',order: 14,view: 'text', type: 'string',},
inspectionStatus: {title: '检查情况',order: 15,view: 'text', type: 'string',},
supervisoryOpinion: {title: '监督意见',order: 16,view: 'text', type: 'string',},
measureCount: {title: '措施数量',order: 17,view: 'number', type: 'number',},
};
/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
return formSchema;
}
@@ -0,0 +1,336 @@
<template>
<div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection" :expandedRowKeys="expandedRowKeys" @expand="handleExpand" @fetch-success="onFetchSuccess">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" v-auth="'dj.inspectimprove:dj_inspect_improve:add'" @click="handleCreate" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" v-auth="'dj.inspectimprove:dj_inspect_improve:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" v-auth="'dj.inspectimprove:dj_inspect_improve:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
<Icon icon="ant-design:delete-outlined"></Icon>
删除
</a-menu-item>
</a-menu>
</template>
<a-button v-auth="'dj.inspectimprove:dj_inspect_improve:deleteBatch'">批量操作
<Icon icon="ant-design:down-outlined"></Icon>
</a-button>
</a-dropdown>
<!-- 高级查询 -->
<super-query :config="superQueryConfig" @search="handleSuperQuery" />
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
</template>
<!--字段回显插槽-->
<template v-slot:bodyCell="{ column, record, index, text }">
</template>
</BasicTable>
<!--字典弹窗-->
<DjInspectImproveModal @register="registerModal" @success="handleSuccess"/>
</div>
</template>
<script lang="ts" name="dj.inspectimprove-djInspectImprove" setup>
//ts语法
import {ref, reactive, computed, unref, toRaw, nextTick} from 'vue';
import {BasicTable, TableAction} from '/@/components/Table';
import {useModal} from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage'
import DjInspectImproveModal from './components/DjInspectImproveModal.vue';
import {columns, searchFormSchema, superQuerySchema} from './DjInspectImprove.data';
import { downloadFile } from '/@/utils/common/renderUtils';
import { useMessage } from '/@/hooks/web/useMessage';
import {list, deleteDjInspectImprove, batchDeleteDjInspectImprove, getExportUrl,getImportUrl, getChildList,getChildListBatch} from './DjInspectImprove.api';
const { createMessage } = useMessage();
const queryParam = reactive<any>({});
const expandedRowKeys = ref([]);
//字典model
const [registerModal, {openModal}] = useModal();
//注册table数据
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
tableProps:{
api: list,
title: '巡视整改台账',
columns,
canResize:false,
isTreeTable: true,
formConfig: {
//labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter:true,
showAdvancedButton:true,
fieldMapToNumber: [
],
fieldMapToTime: [
],
},
actionColumn: {
width: 240,
fixed:'right'
},
beforeFetch: (params) => {
params.hasQuery = "true";
return Object.assign(params, queryParam);
},
},
exportConfig: {
name:"巡视整改台账",
url: getExportUrl,
params: queryParam,
},
importConfig: {
url: getImportUrl,
success: importSuccess
},
})
const [registerTable, {reload, collapseAll, updateTableDataRecord, findTableDataRecord,getDataSource},{ rowSelection, selectedRowKeys }] = tableContext
// 高级查询配置
const superQueryConfig = reactive(superQuerySchema);
/**
* 高级查询事件
*/
function handleSuperQuery(params) {
Object.keys(params).map((k) => {
queryParam[k] = params[k];
});
reload();
}
/**
* 新增事件
*/
function handleCreate() {
openModal(true, {
isUpdate: false,
});
}
/**
* 编辑事件
*/
async function handleEdit(record) {
openModal(true, {
record,
isUpdate: true,
});
}
/**
* 详情
*/
async function handleDetail(record) {
openModal(true, {
record,
isUpdate: true,
hideFooter: true,
});
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteDjInspectImprove({id: record.id}, importSuccess);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
const ids = selectedRowKeys.value.filter(item => !item.includes('loadChild'))
await batchDeleteDjInspectImprove({id: ids}, importSuccess);
}
/**
* 导入
*/
function importSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 添加下级
*/
function handleAddSub(record) {
openModal(true, {
record,
isUpdate: false,
});
}
/**
* 成功回调
*/
async function handleSuccess({isUpdate, values, expandedArr, changeParent}) {
if (isUpdate) {
if (changeParent) {
reload();
} else {
let data = await list({ id: values.id, pageSize: 1, pageNo: 1, pid: values['pid'] });
if (data && data.records && data.records.length > 0) {
// 编辑回调
updateTableDataRecord(values.id, data.records[0]);
}else{
updateTableDataRecord(values.id, values);
}
}
} else {
if(!values['id'] || !values['pid']){
//新增根节点
reload();
}else{
//新增子集
expandedRowKeys.value = [];
for (let key of unref(expandedArr)) {
await expandTreeNode(key)
}
}
}
}
/**
* 接口请求成功后回调
*/
function onFetchSuccess(result) {
getDataByResult(result.items)&&loadDataByExpandedRows();
}
/**
* 根据已展开的行查询数据(用于保存后刷新时异步加载子级的数据)
*/
async function loadDataByExpandedRows() {
if (unref(expandedRowKeys).length > 0) {
const res = await getChildListBatch({ parentIds: unref(expandedRowKeys).join(',')});
if (res.success && res.result.records.length>0) {
//已展开的数据批量子节点
let records = res.result.records
const listMap = new Map();
for (let item of records) {
let pid = item['pid'];
if (unref(expandedRowKeys).includes(pid)) {
let mapList = listMap.get(pid);
if (mapList == null) {
mapList = [];
}
mapList.push(item);
listMap.set(pid, mapList);
}
}
let childrenMap = listMap;
let fn = (list) => {
if(list) {
list.forEach(data => {
if (unref(expandedRowKeys).includes(data.id)) {
data.children = getDataByResult(childrenMap.get(data.id))
fn(data.children)
}
})
}
};
fn(getDataSource())
}
}
}
/**
* 处理数据集
*/
function getDataByResult(result){
if(result && result.length>0){
return result.map(item=>{
//判断是否标记了带有子节点
if(item["hasChild"]=='1'){
let loadChild = { id: item.id+'_loadChild', name: 'loading...', isLoading: true }
item.children = [loadChild]
}
return item
})
}
}
/**
*树节点展开合并
* */
async function handleExpand(expanded, record) {
// 判断是否是展开状态,展开状态(expanded)并且存在子集(children)并且未加载过(isLoading)的就去查询子节点数据
if (expanded) {
expandedRowKeys.value.push(record.id)
if (record.children.length > 0 && !!record.children[0].isLoading) {
let result = await getChildList({pid: record.id});
result=result.records?result.records:result;
if (result && result.length > 0) {
record.children = getDataByResult(result);
} else {
record.children = null
record.hasChild = '0'
}
}
} else {
let keyIndex = expandedRowKeys.value.indexOf(record.id)
if (keyIndex >= 0) {
expandedRowKeys.value.splice(keyIndex, 1);
}
}
}
/**
*操作表格后处理树节点展开合并
* */
async function expandTreeNode(key) {
let record = findTableDataRecord(key)
expandedRowKeys.value.push(key);
let result = await getChildList({pid: key});
if (result && result.length > 0) {
record.children = getDataByResult(result);
} else {
record.children = null
record.hasChild = '0'
}
updateTableDataRecord(key, record);
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
auth: 'dj.inspectimprove:dj_inspect_improve:edit'
},
{
label: '添加下级',
onClick: handleAddSub.bind(null, {pid: record.id}),
}
]
}
/**
* 下拉操作栏
*/
function getDropDownAction(record){
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
}, {
label: '删除',
popConfirm: {
title: '确定删除吗?',
confirm: handleDelete.bind(null, record),
placement: 'topLeft'
},
auth: 'dj.inspectimprove:dj_inspect_improve:delete'
}
]
}
</script>
<style lang="less" scoped>
:deep(.ant-picker),:deep(.ant-input-number){
width: 100%;
}
</style>
@@ -12,11 +12,11 @@
import {computed, defineComponent} from 'vue';
import {defHttp} from '/@/utils/http/axios';
import { propTypes } from '/@/utils/propTypes';
import {getBpmFormSchema} from '../DjInspectionRectifyList.data';
import {saveOrUpdateDict} from '../DjInspectionRectifyList.api';
import {getBpmFormSchema} from '../DjInspectImprove.data';
import {saveOrUpdateDict} from '../DjInspectImprove.api';
export default defineComponent({
name: "DjInspectionRectifyListForm",
name: "DjInspectImproveForm",
components:{
BasicForm
},
@@ -40,7 +40,7 @@
});
let formData = {};
const queryByIdUrl = '/rectifylist/djInspectionRectifyList/queryById';
const queryByIdUrl = '/dj/inspectimprove/djInspectImprove/queryById';
async function initFormData(){
let params = {id: props.formData.dataId};
const data = await defHttp.get({url: queryByIdUrl, params});
@@ -1,19 +1,15 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :width="800" :title="getTitle" @ok="handleSubmit">
<BasicForm @register="registerForm" name="DjInspectionRectifyListForm" />
<BasicForm @register="registerForm" name="DjInspectImproveForm" />
</BasicModal>
</template>
<script lang="ts" setup>
import {ref, computed, unref, reactive} from 'vue';
import {ref, computed, unref} from 'vue';
import {BasicModal, useModalInner} from '/@/components/Modal';
import {BasicForm, useForm} from '/@/components/Form';
import {formSchema} from '../DjInspectionRectifyList.data';
import {loadTreeData, saveOrUpdateDict} from '../DjInspectionRectifyList.api';
import {formSchema} from '../DjInspectImprove.data';
import {loadTreeData, saveOrUpdateDict} from '../DjInspectImprove.api';
import { useMessage } from '/@/hooks/web/useMessage';
import { getDateByPicker } from '/@/utils';
//
const fieldPickers = reactive({
});
const { createMessage } = useMessage();
// emit
const emit = defineEmits(['register', 'success']);
@@ -83,8 +79,6 @@
async function handleSubmit() {
try {
let values = await validate();
//
changeDateValue(values);
setModalProps({confirmLoading: true});
//
await saveOrUpdateDict(values, isUpdate.value);
@@ -112,21 +106,6 @@
setModalProps({confirmLoading: false});
}
}
/**
* 处理日期值
* @param formData 表单数据
*/
const changeDateValue = (formData) => {
if (formData && fieldPickers) {
for (let key in fieldPickers) {
if (formData[key]) {
formData[key] = getDateByPicker(formData[key], fieldPickers[key]);
}
}
}
};
</script>
<style lang="less" scoped>
/** 时间和数字输入框样式 */