refactor: 项目简化

Former-commit-id: 73a4a6c9c41e013928e6205dd7c078d0e955f487
This commit is contained in:
horizons
2022-09-13 07:44:55 +08:00
parent 90c6059f3f
commit 81d7880ebc
64 changed files with 204 additions and 5279 deletions

View File

@@ -1,6 +1,6 @@
<script lang="ts">
export default {
name: 'dictItem',
name: 'dictItem'
};
</script>
@@ -10,8 +10,8 @@ import { ElForm, ElMessage, ElMessageBox } from 'element-plus';
import {
DictItem,
DictItemFormData,
DictItemQueryParam,
} from '@/types/api/system/dict';
DictItemQueryParam
} from '@/types/api/dict';
import { Dialog } from '@/types/common';
import {
@@ -19,8 +19,8 @@ import {
getDictItemData,
addDictItem,
updateDictItem,
deleteDictItems,
} from '@/api/system/dict';
deleteDictItems
} from '@/api/dict';
import { Search, Plus, Edit, Refresh, Delete } from '@element-plus/icons-vue';
const props = defineProps({
@@ -28,19 +28,19 @@ const props = defineProps({
type: String,
default: () => {
return '';
},
}
},
typeName: {
type: String,
default: () => {
return '';
},
},
}
}
});
watch(
() => props.typeCode,
(value) => {
value => {
state.queryParams.typeCode = value;
state.formData.typeCode = value;
handleQuery();
@@ -66,14 +66,14 @@ const state = reactive({
typeCode: props.typeCode,
typeName: props.typeName,
status: 1,
sort: 1,
sort: 1
} as DictItemFormData,
rules: {
name: [{ required: true, message: '请输入字典项名称', trigger: 'blur' }],
value: [{ required: true, message: '请输入字典项值', trigger: 'blur' }],
value: [{ required: true, message: '请输入字典项值', trigger: 'blur' }]
},
localDictCode: props.typeCode,
localDictName: props.typeName,
localDictName: props.typeName
});
const {
@@ -84,7 +84,7 @@ const {
dialog,
formData,
rules,
total,
total
} = toRefs(state);
function handleQuery() {
@@ -121,14 +121,14 @@ function handleAdd() {
}
state.dialog = {
title: '添加字典数据项',
visible: true,
visible: true
};
}
function handleUpdate(row: any) {
state.dialog = {
title: '修改字典数据项',
visible: true,
visible: true
};
const id = row.id || state.ids;
getDictItemData(id).then(({ data }) => {
@@ -167,7 +167,7 @@ function handleDelete(row: any) {
ElMessageBox.confirm('确认删除已选中的数据项?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
type: 'warning'
})
.then(() => {
deleteDictItems(ids).then(() => {

View File

@@ -1,6 +1,6 @@
<script lang="ts">
export default {
name: 'dictType',
name: 'dictType'
};
</script>
@@ -135,17 +135,13 @@ import {
getDictFormData,
addDictType,
updateDictType,
deleteDictTypes,
} from '@/api/system/dict';
deleteDictTypes
} from '@/api/dict';
import { Search, Plus, Edit, Refresh, Delete } from '@element-plus/icons-vue';
import { ElForm, ElMessage, ElMessageBox } from 'element-plus';
import { Dialog } from '@/types/common';
import {
Dict,
DictFormTypeData,
DictQueryParam,
} from '@/types/api/system/dict';
import { Dict, DictFormTypeData, DictQueryParam } from '@/types/api/dict';
const queryFormRef = ref(ElForm);
const dataFormRef = ref(ElForm);
@@ -162,18 +158,18 @@ const state = reactive({
multiple: true,
queryParams: {
pageNum: 1,
pageSize: 10,
pageSize: 10
} as DictQueryParam,
dictList: [] as Dict[],
total: 0,
dialog: { visible: false } as Dialog,
formData: {
status: 1,
status: 1
} as DictFormTypeData,
rules: {
name: [{ required: true, message: '请输入字典名称', trigger: 'blur' }],
code: [{ required: true, message: '请输入字典编码', trigger: 'blur' }],
},
code: [{ required: true, message: '请输入字典编码', trigger: 'blur' }]
}
});
const { total, dialog, loading, dictList, formData, rules, queryParams } =
@@ -203,14 +199,14 @@ function handleSelectionChange(selection: any) {
function handleAdd() {
state.dialog = {
title: '添加字典',
visible: true,
visible: true
};
}
function handleUpdate(row: any) {
state.dialog = {
title: '修改字典',
visible: true,
visible: true
};
const id = row.id || state.ids;
getDictFormData(id).then(({ data }) => {
@@ -249,7 +245,7 @@ function handleDelete(row: any) {
ElMessageBox.confirm('确认删除已选中的数据项?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
type: 'warning'
})
.then(() => {
deleteDictTypes(ids).then(() => {