|
|
|
@ -22,8 +22,10 @@ import { Dialog } from '@/components/Dialog'
|
|
|
|
|
import { getWidth } from '@/utils';
|
|
|
|
|
import Detail from './components/Detail.vue'
|
|
|
|
|
import { Upload } from '@/components/Upload'
|
|
|
|
|
import { useRoute } from 'vue-router';
|
|
|
|
|
import { useRoute,useRouter } from 'vue-router';
|
|
|
|
|
const route = useRoute();
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
|
|
|
|
|
const pageQuery = ref(route || null);
|
|
|
|
|
const modelCode = pageQuery.value?.query?.modelCode;
|
|
|
|
|
const { t } = useI18n()
|
|
|
|
@ -85,12 +87,15 @@ const tableColumns = reactive<TableColumn[]>([
|
|
|
|
|
{
|
|
|
|
|
field: 'action',
|
|
|
|
|
label: t('tableDemo.action'),
|
|
|
|
|
width: 160,
|
|
|
|
|
width: 200,
|
|
|
|
|
fixed: 'right',
|
|
|
|
|
slots: {
|
|
|
|
|
default: (data: any) => {
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<ElLink type="primary" underline={false} onClick={() => getModelParam(data.row)}>
|
|
|
|
|
增加规则
|
|
|
|
|
</ElLink>
|
|
|
|
|
<ElLink type="primary" underline={false} onClick={() => action(data.row, 'edit')}>
|
|
|
|
|
{t('tableDemo.edit')}
|
|
|
|
|
</ElLink>
|
|
|
|
@ -131,18 +136,13 @@ const searchSchema = reactive<FormSchema[]>([
|
|
|
|
|
componentProps: {},
|
|
|
|
|
component: 'Input'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'organCode',
|
|
|
|
|
label: '用户所属机构',
|
|
|
|
|
componentProps: {},
|
|
|
|
|
component: 'Select'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'createDate',
|
|
|
|
|
label: '创建日期',
|
|
|
|
|
componentProps: {},
|
|
|
|
|
component: 'DatePicker'
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
field: 'modelName',
|
|
|
|
|
label: '描述',
|
|
|
|
|
componentProps: {},
|
|
|
|
|
component: 'Input'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
const searchParams = ref({})
|
|
|
|
@ -179,6 +179,17 @@ const action = async (row: TableData, type: string) => {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 数据模型新增规则 **/
|
|
|
|
|
const getModelParam = (data)=>{
|
|
|
|
|
console.log(data);
|
|
|
|
|
router.push({
|
|
|
|
|
name:'repStoreParameter',
|
|
|
|
|
query:{
|
|
|
|
|
modelCode:data.modelCode,
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const AddAction = () => {
|
|
|
|
|
dialogTitle.value = t('tableDemo.add')
|
|
|
|
|
currentRow.value = undefined
|
|
|
|
@ -210,8 +221,8 @@ const delLoading = ref(false)
|
|
|
|
|
|
|
|
|
|
/** 批量删除 **/
|
|
|
|
|
const delDataBatch = async () => {
|
|
|
|
|
const elTableExpose = await getElTableExpose()
|
|
|
|
|
ids.value = elTableExpose?.getSelectionRows().map((v: TableData) => { v.modelCode }) || []
|
|
|
|
|
const elTableExpose = await getElTableExpose();
|
|
|
|
|
ids.value = elTableExpose?.getSelectionRows().map((v: TableData) => { return v.modelCode }) || []
|
|
|
|
|
delLoading.value = true
|
|
|
|
|
await delList(unref(ids).length).finally(() => {
|
|
|
|
|
delLoading.value = false
|
|
|
|
@ -235,12 +246,17 @@ const delData = async (row: TableData) => {
|
|
|
|
|
const disabled = ref(true)
|
|
|
|
|
|
|
|
|
|
const onSelectionChange = (selection: TableData[]) => {
|
|
|
|
|
console.log(selection,"selection的信息");
|
|
|
|
|
disabled.value = selection.length === 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 导出Excel */
|
|
|
|
|
const exportExcel = async () => {
|
|
|
|
|
const data = { ...unref(searchParams) }
|
|
|
|
|
const data = { ...unref(searchParams) };
|
|
|
|
|
const elTableExpose = await getElTableExpose();
|
|
|
|
|
const list = elTableExpose?.getSelectionRows();
|
|
|
|
|
data['list'] = list;
|
|
|
|
|
console.log(data,"导出的参数信息");
|
|
|
|
|
await exportExcelApi(data)
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
@ -267,7 +283,7 @@ const exportExcel = async () => {
|
|
|
|
|
<template #buttons>
|
|
|
|
|
<ElButton type="primary" @click="AddAction">{{ t('tableDemo.add') }}</ElButton>
|
|
|
|
|
<Upload :url="importExcelApiUrl" :callback="getList"> <ElButton type="primary">导入</ElButton> </Upload>
|
|
|
|
|
<ElButton type="primary" @click="exportExcel()">导出</ElButton>
|
|
|
|
|
<ElButton type="primary" @click="exportExcel()" :disabled="disabled">导出</ElButton>
|
|
|
|
|
<ElButton :loading="delLoading" type="primary" :disabled="disabled" @click="delDataBatch()">
|
|
|
|
|
{{ t('tableDemo.del') }}
|
|
|
|
|
</ElButton>
|
|
|
|
|