|
|
|
@ -15,12 +15,16 @@ import { ElButton, ElLink, ElLoading, ElPopconfirm, ElMessage } from 'element-pl
|
|
|
|
|
import { Search } from '@/components/Search'
|
|
|
|
|
import { FormSchema } from '@/components/Form'
|
|
|
|
|
import { ContentWrap } from '@/components/ContentWrap'
|
|
|
|
|
import RuleConfig from './components/Ruleconfig.vue'
|
|
|
|
|
import Write from './components/Write.vue'
|
|
|
|
|
import { Dialog } from '@/components/Dialog'
|
|
|
|
|
import { getWidth } from '@/utils';
|
|
|
|
|
import Detail from './components/Detail.vue'
|
|
|
|
|
import { method } from 'lodash-es'
|
|
|
|
|
|
|
|
|
|
const { t } = useI18n()
|
|
|
|
|
/**
|
|
|
|
|
* 指标定义
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
const ids = ref<string[]>([])
|
|
|
|
|
|
|
|
|
@ -30,7 +34,7 @@ const { tableRegister, tableState, tableMethods } = useTable({
|
|
|
|
|
const res = await getRepDataProblemListApi({
|
|
|
|
|
pageIndex: unref(currentPage),
|
|
|
|
|
pageSize: unref(pageSize),
|
|
|
|
|
...unref(searchParams)
|
|
|
|
|
...unref(indexDefineSearchParams)
|
|
|
|
|
})
|
|
|
|
|
return {
|
|
|
|
|
list: res.body.list,
|
|
|
|
@ -45,8 +49,7 @@ const { tableRegister, tableState, tableMethods } = useTable({
|
|
|
|
|
|
|
|
|
|
const { loading, dataList, total, currentPage, pageSize } = tableState
|
|
|
|
|
const { getList, getElTableExpose, delList, refresh } = tableMethods
|
|
|
|
|
|
|
|
|
|
const tableColumns = reactive<TableColumn[]>([
|
|
|
|
|
const indexDefineTableColumns = reactive<TableColumn[]>([
|
|
|
|
|
{
|
|
|
|
|
field: 'selection',
|
|
|
|
|
type: 'selection',
|
|
|
|
@ -108,7 +111,7 @@ const tableColumns = reactive<TableColumn[]>([
|
|
|
|
|
}}
|
|
|
|
|
onConfirm={() => delData(data.row)}
|
|
|
|
|
></ElPopconfirm>
|
|
|
|
|
<ElLink type="primary" underline={false} onClick={() => action(data.row, 'detail')}>
|
|
|
|
|
<ElLink type="primary" underline={false} onClick={() => action(data.row, 'ruleconfig')}>
|
|
|
|
|
{'配置'}
|
|
|
|
|
</ElLink>
|
|
|
|
|
</>
|
|
|
|
@ -118,7 +121,67 @@ const tableColumns = reactive<TableColumn[]>([
|
|
|
|
|
}
|
|
|
|
|
].map(item => ({ minWidth: item.label ? getWidth(item.label) : 120, ...item }) as TableColumn))
|
|
|
|
|
|
|
|
|
|
const searchSchema = reactive<FormSchema[]>([
|
|
|
|
|
/**
|
|
|
|
|
* 指标属性
|
|
|
|
|
*/
|
|
|
|
|
const indexPropertiesTableColumns = reactive<TableColumn[]>([
|
|
|
|
|
{
|
|
|
|
|
field: 'selection',
|
|
|
|
|
type: 'selection',
|
|
|
|
|
fixed: true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'dataDate',
|
|
|
|
|
label: '指标属性编号'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'createTime',
|
|
|
|
|
label: '指标属性名称'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'tCategory',
|
|
|
|
|
label: '开始时间'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'tCategory',
|
|
|
|
|
label: '结束时间'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'action',
|
|
|
|
|
label: t('tableDemo.action'),
|
|
|
|
|
width: 160,
|
|
|
|
|
fixed: 'right',
|
|
|
|
|
slots: {
|
|
|
|
|
default: (data: any) => {
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<ElLink type="primary" underline={false} onClick={() => action(data.row, 'edit')}>
|
|
|
|
|
{t('tableDemo.edit')}
|
|
|
|
|
</ElLink>
|
|
|
|
|
<ElPopconfirm
|
|
|
|
|
title={t('common.delTableMsg')}
|
|
|
|
|
width={200}
|
|
|
|
|
v-slots={{
|
|
|
|
|
reference: () => {
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<ElLink type="primary" underline={false}>
|
|
|
|
|
{t('tableDemo.del')}
|
|
|
|
|
</ElLink>
|
|
|
|
|
</>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}}
|
|
|
|
|
onConfirm={() => delData(data.row)}
|
|
|
|
|
></ElPopconfirm>
|
|
|
|
|
</>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
].map(item => ({ minWidth: item.label ? getWidth(item.label) : 120, ...item }) as TableColumn))
|
|
|
|
|
|
|
|
|
|
const indexDefineSearchSchema = reactive<FormSchema[]>([
|
|
|
|
|
{
|
|
|
|
|
field: 'createTime',
|
|
|
|
|
label: '指标代码',
|
|
|
|
@ -146,9 +209,31 @@ const searchSchema = reactive<FormSchema[]>([
|
|
|
|
|
}
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
const searchParams = ref({})
|
|
|
|
|
const setSearchParams = (data: any) => {
|
|
|
|
|
searchParams.value = data
|
|
|
|
|
const indexPropertiesSearchSchema = reactive<FormSchema[]>([
|
|
|
|
|
{
|
|
|
|
|
field: 'createTime',
|
|
|
|
|
label: '编号',
|
|
|
|
|
componentProps: {},
|
|
|
|
|
component: 'Input'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'tName',
|
|
|
|
|
label: '名称',
|
|
|
|
|
componentProps: {},
|
|
|
|
|
component: 'Input'
|
|
|
|
|
}
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
const indexDefineSearchParams = ref({})
|
|
|
|
|
const indexDefineSetSearchParams = (data: any) => {
|
|
|
|
|
indexDefineSearchParams.value = data
|
|
|
|
|
getList()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const indexPropertieSearchParams = ref({})
|
|
|
|
|
const indexPropertieSetSearchParams = (data: any) => {
|
|
|
|
|
indexPropertieSearchParams.value = data
|
|
|
|
|
getList()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -158,8 +243,8 @@ const dialogTitle = ref('')
|
|
|
|
|
const currentRow = ref()
|
|
|
|
|
const actionType = ref('')
|
|
|
|
|
|
|
|
|
|
const ruleConfigRef = ref<ComponentRef<typeof RuleConfig>>()
|
|
|
|
|
const writeRef = ref<ComponentRef<typeof Write>>()
|
|
|
|
|
|
|
|
|
|
/**单行查询**/
|
|
|
|
|
const action = async (row: TableData, type: string) => {
|
|
|
|
|
let detailLoading = ElLoading.service({
|
|
|
|
@ -173,7 +258,7 @@ const action = async (row: TableData, type: string) => {
|
|
|
|
|
detailLoading.close()
|
|
|
|
|
if (res) {
|
|
|
|
|
const data = res.body.result
|
|
|
|
|
dialogTitle.value = t(type === 'edit' ? 'tableDemo.edit' : 'tableDemo.detail')
|
|
|
|
|
dialogTitle.value = type === 'edit' ? '编辑' : '规则配置'
|
|
|
|
|
actionType.value = type
|
|
|
|
|
currentRow.value = data
|
|
|
|
|
dialogVisible.value = true
|
|
|
|
@ -207,6 +292,25 @@ const save = async () => {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 添加指标加工规则**/
|
|
|
|
|
const addRuleConfig = async () => {
|
|
|
|
|
const ruleConfig = unref(ruleConfigRef)
|
|
|
|
|
const formData = await ruleConfig?.submit()
|
|
|
|
|
if (formData) {
|
|
|
|
|
saveLoading.value = true
|
|
|
|
|
const res = await saveRepDataProblemApi(formData)
|
|
|
|
|
.catch(() => {})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
saveLoading.value = false
|
|
|
|
|
})
|
|
|
|
|
if (res) {
|
|
|
|
|
dialogVisible.value = false
|
|
|
|
|
currentPage.value = 1
|
|
|
|
|
getList()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const delLoading = ref(false)
|
|
|
|
|
|
|
|
|
|
/** 批量删除 **/
|
|
|
|
@ -238,53 +342,95 @@ const disabled = ref(true)
|
|
|
|
|
const onSelectionChange = (selection: TableData[]) => {
|
|
|
|
|
disabled.value = selection.length === 0
|
|
|
|
|
}
|
|
|
|
|
const activeName = ref('indexDefination')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const handleClick=(tab: any, event: Event | undefined)=> {
|
|
|
|
|
console.log(tab,event);
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<ContentWrap>
|
|
|
|
|
<Search :schema="searchSchema" @reset="setSearchParams" @search="setSearchParams" />
|
|
|
|
|
|
|
|
|
|
<Table
|
|
|
|
|
:columns="tableColumns"
|
|
|
|
|
v-model:pageSize="pageSize"
|
|
|
|
|
v-model:currentPage="currentPage"
|
|
|
|
|
default-expand-all
|
|
|
|
|
node-key="pId"
|
|
|
|
|
:data="dataList"
|
|
|
|
|
:loading="loading"
|
|
|
|
|
:pagination="{
|
|
|
|
|
total
|
|
|
|
|
}"
|
|
|
|
|
@selection-change="onSelectionChange"
|
|
|
|
|
@register="tableRegister"
|
|
|
|
|
@refresh="refresh"
|
|
|
|
|
>
|
|
|
|
|
<template #buttons>
|
|
|
|
|
<ElButton type="primary" @click="AddAction">{{ t('tableDemo.add') }}</ElButton>
|
|
|
|
|
<ElButton :loading="delLoading" type="primary" :disabled="disabled" @click="delDataBatch()">
|
|
|
|
|
{{ t('tableDemo.del') }}
|
|
|
|
|
</ElButton>
|
|
|
|
|
<ElButton type="primary" :disabled="disabled" @click="AddAction">{{'导出EXCEL'}}</ElButton>
|
|
|
|
|
<ElButton :loading="delLoading" type="primary" @click="delDataBatch()">
|
|
|
|
|
{{'导入excel'}}
|
|
|
|
|
</ElButton>
|
|
|
|
|
</template>
|
|
|
|
|
</Table>
|
|
|
|
|
</ContentWrap>
|
|
|
|
|
<ElTabs v-model="activeName" type="" @tab-click="handleClick">
|
|
|
|
|
<ElTabPane label="指标定义" name="indexDefination">
|
|
|
|
|
<ContentWrap>
|
|
|
|
|
<Search :schema="indexDefineSearchSchema" @reset="indexDefineSetSearchParams" @search="indexDefineSetSearchParams" />
|
|
|
|
|
<Table
|
|
|
|
|
:columns="indexDefineTableColumns"
|
|
|
|
|
v-model:pageSize="pageSize"
|
|
|
|
|
v-model:currentPage="currentPage"
|
|
|
|
|
default-expand-all
|
|
|
|
|
node-key="pId"
|
|
|
|
|
:data="dataList"
|
|
|
|
|
:loading="loading"
|
|
|
|
|
:pagination="{
|
|
|
|
|
total
|
|
|
|
|
}"
|
|
|
|
|
@selection-change="onSelectionChange"
|
|
|
|
|
@register="tableRegister"
|
|
|
|
|
@refresh="refresh"
|
|
|
|
|
>
|
|
|
|
|
<template #buttons>
|
|
|
|
|
<ElButton type="primary" @click="AddAction">{{ t('tableDemo.add') }}</ElButton>
|
|
|
|
|
<ElButton :loading="delLoading" type="primary" :disabled="disabled" @click="delDataBatch()">
|
|
|
|
|
{{ t('tableDemo.del') }}
|
|
|
|
|
</ElButton>
|
|
|
|
|
<ElButton type="primary" :disabled="disabled" @click="AddAction">{{ '导出EXCEL' }}</ElButton>
|
|
|
|
|
<ElButton :loading="delLoading" type="primary" @click="delDataBatch()">
|
|
|
|
|
{{ '导入excel' }}
|
|
|
|
|
</ElButton>
|
|
|
|
|
</template>
|
|
|
|
|
</Table>
|
|
|
|
|
</ContentWrap>
|
|
|
|
|
</ElTabPane>
|
|
|
|
|
<ElTabPane label="指标属性" name="indexProperties">
|
|
|
|
|
<ContentWrap>
|
|
|
|
|
<Search :schema="indexPropertiesSearchSchema" @reset="indexPropertieSetSearchParams" @search="indexPropertieSetSearchParams" />
|
|
|
|
|
<Table
|
|
|
|
|
:columns="indexPropertiesTableColumns"
|
|
|
|
|
v-model:pageSize="pageSize"
|
|
|
|
|
v-model:currentPage="currentPage"
|
|
|
|
|
default-expand-all
|
|
|
|
|
node-key="pId"
|
|
|
|
|
:data="dataList"
|
|
|
|
|
:loading="loading"
|
|
|
|
|
:pagination="{
|
|
|
|
|
total
|
|
|
|
|
}"
|
|
|
|
|
@selection-change="onSelectionChange"
|
|
|
|
|
@register="tableRegister"
|
|
|
|
|
@refresh="refresh"
|
|
|
|
|
>
|
|
|
|
|
<template #buttons>
|
|
|
|
|
<ElButton type="primary" @click="AddAction">{{ t('tableDemo.add') }}</ElButton>
|
|
|
|
|
<ElButton :loading="delLoading" type="primary" :disabled="disabled" @click="delDataBatch()">
|
|
|
|
|
{{ t('tableDemo.del') }}
|
|
|
|
|
</ElButton>
|
|
|
|
|
<ElButton type="primary" :disabled="disabled" @click="AddAction">{{ '导出EXCEL' }}</ElButton>
|
|
|
|
|
<ElButton :loading="delLoading" type="primary" @click="delDataBatch()">
|
|
|
|
|
{{ '导入excel' }}
|
|
|
|
|
</ElButton>
|
|
|
|
|
</template>
|
|
|
|
|
</Table>
|
|
|
|
|
</ContentWrap>
|
|
|
|
|
</ElTabPane>
|
|
|
|
|
</ElTabs>
|
|
|
|
|
|
|
|
|
|
<Dialog v-model="dialogVisible" :title="dialogTitle">
|
|
|
|
|
<Write
|
|
|
|
|
v-if="actionType !== 'detail'"
|
|
|
|
|
v-if="actionType !== 'ruleconfig'"
|
|
|
|
|
ref="writeRef"
|
|
|
|
|
:current-row="currentRow"
|
|
|
|
|
:action-type="actionType"
|
|
|
|
|
/>
|
|
|
|
|
<Detail v-if="actionType === 'detail'" :current-row="currentRow" />
|
|
|
|
|
<RuleConfig v-if="actionType === 'ruleconfig'" />
|
|
|
|
|
<template #footer>
|
|
|
|
|
<ElButton v-if="actionType !== 'detail'" type="primary" :loading="saveLoading" @click="save">
|
|
|
|
|
<ElButton v-if="actionType == 'edit'" type="primary" :loading="saveLoading" @click="save">
|
|
|
|
|
{{ t('dialogDemo.save') }}
|
|
|
|
|
</ElButton>
|
|
|
|
|
<ElButton v-if="actionType == 'ruleconfig'" type="primary" :loading="saveLoading" @click="addRuleConfig">
|
|
|
|
|
{{ t('formDemo.add') }}
|
|
|
|
|
</ElButton>
|
|
|
|
|
<ElButton @click="dialogVisible = false">{{ t('dialogDemo.close') }}</ElButton>
|
|
|
|
|
</template>
|
|
|
|
|
</Dialog>
|
|
|
|
|