This commit is contained in:
aixianling
2023-01-11 10:20:14 +08:00
parent 565d053224
commit 5aff9d6bc2
2 changed files with 17 additions and 5 deletions

View File

@@ -32,7 +32,7 @@
</el-form-item> </el-form-item>
</div> </div>
<el-form-item label="所属村" prop="areaId"> <el-form-item label="所属村" prop="areaId">
<ai-area-get :instance="instance" v-model="formData.areaId" :name.sync="formData.areaName" /> <ai-area-get :root="sys.areaId" :instance="instance" v-model="formData.areaId" :name.sync="formData.areaName" />
</el-form-item> </el-form-item>
</template> </template>
</ai-card> </ai-card>
@@ -203,7 +203,7 @@ export default {
} }
}, },
computed: { computed: {
...mapState(['user']), ...mapState(['user','sys']),
isEdit() { isEdit() {
return !!this.params.id return !!this.params.id

View File

@@ -5,7 +5,10 @@ import Vue from "vue"
export const sys = { export const sys = {
state: () => ({ state: () => ({
info: {}, info: {},
theme: {} theme: {},
location: {},
areaId: "",
areaName: ""
}), }),
mutations: { mutations: {
setSysInfo(state, info) { setSysInfo(state, info) {
@@ -13,17 +16,26 @@ export const sys = {
}, },
setTheme(state, theme) { setTheme(state, theme) {
state.theme = theme state.theme = theme
},
setLocation(state, location) {
state.location = location
},
setArea(state, area) {
state.areaId = area.areaId
state.areaName = area.areaName
} }
}, },
actions: { actions: {
getSystem({commit}, info) { getSystem({commit}, info) {
return http.post("/app/appdvcpconfig/getSystemInfo", null, {withoutToken: true}).then(res => { return http.post("/app/appdvcpconfig/getSystemInfo", null, {withoutToken: true}).then(res => {
if (res?.data) { if (res?.data) {
let {systemInfo, colorScheme, enableGreyFilter} = res.data let {systemInfo, colorScheme, enableGreyFilter, location, areaId, areaName} = res.data
systemInfo = JSON.parse(systemInfo || null) || {} systemInfo = JSON.parse(systemInfo || null) || {}
colorScheme = JSON.parse(colorScheme || null) || {} colorScheme = JSON.parse(colorScheme || null) || {}
commit("setSysInfo", {...info, ...systemInfo}) commit("setSysInfo", {...info, ...systemInfo})
commit("setTheme", {colorScheme, enableGreyFilter}) commit("setTheme", {colorScheme, enableGreyFilter})
commit("setLocation", location)
commit("setArea", {areaId, areaName})
return res.data return res.data
} else return Promise.reject() } else return Promise.reject()
}).catch(() => commit("setSysInfo", info)) }).catch(() => commit("setSysInfo", info))
@@ -53,7 +65,7 @@ export const user = {
setUserExtra(state, extra = {}) { setUserExtra(state, extra = {}) {
Object.keys(extra).map(e => Vue.set(state, e, extra[e])) Object.keys(extra).map(e => Vue.set(state, e, extra[e]))
}, },
setRoutes(state,routes){ setRoutes(state, routes) {
state.routes = routes state.routes = routes
} }
}, },