!18 fix(role): 新增角色权限配置ID到DEFAULT_PERMESSION_IDS
* fix(role): 新增角色权限配置ID到DEFAULT_PERMESSION_IDS * chore: 移除.gitignore中.claude忽略规则 * refactor(dj): 移除旧的inspectimprove模块文件
This commit is contained in:
@@ -4,6 +4,7 @@ node_modules
|
|||||||
/dist/
|
/dist/
|
||||||
dist-electron
|
dist-electron
|
||||||
.cache
|
.cache
|
||||||
|
localDoc
|
||||||
|
|
||||||
tests/server/static
|
tests/server/static
|
||||||
tests/server/static/upload
|
tests/server/static/upload
|
||||||
|
|||||||
@@ -1,85 +0,0 @@
|
|||||||
import {defHttp} from "/@/utils/http/axios";
|
|
||||||
import { useMessage } from "/@/hooks/web/useMessage";
|
|
||||||
|
|
||||||
const { createConfirm } = useMessage();
|
|
||||||
|
|
||||||
enum Api {
|
|
||||||
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',
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出api
|
|
||||||
* @param params
|
|
||||||
*/
|
|
||||||
export const getExportUrl = Api.exportXls;
|
|
||||||
/**
|
|
||||||
* 导入api
|
|
||||||
* @param params
|
|
||||||
*/
|
|
||||||
export const getImportUrl = Api.importExcel;
|
|
||||||
/**
|
|
||||||
* 列表接口
|
|
||||||
* @param params
|
|
||||||
*/
|
|
||||||
export const list = (params) =>
|
|
||||||
defHttp.get({url: Api.list, params});
|
|
||||||
/**
|
|
||||||
* 删除
|
|
||||||
*/
|
|
||||||
export const deleteDjInspectImprove = (params,handleSuccess) => {
|
|
||||||
return defHttp.delete({url: Api.deleteDjInspectImprove, params}, {joinParamsToUrl: true}).then(() => {
|
|
||||||
handleSuccess();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 批量删除
|
|
||||||
* @param params
|
|
||||||
*/
|
|
||||||
export const batchDeleteDjInspectImprove = (params, handleSuccess) => {
|
|
||||||
createConfirm({
|
|
||||||
iconType: 'warning',
|
|
||||||
title: '确认删除',
|
|
||||||
content: '是否删除选中数据',
|
|
||||||
okText: '确认',
|
|
||||||
cancelText: '取消',
|
|
||||||
onOk: () => {
|
|
||||||
return defHttp.delete({url: Api.deleteDjInspectImprove, data: params}, {joinParamsToUrl: true}).then(() => {
|
|
||||||
handleSuccess();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 保存或者更新
|
|
||||||
* @param params
|
|
||||||
*/
|
|
||||||
export const saveOrUpdateDict = (params, isUpdate) => {
|
|
||||||
let url = isUpdate ? Api.edit : Api.save;
|
|
||||||
return defHttp.post({url: url, params});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 查询全部树形节点数据
|
|
||||||
* @param params
|
|
||||||
*/
|
|
||||||
export const loadTreeData = (params) =>
|
|
||||||
defHttp.get({url: Api.loadTreeData,params});
|
|
||||||
/**
|
|
||||||
* 查询子节点数据
|
|
||||||
* @param params
|
|
||||||
*/
|
|
||||||
export const getChildList = (params) =>
|
|
||||||
defHttp.get({url: Api.getChildList, params});
|
|
||||||
/**
|
|
||||||
* 批量查询子节点数据
|
|
||||||
* @param params
|
|
||||||
*/
|
|
||||||
export const getChildListBatch = (params) =>
|
|
||||||
defHttp.get({url: Api.getChildListBatch, params},{isTransformResponse:false});
|
|
||||||
@@ -1,252 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
@@ -1,336 +0,0 @@
|
|||||||
<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>
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div style="min-height: 400px">
|
|
||||||
<BasicForm @register="registerForm"></BasicForm>
|
|
||||||
<div style="width: 100%;text-align: center" v-if="!formDisabled">
|
|
||||||
<a-button @click="submitForm" pre-icon="ant-design:check" type="primary">提 交</a-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
import {BasicForm, useForm} from '/@/components/Form/index';
|
|
||||||
import {computed, defineComponent} from 'vue';
|
|
||||||
import {defHttp} from '/@/utils/http/axios';
|
|
||||||
import { propTypes } from '/@/utils/propTypes';
|
|
||||||
import {getBpmFormSchema} from '../DjInspectImprove.data';
|
|
||||||
import {saveOrUpdateDict} from '../DjInspectImprove.api';
|
|
||||||
|
|
||||||
export default defineComponent({
|
|
||||||
name: "DjInspectImproveForm",
|
|
||||||
components:{
|
|
||||||
BasicForm
|
|
||||||
},
|
|
||||||
props:{
|
|
||||||
formData: propTypes.object.def({}),
|
|
||||||
formBpm: propTypes.bool.def(true),
|
|
||||||
},
|
|
||||||
setup(props){
|
|
||||||
const [registerForm, { setFieldsValue, setProps, getFieldsValue }] = useForm({
|
|
||||||
labelWidth: 150,
|
|
||||||
schemas: getBpmFormSchema(props.formData),
|
|
||||||
showActionButtonGroup: false,
|
|
||||||
baseColProps: {span: 24},
|
|
||||||
});
|
|
||||||
|
|
||||||
const formDisabled = computed(()=>{
|
|
||||||
if(props.formData.disabled === false){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
let formData = {};
|
|
||||||
const queryByIdUrl = '/dj/inspectimprove/djInspectImprove/queryById';
|
|
||||||
async function initFormData(){
|
|
||||||
let params = {id: props.formData.dataId};
|
|
||||||
const data = await defHttp.get({url: queryByIdUrl, params});
|
|
||||||
formData = {...data}
|
|
||||||
//设置表单的值
|
|
||||||
await setFieldsValue(formData);
|
|
||||||
//默认是禁用
|
|
||||||
await setProps({disabled: formDisabled.value})
|
|
||||||
}
|
|
||||||
|
|
||||||
async function submitForm() {
|
|
||||||
let data = getFieldsValue();
|
|
||||||
let params = Object.assign({}, formData, data);
|
|
||||||
console.log('表单数据', params)
|
|
||||||
await saveOrUpdateDict(params, true)
|
|
||||||
}
|
|
||||||
|
|
||||||
initFormData();
|
|
||||||
|
|
||||||
return {
|
|
||||||
registerForm,
|
|
||||||
formDisabled,
|
|
||||||
submitForm,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
@@ -1,119 +0,0 @@
|
|||||||
<template>
|
|
||||||
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :width="800" :title="getTitle" @ok="handleSubmit">
|
|
||||||
<BasicForm @register="registerForm" name="DjInspectImproveForm" />
|
|
||||||
</BasicModal>
|
|
||||||
</template>
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import {ref, computed, unref} from 'vue';
|
|
||||||
import {BasicModal, useModalInner} from '/@/components/Modal';
|
|
||||||
import {BasicForm, useForm} from '/@/components/Form';
|
|
||||||
import {formSchema} from '../DjInspectImprove.data';
|
|
||||||
import {loadTreeData, saveOrUpdateDict} from '../DjInspectImprove.api';
|
|
||||||
import { useMessage } from '/@/hooks/web/useMessage';
|
|
||||||
const { createMessage } = useMessage();
|
|
||||||
// 获取emit
|
|
||||||
const emit = defineEmits(['register', 'success']);
|
|
||||||
const isUpdate = ref(true);
|
|
||||||
const isDetail = ref(false);
|
|
||||||
const expandedRowKeys = ref([]);
|
|
||||||
const treeData = ref([]);
|
|
||||||
// 当前编辑的数据
|
|
||||||
let model:Nullable<Recordable> = null;
|
|
||||||
//表单配置
|
|
||||||
const [registerForm, { setProps,resetFields, setFieldsValue, validate, updateSchema, scrollToField }] = useForm({
|
|
||||||
schemas: formSchema,
|
|
||||||
showActionButtonGroup: false,
|
|
||||||
baseColProps: {span: 24},
|
|
||||||
labelCol: {
|
|
||||||
xs: { span: 24 },
|
|
||||||
sm: { span: 4 },
|
|
||||||
},
|
|
||||||
wrapperCol: {
|
|
||||||
xs: { span: 24 },
|
|
||||||
sm: { span: 18 },
|
|
||||||
},
|
|
||||||
});
|
|
||||||
//表单赋值
|
|
||||||
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
|
|
||||||
//重置表单
|
|
||||||
await resetFields();
|
|
||||||
expandedRowKeys.value = [];
|
|
||||||
setModalProps({confirmLoading: false, minHeight: 80 ,showOkBtn: !!!data?.hideFooter});
|
|
||||||
isUpdate.value = !!data?.isUpdate;
|
|
||||||
isDetail.value = !!data?.showFooter;
|
|
||||||
if (data?.record) {
|
|
||||||
model = data.record;
|
|
||||||
//表单赋值
|
|
||||||
await setFieldsValue({
|
|
||||||
...data.record,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
model = null;
|
|
||||||
}
|
|
||||||
//父级节点树信息
|
|
||||||
treeData.value = await loadTreeData({'async': false,'pcode':''});
|
|
||||||
// 隐藏底部时禁用整个表单
|
|
||||||
setProps({ disabled: !!data?.hideFooter })
|
|
||||||
});
|
|
||||||
//设置标题
|
|
||||||
const getTitle = computed(() => (!unref(isUpdate) ? '新增' : !unref(isDetail) ? '详情' : '编辑'));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据pid获取展开的节点
|
|
||||||
* @param pid
|
|
||||||
* @param arr
|
|
||||||
*/
|
|
||||||
function getExpandKeysByPid(pid,arr){
|
|
||||||
if(pid && arr && arr.length>0){
|
|
||||||
for(let i=0;i<arr.length;i++){
|
|
||||||
if(arr[i].key==pid && unref(expandedRowKeys).indexOf(pid)<0){
|
|
||||||
expandedRowKeys.value.push(arr[i].key);
|
|
||||||
getExpandKeysByPid(arr[i]['parentId'],unref(treeData))
|
|
||||||
}else{
|
|
||||||
getExpandKeysByPid(pid,arr[i].children)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//表单提交事件
|
|
||||||
async function handleSubmit() {
|
|
||||||
try {
|
|
||||||
let values = await validate();
|
|
||||||
setModalProps({confirmLoading: true});
|
|
||||||
//提交表单
|
|
||||||
await saveOrUpdateDict(values, isUpdate.value);
|
|
||||||
//关闭弹窗
|
|
||||||
closeModal();
|
|
||||||
//展开的节点信息
|
|
||||||
await getExpandKeysByPid(values['pid'],unref(treeData))
|
|
||||||
//刷新列表(isUpdate:是否编辑;values:表单信息;expandedArr:展开的节点信息)
|
|
||||||
emit('success', {
|
|
||||||
isUpdate: unref(isUpdate),
|
|
||||||
values: {...values},
|
|
||||||
expandedArr: unref(expandedRowKeys).reverse(),
|
|
||||||
// 是否更改了父级节点
|
|
||||||
changeParent: model != null && (model['pid'] != values['pid']),
|
|
||||||
});
|
|
||||||
} catch ({ errorFields }) {
|
|
||||||
if (errorFields) {
|
|
||||||
const firstField = errorFields[0];
|
|
||||||
if (firstField) {
|
|
||||||
scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Promise.reject(errorFields);
|
|
||||||
} finally {
|
|
||||||
setModalProps({confirmLoading: false});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<style lang="less" scoped>
|
|
||||||
/** 时间和数字输入框样式 */
|
|
||||||
:deep(.ant-input-number) {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-calendar-picker) {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
export const ROLE_SCOPE_CONFIG = {
|
export const ROLE_SCOPE_CONFIG = {
|
||||||
DEFAULT_PERMESSION_IDS: '2035916880060223489,2026041610467690430,2026051809451730260',
|
DEFAULT_PERMESSION_IDS: '2035916880060223489,2026041610467690430,2026051809451730260,2059539469575110657',
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user