|
@@ -39,10 +39,10 @@ import { useDownload } from '@/hooks/useDownload'
|
|
|
import { ElMessageBox } from 'element-plus'
|
|
|
import ProTable from '@/components/ProTable/index.vue'
|
|
|
import ImportExcel from '@/components/ImportExcel/index.vue'
|
|
|
-import FormDialog from '@/components/DialogOld/form.vue'
|
|
|
+import FormDialog from '@/components/FormDialog/index.vue'
|
|
|
import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
|
|
|
import { Delete, EditPen, Download, View } from '@element-plus/icons-vue'
|
|
|
-import { listDataApi, delDataApi, addDataApi, updateDataApi, getDataApi, exportApi, getDictsApi } from '@/api/modules/system/dictData'
|
|
|
+import { listDataApi, delDataApi, addDataApi, updateDataApi, getDataApi, exportApi } from '@/api/modules/system/dictData'
|
|
|
import { getDictApi } from '@/api/modules/system/dict'
|
|
|
|
|
|
import { useRoute } from 'vue-router'
|
|
@@ -96,12 +96,13 @@ const openDialog = async (type: number, title: string, row?: any) => {
|
|
|
if (row?.dictCode) {
|
|
|
res = await getDataApi(row?.dictCode || null)
|
|
|
}
|
|
|
+ setItemsOptions()
|
|
|
const params = {
|
|
|
title,
|
|
|
width: 500,
|
|
|
isEdit: type !== 3,
|
|
|
- fieldList: fieldList,
|
|
|
- model: type == 1 ? { dictType: defaultDictType.value } : res.data,
|
|
|
+ itemsOptions: itemsOptions,
|
|
|
+ model: type == 1 ? { dictType: defaultDictType.value, version: 0 } : { ...res.data, version: 0 },
|
|
|
api: type == 1 ? addDataApi : updateDataApi,
|
|
|
getTableList: proTable.value?.getTableList
|
|
|
}
|
|
@@ -144,16 +145,6 @@ const columns = reactive<ColumnProps<any>[]>([
|
|
|
},
|
|
|
width: 120
|
|
|
},
|
|
|
- {
|
|
|
- prop: 'status',
|
|
|
- label: '状态',
|
|
|
- tag: true,
|
|
|
- enum: () => getDictsApi('sys_normal_disable'),
|
|
|
- search: {
|
|
|
- el: 'tree-select'
|
|
|
- },
|
|
|
- fieldNames: { label: 'dictLabel', value: 'dictValue' }
|
|
|
- },
|
|
|
{
|
|
|
prop: 'createTime',
|
|
|
label: '创建时间',
|
|
@@ -166,66 +157,70 @@ const columns = reactive<ColumnProps<any>[]>([
|
|
|
},
|
|
|
{ prop: 'operation', label: '操作', width: 230, fixed: 'right' }
|
|
|
])
|
|
|
-const fieldList: Form.FieldItem[] = [
|
|
|
- {
|
|
|
- label: '标签类型',
|
|
|
- field: 'dictType',
|
|
|
- disabled: true
|
|
|
- },
|
|
|
- {
|
|
|
- label: '数据标签',
|
|
|
- field: 'dictLabel',
|
|
|
- rules: [{ required: true, message: '数据标签不能为空', trigger: 'blur' }],
|
|
|
- placeholder: '请输入数据标签'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '数据键值',
|
|
|
- field: 'dictValue',
|
|
|
- rules: [{ required: true, message: '数据键值不能为空', trigger: 'blur' }],
|
|
|
- placeholder: '请输入数据键值'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '显示排序',
|
|
|
- field: 'dictSort',
|
|
|
- rules: [{ required: true, message: '显示排序不能为空', trigger: 'blur' }],
|
|
|
- type: 'input-number',
|
|
|
- options: {
|
|
|
- min: 0
|
|
|
+
|
|
|
+// 表单配置项
|
|
|
+let itemsOptions: ProForm.ItemsOptions[] = []
|
|
|
+const setItemsOptions = () => {
|
|
|
+ itemsOptions = [
|
|
|
+ {
|
|
|
+ label: '标签类型',
|
|
|
+ prop: 'dictType',
|
|
|
+ compOptions: {
|
|
|
+ disabled: true
|
|
|
+ }
|
|
|
},
|
|
|
- placeholder: '请输入显示排序'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '样式属性',
|
|
|
- field: 'cssClass',
|
|
|
- placeholder: '请输入样式属性'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '回显样式',
|
|
|
- field: 'listClass',
|
|
|
- type: 'select',
|
|
|
- enum: listClassOptions,
|
|
|
- options: {
|
|
|
- valueKey: 'value',
|
|
|
- labelKey: 'label'
|
|
|
+ {
|
|
|
+ label: '数据标签',
|
|
|
+ prop: 'dictLabel',
|
|
|
+ rules: [{ required: true, message: '数据标签不能为空', trigger: 'blur' }],
|
|
|
+ compOptions: {
|
|
|
+ placeholder: '请输入数据标签'
|
|
|
+ }
|
|
|
},
|
|
|
- placeholder: '请输入回显样式'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '状态',
|
|
|
- field: 'status',
|
|
|
- enum: () => getDictsApi('sys_normal_disable'),
|
|
|
- type: 'radio',
|
|
|
- options: {
|
|
|
- labelKey: 'dictLabel',
|
|
|
- valueKey: 'dictValue'
|
|
|
+ {
|
|
|
+ label: '数据键值',
|
|
|
+ prop: 'dictValue',
|
|
|
+ rules: [{ required: true, message: '数据键值不能为空', trigger: 'blur' }],
|
|
|
+ compOptions: {
|
|
|
+ placeholder: '请输入数据键值'
|
|
|
+ }
|
|
|
},
|
|
|
- placeholder: '请选择状态'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '备注',
|
|
|
- field: 'remark',
|
|
|
- type: 'textarea',
|
|
|
- placeholder: '请输入备注'
|
|
|
- }
|
|
|
-]
|
|
|
+ {
|
|
|
+ label: '显示排序',
|
|
|
+ prop: 'dictSort',
|
|
|
+ rules: [{ required: true, message: '显示排序不能为空', trigger: 'blur' }],
|
|
|
+ compOptions: {
|
|
|
+ elTagName: 'input-number',
|
|
|
+ min: 0,
|
|
|
+ placeholder: '请输入显示排序'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '样式属性',
|
|
|
+ prop: 'cssClass',
|
|
|
+ compOptions: {
|
|
|
+ placeholder: '请输入样式属性'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '回显样式',
|
|
|
+ prop: 'listClass',
|
|
|
+ compOptions: {
|
|
|
+ elTagName: 'select',
|
|
|
+ enum: listClassOptions,
|
|
|
+ valueKey: 'value',
|
|
|
+ labelKey: 'label',
|
|
|
+ placeholder: '请输入回显样式'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '备注',
|
|
|
+ prop: 'remark',
|
|
|
+ compOptions: {
|
|
|
+ type: 'textarea',
|
|
|
+ placeholder: '请输入备注'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+}
|
|
|
</script>
|