middleground_code_v2/src/views/masterDataOptions/displayInfo/index.vue

537 lines
14 KiB
Vue
Raw Normal View History

2024-03-26 11:18:19 +08:00
<template>
<div class="displayInfo">
<div class="btn">
<div class="chunk">
<el-button
icon="el-icon-back"
@click="
2024-03-26 11:18:19 +08:00
$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"
2024-03-26 11:18:19 +08:00
>保存
</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="'right'"
labelWidth="100px"
@onSubmit="onSubmit"
>
2024-03-26 11:18:19 +08:00
</baseNewForm>
</div>
2024-06-18 09:59:55 +08:00
<div class="main">
<div class="content">
<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>
2024-06-18 09:59:55 +08:00
<div class="showCheckBoxList">
<div class="showCheckBoxItem" v-for="(item,index) in dbQueryFiled" :key="index">
<div class="name">{{ item.viewName }}</div>
</div>
</div>
</div>
2024-06-18 09:59:55 +08:00
<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>
2024-06-18 09:59:55 +08:00
<div class="showCheckBoxList">
<div class="showCheckBoxItem" v-for="(item,index) in dbListFiled" :key="index">
<div class="name">{{ item.viewName }}</div>
</div>
</div>
2024-03-26 11:18:19 +08:00
</div>
2024-06-18 09:59:55 +08:00
<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>
2024-06-18 09:59:55 +08:00
<div class="showCheckBoxList">
<div class="showCheckBoxItem" v-for="(item,index) in dbAddFiled" :key="index">
<div class="name">{{ item.viewName }}</div>
</div>
</div>
</div>
2024-06-18 09:59:55 +08:00
<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>
2024-06-18 09:59:55 +08:00
<div class="showCheckBoxList">
<div class="showCheckBoxItem" v-for="(item,index) in dbEditFiled" :key="index">
<div class="name">{{ item.viewName }}</div>
</div>
</div>
</div>
2024-06-18 09:59:55 +08:00
<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>
2024-06-18 09:59:55 +08:00
<div class="showCheckBoxList">
<div class="showCheckBoxItem" v-for="(item,index) in dbShowFiled" :key="index">
<div class="name">{{ item.viewName }}</div>
</div>
</div>
</div>
2024-06-18 09:59:55 +08:00
<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>
2024-06-18 09:59:55 +08:00
<div class="showCheckBoxList">
<div class="showCheckBoxItem" v-for="(item,index) in btnShowList" :key="index">
<div class="name">{{ item.name }}</div>
</div>
</div>
2024-03-26 11:18:19 +08:00
</div>
</div>
</div>
2024-06-18 09:59:55 +08:00
2024-03-26 11:18:19 +08:00
</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>
2024-03-26 11:18:19 +08:00
</div>
</template>
<script>
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'
2024-03-26 11:18:19 +08:00
export default {
name: 'index.vue',
2024-03-26 11:18:19 +08:00
data() {
return {
formRow: [
{
elCol: [
{
type: 'select',
title: '显示字段',
id: 'viewFiled',
row: 6,
2024-03-26 11:18:19 +08:00
disabled: false,
required: true,
fontSize: 16,
options: []
2024-03-26 11:18:19 +08:00
},
{
type: 'select',
title: '上级id字段',
id: 'upIdFiled',
row: 6,
2024-03-26 11:18:19 +08:00
disabled: false,
required: true,
fontSize: 16,
options: []
}
2024-03-26 11:18:19 +08:00
]
}
],
ruleForm: {},
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]
}//字典
2024-03-26 11:18:19 +08:00
}
},
methods: {
async initSelect() {
const res = await getApiModuleApi({
tl: 'mdmModuleService',
as: '',
dj: 'queryMdmMainDBField'
2024-03-26 11:18:19 +08:00
}, {
mdmId: this.$route.query.id
})
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
2024-03-26 11:18:19 +08:00
})
this.formRow[0].elCol[0].options.push({
label: item.chName,
id: item.enName
2024-03-26 11:18:19 +08:00
})
})
}
},
//设置保存成功
saveSuccessEmit() {
this.mainTableDialogShow = false
this.getAllField()
2024-03-26 11:18:19 +08:00
},
//验证通过
async onSubmit() {
if (this.ruleForm.id) {
this.openLoading('submit')
const res = await authApi('mdmModuleService', '', 'updateMdmView', '', {
...this.ruleForm,
mdmId: this.$route.query.id,
viewName: this.displayType
})
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()
2024-03-26 11:18:19 +08:00
}
2024-03-26 11:18:19 +08:00
},
//获取类型
async getRuleForm() {
this.openLoading('detail')
this.ruleForm = {}
const res = await authApi('mdmModuleService', '', 'queryMdmView', '', {
mdmId: this.$route.query.id
2024-03-26 11:18:19 +08:00
})
2024-06-18 09:59:55 +08:00
console.log(res.attribute, 'res.attribute', res)
this.ruleForm = res.attribute ? res.attribute : {}
this.displayType = this.ruleForm.viewName ? this.ruleForm.viewName : '1'
2024-03-26 11:18:19 +08:00
},
//保存
saveHandle() {
if (this.displayType === '1') {
this.$refs.optionForm.submitForm()
} else {
this.onSubmit()
2024-03-26 11:18:19 +08:00
}
},
//点击设置
settingHandle(key) {
this.activeTitle = key
this.mainTableDialogShow = true
this.$nextTick(() => {
this.$refs.settingChunk.getAllBtn(key)
2024-03-26 11:18:19 +08:00
})
},
//右弹窗点击保存
mainTableSaveHandle() {
this.$refs.settingChunk.saveHandle()
2024-03-26 11:18:19 +08:00
},
//获取所有字段
async getAllField() {
//字段相关
const res = await authApi('mdmModuleService', '', 'queryMdmViewField', '', {
id: this.$route.query.id
2024-03-26 11:18:19 +08:00
})
2024-06-18 09:59:55 +08:00
console.log(res, 'res')
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
2024-03-26 11:18:19 +08:00
})
res2.attribute.forEach(item => {
item.name = this.allFiledList[item.buttonType - 1].buttonName
2024-03-26 11:18:19 +08:00
})
this.btnShowList = res2.attribute
2024-03-26 11:18:19 +08:00
}
},
components: {
baseRightDialog,
baseNewForm,
settingChunk
2024-03-26 11:18:19 +08:00
},
created() {
//获取显示类型和显示字段
this.getRuleForm()
//获取下啦
2024-03-26 11:18:19 +08:00
this.initSelect()
//获取所有显示字段
this.getAllField()
this.$emit('flashActive', 2)
2024-03-26 11:18:19 +08:00
}
}
</script>
<style scoped lang="scss">
::v-deep .el-form-item__content {
margin: 0 !important;
}
2024-03-26 11:18:19 +08:00
::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;
}
2024-03-26 11:18:19 +08:00
::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;
}
2024-06-18 09:59:55 +08:00
.main{
overflow: auto;
2024-03-26 11:18:19 +08:00
> .content {
2024-06-18 09:59:55 +08:00
margin-top: 1vh;
width: 2100px;
.showItem {
2024-06-18 09:59:55 +08:00
display: inline-block;
width: 340px;
margin-left: 8px;
2024-06-18 09:59:55 +08:00
height: 68vh;
background: #FFFFFF;
border-radius: 8px;
border: 1px solid #EBEBEB;
padding: 14px 20px;
position: relative;
.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%;
}
}
2024-03-26 11:18:19 +08:00
.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;
}
2024-03-26 11:18:19 +08:00
}
}
}
}
2024-06-18 09:59:55 +08:00
}
2024-03-26 11:18:19 +08:00
}
</style>