fix: 调整数据来源配置

This commit is contained in:
sy2084
2024-07-17 23:19:09 +08:00
parent 91832d1e8c
commit 7afe485d90
10 changed files with 67 additions and 22 deletions

View File

@@ -40,6 +40,18 @@
{{ record[column.dataIndex] }}
</template>
</template>
<template v-if="column.dataIndex === 'field_numerical_name'">
<a-select
v-if="editableData[record.field_id]"
v-model:value="record.field_numerical_type_id"
:options="fieldNumTypeSel"
placeholder="请选择"
style="width: 160px">
</a-select>
<template v-else>
{{ record.field_numerical_name }}
</template>
</template>
<template v-if="column.dataIndex === 'field_type_name'">
<a-select
v-if="editableData[record.field_id]"
@@ -67,14 +79,14 @@
<template v-if="column.dataIndex === 'action'">
<a-space v-if="editableData[record.field_id]">
<a-button type="primary" size="small" @click="handleSave(record)"
>保存</a-button
>保存</a-button
>
<a-button size="small" @click="handleCancel(record)"
>取消</a-button
>取消</a-button
>
</a-space>
<a-button v-else type="link" @click="handleEdit(record)"
>修改</a-button
>修改</a-button
>
</template>
</template>
@@ -96,6 +108,7 @@ import { onMounted, reactive, ref, watch } from "vue";
import { viewCfgCols } from "@/views/config-manage/module-cfg/config";
import {
getFieldTypeSelect,
getFieldNumSelect,
getFieldList,
// deleteField,
saveField,
@@ -117,6 +130,7 @@ const listLoading = ref(false);
const fieldName = ref("");
const dataList = ref([]);
const fieldTypeSel = ref([]);
const fieldNumTypeSel = ref([]);
const pageState = reactive({
page: 1,
perPage: 20,
@@ -135,15 +149,23 @@ watch(
onMounted(() => {
toGetFieldTypes();
toGetFieldNumSelect();
});
// 字段类型下拉
// 字段搜索类型下拉
const toGetFieldTypes = () => {
getFieldTypeSelect().then((res) => {
fieldTypeSel.value = res.data;
});
};
// 字段类型下拉
const toGetFieldNumSelect = () => {
getFieldNumSelect().then((res) => {
fieldNumTypeSel.value = res.data;
})
};
// 字段列表
const toGetList = () => {
listLoading.value = true;
@@ -172,6 +194,7 @@ const addField = () => {
field_id: new Date().getTime() + "",
field_title: undefined,
field_name: undefined,
field_numerical_type_id: undefined,
is_search: 0,
field_type_id: undefined,
belong_to_table: undefined,
@@ -203,6 +226,7 @@ const handleSave = (record) => {
field_id: record.field_id,
field_title: record.field_title,
field_name: record.field_name,
field_numerical_type_id: record.field_numerical_type_id,
is_search: record.is_search,
field_type_id: record.field_type_id,
belong_to_table: record.belong_to_table,