|
@@ -70,7 +70,43 @@
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
|
-
|
|
|
+ <template v-if="dataModel.dataType=='NESTED'">
|
|
|
+ <a-divider orientation="left">字段定义</a-divider>
|
|
|
+ <a-row>
|
|
|
+ <a-col :span="24" style="margin-right: 20px;">
|
|
|
+ <div style="float: right;">
|
|
|
+ <Space>
|
|
|
+ <BImportExcel :options="importOptions" @success="onImportSuccess"></BImportExcel>
|
|
|
+
|
|
|
+ <a-button @click="add()">
|
|
|
+ <template #icon>
|
|
|
+ <plus-circle-outlined/>
|
|
|
+ </template>
|
|
|
+ 新增
|
|
|
+ </a-button>
|
|
|
+ </Space>
|
|
|
+ </div>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ <a-row>
|
|
|
+ <a-col style="margin-bottom: 20px;">
|
|
|
+ <a-table :columns="columns" :data-source="dataModel.childFields" :scroll="{ x:'100%', y: 500 }"
|
|
|
+ :pagination="false"
|
|
|
+ bordered>
|
|
|
+ <template #bodyCell="{ column ,record,index}">
|
|
|
+ <template v-if="column.key === 'operation'">
|
|
|
+ <a-button type="link" size="small" @click="edit(record)">修改</a-button>
|
|
|
+ <a-popconfirm placement="leftTop"
|
|
|
+ title="是否删除数据?"
|
|
|
+ @confirm="onDelete(index)">
|
|
|
+ <a-button type="link" size="small">删除</a-button>
|
|
|
+ </a-popconfirm>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ </a-table>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </template>
|
|
|
<a-row style="height: 20px"></a-row>
|
|
|
<a-row type="flex">
|
|
|
<a-col :span="24" style="text-align: right;margin-right: 20px;">
|
|
@@ -78,6 +114,7 @@
|
|
|
</a-col>
|
|
|
</a-row>
|
|
|
</Form>
|
|
|
+ <FieldEdit ref="modalRef" :onSave="onFieldSave"></FieldEdit>
|
|
|
</a-modal>
|
|
|
</template>
|
|
|
<script lang="ts">
|
|
@@ -86,13 +123,16 @@ import {defineComponent, reactive, ref} from "vue";
|
|
|
import BUploadFile from "@/components/file/uploadFile.vue";
|
|
|
import type {SelectProps} from "ant-design-vue";
|
|
|
import {getDictionaryItemList} from "@/api/system/dictionary";
|
|
|
-import type {FormInstance} from 'ant-design-vue';
|
|
|
+import type {FormInstance, TableColumnsType} from 'ant-design-vue';
|
|
|
import {DataTypeList} from '@/enums/dictions';
|
|
|
import type {EsIndexfield} from "@/views/esindex/model";
|
|
|
+import FieldEdit from "@/views/esindex/fieldedit.vue";
|
|
|
+import type{ImportProps} from "@/components/basic/excel/importExcel/ImportProps";
|
|
|
+import BImportExcel from "@/components/basic/excel/importExcel/importExcel.vue";
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: 'FieldEdit',
|
|
|
- components: {BUploadFile, Form},
|
|
|
+ components: {BUploadFile, FieldEdit, BImportExcel,Form},
|
|
|
props: {
|
|
|
onSave: {
|
|
|
type: Function,
|
|
@@ -104,20 +144,84 @@ export default defineComponent({
|
|
|
const confirmLoading = ref<boolean>(false);
|
|
|
const modalFormRef = ref<FormInstance>();
|
|
|
const defaultValue = reactive<EsIndexfield>({
|
|
|
- indexName:"",
|
|
|
+ indexName: "",
|
|
|
fieldCode: "",
|
|
|
fieldName: "",
|
|
|
fieldDesc: "",
|
|
|
dataType: null,
|
|
|
queryTypeId: "",
|
|
|
isSearchField: 1,
|
|
|
- isDisplay:1
|
|
|
+ isDisplay: 1,
|
|
|
+ childFields: []
|
|
|
});
|
|
|
const dataModel = ref({...defaultValue});
|
|
|
const queryTypeList = ref<SelectProps['options']>();
|
|
|
const title = ref();
|
|
|
|
|
|
+ const columns: TableColumnsType = [
|
|
|
+ {
|
|
|
+ title: '序号', width: 80, dataIndex: 'num', key: 'num', align: "center", customRender: ({index}) => {
|
|
|
+ return `${index + 1}`;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {title: '字段编码', dataIndex: 'fieldCode', key: 'fieldCode', align: "center"},
|
|
|
+ {title: '字段名称', dataIndex: 'fieldName', key: 'fieldName', align: "center"},
|
|
|
+ {
|
|
|
+ title: '是否查询字段', dataIndex: 'isSearchField', key: 'isSearchField', align: "center", customRender: ({record}) =>
|
|
|
+ record.isSearchField == "1" ? "是" : "否"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '查询类型', dataIndex: 'queryTypeId', key: 'queryTypeId', align: "center", customRender: ({record}) =>
|
|
|
+ queryTypeList.value?.filter(x => x.value == record.queryTypeId)[0]?.name
|
|
|
+ },
|
|
|
+ {title: '显示排序', dataIndex: 'disOrder', key: 'disOrder', align: "center"},
|
|
|
+ {
|
|
|
+ title: '是否显示', dataIndex: 'isDisplay', key: 'isDisplay', align: "center", customRender: ({record}) =>
|
|
|
+ record.isDisplay == "1" ? "是" : "否"
|
|
|
+ },
|
|
|
+ {title: '操作', key: 'operation', fixed: 'right', width: 120, align: "center"},
|
|
|
+ ];
|
|
|
+ const modalRef = ref();
|
|
|
+ let isEdit = false;
|
|
|
+ const add = () => {
|
|
|
+ isEdit = false;
|
|
|
+ modalRef.value.show(null);
|
|
|
+ }
|
|
|
+ const edit = (record) => {
|
|
|
+ isEdit = true;
|
|
|
+ modalRef.value.show(record);
|
|
|
+ }
|
|
|
+ const onDelete = (record) => {
|
|
|
+ dataModel.value.childFields.splice(record, 1);
|
|
|
+ }
|
|
|
+ const onFieldSave = async (model: EsIndexfield) => {
|
|
|
+ if (!isEdit) {
|
|
|
+ dataModel.value.childFields.push(model);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ const importOptions = ref<ImportProps>({
|
|
|
+ title: "导入",
|
|
|
+ url: 'esindex/importData',
|
|
|
+ columns: [
|
|
|
+ {cnName: "字段编码", enName: "fieldCode", width: 100},
|
|
|
+ {cnName: "字段名称", enName: "fieldName", width: 200},
|
|
|
+ {cnName: "字段描述", enName: "fieldDesc", width: 100},
|
|
|
+ {cnName: "数据类型", enName: "dataType", width: 150},
|
|
|
+ {cnName: "查询类型", enName: "queryTypeName", width: 100},
|
|
|
+ {cnName: "显示排序", enName: "disOrder", width: 200},
|
|
|
+ {cnName: "是否查询字段", enName: "isSearchFieldText", width: 200},
|
|
|
+ {cnName: "是否显示", enName: "isDisplayText", width: 100},
|
|
|
+ ],
|
|
|
+ template: {
|
|
|
+ tempFileName: "索引字段导入模板.xlsx",
|
|
|
+ url: '',
|
|
|
+ params: null
|
|
|
+ }
|
|
|
+ });
|
|
|
+ const onImportSuccess = (data: []) => {
|
|
|
+ dataModel.value.childFields = dataModel.value.childFields.concat(data);
|
|
|
+ }
|
|
|
getDictionaryItemList({code: "queryType"}).then(data => {
|
|
|
queryTypeList.value = data;
|
|
|
});
|
|
@@ -127,7 +231,7 @@ export default defineComponent({
|
|
|
record = {...defaultValue};
|
|
|
}
|
|
|
dataModel.value = record;
|
|
|
- title.value = "主题字段定义";
|
|
|
+ title.value = "索引字段定义";
|
|
|
visible.value = true;
|
|
|
};
|
|
|
|
|
@@ -147,8 +251,8 @@ export default defineComponent({
|
|
|
modalFormRef,
|
|
|
visible, title,
|
|
|
confirmLoading,
|
|
|
- DataTypeList,
|
|
|
- queryTypeList,
|
|
|
+ DataTypeList,onImportSuccess,importOptions,
|
|
|
+ queryTypeList, columns, add, modalRef, onFieldSave,edit,onDelete,
|
|
|
show, handleOk, handleCancel,
|
|
|
};
|
|
|
},
|