xy 1 year ago
parent 6515819125
commit 4c7e3b3763

@ -7,7 +7,7 @@
<!-- </button>--> <!-- </button>-->
<div class="navbar-brand"> <div class="navbar-brand">
<router-link to="/"> <router-link to="/">
<img class="navbar-brand__img" :src="isEnvTest ? require('@/assets/title.png') : require('@/assets/title1.png')" alt=""> <img class="navbar-brand__img" :src="brandImg" alt="">
</router-link> </router-link>
</div> </div>
<div v-show="$route.path !== '/dashboard'" class="toggle-sidebar" @click="toggleIframeSidebarOpened"> <div v-show="$route.path !== '/dashboard'" class="toggle-sidebar" @click="toggleIframeSidebarOpened">
@ -146,7 +146,7 @@ export default {
isMenuScroll: false, isMenuScroll: false,
scrollOffset: 0, scrollOffset: 0,
scrollMaxWidth: 0, scrollMaxWidth: 0,
isEnvTest: (process.env.ENV === 'staging' || process.env.NODE_ENV === 'development'), brandImg: (process.env.ENV === 'staging' || process.env.NODE_ENV === 'development') ? require('@/assets/title.png') : require('@/assets/title1.png'),
zIndex: PopupManager.nextZIndex(), zIndex: PopupManager.nextZIndex(),
isFullscreen: false, isFullscreen: false,
isShowMenuMobile: false, isShowMenuMobile: false,

@ -134,7 +134,7 @@ export default {
}, },
created() { created() {
this.getNotices(true) this.getNotices(true)
setInterval(this.getNotices, 5000) this.timer = setInterval(this.getNotices, 5000)
}, },
beforeDestroy() { beforeDestroy() {
clearInterval(this.timer) clearInterval(this.timer)

@ -28,6 +28,8 @@
:column-config="{ resizable: true }" :column-config="{ resizable: true }"
:checkbox-config="{ trigger: 'row', highlight: true, reserve: true }" :checkbox-config="{ trigger: 'row', highlight: true, reserve: true }"
:data="tableData" :data="tableData"
@checkbox-change="checkboxChange"
@checkbox-all="checkAll"
> >
<vxe-column type="checkbox" width="60" fixed="left" /> <vxe-column type="checkbox" width="60" fixed="left" />
<vxe-column type="seq" width="58" align="center" /> <vxe-column type="seq" width="58" align="center" />
@ -95,8 +97,11 @@ export default {
}, },
computed: {}, computed: {},
watch: { watch: {
'form.user_ids': function(val, oldVal) { 'form.user_ids': {
this.setSelectRow() handler() {
this.setSelectRow()
},
deep: true
}, },
isShow(newVal) { isShow(newVal) {
if (newVal) { if (newVal) {
@ -130,6 +135,31 @@ export default {
} }
}) })
}, },
checkboxChange({ checked, row }) {
if (!checked) {
const index = this.form.user_ids.indexOf(row.id)
if (index !== -1) {
this.form.user_ids.splice(index, 1)
}
}
this.setFormUserIds()
},
checkAll({ checked }) {
if (!checked) {
const ids = this.tableData.map(i => i.id)
ids.forEach(id => {
const index = this.form.user_ids.indexOf(id)
if (index !== -1) {
this.form.user_ids.splice(index, 1)
}
})
}
this.setFormUserIds()
},
setFormUserIds() {
const selectRecords = this.$refs['table'].getCheckboxRecords()
this.form.user_ids = Array.from(new Set([...selectRecords.map(row => row.id), ...this.form.user_ids])).filter(i => !!i)
},
async getUsers() { async getUsers() {
this.tableLoading = true this.tableLoading = true
@ -138,6 +168,7 @@ export default {
this.tableData = res.data this.tableData = res.data
this.total = res.total this.total = res.total
this.tableLoading = false this.tableLoading = false
this.setSelectRow()
} catch (err) { } catch (err) {
this.tableLoading = false this.tableLoading = false
} }
@ -158,11 +189,10 @@ export default {
async submit() { async submit() {
if (this.$refs['table']) { if (this.$refs['table']) {
this.loading = true this.loading = true
const selectRecords = this.$refs['table'].getCheckboxRecords()
try { try {
batchUser({ batchUser({
id: this.form.id, id: this.form.id,
user_ids: Array.from(new Set([...selectRecords.map(row => row.id), ...this.form.user_ids])).filter(i => !!i) user_ids: this.form.user_ids
}) })
// //
setTimeout(() => { setTimeout(() => {

@ -28,6 +28,8 @@
:column-config="{ resizable: true }" :column-config="{ resizable: true }"
:checkbox-config="{ trigger: 'row', highlight: true, reserve: true }" :checkbox-config="{ trigger: 'row', highlight: true, reserve: true }"
:data="tableData" :data="tableData"
@checkbox-change="checkboxChange"
@checkbox-all="checkAll"
> >
<vxe-column type="checkbox" width="60" fixed="left" /> <vxe-column type="checkbox" width="60" fixed="left" />
<vxe-column type="seq" width="58" align="center" /> <vxe-column type="seq" width="58" align="center" />
@ -104,8 +106,11 @@ export default {
}, },
computed: {}, computed: {},
watch: { watch: {
'form.user_ids': function(val, oldVal) { 'form.user_ids': {
this.setSelectRow() handler() {
this.setSelectRow()
},
deep: true
}, },
isShow(newVal) { isShow(newVal) {
if (newVal) { if (newVal) {
@ -140,6 +145,31 @@ export default {
} }
}) })
}, },
checkboxChange({ checked, row }) {
if (!checked) {
const index = this.form.user_ids.indexOf(row.id)
if (index !== -1) {
this.form.user_ids.splice(index, 1)
}
}
this.setFormUserIds()
},
checkAll({ checked }) {
if (!checked) {
const ids = this.tableData.map(i => i.id)
ids.forEach(id => {
const index = this.form.user_ids.indexOf(id)
if (index !== -1) {
this.form.user_ids.splice(index, 1)
}
})
}
this.setFormUserIds()
},
setFormUserIds() {
const selectRecords = this.$refs['table'].getCheckboxRecords()
this.form.user_ids = Array.from(new Set([...selectRecords.map(row => row.id), ...this.form.user_ids])).filter(i => !!i)
},
async getUsers() { async getUsers() {
this.tableLoading = true this.tableLoading = true
@ -148,6 +178,7 @@ export default {
this.tableData = res.data this.tableData = res.data
this.total = res.total this.total = res.total
this.tableLoading = false this.tableLoading = false
this.setSelectRow()
} catch (err) { } catch (err) {
this.tableLoading = false this.tableLoading = false
} }
@ -169,12 +200,11 @@ export default {
async submit() { async submit() {
if (this.$refs['table']) { if (this.$refs['table']) {
this.loading = true this.loading = true
const selectRecords = this.$refs['table'].getCheckboxRecords()
try { try {
batchRoles({ batchRoles({
...this.form, ...this.form,
module_id: this.moduleId, module_id: this.moduleId,
user_ids: Array.from(new Set([...selectRecords.map(row => row.id), ...this.form.user_ids])).filter(i => !!i) user_ids: this.form.user_ids
}) })
// //
setTimeout(() => { setTimeout(() => {

@ -14,7 +14,6 @@ const name = defaultSettings.title || 'vue Admin Template' // page title
// You can change the port by the following methods: // You can change the port by the following methods:
// port = 9528 npm run dev OR npm run dev --port = 9528 // port = 9528 npm run dev OR npm run dev --port = 9528
const port = process.env.port || process.env.npm_config_port || 9528 // dev port const port = process.env.port || process.env.npm_config_port || 9528 // dev port
// All configuration item explanations can be find in https://cli.vuejs.org/config/ // All configuration item explanations can be find in https://cli.vuejs.org/config/
module.exports = { module.exports = {
/** /**

Loading…
Cancel
Save