删除原有测试流程
This commit is contained in:
@@ -1,64 +0,0 @@
|
|||||||
import {defHttp} from '/@/utils/http/axios';
|
|
||||||
import { useMessage } from "/@/hooks/web/useMessage";
|
|
||||||
|
|
||||||
const { createConfirm } = useMessage();
|
|
||||||
|
|
||||||
enum Api {
|
|
||||||
list = '/check/djCheck/list',
|
|
||||||
save='/check/djCheck/add',
|
|
||||||
edit='/check/djCheck/edit',
|
|
||||||
deleteOne = '/check/djCheck/delete',
|
|
||||||
deleteBatch = '/check/djCheck/deleteBatch',
|
|
||||||
importExcel = '/check/djCheck/importExcel',
|
|
||||||
exportXls = '/check/djCheck/exportXls',
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 导出api
|
|
||||||
* @param params
|
|
||||||
*/
|
|
||||||
export const getExportUrl = Api.exportXls;
|
|
||||||
/**
|
|
||||||
* 导入api
|
|
||||||
*/
|
|
||||||
export const getImportUrl = Api.importExcel;
|
|
||||||
/**
|
|
||||||
* 列表接口
|
|
||||||
* @param params
|
|
||||||
*/
|
|
||||||
export const list = (params) =>
|
|
||||||
defHttp.get({url: Api.list, params});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除单个
|
|
||||||
*/
|
|
||||||
export const deleteOne = (params,handleSuccess) => {
|
|
||||||
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
|
|
||||||
handleSuccess();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 批量删除
|
|
||||||
* @param params
|
|
||||||
*/
|
|
||||||
export const batchDelete = (params, handleSuccess) => {
|
|
||||||
createConfirm({
|
|
||||||
iconType: 'warning',
|
|
||||||
title: '确认删除',
|
|
||||||
content: '是否删除选中数据',
|
|
||||||
okText: '确认',
|
|
||||||
cancelText: '取消',
|
|
||||||
onOk: () => {
|
|
||||||
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
|
|
||||||
handleSuccess();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 保存或者更新
|
|
||||||
* @param params
|
|
||||||
*/
|
|
||||||
export const saveOrUpdate = (params, isUpdate) => {
|
|
||||||
let url = isUpdate ? Api.edit : Api.save;
|
|
||||||
return defHttp.post({url: url, params});
|
|
||||||
}
|
|
||||||
@@ -1,170 +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';
|
|
||||||
//列表数据
|
|
||||||
export const columns: BasicColumn[] = [
|
|
||||||
{
|
|
||||||
title: '序号',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'sortNo',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '一级指标',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'primaryIndex',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '评价要点',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'evalPoints',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '评价内容',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'evalContent',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '问题表现',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'problemManifestation',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '整改措施',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'rectificationMeasures',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '完成时限',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'completionDeadline',
|
|
||||||
customRender: ({ text }) => {
|
|
||||||
text = !text ? '' : text.length > 10 ? text.substr(0, 10) : text;
|
|
||||||
return text;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '责任部门',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'responsibleDept_dictText',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '完成情况',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'completionStatus',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '是否可发起',
|
|
||||||
width: 150,
|
|
||||||
dataIndex: 'isLaunchable_dictText',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
//查询数据
|
|
||||||
export const searchFormSchema: FormSchema[] = [];
|
|
||||||
//表单数据
|
|
||||||
export const formSchema: FormSchema[] = [
|
|
||||||
{
|
|
||||||
label: '序号',
|
|
||||||
field: 'sortNo',
|
|
||||||
component: 'InputNumber',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '一级指标',
|
|
||||||
field: 'primaryIndex',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '评价要点',
|
|
||||||
field: 'evalPoints',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '评价内容',
|
|
||||||
field: 'evalContent',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '问题表现',
|
|
||||||
field: 'problemManifestation',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '整改措施',
|
|
||||||
field: 'rectificationMeasures',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '完成时限',
|
|
||||||
field: 'completionDeadline',
|
|
||||||
component: 'DatePicker',
|
|
||||||
componentProps: {
|
|
||||||
valueFormat: 'YYYY-MM-DD',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '责任部门',
|
|
||||||
field: 'responsibleDept',
|
|
||||||
component: 'JSelectDept',
|
|
||||||
componentProps: ({ formActionType, formModel }) => {
|
|
||||||
return {
|
|
||||||
sync: false,
|
|
||||||
checkStrictly: true,
|
|
||||||
defaultExpandLevel: 2,
|
|
||||||
|
|
||||||
onSelect: (options, values) => {
|
|
||||||
const { updateSchema } = formActionType;
|
|
||||||
//所属部门修改后更新负责部门下拉框数据
|
|
||||||
updateSchema([
|
|
||||||
{
|
|
||||||
field: 'departIds',
|
|
||||||
componentProps: { options },
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
//update-begin---author:wangshuai---date:2024-05-11---for:【issues/1222】用户编辑界面“所属部门”与“负责部门”联动出错整---
|
|
||||||
if (!values) {
|
|
||||||
formModel.departIds = [];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//update-end---author:wangshuai---date:2024-05-11---for:【issues/1222】用户编辑界面“所属部门”与“负责部门”联动出错整---
|
|
||||||
//所属部门修改后更新负责部门数据
|
|
||||||
formModel.departIds && (formModel.departIds = formModel.departIds.filter((item) => values.value.indexOf(item) > -1));
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '完成情况',
|
|
||||||
field: 'completionStatus',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
// TODO 主键隐藏字段,目前写死为ID
|
|
||||||
{
|
|
||||||
label: '',
|
|
||||||
field: 'id',
|
|
||||||
component: 'Input',
|
|
||||||
show: false,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
// 高级查询数据
|
|
||||||
export const superQuerySchema = {
|
|
||||||
sortNo: { title: '序号', order: 0, view: 'number', type: 'number' },
|
|
||||||
primaryIndex: { title: '一级指标', order: 1, view: 'text', type: 'string' },
|
|
||||||
evalPoints: { title: '评价要点', order: 2, view: 'text', type: 'string' },
|
|
||||||
evalContent: { title: '评价内容', order: 3, view: 'text', type: 'string' },
|
|
||||||
problemManifestation: { title: '问题表现', order: 4, view: 'text', type: 'string' },
|
|
||||||
rectificationMeasures: { title: '整改措施', order: 5, view: 'text', type: 'string' },
|
|
||||||
completionDeadline: { title: '完成时限', order: 6, view: 'date', type: 'string' },
|
|
||||||
responsibleDept: { title: '责任部门', order: 7, view: 'text', type: 'string' },
|
|
||||||
completionStatus: { title: '完成情况', order: 8, view: 'text', type: 'string' },
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 流程表单调用这个方法获取formSchema
|
|
||||||
* @param param
|
|
||||||
*/
|
|
||||||
export function getBpmFormSchema(_formData): FormSchema[] {
|
|
||||||
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
|
|
||||||
return formSchema;
|
|
||||||
}
|
|
||||||
@@ -1,223 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
<!--引用表格-->
|
|
||||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
|
||||||
<!--插槽:table标题-->
|
|
||||||
<template #tableTitle>
|
|
||||||
<a-button type="primary" v-auth="'check:dj_check:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增 </a-button>
|
|
||||||
<a-button type="primary" v-auth="'check:dj_check:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出 </a-button>
|
|
||||||
<j-upload-button type="primary" v-auth="'check:dj_check: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="'check:dj_check:deleteBatch'"
|
|
||||||
>批量操作
|
|
||||||
<Icon icon="mdi:chevron-down"></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>
|
|
||||||
<!-- 表单区域 -->
|
|
||||||
<DjCheckModal @register="registerModal" @success="handleSuccess"></DjCheckModal>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" name="check-djCheck" setup>
|
|
||||||
import { ref, reactive, computed, unref } from 'vue';
|
|
||||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
|
||||||
import { useModal } from '/@/components/Modal';
|
|
||||||
import { useListPage } from '/@/hooks/system/useListPage';
|
|
||||||
import DjCheckModal from './components/DjCheckModal.vue';
|
|
||||||
import { columns, searchFormSchema, superQuerySchema } from './DjCheck.data';
|
|
||||||
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './DjCheck.api';
|
|
||||||
import { downloadFile } from '/@/utils/common/renderUtils';
|
|
||||||
import { useUserStore } from '/@/store/modules/user';
|
|
||||||
import { useMessage } from '/@/hooks/web/useMessage';
|
|
||||||
import { getDateByPicker } from '/@/utils';
|
|
||||||
//日期个性化选择
|
|
||||||
const fieldPickers = reactive({});
|
|
||||||
const queryParam = reactive<any>({});
|
|
||||||
const checkedKeys = ref<Array<string | number>>([]);
|
|
||||||
const userStore = useUserStore();
|
|
||||||
const { createMessage } = useMessage();
|
|
||||||
//注册model
|
|
||||||
const [registerModal, { openModal }] = useModal();
|
|
||||||
//注册table数据
|
|
||||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
|
||||||
tableProps: {
|
|
||||||
title: '党建检查台账',
|
|
||||||
api: list,
|
|
||||||
columns,
|
|
||||||
canResize: true,
|
|
||||||
formConfig: {
|
|
||||||
//labelWidth: 120,
|
|
||||||
schemas: searchFormSchema,
|
|
||||||
autoSubmitOnEnter: true,
|
|
||||||
showAdvancedButton: true,
|
|
||||||
fieldMapToNumber: [],
|
|
||||||
fieldMapToTime: [],
|
|
||||||
},
|
|
||||||
actionColumn: {
|
|
||||||
width: 120,
|
|
||||||
fixed: 'right',
|
|
||||||
},
|
|
||||||
beforeFetch: (params) => {
|
|
||||||
if (params && fieldPickers) {
|
|
||||||
for (let key in fieldPickers) {
|
|
||||||
if (params[key]) {
|
|
||||||
params[key] = getDateByPicker(params[key], fieldPickers[key]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Object.assign(params, queryParam);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
exportConfig: {
|
|
||||||
name: '党建检查台账',
|
|
||||||
url: getExportUrl,
|
|
||||||
params: queryParam,
|
|
||||||
},
|
|
||||||
importConfig: {
|
|
||||||
url: getImportUrl,
|
|
||||||
success: handleSuccess,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
|
||||||
|
|
||||||
// 高级查询配置
|
|
||||||
const superQueryConfig = reactive(superQuerySchema);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 高级查询事件
|
|
||||||
*/
|
|
||||||
function handleSuperQuery(params) {
|
|
||||||
Object.keys(params).map((k) => {
|
|
||||||
queryParam[k] = params[k];
|
|
||||||
});
|
|
||||||
reload();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增事件
|
|
||||||
*/
|
|
||||||
function handleAdd() {
|
|
||||||
openModal(true, {
|
|
||||||
isUpdate: false,
|
|
||||||
showFooter: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 编辑事件
|
|
||||||
*/
|
|
||||||
function handleEdit(record: Recordable) {
|
|
||||||
openModal(true, {
|
|
||||||
record,
|
|
||||||
isUpdate: true,
|
|
||||||
showFooter: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 详情
|
|
||||||
*/
|
|
||||||
function handleDetail(record: Recordable) {
|
|
||||||
openModal(true, {
|
|
||||||
record,
|
|
||||||
isUpdate: true,
|
|
||||||
showFooter: false,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除事件
|
|
||||||
*/
|
|
||||||
async function handleDelete(record) {
|
|
||||||
await deleteOne({ id: record.id }, handleSuccess);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除事件
|
|
||||||
*/
|
|
||||||
async function batchHandleDelete() {
|
|
||||||
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 成功回调
|
|
||||||
*/
|
|
||||||
function handleSuccess() {
|
|
||||||
(selectedRowKeys.value = []) && reload();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 操作栏
|
|
||||||
*/
|
|
||||||
function getTableAction(record) {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
label: '编辑',
|
|
||||||
onClick: handleEdit.bind(null, record),
|
|
||||||
auth: 'check:dj_check:edit',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '发起流程',
|
|
||||||
onClick: handleProcessLaunch(),
|
|
||||||
disabled: record.isLaunch !== 1,
|
|
||||||
//auth: 'rectifylist:dj_inspection_rectify_list:edit',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 发起流程
|
|
||||||
*/
|
|
||||||
function handleProcessLaunch() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 下拉操作栏
|
|
||||||
*/
|
|
||||||
function getDropDownAction(record) {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
label: '详情',
|
|
||||||
onClick: handleDetail.bind(null, record),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '删除',
|
|
||||||
popConfirm: {
|
|
||||||
title: '是否确认删除',
|
|
||||||
confirm: handleDelete.bind(null, record),
|
|
||||||
placement: 'topLeft',
|
|
||||||
},
|
|
||||||
auth: 'check:dj_check: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 '../DjCheck.data';
|
|
||||||
import { saveOrUpdate } from '../DjCheck.api';
|
|
||||||
|
|
||||||
export default defineComponent({
|
|
||||||
name: 'DjCheckForm',
|
|
||||||
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 = '/check/djCheck/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 saveOrUpdate(params, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
initFormData();
|
|
||||||
|
|
||||||
return {
|
|
||||||
registerForm,
|
|
||||||
formDisabled,
|
|
||||||
submitForm,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
<template>
|
|
||||||
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit">
|
|
||||||
<BasicForm @register="registerForm" name="DjCheckForm" />
|
|
||||||
</BasicModal>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { ref, computed, unref, reactive } from 'vue';
|
|
||||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
|
||||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
|
||||||
import { formSchema } from '../DjCheck.data';
|
|
||||||
import { saveOrUpdate } from '../DjCheck.api';
|
|
||||||
import { useMessage } from '/@/hooks/web/useMessage';
|
|
||||||
import { getDateByPicker } from '/@/utils';
|
|
||||||
const { createMessage } = useMessage();
|
|
||||||
// Emits声明
|
|
||||||
const emit = defineEmits(['register', 'success']);
|
|
||||||
const isUpdate = ref(true);
|
|
||||||
const isDetail = ref(false);
|
|
||||||
//表单配置
|
|
||||||
const [registerForm, { setProps, resetFields, setFieldsValue, validate, scrollToField }] = useForm({
|
|
||||||
labelWidth: 150,
|
|
||||||
schemas: formSchema,
|
|
||||||
showActionButtonGroup: false,
|
|
||||||
baseColProps: { span: 24 },
|
|
||||||
});
|
|
||||||
//表单赋值
|
|
||||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
|
||||||
//重置表单
|
|
||||||
await resetFields();
|
|
||||||
setModalProps({ confirmLoading: false, showCancelBtn: !!data?.showFooter, showOkBtn: !!data?.showFooter });
|
|
||||||
isUpdate.value = !!data?.isUpdate;
|
|
||||||
isDetail.value = !!data?.showFooter;
|
|
||||||
if (unref(isUpdate)) {
|
|
||||||
//表单赋值
|
|
||||||
await setFieldsValue({
|
|
||||||
...data.record,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// 隐藏底部时禁用整个表单
|
|
||||||
setProps({ disabled: !data?.showFooter });
|
|
||||||
});
|
|
||||||
//日期个性化选择
|
|
||||||
const fieldPickers = reactive({});
|
|
||||||
//设置标题
|
|
||||||
const title = computed(() => (!unref(isUpdate) ? '新增' : !unref(isDetail) ? '详情' : '编辑'));
|
|
||||||
//表单提交事件
|
|
||||||
async function handleSubmit(v) {
|
|
||||||
try {
|
|
||||||
let values = await validate();
|
|
||||||
// 预处理日期数据
|
|
||||||
changeDateValue(values);
|
|
||||||
setModalProps({ confirmLoading: true });
|
|
||||||
//提交表单
|
|
||||||
await saveOrUpdate(values, isUpdate.value);
|
|
||||||
//关闭弹窗
|
|
||||||
closeModal();
|
|
||||||
//刷新列表
|
|
||||||
emit('success');
|
|
||||||
} 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 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理日期值
|
|
||||||
* @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>
|
|
||||||
/** 时间和数字输入框样式 */
|
|
||||||
:deep(.ant-input-number) {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-calendar-picker) {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
import {defHttp} from '/@/utils/http/axios';
|
|
||||||
import { useMessage } from "/@/hooks/web/useMessage";
|
|
||||||
|
|
||||||
const { createConfirm } = useMessage();
|
|
||||||
|
|
||||||
enum Api {
|
|
||||||
list = '/demoMetting/djDemoLifeMeeting/list',
|
|
||||||
save='/demoMetting/djDemoLifeMeeting/add',
|
|
||||||
edit='/demoMetting/djDemoLifeMeeting/edit',
|
|
||||||
deleteOne = '/demoMetting/djDemoLifeMeeting/delete',
|
|
||||||
deleteBatch = '/demoMetting/djDemoLifeMeeting/deleteBatch',
|
|
||||||
importExcel = '/demoMetting/djDemoLifeMeeting/importExcel',
|
|
||||||
exportXls = '/demoMetting/djDemoLifeMeeting/exportXls',
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 导出api
|
|
||||||
* @param params
|
|
||||||
*/
|
|
||||||
export const getExportUrl = Api.exportXls;
|
|
||||||
/**
|
|
||||||
* 导入api
|
|
||||||
*/
|
|
||||||
export const getImportUrl = Api.importExcel;
|
|
||||||
/**
|
|
||||||
* 列表接口
|
|
||||||
* @param params
|
|
||||||
*/
|
|
||||||
export const list = (params) =>
|
|
||||||
defHttp.get({url: Api.list, params});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除单个
|
|
||||||
*/
|
|
||||||
export const deleteOne = (params,handleSuccess) => {
|
|
||||||
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
|
|
||||||
handleSuccess();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 批量删除
|
|
||||||
* @param params
|
|
||||||
*/
|
|
||||||
export const batchDelete = (params, handleSuccess) => {
|
|
||||||
createConfirm({
|
|
||||||
iconType: 'warning',
|
|
||||||
title: '确认删除',
|
|
||||||
content: '是否删除选中数据',
|
|
||||||
okText: '确认',
|
|
||||||
cancelText: '取消',
|
|
||||||
onOk: () => {
|
|
||||||
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
|
|
||||||
handleSuccess();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 保存或者更新
|
|
||||||
* @param params
|
|
||||||
*/
|
|
||||||
export const saveOrUpdate = (params, isUpdate) => {
|
|
||||||
let url = isUpdate ? Api.edit : Api.save;
|
|
||||||
return defHttp.post({url: url, params});
|
|
||||||
}
|
|
||||||
@@ -1,200 +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';
|
|
||||||
//列表数据
|
|
||||||
export const columns: BasicColumn[] = [
|
|
||||||
{
|
|
||||||
title: '序号',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'sortNo',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '问题分类',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'problemType',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '问题清单',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'problemList',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '问题表现',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'problemManifestation',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '责任领导',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'responsibleLeader',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '责任部门',
|
|
||||||
width: 150,
|
|
||||||
dataIndex: 'responsibleDept_dictText',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '整改措施',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'rectificationMeasures',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '完成时限',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'completionDeadline',
|
|
||||||
customRender: ({ text }) => {
|
|
||||||
text = !text ? '' : text.length > 10 ? text.substr(0, 10) : text;
|
|
||||||
return text;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '完成时间',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'completionDate',
|
|
||||||
customRender: ({ text }) => {
|
|
||||||
text = !text ? '' : text.length > 10 ? text.substr(0, 10) : text;
|
|
||||||
return text;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '输出成果',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'outputResults',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '完成情况',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'completionStatus',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '是否可发起',
|
|
||||||
align: 'center',
|
|
||||||
width: 150,
|
|
||||||
dataIndex: 'isLaunchable_dictText',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
//查询数据
|
|
||||||
export const searchFormSchema: FormSchema[] = [];
|
|
||||||
//表单数据
|
|
||||||
export const formSchema: FormSchema[] = [
|
|
||||||
{
|
|
||||||
label: '序号',
|
|
||||||
field: 'sortNo',
|
|
||||||
component: 'InputNumber',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '问题分类',
|
|
||||||
field: 'problemType',
|
|
||||||
component: 'InputNumber',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '问题清单',
|
|
||||||
field: 'problemList',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '问题表现',
|
|
||||||
field: 'problemManifestation',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '责任领导',
|
|
||||||
field: 'responsibleLeader',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '责任部门',
|
|
||||||
field: 'responsibleDept',
|
|
||||||
component: 'JSelectDept',
|
|
||||||
componentProps: ({ formActionType, formModel }) => {
|
|
||||||
return {
|
|
||||||
sync: false,
|
|
||||||
checkStrictly: true,
|
|
||||||
defaultExpandLevel: 2,
|
|
||||||
|
|
||||||
onSelect: (options, values) => {
|
|
||||||
const { updateSchema } = formActionType;
|
|
||||||
//所属部门修改后更新负责部门下拉框数据
|
|
||||||
updateSchema([
|
|
||||||
{
|
|
||||||
field: 'departIds',
|
|
||||||
componentProps: { options },
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
//update-begin---author:wangshuai---date:2024-05-11---for:【issues/1222】用户编辑界面“所属部门”与“负责部门”联动出错整---
|
|
||||||
if (!values) {
|
|
||||||
formModel.departIds = [];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//update-end---author:wangshuai---date:2024-05-11---for:【issues/1222】用户编辑界面“所属部门”与“负责部门”联动出错整---
|
|
||||||
//所属部门修改后更新负责部门数据
|
|
||||||
formModel.departIds && (formModel.departIds = formModel.departIds.filter((item) => values.value.indexOf(item) > -1));
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '整改措施',
|
|
||||||
field: 'rectificationMeasures',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '完成时限',
|
|
||||||
field: 'completionDeadline',
|
|
||||||
component: 'DatePicker',
|
|
||||||
componentProps: {
|
|
||||||
valueFormat: 'YYYY-MM-DD',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '完成时间',
|
|
||||||
field: 'completionDate',
|
|
||||||
component: 'DatePicker',
|
|
||||||
componentProps: {
|
|
||||||
valueFormat: 'YYYY-MM-DD',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '输出成果',
|
|
||||||
field: 'outputResults',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '完成情况',
|
|
||||||
field: 'completionStatus',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
// TODO 主键隐藏字段,目前写死为ID
|
|
||||||
{
|
|
||||||
label: '',
|
|
||||||
field: 'id',
|
|
||||||
component: 'Input',
|
|
||||||
show: false,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
// 高级查询数据
|
|
||||||
export const superQuerySchema = {
|
|
||||||
sortNo: { title: '序号', order: 0, view: 'number', type: 'number' },
|
|
||||||
problemType: { title: '问题分类', order: 1, view: 'number', type: 'number' },
|
|
||||||
problemList: { title: '问题清单', order: 2, view: 'text', type: 'string' },
|
|
||||||
problemManifestation: { title: '问题表现', order: 3, view: 'text', type: 'string' },
|
|
||||||
responsibleLeader: { title: '责任领导', order: 4, view: 'text', type: 'string' },
|
|
||||||
responsibleDept: { title: '责任部门', order: 5, view: 'text', type: 'string' },
|
|
||||||
rectificationMeasures: { title: '整改措施', order: 6, view: 'text', type: 'string' },
|
|
||||||
completionDeadline: { title: '完成时限', order: 7, view: 'date', type: 'string' },
|
|
||||||
completionDate: { title: '完成时间', order: 8, view: 'date', type: 'string' },
|
|
||||||
outputResults: { title: '输出成果', order: 9, view: 'text', type: 'string' },
|
|
||||||
completionStatus: { title: '完成情况', order: 10, view: 'text', type: 'string' },
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 流程表单调用这个方法获取formSchema
|
|
||||||
* @param param
|
|
||||||
*/
|
|
||||||
export function getBpmFormSchema(_formData): FormSchema[] {
|
|
||||||
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
|
|
||||||
return formSchema;
|
|
||||||
}
|
|
||||||
@@ -1,223 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
<!--引用表格-->
|
|
||||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
|
||||||
<!--插槽:table标题-->
|
|
||||||
<template #tableTitle>
|
|
||||||
<a-button type="primary" v-auth="'demoMetting:dj_demo_life_meeting:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">
|
|
||||||
新增</a-button
|
|
||||||
>
|
|
||||||
<a-button type="primary" v-auth="'demoMetting:dj_demo_life_meeting:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls">
|
|
||||||
导出</a-button
|
|
||||||
>
|
|
||||||
<j-upload-button
|
|
||||||
type="primary"
|
|
||||||
v-auth="'demoMetting:dj_demo_life_meeting: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="'demoMetting:dj_demo_life_meeting:deleteBatch'"
|
|
||||||
>批量操作
|
|
||||||
<Icon icon="mdi:chevron-down"></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>
|
|
||||||
<!-- 表单区域 -->
|
|
||||||
<DjDemoLifeMeetingModal @register="registerModal" @success="handleSuccess"></DjDemoLifeMeetingModal>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" name="demoMetting-djDemoLifeMeeting" setup>
|
|
||||||
import { ref, reactive, computed, unref } from 'vue';
|
|
||||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
|
||||||
import { useModal } from '/@/components/Modal';
|
|
||||||
import { useListPage } from '/@/hooks/system/useListPage';
|
|
||||||
import DjDemoLifeMeetingModal from './components/DjDemoLifeMeetingModal.vue';
|
|
||||||
import { columns, searchFormSchema, superQuerySchema } from './DjDemoLifeMeeting.data';
|
|
||||||
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './DjDemoLifeMeeting.api';
|
|
||||||
import { downloadFile } from '/@/utils/common/renderUtils';
|
|
||||||
import { useUserStore } from '/@/store/modules/user';
|
|
||||||
import { useMessage } from '/@/hooks/web/useMessage';
|
|
||||||
import { getDateByPicker } from '/@/utils';
|
|
||||||
//日期个性化选择
|
|
||||||
const fieldPickers = reactive({});
|
|
||||||
const queryParam = reactive<any>({});
|
|
||||||
const checkedKeys = ref<Array<string | number>>([]);
|
|
||||||
const userStore = useUserStore();
|
|
||||||
const { createMessage } = useMessage();
|
|
||||||
//注册model
|
|
||||||
const [registerModal, { openModal }] = useModal();
|
|
||||||
//注册table数据
|
|
||||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
|
||||||
tableProps: {
|
|
||||||
title: '所领导板子民主生活会问题台账',
|
|
||||||
api: list,
|
|
||||||
columns,
|
|
||||||
canResize: true,
|
|
||||||
formConfig: {
|
|
||||||
//labelWidth: 120,
|
|
||||||
schemas: searchFormSchema,
|
|
||||||
autoSubmitOnEnter: true,
|
|
||||||
showAdvancedButton: true,
|
|
||||||
fieldMapToNumber: [],
|
|
||||||
fieldMapToTime: [],
|
|
||||||
},
|
|
||||||
actionColumn: {
|
|
||||||
width: 120,
|
|
||||||
fixed: 'right',
|
|
||||||
},
|
|
||||||
beforeFetch: (params) => {
|
|
||||||
if (params && fieldPickers) {
|
|
||||||
for (let key in fieldPickers) {
|
|
||||||
if (params[key]) {
|
|
||||||
params[key] = getDateByPicker(params[key], fieldPickers[key]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Object.assign(params, queryParam);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
exportConfig: {
|
|
||||||
name: '所领导板子民主生活会问题台账',
|
|
||||||
url: getExportUrl,
|
|
||||||
params: queryParam,
|
|
||||||
},
|
|
||||||
importConfig: {
|
|
||||||
url: getImportUrl,
|
|
||||||
success: handleSuccess,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
|
||||||
|
|
||||||
// 高级查询配置
|
|
||||||
const superQueryConfig = reactive(superQuerySchema);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 高级查询事件
|
|
||||||
*/
|
|
||||||
function handleSuperQuery(params) {
|
|
||||||
Object.keys(params).map((k) => {
|
|
||||||
queryParam[k] = params[k];
|
|
||||||
});
|
|
||||||
reload();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 新增事件
|
|
||||||
*/
|
|
||||||
function handleAdd() {
|
|
||||||
openModal(true, {
|
|
||||||
isUpdate: false,
|
|
||||||
showFooter: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 编辑事件
|
|
||||||
*/
|
|
||||||
function handleEdit(record: Recordable) {
|
|
||||||
openModal(true, {
|
|
||||||
record,
|
|
||||||
isUpdate: true,
|
|
||||||
showFooter: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 详情
|
|
||||||
*/
|
|
||||||
function handleDetail(record: Recordable) {
|
|
||||||
openModal(true, {
|
|
||||||
record,
|
|
||||||
isUpdate: true,
|
|
||||||
showFooter: false,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 删除事件
|
|
||||||
*/
|
|
||||||
async function handleDelete(record) {
|
|
||||||
await deleteOne({ id: record.id }, handleSuccess);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 批量删除事件
|
|
||||||
*/
|
|
||||||
async function batchHandleDelete() {
|
|
||||||
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 成功回调
|
|
||||||
*/
|
|
||||||
function handleSuccess() {
|
|
||||||
(selectedRowKeys.value = []) && reload();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 发起流程
|
|
||||||
*/
|
|
||||||
function handleProcessLaunch() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 操作栏
|
|
||||||
*/
|
|
||||||
function getTableAction(record) {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
label: '编辑',
|
|
||||||
onClick: handleEdit.bind(null, record),
|
|
||||||
auth: 'demoMetting:dj_demo_life_meeting:edit',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '发起流程',
|
|
||||||
onClick: handleProcessLaunch(),
|
|
||||||
disabled: record.isLaunch === 0,
|
|
||||||
//auth: 'rectifylist:dj_inspection_rectify_list:edit',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 下拉操作栏
|
|
||||||
*/
|
|
||||||
function getDropDownAction(record) {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
label: '详情',
|
|
||||||
onClick: handleDetail.bind(null, record),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '删除',
|
|
||||||
popConfirm: {
|
|
||||||
title: '是否确认删除',
|
|
||||||
confirm: handleDelete.bind(null, record),
|
|
||||||
placement: 'topLeft',
|
|
||||||
},
|
|
||||||
auth: 'demoMetting:dj_demo_life_meeting: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 '../DjDemoLifeMeeting.data';
|
|
||||||
import {saveOrUpdate} from '../DjDemoLifeMeeting.api';
|
|
||||||
|
|
||||||
export default defineComponent({
|
|
||||||
name: "DjDemoLifeMeetingForm",
|
|
||||||
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 = '/demoMetting/djDemoLifeMeeting/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 saveOrUpdate(params, true)
|
|
||||||
}
|
|
||||||
|
|
||||||
initFormData();
|
|
||||||
|
|
||||||
return {
|
|
||||||
registerForm,
|
|
||||||
formDisabled,
|
|
||||||
submitForm,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
<template>
|
|
||||||
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit">
|
|
||||||
<BasicForm @register="registerForm" name="DjDemoLifeMeetingForm" />
|
|
||||||
</BasicModal>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import {ref, computed, unref, reactive} from 'vue';
|
|
||||||
import {BasicModal, useModalInner} from '/@/components/Modal';
|
|
||||||
import {BasicForm, useForm} from '/@/components/Form/index';
|
|
||||||
import {formSchema} from '../DjDemoLifeMeeting.data';
|
|
||||||
import {saveOrUpdate} from '../DjDemoLifeMeeting.api';
|
|
||||||
import { useMessage } from '/@/hooks/web/useMessage';
|
|
||||||
import { getDateByPicker } from '/@/utils';
|
|
||||||
const { createMessage } = useMessage();
|
|
||||||
// Emits声明
|
|
||||||
const emit = defineEmits(['register','success']);
|
|
||||||
const isUpdate = ref(true);
|
|
||||||
const isDetail = ref(false);
|
|
||||||
//表单配置
|
|
||||||
const [registerForm, { setProps,resetFields, setFieldsValue, validate, scrollToField }] = useForm({
|
|
||||||
labelWidth: 150,
|
|
||||||
schemas: formSchema,
|
|
||||||
showActionButtonGroup: false,
|
|
||||||
baseColProps: {span: 24}
|
|
||||||
});
|
|
||||||
//表单赋值
|
|
||||||
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
|
|
||||||
//重置表单
|
|
||||||
await resetFields();
|
|
||||||
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter});
|
|
||||||
isUpdate.value = !!data?.isUpdate;
|
|
||||||
isDetail.value = !!data?.showFooter;
|
|
||||||
if (unref(isUpdate)) {
|
|
||||||
//表单赋值
|
|
||||||
await setFieldsValue({
|
|
||||||
...data.record,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// 隐藏底部时禁用整个表单
|
|
||||||
setProps({ disabled: !data?.showFooter })
|
|
||||||
});
|
|
||||||
//日期个性化选择
|
|
||||||
const fieldPickers = reactive({
|
|
||||||
});
|
|
||||||
//设置标题
|
|
||||||
const title = computed(() => (!unref(isUpdate) ? '新增' : !unref(isDetail) ? '详情' : '编辑'));
|
|
||||||
//表单提交事件
|
|
||||||
async function handleSubmit(v) {
|
|
||||||
try {
|
|
||||||
let values = await validate();
|
|
||||||
// 预处理日期数据
|
|
||||||
changeDateValue(values);
|
|
||||||
setModalProps({confirmLoading: true});
|
|
||||||
//提交表单
|
|
||||||
await saveOrUpdate(values, isUpdate.value);
|
|
||||||
//关闭弹窗
|
|
||||||
closeModal();
|
|
||||||
//刷新列表
|
|
||||||
emit('success');
|
|
||||||
} 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});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理日期值
|
|
||||||
* @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>
|
|
||||||
/** 时间和数字输入框样式 */
|
|
||||||
:deep(.ant-input-number) {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-calendar-picker) {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
import {defHttp} from '/@/utils/http/axios';
|
|
||||||
import { useMessage } from "/@/hooks/web/useMessage";
|
|
||||||
|
|
||||||
const { createConfirm } = useMessage();
|
|
||||||
|
|
||||||
enum Api {
|
|
||||||
list = '/peopleService/djPeopleService/list',
|
|
||||||
save='/peopleService/djPeopleService/add',
|
|
||||||
edit='/peopleService/djPeopleService/edit',
|
|
||||||
deleteOne = '/peopleService/djPeopleService/delete',
|
|
||||||
deleteBatch = '/peopleService/djPeopleService/deleteBatch',
|
|
||||||
importExcel = '/peopleService/djPeopleService/importExcel',
|
|
||||||
exportXls = '/peopleService/djPeopleService/exportXls',
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 导出api
|
|
||||||
* @param params
|
|
||||||
*/
|
|
||||||
export const getExportUrl = Api.exportXls;
|
|
||||||
/**
|
|
||||||
* 导入api
|
|
||||||
*/
|
|
||||||
export const getImportUrl = Api.importExcel;
|
|
||||||
/**
|
|
||||||
* 列表接口
|
|
||||||
* @param params
|
|
||||||
*/
|
|
||||||
export const list = (params) =>
|
|
||||||
defHttp.get({url: Api.list, params});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除单个
|
|
||||||
*/
|
|
||||||
export const deleteOne = (params,handleSuccess) => {
|
|
||||||
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
|
|
||||||
handleSuccess();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 批量删除
|
|
||||||
* @param params
|
|
||||||
*/
|
|
||||||
export const batchDelete = (params, handleSuccess) => {
|
|
||||||
createConfirm({
|
|
||||||
iconType: 'warning',
|
|
||||||
title: '确认删除',
|
|
||||||
content: '是否删除选中数据',
|
|
||||||
okText: '确认',
|
|
||||||
cancelText: '取消',
|
|
||||||
onOk: () => {
|
|
||||||
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
|
|
||||||
handleSuccess();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 保存或者更新
|
|
||||||
* @param params
|
|
||||||
*/
|
|
||||||
export const saveOrUpdate = (params, isUpdate) => {
|
|
||||||
let url = isUpdate ? Api.edit : Api.save;
|
|
||||||
return defHttp.post({url: url, params});
|
|
||||||
}
|
|
||||||
@@ -1,138 +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';
|
|
||||||
//列表数据
|
|
||||||
export const columns: BasicColumn[] = [
|
|
||||||
{
|
|
||||||
title: '序号',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'sortNo',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '问题分类',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'problemType',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '具体措施',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'specificMeasure',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '完成时限',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'completionDeadline',
|
|
||||||
customRender: ({ text }) => {
|
|
||||||
text = !text ? '' : text.length > 10 ? text.substr(0, 10) : text;
|
|
||||||
return text;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '责任部门',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'responsibleDept_dictText',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '完成情况',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'completionStatus',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '是否可发起',
|
|
||||||
align: 'center',
|
|
||||||
width: 150,
|
|
||||||
dataIndex: 'isLaunchable_dictText',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
//查询数据
|
|
||||||
export const searchFormSchema: FormSchema[] = [];
|
|
||||||
//表单数据
|
|
||||||
export const formSchema: FormSchema[] = [
|
|
||||||
{
|
|
||||||
label: '序号',
|
|
||||||
field: 'sortNo',
|
|
||||||
component: 'InputNumber',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '问题分类',
|
|
||||||
field: 'problemType',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '具体措施',
|
|
||||||
field: 'specificMeasure',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '完成时限',
|
|
||||||
field: 'completionDeadline',
|
|
||||||
component: 'DatePicker',
|
|
||||||
componentProps: {
|
|
||||||
valueFormat: 'YYYY-MM-DD',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '责任部门',
|
|
||||||
field: 'responsibleDept',
|
|
||||||
component: 'JSelectDept',
|
|
||||||
componentProps: ({ formActionType, formModel }) => {
|
|
||||||
return {
|
|
||||||
sync: false,
|
|
||||||
checkStrictly: true,
|
|
||||||
defaultExpandLevel: 2,
|
|
||||||
|
|
||||||
onSelect: (options, values) => {
|
|
||||||
const { updateSchema } = formActionType;
|
|
||||||
//所属部门修改后更新负责部门下拉框数据
|
|
||||||
updateSchema([
|
|
||||||
{
|
|
||||||
field: 'departIds',
|
|
||||||
componentProps: { options },
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
//update-begin---author:wangshuai---date:2024-05-11---for:【issues/1222】用户编辑界面“所属部门”与“负责部门”联动出错整---
|
|
||||||
if (!values) {
|
|
||||||
formModel.departIds = [];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//update-end---author:wangshuai---date:2024-05-11---for:【issues/1222】用户编辑界面“所属部门”与“负责部门”联动出错整---
|
|
||||||
//所属部门修改后更新负责部门数据
|
|
||||||
formModel.departIds && (formModel.departIds = formModel.departIds.filter((item) => values.value.indexOf(item) > -1));
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '完成情况',
|
|
||||||
field: 'completionStatus',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
// TODO 主键隐藏字段,目前写死为ID
|
|
||||||
{
|
|
||||||
label: '',
|
|
||||||
field: 'id',
|
|
||||||
component: 'Input',
|
|
||||||
show: false,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
// 高级查询数据
|
|
||||||
export const superQuerySchema = {
|
|
||||||
sortNo: { title: '序号', order: 0, view: 'number', type: 'number' },
|
|
||||||
problemType: { title: '问题分类', order: 1, view: 'text', type: 'string' },
|
|
||||||
specificMeasure: { title: '具体措施', order: 2, view: 'text', type: 'string' },
|
|
||||||
completionDeadline: { title: '完成时限', order: 3, view: 'date', type: 'string' },
|
|
||||||
responsibleDept: { title: '责任部门', order: 4, view: 'text', type: 'string' },
|
|
||||||
completionStatus: { title: '完成情况', order: 5, view: 'text', type: 'string' },
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 流程表单调用这个方法获取formSchema
|
|
||||||
* @param param
|
|
||||||
*/
|
|
||||||
export function getBpmFormSchema(_formData): FormSchema[] {
|
|
||||||
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
|
|
||||||
return formSchema;
|
|
||||||
}
|
|
||||||
@@ -1,221 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
<!--引用表格-->
|
|
||||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
|
||||||
<!--插槽:table标题-->
|
|
||||||
<template #tableTitle>
|
|
||||||
<a-button type="primary" v-auth="'peopleService:dj_people_service:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
|
|
||||||
<a-button type="primary" v-auth="'peopleService:dj_people_service:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls">
|
|
||||||
导出</a-button
|
|
||||||
>
|
|
||||||
<j-upload-button
|
|
||||||
type="primary"
|
|
||||||
v-auth="'peopleService:dj_people_service: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="'peopleService:dj_people_service:deleteBatch'"
|
|
||||||
>批量操作
|
|
||||||
<Icon icon="mdi:chevron-down"></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>
|
|
||||||
<!-- 表单区域 -->
|
|
||||||
<DjPeopleServiceModal @register="registerModal" @success="handleSuccess"></DjPeopleServiceModal>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" name="peopleService-djPeopleService" setup>
|
|
||||||
import { ref, reactive, computed, unref } from 'vue';
|
|
||||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
|
||||||
import { useModal } from '/@/components/Modal';
|
|
||||||
import { useListPage } from '/@/hooks/system/useListPage';
|
|
||||||
import DjPeopleServiceModal from './components/DjPeopleServiceModal.vue';
|
|
||||||
import { columns, searchFormSchema, superQuerySchema } from './DjPeopleService.data';
|
|
||||||
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './DjPeopleService.api';
|
|
||||||
import { downloadFile } from '/@/utils/common/renderUtils';
|
|
||||||
import { useUserStore } from '/@/store/modules/user';
|
|
||||||
import { useMessage } from '/@/hooks/web/useMessage';
|
|
||||||
import { getDateByPicker } from '/@/utils';
|
|
||||||
//日期个性化选择
|
|
||||||
const fieldPickers = reactive({});
|
|
||||||
const queryParam = reactive<any>({});
|
|
||||||
const checkedKeys = ref<Array<string | number>>([]);
|
|
||||||
const userStore = useUserStore();
|
|
||||||
const { createMessage } = useMessage();
|
|
||||||
//注册model
|
|
||||||
const [registerModal, { openModal }] = useModal();
|
|
||||||
//注册table数据
|
|
||||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
|
||||||
tableProps: {
|
|
||||||
title: '我为群众办实事台账',
|
|
||||||
api: list,
|
|
||||||
columns,
|
|
||||||
canResize: true,
|
|
||||||
formConfig: {
|
|
||||||
//labelWidth: 120,
|
|
||||||
schemas: searchFormSchema,
|
|
||||||
autoSubmitOnEnter: true,
|
|
||||||
showAdvancedButton: true,
|
|
||||||
fieldMapToNumber: [],
|
|
||||||
fieldMapToTime: [],
|
|
||||||
},
|
|
||||||
actionColumn: {
|
|
||||||
width: 120,
|
|
||||||
fixed: 'right',
|
|
||||||
},
|
|
||||||
beforeFetch: (params) => {
|
|
||||||
if (params && fieldPickers) {
|
|
||||||
for (let key in fieldPickers) {
|
|
||||||
if (params[key]) {
|
|
||||||
params[key] = getDateByPicker(params[key], fieldPickers[key]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Object.assign(params, queryParam);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
exportConfig: {
|
|
||||||
name: '我为群众办实事台账',
|
|
||||||
url: getExportUrl,
|
|
||||||
params: queryParam,
|
|
||||||
},
|
|
||||||
importConfig: {
|
|
||||||
url: getImportUrl,
|
|
||||||
success: handleSuccess,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
|
||||||
|
|
||||||
// 高级查询配置
|
|
||||||
const superQueryConfig = reactive(superQuerySchema);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 高级查询事件
|
|
||||||
*/
|
|
||||||
function handleSuperQuery(params) {
|
|
||||||
Object.keys(params).map((k) => {
|
|
||||||
queryParam[k] = params[k];
|
|
||||||
});
|
|
||||||
reload();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 新增事件
|
|
||||||
*/
|
|
||||||
function handleAdd() {
|
|
||||||
openModal(true, {
|
|
||||||
isUpdate: false,
|
|
||||||
showFooter: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 编辑事件
|
|
||||||
*/
|
|
||||||
function handleEdit(record: Recordable) {
|
|
||||||
openModal(true, {
|
|
||||||
record,
|
|
||||||
isUpdate: true,
|
|
||||||
showFooter: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 详情
|
|
||||||
*/
|
|
||||||
function handleDetail(record: Recordable) {
|
|
||||||
openModal(true, {
|
|
||||||
record,
|
|
||||||
isUpdate: true,
|
|
||||||
showFooter: false,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 发起流程
|
|
||||||
*/
|
|
||||||
function handleProcessLaunch() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 删除事件
|
|
||||||
*/
|
|
||||||
async function handleDelete(record) {
|
|
||||||
await deleteOne({ id: record.id }, handleSuccess);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 批量删除事件
|
|
||||||
*/
|
|
||||||
async function batchHandleDelete() {
|
|
||||||
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 成功回调
|
|
||||||
*/
|
|
||||||
function handleSuccess() {
|
|
||||||
(selectedRowKeys.value = []) && reload();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 操作栏
|
|
||||||
*/
|
|
||||||
function getTableAction(record) {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
label: '编辑',
|
|
||||||
onClick: handleEdit.bind(null, record),
|
|
||||||
auth: 'peopleService:dj_people_service:edit',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '发起流程',
|
|
||||||
onClick: handleProcessLaunch(),
|
|
||||||
disabled: record.isLaunch === 0,
|
|
||||||
//auth: 'rectifylist:dj_inspection_rectify_list:edit',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 下拉操作栏
|
|
||||||
*/
|
|
||||||
function getDropDownAction(record) {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
label: '详情',
|
|
||||||
onClick: handleDetail.bind(null, record),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '删除',
|
|
||||||
popConfirm: {
|
|
||||||
title: '是否确认删除',
|
|
||||||
confirm: handleDelete.bind(null, record),
|
|
||||||
placement: 'topLeft',
|
|
||||||
},
|
|
||||||
auth: 'peopleService:dj_people_service: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 '../DjPeopleService.data';
|
|
||||||
import {saveOrUpdate} from '../DjPeopleService.api';
|
|
||||||
|
|
||||||
export default defineComponent({
|
|
||||||
name: "DjPeopleServiceForm",
|
|
||||||
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 = '/peopleService/djPeopleService/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 saveOrUpdate(params, true)
|
|
||||||
}
|
|
||||||
|
|
||||||
initFormData();
|
|
||||||
|
|
||||||
return {
|
|
||||||
registerForm,
|
|
||||||
formDisabled,
|
|
||||||
submitForm,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
<template>
|
|
||||||
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit">
|
|
||||||
<BasicForm @register="registerForm" name="DjPeopleServiceForm" />
|
|
||||||
</BasicModal>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import {ref, computed, unref, reactive} from 'vue';
|
|
||||||
import {BasicModal, useModalInner} from '/@/components/Modal';
|
|
||||||
import {BasicForm, useForm} from '/@/components/Form/index';
|
|
||||||
import {formSchema} from '../DjPeopleService.data';
|
|
||||||
import {saveOrUpdate} from '../DjPeopleService.api';
|
|
||||||
import { useMessage } from '/@/hooks/web/useMessage';
|
|
||||||
import { getDateByPicker } from '/@/utils';
|
|
||||||
const { createMessage } = useMessage();
|
|
||||||
// Emits声明
|
|
||||||
const emit = defineEmits(['register','success']);
|
|
||||||
const isUpdate = ref(true);
|
|
||||||
const isDetail = ref(false);
|
|
||||||
//表单配置
|
|
||||||
const [registerForm, { setProps,resetFields, setFieldsValue, validate, scrollToField }] = useForm({
|
|
||||||
labelWidth: 150,
|
|
||||||
schemas: formSchema,
|
|
||||||
showActionButtonGroup: false,
|
|
||||||
baseColProps: {span: 24}
|
|
||||||
});
|
|
||||||
//表单赋值
|
|
||||||
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
|
|
||||||
//重置表单
|
|
||||||
await resetFields();
|
|
||||||
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter});
|
|
||||||
isUpdate.value = !!data?.isUpdate;
|
|
||||||
isDetail.value = !!data?.showFooter;
|
|
||||||
if (unref(isUpdate)) {
|
|
||||||
//表单赋值
|
|
||||||
await setFieldsValue({
|
|
||||||
...data.record,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// 隐藏底部时禁用整个表单
|
|
||||||
setProps({ disabled: !data?.showFooter })
|
|
||||||
});
|
|
||||||
//日期个性化选择
|
|
||||||
const fieldPickers = reactive({
|
|
||||||
});
|
|
||||||
//设置标题
|
|
||||||
const title = computed(() => (!unref(isUpdate) ? '新增' : !unref(isDetail) ? '详情' : '编辑'));
|
|
||||||
//表单提交事件
|
|
||||||
async function handleSubmit(v) {
|
|
||||||
try {
|
|
||||||
let values = await validate();
|
|
||||||
// 预处理日期数据
|
|
||||||
changeDateValue(values);
|
|
||||||
setModalProps({confirmLoading: true});
|
|
||||||
//提交表单
|
|
||||||
await saveOrUpdate(values, isUpdate.value);
|
|
||||||
//关闭弹窗
|
|
||||||
closeModal();
|
|
||||||
//刷新列表
|
|
||||||
emit('success');
|
|
||||||
} 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});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理日期值
|
|
||||||
* @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>
|
|
||||||
/** 时间和数字输入框样式 */
|
|
||||||
:deep(.ant-input-number) {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-calendar-picker) {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,222 +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';
|
|
||||||
//列表数据
|
|
||||||
export const columns: BasicColumn[] = [
|
|
||||||
{
|
|
||||||
title: '问题名称',
|
|
||||||
align: 'left',
|
|
||||||
dataIndex: 'issueName',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '问题分类',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'problemType',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '面上问题',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'msIssue',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '具体问题',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'specificIssue',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '整改措施',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'rectificationMeasures',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '完成时限',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'completionDeadline',
|
|
||||||
customRender: ({ text }) => {
|
|
||||||
text = !text ? '' : text.length > 10 ? text.substr(0, 10) : text;
|
|
||||||
return text;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '责任部门',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'responsibleDept_dictText',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '分管所领导',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'supervisingLeader',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '标志性成果',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'landmarkAchievement',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '完成时间',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'completionDate',
|
|
||||||
customRender: ({ text }) => {
|
|
||||||
text = !text ? '' : text.length > 10 ? text.substr(0, 10) : text;
|
|
||||||
return text;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '监督意见',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'supervisionOpinion',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '措施数量',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'measureCount',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '是否可发起',
|
|
||||||
align: 'center',
|
|
||||||
width: 150,
|
|
||||||
dataIndex: 'isLaunchable_dictText',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
//查询数据
|
|
||||||
export const searchFormSchema: FormSchema[] = [];
|
|
||||||
//表单数据
|
|
||||||
export const formSchema: FormSchema[] = [
|
|
||||||
{
|
|
||||||
label: '父级节点',
|
|
||||||
field: 'pid',
|
|
||||||
component: 'JTreeSelect',
|
|
||||||
componentProps: {
|
|
||||||
dict: 'dj_inspection_rectify_list,issue_name,id',
|
|
||||||
pidField: 'pid',
|
|
||||||
pidValue: '0',
|
|
||||||
hasChildField: 'has_child',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '问题名称',
|
|
||||||
field: 'issueName',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '问题分类',
|
|
||||||
field: 'problemType',
|
|
||||||
component: 'InputNumber',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '面上问题',
|
|
||||||
field: 'msIssue',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '具体问题',
|
|
||||||
field: 'specificIssue',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '整改措施',
|
|
||||||
field: 'rectificationMeasures',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '完成时限',
|
|
||||||
field: 'completionDeadline',
|
|
||||||
component: 'DatePicker',
|
|
||||||
componentProps: {
|
|
||||||
valueFormat: 'YYYY-MM-DD',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '责任部门',
|
|
||||||
field: 'responsibleDept',
|
|
||||||
component: 'JSelectDept',
|
|
||||||
componentProps: ({ formActionType, formModel }) => {
|
|
||||||
return {
|
|
||||||
sync: false,
|
|
||||||
checkStrictly: true,
|
|
||||||
defaultExpandLevel: 2,
|
|
||||||
|
|
||||||
onSelect: (options, values) => {
|
|
||||||
const { updateSchema } = formActionType;
|
|
||||||
//所属部门修改后更新负责部门下拉框数据
|
|
||||||
updateSchema([
|
|
||||||
{
|
|
||||||
field: 'departIds',
|
|
||||||
componentProps: { options },
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
//update-begin---author:wangshuai---date:2024-05-11---for:【issues/1222】用户编辑界面“所属部门”与“负责部门”联动出错整---
|
|
||||||
if (!values) {
|
|
||||||
formModel.departIds = [];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//update-end---author:wangshuai---date:2024-05-11---for:【issues/1222】用户编辑界面“所属部门”与“负责部门”联动出错整---
|
|
||||||
//所属部门修改后更新负责部门数据
|
|
||||||
formModel.departIds && (formModel.departIds = formModel.departIds.filter((item) => values.value.indexOf(item) > -1));
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '分管所领导',
|
|
||||||
field: 'supervisingLeader',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '标志性成果',
|
|
||||||
field: 'landmarkAchievement',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '完成时间',
|
|
||||||
field: 'completionDate',
|
|
||||||
component: 'DatePicker',
|
|
||||||
componentProps: {
|
|
||||||
valueFormat: 'YYYY-MM-DD',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '监督意见',
|
|
||||||
field: 'supervisionOpinion',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '措施数量',
|
|
||||||
field: 'measureCount',
|
|
||||||
component: 'InputNumber',
|
|
||||||
},
|
|
||||||
// TODO 主键隐藏字段,目前写死为ID
|
|
||||||
{
|
|
||||||
label: '',
|
|
||||||
field: 'id',
|
|
||||||
component: 'Input',
|
|
||||||
show: false,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
// 高级查询数据
|
|
||||||
export const superQuerySchema = {
|
|
||||||
issueName: { title: '问题名称', order: 1, view: 'text', type: 'string' },
|
|
||||||
problemType: { title: '问题分类', order: 2, view: 'number', type: 'number' },
|
|
||||||
msIssue: { title: '面上问题', order: 3, view: 'text', type: 'string' },
|
|
||||||
specificIssue: { title: '具体问题', order: 4, view: 'text', type: 'string' },
|
|
||||||
rectificationMeasures: { title: '整改措施', order: 5, view: 'text', type: 'string' },
|
|
||||||
completionDeadline: { title: '完成时限', order: 6, view: 'date', type: 'string' },
|
|
||||||
responsibleDept: { title: '责任部门', order: 7, view: 'text', type: 'string' },
|
|
||||||
supervisingLeader: { title: '分管所领导', order: 8, view: 'text', type: 'string' },
|
|
||||||
landmarkAchievement: { title: '标志性成果', order: 9, view: 'text', type: 'string' },
|
|
||||||
completionDate: { title: '完成时间', order: 10, view: 'date', type: 'string' },
|
|
||||||
supervisionOpinion: { title: '监督意见', order: 11, view: 'text', type: 'string' },
|
|
||||||
measureCount: { title: '措施数量', order: 12, view: 'number', type: 'number' },
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 流程表单调用这个方法获取formSchema
|
|
||||||
* @param param
|
|
||||||
*/
|
|
||||||
export function getBpmFormSchema(_formData): FormSchema[] {
|
|
||||||
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
|
|
||||||
return formSchema;
|
|
||||||
}
|
|
||||||
@@ -1,387 +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="'rectifylist:dj_inspection_rectify_list:add'" @click="handleCreate" preIcon="ant-design:plus-outlined">
|
|
||||||
新增</a-button
|
|
||||||
>
|
|
||||||
<a-button
|
|
||||||
type="primary"
|
|
||||||
v-auth="'rectifylist:dj_inspection_rectify_list:exportXls'"
|
|
||||||
preIcon="ant-design:export-outlined"
|
|
||||||
@click="onExportXls"
|
|
||||||
>
|
|
||||||
导出</a-button
|
|
||||||
>
|
|
||||||
<j-upload-button
|
|
||||||
type="primary"
|
|
||||||
v-auth="'rectifylist:dj_inspection_rectify_list: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="'rectifylist:dj_inspection_rectify_list: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>
|
|
||||||
<!--字典弹窗-->
|
|
||||||
<DjInspectionRectifyListModal @register="registerModal" @success="handleSuccess" />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" name="rectifylist-djInspectionRectifyList" 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 DjInspectionRectifyListModal from './components/DjInspectionRectifyListModal.vue';
|
|
||||||
import { columns, searchFormSchema, superQuerySchema } from './DjInspectionRectifyList.data';
|
|
||||||
import { downloadFile } from '/@/utils/common/renderUtils';
|
|
||||||
import { useMessage } from '/@/hooks/web/useMessage';
|
|
||||||
import {
|
|
||||||
list,
|
|
||||||
deleteDjInspectionRectifyList,
|
|
||||||
batchDeleteDjInspectionRectifyList,
|
|
||||||
getExportUrl,
|
|
||||||
getImportUrl,
|
|
||||||
getChildList,
|
|
||||||
getChildListBatch,
|
|
||||||
} from './DjInspectionRectifyList.api';
|
|
||||||
import { getDateByPicker } from '/@/utils';
|
|
||||||
//日期个性化选择
|
|
||||||
const fieldPickers = reactive({});
|
|
||||||
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: true,
|
|
||||||
isTreeTable: true,
|
|
||||||
formConfig: {
|
|
||||||
//labelWidth: 120,
|
|
||||||
schemas: searchFormSchema,
|
|
||||||
autoSubmitOnEnter: true,
|
|
||||||
showAdvancedButton: true,
|
|
||||||
fieldMapToNumber: [],
|
|
||||||
fieldMapToTime: [],
|
|
||||||
},
|
|
||||||
actionColumn: {
|
|
||||||
width: 240,
|
|
||||||
fixed: 'right',
|
|
||||||
},
|
|
||||||
beforeFetch: (params) => {
|
|
||||||
if (params && fieldPickers) {
|
|
||||||
for (let key in fieldPickers) {
|
|
||||||
if (params[key]) {
|
|
||||||
params[key] = getDateByPicker(params[key], fieldPickers[key]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 发起流程
|
|
||||||
*/
|
|
||||||
function handleProcessLaunch() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 编辑事件
|
|
||||||
*/
|
|
||||||
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 deleteDjInspectionRectifyList({ id: record.id }, importSuccess);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除事件
|
|
||||||
*/
|
|
||||||
async function batchHandleDelete() {
|
|
||||||
const ids = selectedRowKeys.value.filter((item) => !item.includes('loadChild'));
|
|
||||||
await batchDeleteDjInspectionRectifyList({ 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: 'rectifylist:dj_inspection_rectify_list:edit',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '发起流程',
|
|
||||||
onClick: handleProcessLaunch(),
|
|
||||||
disabled: record.isLaunch === 0,
|
|
||||||
//auth: 'rectifylist:dj_inspection_rectify_list: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: 'rectifylist:dj_inspection_rectify_list:delete',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="less" scoped>
|
|
||||||
:deep(.ant-picker),
|
|
||||||
:deep(.ant-input-number) {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
import { defHttp } from '/@/utils/http/axios';
|
|
||||||
import { useMessage } from '/@/hooks/web/useMessage';
|
|
||||||
|
|
||||||
const { createConfirm } = useMessage();
|
|
||||||
|
|
||||||
enum Api {
|
|
||||||
list = '/tzMetting/djMeetingRecord/list',
|
|
||||||
save = '/tzMetting/djMeetingRecord/add',
|
|
||||||
edit = '/tzMetting/djMeetingRecord/edit',
|
|
||||||
deleteOne = '/tzMetting/djMeetingRecord/delete',
|
|
||||||
deleteBatch = '/tzMetting/djMeetingRecord/deleteBatch',
|
|
||||||
importExcel = '/tzMetting/djMeetingRecord/importExcel',
|
|
||||||
exportXls = '/tzMetting/djMeetingRecord/exportXls',
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 导出api
|
|
||||||
* @param params
|
|
||||||
*/
|
|
||||||
export const getExportUrl = Api.exportXls;
|
|
||||||
/**
|
|
||||||
* 导入api
|
|
||||||
*/
|
|
||||||
export const getImportUrl = Api.importExcel;
|
|
||||||
/**
|
|
||||||
* 列表接口
|
|
||||||
* @param params
|
|
||||||
*/
|
|
||||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除单个
|
|
||||||
*/
|
|
||||||
export const deleteOne = (params, handleSuccess) => {
|
|
||||||
return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
|
|
||||||
handleSuccess();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* 批量删除
|
|
||||||
* @param params
|
|
||||||
*/
|
|
||||||
export const batchDelete = (params, handleSuccess) => {
|
|
||||||
createConfirm({
|
|
||||||
iconType: 'warning',
|
|
||||||
title: '确认删除',
|
|
||||||
content: '是否删除选中数据',
|
|
||||||
okText: '确认',
|
|
||||||
cancelText: '取消',
|
|
||||||
onOk: () => {
|
|
||||||
return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
|
|
||||||
handleSuccess();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* 保存或者更新
|
|
||||||
* @param params
|
|
||||||
*/
|
|
||||||
export const saveOrUpdate = (params, isUpdate) => {
|
|
||||||
let url = isUpdate ? Api.edit : Api.save;
|
|
||||||
return defHttp.post({ url: url, params });
|
|
||||||
};
|
|
||||||
@@ -1,138 +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';
|
|
||||||
//列表数据
|
|
||||||
export const columns: BasicColumn[] = [
|
|
||||||
{
|
|
||||||
title: '序号',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'sortNo',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '问题分类',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'problemType',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '具体措施',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'specificMeasure',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '完成时限',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'completionDeadline',
|
|
||||||
customRender: ({ text }) => {
|
|
||||||
text = !text ? '' : text.length > 10 ? text.substr(0, 10) : text;
|
|
||||||
return text;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '责任部门',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'responsibleDept_dictText',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '完成情况',
|
|
||||||
align: 'center',
|
|
||||||
dataIndex: 'completionStatus',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '是否可发起',
|
|
||||||
align: 'center',
|
|
||||||
width: 150,
|
|
||||||
dataIndex: 'isLaunchable_dictText',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
//查询数据
|
|
||||||
export const searchFormSchema: FormSchema[] = [];
|
|
||||||
//表单数据
|
|
||||||
export const formSchema: FormSchema[] = [
|
|
||||||
{
|
|
||||||
label: '序号',
|
|
||||||
field: 'sortNo',
|
|
||||||
component: 'InputNumber',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '问题分类',
|
|
||||||
field: 'problemType',
|
|
||||||
component: 'InputNumber',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '具体措施',
|
|
||||||
field: 'specificMeasure',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '完成时限',
|
|
||||||
field: 'completionDeadline',
|
|
||||||
component: 'DatePicker',
|
|
||||||
componentProps: {
|
|
||||||
valueFormat: 'YYYY-MM-DD',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '责任部门',
|
|
||||||
field: 'responsibleDept',
|
|
||||||
component: 'JSelectDept',
|
|
||||||
componentProps: ({ formActionType, formModel }) => {
|
|
||||||
return {
|
|
||||||
sync: false,
|
|
||||||
checkStrictly: true,
|
|
||||||
defaultExpandLevel: 2,
|
|
||||||
|
|
||||||
onSelect: (options, values) => {
|
|
||||||
const { updateSchema } = formActionType;
|
|
||||||
//所属部门修改后更新负责部门下拉框数据
|
|
||||||
updateSchema([
|
|
||||||
{
|
|
||||||
field: 'departIds',
|
|
||||||
componentProps: { options },
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
//update-begin---author:wangshuai---date:2024-05-11---for:【issues/1222】用户编辑界面“所属部门”与“负责部门”联动出错整---
|
|
||||||
if (!values) {
|
|
||||||
formModel.departIds = [];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//update-end---author:wangshuai---date:2024-05-11---for:【issues/1222】用户编辑界面“所属部门”与“负责部门”联动出错整---
|
|
||||||
//所属部门修改后更新负责部门数据
|
|
||||||
formModel.departIds && (formModel.departIds = formModel.departIds.filter((item) => values.value.indexOf(item) > -1));
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '完成情况',
|
|
||||||
field: 'completionStatus',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
// TODO 主键隐藏字段,目前写死为ID
|
|
||||||
{
|
|
||||||
label: '',
|
|
||||||
field: 'id',
|
|
||||||
component: 'Input',
|
|
||||||
show: false,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
// 高级查询数据
|
|
||||||
export const superQuerySchema = {
|
|
||||||
sortNo: { title: '序号', order: 0, view: 'number', type: 'number' },
|
|
||||||
problemType: { title: '问题分类', order: 1, view: 'number', type: 'number' },
|
|
||||||
specificMeasure: { title: '具体措施', order: 2, view: 'text', type: 'string' },
|
|
||||||
completionDeadline: { title: '完成时限', order: 3, view: 'date', type: 'string' },
|
|
||||||
responsibleDept: { title: '责任部门', order: 4, view: 'text', type: 'string' },
|
|
||||||
completionStatus: { title: '完成情况', order: 5, view: 'text', type: 'string' },
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 流程表单调用这个方法获取formSchema
|
|
||||||
* @param param
|
|
||||||
*/
|
|
||||||
export function getBpmFormSchema(_formData): FormSchema[] {
|
|
||||||
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
|
|
||||||
return formSchema;
|
|
||||||
}
|
|
||||||
@@ -1,217 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
<!--引用表格-->
|
|
||||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
|
||||||
<!--插槽:table标题-->
|
|
||||||
<template #tableTitle>
|
|
||||||
<a-button type="primary" v-auth="'tzMetting:dj_meeting_record:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
|
|
||||||
<a-button type="primary" v-auth="'tzMetting:dj_meeting_record:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls">
|
|
||||||
导出</a-button
|
|
||||||
>
|
|
||||||
<j-upload-button type="primary" v-auth="'tzMetting:dj_meeting_record: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="'tzMetting:dj_meeting_record:deleteBatch'"
|
|
||||||
>批量操作
|
|
||||||
<Icon icon="mdi:chevron-down"></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>
|
|
||||||
<!-- 表单区域 -->
|
|
||||||
<DjMeetingRecordModal @register="registerModal" @success="handleSuccess"></DjMeetingRecordModal>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" name="tzMetting-djMeetingRecord" setup>
|
|
||||||
import { ref, reactive, computed, unref } from 'vue';
|
|
||||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
|
||||||
import { useModal } from '/@/components/Modal';
|
|
||||||
import { useListPage } from '/@/hooks/system/useListPage';
|
|
||||||
import DjMeetingRecordModal from './components/DjMeetingRecordModal.vue';
|
|
||||||
import { columns, searchFormSchema, superQuerySchema } from './DjMeetingRecord.data';
|
|
||||||
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './DjMeetingRecord.api';
|
|
||||||
import { downloadFile } from '/@/utils/common/renderUtils';
|
|
||||||
import { useUserStore } from '/@/store/modules/user';
|
|
||||||
import { useMessage } from '/@/hooks/web/useMessage';
|
|
||||||
import { getDateByPicker } from '/@/utils';
|
|
||||||
//日期个性化选择
|
|
||||||
const fieldPickers = reactive({});
|
|
||||||
const queryParam = reactive<any>({});
|
|
||||||
const checkedKeys = ref<Array<string | number>>([]);
|
|
||||||
const userStore = useUserStore();
|
|
||||||
const { createMessage } = useMessage();
|
|
||||||
//注册model
|
|
||||||
const [registerModal, { openModal }] = useModal();
|
|
||||||
//注册table数据
|
|
||||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
|
||||||
tableProps: {
|
|
||||||
title: '统战座谈会意见台账及督办反馈',
|
|
||||||
api: list,
|
|
||||||
columns,
|
|
||||||
canResize: true,
|
|
||||||
formConfig: {
|
|
||||||
//labelWidth: 120,
|
|
||||||
schemas: searchFormSchema,
|
|
||||||
autoSubmitOnEnter: true,
|
|
||||||
showAdvancedButton: true,
|
|
||||||
fieldMapToNumber: [],
|
|
||||||
fieldMapToTime: [],
|
|
||||||
},
|
|
||||||
actionColumn: {
|
|
||||||
width: 120,
|
|
||||||
fixed: 'right',
|
|
||||||
},
|
|
||||||
beforeFetch: (params) => {
|
|
||||||
if (params && fieldPickers) {
|
|
||||||
for (let key in fieldPickers) {
|
|
||||||
if (params[key]) {
|
|
||||||
params[key] = getDateByPicker(params[key], fieldPickers[key]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Object.assign(params, queryParam);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
exportConfig: {
|
|
||||||
name: '统战座谈会意见台账及督办反馈',
|
|
||||||
url: getExportUrl,
|
|
||||||
params: queryParam,
|
|
||||||
},
|
|
||||||
importConfig: {
|
|
||||||
url: getImportUrl,
|
|
||||||
success: handleSuccess,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
|
||||||
|
|
||||||
// 高级查询配置
|
|
||||||
const superQueryConfig = reactive(superQuerySchema);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 高级查询事件
|
|
||||||
*/
|
|
||||||
function handleSuperQuery(params) {
|
|
||||||
Object.keys(params).map((k) => {
|
|
||||||
queryParam[k] = params[k];
|
|
||||||
});
|
|
||||||
reload();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 新增事件
|
|
||||||
*/
|
|
||||||
function handleAdd() {
|
|
||||||
openModal(true, {
|
|
||||||
isUpdate: false,
|
|
||||||
showFooter: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 编辑事件
|
|
||||||
*/
|
|
||||||
function handleEdit(record: Recordable) {
|
|
||||||
openModal(true, {
|
|
||||||
record,
|
|
||||||
isUpdate: true,
|
|
||||||
showFooter: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 详情
|
|
||||||
*/
|
|
||||||
function handleDetail(record: Recordable) {
|
|
||||||
openModal(true, {
|
|
||||||
record,
|
|
||||||
isUpdate: true,
|
|
||||||
showFooter: false,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 删除事件
|
|
||||||
*/
|
|
||||||
async function handleDelete(record) {
|
|
||||||
await deleteOne({ id: record.id }, handleSuccess);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 批量删除事件
|
|
||||||
*/
|
|
||||||
async function batchHandleDelete() {
|
|
||||||
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 成功回调
|
|
||||||
*/
|
|
||||||
function handleSuccess() {
|
|
||||||
(selectedRowKeys.value = []) && reload();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 发起流程
|
|
||||||
*/
|
|
||||||
function handleProcessLaunch() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 操作栏
|
|
||||||
*/
|
|
||||||
function getTableAction(record) {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
label: '编辑',
|
|
||||||
onClick: handleEdit.bind(null, record),
|
|
||||||
auth: 'tzMetting:dj_meeting_record:edit',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '发起流程',
|
|
||||||
onClick: handleProcessLaunch(),
|
|
||||||
disabled: record.isLaunch === 0,
|
|
||||||
//auth: 'rectifylist:dj_inspection_rectify_list:edit',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 下拉操作栏
|
|
||||||
*/
|
|
||||||
function getDropDownAction(record) {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
label: '详情',
|
|
||||||
onClick: handleDetail.bind(null, record),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '删除',
|
|
||||||
popConfirm: {
|
|
||||||
title: '是否确认删除',
|
|
||||||
confirm: handleDelete.bind(null, record),
|
|
||||||
placement: 'topLeft',
|
|
||||||
},
|
|
||||||
auth: 'tzMetting:dj_meeting_record: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 '../DjMeetingRecord.data';
|
|
||||||
import {saveOrUpdate} from '../DjMeetingRecord.api';
|
|
||||||
|
|
||||||
export default defineComponent({
|
|
||||||
name: "DjMeetingRecordForm",
|
|
||||||
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 = '/tzMetting/djMeetingRecord/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 saveOrUpdate(params, true)
|
|
||||||
}
|
|
||||||
|
|
||||||
initFormData();
|
|
||||||
|
|
||||||
return {
|
|
||||||
registerForm,
|
|
||||||
formDisabled,
|
|
||||||
submitForm,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
<template>
|
|
||||||
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit">
|
|
||||||
<BasicForm @register="registerForm" name="DjMeetingRecordForm" />
|
|
||||||
</BasicModal>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import {ref, computed, unref, reactive} from 'vue';
|
|
||||||
import {BasicModal, useModalInner} from '/@/components/Modal';
|
|
||||||
import {BasicForm, useForm} from '/@/components/Form/index';
|
|
||||||
import {formSchema} from '../DjMeetingRecord.data';
|
|
||||||
import {saveOrUpdate} from '../DjMeetingRecord.api';
|
|
||||||
import { useMessage } from '/@/hooks/web/useMessage';
|
|
||||||
import { getDateByPicker } from '/@/utils';
|
|
||||||
const { createMessage } = useMessage();
|
|
||||||
// Emits声明
|
|
||||||
const emit = defineEmits(['register','success']);
|
|
||||||
const isUpdate = ref(true);
|
|
||||||
const isDetail = ref(false);
|
|
||||||
//表单配置
|
|
||||||
const [registerForm, { setProps,resetFields, setFieldsValue, validate, scrollToField }] = useForm({
|
|
||||||
labelWidth: 150,
|
|
||||||
schemas: formSchema,
|
|
||||||
showActionButtonGroup: false,
|
|
||||||
baseColProps: {span: 24}
|
|
||||||
});
|
|
||||||
//表单赋值
|
|
||||||
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
|
|
||||||
//重置表单
|
|
||||||
await resetFields();
|
|
||||||
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter});
|
|
||||||
isUpdate.value = !!data?.isUpdate;
|
|
||||||
isDetail.value = !!data?.showFooter;
|
|
||||||
if (unref(isUpdate)) {
|
|
||||||
//表单赋值
|
|
||||||
await setFieldsValue({
|
|
||||||
...data.record,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// 隐藏底部时禁用整个表单
|
|
||||||
setProps({ disabled: !data?.showFooter })
|
|
||||||
});
|
|
||||||
//日期个性化选择
|
|
||||||
const fieldPickers = reactive({
|
|
||||||
});
|
|
||||||
//设置标题
|
|
||||||
const title = computed(() => (!unref(isUpdate) ? '新增' : !unref(isDetail) ? '详情' : '编辑'));
|
|
||||||
//表单提交事件
|
|
||||||
async function handleSubmit(v) {
|
|
||||||
try {
|
|
||||||
let values = await validate();
|
|
||||||
// 预处理日期数据
|
|
||||||
changeDateValue(values);
|
|
||||||
setModalProps({confirmLoading: true});
|
|
||||||
//提交表单
|
|
||||||
await saveOrUpdate(values, isUpdate.value);
|
|
||||||
//关闭弹窗
|
|
||||||
closeModal();
|
|
||||||
//刷新列表
|
|
||||||
emit('success');
|
|
||||||
} 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});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理日期值
|
|
||||||
* @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>
|
|
||||||
/** 时间和数字输入框样式 */
|
|
||||||
:deep(.ant-input-number) {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-calendar-picker) {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
Reference in New Issue
Block a user