You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
taicangZongzhi/src/store/modules/dict.js

54 lines
1.3 KiB

2 years ago
import { getDictList } from '@/api/zongzhi/common.js'
2 years ago
import { listTown } from '@/api/zongzhi/st.js'
2 years ago
const dict = {
state: {
2 years ago
dictObject: {},
townList: []
2 years ago
},
mutations: {
SET_DICT: (state, dict) => {
state.dictObject = dict
2 years ago
},
SET_TOWN: (state, town) => {
state.townList = town
2 years ago
}
},
actions: {
getDictType({ commit }) {
return new Promise((resolve, reject) => {
const query = {
2 years ago
list: 'sys_user_sex,tc_net_sx,tc_yq_media,tc_enter_type,tc_inlet_yewu,tc_item_type,tc_net_safety_level,tc_yes_no,tc_unit_type,tc_tmt_type,tc_net_safety_level,tc_db_steam_state,tc_attack_type'
2 years ago
}
getDictList(query)
.then((res) => {
commit('SET_DICT', res.data)
2 years ago
getownList().then((town) => {
commit('SET_TOWN', town)
resolve()
})
2 years ago
})
.catch((error) => {
reject(error)
})
})
}
}
}
2 years ago
// 获取各镇/村
function getownList() {
return new Promise((resolve, reject) => {
const lsit = []
listTown({ pageNum: 1, pageSize: 200 })
.then((res) => {
res.rows.forEach((item) => {
lsit.push({ value: item.id, label: item.name })
})
resolve(lsit)
})
.catch((error) => {
reject(error)
})
})
}
2 years ago
export default dict