主数据修改、数据源、显示字段

This commit is contained in:
hyt 2024-06-14 15:15:44 +08:00
parent a549dedf45
commit a6a8f235d1
15 changed files with 2614 additions and 509 deletions

View File

@ -74,7 +74,7 @@
"vue-meta": "2.4.0",
"vue-quill-editor": "^3.0.6",
"vue-router": "3.4.9",
"vuedraggable": "2.24.3",
"vuedraggable": "^2.24.3",
"vuex": "3.6.0",
"xlsx": "^0.17.0"
},

View File

@ -104,7 +104,7 @@
@input="(val) => limitPhoneNum(val, ruleForm, row.id)"
:maxlength="row.maxlength ? row.maxlength * 1 : 50"
:min="1"
:max="row.max ? row.max : 99999"
:max="row.max ? row.max : 255"
:label="!row.placeholder ? '描述文字' : row.placeholder"
>
<template slot="append" v-if="row.message">{{ row.message }}</template>

View File

@ -73,6 +73,7 @@ const optionFormRow = [
type: "num",
title: "长度",
id: "filedLength",
max:255,
row: 24,
disabled: false,
required: true,

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@ -1,271 +1,505 @@
<script src="configData.js"></script>
<template>
<div class="wrap">
<div class="btn">
<div class="chunk">
<el-button
icon="el-icon-back"
@click="
$router.replace({ path: '/integrationOption/masterDataOptions' })
"
>返回
</el-button
>
</div>
<div class="chunk">
<el-button
icon="el-icon-first-aid-kit"
type="primary"
@click="saveHandle"
:loading="saveLoading"
>保存
</el-button
>
</div>
</div>
<div class="main">
<div class="left" v-loading="mainLoading">
<div class="title">
数据表
</div>
<div class="receipts">
<div class="label">单据规则:</div>
<div class="receiptsList" @click="openReceiptsHandle">
<template v-if="!receiptsShowTableData.length">点击选择单据规则</template>
<template v-else>
<div class="receiptsItem" v-for="(item,index) in receiptsShowTableData">{{ item.dbValue }}</div>
</template>
</div>
</div>
<div class="mainTable">
<BaseTable
ref="mainTable"
:tableData="mainTableData"
:tabLoading="mainTabLoading"
:tableColumn="mainTableColumn"
:border="false"
:funData="mainFunData"
tableHeight="25vh"
:highlightCurrent="true"
@radioChange="mainOnClick"
@onFunc="mainOnFunc"
>
<template #dbType="{row}">
{{ row.dbType === '1' ? '主表' : '子表' }}
</template>
</BaseTable>
<div class="mainAddRow">
<el-link
type="primary"
@click="addMainAddRow"
:underline="false"
>+ 添加
</el-link
>
</div>
</div>
<div class="title">
表字段
</div>
<div class="activedTable">
<BaseTable
ref="activedTable"
:tableData="activedTableData"
:tabLoading="activedTabLoading"
:tableColumn="activedTableColumn"
:border="false"
:funData="activedFunData"
tableHeight="30vh"
:highlightCurrent="true"
@radioChange="activedOnClick"
@onFunc="activedOnFunc"
>
<template #filedType="{row}">
{{ dataTypeDist[row.filedType] }}
</template>
</BaseTable>
<div class="mainAddRow" v-if="mainActivedRow">
<el-link
type="primary"
@click="activedAddRow"
:underline="false"
>+ 添加
</el-link
>
</div>
</div>
</div v-loading=>
<div class="right">
<template v-if="activedTableRow">
<div class="btn">
<el-button
type="primary"
@click="activedRowSaveHandle"
>暂存
</el-button>
</div>
<div class="title">
表字段
</div>
<div class="optionForm">
<baseNewForm
ref="optionForm"
:spanNumber="24"
:isFunBtn="false"
:formRow="optionFormRow"
:ruleForm="optionRuleForm"
:labelPosition="'left'"
@onSelect="selectChangeHanlde"
@inputBlur="optionFormInputBlur"
@onSubmit="optionOnSubmit"
:disabled="sonFormDisabled"
>
</baseNewForm>
<baseNewForm
ref="typeOptionForm"
:spanNumber="24"
:isFunBtn="false"
:formRow="typeOptionFormRow"
:ruleForm="typeOptionRuleForm"
:labelPosition="'left'"
@onSelect="typeSelectChangeHanlde"
@onSubmit="typeOptionOnSubmit"
:disabled="sonFormDisabled"
>
</baseNewForm>
<baseNewForm
ref="propertyForm"
:spanNumber="24"
:isFunBtn="false"
:formRow="propertyFormRow"
:ruleForm="propertyRuleForm"
:labelPosition="'left'"
@onSubmit="propertyOnSubmit"
:disabled="sonFormDisabled"
>
</baseNewForm>
</div>
<div class="smtitle">
可选控间属性
</div>
<div class="checkBoxList">
<el-checkbox-group :disabled="sonFormDisabled" v-model="propertyActiveList"
@change="propertyActiveListChangeHanlde"
>
<el-checkbox v-for="(item,index) in propertyList" :label="item.id" :key="item.id">{{
item.label
}}
</el-checkbox>
</el-checkbox-group>
</div>
</template>
<template v-else-if="mainActivedRow">
<div class="btn">
<el-button
type="primary"
@click="mainActivedRowSaveHandle"
>暂存
</el-button>
</div>
<div class="title">
数据表
</div>
<div class="optionForm">
<baseNewForm
ref="mainOptionForm"
:spanNumber="24"
:isFunBtn="false"
:formRow="mainOptionRow"
:ruleForm="mainOptionForm"
:labelPosition="'left'"
@onSubmit="mainOptionOnSubmit"
>
</baseNewForm>
<!--数据表-->
<div class="mainTable">
<div class="bigTitle">数据表</div>
<div class="rule">
<div class="name">单据规则</div>
<template v-if="!receiptsTableData.length">
<div class="value">尚未设置</div>
</template>
<template v-else>
<div class="value">
<div class="receiptsItem" v-for="(item,index) in receiptsTableData">{{ item.dbValue }}</div>
</div>
</template>
<div class="btn" @click="ruleAddHandle">
<img src="./images/设置.png" alt="">
</div>
</div>
</div>
<baseDialog v-model="receiptsShow" width="50%" @confirm="receiptsConfirm">
<div class="receiptsTable">
<div class="table">
<BaseTable
ref="receiptsTable"
:showIndex="true"
:tableData="receiptsTableData"
:tableColumn="receiptsTableColumn"
ref="mainTable"
:tableData="mainTableData"
:tabLoading="mainTabLoading"
:tableColumn="mainTableColumn"
:border="false"
:funData="receiptsFunData"
tableHeight="30vh"
@onFunc="receiptsOnFunc"
tableHeight="68vh"
:highlightCurrent="true"
@radioChange="mainOnClick"
>
<template #dbType="{row}">
<el-select v-model="row['dbType']" placeholder="请选择"
@change="(val)=>ruleTypeSeleceChangHandle(val,row)"
>
<el-option
v-for="item in ruleTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
{{ row.dbType === '1' ? '主表' : '子表' }}
</template>
<template #dbValue="{row}">
<div v-if="!row['dbType']">请选择格式类型</div>
<div v-else-if="row['dbType'] === '1'">{{ row.dbValue }}</div>
<div v-else-if="row['dbType'] === '2'">
<el-input v-model="row.dbValue"></el-input>
</div>
<div v-else-if="row['dbType'] === '3'">
<el-select v-model="row.dbValue" placeholder="请选择">
<el-option
v-for="item in dateOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</div>
<div v-else-if="row['dbType'] === '4'">
<el-input v-model="row.dbValue" @input="(val)=>integerNumber(val,row)"></el-input>
<template #operation="{row}">
<div class="btnList">
<div class="settingBtn" @click="mainTableEditHandle(row)">
<img src="./images/设置.png" alt="">
</div>
<div class="deleBtn" @click="mainDeleOnFunc">
<img src="./images/删除.png" alt="">
</div>
</div>
</template>
</BaseTable>
<div class="receiptsAddRow">
<div class="mainAddRow">
<el-link
type="primary"
@click="receiptsAddRow"
@click="addMainAddRow"
:underline="false"
>+ 添加
>+ 数据表添加
</el-link
>
</div>
</div>
</baseDialog>
</div>
<!-- 表字段-->
<div class="sonTable">
<div class="bigTitle">表字段</div>
<div class="table">
<BaseTable
ref="activedTable"
:tableData="activedTableData"
:tabLoading="activedTabLoading"
:tableColumn="activedTableColumn"
:border="false"
tableHeight="73vh"
:highlightCurrent="true"
@radioChange="activedOnClick"
@onFunc="activedOnFunc"
>
<template #filedType="{row}">
{{ dataTypeDist[row.filedType] }}
</template>
<template #operation="{row}">
<div class="btnList">
<div class="settingBtn" @click="sonTableEditHandle(row)">
<img src="./images/设置.png" alt="">
</div>
<div class="deleBtn" @click="activedOnFunc(row)">
<img src="./images/删除.png" alt="">
</div>
</div>
</template>
</BaseTable>
<div class="mainAddRow">
<el-link
v-if="mainTempClick.id"
type="primary"
@click="activedAddRow"
:underline="false"
>+ 表字段添加
</el-link
>
</div>
</div>
</div>
<!-- 单据规则-->
<base-right-dialog
ref="baseRightDialog"
:footerShow="true"
:dialogVisible.sync="ruleAddDialogShow"
title="单据规则"
@handleClose="ruleAddDialogShow=false"
:submitShow="true"
:size="'50%'"
@handleConfirmClick="ruleAddSaveHanlde"
>
<div class="receiptsTable">
<ruleAddTable ref="ruleAddTable"></ruleAddTable>
</div>
</base-right-dialog>
<!-- 数据表 -->
<base-right-dialog
ref="mainTableAddtDialog"
:footerShow="true"
:dialogVisible.sync="mainTableDialogShow"
title="数据表"
@handleClose="mainTableDialogShow=false"
:submitShow="true"
:size="'30%'"
@handleConfirmClick="mainTableSaveHandle"
>
<div class="mainTable">
<mainTable ref="mainTable"></mainTable>
</div>
</base-right-dialog>
<!-- 表字段-->
<base-right-dialog
ref="sonTableAddtDialog"
:footerShow="true"
:dialogVisible.sync="sonTableDialogShow"
title="表字段"
@handleClose="sonTableDialogShow=false"
:submitShow="true"
:size="'30%'"
@handleConfirmClick="sonTableSaveHandle"
>
<div class="mainTable">
<sonTable ref="sonTable" :activedTableData="activedTableData" :mainTempClick="mainTempClick"
@sonSaveHandle="sonSaveHandle"
></sonTable>
</div>
</base-right-dialog>
</div>
</template>
<script>
import sonTable from '@/views/masterDataOptions/dataOrigin/sonTable.vue'
import mainTable from '@/views/masterDataOptions/dataOrigin/mainTable.vue'
import ruleAddTable from '@/views/masterDataOptions/dataOrigin/ruleAddTable.vue'
import BaseTable from '@/views/intergrationTask/compoments/baseTable.vue'
import configData from './configData'
import { getApiModuleApi } from '@/api/apiChunks/index.js'
import baseNewForm from '../compoments/baseNewForm'
import { deepClone } from '@/utils/index.js'
import baseDialog from '@/views/integrationOption/compoments/baseDialog'
import baseForm from '@/components/base/baseNewForm/index.vue'
import baseRightDialog from '@/components/base/baseRightDialog/index.vue'
import { authApi } from '@/api/apis/auth'
export default {
data() {
return {}
return {
mainTempClick: {},//
mainTableData: [],//
mainTabLoading: false,//loading
mainTableColumn: [
{ title: '英文名', id: 'dbName' },
{ title: '表类型', id: 'dbType' },
{ title: '表说明', id: 'remark' },
{ title: '操作', id: 'operation' }
],
mainFunData: [],//
activedTableData: [],//
activedTabLoading: false,//loading
activedTableColumn: [
{ title: '中文名', id: 'chName' },
{ title: '英文名', id: 'enName' },
{ title: '字段类型', id: 'filedType' },
{ title: '长度', id: 'filedLength' },
{ title: '操作', id: 'operation' }
],//
activedFunData: [
{
text: '删除',
color: 'red'
}
],//
ruleAddDialogShow: false,//
receiptsTableData: [],//
mainTableDialogShow: false,//
//
dataTypeDist: {},
//
fieldTypeOptions: [],
sonTableDialogShow: false,//dialog
serviceOptions: []//
}
},
methods: {
//
async initSelect() {
//
const type = await getApiModuleApi({
tl: 'generalServiceImpl',
as: 'dictionaryshop',
dj: 'selectDictionaryshop'
}, { tab_name: 'mdm', column_name: 'mdm_filed_type' })
this.fieldTypeOptions = []
type.attribute.forEach(item => {
//
this.$set(this.dataTypeDist, item.column_value, item.column_content)
this.fieldTypeOptions.push({
label: item.column_content,
id: item.column_value
})
})
this.serviceOptions = []
//
const service = await getApiModuleApi({
tl: 'mdmModuleService',
as: '',
dj: 'queryMdmService'
}, { remark: '' })
service.attribute.forEach(item => {
this.serviceOptions.push({
id: item.dbName,
label: item.remark
})
})
},
//
async mainOnClick(val) {
if (val.index === -1) return
console.log(val)
//
this.mainTempClick = val
//
const res = await authApi('mdmModuleService', '', 'queryMdmDbField', '', {
mdmId: this.$route.query.id,
dbId: this.mainTempClick.id
})
this.activedTableData = res.attribute
},
// (
mainDeleOnFunc(row, item) {
this.$confirm('确定删除?')
.then(async(_) => {
this.openLoading('submit')
const res = await authApi('mdmModuleService', '', 'deleteMdmDb', '', {
mdmId: this.$route.query.id,
...row
})
this.$vmNews('删除成功!', 'success')
this.getMainTableHandle()
})
.catch((_) => {
})
},
//
addMainAddRow() {
if (!this.receiptsTableData.length) {
this.$vmNews('请添加单据规则后,再添加数据表。')
}
this.mainTableDialogShow = true
this.$nextTick(() => {
//
this.$refs.mainTable.$refs.mainOptionForm.resetFields()
this.$refs.mainTable.mainOptionForm = {}
//
this.$refs.mainTable.mainOptionRow[0].elCol.disabled = false
})
},
//
mainTableEditHandle(row) {
this.mainTableDialogShow = true
this.$nextTick(() => {
//
this.$refs.mainTable.$refs.mainOptionForm.resetFields()
this.$refs.mainTable.mainOptionForm = JSON.parse(JSON.stringify(row))
//
this.$refs.mainTable.mainOptionRow[0].elCol.disabled = true
})
},
//
activedOnClick(val) {
},
//
activedOnFunc(row) {
this.$confirm('确定删除?')
.then(async(_) => {
this.openLoading('submit')
const res = await authApi('mdmModuleService', '', 'deleteMdmDbField', '', {
id: row.id,
mdmId: this.$route.query.id,
dbId: this.mainTempClick.id,
dbName: this.mainTempClick.dbName,
enName: row.enName,
filedType: row.filedType
})
this.$vmNews('删除成功', 'success')
this.mainOnClick(this.mainTempClick)
this.activedTableData.splice(row.index, 1)
})
.catch((_) => {
})
},
//
sonTableEditHandle(row) {
this.sonTableDialogShow = true
this.$nextTick(() => {
//
this.$refs.sonTable.$refs.optionForm.resetFields()
this.$refs.sonTable.$refs.typeOptionForm.resetFields()
this.$refs.sonTable.$refs.propertyForm.resetFields()
this.$refs.sonTable.optionRuleForm = {}
this.$set(this.$refs.sonTable.optionRuleForm,'required',false)
this.$set(this.$refs.sonTable.optionRuleForm,'disabled',false)
this.$refs.sonTable.typeOptionRuleForm = {}
this.$refs.sonTable.propertyRuleForm = {}
this.$refs.sonTable.propertyActiveList = []
this.$refs.sonTable.propertyFormRow = []
this.$refs.sonTable.typeOptionFormRow = []
//
this.$refs.sonTable.optionFormRow[2].elCol[0].options = this.fieldTypeOptions
this.$refs.sonTable.serviceOptions = this.serviceOptions
this.$refs.sonTable.activedOnClick(row)
})
},
//
activedAddRow() {
this.sonTableDialogShow = true
this.$nextTick(() => {
//
this.$refs.sonTable.$refs.optionForm.resetFields()
this.$refs.sonTable.$refs.typeOptionForm.resetFields()
this.$refs.sonTable.$refs.propertyForm.resetFields()
this.$refs.sonTable.optionRuleForm = {}
this.$set(this.$refs.sonTable.optionRuleForm,'required',false)
this.$set(this.$refs.sonTable.optionRuleForm,'disabled',false)
this.$refs.sonTable.typeOptionRuleForm = {}
this.$refs.sonTable.propertyRuleForm = {}
this.$refs.sonTable.propertyActiveList = []
this.$refs.sonTable.propertyFormRow = []
this.$refs.sonTable.typeOptionFormRow = []
this.$refs.sonTable.activedTableRow = {}
//
this.$refs.sonTable.optionFormRow[2].elCol[0].options = this.fieldTypeOptions
this.$refs.sonTable.serviceOptions = this.serviceOptions
})
},
//
ruleAddHandle() {
this.ruleAddDialogShow = true
this.$nextTick(() => {
this.$refs.ruleAddTable.ruleAddTableData = JSON.parse(JSON.stringify(this.receiptsTableData))
})
},
//(
async ruleAddSaveHanlde() {
let tempTableData = this.$refs.ruleAddTable.ruleAddTableData
let type = false
let flag = tempTableData.some((item, index) => {
if (!item.dbType || !item.dbValue) {
this.$vmNews(`请选择${index + 1}行的类型并填写或选择规则`, 'warning')
return true
} else if (item.dbType === '4' && index + 1 !== tempTableData.length) {
type = true
this.$vmNews(`流水号只允许在最后一行`, 'warning')
return true
} else if (item.dbType === '4') {
type = true
}
})
if (!type) {
this.$vmNews(`请添加流水号`, 'warning')
return
}
if (flag) return
this.openLoading('submit')
const res = await authApi('mdmModuleService', '', 'saveOrUpdateMdmTableCodeRule', '', {
id: this.$route.query.id,
mdmTableCodeRuleEntityList: tempTableData
})
this.ruleAddDialogShow = false
this.$vmNews('添加单据规则成功', 'success')
//
this.getRuleHandle()
},
//
async getRuleHandle() {
this.openLoading('submit')
const res = await authApi('mdmModuleService', '', 'getMdmTableCodeRule', '', {
mdmId: this.$route.query.id
})
this.receiptsTableData = res.attribute
},
//
mainTableSaveHandle() {
this.$refs.mainTable.$refs.mainOptionForm.$refs['ruleForm'].validate(async(valid) => {
if (valid) {
//
let blacklist = ['id', 'document_rule', 'document_rule_num', 'data_status', 'add_status', 'update_status', 'delete_status', 'sorts', 'create_user_id', 'create_time', 'modify_user_id', 'modify_time', 'sts', 'org_id', 'company_id']
let form = this.$refs.mainTable.mainOptionForm
//
if (blacklist.includes(form.dbName)) {
this.$vmNews('当前英文名为系统默认字段,请修改')
return
}
// "dbType":"2",// 1 2
if (this.mainTableData.length && !form.id) {
this.$set(form, 'dbType', 2)
} else {
this.$set(form, 'dbType', 1)
}
//id
if (form.id) {
this.openLoading('submit')
const res = await authApi('mdmModuleService', '', 'updateMdmDb', '', {
mdmId: this.$route.query.id,
...form
})
if (res.status == 200) {
this.$vmNews('保存成功', 'success')
this.mainTableDialogShow = false
this.getMainTableHandle()
}
} else {
this.openLoading('submit')
const res = await authApi('mdmModuleService', '', 'saveMdmDb', '', {
mdmId: this.$route.query.id,
...form
})
if (res.status == 200) {
this.$vmNews('保存成功', 'success')
this.mainTableDialogShow = false
this.getMainTableHandle()
}
}
} else {
return false
}
})
},
//
sonTableSaveHandle() {
this.$refs.sonTable.$refs.optionForm.submitForm()
},
//
async getMainTableHandle() {
this.openLoading('detail')
const res = await authApi('mdmModuleService', '', 'queryMdmDb', '', {
mdmId: this.$route.query.id
})
this.mainTableData = res.attribute
},
//
async sonSaveHandle(params) {
console.log('进来了')
if (params.id) {
this.openLoading('submit')
const res = await authApi('mdmModuleService', '', 'updateMdmDbField', '', params)
this.$vmNews('保存成功!', 'success')
this.sonTableDialogShow = false
//
this.mainOnClick(this.mainTempClick)
} else {
this.openLoading('submit')
const res = await authApi('mdmModuleService', '', 'saveMdmDbField', '', params)
this.$vmNews('保存成功!', 'success')
this.sonTableDialogShow = false
//
this.mainOnClick(this.mainTempClick)
}
}
},
methods: {},
components: {
baseRightDialog, baseForm,
baseNewForm,
BaseTable,
baseDialog
baseDialog,
ruleAddTable,
mainTable,
sonTable
},
created() {
//
this.getRuleHandle()
//
this.getMainTableHandle()
//
this.initSelect()
//
this.$emit('flashActive', 1)
},
watch: {},
computed: {}
@ -280,4 +514,129 @@ export default {
::v-deep .el-form-item {
display: block !important;
}
.wrap {
display: flex;
background-color: #fff;
margin-left: 15px;
border-radius: 8px;
.mainAddRow {
margin-top: 30px;
border: 1px dotted #ccc;
text-align: center;
height: 50px;
line-height: 50px;
}
.bigTitle {
font-family: PingFangSC, PingFang SC;
font-weight: 600;
font-size: 18px;
color: #333333;
line-height: 25px;
text-align: left;
font-style: normal;
}
.mainTable {
flex: 1;
padding: 30px 20px 20px;
border-right: 1px solid #EBEBEB;;
.rule {
margin-top: 30px;
display: flex;
align-items: center;
width: 100%;
.name {
margin-right: 20px;
font-family: PingFangSC, PingFang SC;
font-weight: 600;
font-size: 16px;
color: #333333;
line-height: 22px;
text-align: left;
font-style: normal;
}
.value {
display: flex;
align-items: center;
}
.btn {
margin-left: 15px;
cursor: pointer;
width: 24px;
height: 24px;
background: #EBEBED;
border-radius: 6px;
display: flex;
justify-content: center;
align-items: center;
> img {
width: 10px;
height: 10px;
}
}
}
.table {
margin-top: 20px;
}
}
.sonTable {
flex: 1;
padding: 30px 20px 20px;
.table {
margin-top: 20px;
}
}
}
.btnList {
display: flex;
align-items: center;
justify-content: center;
.settingBtn {
cursor: pointer;
width: 24px;
height: 24px;
background: #EBEBED;
border-radius: 6px;
display: flex;
justify-content: center;
align-items: center;
> img {
width: 10px;
height: 10px;
}
}
.deleBtn {
cursor: pointer;
margin-left: 10px;
width: 24px;
height: 24px;
background: #EBEBED;
border-radius: 6px;
display: flex;
justify-content: center;
align-items: center;
> img {
width: 10px;
height: 10px;
}
}
}
</style>

View File

@ -1199,6 +1199,8 @@ export default {
}
</style>
<style>
.receiptsAddRow {
margin-top: 30px;
border: 1px dotted #ccc;

View File

@ -0,0 +1,70 @@
<template>
<div class="mainTable">
<baseNewForm
ref="mainOptionForm"
:spanNumber="24"
:isFunBtn="false"
:formRow="mainOptionRow"
:ruleForm="mainOptionForm"
:labelPosition="'left'"
@onSubmit="mainOptionOnSubmit"
>
</baseNewForm>
</div>
</template>
<script>
import baseNewForm from '../compoments/baseNewForm'
export default {
name: 'mainTable',
components: {
baseNewForm
},
data() {
return {
mainOptionRow: [
{
elCol: [
{
type: 'input',
title: '英文名',
id: 'dbName',
disabledOfId: true,
row: 24,
disabled: false,
required: true,
fontSize: 16,
pattern: /^[a-zA-Z][a-zA-Z0-9_]{0,50}$/,
message: '须以字母开头且不能出现_外的字符与中文'
}
]
},
{
elCol: [
{
type: 'input',
title: '表说明',
id: 'remark',
row: 24,
disabled: false,
required: true,
fontSize: 16
}
]
}
],
mainOptionForm: {}
}
},
methods: {
mainOptionOnSubmit() {
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@ -0,0 +1,134 @@
<template>
<div class="ruleAddTable">
<BaseTable
ref="receiptsTable"
:showIndex="true"
:tableData="ruleAddTableData"
:tableColumn="receiptsTableColumn"
:border="false"
:funData="receiptsFunData"
tableHeight="60vh"
@onFunc="receiptsOnFunc"
>
<template #dbType="{row}">
<el-select v-model="row['dbType']" placeholder="请选择"
@change="(val)=>ruleTypeSeleceChangHandle(val,row)"
>
<el-option
v-for="item in ruleTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</template>
<template #dbValue="{row}">
<div v-if="!row['dbType']">请选择格式类型</div>
<div v-else-if="row['dbType'] === '1'">{{ row.dbValue }}</div>
<div v-else-if="row['dbType'] === '2'">
<el-input v-model="row.dbValue"></el-input>
</div>
<div v-else-if="row['dbType'] === '3'">
<el-select v-model="row.dbValue" placeholder="请选择">
<el-option
v-for="item in dateOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</div>
<div v-else-if="row['dbType'] === '4'">
<el-input v-model="row.dbValue" @input="(val)=>integerNumber(val,row)"></el-input>
</div>
</template>
</BaseTable>
<div class="receiptsAddRow" style="margin-top: 30px;
border: 1px dotted #ccc;
text-align: center;
height: 50px;
line-height: 50px;"
>
<el-link
type="primary"
@click="receiptsAddRow"
:underline="false"
>+ 添加
</el-link>
</div>
</div>
</template>
<script>
import BaseTable from '@/views/intergrationTask/compoments/baseTable.vue'
export default {
name: 'ruleAddTable',
components: { BaseTable },
data() {
return {
receiptsTableData: [],//
ruleAddTableData: [],//
receiptsTableColumn: [
{
title: '类型',
id: 'dbType'
},
{
title: '格式规则',
id: 'dbValue'
}
],//
ruleTypeOptions: [
{
label: '连接符号',
value: '1'
}, {
label: '字符串',
value: '2'
}, {
label: '日期',
value: '3'
}, {
label: '流水号',
value: '4'
}
],//
receiptsFunData: [
{
text: '删除',
color: 'red'
}
]//
}
},
methods: {
//
receiptsOnFunc(row) {
this.ruleAddTableData.splice(row.index, 1)
},
//
receiptsAddRow() {
this.ruleAddTableData.push({})
},
//
ruleTypeSeleceChangHandle(val, row) {
this.$set(row, 'dbValue', '')
if (val === '1') {
row['dbValue'] = '-'
}
},
//
integerNumber(val, row) {
row['dbValue'] = row['dbValue'].replace(/[^\d]/g, '')
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@ -0,0 +1,720 @@
<template>
<div class="sonTable">
<div class="optionForm">
<baseNewForm
ref="optionForm"
:spanNumber="24"
:isFunBtn="false"
:formRow="optionFormRow"
:ruleForm="optionRuleForm"
:labelPosition="'left'"
@onSelect="selectChangeHanlde"
@inputBlur="optionFormInputBlur"
@onSubmit="optionOnSubmit"
>
</baseNewForm>
<baseNewForm
ref="typeOptionForm"
:spanNumber="24"
:isFunBtn="false"
:formRow="typeOptionFormRow"
:ruleForm="typeOptionRuleForm"
:labelPosition="'left'"
@onSelect="typeSelectChangeHanlde"
@onSubmit="typeOptionOnSubmit"
>
</baseNewForm>
<baseNewForm
ref="propertyForm"
:spanNumber="24"
:isFunBtn="false"
:formRow="propertyFormRow"
:ruleForm="propertyRuleForm"
:labelPosition="'left'"
@onSubmit="propertyOnSubmit"
>
</baseNewForm>
</div>
<div class="smtitle">
可选控间属性
</div>
<div class="checkBoxList">
<el-checkbox-group v-model="propertyActiveList"
@change="propertyActiveListChangeHanlde"
>
<el-checkbox v-for="(item,index) in propertyList" :label="item.id" :key="item.id">{{
item.label
}}
</el-checkbox>
</el-checkbox-group>
</div>
</div>
</template>
<script>
import baseNewForm from '../compoments/baseNewForm.vue'
import { deepClone } from '@/utils'
import { getApiModuleApi } from '@/api/apiChunks'
export default {
name: 'sonTable',
props: {
activedTableData: {
type: Array,
default: () => {
return []
}
},
mainTempClick: {
type: Object,
default: () => {
return {}
}
}
},
data() {
return {
activedTableRow: {},//
optionFormRow: [
{
elCol: [
{
type: 'input',
title: '中文名称',
id: 'chName',
row: 24,
disabled: false,
required: true,
fontSize: 16
}
]
},
{
elCol: [
{
type: 'input',
title: '英文名称',
id: 'enName',
row: 24,
disabled: false,
required: true,
fontSize: 16,
pattern: /^[a-zA-Z][a-zA-Z0-9_]{0,50}$/,
message: '须以字母开头且不能出现_外的字符与中文',
disabledOfId: true
}
]
},
{
elCol: [
{
type: 'select',
title: '字段类型',
id: 'filedType',
row: 24,
disabled: false,
required: true,
fontSize: 16,
options: []
}
]
},
{
elCol: [
{
type: 'num',
title: '长度',
id: 'filedLength',
row: 24,
disabled: false,
required: true,
fontSize: 16,
max: 255
}
]
},
{
elCol: [
{
type: 'input',
title: '显示名',
id: 'title',
row: 24,
disabled: false,
required: true,
fontSize: 16
}
]
}
, {
elCol: [
{
type: 'select',
title: '宽度',
id: 'row',
row: 24,
disabled: false,
required: true,
fontSize: 16,
options: [
{
label: '3',
id: '3'
}, {
label: '6',
id: '6'
}, {
label: '9',
id: '9'
}, {
label: '12',
id: '12'
}, {
label: '15',
id: '15'
}, {
label: '18',
id: '18'
}, {
label: '21',
id: '21'
}, {
label: '24',
id: '24'
}
]
}
]
},
{
elCol: [
{
type: 'num',
title: '单元格宽度',
id: 'width',
row: 24,
disabled: false,
required: false,
fontSize: 16,
message: 'px'
}
]
},
{
elCol: [
{
type: 'select',
title: '数据类型',
id: 'type',
row: 24,
disabled: false,
required: true,
fontSize: 16,
options: [
{
label: 'input',
id: 'input'
}, {
label: 'datepick',
id: 'datepick'
}, {
label: 'daterange',
id: 'daterange'
}, {
label: 'radio',
id: 'radio'
}, {
label: 'textrea',
id: 'textrea'
}, {
label: 'select',
id: 'select'
}, {
label: 'treeselect',
id: 'treeselect'
}, {
label: 'number',
id: 'num'
}
]
}
]
},
{
elCol: [
{
type: 'onecheck',
title: '必填',
id: 'required',
row: 24,
disabled: false,
required: false,
fontSize: 16,
options: [
{
label: '是',
id: 'true'
}, {
label: '否',
id: 'false'
}
]
}
]
},
{
elCol: [
{
type: 'onecheck',
title: '禁止修改',
id: 'disabled',
row: 24,
disabled: false,
required: false,
fontSize: 16,
options: [
{
label: '是',
id: 'true'
}
]
}
]
}
],
optionRuleForm: {},//options
//type
typeOptionFormRow: [],
typeOptionRuleForm: {},//type
propertyFormRow: [],//
propertyRuleForm: {},//
propertyActiveList: [],//v-model)
propertyList: [
{
label: '大于',
id: 'up'
}, {
label: '小于',
id: 'low'
},
{
label: '正则',
id: 'pattern'
},
{ label: '正则提示', id: 'message' }
],//
//
typeDist: {
select: [
{
type: 'select',
id: 'service',
title: '服务名称',
row: 24,
disabled: false,
required: true,
fontSize: 16,
options: []
},
{
type: 'select',
id: 'label',
title: 'label',
row: 24,
disabled: false,
required: true,
fontSize: 16,
options: []
}, {
type: 'input',
id: 'value',
title: 'value',
row: 24,
disabled: true,
required: true,
fontSize: 16,
options: []
}
],
radio: [
{
type: 'select',
id: 'service',
title: '服务名称',
row: 24,
disabled: false,
required: true,
fontSize: 16,
options: []
},
{
type: 'select',
id: 'label',
title: 'label',
row: 24,
disabled: false,
required: true,
fontSize: 16,
options: []
}, {
type: 'input',
id: 'value',
title: 'value',
row: 24,
disabled: true,
required: true,
fontSize: 16,
options: []
}
],
treeselect: [
{
type: 'select',
id: 'service',
title: '服务名称',
row: 24,
disabled: false,
required: true,
fontSize: 16,
options: []
},
{
type: 'select',
id: 'label',
title: 'label',
row: 24,
disabled: false,
required: true,
fontSize: 16,
options: []
}, {
type: 'input',
id: 'value',
title: 'value',
row: 24,
disabled: true,
required: false,
fontSize: 16,
options: []
},
{
type: 'select',
id: 'upId',
title: 'upId',
row: 24,
disabled: false,
required: true,
fontSize: 16,
options: []
}
]
},
serviceOptions: [], //
//radiolist
propertyDist: {
up: {
type: 'select',
id: 'up',
title: '大于',
row: 24,
disabled: false,
required: true,
fontSize: 16,
options: []
},
low: {
type: 'select',
id: 'low',
title: '小于',
row: 24,
disabled: false,
required: true,
fontSize: 16,
options: []
},
pattern: {
type: 'input',
id: 'pattern',
title: '正则',
row: 24,
disabled: false,
required: true,
fontSize: 16
},
message: {
type: 'input',
id: 'message',
title: '正则提示',
row: 24,
disabled: false,
required: true,
fontSize: 16
}
}
}
},
methods: {
//
activedOnClick(val) {
this.activedTableRow = val
//typeruleForm
this.typeOptionFormRow = []
this.typeOptionRuleForm = {
value: 'id'
}
this.propertyFormRow = []
this.propertyRuleForm = {}
this.propertyActiveList = []
let propertyRuleForm = []
let optionRuleForm = []
let typeOptionRuleForm = []
this.$nextTick(() => {
//
this.$refs.optionForm.resetForm()
this.optionRuleForm = deepClone(val)
console.log(this.optionRuleForm, 'this.optionRuleForm')
let dom = document.querySelector('.optionForm')
dom.scrollTo({
top: 0,
behavior: 'smooth'
})
//
if (!val.mdmModuleDbFiledsRules) return
val.mdmModuleDbFiledsRules.forEach(item => {
if (item.ruleCode === 'required' || item.ruleCode === 'disabled') {
if (!item.ruleValue) {
this.$set(this[item.formName], item.ruleCode, false)
} else if (typeof item.ruleValue === 'boolean') {
this.$set(this[item.formName], item.ruleCode, item.ruleValue)
} else {
this.$set(this[item.formName], item.ruleCode, JSON.parse(item.ruleValue))
}
} else {
this.$set(this[item.formName], item.ruleCode, item.ruleValue)
}
if (item.formName === 'propertyRuleForm') {
propertyRuleForm.push(item.ruleCode)
}
})
if (this.typeOptionRuleForm.service) {
this.typeSelectChangeHanlde(this.typeOptionRuleForm.service, '', '', { id: 'service' }, true)
}
this.selectChangeHanlde(this.optionRuleForm.type, '', '', { id: 'type' }, true)
this.propertyActiveList = propertyRuleForm
this.propertyActiveListChangeHanlde(this.propertyActiveList)
})
},
//type
selectChangeHanlde(val, index, indexRow, row, init = false) {
if (row.id === 'type') {
this.typeOptionFormRow = []
if (!init) {
this.typeOptionRuleForm = {
value: 'id'
}
}
if (val && this.typeDist[val]) {
this.typeDist[val].forEach(item => {
//
if (item.id === 'service') {
item.options = deepClone(this.serviceOptions)
}
let tempObj = {
elCol: [
{
...item
}
]
}
this.typeOptionFormRow.push(tempObj)
})
}
}
},
//
optionFormInputBlur(id, row) {
if (id === 'chName' && !row.title) {
this.$set(row, 'title', row['chName'])
}
},
//
optionOnSubmit() {
this.$refs.typeOptionForm.submitForm()
},
//typelabel
async typeSelectChangeHanlde(val, index, indexRow, row, initFlag = false) {
if (row.id === 'service') {
if (val) {
const res = await getApiModuleApi({
tl: 'mdmModuleService',
as: '',
dj: 'queryMdmServiceField'
}, { mdmId: this.$route.query.id, dbId: this.mainTempClick.id })
this.labelOptions = []
res.attribute.forEach(item => {
this.labelOptions.push({
id: item.enName,
label: item.chName
})
})
} else {
this.labelOptions = []
}
this.typeOptionFormRow.forEach(item => {
if (item.elCol[0].id === 'label' || item.elCol[0].id === 'upId') {
if (!initFlag) {
this.$set(this.typeOptionRuleForm, item.elCol[0].id, '')
}
item.elCol[0].options = deepClone(this.labelOptions)
}
})
}
},
//type
typeOptionOnSubmit() {
this.$refs.propertyForm.submitForm()
},
//
propertyOnSubmit() {
console.log('进入保存方法', this.activedTableRow)
let params = {
mdmId: this.$route.query.id,
dbId: this.mainTempClick.id,
dbType: this.mainTempClick.dbType,
dbName: this.mainTempClick.dbName,
id: this.activedTableRow.id
}
//
let tempDist = {
title: true,
row: true,
type: true,
required: true,
disabled: true,
width: true
}
let tempArr = []
let disabledWords = ['id', 'formmain_id', 'data_status', 'sorts', 'create_user_id', 'create_time', 'modify_user_id', 'modify_time', 'sts', 'org_id', 'company_id']
if (disabledWords.includes(this.optionRuleForm.enName)) {
this.$vmNews(`暂存失败,英文名${this.optionRuleForm.enName}不合法。`)
return
}
if (this.optionRuleForm.type === 'datepick' || this.optionRuleForm.type === 'daterange') {
if (this.optionRuleForm.filedType != 4) {
this.$vmNews('字段类型与数据类型不合法,请选择日期类型', 'warning')
return
}
}
if (this.optionRuleForm.filedType == 4) {
if (this.optionRuleForm.type !== 'datepick' && this.optionRuleForm.type !== 'daterange') {
this.$vmNews('字段类型与数据类型不合法', 'warning')
return
}
}
if (this.optionRuleForm.filedLength * 1 > 255) {
this.$vmNews('长度不能大于255')
return
}
this.$set(params, 'chName', this.optionRuleForm.chName)
this.$set(params, 'enName', this.optionRuleForm.enName)
this.$set(params, 'filedType', this.optionRuleForm.filedType)
this.$set(params, 'filedLength', this.optionRuleForm.filedLength)
this.optionFormRow.forEach(item => {
if (tempDist[item.elCol[0].id]) {
tempArr.push({
ruleName: item.elCol[0].title,
ruleCode: item.elCol[0].id,
ruleValue: this.optionRuleForm[item.elCol[0].id],
ruleType: 2,
formName: 'optionRuleForm'
})
}
})
this.typeOptionFormRow.forEach(item => {
tempArr.push({
ruleName: item.elCol[0].title,
ruleCode: item.elCol[0].id,
ruleValue: this.typeOptionRuleForm[item.elCol[0].id],
ruleType: 2,
formName: 'typeOptionRuleForm'
})
})
this.propertyFormRow.forEach(item => {
tempArr.push({
ruleName: item.elCol[0].title,
ruleCode: item.elCol[0].id,
ruleValue: this.propertyRuleForm[item.elCol[0].id],
ruleType: 2,
formName: 'propertyRuleForm'
})
})
params.mdmModuleDbFiledsRules = tempArr
console.log(params)
this.$emit('sonSaveHandle', params)
},
//
propertyActiveListChangeHanlde(val) {
this.propertyFormRow = []
//
Object.keys(this.propertyRuleForm).forEach(item => {
if (!val.includes(item)) {
this.$delete(this.propertyRuleForm, item)
}
})
if (val === 'up' || val === 'low') {
this.activedTableData.forEach(item => {
tempOptions.push({ label: item.id, chName: item.enName })
})
}
//
val.forEach(item => {
let tempOptions = []
//datepick
if (item === 'up' || item === 'low') {
this.activedTableData.some(ele => {
console.log(ele, 'ele')
if (this.activedTableRow.id === ele.id || !ele.mdmModuleDbFiledsRules) return false
ele.mdmModuleDbFiledsRules.forEach(ele02 => {
if (ele02.ruleValue === 'datepick') {
tempOptions.push({ label: ele.chName, id: ele.enName })
}
})
})
}
let tempObj = {
elCol: [
{
...this.propertyDist[item],
options: tempOptions
}
]
}
this.propertyFormRow.push(tempObj)
})
}
},
components: {
baseNewForm
}
}
</script>
<style scoped lang="scss">
.smtitle {
color: #000;
font-weight: 600;
padding: 20px 0;
border-top: 1px solid #EBEBEB;
}
.checkBoxList {
padding-bottom: 50px;
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -3,8 +3,8 @@
<div class="btn">
<div class="chunk">
<el-button
icon="el-icon-back"
@click="
icon="el-icon-back"
@click="
$router.replace({ path: '/integrationOption/masterDataOptions' })
"
>返回
@ -13,10 +13,10 @@
</div>
<div class="chunk">
<el-button
icon="el-icon-first-aid-kit"
type="primary"
@click="saveHandle"
:loading="saveLoading"
icon="el-icon-first-aid-kit"
type="primary"
@click="saveHandle"
:loading="saveLoading"
>保存
</el-button
>
@ -32,342 +32,349 @@
</div>
<div class="form" v-if="displayType == 1">
<baseNewForm
ref="optionForm"
:spanNumber="24"
:isFunBtn="false"
:formRow="formRow"
:ruleForm="ruleForm"
:labelPosition="'left'"
labelWidth="80px"
@onSubmit="onSubmit">
ref="optionForm"
:spanNumber="24"
:isFunBtn="false"
:formRow="formRow"
:ruleForm="ruleForm"
:labelPosition="'right'"
labelWidth="100px"
@onSubmit="onSubmit"
>
</baseNewForm>
</div>
<div class="tabIndex">
<el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect">
<el-menu-item index="1">查询</el-menu-item>
<el-menu-item index="2">列表</el-menu-item>
<el-menu-item index="3">新增</el-menu-item>
<el-menu-item index="4">修改</el-menu-item>
<el-menu-item index="5">查看</el-menu-item>
</el-menu>
</div>
<div class="content">
<el-transfer
style="text-align: left; display: inline-block;"
v-model="contentFormArr"
filterable
:titles="['全部字段', '显示字段']"
target-order="push"
@change="handleChange"
@right-check-change="rightCheckChange"
:props="propsKey"
:data="data">
<span slot-scope="{ option }">{{ option.name }}</span>
</el-transfer>
<div class="buttonList">
<div class="upBtn">
<el-button type="primary" icon="el-icon-top" @click="upHanlde"
:disabled="rightActived.length !== 1"></el-button>
<div class="showItem">
<div class="itemTitle">查询</div>
<div class="setting">
<div class="settingBox" @click="settingHandle('查询')">
<div class="img">
<img src="./images/设置.png" alt="">
</div>
<div class="value">设置</div>
</div>
</div>
<div class="downBtn">
<el-button type="primary" icon="el-icon-bottom" @click="downHanlde"
:disabled="rightActived.length !==1"></el-button>
<div class="showCheckBoxList">
<div class="showCheckBoxItem" v-for="(item,index) in dbQueryFiled" :key="item.viewFiled">
<div class="name">{{ item.viewName }}</div>
</div>
</div>
</div>
<div class="showItem">
<div class="itemTitle">列表</div>
<div class="setting">
<div class="settingBox" @click="settingHandle('列表')">
<div class="img">
<img src="./images/设置.png" alt="">
</div>
<div class="value">设置</div>
</div>
</div>
<div class="showCheckBoxList">
<div class="showCheckBoxItem" v-for="(item,index) in dbListFiled" :key="item.viewFiled">
<div class="name">{{ item.viewName }}</div>
</div>
</div>
</div>
<div class="showItem">
<div class="itemTitle">新增</div>
<div class="setting">
<div class="settingBox" @click="settingHandle('新增')">
<div class="img">
<img src="./images/设置.png" alt="">
</div>
<div class="value">设置</div>
</div>
</div>
<div class="showCheckBoxList">
<div class="showCheckBoxItem" v-for="(item,index) in dbAddFiled" :key="item.viewFiled">
<div class="name">{{ item.viewName }}</div>
</div>
</div>
</div>
<div class="showItem">
<div class="itemTitle">修改</div>
<div class="setting">
<div class="settingBox" @click="settingHandle('修改')">
<div class="img">
<img src="./images/设置.png" alt="">
</div>
<div class="value">设置</div>
</div>
</div>
<div class="showCheckBoxList">
<div class="showCheckBoxItem" v-for="(item,index) in dbEditFiled" :key="item.viewFiled">
<div class="name">{{ item.viewName }}</div>
</div>
</div>
</div>
<div class="showItem">
<div class="itemTitle">查看</div>
<div class="setting">
<div class="settingBox" @click="settingHandle('查看')">
<div class="img">
<img src="./images/设置.png" alt="">
</div>
<div class="value">设置</div>
</div>
</div>
<div class="showCheckBoxList">
<div class="showCheckBoxItem" v-for="(item,index) in dbShowFiled" :key="item.viewFiled">
<div class="name">{{ item.viewName }}</div>
</div>
</div>
</div>
<div class="showItem">
<div class="itemTitle">按钮</div>
<div class="setting">
<div class="settingBox" @click="settingHandle('按钮')">
<div class="img">
<img src="./images/设置.png" alt="">
</div>
<div class="value">设置</div>
</div>
</div>
<div class="showCheckBoxList">
<div class="showCheckBoxItem" v-for="(item,index) in btnShowList" :key="item.buttonType">
<div class="name">{{ item.name }}</div>
</div>
</div>
</div>
</div>
</div>
<!-- -->
<base-right-dialog
ref="mainTableAddtDialog"
:footerShow="true"
:dialogVisible.sync="mainTableDialogShow"
:title="activeTitle + '设置'"
@handleClose="mainTableDialogShow=false"
:submitShow="true"
:size="'50%'"
@handleConfirmClick="mainTableSaveHandle"
>
<div class="mainTable">
<settingChunk ref="settingChunk" @saveSuccessEmit="saveSuccessEmit"></settingChunk>
</div>
</base-right-dialog>
</div>
</template>
<script>
import baseNewForm from "@/views/intergrationTask/compoments/baseNewForm";
import {getApiModuleApi} from "@/api/apiChunks/index.js";
import settingChunk from '@/views/masterDataOptions/displayInfo/settingChunk.vue'
import baseNewForm from '@/views/intergrationTask/compoments/baseNewForm'
import { getApiModuleApi } from '@/api/apiChunks/index.js'
import baseRightDialog from '@/components/base/baseRightDialog/index.vue'
import { authApi } from '@/api/apis/auth'
export default {
name: "index.vue",
name: 'index.vue',
data() {
return {
mainLoading:false,
saveLoading:false,
id: "",
propsKey: {
key: "id",
label: "name",
disabled: "disabled"
},
displayType: "1",
formRow: [
{
elCol: [
{
type: "select",
title: "显示字段",
id: "viewFiled",
row: 12,
type: 'select',
title: '显示字段',
id: 'viewFiled',
row: 6,
disabled: false,
required: true,
fontSize: 16,
options: [],
options: []
},
{
type: "select",
title: "上级id字段",
id: "upIdFiled",
row: 12,
type: 'select',
title: '上级id字段',
id: 'upIdFiled',
row: 6,
disabled: false,
required: true,
fontSize: 16,
options: [],
},
options: []
}
]
}
],
ruleForm: {},
activeIndex: "1",
contentFormArr: [],
data: [],
rightActived: [],
addFiled: [],
dbAddFiled: [],
editFiled: [],
dbEditFiled: [],
showFiled: [],
dbShowFiled: [],
queryFiled: [],
dbQueryFiled: [],
listFiled: [],
dbListFiled: [],
ainLoading: false,
displayType: '1',//
saveLoading: false,//loading
activeTitle: '',//key
mainTableDialogShow: false,
mainLoading: false,
'dbQueryFiled': [],//
'dbAddFiled': [],//
'dbEditFiled': [],//
'dbShowFiled': [],//
'dbListFiled': [],//
btnShowList: [],//
allFiledList: [
{
buttonName: '新建',
buttonValue: 'new',
buttonType: '1'
}, {
buttonName: '重置',
buttonValue: 'resize',
buttonType: '2'
}, {
buttonName: '查询',
buttonValue: 'search',
buttonType: '3'
}, {
buttonName: '修改',
buttonValue: 'edit',
buttonType: '4'
}, {
buttonName: '删除',
buttonValue: 'dele',
buttonType: '5'
}, {
buttonName: '查看',
buttonValue: 'view',
buttonType: '6'
}, {
buttonName: '下发',
buttonValue: 'send',
buttonType: '7'
}
],//
dist: {
'查询': ['queryFiled', 'dbQueryFiled', 1],
'列表': ['listFiled', 'dbListFiled', 2],
'新增': ['addFiled', 'dbAddFiled', 3],
'修改': ['editFiled', 'dbEditFiled', 4],
'查看': ['showFiled', 'dbShowFiled', 5]
}//
}
},
methods: {
async init() {
this.mainLoading = true
this.activeIndex = "1"
const res = await getApiModuleApi({
tl: "mdmService",
as: "mdmService",
dj: "queryMdmModuleView",
}, {
id: this.$route.query.id
})
this.mainLoading = false
this.addFiled = res.attribute.addFiled
this.dbAddFiled = res.attribute.dbAddFiled
this.initDispose(this.addFiled, this.dbAddFiled)
this.editFiled = res.attribute.editFiled
this.dbEditFiled = res.attribute.dbEditFiled
this.initDispose(this.editFiled, this.dbEditFiled)
this.showFiled = res.attribute.showFiled
this.dbShowFiled = res.attribute.dbShowFiled
this.initDispose(this.showFiled, this.dbShowFiled)
this.queryFiled = res.attribute.queryFiled
this.dbQueryFiled = res.attribute.dbQueryFiled
this.initDispose(this.queryFiled, this.dbQueryFiled)
this.listFiled = res.attribute.listFiled
this.dbListFiled = res.attribute.dbListFiled
this.initDispose(this.listFiled, this.dbListFiled)
this.data = this.queryFiled
this.contentFormArr = []
this.dbQueryFiled.forEach(item => {
this.contentFormArr.push(item.id)
})
this.id = res.attribute.mdmModuleViewEntity.id
if (!res.attribute.mdmModuleViewEntity.viewName) return
this.displayType = res.attribute.mdmModuleViewEntity.viewName
this.ruleForm = {
viewFiled: res.attribute.mdmModuleViewEntity.viewFiled,
upIdFiled: res.attribute.mdmModuleViewEntity.upIdFiled,
}
},
async initSelect() {
const res = await getApiModuleApi({
tl: "mdmService",
as: "mdmService",
dj: "queryMdmModuleServerMainFiled"
tl: 'mdmModuleService',
as: '',
dj: 'queryMdmMainDBField'
}, {
mdmId: this.$route.query.id
})
console.log(res, 'select')
if (res.status === '200') {
this.formRow[0].elCol[1].options = []
this.formRow[0].elCol[0].options = []
res.attribute.forEach(item => {
this.formRow[0].elCol[1].options.push({
label: item.chName,
id: item.enName,
id: item.enName
})
this.formRow[0].elCol[0].options.push({
label: item.chName,
id: item.enName,
id: item.enName
})
})
}
},
async saveHandle() {
if (this.displayType === '1') {
this.$refs.optionForm.submitForm()
} else {
this.saveLoading = true
let params = {
id: this.$route.query.id,
mdmModuleViewEntity: {
id: this.id,
viewName: this.displayType
},
addFiled: this.dbAddFiled,
editFiled: this.dbEditFiled,
showFiled: this.dbShowFiled,
queryFiled: this.dbQueryFiled,
listFiled: this.dbListFiled,
}
const res = await getApiModuleApi({
tl: "mdmService",
as: "mdmService",
dj: "doSaveMdmModuleView",
}, params)
if (res.status === '200') {
this.$vmNews("保存成功!", "success")
this.init()
this.$store.dispatch("GenerateRoutes")
}
this.saveLoading = false
}
//
saveSuccessEmit() {
this.mainTableDialogShow = false
this.getAllField()
},
//
async onSubmit() {
if (this.ruleForm.viewFiled === this.ruleForm.upIdFiled) {
this.$vmNews("显示字段与上级id字段不能相同", "warning")
return
}
this.saveLoading = true
let params = {
id: this.$route.query.id,
mdmModuleViewEntity: {
id: this.id,
viewName: this.displayType,
...this.ruleForm
},
addFiled: this.dbAddFiled,
editFiled: this.dbEditFiled,
showFiled: this.dbShowFiled,
queryFiled: this.dbQueryFiled,
listFiled: this.dbListFiled,
}
const res = await getApiModuleApi({
tl: "mdmService",
as: "mdmService",
dj: "doSaveMdmModuleView",
}, params)
if (res.status === '200') {
this.$vmNews("保存成功!", "success")
this.$store.dispatch("GenerateRoutes")
this.init()
}
this.saveLoading = false
},
handleSelect(key, keyPath) {
this.activeIndex = key
this.rightActived = []
let tempObj = {
1: ['queryFiled', 'dbQueryFiled'],
2: ['listFiled', 'dbListFiled'],
3: ['addFiled', 'dbAddFiled'],
4: ['editFiled', 'dbEditFiled'],
5: ['showFiled', 'dbShowFiled']
}
this.data = this[tempObj[key][0]]
this.contentFormArr = []
this[tempObj[key][1]].forEach(item => {
this.contentFormArr.push(item.id)
})
},
handleChange(value, direction, movedKeys) {
let tempObj = {
1: ['queryFiled', 'dbQueryFiled'],
2: ['listFiled', 'dbListFiled'],
3: ['addFiled', 'dbAddFiled'],
4: ['editFiled', 'dbEditFiled'],
5: ['showFiled', 'dbShowFiled']
}
this.disposeDataArr(value)
this.rightActived = []
},
initDispose(arr1, arr2) {
arr2.forEach(item => {
arr1.some(ele => {
if (item.viewFiled === ele.id) {
item.id = ele.id
item.name = ele.name
return true
}
return false
if (this.ruleForm.id) {
this.openLoading('submit')
const res = await authApi('mdmModuleService', '', 'updateMdmView', '', {
...this.ruleForm,
mdmId: this.$route.query.id,
viewName: this.displayType
})
})
},
rightCheckChange(arr) {
this.rightActived = arr
},
//
upHanlde() {
const index = this.contentFormArr.findIndex(ele => {
return this.rightActived[0] === ele
})
if (index === 0) {
this.$vmNews("排序为1时无法向上")
return
}
const tempDele = this.contentFormArr.splice(index, 1)
this.contentFormArr.splice(index - 1, 0, tempDele[0])
this.disposeDataArr(this.contentFormArr)
},
//
downHanlde() {
const index = this.contentFormArr.findIndex(ele => {
return this.rightActived[0] === ele
})
if (index === this.contentFormArr.length - 1) {
this.$vmNews("末尾排序无法向下排序")
return
}
const tempDele = this.contentFormArr.splice(index, 1)
this.contentFormArr.splice(index + 1, 0, tempDele[0])
this.disposeDataArr(this.contentFormArr)
},
disposeDataArr(arr) {
let tempObj = {
1: ['queryFiled', 'dbQueryFiled'],
2: ['listFiled', 'dbListFiled'],
3: ['addFiled', 'dbAddFiled'],
4: ['editFiled', 'dbEditFiled'],
5: ['showFiled', 'dbShowFiled']
}
this[tempObj[this.activeIndex][1]] = []
arr.forEach((idNum, index) => {
this.data.some(item => {
if (item.id === idNum) {
this[tempObj[this.activeIndex][1]].push({...item, sort: index})
return true
} else {
return false
}
this.$vmNews('保存成功', 'success')
this.getRuleForm()
} else {
this.openLoading('submit')
const res = await authApi('mdmModuleService', '', 'saveMdmView', '', {
...this.ruleForm,
mdmId: this.$route.query.id,
viewName: this.displayType
})
this.$vmNews('保存成功', 'success')
this.getRuleForm()
}
},
//
async getRuleForm() {
this.openLoading('detail')
this.ruleForm = {}
const res = await authApi('mdmModuleService', '', 'queryMdmView', '', {
mdmId: this.$route.query.id
})
this.ruleForm = res.attribute
this.displayType = this.ruleForm.viewName
},
//
saveHandle() {
if (this.displayType === '1') {
this.$refs.optionForm.submitForm()
} else {
this.onSubmit()
}
},
//
settingHandle(key) {
this.activeTitle = key
this.mainTableDialogShow = true
this.$nextTick(() => {
this.$refs.settingChunk.getAllBtn(key)
})
},
//
mainTableSaveHandle() {
this.$refs.settingChunk.saveHandle()
},
//
async getAllField() {
//
const res = await authApi('mdmModuleService', '', 'queryMdmViewField', '', {
id: this.$route.query.id
})
this.dbQueryFiled = res.attribute.dbQueryFiled
this.dbListFiled = res.attribute.dbListFiled
this.dbAddFiled = res.attribute.dbAddFiled
this.dbEditFiled = res.attribute.dbEditFiled
this.dbShowFiled = res.attribute.dbShowFiled
//
const res2 = await authApi('mdmModuleService', '', 'queryMdmViewButton', '', {
mdmId: this.$route.query.id
})
res2.attribute.forEach(item => {
item.name = this.allFiledList[item.buttonType - 1].buttonName
})
this.btnShowList = res2.attribute
}
},
components: {
baseNewForm
baseRightDialog,
baseNewForm,
settingChunk
},
created() {
this.init()
//
this.getRuleForm()
//
this.initSelect()
this.$emit("flashActive", 2)
//
this.getAllField()
this.$emit('flashActive', 2)
}
}
</script>
<style scoped lang="scss">
::v-deep .el-form-item__content {
margin: 0 !important;
}
::v-deep .el-menu-item {
padding: 0 35px;
}
@ -384,6 +391,7 @@ export default {
::v-deep .el-transfer-panel__list {
height: 50vh;
}
::v-deep .el-transfer-panel__body {
height: 50vh;
}
@ -424,15 +432,94 @@ export default {
}
> .content {
margin-top: 30px;
margin-top: 3vh;
display: flex;
align-items: center;
.buttonList {
margin-left: 50px;
.showItem {
flex: 1;
margin-left: 8px;
height: 70vh;
background: #FFFFFF;
border-radius: 8px;
border: 1px solid #EBEBEB;
padding: 14px 20px;
position: relative;
.downBtn {
margin-top: 30px;
.itemTitle {
font-family: PingFangSC, PingFang SC;
font-weight: 500;
font-size: 16px;
color: #333333;
line-height: 22px;
font-style: normal;
text-align: center;
padding-bottom: 20px;
border-bottom: 1px #ebebeb solid;
}
.setting {
width: 100%;
height: 140px;
position: absolute;
bottom: 0;
left: 0;
border-radius: 8px;
display: none;
justify-content: center;
align-items: center;
background-color: rgba(0, 0, 0, .6);
.settingBox {
cursor: pointer;
.img {
width: 44px;
height: 44px;
img {
width: 100%;
height: 100%;
}
}
.value {
margin-top: 10px;
font-family: PingFangSC, PingFang SC;
font-weight: 600;
font-size: 16px;
color: #FFFFFF;
line-height: 22px;
text-align: center;
font-style: normal;
}
}
}
&:hover {
.setting {
display: flex !important;
}
}
.showCheckBoxList {
height: 45vh;
overflow: auto;
}
.showCheckBoxItem {
display: flex;
justify-content: space-between;
align-items: center;
margin: 16px 0 16px;
border-radius: 4px;
font-size: 14px;
.btn {
color: grey;
cursor: pointer;
}
}
}
}

View File

@ -0,0 +1,442 @@
<template>
<div class="displayInfo">
<div class="btn">
<div class="chunk">
<el-button
icon="el-icon-back"
@click="
$router.replace({ path: '/integrationOption/masterDataOptions' })
"
>返回
</el-button
>
</div>
<div class="chunk">
<el-button
icon="el-icon-first-aid-kit"
type="primary"
@click="saveHandle"
:loading="saveLoading"
>保存
</el-button
>
</div>
</div>
<div class="main" v-loading="mainLoading">
<div class="title">显示类型</div>
<div class="radio">
<el-radio-group v-model="displayType">
<el-radio label="1">树形</el-radio>
<el-radio label="2">列表</el-radio>
</el-radio-group>
</div>
<div class="form" v-if="displayType == 1">
<baseNewForm
ref="optionForm"
:spanNumber="24"
:isFunBtn="false"
:formRow="formRow"
:ruleForm="ruleForm"
:labelPosition="'left'"
labelWidth="80px"
@onSubmit="onSubmit">
</baseNewForm>
</div>
<div class="tabIndex">
<el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect">
<el-menu-item index="1">查询</el-menu-item>
<el-menu-item index="2">列表</el-menu-item>
<el-menu-item index="3">新增</el-menu-item>
<el-menu-item index="4">修改</el-menu-item>
<el-menu-item index="5">查看</el-menu-item>
</el-menu>
</div>
<div class="content">
<el-transfer
style="text-align: left; display: inline-block;"
v-model="contentFormArr"
filterable
:titles="['全部字段', '显示字段']"
target-order="push"
@change="handleChange"
@right-check-change="rightCheckChange"
:props="propsKey"
:data="data">
<span slot-scope="{ option }">{{ option.name }}</span>
</el-transfer>
<div class="buttonList">
<div class="upBtn">
<el-button type="primary" icon="el-icon-top" @click="upHanlde"
:disabled="rightActived.length !== 1"></el-button>
</div>
<div class="downBtn">
<el-button type="primary" icon="el-icon-bottom" @click="downHanlde"
:disabled="rightActived.length !==1"></el-button>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import baseNewForm from "@/views/intergrationTask/compoments/baseNewForm";
import {getApiModuleApi} from "@/api/apiChunks/index.js";
export default {
name: "index.vue",
data() {
return {
mainLoading:false,
saveLoading:false,
id: "",
propsKey: {
key: "id",
label: "name",
disabled: "disabled"
},
displayType: "1",
formRow: [
{
elCol: [
{
type: "select",
title: "显示字段",
id: "viewFiled",
row: 12,
disabled: false,
required: true,
fontSize: 16,
options: [],
},
{
type: "select",
title: "上级id字段",
id: "upIdFiled",
row: 12,
disabled: false,
required: true,
fontSize: 16,
options: [],
},
]
}
],
ruleForm: {},
activeIndex: "1",
contentFormArr: [],
data: [],
rightActived: [],
addFiled: [],
dbAddFiled: [],
editFiled: [],
dbEditFiled: [],
showFiled: [],
dbShowFiled: [],
queryFiled: [],
dbQueryFiled: [],
listFiled: [],
dbListFiled: [],
}
},
methods: {
async init() {
this.mainLoading = true
this.activeIndex = "1"
const res = await getApiModuleApi({
tl: "mdmService",
as: "mdmService",
dj: "queryMdmModuleView",
}, {
id: this.$route.query.id
})
this.mainLoading = false
this.addFiled = res.attribute.addFiled
this.dbAddFiled = res.attribute.dbAddFiled
this.initDispose(this.addFiled, this.dbAddFiled)
this.editFiled = res.attribute.editFiled
this.dbEditFiled = res.attribute.dbEditFiled
this.initDispose(this.editFiled, this.dbEditFiled)
this.showFiled = res.attribute.showFiled
this.dbShowFiled = res.attribute.dbShowFiled
this.initDispose(this.showFiled, this.dbShowFiled)
this.queryFiled = res.attribute.queryFiled
this.dbQueryFiled = res.attribute.dbQueryFiled
this.initDispose(this.queryFiled, this.dbQueryFiled)
this.listFiled = res.attribute.listFiled
this.dbListFiled = res.attribute.dbListFiled
this.initDispose(this.listFiled, this.dbListFiled)
this.data = this.queryFiled
this.contentFormArr = []
this.dbQueryFiled.forEach(item => {
this.contentFormArr.push(item.id)
})
this.id = res.attribute.mdmModuleViewEntity.id
if (!res.attribute.mdmModuleViewEntity.viewName) return
this.displayType = res.attribute.mdmModuleViewEntity.viewName
this.ruleForm = {
viewFiled: res.attribute.mdmModuleViewEntity.viewFiled,
upIdFiled: res.attribute.mdmModuleViewEntity.upIdFiled,
}
},
async initSelect() {
const res = await getApiModuleApi({
tl: "mdmService",
as: "mdmService",
dj: "queryMdmModuleServerMainFiled"
}, {
mdmId: this.$route.query.id
})
console.log(res, 'select')
if (res.status === '200') {
this.formRow[0].elCol[1].options = []
this.formRow[0].elCol[0].options = []
res.attribute.forEach(item => {
this.formRow[0].elCol[1].options.push({
label: item.chName,
id: item.enName,
})
this.formRow[0].elCol[0].options.push({
label: item.chName,
id: item.enName,
})
})
}
},
async saveHandle() {
if (this.displayType === '1') {
this.$refs.optionForm.submitForm()
} else {
this.saveLoading = true
let params = {
id: this.$route.query.id,
mdmModuleViewEntity: {
id: this.id,
viewName: this.displayType
},
addFiled: this.dbAddFiled,
editFiled: this.dbEditFiled,
showFiled: this.dbShowFiled,
queryFiled: this.dbQueryFiled,
listFiled: this.dbListFiled,
}
const res = await getApiModuleApi({
tl: "mdmService",
as: "mdmService",
dj: "doSaveMdmModuleView",
}, params)
if (res.status === '200') {
this.$vmNews("保存成功!", "success")
this.init()
this.$store.dispatch("GenerateRoutes")
}
this.saveLoading = false
}
},
//
async onSubmit() {
if (this.ruleForm.viewFiled === this.ruleForm.upIdFiled) {
this.$vmNews("显示字段与上级id字段不能相同", "warning")
return
}
this.saveLoading = true
let params = {
id: this.$route.query.id,
mdmModuleViewEntity: {
id: this.id,
viewName: this.displayType,
...this.ruleForm
},
addFiled: this.dbAddFiled,
editFiled: this.dbEditFiled,
showFiled: this.dbShowFiled,
queryFiled: this.dbQueryFiled,
listFiled: this.dbListFiled,
}
const res = await getApiModuleApi({
tl: "mdmService",
as: "mdmService",
dj: "doSaveMdmModuleView",
}, params)
if (res.status === '200') {
this.$vmNews("保存成功!", "success")
this.$store.dispatch("GenerateRoutes")
this.init()
}
this.saveLoading = false
},
handleSelect(key, keyPath) {
this.activeIndex = key
this.rightActived = []
let tempObj = {
1: ['queryFiled', 'dbQueryFiled'],
2: ['listFiled', 'dbListFiled'],
3: ['addFiled', 'dbAddFiled'],
4: ['editFiled', 'dbEditFiled'],
5: ['showFiled', 'dbShowFiled']
}
this.data = this[tempObj[key][0]]
this.contentFormArr = []
this[tempObj[key][1]].forEach(item => {
this.contentFormArr.push(item.id)
})
},
handleChange(value, direction, movedKeys) {
let tempObj = {
1: ['queryFiled', 'dbQueryFiled'],
2: ['listFiled', 'dbListFiled'],
3: ['addFiled', 'dbAddFiled'],
4: ['editFiled', 'dbEditFiled'],
5: ['showFiled', 'dbShowFiled']
}
this.disposeDataArr(value)
this.rightActived = []
},
initDispose(arr1, arr2) {
arr2.forEach(item => {
arr1.some(ele => {
if (item.viewFiled === ele.id) {
item.id = ele.id
item.name = ele.name
return true
}
return false
})
})
},
rightCheckChange(arr) {
this.rightActived = arr
},
//
upHanlde() {
const index = this.contentFormArr.findIndex(ele => {
return this.rightActived[0] === ele
})
if (index === 0) {
this.$vmNews("排序为1时无法向上")
return
}
const tempDele = this.contentFormArr.splice(index, 1)
this.contentFormArr.splice(index - 1, 0, tempDele[0])
this.disposeDataArr(this.contentFormArr)
},
//
downHanlde() {
const index = this.contentFormArr.findIndex(ele => {
return this.rightActived[0] === ele
})
if (index === this.contentFormArr.length - 1) {
this.$vmNews("末尾排序无法向下排序")
return
}
const tempDele = this.contentFormArr.splice(index, 1)
this.contentFormArr.splice(index + 1, 0, tempDele[0])
this.disposeDataArr(this.contentFormArr)
},
disposeDataArr(arr) {
let tempObj = {
1: ['queryFiled', 'dbQueryFiled'],
2: ['listFiled', 'dbListFiled'],
3: ['addFiled', 'dbAddFiled'],
4: ['editFiled', 'dbEditFiled'],
5: ['showFiled', 'dbShowFiled']
}
this[tempObj[this.activeIndex][1]] = []
arr.forEach((idNum, index) => {
this.data.some(item => {
if (item.id === idNum) {
this[tempObj[this.activeIndex][1]].push({...item, sort: index})
return true
} else {
return false
}
})
})
}
},
components: {
baseNewForm
},
created() {
this.init()
this.initSelect()
this.$emit("flashActive", 2)
}
}
</script>
<style scoped lang="scss">
::v-deep .el-menu-item {
padding: 0 35px;
}
::v-deep .el-transfer-panel {
width: 25vw;
height: 60vh;
}
::v-deep .el-button {
border-radius: 16px;
}
::v-deep .el-transfer-panel__list {
height: 50vh;
}
::v-deep .el-transfer-panel__body {
height: 50vh;
}
.displayInfo {
background-color: #fbfbfb;
width: 100%;
position: relative;
> .btn {
display: flex;
justify-content: flex-end;
> .chunk {
margin-left: 10px;
}
}
> .main {
background-color: #fff;
border-right: 8px;
height: 85vh;
overflow: auto;
margin-top: 10px;
padding: 0px 15px;
> .title {
font-weight: 600;
margin: 15px 0;
}
> .radio {
margin: 15px 20px;
}
> .tabIndex {
margin-top: 10px;
}
> .content {
margin-top: 30px;
display: flex;
align-items: center;
.buttonList {
margin-left: 50px;
.downBtn {
margin-top: 30px;
}
}
}
}
}
</style>

View File

@ -0,0 +1,290 @@
<template>
<div class="settingChunk">
<div class="leftAll">
<div class="search">
<el-input
placeholder="搜索"
prefix-icon="el-icon-search"
v-model="searchValue"
>
</el-input>
</div>
<div class="checkBoxList">
<!-- 字段-->
<template v-if="showFiledFlag">
<el-checkbox-group v-model="pickList" @change="checkBoxChangeHandle">
<template v-for="(item,index) in allBtnList">
<div class="checkBoxItem" :key="item.id" v-if="item.name.includes(searchValue)">
<el-checkbox :label="item.id">{{ item.name }}</el-checkbox>
</div>
</template>
</el-checkbox-group>
</template>
<!-- 按钮类型-->
<template v-else>
<el-checkbox-group v-model="pickList" @change="changeBtnBoxHandle">
<template v-for="(item,index) in allFiledList">
<div class="checkBoxItem" :key="item.buttonType" v-if="item.buttonName.includes(searchValue)">
<el-checkbox :label="item.buttonType">{{ item.buttonName }}</el-checkbox>
</div>
</template>
</el-checkbox-group>
</template>
</div>
</div>
<div class="rightAdd">
<div class="pickTitle">已选择{{ pickShowList.length }}</div>
<div class="showCheckBoxList">
<draggable v-model="pickShowList">
<template v-if="showFiledFlag">
<div class="showCheckBoxItem" v-for="(item,index) in pickShowList" :key="item.viewFiled">
<div class="name">{{ item.name }}</div>
<div class="btn" @click="deleShowList(item,index)">x</div>
</div>
</template>
<template v-else>
<div class="showCheckBoxItem" v-for="(item,index) in pickShowList" :key="item.buttonType">
<div class="name">{{ item.buttonName }}</div>
<div class="btn" @click="deleBtnShowList(item,index)">x</div>
</div>
</template>
</draggable>
</div>
</div>
</div>
</template>
<script>
import draggable from 'vuedraggable'
import { authApi } from '@/api/apis/auth'
export default {
name: 'settingChunk',
data() {
return {
searchValue: '',//
allBtnList: [],//
allFiledList: [
{
buttonName: '新建',
buttonValue: 'new',
buttonType: '1'
}, {
buttonName: '重置',
buttonValue: 'resize',
buttonType: '2'
}, {
buttonName: '查询',
buttonValue: 'search',
buttonType: '3'
}, {
buttonName: '修改',
buttonValue: 'edit',
buttonType: '4'
}, {
buttonName: '删除',
buttonValue: 'dele',
buttonType: '5'
}, {
buttonName: '查看',
buttonValue: 'view',
buttonType: '6'
}, {
buttonName: '下发',
buttonValue: 'send',
buttonType: '7'
}
],//
//key''viewType
dist: {
'查询': ['queryFiled', 'dbQueryFiled', 1],
'列表': ['listFiled', 'dbListFiled', 2],
'新增': ['addFiled', 'dbAddFiled', 3],
'修改': ['editFiled', 'dbEditFiled', 4],
'查看': ['showFiled', 'dbShowFiled', 5]
},
pickDist: {},//
pickList: [],//
pickShowList: [],//
thisKey: '',//key
showFiledFlag: true//
}
},
methods: {
//
async getAllBtn(key) {
this.showFiledFlag = true
this.thisKey = key
//
this.pickShowList = []
this.pickList = []
this.searchValue = ''
this.allBtnList = []
this.pickDist = {}
//
if (this.dist[key]) {
this.openLoading('detail')
const res = await authApi('mdmModuleService', '', 'queryMdmViewField', '', {
id: this.$route.query.id
})
let tempArr = this.dist[key]
res.attribute[tempArr[0]].forEach(item => {
this.$set(this.pickDist, item.id, item.name)
})
this.allBtnList = res.attribute[tempArr[0]]
res.attribute[tempArr[1]].forEach(item => {
this.pickList.push(item.viewFiled)
this.checkBoxChangeHandle()
})
} else {
this.showFiledFlag = false
const res = await authApi('mdmModuleService', '', 'queryMdmViewButton', '', {
mdmId: this.$route.query.id
})
res.attribute.forEach(item => {
this.pickList.push(item.buttonType)
})
this.changeBtnBoxHandle()
}
},
//
checkBoxChangeHandle() {
let tempList = []
this.pickShowList = []
//listdist
this.pickList.forEach(item => {
this.pickShowList.push({
name: this.pickDist[item],
viewFiled: item
})
})
},
//
changeBtnBoxHandle() {
this.pickShowList = []
this.pickList.forEach(item => {
let obj = this.allFiledList[item - 1]
this.pickShowList.push(obj)
})
},
//
deleShowList(item, index) {
this.pickShowList.splice(index, 1)
//box
let tempArr = []
this.pickShowList.forEach((item) => {
tempArr.push(item.viewFiled)
})
this.pickList = tempArr
},
//
deleBtnShowList(item, index) {
this.pickShowList.splice(index, 1)
let tempArr = []
this.pickShowList.forEach((item) => {
tempArr.push(item.buttonType)
})
this.pickList = tempArr
},
//
async saveHandle() {
//
if (this.showFiledFlag) {
//
let keyArr = this.dist[this.thisKey]
let params = {
mdmId: this.$route.query.id,
viewType: keyArr[2]
}
params[keyArr[1]] = this.pickShowList
this.openLoading("submit")
const res = await authApi('mdmModuleService', '', 'saveOrUpdateMdmViewField', '', params)
this.$vmNews('保存成功!', 'success')
this.$emit('saveSuccessEmit')
} else {
//
let params = {
mdmId: this.$route.query.id,
dbButtonFiled: this.pickShowList
}
this.openLoading("submit")
const res = await authApi('mdmModuleService', '', 'saveOrUpdateMdmViewButton', '', params)
this.$vmNews('保存成功!', 'success')
this.$emit('saveSuccessEmit')
}
}
},
mounted() {
},
components: {
draggable
}
}
</script>
<style scoped lang="scss">
.settingChunk {
display: flex;
height: 80vh;
.leftAll {
flex: 1;
padding: 0 20px;
border-right: 1px solid #EBEBEB;
.search {
width: 100%;
}
.checkBoxList {
height: 70vh;
overflow: auto;
}
.checkBoxItem {
margin: 20px 0 16px;
}
}
.rightAdd {
flex: 1;
padding: 0 20px;
.pickTitle {
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 14px;
color: #333333;
line-height: 20px;
text-align: left;
font-style: normal;
}
.showCheckBoxList {
height: 70vh;
overflow: auto;
}
.showCheckBoxItem {
display: flex;
justify-content: space-between;
align-items: center;
margin: 10px 0 10px;
padding: 15px 10px;
background: #F8F8F8;
border-radius: 4px;
cursor: move; /* 将指针换成拖动样式 */
user-select: none; /* 禁止选择文字 */
.btn {
color: grey;
cursor: pointer;
}
}
}
}
</style>