255 lines
9.4 KiB
Vue
255 lines
9.4 KiB
Vue
<template>
|
|
<BasicTable @register="registerTable">
|
|
<template #tableTitle>
|
|
<a-button v-auth="'archives:group_user_batch:big'" type="primary" preIcon="ant-design:import-outlined" @click="downloadTemplate1">
|
|
下载大病人员模板</a-button
|
|
>
|
|
<a-upload
|
|
v-auth="'archives:group_user_batch:big'"
|
|
name="file"
|
|
:showUploadList="false"
|
|
:customRequest="onImportXls1"
|
|
accept=".xlsx, .xls, application/vnd.ms-excel-=='"
|
|
>
|
|
<a-button type="primary" preIcon="ant-design:import-outlined" :loading="bigLoading">导入大病人员</a-button>
|
|
</a-upload>
|
|
<a-button v-auth="'archives:group_user_batch:slow'" type="primary" preIcon="ant-design:import-outlined" @click="downloadTemplate2">
|
|
下载慢病人员模板</a-button
|
|
>
|
|
<a-upload
|
|
v-auth="'archives:group_user_batch:slow'"
|
|
name="file"
|
|
:showUploadList="false"
|
|
:customRequest="onImportXls2"
|
|
accept=".xlsx, .xls, application/vnd.ms-excel-=='"
|
|
>
|
|
<a-button type="primary" preIcon="ant-design:import-outlined" :loading="slowLoading">导入慢病人员</a-button>
|
|
</a-upload>
|
|
|
|
<a-button type="primary" preIcon="ant-design:plus-outlined" v-auth="'archives:group_user_batch:automaticAbnormal'" @click="automatic1">
|
|
自动添加最新体检异常项
|
|
</a-button>
|
|
<a-button type="primary" preIcon="ant-design:plus-outlined" v-auth="'archives:group_user_batch:automaticResult'" @click="automatic2">
|
|
自动添加评估结果
|
|
</a-button>
|
|
|
|
<a-button v-auth="'archives:group_user_batch:importExcel'" type="primary" preIcon="ant-design:import-outlined" @click="downloadTemplate3">
|
|
下载批量修改导入模板
|
|
</a-button>
|
|
<a-upload
|
|
v-auth="'archives:group_user_batch:importExcel'"
|
|
name="file"
|
|
:showUploadList="false"
|
|
:customRequest="onImportXls3"
|
|
accept=".xlsx, .xls, application/vnd.ms-excel-=='"
|
|
>
|
|
<a-button type="primary">批量修改导入</a-button>
|
|
</a-upload>
|
|
<a-button v-auth="'archives:group_user_batch:exportFivePeople'" type="primary" preIcon="ant-design:export-outlined" @click="exportReport">
|
|
导出
|
|
</a-button>
|
|
<a-button
|
|
v-auth="'archives:group_user_batch:exportFivePeopleRecord'"
|
|
preIcon="ant-design:search-outlined"
|
|
@click="handleLookRecord"
|
|
type="primary"
|
|
>查看导出记录
|
|
</a-button>
|
|
<!-- <a-button v-auth="'archives:group_user_batch:importExcel'" @click="handleLookRecord" type="primary"> 查看批量修改导入记录 </a-button>-->
|
|
</template>
|
|
<!--操作栏-->
|
|
<template #action="{ record }">
|
|
<TableAction :actions="getTableAction(record)" />
|
|
</template>
|
|
</BasicTable>
|
|
<index-drawer @register="registerDrawer" @success="handleSuccess" />
|
|
<!-- <ExportUtil task-code="batchUpdateUserGroup" :params="{ handleType: '2' }" @register="registerExport" />-->
|
|
<ExportUtil task-code="groupUserTaskCode" @register="registerExport" />
|
|
</template>
|
|
<script setup lang="ts">
|
|
import BasicTable from '/@/components/Table/src/BasicTable.vue';
|
|
import { TableAction } from '/@/components/Table';
|
|
import { useListPage } from '/@/hooks/system/useListPage';
|
|
import {
|
|
listApi,
|
|
Api,
|
|
autoAddCApi,
|
|
autoAddDApi,
|
|
excelImportTemplateUrl,
|
|
listGroupUserExportApi,
|
|
} from '/@/views/archive/fiveClassPeople/index.api';
|
|
import { columns, searchFormSchema } from '/@/views/archive/fiveClassPeople/index.data';
|
|
import IndexDrawer from '/@/views/archive/fiveClassPeople/components/indexDrawer.vue';
|
|
import { useDrawer } from '/@/components/Drawer';
|
|
import { useMethods } from '/@/hooks/system/useMethods';
|
|
import { downloadExcel } from '/@/views/healthMonitor/healMonitorManage/monitorToll/toolManagement/toolHooks';
|
|
import { ref } from 'vue';
|
|
import ExportUtil from '/@/utils/export/exportUtil.vue';
|
|
import { message } from 'ant-design-vue';
|
|
|
|
const [registerDrawer, { openDrawer }] = useDrawer();
|
|
const [registerExport, { openDrawer: openExportDrawer }] = useDrawer();
|
|
|
|
function exportReport() {
|
|
const val = getForm().getFieldsValue();
|
|
listGroupUserExportApi(val);
|
|
}
|
|
function handleLookRecord() {
|
|
openExportDrawer(true, {});
|
|
}
|
|
|
|
const { hasParamsImportXls, handleExportXlsx } = useMethods();
|
|
|
|
const bigLoading = ref(false);
|
|
const slowLoading = ref(false);
|
|
|
|
function getTableAction(record: Recordable) {
|
|
return [
|
|
{
|
|
label: '编辑',
|
|
onclick: handleEdit.bind(null, record),
|
|
auth: 'archives:edit-button',
|
|
},
|
|
];
|
|
}
|
|
|
|
function handleEdit(record: Recordable) {
|
|
openDrawer(true, {
|
|
record,
|
|
});
|
|
}
|
|
|
|
const { tableContext } = useListPage({
|
|
tableProps: {
|
|
api: listApi,
|
|
columns,
|
|
canResize: false,
|
|
beforeFetch: (params) => {
|
|
if (params['orgCode2']) {
|
|
params['orgCode'] = params['orgCode2'];
|
|
} else {
|
|
params['orgCode'] = params['orgCode1'];
|
|
}
|
|
return params;
|
|
},
|
|
formConfig: {
|
|
schemas: searchFormSchema,
|
|
autoSubmitOnEnter: true,
|
|
showAdvancedButton: false,
|
|
fieldMapToNumber: [],
|
|
},
|
|
showIndexColumn: true,
|
|
indexColumnProps: {
|
|
width: 80,
|
|
},
|
|
actionColumn: {
|
|
width: 80,
|
|
fixed: 'right',
|
|
},
|
|
},
|
|
});
|
|
|
|
const [registerTable, { reload, getForm }] = tableContext;
|
|
|
|
function handleSuccess() {
|
|
reload();
|
|
}
|
|
|
|
function onImportXls1(d) {
|
|
const size = d.file.size;
|
|
const m10 = 1024 * 1024 * 10;
|
|
if (size > m10) {
|
|
console.log('文件过大');
|
|
}
|
|
bigLoading.value = true;
|
|
console.log(d, 'dddddd');
|
|
hasParamsImportXls(d, Api.groupUserAImportExcel, { noMessage: true }, (res) => {
|
|
if (res?.code != 200) {
|
|
alert(
|
|
res?.result
|
|
? res?.result
|
|
.map((item: any) => {
|
|
return item.substring(0, item.length) + ';';
|
|
})
|
|
.join('\n')
|
|
: res?.message
|
|
);
|
|
}
|
|
reload();
|
|
}).finally(() => {
|
|
bigLoading.value = false;
|
|
});
|
|
}
|
|
function onImportXls2(d) {
|
|
const size = d.file.size;
|
|
const m10 = 1024 * 1024 * 10;
|
|
if (size > m10) {
|
|
console.log('文件过大');
|
|
}
|
|
slowLoading.value = true;
|
|
hasParamsImportXls(d, Api.groupUserBImportExcel, { noMessage: true }, (res) => {
|
|
alert(
|
|
res?.result
|
|
? res?.result
|
|
.map((item: any) => {
|
|
return item.substring(0, item.length) + ';';
|
|
})
|
|
.join('\n')
|
|
: res?.message
|
|
);
|
|
reload();
|
|
}).finally(() => {
|
|
slowLoading.value = false;
|
|
});
|
|
}
|
|
|
|
function onImportXls3(file) {
|
|
hasParamsImportXls(file, Api.groupImportExcel, {}, (res) => {
|
|
alert(
|
|
res?.result
|
|
? res?.result
|
|
.map((item: any) => {
|
|
return item.substring(0, item.length) + ';';
|
|
})
|
|
.join('\n')
|
|
: res?.message
|
|
);
|
|
reload();
|
|
}).finally(() => {
|
|
slowLoading.value = false;
|
|
});
|
|
}
|
|
|
|
function downloadTemplate1() {
|
|
// downloadExcel('/static/fiveClass/big.xlsx', '大病人员导入模板');
|
|
downLoadFile('1');
|
|
}
|
|
function downloadTemplate2() {
|
|
// downloadExcel('/static/fiveClass/slow.xlsx', '慢病人员导入模板');
|
|
downLoadFile('2');
|
|
}
|
|
function downloadTemplate3() {
|
|
downloadExcel('/static/fiveClass/large.xlsx', '批量修改导入模板');
|
|
}
|
|
|
|
async function downLoadFile(type) {
|
|
await handleExportXlsx(type === '1' ? '大病人员导入模板' : '慢病人员导入模板', excelImportTemplateUrl, { type: type });
|
|
// try {
|
|
// let res: any = await excelImportTemplateApi({ type: type });
|
|
// let blob = new Blob([res], { type: 'application/octet-stream' });
|
|
// let link = document.createElement('a');
|
|
// link.href = window.URL.createObjectURL(blob);
|
|
// link.download = (type === 1 ? '大病人员导入模板' : '慢病人员导入模板') + '.xlsx';
|
|
// link.click();
|
|
// } catch {}
|
|
}
|
|
|
|
function automatic1() {
|
|
autoAddCApi();
|
|
}
|
|
function automatic2() {
|
|
autoAddDApi();
|
|
}
|
|
</script>
|
|
<style scoped lang="less"></style>
|