修改店铺信息后, 更新其他页面上的店铺信息
This commit is contained in:
parent
23df15dfad
commit
fab2137eb4
@ -403,7 +403,7 @@ import { IShopData } from '@/api/types'
|
|||||||
import { ElTree } from 'element-ui/types/tree'
|
import { ElTree } from 'element-ui/types/tree'
|
||||||
import { UserModule } from '@/store/modules/user'
|
import { UserModule } from '@/store/modules/user'
|
||||||
import UploadCorpImage from '@/components/UploadCorpImage/index.vue'
|
import UploadCorpImage from '@/components/UploadCorpImage/index.vue'
|
||||||
import { EVENT_ACTIVITY_UPDATE, EVENT_COUPON_UPDATE, EventBus } from '@/utils/event-bus'
|
import { EVENT_ACTIVITY_UPDATE, EVENT_COUPON_UPDATE, EVENT_SHOP_UPDATE, EventBus } from '@/utils/event-bus'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
name: 'ActivityEditor',
|
name: 'ActivityEditor',
|
||||||
@ -509,6 +509,9 @@ export default class extends Vue {
|
|||||||
}
|
}
|
||||||
if (UserModule.level === 1) {
|
if (UserModule.level === 1) {
|
||||||
await this.getRemoteDeptList()
|
await this.getRemoteDeptList()
|
||||||
|
EventBus.$on(EVENT_SHOP_UPDATE, () => {
|
||||||
|
this.getRemoteDeptList()
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
this.postForm.shop = UserModule.department
|
this.postForm.shop = UserModule.department
|
||||||
await this.fetchMyShop()
|
await this.fetchMyShop()
|
||||||
@ -524,6 +527,9 @@ export default class extends Vue {
|
|||||||
|
|
||||||
beforeDestory() {
|
beforeDestory() {
|
||||||
EventBus.$off(EVENT_COUPON_UPDATE)
|
EventBus.$off(EVENT_COUPON_UPDATE)
|
||||||
|
if (UserModule.level === 1) {
|
||||||
|
EventBus.$off(EVENT_SHOP_UPDATE)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async fetchData(id: string) {
|
private async fetchData(id: string) {
|
||||||
|
@ -139,7 +139,7 @@ import { parseTime } from '@/utils'
|
|||||||
import { getAllCategory, getAllTags } from '@/api/question'
|
import { getAllCategory, getAllTags } from '@/api/question'
|
||||||
import { deleteActivity, getActivitys, publishActivity, IActivityData } from '@/api/activity'
|
import { deleteActivity, getActivitys, publishActivity, IActivityData } from '@/api/activity'
|
||||||
import { UserModule } from '@/store/modules/user'
|
import { UserModule } from '@/store/modules/user'
|
||||||
import { EVENT_ACTIVITY_UPDATE, EVENT_SHOP_PUZZLES_UPDATE, EventBus } from '@/utils/event-bus'
|
import { EVENT_ACTIVITY_UPDATE, EVENT_SHOP_PUZZLES_UPDATE, EVENT_SHOP_UPDATE, EventBus } from '@/utils/event-bus'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
name: 'ActivityList',
|
name: 'ActivityList',
|
||||||
@ -196,6 +196,9 @@ export default class extends Vue {
|
|||||||
async created() {
|
async created() {
|
||||||
if (UserModule.level === 1) {
|
if (UserModule.level === 1) {
|
||||||
await this.getRemoteDeptList()
|
await this.getRemoteDeptList()
|
||||||
|
EventBus.$on(EVENT_SHOP_UPDATE, () => {
|
||||||
|
this.getRemoteDeptList()
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
this.filterForm.shop = UserModule.department
|
this.filterForm.shop = UserModule.department
|
||||||
this.listQuery.shop = UserModule.department
|
this.listQuery.shop = UserModule.department
|
||||||
@ -209,6 +212,9 @@ export default class extends Vue {
|
|||||||
|
|
||||||
beforeDestory() {
|
beforeDestory() {
|
||||||
EventBus.$off(EVENT_ACTIVITY_UPDATE)
|
EventBus.$off(EVENT_ACTIVITY_UPDATE)
|
||||||
|
if (UserModule.level === 1) {
|
||||||
|
EventBus.$off(EVENT_SHOP_UPDATE)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getList() {
|
private async getList() {
|
||||||
|
@ -305,6 +305,7 @@ import { cloneDeep } from 'lodash'
|
|||||||
import { UserModule } from '@/store/modules/user'
|
import { UserModule } from '@/store/modules/user'
|
||||||
import { IShopData } from '@/api/types'
|
import { IShopData } from '@/api/types'
|
||||||
import { getShops } from '@/api/shop'
|
import { getShops } from '@/api/shop'
|
||||||
|
import { EVENT_SHOP_UPDATE, EventBus } from '@/utils/event-bus'
|
||||||
|
|
||||||
declare module 'vue/types/vue' {
|
declare module 'vue/types/vue' {
|
||||||
interface Vue {
|
interface Vue {
|
||||||
@ -361,11 +362,20 @@ export default class extends Vue {
|
|||||||
async created() {
|
async created() {
|
||||||
if (UserModule.level === 1) {
|
if (UserModule.level === 1) {
|
||||||
await this.getRemoteDeptList()
|
await this.getRemoteDeptList()
|
||||||
|
EventBus.$on(EVENT_SHOP_UPDATE, () => {
|
||||||
|
this.getRemoteDeptList()
|
||||||
|
})
|
||||||
} else if (UserModule.department) {
|
} else if (UserModule.department) {
|
||||||
this.shop = UserModule.department
|
this.shop = UserModule.department
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
beforeDestory() {
|
||||||
|
if (UserModule.level === 1) {
|
||||||
|
EventBus.$off(EVENT_SHOP_UPDATE)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private modalRules = {
|
private modalRules = {
|
||||||
question: [{ required: true, message: '请输入题目', trigger: 'blur' },
|
question: [{ required: true, message: '请输入题目', trigger: 'blur' },
|
||||||
{ min: 2, max: 35, message: '长度在 2 到 35 个字符', trigger: 'blur' }],
|
{ min: 2, max: 35, message: '长度在 2 到 35 个字符', trigger: 'blur' }],
|
||||||
|
@ -319,7 +319,7 @@ import { UserModule } from '@/store/modules/user'
|
|||||||
import { defaultRewardData, IRewardData } from '@/api/activity'
|
import { defaultRewardData, IRewardData } from '@/api/activity'
|
||||||
import PuzzleList from './components/PuzzleList.vue'
|
import PuzzleList from './components/PuzzleList.vue'
|
||||||
import UploadCorpImage from '@/components/UploadCorpImage/index.vue'
|
import UploadCorpImage from '@/components/UploadCorpImage/index.vue'
|
||||||
import { EVENT_COUPON_UPDATE, EVENT_EXAM_UPDATE, EventBus } from '@/utils/event-bus'
|
import { EVENT_COUPON_UPDATE, EVENT_EXAM_UPDATE, EVENT_SHOP_UPDATE, EventBus } from '@/utils/event-bus'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
name: 'ExamEditor',
|
name: 'ExamEditor',
|
||||||
@ -407,6 +407,9 @@ export default class extends Vue {
|
|||||||
}
|
}
|
||||||
if (UserModule.level === 1) {
|
if (UserModule.level === 1) {
|
||||||
await this.getRemoteDeptList()
|
await this.getRemoteDeptList()
|
||||||
|
EventBus.$on(EVENT_SHOP_UPDATE, () => {
|
||||||
|
this.getRemoteDeptList()
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
this.postForm.shop = UserModule.department
|
this.postForm.shop = UserModule.department
|
||||||
await this.fetchMyShop()
|
await this.fetchMyShop()
|
||||||
@ -422,6 +425,9 @@ export default class extends Vue {
|
|||||||
|
|
||||||
beforeDestory() {
|
beforeDestory() {
|
||||||
EventBus.$off(EVENT_COUPON_UPDATE)
|
EventBus.$off(EVENT_COUPON_UPDATE)
|
||||||
|
if (UserModule.level === 1) {
|
||||||
|
EventBus.$off(EVENT_SHOP_UPDATE)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async fetchData(id: string) {
|
private async fetchData(id: string) {
|
||||||
|
@ -137,7 +137,7 @@ import { parseTime } from '@/utils'
|
|||||||
import { getAllCategory, getAllTags, IQuestionData } from '@/api/question'
|
import { getAllCategory, getAllTags, IQuestionData } from '@/api/question'
|
||||||
import { deleteExam, getExams } from '@/api/exam'
|
import { deleteExam, getExams } from '@/api/exam'
|
||||||
import { UserModule } from '@/store/modules/user'
|
import { UserModule } from '@/store/modules/user'
|
||||||
import { EVENT_EXAM_UPDATE, EVENT_SHOP_PUZZLES_UPDATE, EventBus } from '@/utils/event-bus'
|
import { EVENT_EXAM_UPDATE, EVENT_SHOP_PUZZLES_UPDATE, EVENT_SHOP_UPDATE, EventBus } from '@/utils/event-bus'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
name: 'ExamList',
|
name: 'ExamList',
|
||||||
@ -193,6 +193,9 @@ export default class extends Vue {
|
|||||||
async created() {
|
async created() {
|
||||||
if (UserModule.level === 1) {
|
if (UserModule.level === 1) {
|
||||||
await this.getRemoteDeptList()
|
await this.getRemoteDeptList()
|
||||||
|
EventBus.$on(EVENT_SHOP_UPDATE, () => {
|
||||||
|
this.getRemoteDeptList()
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
this.filterForm.shop = UserModule.department
|
this.filterForm.shop = UserModule.department
|
||||||
this.listQuery.shop = UserModule.department
|
this.listQuery.shop = UserModule.department
|
||||||
@ -206,6 +209,9 @@ export default class extends Vue {
|
|||||||
|
|
||||||
beforeDestory() {
|
beforeDestory() {
|
||||||
EventBus.$off(EVENT_EXAM_UPDATE)
|
EventBus.$off(EVENT_EXAM_UPDATE)
|
||||||
|
if (UserModule.level === 1) {
|
||||||
|
EventBus.$off(EVENT_SHOP_UPDATE)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getList() {
|
private async getList() {
|
||||||
|
@ -114,6 +114,7 @@ import {
|
|||||||
saveShopGameInfo
|
saveShopGameInfo
|
||||||
} from '@/api/shop'
|
} from '@/api/shop'
|
||||||
import { UserModule } from '@/store/modules/user'
|
import { UserModule } from '@/store/modules/user'
|
||||||
|
import { EVENT_SHOP_UPDATE, EventBus } from '@/utils/event-bus'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
name: 'GameSetting',
|
name: 'GameSetting',
|
||||||
@ -156,11 +157,20 @@ export default class extends Vue {
|
|||||||
await this.getList()
|
await this.getList()
|
||||||
if (UserModule.level === 1) {
|
if (UserModule.level === 1) {
|
||||||
await this.getRemoteDeptList('')
|
await this.getRemoteDeptList('')
|
||||||
|
EventBus.$on(EVENT_SHOP_UPDATE, () => {
|
||||||
|
this.getRemoteDeptList()
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
this.shop = UserModule.department
|
this.shop = UserModule.department
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
beforeDestory() {
|
||||||
|
if (UserModule.level === 1) {
|
||||||
|
EventBus.$off(EVENT_SHOP_UPDATE)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Watch('shop')
|
@Watch('shop')
|
||||||
private onShopChange() {
|
private onShopChange() {
|
||||||
if (this.shop) {
|
if (this.shop) {
|
||||||
@ -224,7 +234,7 @@ export default class extends Vue {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getRemoteDeptList(name: string) {
|
private async getRemoteDeptList(name?: string) {
|
||||||
if (UserModule.level > 1) {
|
if (UserModule.level > 1) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ import { getShops } from '@/api/shop'
|
|||||||
import { parseTime } from '@/utils'
|
import { parseTime } from '@/utils'
|
||||||
import { deleteCoupon, getCoupons } from '@/api/coupon'
|
import { deleteCoupon, getCoupons } from '@/api/coupon'
|
||||||
import { UserModule } from '@/store/modules/user'
|
import { UserModule } from '@/store/modules/user'
|
||||||
import { EVENT_COUPON_UPDATE, EventBus } from '@/utils/event-bus'
|
import { EVENT_COUPON_UPDATE, EVENT_SHOP_UPDATE, EventBus } from '@/utils/event-bus'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
name: 'CouponList',
|
name: 'CouponList',
|
||||||
@ -187,6 +187,9 @@ export default class extends Vue {
|
|||||||
async created() {
|
async created() {
|
||||||
if (UserModule.level === 1) {
|
if (UserModule.level === 1) {
|
||||||
await this.getRemoteDeptList()
|
await this.getRemoteDeptList()
|
||||||
|
EventBus.$on(EVENT_SHOP_UPDATE, () => {
|
||||||
|
this.getRemoteDeptList()
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
this.filterForm.department = UserModule.department
|
this.filterForm.department = UserModule.department
|
||||||
this.listQuery.shop = UserModule.department
|
this.listQuery.shop = UserModule.department
|
||||||
@ -208,6 +211,9 @@ export default class extends Vue {
|
|||||||
|
|
||||||
beforeDestory() {
|
beforeDestory() {
|
||||||
EventBus.$off(EVENT_COUPON_UPDATE)
|
EventBus.$off(EVENT_COUPON_UPDATE)
|
||||||
|
if (UserModule.level === 1) {
|
||||||
|
EventBus.$off(EVENT_SHOP_UPDATE)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async handleDelete(scope: any) {
|
private async handleDelete(scope: any) {
|
||||||
|
@ -134,7 +134,7 @@ import Tinymce from '@/components/Tinymce/index.vue'
|
|||||||
import { getShops } from '@/api/shop'
|
import { getShops } from '@/api/shop'
|
||||||
import { defaultCouponData, getCoupon, saveCoupon } from '@/api/coupon'
|
import { defaultCouponData, getCoupon, saveCoupon } from '@/api/coupon'
|
||||||
import { UserModule } from '@/store/modules/user'
|
import { UserModule } from '@/store/modules/user'
|
||||||
import { EVENT_COUPON_UPDATE, EVENT_SHOP_PUZZLES_UPDATE, EventBus } from '@/utils/event-bus'
|
import { EVENT_COUPON_UPDATE, EVENT_SHOP_PUZZLES_UPDATE, EVENT_SHOP_UPDATE, EventBus } from '@/utils/event-bus'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
name: 'CouponEditor',
|
name: 'CouponEditor',
|
||||||
@ -194,6 +194,9 @@ export default class extends Vue {
|
|||||||
const id = this.$route.params?.id
|
const id = this.$route.params?.id
|
||||||
if (UserModule.level === 1) {
|
if (UserModule.level === 1) {
|
||||||
this.getRemoteDeptList('')
|
this.getRemoteDeptList('')
|
||||||
|
EventBus.$on(EVENT_SHOP_UPDATE, () => {
|
||||||
|
this.getRemoteDeptList()
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
this.postForm.shop = UserModule.department
|
this.postForm.shop = UserModule.department
|
||||||
}
|
}
|
||||||
@ -203,6 +206,12 @@ export default class extends Vue {
|
|||||||
this.tempTagView = Object.assign({}, this.$route)
|
this.tempTagView = Object.assign({}, this.$route)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
beforeDestory() {
|
||||||
|
if (UserModule.level === 1) {
|
||||||
|
EventBus.$off(EVENT_SHOP_UPDATE)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Watch('dataRange')
|
@Watch('dataRange')
|
||||||
private onDataRangeChange(val: Date[]) {
|
private onDataRangeChange(val: Date[]) {
|
||||||
console.log(`onDataRangeChange ${val}`)
|
console.log(`onDataRangeChange ${val}`)
|
||||||
|
@ -251,12 +251,6 @@ export default class extends Vue {
|
|||||||
this.$refs.filterForm.resetFields()
|
this.$refs.filterForm.resetFields()
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getRemoteDeptList(name: string) {
|
|
||||||
const { data } = await getShops({ key: name })
|
|
||||||
if (!data.records) return
|
|
||||||
this.allDepts = data.records
|
|
||||||
}
|
|
||||||
|
|
||||||
private async getRemoteTags() {
|
private async getRemoteTags() {
|
||||||
const { data } = await getAllTags()
|
const { data } = await getAllTags()
|
||||||
console.log(data)
|
console.log(data)
|
||||||
|
@ -57,6 +57,7 @@ import { getAllCategory } from '@/api/question'
|
|||||||
import { ElTree } from 'element-ui/types/tree'
|
import { ElTree } from 'element-ui/types/tree'
|
||||||
import { IShopData } from '@/api/types'
|
import { IShopData } from '@/api/types'
|
||||||
import { UserModule } from '@/store/modules/user'
|
import { UserModule } from '@/store/modules/user'
|
||||||
|
import { EVENT_COUPON_UPDATE, EVENT_SHOP_UPDATE, EventBus } from '@/utils/event-bus'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
name: 'QuestionSetting',
|
name: 'QuestionSetting',
|
||||||
@ -92,7 +93,10 @@ export default class extends Vue {
|
|||||||
async created() {
|
async created() {
|
||||||
await this.getRemoteCategory()
|
await this.getRemoteCategory()
|
||||||
if (UserModule.level === 1) {
|
if (UserModule.level === 1) {
|
||||||
await this.getRemoteDeptList('')
|
await this.getRemoteDeptList()
|
||||||
|
EventBus.$on(EVENT_SHOP_UPDATE, () => {
|
||||||
|
this.getRemoteDeptList()
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
this.shop = UserModule.department
|
this.shop = UserModule.department
|
||||||
await this.fetchMyShop()
|
await this.fetchMyShop()
|
||||||
@ -100,6 +104,12 @@ export default class extends Vue {
|
|||||||
this.loading = false
|
this.loading = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
beforeDestory() {
|
||||||
|
if (UserModule.level === 1) {
|
||||||
|
EventBus.$off(EVENT_SHOP_UPDATE)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Watch('shop')
|
@Watch('shop')
|
||||||
private onShopChange() {
|
private onShopChange() {
|
||||||
if (this.shop && UserModule.level === 1) {
|
if (this.shop && UserModule.level === 1) {
|
||||||
@ -120,7 +130,7 @@ export default class extends Vue {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getRemoteDeptList(name: string) {
|
private async getRemoteDeptList(name?: string) {
|
||||||
const { data } = await getShops({ key: name })
|
const { data } = await getShops({ key: name })
|
||||||
if (!data.records) return
|
if (!data.records) return
|
||||||
this.allDepts = data.records
|
this.allDepts = data.records
|
||||||
|
@ -157,7 +157,7 @@ import { IQuestionData } from '@/api/question'
|
|||||||
import { UserModule } from '@/store/modules/user'
|
import { UserModule } from '@/store/modules/user'
|
||||||
import { deleteShopQuestion, getShopCategory, getShopQuestions } from '@/api/shoppuzzle'
|
import { deleteShopQuestion, getShopCategory, getShopQuestions } from '@/api/shoppuzzle'
|
||||||
import { IShopData } from '@/api/types'
|
import { IShopData } from '@/api/types'
|
||||||
import { EVENT_SHOP_PUZZLES_UPDATE, EventBus } from '@/utils/event-bus'
|
import { EVENT_SHOP_PUZZLES_UPDATE, EVENT_SHOP_UPDATE, EventBus } from '@/utils/event-bus'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
name: 'ShopPuzzles',
|
name: 'ShopPuzzles',
|
||||||
@ -217,6 +217,9 @@ export default class extends Vue {
|
|||||||
async created() {
|
async created() {
|
||||||
if (UserModule.level === 1) {
|
if (UserModule.level === 1) {
|
||||||
await this.getRemoteDeptList()
|
await this.getRemoteDeptList()
|
||||||
|
EventBus.$on(EVENT_SHOP_UPDATE, () => {
|
||||||
|
this.getRemoteDeptList()
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
this.filterForm.shop = UserModule.department
|
this.filterForm.shop = UserModule.department
|
||||||
this.listQuery.shop = UserModule.department
|
this.listQuery.shop = UserModule.department
|
||||||
@ -230,6 +233,9 @@ export default class extends Vue {
|
|||||||
|
|
||||||
beforeDestory() {
|
beforeDestory() {
|
||||||
EventBus.$off(EVENT_SHOP_PUZZLES_UPDATE)
|
EventBus.$off(EVENT_SHOP_PUZZLES_UPDATE)
|
||||||
|
if (UserModule.level === 1) {
|
||||||
|
EventBus.$off(EVENT_SHOP_UPDATE)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getList() {
|
private async getList() {
|
||||||
|
@ -237,6 +237,7 @@ export default class extends Vue {
|
|||||||
})
|
})
|
||||||
await updateShopPublish({ id: row._id, publish: !row.publish })
|
await updateShopPublish({ id: row._id, publish: !row.publish })
|
||||||
row.publish = !row.publish
|
row.publish = !row.publish
|
||||||
|
EventBus.$emit(EVENT_SHOP_UPDATE, {})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
}
|
}
|
||||||
|
@ -295,6 +295,7 @@ import { IRole } from '@/views/system/role.vue'
|
|||||||
import { IShopData } from '@/api/types'
|
import { IShopData } from '@/api/types'
|
||||||
import { UserModule } from '@/store/modules/user'
|
import { UserModule } from '@/store/modules/user'
|
||||||
import { getShops } from '@/api/shop'
|
import { getShops } from '@/api/shop'
|
||||||
|
import { EVENT_SHOP_UPDATE, EventBus } from '@/utils/event-bus'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
name: 'ShopAdmin',
|
name: 'ShopAdmin',
|
||||||
@ -353,9 +354,16 @@ export default class extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async created() {
|
async created() {
|
||||||
this.allDepts = await this.getRemoteDeptList('')
|
await this.getRemoteDeptList()
|
||||||
await this.getRecords()
|
await this.getRecords()
|
||||||
await this.getAllRole()
|
await this.getAllRole()
|
||||||
|
EventBus.$on(EVENT_SHOP_UPDATE, () => {
|
||||||
|
this.getRemoteDeptList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
beforeDestory() {
|
||||||
|
EventBus.$off(EVENT_SHOP_UPDATE)
|
||||||
}
|
}
|
||||||
|
|
||||||
private search() {
|
private search() {
|
||||||
@ -571,7 +579,7 @@ export default class extends Vue {
|
|||||||
const { data } = await getShops({ key: name })
|
const { data } = await getShops({ key: name })
|
||||||
if (!data.records) return
|
if (!data.records) return
|
||||||
this.deptListOptions = data.records
|
this.deptListOptions = data.records
|
||||||
return data.records
|
this.allDepts = data.records
|
||||||
}
|
}
|
||||||
|
|
||||||
private formatDept(row: any) {
|
private formatDept(row: any) {
|
||||||
|
@ -229,10 +229,8 @@
|
|||||||
>
|
>
|
||||||
<el-select
|
<el-select
|
||||||
v-model="record.department"
|
v-model="record.department"
|
||||||
:remote-method="getRemoteDeptList"
|
|
||||||
filterable
|
filterable
|
||||||
default-first-option
|
default-first-option
|
||||||
remote
|
|
||||||
placeholder=""
|
placeholder=""
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
@ -295,6 +293,8 @@ import {
|
|||||||
import { IRole } from '@/views/system/role.vue'
|
import { IRole } from '@/views/system/role.vue'
|
||||||
import { getShops } from '@/api/shop'
|
import { getShops } from '@/api/shop'
|
||||||
import { IShopData } from '@/api/types'
|
import { IShopData } from '@/api/types'
|
||||||
|
import { EVENT_SHOP_UPDATE, EventBus } from '@/utils/event-bus'
|
||||||
|
import { UserModule } from '@/store/modules/user'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
name: 'AdminSystem',
|
name: 'AdminSystem',
|
||||||
@ -349,9 +349,16 @@ export default class extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async created() {
|
async created() {
|
||||||
this.allDepts = await this.getRemoteDeptList('')
|
await this.getRemoteDeptList('')
|
||||||
await this.getRecords()
|
await this.getRecords()
|
||||||
await this.getAllRole()
|
await this.getAllRole()
|
||||||
|
EventBus.$on(EVENT_SHOP_UPDATE, () => {
|
||||||
|
this.getRemoteDeptList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
beforeDestory() {
|
||||||
|
EventBus.$off(EVENT_SHOP_UPDATE)
|
||||||
}
|
}
|
||||||
|
|
||||||
private search() {
|
private search() {
|
||||||
@ -556,11 +563,11 @@ export default class extends Vue {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getRemoteDeptList(name: string) {
|
private async getRemoteDeptList(name?: string) {
|
||||||
const { data } = await getShops({ key: name })
|
const { data } = await getShops({ key: name })
|
||||||
if (!data.records) return
|
if (!data.records) return
|
||||||
this.deptListOptions = data.records
|
this.deptListOptions = data.records
|
||||||
return data.records
|
this.allDepts = data.records
|
||||||
}
|
}
|
||||||
|
|
||||||
private formatDept(row: any) {
|
private formatDept(row: any) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user