<template>
|
<zt-dialog ref="dialog" @confirm="formSubmit" column='2' append-to-body class="pub_dialog">
|
<el-row :gutter="24" style="height: 700px;overflow: auto">
|
<el-col :span="24">
|
<el-form :model="dataForm" ref="dataForm" :disabled="dataForm.disabled" label-width="120px"
|
label-position="left" size="mini">
|
<el-row :gutter="20">
|
<el-col :span="12">
|
<zt-form-item label="源" prop="src" rules="required">
|
<zt-select v-model="dataForm.src" :datas="srcList" placeholder="源" @change="changeSelect"></zt-select>
|
<!-- <zt-dict v-model="dataForm.src" dict="company_type" placeholder="源" @input="changeSelect"></zt-dict>
|
-->
|
</zt-form-item>
|
</el-col>
|
<el-col :span="12">
|
<zt-form-item label="目的" prop="dst" class="role-list" rules="required">
|
<zt-select v-model="dataForm.dst" :datas="dstList" placeholder="目的" @change="changeSelect"></zt-select>
|
<!-- <zt-dict v-model="dataForm.dst" dict="company_type" placeholder="目的" @input="changeSelect"></zt-dict>
|
-->
|
</zt-form-item>
|
</el-col>
|
</el-row>
|
<!-- <zt-form-item label="数据库名称" prop="databasename">
|
<zt-dict v-model="dataForm.databasename" placeholder="数据库名称" dict="sync_config_databasename_type"></zt-dict>
|
</zt-form-item> -->
|
|
<!-- <zt-form-item label="主键字段名" prop="pkField">
|
<el-input v-model="dataForm.pkField" placeholder="主键字段名"></el-input>
|
</zt-form-item> -->
|
<!--<el-row :gutter="20">
|
<el-col :span="12">
|
<zt-form-item label="数据等级" prop="datalevel">
|
<el-input v-model="dataForm.datalevel" placeholder="数据等级"></el-input>
|
</zt-form-item>
|
</el-col>
|
<el-col :span="12">
|
<zt-form-item label="数据传递方向" prop="direct">
|
<el-input v-model="dataForm.direct" placeholder="数据传递方向"></el-input>
|
</zt-form-item>
|
</el-col>
|
</el-row>-->
|
|
<el-row :gutter="20">
|
<el-col :span="12">
|
<zt-form-item label="序号" prop="sortno">
|
<el-input type="number" v-model="dataForm.sortno" placeholder="序号"></el-input>
|
</zt-form-item>
|
</el-col>
|
<el-col :span="12">
|
<zt-form-item label="不传递字段" prop="fieldlist">
|
<el-input v-model="dataForm.fieldlist" placeholder="不传递字段','分隔"></el-input>
|
</zt-form-item>
|
</el-col>
|
</el-row>
|
|
<el-row :gutter="20">
|
<el-col :span="24">
|
<zt-form-item prop="timecond" label="按时间范围过滤">
|
<!-- <el-checkbox v-model="dataForm.timecond" true-label="0" false-label="1">按时间范围过滤</el-checkbox> -->
|
<el-switch v-model="dataForm.timecond"></el-switch>
|
</zt-form-item>
|
</el-col>
|
</el-row>
|
|
<!-- <el-row :gutter="20">
|
<el-col :span="8">
|
<zt-form-item prop="productCond" label="按产品节点过滤">
|
<!– <el-checkbox v-model="dataForm.productCond" true-label="0" false-label="1">按产品节点过滤</el-checkbox> –>
|
<el-switch v-model="dataForm.productCond"></el-switch>
|
</zt-form-item>
|
</el-col>
|
<el-col :span="8">
|
<zt-form-item label="产品节点ID字段" prop="productfield">
|
<el-input v-model="dataForm.productfield" placeholder="产品节点ID字段"></el-input>
|
</zt-form-item>
|
</el-col>
|
<el-col :span="8">
|
<zt-form-item label="产品数据ID字段" prop="productdatafield">
|
<el-input v-model="dataForm.productdatafield" placeholder="产品数据ID字段"></el-input>
|
</zt-form-item>
|
</el-col>
|
</el-row>-->
|
|
<!-- <el-row :gutter="20">
|
<el-col :span="12">
|
<zt-form-item prop="companyCond" label="按厂家过滤">
|
<!– <el-checkbox v-model="dataForm.companyCond" true-label="0" false-label="1">按厂家过滤</el-checkbox> –>
|
<el-switch v-model="dataForm.companyCond"></el-switch>
|
</zt-form-item>
|
</el-col>
|
|
<el-col :span="12">
|
<zt-form-item label="厂家字段名称" prop="fkField">
|
<el-input v-model="dataForm.fkField" placeholder="厂家字段名称"></el-input>
|
</zt-form-item>
|
</el-col>
|
</el-row>-->
|
|
<el-row :gutter="20">
|
<el-col :span="12">
|
<zt-form-item label="按其他条件过滤" prop="otherCond" class="role-list">
|
<!-- <zt-select v-model="dataForm.otherCond" url="/maintain/SyncConfig/getTableNameList" placeholder="按其他条件过滤"></zt-select> -->
|
<!-- <el-input v-model="dataForm.otherCond" placeholder="按其他条件过滤"></el-input> -->
|
<el-select v-model="dataForm.otherCond" placeholder="按其他条件过滤">
|
<el-option v-for="item in otherCondList" :key="item.value" :label="item.label" :value="item.value">
|
</el-option>
|
</el-select>
|
</zt-form-item>
|
</el-col>
|
<el-col :span="12">
|
<zt-form-item label="其他条件外键" prop="otherTermKey">
|
<el-input v-model="dataForm.otherTermKey" placeholder="其他条件外键"></el-input>
|
</zt-form-item>
|
</el-col>
|
</el-row>
|
|
<el-row :gutter="20">
|
<el-col :span="24">
|
<zt-form-item label="附件条件sql" prop="addcond">
|
<el-input type="textarea" v-model="dataForm.addcond" placeholder="附件条件sql" show-word-limit
|
rows="4"></el-input>
|
</zt-form-item>
|
</el-col>
|
<!-- <el-col :span="12">
|
<zt-form-item label="相关状态处理" prop="relatedStateHandle">
|
<el-input v-model="dataForm.relatedStateHandle" placeholder="相关状态处理"></el-input>
|
</zt-form-item>
|
</el-col> -->
|
</el-row>
|
<!-- <el-row :gutter="20">
|
<el-col :span="24">
|
<zt-form-item label="相关状态处理" prop="labelPosition">
|
<el-radio-group v-model="dataForm.labelPosition" size="small">
|
<el-radio-button label="0">否</el-radio-button>
|
<el-radio-button label="1">前</el-radio-button>
|
<el-radio-button label="2">后</el-radio-button>
|
</el-radio-group>
|
</zt-form-item>
|
</el-col>
|
</el-row> -->
|
<!-- <el-row :gutter="20">-->
|
<!-- <el-col :span="24">-->
|
<!-- <zt-form-item label="相关状态处理" prop="relatedStateHandle">-->
|
<!-- <el-input type="textarea" v-model="dataForm.relatedStateHandle" placeholder="相关状态处理','分隔" show-word-limit rows="4"></el-input>-->
|
<!-- </zt-form-item>-->
|
<!-- </el-col>-->
|
<!-- </el-row>-->
|
<el-row :gutter="20">
|
<el-col :span="24">
|
<zt-form-item label="规则说明" prop="tabledesc">
|
<el-input type="textarea" maxlength="600" v-model="dataForm.tabledesc" placeholder="规则说明"
|
show-word-limit rows="4"></el-input>
|
</zt-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="20">
|
<el-col :span="24">
|
<zt-form-item label="是否启用" prop="relatedDataFlow">
|
<el-switch v-model="dataForm.relatedDataFlow"></el-switch>
|
</zt-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
</el-col>
|
<el-col :span="24" class="tran">
|
<el-transfer style="margin-left: 15%;" v-model="dataForm.syncConfigTableList" :titles="['未关联', '已关联']"
|
:data="tableNameList"></el-transfer>
|
</el-col>
|
</el-row>
|
</zt-dialog>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
dataForm: {
|
id: '',
|
databasename: '',
|
tablename: '',
|
tabledesc: '',
|
pkField: '',
|
fkField: '',
|
datalevel: '',
|
direct: '',
|
sortno: 1,
|
src: '',
|
dst: '',
|
productfield: '',
|
productdatafield: '',
|
ismarkfield: '',
|
fieldlist: '',
|
timecond: false,
|
addcond: '',
|
otherTermKey: '',
|
relatedStateHandle: '',
|
relatedDataFlow: true,
|
productCond: false,
|
companyCond: false,
|
otherCond: '',
|
syncConfigTableList: [],
|
syncConfigTableRigthList: [],
|
labelPosition: 0
|
},
|
srcList: [{id: 'cj', name: '厂家'}, {id: 'jd', name: '基地'}],
|
dstList: [{id: 'cj', name: '厂家'}, {id: 'jd', name: '基地'}, {id: 'yjs', name: '研究所'}],
|
tableNameList: [],
|
otherCondList: [],
|
isOne: true,
|
}
|
},
|
methods: {
|
init(id) {
|
this.isOne = true
|
this.dataForm.id = id
|
if (this.dataForm.id === null || this.dataForm.id === undefined) {
|
this.dataForm.id = ''
|
this.getListInfo()
|
}
|
},
|
// 获取信息
|
async getInfo() {
|
let res = await this.$http.get(
|
`/maintain/SyncConfig/${this.dataForm.id}`
|
)
|
this.dataForm = {
|
...this.dataForm,
|
...res.data
|
}
|
this.getOtherCondList()
|
this.getListInfo()
|
},
|
// 获取列表信息
|
async getListInfo() {
|
this.tableNameList = []
|
let res = await this.$http.post(
|
'/sys/data/export/record/tname',
|
this.dataForm
|
)
|
if (res.success) {
|
this.tableNameList = res.data.dataList
|
this.dataForm.syncConfigTableList =
|
res.data.rightChecked === null ? [] : res.data.rightChecked
|
}
|
},
|
changeSelect() {
|
this.otherCondList = []
|
this.dataForm.otherCond = ''
|
this.getOtherCondList()
|
this.getListInfo()
|
},
|
async getOtherCondList() {
|
if (
|
this.dataForm.src !== null &&
|
this.dataForm.src !== '' &&
|
this.dataForm.src !== undefined &&
|
this.dataForm.dst !== null &&
|
this.dataForm.dst !== '' &&
|
this.dataForm.dst !== undefined
|
) {
|
let data = {
|
src: this.dataForm.src,
|
dst: this.dataForm.dst,
|
id:
|
this.dataForm.id !== null &&
|
this.dataForm.id !== '' &&
|
this.dataForm.id !== undefined
|
? this.dataForm.id
|
: ''
|
}
|
let res = await this.$http.post(
|
'/sys/data/export/record/otherCond',
|
data
|
)
|
if (res.success) {
|
this.otherCondList = res.data
|
}
|
}
|
},
|
// 表单提交
|
async formSubmit() {
|
if(this.isOne){
|
this.isOne= false
|
let configArr = []
|
this.dataForm.syncConfigTableList.forEach((element) => {
|
configArr.push(JSON.parse('{"tableName":"' + element + '"}'))
|
})
|
this.dataForm.syncConfigTableList = configArr
|
let res = await this.$http[!this.dataForm.id ? 'post' : 'put']('/maintain/SyncConfig/', this.dataForm)
|
if (res.success) {
|
|
await this.$tip.success()
|
this.$refs.dialog.close()
|
this.$emit('refreshDataList')
|
}
|
}
|
},
|
leftCheckChange(value, movedKeys) {
|
// window.console.log(value, movedKeys)
|
/*
|
// 左侧数据
|
this.tableNameList.push(movedKeys)
|
// 右侧数据
|
this.dataForm.syncConfigTableList.push({
|
key: movedKeys[0] + '',
|
label: movedKeys[0] + ''
|
}) */
|
},
|
rightCheckChange(value, movedKeys) {
|
window.console.log(value, movedKeys)
|
}
|
}
|
}
|
</script>
|
<style lang="scss">
|
.tran .el-transfer-panel {
|
width: 33%;
|
height: 500px;
|
margin: 10px;
|
}
|
|
.tran .el-transfer-panel__list {
|
height: 460px;
|
}
|
</style>
|