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

perf: 优化应用配置

parent 3875273d
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
<a-button type="primary" @click="handleAdd">新增</a-button> <a-button type="primary" @click="handleAdd">新增</a-button>
<a-button type="danger" @click="handleDelAll">批量删除</a-button> <a-button type="danger" @click="handleDelAll">批量删除</a-button>
</a-space> </a-space>
<div class="search-box"> <div class="search-box" v-if="searchTemplate.length">
<a-input-group compact> <a-input-group compact>
<a-select style="min-width: 100px" v-model="fieldCode"> <a-select style="min-width: 100px" v-model="fieldCode">
<a-select-option <a-select-option
v-for="v in appTemplate" v-for="v in searchTemplate"
:key="v.id" :key="v.id"
:value="v.fieldCode" :value="v.fieldCode"
> >
...@@ -153,7 +153,9 @@ export default { ...@@ -153,7 +153,9 @@ export default {
previewVisible: false, previewVisible: false,
previewData: {}, // 预览信息 previewData: {}, // 预览信息
appTemplate: [], // 字段模板列表 appTemplate: [], // 字段模板列表
searchTemplate: [], //关联搜索字段模板列表
selectedRowKeys: [], selectedRowKeys: [],
orConditionList: [],
}; };
}, },
computed: { computed: {
...@@ -190,14 +192,25 @@ export default { ...@@ -190,14 +192,25 @@ export default {
return { return {
title: v.fieldName, title: v.fieldName,
dataIndex: v.fieldCode, 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]; return [index, ...arr, action];
}, },
}, },
created() { async created() {
this.getTempleteList(); await this.getTempleteList();
this.getDatasetList(); this.getDatasetList();
}, },
methods: { methods: {
...@@ -210,11 +223,15 @@ export default { ...@@ -210,11 +223,15 @@ export default {
}); });
if (res.data.code === 1) { if (res.data.code === 1) {
let { data } = res.data.data; let { data } = res.data.data;
this.appTemplate = data.sort((a, b) => { let arr = data.sort((a, b) => {
return a.fieldOrderNo - b.fieldOrderNo; return a.fieldOrderNo - b.fieldOrderNo;
}); });
if (this.appTemplate.length) { this.appTemplate = arr;
this.fieldCode = this.appTemplate[0].fieldCode; 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 { ...@@ -227,6 +244,16 @@ export default {
appId: this.appId, appId: this.appId,
fieldCode: this.fieldCode, fieldCode: this.fieldCode,
fieldValue: `%${this.searchVal}%`, fieldValue: `%${this.searchVal}%`,
// orConditionList: [
// {
// fieldCode: this.fieldCode,
// fieldValue: `%${this.searchVal}%`,
// },
// {
// fieldCode: "top",
// fieldValue: `%%`,
// },
// ],
}); });
this.loading = false; this.loading = false;
if (res.data.code === 1) { if (res.data.code === 1) {
......
...@@ -120,6 +120,18 @@ export default { ...@@ -120,6 +120,18 @@ export default {
title: "允许为空", title: "允许为空",
scopedSlots: { customRender: "fieldNull" }, scopedSlots: { customRender: "fieldNull" },
}, },
{
title: "关联搜索",
dataIndex: "defaultValue",
customRender: (text) => {
return <a-tag> {text == 1 ? "" : ""} </a-tag>;
},
},
{
title: "默认值",
dataIndex: "fieldValue",
},
{ {
title: "操作", title: "操作",
width: "110px", width: "110px",
...@@ -239,5 +251,4 @@ export default { ...@@ -239,5 +251,4 @@ export default {
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped></style>
</style>
\ No newline at end of file
...@@ -363,7 +363,7 @@ export default { ...@@ -363,7 +363,7 @@ export default {
if (v.id) { if (v.id) {
delete v.id; delete v.id;
} }
v.fieldValue = undefined; // v.fieldValue = v.fieldValue ?? undefined;
if (v.fieldType == "upload") { if (v.fieldType == "upload") {
v.fileList = []; v.fileList = [];
} }
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
</a-select> </a-select>
</a-form-model-item> </a-form-model-item>
<a-form-model-item <a-form-model-item
v-if="form.fieldType == 'table'" v-if="form.fieldType == 'table' || form.fieldType == 'select'"
label="数据接口" label="数据接口"
prop="serviceApi" prop="serviceApi"
> >
...@@ -137,6 +137,15 @@ ...@@ -137,6 +137,15 @@
<a-radio :value="1"></a-radio> <a-radio :value="1"></a-radio>
</a-radio-group> </a-radio-group>
</a-form-model-item> </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-form-model-item label="排序" prop="fieldOrderNo">
<a-input-number v-model="form.fieldOrderNo" :min="0" /> <a-input-number v-model="form.fieldOrderNo" :min="0" />
</a-form-model-item> </a-form-model-item>
...@@ -220,26 +229,6 @@ export default { ...@@ -220,26 +229,6 @@ export default {
}, },
}, },
data() { 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 { return {
fieldTypeItem, fieldTypeItem,
fieldType: [ fieldType: [
...@@ -265,7 +254,8 @@ export default { ...@@ -265,7 +254,8 @@ export default {
isList: 0, //字段是否列表显示(0.否,1.是) isList: 0, //字段是否列表显示(0.否,1.是)
fieldOrderNo: 99, // 排序号 fieldOrderNo: 99, // 排序号
fieldTypeValue: "", // 字段类型值 fieldTypeValue: "", // 字段类型值
defaultValue: "", // 字段默认值 defaultValue: "0", // 字段默认值(用作关联搜索)
fieldValue: "", // 字段值
serviceApi: "", // 动态数据接口 serviceApi: "", // 动态数据接口
serviceApiParams: "", // 动态数据参数配置 serviceApiParams: "", // 动态数据参数配置
remark: "", // remark: "", //
...@@ -287,9 +277,9 @@ export default { ...@@ -287,9 +277,9 @@ export default {
isList: [ isList: [
{ required: true, message: "请选择是否列表显示", trigger: "change" }, { required: true, message: "请选择是否列表显示", trigger: "change" },
], ],
serviceApi: [ // serviceApi: [
{ required: true, message: "请输入数据接口地址", trigger: "blur" }, // { 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