add:映射前端
This commit is contained in:
@@ -27,7 +27,7 @@ export function edit(data) {
|
||||
export function getTableColumnNames(params) {
|
||||
return request({
|
||||
url: 'api/externalFieldMapping/getTableColumnNames/' + params,
|
||||
method: 'get',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@ export function getAllTableName() {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export function getExistTableName() {
|
||||
return request({
|
||||
url: 'api/externalFieldMapping/getExistTableName',
|
||||
@@ -49,7 +48,7 @@ export function getExistTableName() {
|
||||
export function getTableColumnNamesFromMapping(params) {
|
||||
return request({
|
||||
url: 'api/externalFieldMapping/getTableColumnNamesFromMapping/' + params,
|
||||
method: 'get',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
@@ -65,11 +64,10 @@ export function updateRows(data) {
|
||||
return request({
|
||||
url: 'api/externalFieldMapping/updateRows',
|
||||
method: 'put',
|
||||
data,
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export default {
|
||||
add,
|
||||
edit,
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<div class="crud-opts2" style="margin-bottom: 5px;margin-top: 30px">
|
||||
<span class="crud-opts-right2">
|
||||
<!--左侧插槽-->
|
||||
<slot name="left"/>
|
||||
<slot name="left" />
|
||||
<el-form
|
||||
:inline="true"
|
||||
class="demo-form-inline"
|
||||
@@ -20,24 +20,24 @@
|
||||
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"
|
||||
placeholder="请选择/搜索"
|
||||
class="filter-item"
|
||||
@change="getColumns"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in tableNameList"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="映射表名" prop="local_table_name">
|
||||
<el-select
|
||||
v-model="form.local_table_name"
|
||||
clearable
|
||||
filterable
|
||||
size="mini"
|
||||
placeholder="请选择/搜索"
|
||||
class="filter-item"
|
||||
@change="getColumns"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in tableNameList"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="接口地址" prop="api_address">
|
||||
<el-input :disabled="!form.local_table_name" v-model="form.api_address" style="width: 180px;"/>
|
||||
<el-input v-model="form.api_address" :disabled="!form.local_table_name" style="width: 180px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="同步类型" prop="sync_type">
|
||||
<el-select
|
||||
@@ -73,8 +73,8 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<rrOperation :crud="crud"/>
|
||||
</el-form>
|
||||
<rrOperation :crud="crud" />
|
||||
</el-form>
|
||||
</span>
|
||||
</div>
|
||||
<el-table
|
||||
@@ -85,7 +85,7 @@
|
||||
highlight-current-row
|
||||
style="width: 100%;"
|
||||
>
|
||||
<el-table-column align="center" label="序号" type="index" width="50"/>
|
||||
<el-table-column align="center" label="序号" type="index" width="50" />
|
||||
<el-table-column align="center" fixed="right" label="操作" width="100">
|
||||
<template scope="scope">
|
||||
<el-button
|
||||
@@ -97,10 +97,10 @@
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="字段名称" prop="local_field_name"/>
|
||||
<el-table-column align="center" label="字段名称" prop="local_field_name" />
|
||||
<el-table-column align="center" label="外部系统字段名称" prop="external_field_name">
|
||||
<template scope="scope">
|
||||
<el-input v-model="scope.row.external_field_name" size="mini"/>
|
||||
<el-input v-model="scope.row.external_field_name" size="mini" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -113,10 +113,9 @@
|
||||
|
||||
<script>
|
||||
|
||||
import CRUD, {crud, header, presenter} from '@crud/crud'
|
||||
import CRUD, { crud, header, presenter } from '@crud/crud'
|
||||
import crudFieldMapping from '@/api/wms/base_manage/field_mapping/fieldMapping'
|
||||
|
||||
|
||||
export default {
|
||||
name: 'AddDtl',
|
||||
components: {},
|
||||
@@ -168,7 +167,7 @@ export default {
|
||||
rows.splice(index, 1)
|
||||
},
|
||||
getColumns() {
|
||||
if (this.form.local_table_name === "") {
|
||||
if (this.form.local_table_name === '') {
|
||||
this.form.local_field_name = null
|
||||
this.tableData = []
|
||||
return
|
||||
@@ -179,21 +178,21 @@ export default {
|
||||
},
|
||||
submit() {
|
||||
if (!this.form.local_table_name) {
|
||||
this.crud.notify('映射表名不能为空!!', CRUD.NOTIFICATION_TYPE.INFO);
|
||||
return false;
|
||||
this.crud.notify('映射表名不能为空!!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
if (!this.form.sync_type) {
|
||||
this.crud.notify('同步类型不能为空!!', CRUD.NOTIFICATION_TYPE.INFO);
|
||||
return false;
|
||||
this.crud.notify('同步类型不能为空!!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
const isInvalidRow = this.tableData.some(row => !row.external_field_name);
|
||||
const isInvalidRow = this.tableData.some(row => !row.external_field_name)
|
||||
if (isInvalidRow) {
|
||||
this.crud.notify('外部字段名称不能为空!!', CRUD.NOTIFICATION_TYPE.INFO);
|
||||
return false;
|
||||
this.crud.notify('外部字段名称不能为空!!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
const requestData = {
|
||||
"bmExternalFieldMapping": this.form,
|
||||
"dtos": this.tableData
|
||||
'bmExternalFieldMapping': this.form,
|
||||
'dtos': this.tableData
|
||||
}
|
||||
crudFieldMapping.addRows(requestData)
|
||||
this.$emit('update:dialogShow', false)
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<div class="crud-opts2" style="margin-bottom: 5px;margin-top: 30px">
|
||||
<span class="crud-opts-right2">
|
||||
<!--左侧插槽-->
|
||||
<slot name="left"/>
|
||||
<slot name="left" />
|
||||
<el-form
|
||||
:inline="true"
|
||||
class="demo-form-inline"
|
||||
@@ -20,26 +20,26 @@
|
||||
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>
|
||||
<el-form-item label="接口地址" prop="api_address">
|
||||
<el-input :disabled="!form.local_table_name" v-model="form.api_address" style="width: 180px;"/>
|
||||
<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>
|
||||
<el-form-item label="同步类型" prop="sync_type">
|
||||
<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>
|
||||
<el-form-item label="同步类型" prop="sync_type">
|
||||
<el-select
|
||||
v-model="form.sync_type"
|
||||
class="filter-item"
|
||||
@@ -56,7 +56,7 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="外部系统" prop="external_system">
|
||||
<el-form-item label="外部系统" prop="external_system">
|
||||
<el-select
|
||||
v-model="form.external_system"
|
||||
class="filter-item"
|
||||
@@ -73,8 +73,8 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<rrOperation :crud="crud"/>
|
||||
</el-form>
|
||||
<rrOperation :crud="crud" />
|
||||
</el-form>
|
||||
</span>
|
||||
</div>
|
||||
<el-table
|
||||
@@ -85,7 +85,7 @@
|
||||
highlight-current-row
|
||||
style="width: 100%;"
|
||||
>
|
||||
<el-table-column align="center" label="序号" type="index" width="50"/>
|
||||
<el-table-column align="center" label="序号" type="index" width="50" />
|
||||
<el-table-column align="center" fixed="right" label="操作" width="100">
|
||||
<template scope="scope">
|
||||
<el-button
|
||||
@@ -97,10 +97,10 @@
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="字段名称" prop="local_field_name"/>
|
||||
<el-table-column align="center" label="字段名称" prop="local_field_name" />
|
||||
<el-table-column align="center" label="外部系统字段名称" prop="external_field_name">
|
||||
<template scope="scope">
|
||||
<el-input v-model="scope.row.external_field_name" size="mini"/>
|
||||
<el-input v-model="scope.row.external_field_name" size="mini" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -113,10 +113,9 @@
|
||||
|
||||
<script>
|
||||
|
||||
import CRUD, {crud, header, presenter} from '@crud/crud'
|
||||
import CRUD, { crud, header, presenter } from '@crud/crud'
|
||||
import crudFieldMapping from '@/api/wms/base_manage/field_mapping/fieldMapping'
|
||||
|
||||
|
||||
export default {
|
||||
name: 'EditDtl',
|
||||
components: {},
|
||||
@@ -181,17 +180,17 @@ export default {
|
||||
},
|
||||
submit() {
|
||||
if (!this.form.local_table_name) {
|
||||
this.crud.notify('映射表名不能为空!', CRUD.NOTIFICATION_TYPE.INFO);
|
||||
return false;
|
||||
this.crud.notify('映射表名不能为空!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
const isInvalidRow = this.tableData.some(row => !row.external_field_name);
|
||||
const isInvalidRow = this.tableData.some(row => !row.external_field_name)
|
||||
if (isInvalidRow) {
|
||||
this.crud.notify('外部字段名称不能为空!!', CRUD.NOTIFICATION_TYPE.INFO);
|
||||
return false;
|
||||
this.crud.notify('外部字段名称不能为空!!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
const requestData = {
|
||||
"bmExternalFieldMapping": this.form,
|
||||
"dtos": this.tableData
|
||||
'bmExternalFieldMapping': this.form,
|
||||
'dtos': this.tableData
|
||||
}
|
||||
crudFieldMapping.updateRows(requestData)
|
||||
this.$emit('update:dialogShow', false)
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<rrOperation :crud="crud"/>
|
||||
<rrOperation :crud="crud" />
|
||||
</el-form>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission">
|
||||
@@ -77,7 +77,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="接口地址" prop="api_address">
|
||||
<el-input v-model="form.api_address" style="width: 180px;"/>
|
||||
<el-input v-model="form.api_address" style="width: 180px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="同步类型" prop="sync_type">
|
||||
<el-select
|
||||
@@ -118,11 +118,17 @@
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--表格渲染-->
|
||||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler">
|
||||
<el-table-column type="selection" width="55"/>
|
||||
<el-table-column prop="local_table_name" label="映射表名" width="250"/>
|
||||
<el-table-column prop="api_address" label="接口地址" width="250"/>
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
:data="crud.data"
|
||||
size="mini"
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="local_table_name" label="映射表名" width="250" />
|
||||
<el-table-column prop="api_address" label="接口地址" width="250" />
|
||||
<el-table-column prop="sync_type" label="同步类型">
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.sync_type[scope.row.sync_type] }}
|
||||
@@ -133,9 +139,9 @@
|
||||
{{ dict.label.external_system[scope.row.external_system] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="mapping_json" label="映射关系" show-overflow-tooltip/>
|
||||
<el-table-column prop="last_update_name" label="更新人"/>
|
||||
<el-table-column prop="last_update_time" label="更新时间" width="150"/>
|
||||
<el-table-column prop="mapping_json" label="映射关系" show-overflow-tooltip />
|
||||
<el-table-column prop="last_update_name" label="更新人" />
|
||||
<el-table-column prop="last_update_time" label="更新时间" width="150" />
|
||||
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
@@ -146,16 +152,16 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination/>
|
||||
<pagination />
|
||||
</div>
|
||||
<AddDialog :form="form" :dialog-show.sync="addShow" @AddChanged="querytable1"/>
|
||||
<EditDialog :form="form" ref="editRef" :dialog-show.sync="editShow" @EditChanged="querytable"/>
|
||||
<AddDialog :form="form" :dialog-show.sync="addShow" @AddChanged="querytable1" />
|
||||
<EditDialog ref="editRef" :form="form" :dialog-show.sync="editShow" @EditChanged="querytable" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudFieldMapping from '@/api/wms/base_manage/field_mapping/fieldMapping'
|
||||
import CRUD, {crud, form, header, presenter} from '@crud/crud'
|
||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation.vue'
|
||||
import crudOperation from '@crud/CRUD.operation.vue'
|
||||
import udOperation from '@crud/UD.operation.vue'
|
||||
@@ -163,7 +169,6 @@ import pagination from '@crud/Pagination.vue'
|
||||
import AddDialog from '@/views/wms/base_manage/field_mapping/AddDialog'
|
||||
import EditDialog from '@/views/wms/base_manage/field_mapping/EditDialog'
|
||||
|
||||
|
||||
const defaultForm = {
|
||||
id: null,
|
||||
local_table_name: null,
|
||||
@@ -174,7 +179,7 @@ const defaultForm = {
|
||||
}
|
||||
export default {
|
||||
name: 'ExternalFieldMapping',
|
||||
components: {pagination, crudOperation, rrOperation, udOperation, AddDialog, EditDialog},
|
||||
components: { pagination, crudOperation, rrOperation, udOperation, AddDialog, EditDialog },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
dicts: ['external_system', 'sync_type'],
|
||||
cruds() {
|
||||
@@ -183,7 +188,7 @@ export default {
|
||||
url: 'api/externalFieldMapping',
|
||||
idField: 'id',
|
||||
sort: 'id,desc',
|
||||
crudMethod: {...crudFieldMapping},
|
||||
crudMethod: { ...crudFieldMapping },
|
||||
query: {},
|
||||
optShow: {
|
||||
add: false,
|
||||
@@ -191,7 +196,7 @@ export default {
|
||||
download: false,
|
||||
reset: true,
|
||||
del: true
|
||||
},
|
||||
}
|
||||
})
|
||||
},
|
||||
data() {
|
||||
@@ -204,7 +209,7 @@ export default {
|
||||
permission: {},
|
||||
rules: {
|
||||
position_code: [
|
||||
{required: true, message: '缓存线位置编码不能为空', trigger: 'blur'}
|
||||
{ required: true, message: '缓存线位置编码不能为空', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -220,7 +225,7 @@ export default {
|
||||
return true
|
||||
},
|
||||
getColumns() {
|
||||
if (this.form.local_table_name === "") {
|
||||
if (this.form.local_table_name === '') {
|
||||
this.form.local_field_name = null
|
||||
this.fieldNameList = []
|
||||
return
|
||||
@@ -241,7 +246,7 @@ export default {
|
||||
},
|
||||
querytable1() {
|
||||
this.crud.toQuery()
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user