dbsd_kczx/src/views/kc/config/StaticCon/StaticCon.vue

208 lines
4.8 KiB
Vue

<template>
<div>
<!--查询区域-->
<!--引用表格-->
<BasicTable @register="registerTable" >
<template #tableTitle>
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction />
</template>
<template #fileSlot="{text}">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button>
</template>
</BasicTable>
</div>
</template>
<script lang="ts" name="config-KcTkypdata" setup>
import { ref, reactive, computed, watch, nextTick,defineExpose } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { columns } from './StaticCon.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './StaticCon.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
import { JInput } from '/@/components/Form';
import { getSysConfig } from '/@/views/site/utils/index';
import { getUserInfo, getUserId } from '/@/views/site/utils/index';
const roleList = computed(() => getUserInfo()?.roleList??[]);
const queryParam = ref<any>({});
const toggleSearchStatus = ref<boolean>(false);
const { createMessage } = useMessage();
const xqDictTag = ref();
watch(() => xqDictTag.value?.dictOptions,(d) => {
if(d){
queryParam.value.xqxn = d[0]?.value
if(queryParam.value.xqxn){
nextTick(() => {
reload();
})
}
}
},{
deep:true,
immediate:true,
});
//注册table数据
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: 'kc_export_config_tpkwcqkjzglx',
api: list,
columns,
canResize:false,
useSearchForm: false,
showActionColumn: false,
immediate: false,
actionColumn: {
width: 120,
fixed: 'right',
},
beforeFetch: (params) => {
params.column = '',params.order = '';//新生成的默认不带排序
params.findByDwmc = !roleList.value.filter(x => x.roleCode == 'admin' ).length
params.findGh = getUserId()
//params.xqxn = getSysConfig().flag1;
return Object.assign(params, queryParam.value);
},
},
exportConfig: {
name: "人员信息",
url: getExportUrl,
params: () => {
let params:any = {};
params.findByDwmc = !roleList.value.filter(x => x.roleCode == 'admin' ).length
params.findGh = getUserId()
return Object.assign(params,queryParam.value);
}
},
importConfig: {
url: getImportUrl,
success: handleSuccess
},
});
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
const labelCol = reactive({
xs: { span: 24 },
sm: { span: 7 },
});
const wrapperCol = reactive({
xs: { span: 24 },
sm: { span: 16 },
});
const registerYqModal = ref();
function handleAdd() {
registerYqModal.value.disableSubmit = false;
registerYqModal.value.add();
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
console.log(`🚀 ~ file: StaticCon.vue:125 ~ handleEdit ~ record:`, record)
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
}
/**
* 删除事件
*/
async function handleDelete(record) {
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
}
/**
* 成功回调
*/
function handleSuccess() {
reload();
}
/**
* 操作栏
*/
function getTableAction(record) {
}
/**
* 下拉操作栏
*/
function getDropDownAction(record) {
}
/**
* 查询
*/
function searchQuery() {
reload();
}
/**
* 重置
*/
function searchReset() {
queryParam.value = {};
selectedRowKeys.value = [];
//刷新数据
reload();
}
function init(record){
console.log(`🚀 ~ file: StaticCon.vue:177 ~ init ~ record:`, record)
queryParam.value.code = record.code;
reload();
}
defineExpose({
init,
});
</script>
<style lang="less" scoped>
.jeecg-basic-table-form-container {
.table-page-search-submitButtons {
display: block;
margin-bottom: 24px;
white-space: nowrap;
}
.query-group-cust{
width: calc(50% - 15px);
min-width: 100px !important;
}
.query-group-split-cust{
width: 30px;
display: inline-block;
text-align: center
}
}
</style>