陶杰
2024-08-22 4aa0bd47801606b4d0e0a6a2ed8fe92a7e5f2444
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
import http from './http'
import dicts from './dicts.js'
import util from './util.js'
 
const httpCommon = {
     
    async queryDict(spacecode,parentCode) {
        const {
            code,
            data
        } = await http.commonPage('spacedict', {
            current: 1,
            size: 100,
            // type:dicts.UserType
            parentCode: parentCode || '',
            spacecode:spacecode||''
        })
        var options = []
    
        if (code == 0) {
            if (data.records) {
                for (var item of data.records) {
                    options.push(item)
                }
            }
        }
        return options
    },
    
    async queryMetaByType(type) {
        // console.log('type?', type)
        const {
            code,
            data
        } = await http.request('get', 'api/v1.0/spacedictmeta/type-list', {
            params: {
                type: type
            }
        })
        var options = []
        if (code == 0) {
            if (data) {
                for (var item of data) {
                    // console.log('item',item)
                    options.push({
                        label: item.name,
                        value: item.code
                    })
                }
            }
        }
        return options
    },
 
}
export default httpCommon