add:数据解析结果显示

This commit is contained in:
zhangzq
2024-05-14 10:39:14 +08:00
parent 1e2da6f427
commit c81d454a4f
3 changed files with 87 additions and 4 deletions

View File

@@ -132,7 +132,7 @@
:close-on-click-modal="false"
title="表单同步测试"
:visible.sync=syncShow
width="600px"
width="800px"
@close="syncAnalyseCannel"
>
<el-form ref="form" :model="syncForm" :rules="rules" size="mini" label-width="50px">
@@ -140,9 +140,69 @@
<el-input disabled v-model="syncForm.form_name" :precision="0" style="width: 150px;" />
</el-form-item>
<el-form-item label="测试数据" prop="analyseData">
<el-input type="textarea" v-model="syncForm.analyseData" :precision="0" style="width: 450px;" />
<el-input type="textarea" v-model="syncForm.analyseData" :precision="0" style="width: 650px;" />
</el-form-item>
</el-form>
<div v-if="viewMst.length >0">
<div class="crud-opts2">
<span class="role-span2">解析数据</span>
</div>
<el-card class="box-card" shadow="never" :body-style="{padding:'0'}">
<!--表格渲染-->
<el-table
ref="table"
:data="viewMst"
style="width: 100%;"
max-height="300"
size="mini"
border
:highlight-current-row="true"
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
<el-table-column min-width="120" show-overflow-tooltip prop="id" label="id" align="center" />
<el-table-column min-width="120" show-overflow-tooltip prop="code" label="单据编码" align="center" />
<el-table-column min-width="120" show-overflow-tooltip prop="biz_code" label="业务单" align="center" />
<el-table-column min-width="120" show-overflow-tooltip prop="material_id" label="物料id" align="center" />
<el-table-column min-width="120" show-overflow-tooltip prop="pcsn" label="批次" align="center" />
<el-table-column min-width="120" show-overflow-tooltip prop="qty" label="数量" align="center" />
<el-table-column min-width="120" show-overflow-tooltip prop="vehicle_code" label="载具" align="center" />
<el-table-column min-width="120" show-overflow-tooltip prop="status" label="单据状态" align="center" />
<el-table-column min-width="120" show-overflow-tooltip v-for="(item, index) in viewMstCols" :key="item.value" :label="item.lable" >
<template slot-scope="scope">{{scope.row.form_data[item.value]}}</template>
</el-table-column>
</el-table>
</el-card>
<div v-if="hasDtl">
<div class="crud-opts2">
<span class="role-span2">明细数据</span>
</div>
<el-card class="box-card" shadow="never" :body-style="{padding:'0'}">
<!--表格渲染-->
<el-table
ref="table"
:data="viewDtl"
style="width: 100%;"
max-height="300"
size="mini"
border
:highlight-current-row="true"
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
<el-table-column min-width="120" show-overflow-tooltip prop="id" label="id" align="center" />
<el-table-column min-width="120" show-overflow-tooltip prop="code" label="单据编码" align="center" />
<el-table-column min-width="120" show-overflow-tooltip prop="biz_code" label="业务单" align="center" />
<el-table-column min-width="120" show-overflow-tooltip prop="material_id" label="物料id" align="center" />
<el-table-column min-width="120" show-overflow-tooltip prop="pcsn" label="批次" align="center" />
<el-table-column min-width="120" show-overflow-tooltip prop="qty" label="数量" align="center" />
<el-table-column min-width="120" show-overflow-tooltip prop="vehicle_code" label="载具" align="center" />
<el-table-column min-width="120" show-overflow-tooltip prop="status" label="单据状态" align="center" />
<el-table-column min-width="120" show-overflow-tooltip v-for="(item, index) in viewDtlCols" :key="item.value" :label="item.lable" >
<template slot-scope="scope">{{scope.row.form_data[item.value]}}</template>
</el-table-column>
</el-table>
</el-card>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button :loading="crud.cu === 2" type="primary" @click="syncAnalyseSubmit">同步解析</el-button>
</div>
@@ -244,6 +304,11 @@ export default {
syncShow: false,
syncForm: {},
permission: {},
viewMst: [],
viewDtl: [],
hasDtl: false,
viewMstCols: {},
viewDtlCols: {},
rules: {
position_code: [
{ required: true, message: '缓存线位置编码不能为空', trigger: 'blur' }
@@ -294,14 +359,32 @@ export default {
syncTest(row){
this.syncShow = true
this.syncForm = row
crudFormMapping.tableColumns(row.form_type).then(res => {
this.viewMstCols = res.item
if (res.dtl_item != null){
this.hasDtl = true
this.viewDtlCols = res.dtl_item
}
})
},
syncAnalyseSubmit(){
this.viewMst=[]
this.viewDtl = []
crudFormMapping.syncAnalyse(this.syncForm).then(res => {
this.crud.notify('解析成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
for (let i = 0; i < res.content.length; i++) {
if (i==0){this.viewMst.push(res.content[i])}
else {this.viewDtl.push(res.content[i])}
}
})
},
syncAnalyseCannel(){
this.syncForm = {}
this.viewMst = [],
this.viewDtl = [],
this.hasDtl = false,
this.viewMstCols = {},
this.viewDtlCols = {}
}
}
}