This commit is contained in:
@@ -1,28 +1,26 @@
|
||||
<script setup lang="ts">
|
||||
|
||||
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
||||
import { getVxePopupContainer } from '@vben/utils';
|
||||
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
|
||||
import {
|
||||
useVbenVxeGrid,
|
||||
vxeCheckboxChecked,
|
||||
type VxeGridProps
|
||||
} from '#/adapter/vxe-table';
|
||||
import {onMounted} from "vue";
|
||||
|
||||
import {
|
||||
contingenPlanExport,
|
||||
contingenPlanList,
|
||||
contingenPlanRemove,
|
||||
contingenPlanUpdate
|
||||
} from '#/api/property/customerService/contingenPlan';
|
||||
import type { ContingenPlanForm } from '#/api/property/customerService/contingenPlan/model';
|
||||
questionnaireExport,
|
||||
questionnaireList,
|
||||
questionnaireRemove,
|
||||
} from '#/api/property/customerService/questionnaire/questionnaire';
|
||||
import type { QuestionnaireForm } from '#/api/property/customerService/questionnaire/questionnaire/model';
|
||||
import { commonDownloadExcel } from '#/utils/file/download';
|
||||
|
||||
import contingenPlanModal from './questionnaire-modal.vue';
|
||||
import contingenPlanDetail from './questionnaire-detail.vue';
|
||||
import questionnaireModal from './questionnaire-modal.vue';
|
||||
import { columns, querySchema } from './data';
|
||||
import {personList} from "#/api/property/resident/person";
|
||||
import {renderDictValue} from "#/utils/render";
|
||||
|
||||
import questionnaireDetail from './questionnaire-detail.vue'
|
||||
const formOptions: VbenFormProps = {
|
||||
commonConfig: {
|
||||
labelWidth: 80,
|
||||
@@ -40,6 +38,8 @@ const gridOptions: VxeGridProps = {
|
||||
highlight: true,
|
||||
// 翻页时保留选中状态
|
||||
reserve: true,
|
||||
// 点击行选中
|
||||
// trigger: 'row',
|
||||
},
|
||||
columns,
|
||||
height: 'auto',
|
||||
@@ -48,7 +48,7 @@ const gridOptions: VxeGridProps = {
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues = {}) => {
|
||||
return await contingenPlanList({
|
||||
return await questionnaireList({
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
@@ -60,7 +60,7 @@ const gridOptions: VxeGridProps = {
|
||||
keyField: 'id',
|
||||
},
|
||||
// 表格全局唯一表示 保存列配置需要用到
|
||||
id: 'system-contingenPlan-index'
|
||||
id: 'property-questionnaire-index'
|
||||
};
|
||||
|
||||
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
@@ -68,113 +68,76 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
gridOptions,
|
||||
});
|
||||
|
||||
const [ContingenPlanModal, modalApi] = useVbenModal({
|
||||
connectedComponent: contingenPlanModal,
|
||||
const [QuestionnaireModal, modalApi] = useVbenModal({
|
||||
connectedComponent: questionnaireModal,
|
||||
});
|
||||
|
||||
const [contingenPlanDetailModal, contingenPlanDetailApi] = useVbenModal({
|
||||
connectedComponent: contingenPlanDetail,
|
||||
const [QuestionnaireDetail, detailApi] = useVbenModal({
|
||||
connectedComponent: questionnaireDetail,
|
||||
});
|
||||
|
||||
async function handleInfo(row: Required<ContingenPlanForm>) {
|
||||
contingenPlanDetailApi.setData({ id: row.id });
|
||||
contingenPlanDetailApi.open();
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
modalApi.setData({});
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleEdit(row: Required<ContingenPlanForm>) {
|
||||
async function handleEdit(row: Required<QuestionnaireForm>) {
|
||||
modalApi.setData({ id: row.id });
|
||||
modalApi.open();
|
||||
}
|
||||
async function handleInfo(row: Required<QuestionnaireForm>) {
|
||||
detailApi.setData({ id: row.id });
|
||||
detailApi.open();
|
||||
}
|
||||
|
||||
async function handleDelete(row: Required<ContingenPlanForm>) {
|
||||
await contingenPlanRemove(row.id);
|
||||
async function handleDelete(row: Required<QuestionnaireForm>) {
|
||||
await questionnaireRemove(row.id);
|
||||
await tableApi.query();
|
||||
}
|
||||
|
||||
async function handleExamine(row: Required<ContingenPlanForm>) {
|
||||
row.status = '1'
|
||||
await contingenPlanUpdate(row);
|
||||
await tableApi.query();
|
||||
}
|
||||
|
||||
function handleMultiDelete() {
|
||||
const rows = tableApi.grid.getCheckboxRecords();
|
||||
const ids = rows.map((row: Required<ContingenPlanForm>) => row.id);
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
okType: 'danger',
|
||||
content: `确认删除选中的${ids.length}条记录吗?`,
|
||||
onOk: async () => {
|
||||
await contingenPlanRemove(ids);
|
||||
await tableApi.query();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function handleDownloadExcel() {
|
||||
commonDownloadExcel(contingenPlanExport, '应急预案管理数据', tableApi.formApi.form.values, {
|
||||
fieldMappingTime: formOptions.fieldMappingTime,
|
||||
});
|
||||
}
|
||||
|
||||
async function queryPersonData() {
|
||||
let params = {
|
||||
pageSize: 1000,
|
||||
pageNum: 1,
|
||||
}
|
||||
const res = await personList(params);
|
||||
const options = res.rows.map((user) => ({
|
||||
label: user.userName + '-' + renderDictValue(user.gender, 'sys_user_sex') + '-' + user.phone,
|
||||
value: user.id,
|
||||
}));
|
||||
tableApi.formApi.updateSchema([
|
||||
{
|
||||
componentProps: () => ({
|
||||
options: options,
|
||||
showSearch:true,
|
||||
filterOption: filterOption
|
||||
}),
|
||||
fieldName: 'dutyPersion',
|
||||
}
|
||||
])
|
||||
}
|
||||
|
||||
const filterOption = (input: string, option: any) => {
|
||||
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
await queryPersonData()
|
||||
})
|
||||
// function handleMultiDelete() {
|
||||
// const rows = tableApi.grid.getCheckboxRecords();
|
||||
// const ids = rows.map((row: Required<QuestionnaireForm>) => row.id);
|
||||
// Modal.confirm({
|
||||
// title: '提示',
|
||||
// okType: 'danger',
|
||||
// content: `确认删除选中的${ids.length}条记录吗?`,
|
||||
// onOk: async () => {
|
||||
// await questionnaireRemove(ids);
|
||||
// await tableApi.query();
|
||||
// },
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// function handleDownloadExcel() {
|
||||
// commonDownloadExcel(questionnaireExport, '调查问卷数据', tableApi.formApi.form.values, {
|
||||
// fieldMappingTime: formOptions.fieldMappingTime,
|
||||
// });
|
||||
// }
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page :auto-content-height="true">
|
||||
<BasicTable table-title="应急预案管理列表">
|
||||
<BasicTable table-title="调查问卷列表">
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<a-button
|
||||
v-access:code="['system:contingenPlan:export']"
|
||||
@click="handleDownloadExcel"
|
||||
>
|
||||
{{ $t('pages.common.export') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||
danger
|
||||
type="primary"
|
||||
v-access:code="['system:contingenPlan:remove']"
|
||||
@click="handleMultiDelete">
|
||||
{{ $t('pages.common.delete') }}
|
||||
</a-button>
|
||||
<!-- <a-button-->
|
||||
<!-- v-access:code="['property:questionnaire:export']"-->
|
||||
<!-- @click="handleDownloadExcel"-->
|
||||
<!-- >-->
|
||||
<!-- {{ $t('pages.common.export') }}-->
|
||||
<!-- </a-button>-->
|
||||
<!-- <a-button-->
|
||||
<!-- :disabled="!vxeCheckboxChecked(tableApi)"-->
|
||||
<!-- danger-->
|
||||
<!-- type="primary"-->
|
||||
<!-- v-access:code="['property:questionnaire:remove']"-->
|
||||
<!-- @click="handleMultiDelete">-->
|
||||
<!-- {{ $t('pages.common.delete') }}-->
|
||||
<!-- </a-button>-->
|
||||
<a-button
|
||||
type="primary"
|
||||
v-access:code="['system:contingenPlan:add']"
|
||||
v-access:code="['property:questionnaire:add']"
|
||||
@click="handleAdd"
|
||||
>
|
||||
{{ $t('pages.common.add') }}
|
||||
@@ -183,28 +146,16 @@ onMounted(async () => {
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<Popconfirm
|
||||
v-if="row.status === '0'"
|
||||
:get-popup-container="getVxePopupContainer"
|
||||
placement="left"
|
||||
title="确认审核?"
|
||||
@confirm="handleExamine(row)"
|
||||
>
|
||||
<ghost-button
|
||||
@click.stop=""
|
||||
>
|
||||
{{ '审核' }}
|
||||
</ghost-button>
|
||||
</Popconfirm>
|
||||
<ghost-button
|
||||
v-access:code="['property:questionnaire:info']"
|
||||
@click.stop="handleInfo(row)"
|
||||
>
|
||||
{{ $t('pages.common.info') }}
|
||||
预览问卷
|
||||
</ghost-button>
|
||||
<ghost-button
|
||||
v-if="row.status === '0'"
|
||||
v-access:code="['system:contingenPlan:edit']"
|
||||
v-access:code="['property:questionnaire:edit']"
|
||||
@click.stop="handleEdit(row)"
|
||||
:disabled="row.status!=='1'"
|
||||
>
|
||||
{{ $t('pages.common.edit') }}
|
||||
</ghost-button>
|
||||
@@ -216,16 +167,23 @@ onMounted(async () => {
|
||||
>
|
||||
<ghost-button
|
||||
danger
|
||||
v-access:code="['system:contingenPlan:remove']"
|
||||
v-access:code="['property:questionnaire:remove']"
|
||||
@click.stop=""
|
||||
:disabled="row.status!=='1'"
|
||||
>
|
||||
{{ $t('pages.common.delete') }}
|
||||
</ghost-button>
|
||||
</Popconfirm>
|
||||
<ghost-button
|
||||
v-access:code="['property:questionnaire:info']"
|
||||
@click.stop="handleEdit(row)"
|
||||
>
|
||||
统计分析
|
||||
</ghost-button>
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<ContingenPlanModal @reload="tableApi.query()" />
|
||||
<contingenPlanDetailModal/>
|
||||
<QuestionnaireModal @reload="tableApi.query()" />
|
||||
<QuestionnaireDetail/>
|
||||
</Page>
|
||||
</template>
|
||||
|
Reference in New Issue
Block a user