add:入库单主表处理:自定义入库单字段处理
This commit is contained in:
@@ -106,11 +106,11 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.receivedCount()
|
||||
this.$bus.on(NOTICE_MESSAGE_UPDATE, this.receivedCount) // 监听事件
|
||||
// this.receivedCount()
|
||||
// this.$bus.on(NOTICE_MESSAGE_UPDATE, this.receivedCount) // 监听事件
|
||||
},
|
||||
destroyed() {
|
||||
this.$bus.off(NOTICE_MESSAGE_UPDATE)
|
||||
// this.$bus.off(NOTICE_MESSAGE_UPDATE)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -109,10 +109,10 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
// 绑定查看站内信消息事件
|
||||
this.$bus.on(NOTICE_SHOW_MESSAGE, this.show)
|
||||
// this.$bus.on(NOTICE_SHOW_MESSAGE, this.show)
|
||||
},
|
||||
destroyed() {
|
||||
this.$bus.off(NOTICE_SHOW_MESSAGE)
|
||||
// this.$bus.off(NOTICE_SHOW_MESSAGE)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -32,4 +32,12 @@ export function getTypes(params) {
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, getTypes}
|
||||
|
||||
export function getHeader(params) {
|
||||
return request({
|
||||
url: '/api/bmFormStruc/formColumns/' + params,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, getTypes, getHeader}
|
||||
|
||||
367
wms_pro/qd/src/views/wms/stor_manage/in/index.vue
Normal file
367
wms_pro/qd/src/views/wms/stor_manage/in/index.vue
Normal file
@@ -0,0 +1,367 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<div >
|
||||
<!-- 搜索 -->
|
||||
<el-form
|
||||
:inline="true"
|
||||
class="demo-form-inline"
|
||||
label-position="right"
|
||||
label-width="80px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="单据类型">
|
||||
<el-select
|
||||
v-model="query.bill_type"
|
||||
clearable
|
||||
filterable
|
||||
size="mini"
|
||||
placeholder="单据类型"
|
||||
class="filter-item"
|
||||
@change="crud.toQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.ST_INV_CP_IN_TYPE"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<!--<el-form-item label="生成方式">
|
||||
<el-select
|
||||
v-model="query.bill_type"
|
||||
clearable
|
||||
filterable
|
||||
size="mini"
|
||||
placeholder="生成方式"
|
||||
class="filter-item"
|
||||
@change="crud.toQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.ST_INV_CP_IN_TYPE"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>-->
|
||||
|
||||
<el-form-item label="单据日期">
|
||||
<el-date-picker
|
||||
v-model="query.createTime"
|
||||
type="daterange"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="['00:00:00', '23:59:59']"
|
||||
@change="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="单据状态">
|
||||
<el-select
|
||||
v-model="query.bill_status"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="单据状态"
|
||||
class="filter-item"
|
||||
@change="crud.toQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.IO_BILL_STATUS"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="入库单号">
|
||||
<el-input
|
||||
v-model="query.bill_code"
|
||||
size="mini"
|
||||
clearable
|
||||
placeholder="单据号"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="生产车间">
|
||||
<el-select
|
||||
v-model="query.product_area"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="全部"
|
||||
class="filter-item"
|
||||
@change="crud.toQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.product_area"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<rrOperation />
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission">
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="success"
|
||||
:disabled="dis_flag"
|
||||
icon="el-icon-position"
|
||||
size="mini"
|
||||
@click="divOpen"
|
||||
>
|
||||
分配
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="success"
|
||||
icon="el-icon-position"
|
||||
size="mini"
|
||||
:disabled="task_flag"
|
||||
@click="taskOpen"
|
||||
>
|
||||
作业任务
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="warning"
|
||||
icon="el-icon-check"
|
||||
size="mini"
|
||||
:disabled="confirm_flag"
|
||||
@click="confirm"
|
||||
>
|
||||
强制确认
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
size="mini"
|
||||
:data="crud.data"
|
||||
highlight-current-row
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
@current-change="handleCurrentChange"
|
||||
@select="handleSelectionChange"
|
||||
@select-all="onSelectAll"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column show-overflow-tooltip prop="code" width="130" label="单据号">
|
||||
<template slot-scope="scope">
|
||||
<el-link type="warning" @click="toView(scope.row)">{{ scope.row.code }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column show-overflow-tooltip prop="status" label="单据状态" />
|
||||
<el-table-column prop="product_area" label="生产车间" width="130" show-overflow-tooltip />
|
||||
<el-table-column show-overflow-tooltip prop="form_type" min-width="120" label="单据类型" />
|
||||
<el-table-column show-overflow-tooltip prop="biz_code" label="仓库" min-width="120" />
|
||||
<el-table-column show-overflow-tooltip min-width="120" prop="biz_date" label="业务日期" />
|
||||
<template v-for="(col,index) in cols">
|
||||
<el-table-column :prop="col.value" :label="col.lable" width="120px" show-overflow-tooltip />
|
||||
</template>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="创建人" align="center" prop="create_id" />
|
||||
<el-table-column label="创建时间" align="center" prop="create_time" width="150" />
|
||||
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
:data="scope.row"
|
||||
:permission="permission"
|
||||
:disabled-edit="canUd(scope.row)"
|
||||
:disabled-dle="canUd(scope.row)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
<!-- <AddDialog @AddChanged="querytable" />-->
|
||||
<!-- <ViewDialog :dialog-show.sync="viewShow" :rowmst="mstrow" @AddChanged="querytable" />-->
|
||||
<!-- <DivDialog :dialog-show.sync="divShow" :stor-id="storId" :open-param="openParam" @AddChanged="querytable" />-->
|
||||
<!-- <TaskDialog :dialog-show.sync="taskShow" :open-param="taskOpenParam" />-->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import formstruc from '@/views/wms/config_manage/formStruc/formstruc'
|
||||
import crudProductIn from '@/views/wms/stor_manage/in/storinvin'
|
||||
import CRUD, { crud, header, presenter } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
// import AddDialog from '@/views/wms/storage_manage/product/productIn/AddDialog'
|
||||
// import DivDialog from '@/views/wms/storage_manage/product/productIn/DivDialog'
|
||||
// import ViewDialog from '@/views/wms/storage_manage/product/productIn/ViewDialog'
|
||||
import { mapGetters } from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'ProductIn',
|
||||
components: { formstruc, crudProductIn, crudOperation, rrOperation, udOperation, pagination },
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '',
|
||||
optShow: { add: true, reset: true },
|
||||
idField: 'iostorinv_id',
|
||||
url: '/api/stIvtIostorinvIn',
|
||||
crudMethod: { ...crudProductIn },
|
||||
props: {
|
||||
size: 10
|
||||
}
|
||||
})
|
||||
},
|
||||
mixins: [presenter(), header(), crud()],
|
||||
// 数据字典
|
||||
dicts: ['IO_BILL_STATUS', 'ST_INV_CP_IN_TYPE', 'product_area'],
|
||||
data() {
|
||||
return {
|
||||
cols:[],
|
||||
height: document.documentElement.clientHeight - 180 + 'px;',
|
||||
permission: {},
|
||||
dis_flag: true,
|
||||
task_flag: true,
|
||||
confirm_flag: true,
|
||||
disShow: false,
|
||||
viewShow: false,
|
||||
mstrow: {},
|
||||
divShow: false,
|
||||
openParam: [],
|
||||
taskOpenParam: [],
|
||||
currentRow: null,
|
||||
storlist: [],
|
||||
storId: null,
|
||||
taskShow: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'user'
|
||||
])
|
||||
},
|
||||
mounted: function() {
|
||||
const that = this
|
||||
window.onresize = function temp() {
|
||||
that.height = document.documentElement.clientHeight - 180 + 'px;'
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// crudStorattr.getStor({ 'stor_type': '4' }).then(res => {
|
||||
// this.storlist = res.content
|
||||
// })
|
||||
},
|
||||
methods: {
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
formstruc.getHeader('STOR_IN').then(res => {
|
||||
this.cols = res
|
||||
})
|
||||
},
|
||||
fun(val) {
|
||||
return Number(val).toFixed(3)
|
||||
},
|
||||
canUd(row) {
|
||||
return row.bill_status !== '10'
|
||||
},
|
||||
handleSelectionChange(val, row) {
|
||||
if (val.length > 1) {
|
||||
this.$refs.table.clearSelection()
|
||||
this.$refs.table.toggleRowSelection(val.pop())
|
||||
this.buttonChange(row)
|
||||
} else if (val.length === 1) {
|
||||
this.buttonChange(row)
|
||||
} else {
|
||||
this.handleCurrentChange(null)
|
||||
}
|
||||
},
|
||||
onSelectAll() {
|
||||
this.$refs.table.clearSelection()
|
||||
this.handleCurrentChange(null)
|
||||
},
|
||||
buttonChange(currentRow) {
|
||||
if (currentRow !== null) {
|
||||
this.currentRow = currentRow
|
||||
if (currentRow.bill_status === '10' || currentRow.bill_status === '20' || currentRow.bill_status === '30') {
|
||||
this.dis_flag = false
|
||||
} else {
|
||||
this.dis_flag = true
|
||||
}
|
||||
if (currentRow.bill_status === '30' || currentRow.bill_status === '20') {
|
||||
this.confirm_flag = false
|
||||
} else {
|
||||
this.confirm_flag = true
|
||||
}
|
||||
if (currentRow.bill_status !== '99') {
|
||||
this.task_flag = false
|
||||
} else {
|
||||
this.task_flag = true
|
||||
}
|
||||
}
|
||||
},
|
||||
handleCurrentChange(currentRow) {
|
||||
if (currentRow === null) {
|
||||
this.dis_flag = true
|
||||
this.confirm_flag = true
|
||||
this.task_flag = true
|
||||
this.currentRow = {}
|
||||
}
|
||||
},
|
||||
bill_typeFormat(row, column) {
|
||||
return this.dict.label.ST_INV_CP_IN_TYPE[row.bill_type]
|
||||
},
|
||||
toView(row) {
|
||||
this.mstrow = row
|
||||
this.viewShow = true
|
||||
},
|
||||
confirm() {
|
||||
if (!this.currentRow) {
|
||||
this.crud.notify('请选择一条单据', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
crudProductIn.confirm({ 'iostorinv_id': this.currentRow.iostorinv_id }).then(res => {
|
||||
this.crud.notify('单据确认成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.crud.toQuery()
|
||||
})
|
||||
},
|
||||
stateFormat(row, column) {
|
||||
return this.dict.label.IO_BILL_STATUS[row.bill_status]
|
||||
},
|
||||
divOpen() {
|
||||
crudProductIn.getIosInvDtl({ 'bill_code': this.currentRow.bill_code }).then(res => {
|
||||
this.openParam = res
|
||||
this.storId = this.currentRow.stor_id
|
||||
this.billType = this.currentRow.bill_type
|
||||
this.divShow = true
|
||||
})
|
||||
},
|
||||
taskOpen() {
|
||||
crudProductIn.getIosInvDtl({ 'bill_code': this.currentRow.bill_code }).then(res => {
|
||||
this.taskOpenParam = res
|
||||
})
|
||||
this.taskShow = true
|
||||
},
|
||||
querytable() {
|
||||
this.onSelectAll()
|
||||
this.crud.toQuery()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
::v-deep .el-dialog__body {
|
||||
padding-top: 10px;
|
||||
}
|
||||
</style>
|
||||
138
wms_pro/qd/src/views/wms/stor_manage/in/storinvin.js
Normal file
138
wms_pro/qd/src/views/wms/stor_manage/in/storinvin.js
Normal file
@@ -0,0 +1,138 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: '/api/productIn',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: '/api/productIn/delete',
|
||||
method: 'post',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: '/api/productIn/update',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function getIosInvDis(data) {
|
||||
return request({
|
||||
url: '/api/productIn/getIosInvDis',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function vehicleCheck() {
|
||||
return request({
|
||||
url: '/api/productIn/vehicleCheck',
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
export function confirmvehicle(data) {
|
||||
return request({
|
||||
url: '/api/productIn/confirmvehicle',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function getSect(data) {
|
||||
return request({
|
||||
url: '/api/stIvtSectattr/getSect',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function divStruct(data) {
|
||||
return request({
|
||||
url: '/api/productIn/divStruct',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function unDivStruct(data) {
|
||||
return request({
|
||||
url: '/api/productIn/unDivStruct',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function setPoint(data) {
|
||||
return request({
|
||||
url: '/api/productIn/setPoint',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function confirm(data) {
|
||||
return request({
|
||||
url: '/api/productIn/confirm',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function cancelConfirmvehicle(data) {
|
||||
return request({
|
||||
url: '/api/productIn/cancelConfirmvehicle',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function delTask(data) {
|
||||
return request({
|
||||
url: '/api/productIn/delTask',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function sendTask(data) {
|
||||
return request({
|
||||
url: '/api/productIn/sendTask',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function confirmTask(data) {
|
||||
return request({
|
||||
url: '/api/productIn/confirmTask',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default {
|
||||
add,
|
||||
edit,
|
||||
del,
|
||||
getIosInvDis,
|
||||
vehicleCheck,
|
||||
confirmvehicle,
|
||||
getSect,
|
||||
divStruct,
|
||||
unDivStruct,
|
||||
setPoint,
|
||||
confirm,
|
||||
cancelConfirmvehicle,
|
||||
delTask,
|
||||
sendTask,
|
||||
confirmTask
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
label-width="80px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="表单结构表" prop="local_table_name">
|
||||
<el-form-item label="表单结构表" prop="form_type">
|
||||
<el-select
|
||||
v-model="form.form_type"
|
||||
clearable
|
||||
@@ -37,13 +37,13 @@
|
||||
:value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="表单名称" prop="api_address">
|
||||
<el-form-item label="表单名称" prop="form_name">
|
||||
<el-input v-model="form.form_name" :disabled=true style="width: 180px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="表单描述" prop="api_address">
|
||||
<el-form-item label="表单描述" prop="form_desc">
|
||||
<el-input v-model="form.form_desc" :disabled=true style="width: 180px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="接口地址" prop="api_address">
|
||||
<el-form-item label="接口地址" prop="sync_url">
|
||||
<el-input v-model="form.sync_url" :disabled="!form.form_type" style="width: 180px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="同步类型" prop="sync_type">
|
||||
|
||||
@@ -20,31 +20,20 @@
|
||||
label-width="80px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="映射表名" prop="local_table_name">
|
||||
<el-select
|
||||
v-model="form.local_table_name"
|
||||
clearable
|
||||
filterable
|
||||
size="mini"
|
||||
disabled
|
||||
placeholder="请选择/搜索"
|
||||
class="filter-item"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in tableNameList"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
<el-form-item label="映射表类型" prop="form_type">
|
||||
<el-input v-model="form.form_type" :disabled=true style="width: 180px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="接口地址" prop="api_address">
|
||||
<el-input v-model="form.api_address" :disabled="!form.local_table_name" style="width: 180px;" />
|
||||
<el-form-item label="映射表名" prop="form_name">
|
||||
<el-input v-model="form.form_name" :disabled=true style="width: 180px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="接口地址" prop="sync_url">
|
||||
<el-input v-model="form.sync_url" style="width: 180px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="同步类型" prop="sync_type">
|
||||
<el-select
|
||||
v-model="form.sync_type"
|
||||
class="filter-item"
|
||||
clearable
|
||||
:disabled="!form.local_table_name"
|
||||
placeholder="请选择"
|
||||
style="width: 180px"
|
||||
>
|
||||
@@ -63,7 +52,6 @@
|
||||
clearable
|
||||
placeholder="请选择"
|
||||
style="width: 180px"
|
||||
:disabled="!form.local_table_name"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.external_system"
|
||||
@@ -77,9 +65,13 @@
|
||||
</el-form>
|
||||
</span>
|
||||
</div>
|
||||
<el-tabs v-model="currentTab" class="center-tabs">
|
||||
<el-tab-pane label="主表字段映射" name="mst" />
|
||||
<el-tab-pane v-if='this.form.has_child' label="明细字段映射" name="dtl" />
|
||||
</el-tabs>
|
||||
<el-table
|
||||
ref="table"
|
||||
:data="tableData"
|
||||
:data="currentTab==='mst'?tableData:tableDtlData"
|
||||
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
|
||||
border
|
||||
highlight-current-row
|
||||
@@ -93,14 +85,20 @@
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
type="danger"
|
||||
@click.native.prevent="deleteRow(scope.$index, tableData)"
|
||||
@click.native.prevent="deleteRow(scope.$index, currentTab==='mst'?tableData:tableDtlData)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="字段名称" prop="local_field_name" />
|
||||
<el-table-column align="center" label="外部系统字段名称" prop="external_field_name">
|
||||
<el-table-column align="center" label="表单字段" prop="value" />
|
||||
<el-table-column align="center" label="表单字段名称" prop="lable" />
|
||||
<el-table-column align="center" label="外部系统映射字段" prop="mapping_field">
|
||||
<template scope="scope">
|
||||
<el-input v-model="scope.row.external_field_name" size="mini" />
|
||||
<el-input v-model="scope.row.mapping_field" size="mini" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="映射表达式" prop="skipExpression">
|
||||
<template scope="scope">
|
||||
<el-input v-model="scope.row.skipExpression" size="mini" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -114,7 +112,7 @@
|
||||
<script>
|
||||
|
||||
import CRUD, { crud, header, presenter } from '@crud/crud'
|
||||
import crudFormMapping from './formMapping'
|
||||
import crudFormMapping, {updateRows} from './formMapping'
|
||||
|
||||
export default {
|
||||
name: 'EditDtl',
|
||||
@@ -133,9 +131,11 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
currentTab: 'mst',
|
||||
dialogVisible: false,
|
||||
tableNameList: [],
|
||||
tableData: []
|
||||
tableData: [],
|
||||
tableDtlData: [],
|
||||
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -150,51 +150,82 @@ export default {
|
||||
this.$emit('update:dialogShow', false)
|
||||
},
|
||||
open() {
|
||||
this.getExistTableName()
|
||||
},
|
||||
getExistTableName() {
|
||||
crudFormMapping.getExistTableName().then(res => {
|
||||
this.tableNameList = res
|
||||
})
|
||||
},
|
||||
setForm(row) {
|
||||
this.form.id = row.id
|
||||
this.form.local_table_name = row.local_table_name
|
||||
this.form.api_address = row.api_address
|
||||
this.form.sync_type = row.sync_type
|
||||
this.form.external_system = row.external_system
|
||||
this.getColumns(this.form.local_table_name)
|
||||
const mappingJson = row.mapping_json
|
||||
let mst_json = mappingJson[0]
|
||||
const dtl_json = mappingJson[1]
|
||||
crudFormMapping.tableColumns(row.form_type).then(res => {
|
||||
this.form.id = res.id
|
||||
this.form.form_name = res.form_name
|
||||
this.form.form_type = res.form_type
|
||||
this.form.form_desc = res.form_desc
|
||||
this.form.sync_url = row.sync_url
|
||||
this.form.sync_type = row.sync_type
|
||||
this.form.external_system = row.external_system
|
||||
this.form.has_child = res.has_child
|
||||
this.tableData = res.item
|
||||
this.tableDtlData = res.dtl_item
|
||||
for (let i = 0; i < this.tableData.length; i++) {
|
||||
ddd:
|
||||
for (let j = 0; j < mst_json.length; j++) {
|
||||
if (mst_json[j].value == this.tableData[i].value) {
|
||||
this.$set(this.tableData, i,mst_json[j])
|
||||
break ddd
|
||||
}
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < this.tableDtlData.length; i++) {
|
||||
ddd:
|
||||
for (let j = 0; j < dtl_json.length; j++) {
|
||||
if (dtl_json[j].value == this.tableDtlData[i].value) {
|
||||
this.$set(this.tableDtlData, i,dtl_json[j])
|
||||
// this.tableDtlData[i].mapping_field = dtl_json[j].mapping_field
|
||||
// this.tableDtlData[i].skipExpression = dtl_json[j].skipExpression
|
||||
break ddd
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.$emit('EditChanged')
|
||||
this.tableData = []
|
||||
this.tableDtlData = []
|
||||
this.form = {}
|
||||
this.currentTab = 'mst'
|
||||
this.dialogVisible = false
|
||||
},
|
||||
deleteRow(index, rows) {
|
||||
rows.splice(index, 1)
|
||||
},
|
||||
getColumns(local_table_name) {
|
||||
crudFormMapping.getTableColumnNamesFromMapping(local_table_name).then(res => {
|
||||
this.tableData = res.dtos
|
||||
})
|
||||
},
|
||||
submit() {
|
||||
if (!this.form.local_table_name) {
|
||||
this.crud.notify('映射表名不能为空!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
if (!this.form.sync_url) {
|
||||
this.crud.notify('接口地址不能为空!!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
const isInvalidRow = this.tableData.some(row => !row.external_field_name)
|
||||
if (!this.form.sync_type) {
|
||||
this.crud.notify('同步类型不能为空!!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
const isInvalidRow = this.tableData.some(row => !row.mapping_field)
|
||||
if (isInvalidRow) {
|
||||
this.crud.notify('外部字段名称不能为空!!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
const isdtlRow = this.tableDtlData.some(row => !row.mapping_field)
|
||||
if (isdtlRow) {
|
||||
this.crud.notify('外部字段名称不能为空!!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
const requestData = {
|
||||
'bmExternalFieldMapping': this.form,
|
||||
'dtos': this.tableData
|
||||
'mst': this.form,
|
||||
'item': [this.tableData, this.tableDtlData]
|
||||
}
|
||||
crudFormMapping.updateRows(requestData)
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.$emit('EditChanged')
|
||||
this.$emit('AddChanged')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,8 +48,8 @@ export function addRows(data) {
|
||||
|
||||
export function updateRows(data) {
|
||||
return request({
|
||||
url: 'api/syncFormMapping/updateRows',
|
||||
method: 'put',
|
||||
url: 'api/syncFormMapping/update',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user