初始化动态配置

20231126-yw
yuanwei 1 year ago
parent 2c1cf912eb
commit 9cb09bd672

@ -0,0 +1,41 @@
import axios from "@/utils/request";
export function list(query) {
return axios({
url: "/system/custom/config/list",
method: "get",
params: query
});
}
// 保存
export function saveCustomConfig(data, formName, method = "post") {
let url =
formName !== "edit"
? "/system/custom/config/save"
: "/system/custom/config/edit";
return axios({
url: url,
method: method,
data: data
});
}
// 删除
export function devCustomConfig(data) {
return axios({
url: "/system/custom/config/delete",
method: "post",
data: data
});
}
export function getConfigs(query) {
return axios({
url: "/system/custom/config/getConfigs",
method: "post",
data: query
});
}

@ -0,0 +1,32 @@
import axios from "@/utils/request";
export function list(query) {
return axios({
url: "/system/custom/configDetail/list",
method: "get",
params: query
});
}
// 保存
export function saveCustomConfig(data, formName, method = "post") {
let url =
formName !== "edit"
? "/system/custom/configDetail/save"
: "/system/custom/configDetail/edit";
return axios({
url: url,
method: method,
data: data
});
}
// 删除
export function devCustomConfig(data) {
return axios({
url: "/system/custom/configDetail/delete",
method: "post",
data: data
});
}

@ -0,0 +1,120 @@
import {getConfigs} from "@/api/system/sysCustomConfig";
import {Message} from "element-ui";
function getColer(item,value){
const colorRule = item.colorRule;
if(colorRule && colorRule.indexOf(",") != -1){
var arr = colorRule.split("|");
var reColor = "";
arr.some(s => {
var arrTemp = s.split(",");
const type = arrTemp[0]
const valueT = arrTemp[1]
const color = arrTemp[2]
if(type == "=" && value == valueT){
reColor = color;
}else if(type == ">=" && value >= valueT){
reColor = color;
}else if(type == ">" && value > valueT){
reColor = color;
}else if(type == "<" && value < valueT){
reColor = color;
}else if(type == "<=" && value <= valueT){
reColor = color;
} else if(type == "0"){
reColor = color;
}
})
return reColor;
}else{
return colorRule;
}
}
export async function getHead(businessType,type){
try {
var subData = {};
subData.businessType = businessType;
subData.type = type;
const re = await getConfigs(subData);
if(re.code != 20000){
Message.error("获取配置失败");
}
return re;
} catch (error) {
console.error(error);
}
}
export function executeFuc(_this,row,number,type,clickFuc,value){
if("1" == type){
//按钮事件
return callModelFun(_this,clickFuc,row);
}else if("3" == type){
//按钮是否禁用事件
if(clickFuc){
return callModelFun(_this,clickFuc,row);
}else{
return false;
}
}else if("4" == type){
//颜色方法
return getColer(clickFuc,value);
}else if("5" == type){
//查询input方法
if(clickFuc){
return callModelFun(_this,clickFuc,row);
}else{
return false;
}
}else if("6" == type){
//查询input方法
if(clickFuc){
return callModelFun(_this,clickFuc,row);
}else{
return false;
}
}else if("2" == type){
if(number.clickFuc){
//表单事件
return callModelFun(_this,number.clickFuc,row);
}else{
return true;
}
}else if(number != null && number >= 0){
//复选框事件
var checkSelectableFuc = ""
_this.tableObj.tableList.forEach(obj => {
if(obj.columnType == "selection"){
checkSelectableFuc = obj.clickFuc;
}
})
//
if(checkSelectableFuc){
return callModelFun(_this,checkSelectableFuc,row);
}else{
return true;
}
}else{
console.log(row);
//表单点击事件
if(_this.tableObj.handleChangeFuc){
return callModelFun(_this,_this.tableObj.handleChangeFuc,row);
}
return true;
}
}
/**
* 根据方法名称调用方法
*/
function callModelFun(_this,funcName,row) {
let methods = _this.$options.methods;
// 解释说明一下, this需要传入目标方法, 否则,在目标方法中修改data中的值, 将不会重新渲染dom, 跟v-if结合使用的过程中需要注意
return methods[funcName](_this,row);
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,599 @@
<template>
<!-- 系统管理 组织架构 仓库信息页面 -->
<div>
<el-card>
<el-form :inline="true" :model="query" class="query-form" size="mini">
<el-form-item class="query-form-item" label="列名:">
<el-input v-model="query.columnName" clearable placeholder="列名"></el-input>
</el-form-item>
<el-form-item>
<el-button-group style="margin-left: 10px; display: flex">
<el-button type="primary" icon="el-icon-refresh" @click="onReset"></el-button>
<el-button type="primary" icon="el-icon-search" @click="onSubmit"></el-button>
<el-button type="primary" icon="el-icon-plus" @click="handleSubForm({}, 'add')">新增</el-button>
</el-button-group>
</el-form-item>
</el-form>
<el-table :data="list" border highlight-current-row row-key="id"
style="width: 100%">
<el-table-column label="序号" type="index" ref="dataForm"></el-table-column>
<el-table-column prop="columnName" label="列名"> </el-table-column>
<el-table-column prop="isShow" label="是否展示">
<template slot-scope="scope">
<span>{{ isShowMap[scope.row.isShow] }}</span>
</template>
</el-table-column>
<el-table-column prop="columnDesc" label="列描述"></el-table-column>
<el-table-column prop="columnType" label="列类型">
<template slot-scope="scope">
<span>{{ columnTypeMap[scope.row.columnType] }}</span>
</template>
</el-table-column>
<el-table-column prop="number" label="排序"></el-table-column>
<el-table-column prop="width" label="宽度"></el-table-column>
<el-table-column label="字段是否可以排序" prop="sort">
<template slot-scope="scope">
<span>{{ upUerMap[scope.row.sort] }}</span>
</template>
</el-table-column>
<el-table-column label="是否缩略" prop="tooltip">
<template slot-scope="scope">
<span>{{ upUerMap[scope.row.tooltip] }}</span>
</template>
</el-table-column>
<el-table-column prop="lableRule" show-overflow-tooltip="true" label="字典替换规则"></el-table-column>
<el-table-column prop="colorRule" show-overflow-tooltip="true" label="颜色规则"></el-table-column>
<el-table-column prop="buttonRule" show-overflow-tooltip="true" label="按钮规则"></el-table-column>
<el-table-column prop="clickFuc" label="点击事件"></el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
type="text"
@click.native="handleSubForm(scope.row, 'edit')"
>编辑
</el-button>
<el-button type="text" @click.native="handleDel(scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<!--仓库编辑对话框-->
<el-dialog :title="formMap[formName]" :close-on-click-modal="false"
:close-on-press-escape="false" :visible.sync="formVisible" :before-close="hideForm" width="70%" top="5vh">
<el-form :model="subData" ref="dataForm" :rules="formRules" label-width="130px">
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="列名" prop="columnName" class="query-form-item">
<el-input v-model="subData.columnName" style="width: 80%" placeholder="请输入业列名"
auto-complete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="是否展示" prop="columnType">
<el-select v-model="subData.isShow" placeholder="请选择是否展示" style="width: 80%">
<el-option label="显示" value="1" />
<el-option label="隐藏" value="2" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="列描述" prop="columnDesc" class="query-form-item">
<el-input v-model="subData.columnDesc" style="width: 80%" placeholder="请输入列描述"
auto-complete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="列类型" prop="columnType">
<el-select v-model="subData.columnType" placeholder="请选择列类型" style="width: 80%">
<el-option label="序号" value="id" />
<el-option label="复选框" value="selection" />
<el-option label="单选框" value="radio" />
<el-option label="字典" value="laber" />
<el-option label="el-tag" value="eltag" />
<el-option label="按钮" value="button" />
<el-option label="默认" value="text" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="排序" prop="number" class="query-form-item">
<el-input v-model="subData.number" style="width: 80%" placeholder="请输入排序"
auto-complete="off"></el-input>
<div style="color: red">数字越大字段排在越前面</div>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="宽度" prop="width" class="query-form-item">
<el-input v-model="subData.width" style="width: 80%" placeholder="请输入宽度"
auto-complete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item
label="字段是否可以排序"
prop="sort"
class="query-form-item"
>
<el-radio-group v-model="subData.sort">
<el-radio :label="true"></el-radio>
<el-radio :label="false"></el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item
label="是否缩略"
prop="tooltip"
class="query-form-item"
>
<el-radio-group v-model="subData.tooltip">
<el-radio :label="true"></el-radio>
<el-radio :label="false"></el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="20" class="el-col">
<el-form-item label="字典替换规则" class="query-form-item">
<div style="display:flex" :key="i" v-for="(item, i) in conditionForm.lableList">
<el-form-item label="值" :prop="'lableList.' + i + '.value'" >
<el-input type="input" v-model="item.value" placeholder="请输入值"></el-input>
</el-form-item>
<el-form-item label="中文名" :prop="'lableList.' + i + '.name'">
<el-input type="input" v-model="item.name" placeholder="请输入中文名"></el-input>
</el-form-item>
<i v-if="i === 0" @click="addLableList" style="font-size:20px;color:#25c4fe;margin:8px 0 0 10px;" class="el-icon-circle-plus"></i>
<i @click="deleteLableList(i)" style="font-size:20px;color:#25c4fe;margin:8px 0 0 10px;" class="el-icon-remove"></i>
</div>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="20" class="el-col">
<el-form-item label="颜色规则" class="query-form-item">
<div style="display:flex" :key="i" v-for="(item, i) in conditionForm.colorList">
<el-form-item label="判断条件" :prop="'colorList.' + i + '.type'">
<el-select clearable v-model="item.type" placeholder="请选择判断条件">
<el-option label="默认" value="0" />
<el-option label="大于" value=">" />
<el-option label="大于等于" value=">=" />
<el-option label="小于" value="<" />
<el-option label="小于等于" value="<=" />
<el-option label="等于" value="=" />
</el-select>
</el-form-item>
<el-form-item label="值" :prop="'colorList.' + i + '.value'" >
<el-input type="input" v-model="item.value" placeholder="请输入值"></el-input>
</el-form-item>
<el-form-item label="颜色" :prop="'colorList.' + i + '.color'">
<el-input type="input" v-model="item.color" placeholder="请输入颜色"></el-input>
</el-form-item>
<i v-if="i === 0" @click="addColorList" style="font-size:20px;color:#25c4fe;margin:8px 0 0 10px;" class="el-icon-circle-plus"></i>
<i @click="deleteColorList(i)" style="font-size:20px;color:#25c4fe;margin:8px 0 0 10px;" class="el-icon-remove"></i>
</div>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="20" class="el-col">
<el-form-item label="按钮规则" class="query-form-item">
<div style="display:flex" :key="i" v-for="(item, i) in conditionForm.buttonList">
<el-form-item label-width="50px" label="类型" :prop="'buttonList.' + i + '.type'">
<el-select clearable style="width: 120px;" v-model="item.type" placeholder="请选择类型">
<el-option label="文本" value="text" />
</el-select>
</el-form-item>
<el-form-item label-width="50px" label="大小" :prop="'buttonList.' + i + '.size'" >
<el-select clearable style="width: 120px;" v-model="item.size" placeholder="请选择大小">
<el-option label="medium" value="medium" />
<el-option label="mini" value="mini" />
<el-option label="small" value="small" />
</el-select>
</el-form-item>
<el-form-item label-width="50px" label="名称" :prop="'buttonList.' + i + '.name'">
<el-input type="input" style="width: 120px;" v-model="item.name" placeholder="请输入名称"></el-input>
</el-form-item>
<el-form-item label-width="50px" label="样式" :prop="'buttonList.' + i + '.style'">
<el-input type="input" style="width: 120px;" v-model="item.style" placeholder="请输入样式"></el-input>
</el-form-item>
<el-form-item label-width="70px" label="禁用判断方法" :prop="'buttonList.' + i + '.disabledFuc'">
<el-input type="input" style="width: 120px;" v-model="item.disabledFuc" placeholder="请输入禁用判断方法"></el-input>
</el-form-item>
<el-form-item label-width="70px" label="点击方法" :prop="'buttonList.' + i + '.clickFuc'">
<el-input type="input" style="width: 120px;" v-model="item.clickFuc" placeholder="请输入点击方法"></el-input>
</el-form-item>
<i v-if="i === 0" @click="addButtonList" style="font-size:20px;color:#25c4fe;margin:8px 0 0 10px;" class="el-icon-circle-plus"></i>
<i @click="deleteButtonList(i)" style="font-size:20px;color:#25c4fe;margin:8px 0 0 10px;" class="el-icon-remove"></i>
</div>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="点击事件" prop="clickFuc" class="query-form-item">
<el-input v-model="subData.clickFuc" style="width: 80%" placeholder="请输入点击事件"
auto-complete="off"></el-input>
<div style="color: red">目前只支持复选框配置</div>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click.native="hideForm">取消</el-button>
<el-button type="primary" @click.native="forSubmit()">提交
</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
list,
saveCustomConfig,
devCustomConfig
} from "@/api/system/sysCustomConfigDetail";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import Treeselect from "@riophae/vue-treeselect";
import {
isBlank
} from "@/utils/strUtil";
export default {
name: "info",
props: {
info: {
type: Object,
required: true
},
type: {
type: String,
required: true
}
},
data() {
return {
//----------------------------------
query: {
columnName: null,
configId: this.info.configId,
type: this.type,
},
loading: true,
list: [],
formName: null,
formMap: {
add: "配置界面详细-新增",
edit: "配置界面详细--编辑",
},
conditionForm: {
lableList: [{
name: '',
value: ''
}],
colorList: [{
type: '',
value: '',
color: ''
}],
buttonList: [{
type: '',
size: '',
style: '',
name: '',
clickFuc: ''
}]
},
formVisible: false,
subData: {},
formRules: {
columnName: [{ required: true, message: "请输入列名", trigger: "blur" }],
columnDesc: [
{ required: true, message: "请输入列名", trigger: "blur" },
],
columnType: [
{ required: true, message: "请选择类型", trigger: "blur" },
],
},
isExpandAll: true,
total: 0,
typeMap: {
1: "列表",
2: "表单",
},
upUerMap:{
true: "是",
false: "否",
},
columnTypeMap: {
"id": "序号",
"selection": "复选框",
"radio": "单选框",
"laber": "字典",
"eltag":"el-tag",
"button":"按钮",
"text":"默认",
},
isShowMap: {
"1": "显示",
"2": "隐藏",
},
};
},
watch: {
info: function () {
this.getList();
},
},
methods: {
//---------------------------------
/* 重置按钮 点击事件 */
onReset() {
this.$router.push({
path: "",
});
this.query = {
configId: this.info.configId,
type: this.type,
columnName: "",
};
this.getList();
},
/* 查询按钮点击事件 */
onSubmit() {
this.getList();
},
getList() {
if (isBlank(this.info.configId)) {
return;
}
this.query.configId=this.info.configId;
this.query.type=this.type;
this.loading = true;
this.list = [];
list(this.query)
.then((response) => {
this.loading = false;
this.list = response.data.list || [];
this.total = response.data.total || 0;
})
.catch(() => {
this.loading = false;
this.total = 0;
this.list = [];
});
},
/* 新增 编辑点击事件 */
handleSubForm(data, formName) {
if (isBlank(this.info.configId)) {
this.$message.warning("请先选择配置!");
return;
}
this.formName = formName;
this.subData = JSON.parse(JSON.stringify(data));
this.subData.configId = this.info.configId,
this.subData.type = this.type;
this.formVisible = true;
if("edit" == formName){
const colorRule = this.subData.colorRule;
var colorList = [{type: '', value: '', color: ''}]
if(colorRule){
var arr = colorRule.split("|");
var colorList = []
arr.forEach(obj =>{
var arrTemp = obj.split(",");
colorList.push({
type: arrTemp[0],
value: arrTemp[1],
color: arrTemp[2],
})
})
}
this.conditionForm.colorList = colorList;
const lableRule = this.subData.lableRule;
var lableList = [{name: '', value: ''}]
if(lableRule){
var jsonObj = JSON.parse(lableRule);
var lableList = []
for(var index in jsonObj){
lableList.push({
name: jsonObj[index],
value: index,
})
}
}
this.conditionForm.lableList = lableList;
const buttonRule = this.subData.buttonRule;
var buttonList = [{type: '', size: '', style: '', name: '', clickFuc: '', disabledFuc: ''}]
if(buttonRule){
var jsonArr = JSON.parse(buttonRule);
var buttonList = []
jsonArr.forEach(obj =>{
buttonList.push({
type: obj.type,
size: obj.size,
style: obj.style,
name: obj.name,
clickFuc: obj.clickFuc,
disabledFuc: obj.disabledFuc
})
})
}
this.conditionForm.buttonList = buttonList;
}
},
/* 删除按钮点击事件 */
handleDel(row) {
if (row.id) {
this.$confirm("确认删除该配置吗?", "提示", {
type: "warning",
})
.then(() => {
this.deleteLoading = true;
let para = {
id: row.id
};
devCustomConfig(para)
.then((response) => {
this.deleteLoading = false;
if (response.code !== 20000) {
this.$message.error(response.message);
return false;
}
this.getList();
this.$message.success("删除成功");
})
.catch(() => {
this.deleteLoading = false;
});
})
.catch(() => {
this.$message.info("取消删除");
});
}
},
hideForm() {
// ---
this.formVisible = false;
this.resetForm();
return true;
},
//
resetForm() {
if (this.$refs["dataForm"]) {
//
this.$refs["dataForm"].clearValidate();
//
this.$refs["dataForm"].resetFields();
this.getList();
}
},
forSubmit() {
var colorRule = "";
this.conditionForm.colorList.forEach(obj => {
if(obj.type != "" && obj.value != "" && obj.color != "" ){
colorRule += obj.type+","+obj.value+","+obj.color+"|"
}
})
this.subData.colorRule = "";
if(colorRule != ""){
this.subData.colorRule = colorRule.substring(0, colorRule.length-1);
}
var lableRule = {};
this.conditionForm.lableList.forEach(obj => {
if(obj.name != "" && obj.value != ""){
lableRule[`${obj.value}`] = obj.name;
}
})
this.subData.lableRule = "";
if(JSON.stringify(lableRule) != "{}"){
this.subData.lableRule = JSON.stringify(lableRule);
}
var buttonRule = [];
this.conditionForm.buttonList.forEach(obj => {
if(obj.type != "" && obj.name != "" && obj.clickFuc != ""){
buttonRule.push({
type: obj.type,
size: obj.size,
style: obj.style,
name: obj.name,
clickFuc: obj.clickFuc,
disabledFuc: obj.disabledFuc
})
}
})
this.subData.buttonRule = "";
if(buttonRule.length > 0){
this.subData.buttonRule = JSON.stringify(buttonRule);
}
// ---
this.$refs["dataForm"].validate((valid) => {
if (valid) {
saveCustomConfig(this.subData, this.formName)
.then((response) => {
this.formVisible = false;
if (response.code == 20000) {
this.getList();
} else {
this.$message.error(response.message);
}
})
.catch(() => {
this.formVisible = false;
});
}
});
},
//
addLableList () {
this.conditionForm.lableList.push({
name: '',
value: ''
})
},
//
deleteLableList (index) {
this.conditionForm.lableList.splice(index, 1)
},
//
addColorList () {
this.conditionForm.colorList.push({
type: '',
value: '',
color: ''
})
},
//
deleteColorList (index) {
this.conditionForm.colorList.splice(index, 1)
},
//
addButtonList () {
this.conditionForm.buttonList.push({
type: '',
size: '',
style: '',
name: '',
clickFuc: ''
})
},
//
deleteButtonList (index) {
this.conditionForm.buttonList.splice(index, 1)
},
},
};
</script>

@ -0,0 +1,478 @@
<template>
<!-- 系统管理 组织架构 仓库信息页面 -->
<div>
<el-card>
<el-form :inline="true" :model="query" class="query-form" size="mini">
<el-form-item class="query-form-item" label="列名:">
<el-input v-model="query.columnName" clearable placeholder="列名"></el-input>
</el-form-item>
<el-form-item>
<el-button-group style="margin-left: 10px; display: flex">
<el-button type="primary" icon="el-icon-refresh" @click="onReset"></el-button>
<el-button type="primary" icon="el-icon-search" @click="onSubmit"></el-button>
<el-button type="primary" icon="el-icon-plus" @click="handleSubForm({}, 'add')">新增</el-button>
</el-button-group>
</el-form-item>
</el-form>
<el-table :data="list" border highlight-current-row row-key="id"
style="width: 100%">
<el-table-column label="序号" type="index" ref="dataForm"></el-table-column>
<el-table-column prop="columnName" label="列名"> </el-table-column>
<el-table-column prop="isShow" label="是否展示">
<template slot-scope="scope">
<span>{{ isShowMap[scope.row.isShow] }}</span>
</template>
</el-table-column>
<el-table-column prop="columnDesc" label="列描述"></el-table-column>
<el-table-column prop="columnType" label="列类型">
<template slot-scope="scope">
<span>{{ columnTypeMap[scope.row.columnType] }}</span>
</template>
</el-table-column>
<el-table-column prop="lineNumber" label="行号"></el-table-column>
<el-table-column prop="number" label="排序"></el-table-column>
<el-table-column prop="width" label="col-span"></el-table-column>
<el-table-column prop="size" label="组件尺寸"></el-table-column>
<el-table-column prop="style" label="样式"></el-table-column>
<el-table-column label="是否禁用" prop="disabled">
<template slot-scope="scope">
<span>{{ upUerMap[scope.row.disabled] }}</span>
</template>
</el-table-column>
<el-table-column prop="lableRule" show-overflow-tooltip="true" label="字典替换规则"></el-table-column>
<el-table-column prop="checkRules" show-overflow-tooltip="true" label="验证规则"></el-table-column>
<el-table-column prop="inputType" label="input类型"></el-table-column>
<el-table-column prop="clickFuc" label="内容改变事件"></el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
type="text"
@click.native="handleSubForm(scope.row, 'edit')"
>编辑
</el-button>
<el-button type="text" @click.native="handleDel(scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<!--仓库编辑对话框-->
<el-dialog :title="formMap[formName]" :close-on-click-modal="false"
:close-on-press-escape="false" :visible.sync="formVisible" :before-close="hideForm" width="60%" top="5vh">
<el-form :model="subData" ref="dataForm" :rules="formRules" label-width="130px">
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="列名" prop="columnName" class="query-form-item">
<el-input v-model="subData.columnName" style="width: 80%" placeholder="请输入业列名"
auto-complete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="是否展示" prop="columnType">
<el-select v-model="subData.isShow" placeholder="请选择是否展示" style="width: 80%">
<el-option label="显示" value="1" />
<el-option label="隐藏" value="2" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="列描述" prop="columnDesc" class="query-form-item">
<el-input v-model="subData.columnDesc" style="width: 80%" placeholder="请输入列描述"
auto-complete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="列类型" prop="columnType">
<el-select v-model="subData.columnType" placeholder="请选择列类型" style="width: 80%">
<el-option label="表单" value="input" />
<el-option label="下拉框" value="select" />
<el-option label="单选框" value="radio" />
<el-option label="下拉框自定义" value="selectCustom" />
<el-option label="树状自定以" value="treeCustom" />
<el-option label="时间选择" value="date" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="行号" prop="lineNumber" class="query-form-item">
<el-input v-model="subData.lineNumber" style="width: 80%" placeholder="请输入行号"
auto-complete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="排序" prop="number" class="query-form-item">
<el-input v-model="subData.number" style="width: 80%" placeholder="请输入排序"
auto-complete="off"></el-input>
<div style="color: red">数字越大字段排在越前面</div>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="col-span" prop="width" class="query-form-item">
<el-input v-model="subData.width" style="width: 80%" placeholder="请输入col-span"
auto-complete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="组件尺寸" prop="size">
<el-select v-model="subData.size" placeholder="请选择组件尺寸" style="width: 80%">
<el-option label="medium" value="medium" />
<el-option label="small" value="small" />
<el-option label="mini" value="mini" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="样式" prop="style" class="query-form-item">
<el-input v-model="subData.style" style="width: 80%" placeholder="请输入样式"
auto-complete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="input类型" prop="size">
<el-select v-model="subData.size" placeholder="请选择input类型" style="width: 80%">
<el-option label="text" value="text" />
<el-option label="number" value="number" />
<el-option label="textarea" value="textarea" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="验证规则" prop="checkRules">
<el-input v-model="subData.checkRules" type="textarea" style="width: 80%" placeholder="请输入验证规则"
auto-complete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item
label="是否禁用"
prop="disabled"
class="query-form-item"
>
<el-radio-group v-model="subData.disabled">
<el-radio :label="true"></el-radio>
<el-radio :label="false"></el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="内容改变事件" prop="clickFuc" class="query-form-item">
<el-input v-model="subData.clickFuc" style="width: 80%" placeholder="请输入内容改变事件"
auto-complete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="20" class="el-col">
<el-form-item label="字典替换规则" class="query-form-item">
<div style="display:flex" :key="i" v-for="(item, i) in conditionForm.lableList">
<el-form-item label="值" :prop="'lableList.' + i + '.value'" >
<el-input type="input" v-model="item.value" placeholder="请输入值"></el-input>
</el-form-item>
<el-form-item label="中文名" :prop="'lableList.' + i + '.name'">
<el-input type="input" v-model="item.name" placeholder="请输入中文名"></el-input>
</el-form-item>
<i v-if="i === 0" @click="addLableList" style="font-size:20px;color:#25c4fe;margin:8px 0 0 10px;" class="el-icon-circle-plus"></i>
<i @click="deleteLableList(i)" style="font-size:20px;color:#25c4fe;margin:8px 0 0 10px;" class="el-icon-remove"></i>
</div>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click.native="hideForm">取消</el-button>
<el-button type="primary" @click.native="forSubmit()">提交
</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
list,
saveCustomConfig,
devCustomConfig
} from "@/api/system/sysCustomConfigDetail";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import Treeselect from "@riophae/vue-treeselect";
import {
isBlank
} from "@/utils/strUtil";
export default {
name: "info",
props: {
info: {
type: Object,
required: true
},
type: {
type: String,
required: true
}
},
data() {
return {
//----------------------------------
query: {
columnName: null,
configId: this.info.configId,
type: this.type,
},
loading: true,
list: [],
formName: null,
formMap: {
add: "配置界面详细-新增",
edit: "配置界面详细--编辑",
},
conditionForm: {
lableList: [{
name: '',
value: ''
}],
colorList: [{
type: '',
value: '',
color: ''
}],
buttonList: [{
type: '',
size: '',
style: '',
name: '',
clickFuc: ''
}]
},
formVisible: false,
subData: {},
formRules: {
columnName: [{ required: true, message: "请输入列名", trigger: "blur" }],
columnDesc: [
{ required: true, message: "请输入列名", trigger: "blur" },
],
columnType: [
{ required: true, message: "请选择类型", trigger: "blur" },
],
},
isExpandAll: true,
total: 0,
typeMap: {
1: "列表",
2: "表单",
},
upUerMap:{
true: "是",
false: "否",
},
isShowMap: {
"1": "显示",
"2": "隐藏",
},
columnTypeMap: {
"input": "输入框",
"radio": "单选框",
"select": "下拉框",
"selectCustom": "下拉框自定义",
"date":"时间选择",
"treeCustom":"树状自定义",
},
};
},
watch: {
info: function () {
this.getList();
},
},
methods: {
//---------------------------------
/* 重置按钮 点击事件 */
onReset() {
this.$router.push({
path: "",
});
this.query = {
configId: this.info.configId,
type: this.type,
columnName: "",
};
this.getList();
},
/* 查询按钮点击事件 */
onSubmit() {
this.getList();
},
getList() {
if (isBlank(this.info.configId)) {
return;
}
this.query.configId=this.info.configId;
this.query.type=this.type;
this.loading = true;
this.list = [];
list(this.query)
.then((response) => {
this.loading = false;
this.list = response.data.list || [];
this.total = response.data.total || 0;
})
.catch(() => {
this.loading = false;
this.total = 0;
this.list = [];
});
},
/* 新增 编辑点击事件 */
handleSubForm(data, formName) {
if (isBlank(this.info.configId)) {
this.$message.warning("请先选择配置!");
return;
}
this.formName = formName;
this.subData = JSON.parse(JSON.stringify(data));
this.subData.configId = this.info.configId;
this.subData.type = this.type;
this.formVisible = true;
if("edit" == formName){
}
},
/* 删除按钮点击事件 */
handleDel(row) {
if (row.id) {
this.$confirm("确认删除该配置吗?", "提示", {
type: "warning",
})
.then(() => {
this.deleteLoading = true;
let para = {
id: row.id
};
devCustomConfig(para)
.then((response) => {
this.deleteLoading = false;
if (response.code !== 20000) {
this.$message.error(response.message);
return false;
}
this.getList();
this.$message.success("删除成功");
})
.catch(() => {
this.deleteLoading = false;
});
})
.catch(() => {
this.$message.info("取消删除");
});
}
},
hideForm() {
// ---
this.formVisible = false;
this.resetForm();
return true;
},
//
resetForm() {
if (this.$refs["dataForm"]) {
//
this.$refs["dataForm"].clearValidate();
//
this.$refs["dataForm"].resetFields();
this.getList();
}
},
forSubmit() {
// ---
this.$refs["dataForm"].validate((valid) => {
if (valid) {
saveCustomConfig(this.subData, this.formName)
.then((response) => {
this.formVisible = false;
if (response.code == 20000) {
this.getList();
} else {
this.$message.error(response.message);
}
})
.catch(() => {
this.formVisible = false;
});
}
});
},
//
addLableList () {
this.conditionForm.lableList.push({
name: '',
value: ''
})
},
//
deleteLableList (index) {
this.conditionForm.lableList.splice(index, 1)
},
//
addColorList () {
this.conditionForm.colorList.push({
type: '',
value: '',
color: ''
})
},
//
deleteColorList (index) {
this.conditionForm.colorList.splice(index, 1)
},
//
addButtonList () {
this.conditionForm.buttonList.push({
type: '',
size: '',
style: '',
name: '',
clickFuc: ''
})
},
//
deleteButtonList (index) {
this.conditionForm.buttonList.splice(index, 1)
},
},
};
</script>

@ -0,0 +1,436 @@
<template>
<!-- 系统管理 组织架构 仓库信息页面 -->
<div>
<el-card>
<el-form :inline="true" :model="query" class="query-form" size="mini">
<el-form-item class="query-form-item" label="列名:">
<el-input v-model="query.columnName" clearable placeholder="列名"></el-input>
</el-form-item>
<el-form-item>
<el-button-group style="margin-left: 10px; display: flex">
<el-button type="primary" icon="el-icon-refresh" @click="onReset"></el-button>
<el-button type="primary" icon="el-icon-search" @click="onSubmit"></el-button>
<el-button type="primary" icon="el-icon-plus" @click="handleSubForm({}, 'add')">新增</el-button>
</el-button-group>
</el-form-item>
</el-form>
<el-table :data="list" border highlight-current-row row-key="id"
style="width: 100%">
<el-table-column label="序号" type="index" ref="dataForm"></el-table-column>
<el-table-column prop="columnName" label="列名"> </el-table-column>
<el-table-column prop="isShow" label="是否展示">
<template slot-scope="scope">
<span>{{ isShowMap[scope.row.isShow] }}</span>
</template>
</el-table-column>
<el-table-column prop="columnDesc" label="列描述"></el-table-column>
<el-table-column prop="columnType" label="列类型">
<template slot-scope="scope">
<span>{{ columnTypeMap[scope.row.columnType] }}</span>
</template>
</el-table-column>
<el-table-column prop="number" label="排序"></el-table-column>
<el-table-column prop="width" label="宽度"></el-table-column>
<el-table-column prop="lableRule" show-overflow-tooltip="true" label="字典替换规则"></el-table-column>
<el-table-column prop="clickFuc" label="事件"></el-table-column>
<el-table-column prop="disabledFuc" label="禁用方法"></el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
type="text"
@click.native="handleSubForm(scope.row, 'edit')"
>编辑
</el-button>
<el-button type="text" @click.native="handleDel(scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<!--仓库编辑对话框-->
<el-dialog :title="formMap[formName]" :close-on-click-modal="false"
:close-on-press-escape="false" :visible.sync="formVisible" :before-close="hideForm" width="60%" top="5vh">
<el-form :model="subData" ref="dataForm" :rules="formRules" label-width="130px">
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="列名" prop="columnName" class="query-form-item">
<el-input v-model="subData.columnName" style="width: 80%" placeholder="请输入业列名"
auto-complete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="是否展示" prop="columnType">
<el-select v-model="subData.isShow" placeholder="请选择是否展示" style="width: 80%">
<el-option label="显示" value="1" />
<el-option label="隐藏" value="2" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="列描述" prop="columnDesc" class="query-form-item">
<el-input v-model="subData.columnDesc" style="width: 80%" placeholder="请输入列描述"
auto-complete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="列类型" prop="columnType">
<el-select v-model="subData.columnType" placeholder="请选择列类型" style="width: 80%">
<el-option label="输入框" value="input" />
<el-option label="下拉框" value="select" />
<el-option label="远程搜索" value="selectServer" />
<el-option label="区间时间选择框" value="datePicker" />
<el-option label="单时间选择框" value="data" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="排序" prop="number" class="query-form-item">
<el-input v-model="subData.number" style="width: 80%" placeholder="请输入排序"
auto-complete="off"></el-input>
<div style="color: red">数字越大字段排在越前面</div>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="宽度" prop="width" class="query-form-item">
<el-input v-model="subData.width" style="width: 80%" placeholder="请输入宽度"
auto-complete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="20" class="el-col">
<el-form-item label="字典替换规则" class="query-form-item">
<div style="display:flex" :key="i" v-for="(item, i) in conditionForm.lableList">
<el-form-item label="值" :prop="'lableList.' + i + '.value'" >
<el-input type="input" v-model="item.value" placeholder="请输入值"></el-input>
</el-form-item>
<el-form-item label="中文名" :prop="'lableList.' + i + '.name'">
<el-input type="input" v-model="item.name" placeholder="请输入中文名"></el-input>
</el-form-item>
<i v-if="i === 0" @click="addLableList" style="font-size:20px;color:#25c4fe;margin:8px 0 0 10px;" class="el-icon-circle-plus"></i>
<i @click="deleteLableList(i)" style="font-size:20px;color:#25c4fe;margin:8px 0 0 10px;" class="el-icon-remove"></i>
</div>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="事件" prop="clickFuc" class="query-form-item">
<el-input v-model="subData.clickFuc" style="width: 80%" placeholder="请输入事件"
auto-complete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="禁用方法" prop="clickFuc" class="query-form-item">
<el-input v-model="subData.disabledFuc" style="width: 80%" placeholder="请输入禁用方法"
auto-complete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click.native="hideForm">取消</el-button>
<el-button type="primary" @click.native="forSubmit()">提交
</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
list,
saveCustomConfig,
devCustomConfig
} from "@/api/system/sysCustomConfigDetail";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import Treeselect from "@riophae/vue-treeselect";
import {
isBlank
} from "@/utils/strUtil";
export default {
name: "info",
props: {
info: {
type: Object,
required: true
},
type: {
type: String,
required: true
}
},
data() {
return {
//----------------------------------
query: {
columnName: null,
configId: this.info.configId,
type: this.type,
},
loading: true,
list: [],
formName: null,
formMap: {
add: "配置界面详细-新增",
edit: "配置界面详细--编辑",
},
conditionForm: {
lableList: [{
name: '',
value: ''
}],
colorList: [{
type: '',
value: '',
color: ''
}],
buttonList: [{
type: '',
size: '',
style: '',
name: '',
clickFuc: ''
}]
},
formVisible: false,
subData: {},
formRules: {
columnName: [{ required: true, message: "请输入列名", trigger: "blur" }],
columnDesc: [
{ required: true, message: "请输入列名", trigger: "blur" },
],
columnType: [
{ required: true, message: "请选择类型", trigger: "blur" },
],
},
isExpandAll: true,
total: 0,
typeMap: {
1: "列表",
2: "表单",
},
upUerMap:{
true: "是",
false: "否",
},
isShowMap: {
"1": "显示",
"2": "隐藏",
},
columnTypeMap: {
"input": "输入框",
"select": "下拉框",
"data": "单时间选择框",
"datePicker": "区间时间选择框",
"selectServer":"远程搜索",
},
};
},
watch: {
info: function () {
this.getList();
},
},
methods: {
//---------------------------------
/* 重置按钮 点击事件 */
onReset() {
this.$router.push({
path: "",
});
this.query = {
configId: this.info.configId,
type: this.type,
columnName: "",
};
this.getList();
},
/* 查询按钮点击事件 */
onSubmit() {
this.getList();
},
getList() {
if (isBlank(this.info.configId)) {
return;
}
this.query.configId=this.info.configId;
this.query.type=this.type;
this.loading = true;
this.list = [];
list(this.query)
.then((response) => {
this.loading = false;
this.list = response.data.list || [];
this.total = response.data.total || 0;
})
.catch(() => {
this.loading = false;
this.total = 0;
this.list = [];
});
},
/* 新增 编辑点击事件 */
handleSubForm(data, formName) {
if (isBlank(this.info.configId)) {
this.$message.warning("请先选择配置!");
return;
}
this.formName = formName;
this.subData = JSON.parse(JSON.stringify(data));
this.subData.configId = this.info.configId,
this.subData.type = this.type;
this.formVisible = true;
if("edit" == formName){
const lableRule = this.subData.lableRule;
var lableList = [{name: '', value: ''}]
if(lableRule){
var jsonObj = JSON.parse(lableRule);
var lableList = []
for(var index in jsonObj){
lableList.push({
name: jsonObj[index],
value: index,
})
}
}
this.conditionForm.lableList = lableList;
}
},
/* 删除按钮点击事件 */
handleDel(row) {
if (row.id) {
this.$confirm("确认删除该配置吗?", "提示", {
type: "warning",
})
.then(() => {
this.deleteLoading = true;
let para = {
id: row.id
};
devCustomConfig(para)
.then((response) => {
this.deleteLoading = false;
if (response.code !== 20000) {
this.$message.error(response.message);
return false;
}
this.getList();
this.$message.success("删除成功");
})
.catch(() => {
this.deleteLoading = false;
});
})
.catch(() => {
this.$message.info("取消删除");
});
}
},
hideForm() {
// ---
this.formVisible = false;
this.resetForm();
return true;
},
//
resetForm() {
if (this.$refs["dataForm"]) {
//
this.$refs["dataForm"].clearValidate();
//
this.$refs["dataForm"].resetFields();
this.getList();
}
},
forSubmit() {
var lableRule = {};
this.conditionForm.lableList.forEach(obj => {
if(obj.name != ""){
lableRule[`${obj.value}`] = obj.name;
}
})
this.subData.lableRule = "";
if(JSON.stringify(lableRule) != "{}"){
this.subData.lableRule = JSON.stringify(lableRule);
}
// ---
this.$refs["dataForm"].validate((valid) => {
if (valid) {
saveCustomConfig(this.subData, this.formName)
.then((response) => {
this.formVisible = false;
if (response.code == 20000) {
this.getList();
} else {
this.$message.error(response.message);
}
})
.catch(() => {
this.formVisible = false;
});
}
});
},
//
addLableList () {
this.conditionForm.lableList.push({
name: '',
value: ''
})
},
//
deleteLableList (index) {
this.conditionForm.lableList.splice(index, 1)
},
//
addColorList () {
this.conditionForm.colorList.push({
type: '',
value: '',
color: ''
})
},
//
deleteColorList (index) {
this.conditionForm.colorList.splice(index, 1)
},
//
addButtonList () {
this.conditionForm.buttonList.push({
type: '',
size: '',
style: '',
name: '',
clickFuc: ''
})
},
//
deleteButtonList (index) {
this.conditionForm.buttonList.splice(index, 1)
},
},
};
</script>

@ -0,0 +1,307 @@
<template>
<!-- 系统管理 组织架构 仓库信息页面 -->
<div>
<el-card>
<el-form :inline="true" :model="query" class="query-form" size="mini">
<el-form-item class="query-form-item" label="业务标识:">
<el-input v-model="query.businessType" clearable placeholder="业务标识"></el-input>
</el-form-item>
<el-form-item label="表单类型:" prop="type">
<el-select v-model="query.type" placeholder="请选择类型" style="width: 90%">
<el-option label="列表" :value="1" />
<el-option label="表单" :value="2" />
</el-select>
</el-form-item>
<el-form-item>
<el-button-group style="margin-left: 10px; display: flex">
<el-button type="primary" icon="el-icon-refresh" @click="onReset"></el-button>
<el-button type="primary" icon="el-icon-search" @click="onSubmit"></el-button>
<el-button type="primary" icon="el-icon-plus" @click="handleSubForm({}, 'add')">新增</el-button>
</el-button-group>
</el-form-item>
</el-form>
<el-table :data="list" border highlight-current-row
@current-change="handSubCurrentChange"
row-key="id"
style="width: 100%">
<el-table-column label="序号" type="index" ref="dataForm"></el-table-column>
<el-table-column prop="businessType" label="业务标识"> </el-table-column>
<el-table-column prop="remark" label="备注"> </el-table-column>
<el-table-column prop="type" label="类型">
<template slot-scope="scope">
<span>{{ typeMap[scope.row.type] }}</span>
</template>
</el-table-column>
<el-table-column prop="handleChangeFuc" label="列表点击方法"> </el-table-column>
<el-table-column label="操作" width="220">
<template slot-scope="scope">
<el-button
type="text"
@click.native="handleSubForm(scope.row, 'edit')"
>编辑
</el-button>
<el-button type="text" @click.native="handleDel(scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<!--仓库编辑对话框-->
<el-dialog :title="formMap[formName]" :close-on-click-modal="false"
:close-on-press-escape="false" :visible.sync="formVisible" :before-close="hideForm" width="60%" top="5vh">
<el-form :model="subData" ref="dataForm" :rules="formRules" label-width="130px">
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="业务标识" prop="businessType" class="query-form-item">
<el-input v-model="subData.businessType" style="width: 80%" placeholder="请输入业务标识"
auto-complete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="描述" prop="remark" class="query-form-item">
<el-input v-model="subData.remark" style="width: 80%" placeholder="请输入描述"
auto-complete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="类型" prop="type">
<el-select v-model="subData.type" placeholder="请选择类型" style="width: 80%">
<el-option label="列表" value="1" />
<el-option label="表单" value="2" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<el-form-item label="列表点击方法" prop="handleChangeFuc" class="query-form-item">
<el-input v-model="subData.handleChangeFuc" style="width: 80%" placeholder="请输入列表点击方法"
auto-complete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click.native="hideForm">取消</el-button>
<el-button type="primary" @click.native="forSubmit()">提交
</el-button>
</div>
</el-dialog>
<el-tabs type="border-card" style="margin: 15px">
<el-tab-pane>
<span slot="label">自定义列-详细配置</span>
<config-detail
:info="configParms"
:type ="1"
></config-detail>
</el-tab-pane>
<el-tab-pane>
<span slot="label">自定义查询框-详细配置</span>
<config-query-detail
:info="configParms"
:type ="2"
></config-query-detail>
</el-tab-pane>
<el-tab-pane>
<span slot="label">自定义表单-详细配置</span>
<config-from-detail
:info="configParms"
:type ="3">
</config-from-detail>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import {
list,
saveCustomConfig,
devCustomConfig
} from "@/api/system/sysCustomConfig";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import configDetail from "@/views/system/customConfig/configDetail";
import configFromDetail from "@/views/system/customConfig/configFromDetail";
import configQueryDetail from "@/views/system/customConfig/configQueryDetail";
import {
isBlank
} from "@/utils/strUtil";
export default {
data() {
return {
//----------------------------------
query: {
name: null,
type: null,
},
loading: true,
list: [],
formName: null,
formMap: {
add: "配置界面信息-新增",
edit: "配置界面信息-编辑",
},
configParms: {
configId:null,
},
formVisible: false,
subData: {},
formRules: {
businessType: [{ required: true, message: "请输入业务标识", trigger: "blur" }],
type: [
{ required: true, message: "请选择类型", trigger: "blur" },
],
},
isExpandAll: true,
total: 0,
typeMap: {
1: "列表",
2: "表单",
},
};
},
methods: {
//---------------------------------
/* 重置按钮 点击事件 */
onReset() {
this.$router.push({
path: "",
});
this.query = {
name: "",
type: "",
};
this.getList();
this.configParms = {
configId:null
};
},
/* 查询按钮点击事件 */
onSubmit() {
this.getList();
},
handSubCurrentChange(row) {
//
this.configDetail(row);
},
configDetail(row) {
this.configParms = {
configId: row.id,
page:1
};
},
getList() {
//
this.loading = true;
this.list = [];
list(this.query)
.then((response) => {
this.loading = false;
this.list = response.data.list || [];
this.total = response.data.total || 0;
})
.catch(() => {
this.loading = false;
this.total = 0;
this.list = [];
});
},
/* 新增 编辑点击事件 */
handleSubForm(data, formName) {
this.formName = formName;
this.subData = JSON.parse(JSON.stringify(data));
this.formVisible = true;
},
/* 删除按钮点击事件 */
handleDel(row) {
if (row.id) {
this.$confirm("确认删除该配置吗?", "提示", {
type: "warning",
})
.then(() => {
this.deleteLoading = true;
let para = {
id: row.id
};
devCustomConfig(para)
.then((response) => {
this.deleteLoading = false;
if (response.code !== 20000) {
this.$message.error(response.message);
return false;
}
this.getList();
this.$message.success("删除成功");
})
.catch(() => {
this.deleteLoading = false;
});
})
.catch(() => {
this.$message.info("取消删除");
});
}
},
hideForm() {
// ---
this.formVisible = false;
this.resetForm();
return true;
},
//
resetForm() {
if (this.$refs["dataForm"]) {
//
this.$refs["dataForm"].clearValidate();
//
this.$refs["dataForm"].resetFields();
this.getList();
}
},
forSubmit() {
// ---
this.$refs["dataForm"].validate((valid) => {
if (valid) {
saveCustomConfig(this.subData, this.formName)
.then((response) => {
this.formVisible = false;
if (response.code == 20000) {
this.getList();
} else {
this.$message.error(response.message);
}
})
.catch(() => {
this.formVisible = false;
});
}
});
},
},
mounted() {},
components: {
configDetail,
configFromDetail,
configQueryDetail,
},
created() {
this.getList();
},
};
</script>
Loading…
Cancel
Save