Commit 61d63b47 authored by “yiyousong”'s avatar “yiyousong”

perf: 优化应用配置

parent 3875273d
......@@ -6,11 +6,11 @@
<a-button type="primary" @click="handleAdd">新增</a-button>
<a-button type="danger" @click="handleDelAll">批量删除</a-button>
</a-space>
<div class="search-box">
<div class="search-box" v-if="searchTemplate.length">
<a-input-group compact>
<a-select style="min-width: 100px" v-model="fieldCode">
<a-select-option
v-for="v in appTemplate"
v-for="v in searchTemplate"
:key="v.id"
:value="v.fieldCode"
>
......@@ -153,7 +153,9 @@ export default {
previewVisible: false,
previewData: {}, // 预览信息
appTemplate: [], // 字段模板列表
searchTemplate: [], //关联搜索字段模板列表
selectedRowKeys: [],
orConditionList: [],
};
},
computed: {
......@@ -190,14 +192,25 @@ export default {
return {
title: v.fieldName,
dataIndex: v.fieldCode,
customRender: (text, record) => {
let row = record.appInfoFieldList.find(
(item) => item.fieldCode == v.fieldCode
);
if (row.fieldTypeValue && !row.serviceApiParams) {
let fieldTypeValue = JSON.parse(row.fieldTypeValue);
return fieldTypeValue[text];
} else {
return text;
}
},
};
}
});
return [index, ...arr, action];
},
},
created() {
this.getTempleteList();
async created() {
await this.getTempleteList();
this.getDatasetList();
},
methods: {
......@@ -210,11 +223,15 @@ export default {
});
if (res.data.code === 1) {
let { data } = res.data.data;
this.appTemplate = data.sort((a, b) => {
let arr = data.sort((a, b) => {
return a.fieldOrderNo - b.fieldOrderNo;
});
if (this.appTemplate.length) {
this.fieldCode = this.appTemplate[0].fieldCode;
this.appTemplate = arr;
this.searchTemplate = data.filter((v) => {
return v.defaultValue == 1;
});
if (this.searchTemplate.length) {
this.fieldCode = this.searchTemplate[0].fieldCode;
}
}
},
......@@ -227,6 +244,16 @@ export default {
appId: this.appId,
fieldCode: this.fieldCode,
fieldValue: `%${this.searchVal}%`,
// orConditionList: [
// {
// fieldCode: this.fieldCode,
// fieldValue: `%${this.searchVal}%`,
// },
// {
// fieldCode: "top",
// fieldValue: `%%`,
// },
// ],
});
this.loading = false;
if (res.data.code === 1) {
......
......@@ -120,6 +120,18 @@ export default {
title: "允许为空",
scopedSlots: { customRender: "fieldNull" },
},
{
title: "关联搜索",
dataIndex: "defaultValue",
customRender: (text) => {
return <a-tag> {text == 1 ? "" : ""} </a-tag>;
},
},
{
title: "默认值",
dataIndex: "fieldValue",
},
{
title: "操作",
width: "110px",
......@@ -239,5 +251,4 @@ export default {
};
</script>
<style lang="less" scoped>
</style>
\ No newline at end of file
<style lang="less" scoped></style>
......@@ -363,7 +363,7 @@ export default {
if (v.id) {
delete v.id;
}
v.fieldValue = undefined;
// v.fieldValue = v.fieldValue ?? undefined;
if (v.fieldType == "upload") {
v.fileList = [];
}
......
......@@ -35,7 +35,7 @@
</a-select>
</a-form-model-item>
<a-form-model-item
v-if="form.fieldType == 'table'"
v-if="form.fieldType == 'table' || form.fieldType == 'select'"
label="数据接口"
prop="serviceApi"
>
......@@ -137,6 +137,15 @@
<a-radio :value="1"></a-radio>
</a-radio-group>
</a-form-model-item>
<a-form-model-item label="关联搜索" prop="defaultValue">
<a-radio-group v-model="form.defaultValue">
<a-radio value="0"></a-radio>
<a-radio value="1"></a-radio>
</a-radio-group>
</a-form-model-item>
<a-form-model-item label="默认值" prop="fieldValue">
<a-input v-model="form.fieldValue" placeholder="请输入默认值" />
</a-form-model-item>
<a-form-model-item label="排序" prop="fieldOrderNo">
<a-input-number v-model="form.fieldOrderNo" :min="0" />
</a-form-model-item>
......@@ -220,26 +229,6 @@ export default {
},
},
data() {
// 校验JSON
// const checkJSON = (rule, value, callback) => {
// if (!value) {
// callback(new Error("请输入数据配置"));
// } else {
// try {
// let Obj = JSON.parse(value);
// let isjson =
// Object.prototype.toString.call(Obj).toLowerCase() ==
// "[object object]" && Object.keys(Obj).length;
// if (isjson) {
// callback();
// } else {
// callback(new Error("请输入JSON对象格式"));
// }
// } catch (err) {
// callback(new Error("输入的JSON数据格式有误"));
// }
// }
// };
return {
fieldTypeItem,
fieldType: [
......@@ -265,7 +254,8 @@ export default {
isList: 0, //字段是否列表显示(0.否,1.是)
fieldOrderNo: 99, // 排序号
fieldTypeValue: "", // 字段类型值
defaultValue: "", // 字段默认值
defaultValue: "0", // 字段默认值(用作关联搜索)
fieldValue: "", // 字段值
serviceApi: "", // 动态数据接口
serviceApiParams: "", // 动态数据参数配置
remark: "", //
......@@ -287,9 +277,9 @@ export default {
isList: [
{ required: true, message: "请选择是否列表显示", trigger: "change" },
],
serviceApi: [
{ required: true, message: "请输入数据接口地址", trigger: "blur" },
],
// serviceApi: [
// { required: true, message: "请输入数据接口地址", trigger: "blur" },
// ],
},
};
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment