diff --git a/src/components/FormDialog/FormDialog.vue b/src/components/FormDialog/FormDialog.vue
index 3343003..82e484f 100644
--- a/src/components/FormDialog/FormDialog.vue
+++ b/src/components/FormDialog/FormDialog.vue
@@ -151,4 +151,7 @@ watch(() => props.modelValue, (newValue) => {
:deep(.el-date-editor).el-input {
width: 100% !important;
}
+:deep(.el-input-number) {
+ width: 100% !important;
+}
\ No newline at end of file
diff --git a/src/components/TableBody/TableHeader.vue b/src/components/TableBody/TableHeader.vue
index 9dff5a1..d864c9d 100644
--- a/src/components/TableBody/TableHeader.vue
+++ b/src/components/TableBody/TableHeader.vue
@@ -17,7 +17,7 @@
详情
+ v-permission="tableHeader[2]?.detail" @click="emit('handle', 'detail')" :key="index">详情
-
-
-
-
- {{ currentData }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+};
+// 表格分页事件
+const handleTablePagination = (current) => {
+ console.log(current);
+};
+
+// 搜索
+const handleSearch = (val) => {
+ reqParams.name = val.value;
+ init();
+};
+
+// 新增
+const handleCreate = () => {
+ formDialogStatus.value = 'create'
+ FormDialogData.title = '新增'
+ FormDialogData.formJsonData = {}
+ formDialog.value = true
+};
+const fromId = ref('')
+// 编辑
+const handleEdit = (val) => {
+ console.log('val', val);
+ formDialogStatus.value = 'edit'
+ const id = val[0].id
+ FormDialogData.title = '编辑'
+ http.get(`/api/system/metadata/${id}`).then(response => {
+ FormDialogData.formJsonData = response.data
+ formDialog.value = true
+ })
+};
+
+// 删除
+const handleDelete = (data) => {
+ const ids = data.map(item => {
+ return item.id
+ })
+ // http.post(`/api/config/removeBatch`, { ids }).then(res => {
+ // if (res.code == 200) {
+ // ElMessage({
+ // message: '删除成功',
+ // type: 'success',
+ // })
+ // init()
+ // }
+ // })
+}
+
+// 详情
+const handleDetail = (val) => {
+ console.log('val', val);
+ formDialogStatus.value = 'detail'
+ const id = val[0].id
+ FormDialogData.title = '详情'
+ http.get(`/api/system/metadata/${id}`).then(response => {
+ console.log('response', response);
+ FormDialogData.formJsonData = response.data
+ formDialog.value = true
+ FormDialogData.formJosnDisabled = true
+ })
+}
+
+// 清空混合搜索
+// TableBodyRef.value.clearMixInput()
+
+// 清空搜索
+// TableBodyRef.value.clearSearch()
+
+/* 表单弹框 */
+const formDialog = ref(false)
+const formDialogStatus = ref('')
+const FormDialogData = reactive({
+ title: '新增', // String | 必填 | 标题
+ width: '50%', // String | 默认值 30% | 弹框宽度
+ formType: 'json', // 'slot' 默认为 slot | 'json' (后台接口返回就配置 json)
+ // 注意:以下配置为 json 时才有效
+ formJosnRules: {
+ deptId: [
+ { required: true, message: '请选择所属部门', trigger: 'blur' },
+ ],
+ projectId: [
+ { required: true, message: '请填写所属项目', trigger: 'blur' },
+ ],
+ name: [
+ { required: true, message: '请填写中文表名', trigger: 'blur' },
+ ],
+ ename: [
+ { required: true, message: '请填写英文表名', trigger: 'blur' },
+ ],
+ intro: [
+ { required: true, message: '请填写简介', trigger: 'blur' },
+ ],
+ state: [
+ { required: true, message: '请选择配置状态', trigger: 'blur' },
+ ],
+ dataNum: [
+ { required: true, message: '请填写数据量', trigger: 'blur' },
+ ],
+ }, // 默认为{},表单校验规则
+ formJosnLabelWidth: 'auto', // 默认为 120px,表单 label 宽度
+ // form 元素
+ formJosnElement: [
+ {
+ type: 'tree-select', // 元素类型
+ cloSpan: 12, // 栅格布局所占份数 (默认24)
+ disabled: false, // 元素是否禁用(默认为false)
+ label: '所属部门', // 元素的 label
+ placeholder: '请选择所属部门', // 元素的 placeholder
+ model: 'deptId', // 元素 form 的 key
+ options: bmOptions // type 为 select 生效 (默认为 [] )
+ },
+ {
+ type: 'input', // 元素类型
+ cloSpan: 12, // 栅格布局所占份数 (默认24)
+ disabled: false, // 元素是否禁用(默认为false)
+ label: '所属项目', // 元素的 label
+ placeholder: '请填写所属项目', // 元素的 placeholder
+ model: 'projectId', // 元素 form 的 key
+ },
+ {
+ type: 'input', // 元素类型
+ cloSpan: 12, // 栅格布局所占份数 (默认24)
+ disabled: false, // 元素是否禁用(默认为false)
+ label: '中文表名', // 元素的 label
+ placeholder: '请填写中文表名', // 元素的 placeholder
+ model: 'name', // 元素 form 的 key
+ },
+ {
+ type: 'input', // 元素类型
+ cloSpan: 12, // 栅格布局所占份数 (默认24)
+ disabled: false, // 元素是否禁用(默认为false)
+ label: '英文表名', // 元素的 label
+ placeholder: '请填写英文表名', // 元素的 placeholder
+ model: 'ename', // 元素 form 的 key
+ },
+ {
+ type: 'input', // 元素类型
+ cloSpan: 12, // 栅格布局所占份数 (默认24)
+ disabled: false, // 元素是否禁用(默认为false)
+ label: '简介', // 元素的 label
+ placeholder: '请填写简介', // 元素的 placeholder
+ model: 'intro', // 元素 form 的 key
+ },
+ {
+ type: 'select', // 元素类型
+ cloSpan: 12, // 栅格布局所占份数 (默认24)
+ disabled: false, // 元素是否禁用(默认为false)
+ label: '配置状态', // 元素的 label
+ placeholder: '请选择配置状态', // 元素的 placeholder
+ model: 'state', // 元素 form 的 key
+ options: [
+ {
+ label: '启用',
+ value: "1",
+ },
+ {
+ label: '未启用',
+ value: "0",
+ },
+ ] // type 为 select 生效 (默认为 [] )
+ },
+
+ {
+ type: 'number', // 元素类型
+ cloSpan: 12, // 栅格布局所占份数 (默认24)
+ disabled: false, // 元素是否禁用(默认为false)
+ label: '数据量', // 元素的 label
+ placeholder: '请填写数据量', // 元素的 placeholder
+ model: 'dataNum', // 元素 form 的 key
+ },
+ ],
+ formJosnDisabled: false, // 表单是否禁用
+ formJsonData: {}, // 新增或者编辑表单值 (编辑必须传)
+})
+
+
+const handleSubmit = (formJsonValue) => {
+ console.log(formJsonValue)
+ switch (formDialogStatus.value) {
+ case 'create':
+ http.post(`/api/system/metadata`, formJsonValue).then(response => {
+ if (response.code == 200) {
+ ElMessage({
+ message: '新增成功',
+ type: 'success',
+ })
+ init()
+ formDialog.value = false
+ }
+ })
+ break;
+ case 'edit':
+ formJsonValue.id = formJsonValue.id
+ http.post(`/api/system/metadata`, formJsonValue).then(response => {
+ if (response.code == 200) {
+ ElMessage({
+ message: '编辑成功',
+ type: 'success',
+ })
+ fromId.value = ''
+ init()
+ formDialog.value = false
+ }
+ })
+ break;
+ default:
+ break;
+ }
+}
+
+
+/* 请求参数 */
+const reqParams = reactive({
+ page: data.pagination.current,
+ size: data.pagination.pageSize,
+ deptId: undefined,
+ projectId: undefined,// 项目id
+ name: undefined,// 表中文名
+ ename: undefined, //表英文名
+})
+
+const handleMixInput = (val) => {
+ reqParams.name = undefined
+ reqParams.ename = undefined
+ if (val.seachMixSelect.value === '' || val.seachMixInput.value === '') {
+ init()
+ return
+ }
+ reqParams[val.seachMixSelect.value] = val.seachMixInput.value
+ init()
+}
+
+// 请求
+const init = () => {
+ data.tableType.tableLoading = true
+ http.get(`/api/system/metadata`, reqParams).then(res => {
+ if (res.code == 200) {
+ console.log(res.data)
+ data.tableData = res.data.rows
+ data.tableType.tableLoading = false
+ data.pagination.total = res.data.count
+ }
+ }).catch(() => {
+ data.tableType.tableLoading = false
+ })
+}
+
+onMounted(() => {
+ init()
+})
+
+
diff --git a/vite.config.js b/vite.config.js
index 83d4d6c..25bf35a 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -29,9 +29,9 @@ export default defineConfig({
'/api': {
// target: 'http://10.0.0.29:9999',
// target: 'https://fywz.btdit.cn/',
- target: 'http://10.0.0.74:7777/', // 刘进
+ target: 'http://10.0.0.65:7777/', // 刘进
changeOrigin: true,
- rewrite: (path) => path.replace(/^\/api/, '')
+ // rewrite: (path) => path.replace(/^\/api/, '')
// ws: true,// 开启webSocket
}
}