test.vue
2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<template>
<eagle-scheme
:option="{ $http: $axios, url: '/dataDictionary', detailMethod: 'queryById', getMethod: 'queryById', editMethod: 'modify' }"
:list="schemeList"
:formProps="{ span: 24, 'label-width': '60px' }"
:detailProps="{ span: 24, 'label-width': '50px' }"
:dialogProps="dialogProps"
@dialog-change="handleDialogChange"
>
<el-table-column type="selection" width="50"></el-table-column>
</eagle-scheme>
</template>
<script>
export default {
name: 'test',
data() {
return {
schemeList: [
{ type: 'el-input', label: 'ID', key: 'id', include: 'form', visible: (model, { formMode } = {}) => { return formMode == 'edit' },
props: { disabled: true },
},
{ type: 'el-input', label: '编码', key: 'code', exclude: 'search',
rules: [{ required: true, message: '编码不能为空', trigger: 'blur' }],
props: { placeholder: '编码' },
},
{ type: 'el-input', label: '名称', key: 'name',
rules: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
props: { placeholder: '名称' },
},
{ type: 'el-input', label: '备注', key: 'remark', include: 'table',
props: { placeholder: '备注' },
},
],
dialogType: '',
}
},
computed: {
dialogProps() {
return { width: this.dialogType === 'dialog-form' ? '500px' : '400px' };
}
},
methods: {
async searchAPI(param) {
return this.$axios.get(`/dataDictionary/page?current=1&size=10`)
.then((response) => {
const { result = [], totalCount = 0 } = response || {};
return { result, totalCount };
}).catch(() => {
return {};
});
},
async getAPI(param) {
return this.$axios.get(`/dataDictionary/queryById?id=${param.id}`)
.then((response) => {
const { result = {} } = response || {};
return result;
}).catch(() => {
return {};
});
},
async newAPI(param) {
return this.$axios.post('/dataDictionary/add', param)
.then((response) => {
const { success = false } = response || {};
return success;
}).catch(() => {
return false;
});
},
async editAPI(param) {
return this.$axios.post('/dataDictionary/modify', param)
.then((response) => {
const { success = false } = response || {};
return success;
}).catch(() => {
return false;
});
},
async deleteAPI(param) {
return this.$axios.post('/dataDictionary/delete', param)
.then((response) => {
const { success = false } = response || {};
return success;
}).catch(() => {
return false;
});
},
handleDialogChange(type) {
this.dialogType = type;
}
}
}
</script>