优化提交

main
yangyuanshuai 9 months ago
parent 2b4eeb264b
commit aec7eb71e6

@ -47,6 +47,11 @@ export const exportExcelApi = (params: any) => {
return request.doExport({ url: '/RepDataProblem/sdi/reporting/RepDataProblem/RepDataProblemExportXls', params });
};
/** 导出Word */
export const exportWordApi = (params: any) => {
return request.doExport({ url: '/RepDataProblem/sdi/reporting/RepDataProblem/RepDataProblemExportWord', params });
};
/** 获取某个字典 */
export const getCsckCheckType = ({ paramName, systemCode }): Promise<IResponse> => {
return request.postJson({

@ -37,8 +37,8 @@ export const queryRepTemplateApi = (tId?: string): Promise<IResponse> => {
};
/** 查询文件流 */
export const queryFileFlowRepTemplateApi = (tId?: string): Promise<IResponse> => {
return request.postJson({ url: '/RepTemplate/spi/reporting/RepTemplate/RepTemplateQueryOneFileFlow', data: { tId } });
export const queryFileFlowRepTemplateApi = (pId?: string): Promise<IResponse> => {
return request.doPreviewFile({ url: '/RepDataProblem/sdi/reporting/RepDataProblem/RepDataProblemPreview', data: { pId } });
};
/** 同步导入 */

@ -1,6 +1,5 @@
<script setup lang="ts">
import mammoth from 'mammoth';
import "@vue-office/docx/lib/index.css";
import { reactive,ref } from "vue";
import { useRoute } from 'vue-router';
import { ElMessage } from 'element-plus';
@ -22,22 +21,8 @@ const fetchDocFile = async ()=>{
// APIDOC
const response = await queryFileFlowRepTemplateApi(fileData);
console.log(response,"response文件流信息");
const { data, headers } = response;
if(headers['status'] == 500){// WARNERROR
const code = headers['error']?headers['error'].substring(headers['error'].length-4):'1003';
console.log(code)
switch(code){
case "1001":
case "1002":
ElMessage.error(downLoadErrorMsg[code]);
break;
default:
ElMessage.error(downLoadErrorMsg['1003']);
break;
}
return;
}
const arrayBuffer = new File([data], 'document.docx', { type: 'doc' }).arrayBuffer();
const { data } = response;
const arrayBuffer = new File([data], 'document.docx', { type: 'docx' }).arrayBuffer();
console.log(arrayBuffer,"arrayBuffer");
const result = mammoth.convertToHtml({ arrayBuffer });
console.log(result,"result信息");

@ -79,10 +79,7 @@ export default {
}
return;
}
let fileName:string = headers['content-disposition']?.replace(/\w+;\s*filename=(.*)/, '$1');
fileName = fileName?fileName:'报表导出.txt';
// const fileName = "测试导出.xlsx";
// @ts-ignore
const fileName:string = headers['content-disposition']?.replace(/\w+;\s*filename=(.*)/, '$1');
const blob = new Blob([data], {
type: headers['content-type']
})

@ -1910,7 +1910,7 @@ export const asyncRouterMap: AppRouteRecordRaw[] = [
name: 'repIndexSet',
menuId: 'repIndexSet',
meta: {
title: '指标集模型',
title: '指标集',
alwaysShow: true,
type:"ybt",
sort:10,
@ -1922,7 +1922,7 @@ export const asyncRouterMap: AppRouteRecordRaw[] = [
name: 'repStoreParameter',
menuId: 'repStoreParameter',
meta: {
title: '参数管理',
title: '模型参数管理',
alwaysShow: true,
type:"ybt",
sort:11,

@ -18,14 +18,17 @@ import { Search } from '@/components/Search'
import { FormSchema } from '@/components/Form'
import { ContentWrap } from '@/components/ContentWrap'
import Write from './components/Write.vue'
import RuleConfig from './components/RuleConfig.vue'
import { Dialog } from '@/components/Dialog'
import { getWidth } from '@/utils';
import Detail from './components/Detail.vue'
import { Upload } from '@/components/Upload'
import { saveRepDataProblemApi } from '@/api/reporting/RepDataProblem/RepDataProblem'
const { t } = useI18n()
const ids = ref<string[]>([])
const ruleConfigRef = ref<ComponentRef<typeof RuleConfig>>()
const { tableRegister, tableState, tableMethods } = useTable({
fetchDataApi: async () => {
@ -57,43 +60,16 @@ const tableColumns = reactive<TableColumn[]>([
},
{
field: 'indexsetCode',
label: '指标集编码'
label: '指标集编码',
hidden:true
},
{
field: 'code',
label: '科目编码'
},
{
field: 'beginDate',
label: '开始日期'
},
{
field: 'endDate',
label: '结束日期'
label: '指标代码'
},
{
field: 'itemName',
label: '科目名称'
},
{
field: 'itemOrder',
label: '排序'
},
{
field: 'frequency',
label: '频度'
},
{
field: 'isOrgCollect',
label: '是否机构汇总'
},
{
field: 'status',
label: '状态'
},
{
field: 'conCode',
label: '对照指标编码'
label: '指标名称'
},
{
field: 'indexType',
@ -103,17 +79,18 @@ const tableColumns = reactive<TableColumn[]>([
field: 'indexcalType',
label: '指标计算类型'
},
{
field: 'indexdataType',
label: '指标数据类型'
},
{
field: 'indexdataPrecision',
label: '指标数据精度'
field: 'beginDate',
label: '开始日期'
},
{
field: 'indexdataUnit',
label: '指标数据项单位'
field: 'endDate',
label: '结束日期'
},
{
field: 'action',
@ -143,6 +120,10 @@ const tableColumns = reactive<TableColumn[]>([
}}
onConfirm={() => delData(data.row)}
></ElPopconfirm>
<ElLink type="primary" underline={false} onClick={() => action(data.row, 'ruleconfig')}>
{'配置'}
</ElLink>
</>
)
}
@ -151,41 +132,32 @@ const tableColumns = reactive<TableColumn[]>([
].map(item => ({ minWidth: item.label ? getWidth(item.label) : 120, ...item }) as TableColumn))
const searchSchema = reactive<FormSchema[]>([
{
field: 'indexsetCode',
label: '指标集编码',
componentProps: {},
component: 'Input'
},
{
field: 'code',
label: '科目编码',
label: '指标代码',
componentProps: {},
component: 'Input'
},
{
field: 'itemName',
label: '科目名称',
label: '指标名称',
componentProps: {},
component: 'Input'
},
{
field: 'frequency',
label: '频度',
componentProps: {},
component: 'Select'
},
{
field: 'status',
label: '状态',
componentProps: {},
component: 'Select'
},
{
field: 'indexType',
label: '指标类型',
componentProps: {},
component: 'Select'
},
{
field: 'indexDate',
label: '日期范围',
componentProps: {
type:'daterange',
valueFormat: 'YYYYMMDD'
},
component: 'DatePicker'
}
])
@ -216,13 +188,32 @@ 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
}
}
/** 添加指标加工规则**/
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 AddAction = () => {
dialogTitle.value = t('tableDemo.add')
currentRow.value = undefined
@ -321,16 +312,19 @@ const exportExcel = async () => {
<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>

@ -3,7 +3,6 @@ import { Form, FormSchema } from '@/components/Form'
import { useForm } from '@/hooks/web/useForm'
import { PropType, reactive, watch } from 'vue'
import { useValidator } from '@/hooks/web/useValidator'
import { Value } from 'sass';
// import { getWorkFlowVisiableButton } from '@/api/csck/CsckFlow';
const { required } = useValidator()

@ -57,11 +57,16 @@ const tableColumns = reactive<TableColumn[]>([
},
{
field: 'indexsetCode',
label: '指标集编码'
label: '指标集编码',
hidden:true
},
{
field: 'targetCode',
label: '栏编码'
label: '指标属性编码'
},
{
field: 'targetName',
label: '指标属性名称'
},
{
field: 'beginDate',
@ -71,22 +76,6 @@ const tableColumns = reactive<TableColumn[]>([
field: 'endDate',
label: '结束日期'
},
{
field: 'targetName',
label: '栏名称'
},
{
field: 'targetOrder',
label: '排序'
},
{
field: 'status',
label: '状态'
},
{
field: 'isOrgCollect',
label: '是否机构汇总'
},
{
field: 'action',
label: t('tableDemo.action'),
@ -127,26 +116,21 @@ const searchSchema = reactive<FormSchema[]>([
field: 'indexsetCode',
label: '指标集编码',
componentProps: {},
component: 'Input'
component: 'Input',
hidden:true
},
{
field: 'targetName',
label: '栏名称',
field: 'targetCode',
label: '指标属性编号',
componentProps: {},
component: 'Input'
},
{
field: 'status',
label: '状态',
field: 'targetName',
label: '指标属性名称',
componentProps: {},
component: 'Select'
component: 'Input'
},
{
field: 'isOrgCollect',
label: '是否机构汇总',
componentProps: {},
component: 'Select'
}
])
const searchParams = ref({})

@ -10,19 +10,13 @@ import {
import { TableData } from '@/api/reporting/RepDataProblem/RepDataProblem/types'
import { useTable } from '@/hooks/web/useTable'
import { useI18n } from '@/hooks/web/useI18n'
import { Table, TableColumn } from '@/components/Table'
import { ElButton, ElLink, ElLoading, ElPopconfirm, ElMessage } from 'element-plus'
import { Search } from '@/components/Search'
import { FormSchema } from '@/components/Form'
import { ContentWrap } from '@/components/ContentWrap'
import CodeRepItem from '@/views/dataset/CodeRepItem/CodeRepItem.vue';//
import CodeRepTarget from '@/views/dataset/CodeRepTarget/CodeRepTarget.vue';//
import RuleConfig from './components/Ruleconfig.vue'
import Write from './components/Write.vue'
import { Dialog } from '@/components/Dialog'
import { getWidth } from '@/utils';
import { INDEX_CATAGOTY_LIST } from './constants'
const { t } = useI18n()
/**
@ -31,7 +25,7 @@ const { t } = useI18n()
const ids = ref<string[]>([])
const { tableRegister, tableState, tableMethods } = useTable({
const { tableState, tableMethods } = useTable({
fetchDataApi: async () => {
const { currentPage, pageSize } = tableState
const res = await getRepDataProblemListApi({
@ -50,197 +44,15 @@ const { tableRegister, tableState, tableMethods } = useTable({
},
})
const { loading, dataList, total, currentPage, pageSize } = tableState
const { getList, getElTableExpose, delList, refresh } = tableMethods
const indexDefineTableColumns = reactive<TableColumn[]>([
{
field: 'selection',
type: 'selection',
fixed: true
},
{
field: 'dataDate',
label: '指标代码'
},
{
field: 'createTime',
label: '指标名称'
},
{
field: 'tName',
label: '指标类型'
},
{
field: 'tCategory',
label: '指标计算类型'
},
{
field: 'tCategory',
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>
<ElLink type="primary" underline={false} onClick={() => action(data.row, 'ruleconfig')}>
{'配置'}
</ElLink>
</>
)
}
}
}
].map(item => ({ minWidth: item.label ? getWidth(item.label) : 120, ...item }) as TableColumn))
/**
* 指标属性
*/
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 { currentPage } = tableState
const { getList } = tableMethods
const indexDefineSearchSchema = reactive<FormSchema[]>([
{
field: 'createTime',
label: '指标代码',
componentProps: {},
component: 'Input'
},
{
field: 'tName',
label: '指标名称',
componentProps: {},
component: 'Input'
},
{
field: 'tCategory',
label: '指标计算类型',
componentProps: {
options:INDEX_CATAGOTY_LIST
},
component: 'Select'
},
{
field: 'organCode',
label: '日期范围',
componentProps: {type: 'daterange'},
component: 'DatePicker'
}
])
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()
}
const dialogVisible = ref(false)
const dialogTitle = ref('')
@ -248,34 +60,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({
background: 'rgba(0, 0, 0, 0.7)'
})
const res = await queryRepDataProblemApi(row.pId)
.catch(() => {})
.finally(() => {
detailLoading.close()
})
detailLoading.close()
if (res) {
const data = res.body.result
dialogTitle.value = type === 'edit' ? '编辑' : '规则配置'
actionType.value = type
currentRow.value = data
dialogVisible.value = true
}
}
const AddAction = () => {
dialogTitle.value = t('tableDemo.add')
currentRow.value = undefined
dialogVisible.value = true
actionType.value = 'add'
}
const saveLoading = ref(false)
/** 保存 **/
@ -297,36 +83,6 @@ 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)
/** 批量删除 **/
const delDataBatch = async () => {
const elTableExpose = await getElTableExpose()
ids.value = elTableExpose?.getSelectionRows().map((v: TableData) => { v.pId }) || []
delLoading.value = true
await delList(unref(ids).length).finally(() => {
delLoading.value = false
})
}
/** 单行删除 */
const delData = async (row: TableData) => {
@ -342,11 +98,7 @@ const delData = async (row: TableData) => {
}
}
const disabled = ref(true)
const onSelectionChange = (selection: TableData[]) => {
disabled.value = selection.length === 0
}
const activeName = ref('indexDefination')
@ -368,12 +120,11 @@ const handleClick=(tab: any, event: Event | undefined)=> {
</ContentWrap>
<Dialog v-model="dialogVisible" :title="dialogTitle">
<Write
v-if="actionType !== 'ruleconfig'"
v-if="actionType !== 'detail'"
ref="writeRef"
:current-row="currentRow"
:action-type="actionType"
/>
<RuleConfig v-if="actionType === 'ruleconfig'" />
<template #footer>
<ElButton v-if="actionType == 'edit'" type="primary" :loading="saveLoading" @click="save">
{{ t('dialogDemo.save') }}

@ -6,6 +6,7 @@ import {
delRepDataProblemListApi,
delRepDataProblemApi,
queryRepDataProblemApi,
exportWordApi,
} from '@/api/reporting/RepDataProblem/RepDataProblem'
import { TableData } from '@/api/reporting/RepDataProblem/RepDataProblem/types'
import { useTable } from '@/hooks/web/useTable'
@ -33,6 +34,12 @@ const loginOrganCode = getLoginOrganCodeByUserInfo();
const ids = ref<string[]>([])
/** 生成word */
const exportWord = async (row: TableData) => {
const data = { tid: row.tId};
exportWordApi(data);
};
const { tableRegister, tableState, tableMethods } = useTable({
fetchDataApi: async () => {
const { currentPage, pageSize } = tableState
@ -86,10 +93,10 @@ const tableColumns = reactive<TableColumn[]>([
default: (data: any) => {
return (
<>
<ElLink type="primary" underline={false} onClick={() => action(data.row, 'detail')}>
<ElLink type="primary" underline={false} onClick={() => exportWord(data.row)}>
{'生成'}
</ElLink>
<ElLink type="primary" underline={false} onClick={() => ShowPreViewFile(data.row)}>
<ElLink type="primary" disabled={data.row.status=='true'} underline={false} onClick={() => ShowPreViewFile(data.row)}>
{'预览'}
</ElLink>
</>
@ -200,7 +207,7 @@ const ShowPreViewFile = (data)=>{
router.push({
name:'PreViewFile',
query:{
fileData:data.tId,
fileData:data.pId,
}
})
// const routeData = router.resolve({

@ -101,7 +101,7 @@ const formSchema = reactive<FormSchema[]>([
componentProps: {
limit: 1,
drag:true,
accept:".doc,.docx",
accept:".docx",
action: null,
autoUpload:false,
fileList:[],
@ -119,7 +119,7 @@ const formSchema = reactive<FormSchema[]>([
},
slots: {
default: () =><div class="el-upload"><i class="el-icon-upload"></i><br/><h1 class="el-upload__text">拖拽报告模版到这里...<br/><em>上传报告模版</em></h1></div>,
tip: () => <div class="el-upload__tip">doc,docx文件</div>,
tip: () => <div class="el-upload__tip">docx文件</div>,
file:(file)=>{
fileData = file.file.raw;
tName=file.file.name;

Loading…
Cancel
Save