提交 2d7cca30 authored 作者: kxjia's avatar kxjia

修改tb3验证

上级 217d97cc
...@@ -25,8 +25,8 @@ enum Api { ...@@ -25,8 +25,8 @@ enum Api {
queryHistoryFill = '/baosong/baosongTaskRecord/queryHistoryFill', queryHistoryFill = '/baosong/baosongTaskRecord/queryHistoryFill',
batchSaveOrUpdateBeforeDelete = '/baosong/baosongTaskRecord/batchSaveOrUpdateBeforeDelete', batchSaveOrUpdateBeforeDelete = '/baosong/baosongTaskRecord/batchSaveOrUpdateBeforeDelete',
findFilledlist = '/baosong/baosongTaskRecord/findFilledlist', findFilledlist = '/baosong/baosongTaskRecord/findFilledlist',
findFillHistoryForCheck = '/baosong/baosongTaskRecord/findFillHistoryForCheck',
} }
...@@ -107,6 +107,9 @@ export const queryTaskRecords = (params) => { ...@@ -107,6 +107,9 @@ export const queryTaskRecords = (params) => {
} }
export const findFillHistoryForCheck = (params) =>
defHttp.get({url: Api.findFillHistoryForCheck, params});
export const deleteByPitemidAndRind = (params, handleSuccess) => { export const deleteByPitemidAndRind = (params, handleSuccess) => {
createConfirm({ createConfirm({
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
</div> </div>
</template> </template>
<template #tools> <template #tools>
<vxe-button status="primary" icon="vxe-icon-edit" @click="handleOpenHistoryDrawer()" :disabled="loading">近5年数据填报</vxe-button>
<vxe-button status="primary" icon="vxe-icon-edit" @click="validateAndShowResults()" :disabled="loading">校验</vxe-button> <vxe-button status="primary" icon="vxe-icon-edit" @click="validateAndShowResults()" :disabled="loading">校验</vxe-button>
<vxe-button status="primary" icon="vxe-icon-save" @click="saveBatch()" :disabled="loading">保存</vxe-button> <vxe-button status="primary" icon="vxe-icon-save" @click="saveBatch()" :disabled="loading">保存</vxe-button>
</template> </template>
...@@ -234,13 +235,14 @@ ...@@ -234,13 +235,14 @@
</div> </div>
</template> </template>
</vxe-drawer> </vxe-drawer>
</div> <HistoryFillCheck ref="historyFillCheckRef" v-model="historyDrawerVisible" @closeDrawer="closeHistoryDrawer"/>
</div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import MultiColumnTable from '../tableComponents/MultiColumnTable.vue' import MultiColumnTable from '../tableComponents/MultiColumnTable.vue'
import AttachTable from '../tableComponents/AttachTable.vue' import AttachTable from '../tableComponents/AttachTable.vue'
import HistoryFillCheck from './check/HistoryFillCheck.vue'
import { tableFormData } from '../../data/tb3.data'; import { tableFormData } from '../../data/tb3.data';
import { ref, reactive,nextTick,onMounted,toRaw } from 'vue' import { ref, reactive,nextTick,onMounted,toRaw } from 'vue'
...@@ -252,6 +254,8 @@ import { getTblvalidFormula } from '../../tpl/BaosongDataValid.api' ...@@ -252,6 +254,8 @@ import { getTblvalidFormula } from '../../tpl/BaosongDataValid.api'
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
const historyFillCheckRef = ref();
const historyDrawerVisible = ref(false);
const route = useRoute(); const route = useRoute();
const tableRef = ref(); const tableRef = ref();
...@@ -934,10 +938,8 @@ const validateAllInputs = async () => { ...@@ -934,10 +938,8 @@ const validateAllInputs = async () => {
try { try {
const formulaItems = validFormula.value const formulaItems = validFormula.value
const codeVal = await buildCodeValueMap() const codeVal = await buildCodeValueMap()
validationResults.value = {} validationResults.value = {}
validationMessages.value = {} validationMessages.value = {}
for (const strKey in formData) { for (const strKey in formData) {
const val = formData[strKey] const val = formData[strKey]
if (val !== undefined && val !== null && val !== '') { if (val !== undefined && val !== null && val !== '') {
...@@ -947,7 +949,6 @@ const validateAllInputs = async () => { ...@@ -947,7 +949,6 @@ const validateAllInputs = async () => {
const regex = new RegExp(`\\b${field}\\b`, 'gi') const regex = new RegExp(`\\b${field}\\b`, 'gi')
return regex.test(formulaText) return regex.test(formulaText)
}) })
if (targetFormula) { if (targetFormula) {
const formulaText = (targetFormula.formula || '').toString() const formulaText = (targetFormula.formula || '').toString()
const isValid = await evaluateFormula(formulaText, codeVal) const isValid = await evaluateFormula(formulaText, codeVal)
...@@ -967,7 +968,15 @@ const validateAllInputs = async () => { ...@@ -967,7 +968,15 @@ const validateAllInputs = async () => {
} }
} }
const closeHistoryDrawer = () => {
historyFillCheckRef.value.closeDrawer();
historyDrawerVisible.value = false;
}
const handleOpenHistoryDrawer = () => {
historyFillCheckRef.value.onDrawerShow(queryParam.value.tplId);
// 设置抽屉可见
historyDrawerVisible.value = true;
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
......
<template>
<vxe-drawer
v-model="drawerVisibleFromProp"
placement="right"
title="近5年填报数据对比"
width="90%"
:footer="{ show: true }"
>
<div>
<vxe-grid v-bind="gridOptions"></vxe-grid>
</div>
</vxe-drawer>
</template>
<script lang="ts" setup>
import { ref,reactive, computed } from 'vue'
import type { VxeGridProps } from 'vxe-table'
import type { VxeGridPropTypes } from 'vxe-table'
import { findFillHistoryForCheck } from '/@/views/baosong/record/BaosongTaskRecord.api';
const props = defineProps({
modelValue: {
type: Boolean,
default: false
}
})
const emit = defineEmits(['update:modelValue'])
const tableData = ref<RowVO[]>([]);
const drawerVisible = ref(false);
const drawerVisibleFromProp = computed({
get: () => props.modelValue,
set: (value) => emit('update:modelValue', value)
})
interface RowVO {
id: number
itemId: number
itemName: string
values: string[]
}
const gridOptions = reactive<VxeGridProps<RowVO>>({
border: true,
size: 'small',
columns: [
{ type: 'seq', width: 70 },
{ field: 'itemId', title: '字段ID',width: "10%",visible:false},
{ field: 'itemName', title: '字段名称',width: "15%"},
{ field: 'values', title: '最近5年填报数据',width: "75%",
children: [
{ field: 'value1', title: '第一次',width: "15%"},
{ field: 'value2', title: '第二次',width: "15%"},
{ field: 'value3', title: '第三次',width: "15%"},
{ field: 'value4', title: '第四次',width: "15%"},
{ field: 'value5', title: '第五次',width: "15%"},
],
},
{ field: 'opt', title: '操作' ,width: "10%"},
],
data: []
})
async function onDrawerShow(tplid: number) {
const retData = await findFillHistoryForCheck({
tplid: tplid
});
// 处理 values 数据
const processedData = retData.map(item => {
const processedItem = {...item};
// 将 values 数组中的 value 属性提取出来
if (Array.isArray(processedItem.values)) {
processedItem.values.forEach((valueItem, index) => {
// 将每个 valueItem 的 value 属性设置到单独的字段中
processedItem[`value${index}`] = valueItem.value;
});
}
return processedItem;
});
gridOptions.data = processedData;
return false;
}
const closeDrawer = () => {
drawerVisible.value = false;
emit('update:modelValue', false);
}
defineExpose({
onDrawerShow,
closeDrawer
});
</script>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论