活动基础单位查询为空,活动单位没有同步sys_unit
This commit is contained in:
@@ -6,13 +6,13 @@ layout("/layouts/platform.html"){
|
||||
<el-row :gutter="10" type="flex" style="height: calc(100vh - 126px)">
|
||||
<el-col :span="5">
|
||||
<el-card shadow="never" style="height: 100%" body-style="{ height: '100%' }">
|
||||
<div style="max-height: calc(100vh - 160px); overflow-y: auto">
|
||||
<div v-loading="treeLoading" style="max-height: calc(100vh - 160px); overflow-y: auto">
|
||||
<el-tree
|
||||
:data="treeData"
|
||||
:default-expanded-keys="['1']"
|
||||
:default-expanded-keys="['0000']"
|
||||
:expand-on-click-node="false"
|
||||
:props="{
|
||||
children: 'child',
|
||||
children: 'children',
|
||||
label: 'name'
|
||||
}"
|
||||
@node-click="treeNodeClick"
|
||||
@@ -57,7 +57,7 @@ layout("/layouts/platform.html"){
|
||||
</el-card>
|
||||
<el-card shadow="never" style="border: 1px solid var(--border-color-lighter)">
|
||||
<table-tool></table-tool>
|
||||
<el-table :data="tableData" height="calc(100vh - 380px)" border size="small">
|
||||
<el-table :data="tableData" v-loading="tableLoading" height="calc(100vh - 380px)" border size="small">
|
||||
<el-table-column label="序号" type="index">
|
||||
<template scope="scope">
|
||||
<span>{{scope.$index+(pageForm.pageNumber - 1) * pageForm.pageSize + 1}}</span>
|
||||
@@ -95,50 +95,75 @@ layout("/layouts/platform.html"){
|
||||
data() {
|
||||
return {
|
||||
pageForm: {
|
||||
searchName: "name"
|
||||
searchName: "name",
|
||||
parentId: "0000"
|
||||
},
|
||||
treeData: [],
|
||||
treeLoading: false,
|
||||
currentTreeNode: null,
|
||||
currentTreeData: null
|
||||
}
|
||||
},
|
||||
components: {},
|
||||
methods: {
|
||||
async doDelete(id) {
|
||||
const confirm = await this.$confirm("确定要删除该单位吗?", "提示", {
|
||||
doDelete(id) {
|
||||
this.$confirm("确定要删除该单位吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
return this.$axios.post(loc() + "/doDelete", { id }).then((resp) => {
|
||||
if (resp.code === 0) {
|
||||
// 树刷新后统一恢复选中节点并查询列表,避免旧节点条件与新树不一致。
|
||||
this.getTreeData()
|
||||
this.$message.success(resp.msg)
|
||||
} else {
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
})
|
||||
}, () => {
|
||||
// 取消确认时保留当前单位树及列表。
|
||||
})
|
||||
if (confirm === "confirm") {
|
||||
const resp = await this.$axios.post(loc() + "/doDelete", { id })
|
||||
if (resp.code === 0) {
|
||||
this.getTreeData()
|
||||
this.doSearch()
|
||||
this.$message.success(resp.msg)
|
||||
} else {
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
}
|
||||
},
|
||||
treeNodeClick(data, node) {
|
||||
this.currentTreeData = data
|
||||
this.currentTreeNode = node
|
||||
this.pageForm.parentId = data.id
|
||||
// 直属下级查询复用 mixin 的搜索及分页重置逻辑。
|
||||
this.$set(this.pageForm, "parentId", data.id)
|
||||
this.doSearch()
|
||||
},
|
||||
getTreeData() {
|
||||
this.$axios.post(loc() + "/tree").then((res) => {
|
||||
this.treeData = res.data
|
||||
if (this.treeData) {
|
||||
this.currentTreeData = this.treeData[0]
|
||||
this.treeLoading = true
|
||||
return this.$axios.post(loc() + "/tree").then((res) => {
|
||||
if (res.code !== 0) {
|
||||
this.notifyWarning(res.msg)
|
||||
return
|
||||
}
|
||||
this.treeData = res.data || []
|
||||
return this.$nextTick(() => {
|
||||
// 首次选择学校节点;刷新时保留当前选择,节点不存在时回退到首个根节点。
|
||||
const selectedNode = this.currentTreeData
|
||||
? this.$refs.treeRef.getNode(this.currentTreeData.id) : null
|
||||
const selectedData = selectedNode ? selectedNode.data : this.treeData[0]
|
||||
if (selectedData) {
|
||||
this.$refs.treeRef.setCurrentKey(selectedData.id)
|
||||
this.treeNodeClick(selectedData, this.$refs.treeRef.getNode(selectedData.id))
|
||||
} else {
|
||||
// 空树时清除旧列表,避免继续显示已经删除或失效的单位。
|
||||
this.currentTreeData = null
|
||||
this.currentTreeNode = null
|
||||
this.tableData = []
|
||||
this.$set(this.pageForm, "parentId", "")
|
||||
this.$set(this.pageForm, "totalCount", 0)
|
||||
}
|
||||
})
|
||||
}).finally(() => {
|
||||
this.treeLoading = false
|
||||
})
|
||||
},
|
||||
openUnit() {}
|
||||
},
|
||||
created() {
|
||||
this.pageData()
|
||||
this.getTreeData()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -362,6 +362,7 @@ layout("/layouts/platform.html"){
|
||||
activityList: [],
|
||||
pageForm: {
|
||||
isMenWomen: [],
|
||||
unionId: "",
|
||||
isActivity: "2",
|
||||
year: new Date().getFullYear() + ""
|
||||
},
|
||||
@@ -379,6 +380,7 @@ layout("/layouts/platform.html"){
|
||||
{prop: "apply_num_bc", label: "暂保存人数"}
|
||||
],
|
||||
unionOptions: [],
|
||||
defaultUnionId: "",
|
||||
|
||||
dialogLeaderCoach: false,
|
||||
userOptions: [],
|
||||
@@ -392,6 +394,27 @@ layout("/layouts/platform.html"){
|
||||
"activity-sports-delete-user": ACTIVITY_SPORTS_DELETE_USER
|
||||
},
|
||||
methods: {
|
||||
getApplyUnionOptions() {
|
||||
// 报名只使用活动工会,默认值取当前单位的活动工会关联。
|
||||
return this.$axios.post(loc() + "/unionOptions").then((res) => {
|
||||
if (res.code !== 0) {
|
||||
this.notifyWarning(res.msg)
|
||||
return
|
||||
}
|
||||
this.unionOptions = res.data.options || []
|
||||
this.defaultUnionId = res.data.defaultUnionId || ""
|
||||
this.$set(this.pageForm, "unionId", this.defaultUnionId)
|
||||
})
|
||||
},
|
||||
getSelectedApplyUnionId() {
|
||||
// 清空选项时回退活动工会默认值,不能使用登录信息中的系统工会 ID。
|
||||
const unionId = this.pageForm.unionId || this.defaultUnionId
|
||||
if (!unionId || !this.unionOptions.some((item) => item.id === unionId)) {
|
||||
this.notifyWarning("请选择有效的活动工会")
|
||||
return ""
|
||||
}
|
||||
return unionId
|
||||
},
|
||||
changeLeader(id) {
|
||||
if (id) {
|
||||
const userList = this.$refs.userData.options
|
||||
@@ -501,27 +524,27 @@ layout("/layouts/platform.html"){
|
||||
this.activityNoticeDialog = true
|
||||
},
|
||||
|
||||
async getUnionCoachLeaderHead() {
|
||||
getUnionCoachLeaderHead() {
|
||||
this.leaderData = {}
|
||||
this.coachData = {}
|
||||
this.headData = {}
|
||||
this.staffData = {}
|
||||
const resp = await this.$axios.post(loc() + "/getUnionCoachLeaderHead", {activityId: this.pageForm.activityId})
|
||||
const {unionCoach, unionLeader, unionHead, unionStaff, userOptions} = resp.data
|
||||
if (unionCoach) {
|
||||
this.coachData = unionCoach
|
||||
}
|
||||
if (unionLeader) {
|
||||
this.leaderData = unionLeader
|
||||
}
|
||||
if (unionHead) {
|
||||
this.headData = unionHead
|
||||
}
|
||||
if (unionStaff) {
|
||||
this.staffData = unionStaff
|
||||
}
|
||||
|
||||
this.userOptions = userOptions
|
||||
// 领队教练回显跟随报名选择的活动工会。
|
||||
return this.$axios.post(loc() + "/getUnionCoachLeaderHead", {
|
||||
activityId: this.pageForm.activityId,
|
||||
unionId: this.pageForm.unionId || this.defaultUnionId
|
||||
}).then((resp) => {
|
||||
if (resp.code !== 0) {
|
||||
this.notifyWarning(resp.msg)
|
||||
return
|
||||
}
|
||||
const {unionCoach, unionLeader, unionHead, unionStaff, userOptions} = resp.data
|
||||
this.coachData = unionCoach || {}
|
||||
this.leaderData = unionLeader || {}
|
||||
this.headData = unionHead || {}
|
||||
this.staffData = unionStaff || {}
|
||||
this.userOptions = userOptions
|
||||
})
|
||||
},
|
||||
async changeActivity() {
|
||||
const resp = await this.$axios.post("/platform/activity/apply/getEvents", {activityId: this.pageForm.activityId})
|
||||
@@ -539,14 +562,15 @@ layout("/layouts/platform.html"){
|
||||
})
|
||||
},
|
||||
|
||||
async openUniteApply(data) {
|
||||
openUniteApply(data) {
|
||||
const now = moment().valueOf()
|
||||
if (now < moment(data.applyStartTime).valueOf() || now > moment(data.applyEndTime).valueOf()) {
|
||||
this.notifyWarning("此活动不在报名时间内")
|
||||
return
|
||||
}
|
||||
const union = this.$store.state.user.union
|
||||
data.unionId = this.pageForm.unionId ? this.pageForm.unionId : union.id
|
||||
const unionId = this.getSelectedApplyUnionId()
|
||||
if (!unionId) return
|
||||
this.$set(data, "unionId", unionId)
|
||||
this.$refs.guava.edit(() => {
|
||||
this.$refs.activityApplyUser.openUniteApply(data)
|
||||
})
|
||||
@@ -555,8 +579,9 @@ layout("/layouts/platform.html"){
|
||||
this.$refs.activityApplyUser.doApplyUser(flag)
|
||||
},
|
||||
doDelete(data) {
|
||||
const union = this.$store.state.user.union
|
||||
data.unionId = this.pageForm.unionId ? this.pageForm.unionId : union.id
|
||||
const unionId = this.getSelectedApplyUnionId()
|
||||
if (!unionId) return
|
||||
this.$set(data, "unionId", unionId)
|
||||
this.$refs.guava.public(() => {
|
||||
this.$refs.activityDeleteUser.openDelete(data)
|
||||
})
|
||||
@@ -566,11 +591,16 @@ layout("/layouts/platform.html"){
|
||||
this.$refs.guava.index()
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
await this.activityInfoData()
|
||||
this.unitOptions = await this.$businessTool.listUnit()
|
||||
this.unionOptions = await this.$businessTool.listUnion()
|
||||
await this.focusGroup()
|
||||
created() {
|
||||
// 工会选项就绪后加载活动,防止报名入口使用尚未初始化的默认工会。
|
||||
this.getApplyUnionOptions().then(() => {
|
||||
return this.activityInfoData()
|
||||
}).then(() => {
|
||||
return this.$businessTool.listUnit()
|
||||
}).then((units) => {
|
||||
this.unitOptions = units
|
||||
return this.focusGroup()
|
||||
})
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user