...
|
...
|
@@ -2,7 +2,7 @@ |
|
|
* 配置页面编辑属性
|
|
|
* @returns {{editColProps: {}}}
|
|
|
*/
|
|
|
let configPageEdit = () => {
|
|
|
let configPageEdit = (columns, currentNode) => {
|
|
|
const {proxy} = Vue.getCurrentInstance();
|
|
|
// 编辑属性
|
|
|
let editColProps = Vue.ref({});
|
...
|
...
|
@@ -33,13 +33,24 @@ let configPageEdit = () => { |
|
|
* 时间:2021/10/27 14:34
|
|
|
*/
|
|
|
let getColType = (row) => {
|
|
|
|
|
|
// 获取属性标识的配置
|
|
|
let code = row.colType;
|
|
|
proxy.$http.get(`/api-web/v32/res/list/detail/col/${code}`, {}, function (res) {
|
|
|
if (res && res.object) {
|
|
|
fieldsObj.value = res.object;
|
|
|
row.colTypeQueryFields = '';
|
|
|
|
|
|
if (fieldsObj.value[code] && Object.keys(fieldsObj.value[code]).length > 0) {
|
|
|
row.colTypeExtend = '';
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
let params = {
|
|
|
resTypeId: currentNode.value.id,
|
|
|
colType: row.colType,
|
|
|
colTypeExtendProps: row.colTypeExtendProps,
|
|
|
colTypeExtend: row.colTypeExtend
|
|
|
}
|
|
|
|
|
|
proxy.$http.get(`/api-web/v32/res/config/detail/colTypes`, params, function (res) {
|
|
|
if (res && res.map) {
|
|
|
fieldsObj.value = res.map;
|
|
|
}
|
|
|
});
|
|
|
}
|
...
|
...
|
@@ -50,30 +61,55 @@ let configPageEdit = () => { |
|
|
* 作者: Wang
|
|
|
* 时间:2021/10/27 14:34
|
|
|
*/
|
|
|
let getColTypeExtVal = (row) => {
|
|
|
let getColTypeExtVal = (flg, row) => {
|
|
|
let colTypeExtend = row.colTypeExtend;
|
|
|
let rowProps = row.colTypeExtendProps;
|
|
|
if(!colTypeExtend || colTypeExtend == '' || colTypeExtend == null){
|
|
|
proxy.$global.showMsg("请选择关联扩展属性!", "warning")
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if(fieldsValueObj.value[row.id] && Object.keys(fieldsValueObj.value[row.id]).length >0){
|
|
|
return;
|
|
|
}
|
|
|
// 获取属性标识的配置
|
|
|
let params = {
|
|
|
resTypeId: currentNode.value.id,
|
|
|
colType: row.colType,
|
|
|
colTypeQueryFields: row.colTypeQueryFields
|
|
|
colTypeExtendProps: rowProps,
|
|
|
colTypeExtend: colTypeExtend
|
|
|
}
|
|
|
proxy.$http.get(`/api-web/v32/res/list/detail/setting`, params, function (res) {
|
|
|
proxy.$http.get(`/api-web/v32/res/config/detail/setting`, params, function (res) {
|
|
|
if (res && res.object) {
|
|
|
fieldsValueObj.value[row.id] = res.object;
|
|
|
settingVal.value[row.id] = {};
|
|
|
|
|
|
let defVal = JSON.parse(rowProps);
|
|
|
if(defVal){
|
|
|
settingVal.value[row.id] = defVal;
|
|
|
} else {
|
|
|
settingVal.value[row.id] = {};
|
|
|
}
|
|
|
settingCmDialogFlg.value = flg;
|
|
|
} else {
|
|
|
proxy.$global.showMsg("该属性无需配置!", "warning")
|
|
|
}
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
let showSettingCmDialog = (flg, row) => {
|
|
|
settingCmDialogFlg.value = flg;
|
|
|
|
|
|
if (flg == true && row) {
|
|
|
currentRow.value = row;
|
|
|
// 记载已配置的属性
|
|
|
if(row.setting && row.setting[row.id]){
|
|
|
// 加载已配置的属性
|
|
|
if (row.setting && row.setting[row.id]) {
|
|
|
settingVal.value[row.id] = row.setting[row.id]
|
|
|
} else {
|
|
|
getColTypeExtVal(flg, row);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
settingCmDialogFlg.value = flg;
|
|
|
}
|
|
|
|
|
|
let getSettingDetail = () => {
|
...
|
...
|
@@ -98,12 +134,76 @@ let configPageEdit = () => { |
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 展示配置属性
|
|
|
* <p>
|
|
|
* 作者: Wang
|
|
|
* 时间:2021/11/8 16:30
|
|
|
*/
|
|
|
const treeNodeConfig = (currentNode) => {
|
|
|
|
|
|
const {proxy} = Vue.getCurrentInstance();
|
|
|
|
|
|
let treeNodeDialogFlg = Vue.ref(false);
|
|
|
let treeNodeForm = Vue.ref({
|
|
|
options: '',
|
|
|
detailFunc: '',
|
|
|
veiwName: ''
|
|
|
});
|
|
|
|
|
|
let treeNodeFormRules = Vue.ref({});
|
|
|
|
|
|
/**
|
|
|
* 展示树节点配置
|
|
|
* <p>
|
|
|
* 作者: Wang
|
|
|
* 时间:2021/11/8 16:33
|
|
|
*/
|
|
|
let showTreeNodeDialog = (flg) => {
|
|
|
if (flg && flg == true && currentNode.value.map) {
|
|
|
treeNodeForm.value = {
|
|
|
id: currentNode.value.id,
|
|
|
options: currentNode.value.map.options,
|
|
|
detailFunc: currentNode.value.map.detailFunc,
|
|
|
veiwName: currentNode.value.map.veiwName
|
|
|
}
|
|
|
}
|
|
|
treeNodeDialogFlg.value = flg;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 保存树节点配置
|
|
|
*/
|
|
|
let saveTreeNodeConfig = () => {
|
|
|
proxy.$http.get(`/api-web/v32/res/config/saveTreeConfig`, treeNodeForm.value, function (res) {
|
|
|
if (res && res.success) {
|
|
|
proxy.$global.showMsg("保存成功!")
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
treeNodeDialogFlg,
|
|
|
showTreeNodeDialog,
|
|
|
saveTreeNodeConfig,
|
|
|
treeNodeForm,
|
|
|
treeNodeFormRules
|
|
|
}
|
|
|
}
|
|
|
|
|
|
export default {
|
|
|
name: 'resConfigIndex',
|
|
|
template: '',
|
|
|
components: {
|
|
|
'property-edit': Vue.defineAsyncComponent(
|
|
|
() => myImport('components/page/assets/propertyedit/index')
|
|
|
'rateComponents': Vue.defineAsyncComponent(
|
|
|
() => myImport('components/page/res/rateComponents/index')
|
|
|
),
|
|
|
'resNameComponents': Vue.defineAsyncComponent(
|
|
|
() => myImport('components/page/res/resNameComponents/index')
|
|
|
),
|
|
|
'statusComponents': Vue.defineAsyncComponent(
|
|
|
() => myImport('components/page/res/statusComponents/index')
|
|
|
),
|
|
|
},
|
|
|
data() {
|
...
|
...
|
@@ -114,7 +214,7 @@ export default { |
|
|
}
|
|
|
}
|
|
|
},
|
|
|
setup() {
|
|
|
setup(props, {attrs, slots, emit}) {
|
|
|
const {proxy} = Vue.getCurrentInstance();
|
|
|
let height = Vue.ref((window.innerHeight - 10) * 0.8);
|
|
|
let currentNode = Vue.ref({});
|
...
|
...
|
@@ -139,7 +239,16 @@ export default { |
|
|
getSettingDetail,
|
|
|
currentRow,
|
|
|
settingVal
|
|
|
} = configPageEdit()
|
|
|
} = configPageEdit(columns, currentNode)
|
|
|
|
|
|
|
|
|
const {
|
|
|
treeNodeDialogFlg,
|
|
|
showTreeNodeDialog,
|
|
|
saveTreeNodeConfig,
|
|
|
treeNodeForm,
|
|
|
treeNodeFormRules
|
|
|
} = treeNodeConfig(currentNode);
|
|
|
|
|
|
|
|
|
// 获取左侧树结构
|
...
|
...
|
@@ -147,11 +256,11 @@ export default { |
|
|
proxy.$http.get("/api-web/v32/res/list/config/tree", {}, function (res) {
|
|
|
if (res && res.data) {
|
|
|
let arr = [];
|
|
|
res.data.forEach(function (v){
|
|
|
res.data.forEach(function (v) {
|
|
|
arr.push({
|
|
|
id:v.id,
|
|
|
label:v.label,
|
|
|
children:v.children
|
|
|
id: v.id,
|
|
|
label: v.label,
|
|
|
children: v.children
|
|
|
});
|
|
|
})
|
|
|
|
...
|
...
|
@@ -171,7 +280,7 @@ export default { |
|
|
treeNodeId: currentNode.value.id,
|
|
|
loadDefault: defList.value.length == 0 ? 1 : 0
|
|
|
}
|
|
|
proxy.$http.get(`/api-web/v32/res/list/config`, params, function (res) {
|
|
|
proxy.$http.get(`/api-web/v32/res/config/list`, params, function (res) {
|
|
|
if (res && res.object) {
|
|
|
columns.value = res.object.columns;
|
|
|
dataList.value = res.object.datas;
|
...
|
...
|
@@ -179,6 +288,10 @@ export default { |
|
|
let arr = res.object.defaultList;
|
|
|
if (arr && arr.length > 0) {
|
|
|
defList.value = arr;
|
|
|
|
|
|
// 加载一个数据的类型
|
|
|
getColType(arr[0]);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -191,8 +304,22 @@ export default { |
|
|
* 作者: Wang
|
|
|
* 时间:2021/10/28 17:55
|
|
|
*/
|
|
|
let clickIndex = 0;
|
|
|
let handleConfigNodeClick = (data) => {
|
|
|
if (data) {
|
|
|
|
|
|
let isExistArr = dataList.value.filter(function (v) {
|
|
|
if (v.isAdd && v.isAdd == 1) {
|
|
|
return v;
|
|
|
}
|
|
|
})
|
|
|
if (isExistArr.length > 0) {
|
|
|
proxy.$global.confirm("有已添未保存的配置数据,是否清空?", function () {
|
|
|
currentNode.value = data;
|
|
|
getConfigData();
|
|
|
})
|
|
|
return;
|
|
|
}
|
|
|
currentNode.value = data;
|
|
|
getConfigData();
|
|
|
}
|
...
|
...
|
@@ -218,6 +345,9 @@ export default { |
|
|
data['isQuery'] = 1;
|
|
|
data['colIsTd'] = 1;
|
|
|
data['status'] = 0;
|
|
|
data['resListId'] = currentNode.value.id;
|
|
|
// 排序
|
|
|
data['colSort'] = 100;
|
|
|
// 新增状态
|
|
|
data['isAdd'] = 1;
|
|
|
|
...
|
...
|
@@ -236,11 +366,56 @@ export default { |
|
|
return;
|
|
|
}
|
|
|
// 添加
|
|
|
dataList.value.splice(0, 0, item);
|
|
|
let newData = {...item};
|
|
|
newData['resListId'] = currentNode.value.id;
|
|
|
dataList.value.splice(0, 0, newData);
|
|
|
}
|
|
|
// 保存
|
|
|
let saveConfig = () => {
|
|
|
console.log(dataList.value)
|
|
|
|
|
|
let arr = dataList.value;
|
|
|
if (arr.length == 0) {
|
|
|
proxy.$global.showMsg("请添加配置项!", 'warning');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
let msg = "";
|
|
|
arr.filter(function (v, i) {
|
|
|
if (v.colAlias == '' || v.colKey == '') {
|
|
|
msg += `请填写第${(i + 1)}行的属性名称或者标识!`
|
|
|
} else if (v.colWidth == '' || v.colWidth == null || v.colWidth < 0) {
|
|
|
msg += `第${(i + 1)}行的列宽不能为空或者小于0!`
|
|
|
} else if (v.colWidth == '' || v.colSort == null || v.colSort < 0) {
|
|
|
msg += `请填写第${(i + 1)}行的排序不能为空或者小于0!`
|
|
|
}
|
|
|
})
|
|
|
|
|
|
if (msg != '') {
|
|
|
proxy.$global.showMsg(msg, 'warning');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
// 保存时,将v['setting']转换为string
|
|
|
arr.forEach(function (v) {
|
|
|
v['setting'] = JSON.stringify(v['setting']);
|
|
|
})
|
|
|
|
|
|
/**
|
|
|
* 保存配置
|
|
|
* <p>
|
|
|
* 作者: Wang
|
|
|
* 时间:2021/11/9 15:19
|
|
|
*/
|
|
|
proxy.$http.post(`/api-web/v32/res/config/saveResTypeConfig/${currentNode.value.id}`, arr, function (res) {
|
|
|
if (res && res.success) {
|
|
|
proxy.$global.showMsg("保存成功!");
|
|
|
|
|
|
// 刷新当前列表数据
|
|
|
getConfigData();
|
|
|
} else {
|
|
|
proxy.$global.showMsg(res.msg && res.msg != '' ? res.msg : "保存成功!", "error");
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -249,11 +424,22 @@ export default { |
|
|
* 作者: Wang
|
|
|
* 时间:2021/10/26 19:47
|
|
|
*/
|
|
|
let deleteRow = (index) => {
|
|
|
proxy.$global.confirm("确认删除该行配置吗?", function () {
|
|
|
dataList.value.splice(index, 1);
|
|
|
|
|
|
proxy.$global.showMsg("删除成功!")
|
|
|
let deleteRow = (row,index) => {
|
|
|
proxy.$global.confirm("确认删除该配置项吗?", function () {
|
|
|
if(row.isAdd && row.isAdd == 1){
|
|
|
proxy.$global.showMsg("删除成功!")
|
|
|
dataList.value.splice(index, 1);
|
|
|
} else {
|
|
|
// 删除配置项
|
|
|
proxy.$http.post(`/api-web/v32/res/config/deleteResTypeConfig/${row.id}`, {}, function (res) {
|
|
|
if (res && res.success) {
|
|
|
proxy.$global.showMsg("删除成功!");
|
|
|
dataList.value.splice(index, 1);
|
|
|
} else {
|
|
|
proxy.$global.showMsg(res.msg && res.msg != '' ? res.msg : "删除失败!", "error");
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
|
...
|
...
|
@@ -286,7 +472,14 @@ export default { |
|
|
showSettingCmDialog,
|
|
|
getSettingDetail,
|
|
|
currentRow,
|
|
|
settingVal
|
|
|
settingVal,
|
|
|
|
|
|
// 树节点配置
|
|
|
treeNodeDialogFlg,
|
|
|
showTreeNodeDialog,
|
|
|
saveTreeNodeConfig,
|
|
|
treeNodeForm,
|
|
|
treeNodeFormRules
|
|
|
}
|
|
|
}
|
|
|
} |
...
|
...
|
|