30教龄教职工管理和单身教工管理新增手机h5端查询页;

This commit is contained in:
dd3s_206
2026-06-12 13:43:03 +08:00
parent 37f52d9f1a
commit 51689e4e0b
6 changed files with 551 additions and 9 deletions
@@ -1,6 +1,7 @@
package com.budwk.app.zhgh.staffmanage.singleTeacher.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.result.Result;
@@ -38,8 +39,14 @@ public class SingleTeacherLedgerController {
public void index() {
}
@At("/h5")
@Ok("beetl:/platform/zhghh5/staffmanage/singleTeacher/ledger/index.html")
@SaCheckPermission("h5.singleTeacher.ledger")
public void h5Index() {
}
@At
@SaCheckPermission("singleTeacher.ledger")
@SaCheckPermission(value = {"singleTeacher.ledger", "h5.singleTeacher.ledger"}, mode = SaMode.OR)
@ApiOperation("分页查询")
@Ok("json:{dateFormat:'yyyy-MM-dd'}")
public Result pageData(@Param("pageForm") SingleTeacherPageForm pageForm) {
@@ -48,7 +55,7 @@ public class SingleTeacherLedgerController {
}
@At
@SaCheckPermission("singleTeacher.ledger")
@SaCheckPermission(value = {"singleTeacher.ledger", "h5.singleTeacher.ledger"}, mode = SaMode.OR)
@ApiOperation("新增")
@SLog(tag = "单身教工台账", msg = "新增了一条记录,用户ID:${args[0].userId}")
public Result insert(@Param("singleTeacher") SingleTeacher singleTeacher) {
@@ -57,7 +64,7 @@ public class SingleTeacherLedgerController {
}
@At
@SaCheckPermission("singleTeacher.ledger")
@SaCheckPermission(value = {"singleTeacher.ledger", "h5.singleTeacher.ledger"}, mode = SaMode.OR)
@ApiOperation("编辑")
@SLog(tag = "单身教工台账", msg = "编辑了一条记录,用户ID:${args[0].userId}")
public Result update(@Param("singleTeacher") SingleTeacher singleTeacher) {
@@ -66,7 +73,7 @@ public class SingleTeacherLedgerController {
}
@At
@SaCheckPermission("singleTeacher.ledger")
@SaCheckPermission(value = {"singleTeacher.ledger", "h5.singleTeacher.ledger"}, mode = SaMode.OR)
@ApiOperation("删除")
@SLog(tag = "单身教工台账", msg = "删除了一条记录,用户ID:${args[0].userId}")
public Result delete(@Param("id") String id) {
@@ -75,7 +82,7 @@ public class SingleTeacherLedgerController {
}
@At
@SaCheckPermission("singleTeacher.ledger")
@SaCheckPermission(value = {"singleTeacher.ledger", "h5.singleTeacher.ledger"}, mode = SaMode.OR)
@ApiOperation("详情")
public Result detail(@Param("id") String id) {
SingleTeacher singleTeacher = dao.fetch(SingleTeacher.class, id);
@@ -83,7 +90,7 @@ public class SingleTeacherLedgerController {
}
@At
@SaCheckPermission("singleTeacher.ledger")
@SaCheckPermission(value = {"singleTeacher.ledger", "h5.singleTeacher.ledger"}, mode = SaMode.OR)
@ApiOperation("查询非单身教工人员")
public Result queryNotSingleTeacher(@Param("key") String key) {
Sql sql = Sqls.create("select id,username,loginname,mobile,education,birthday from sys_user $condition");
@@ -5,6 +5,7 @@ import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.excel.EasyExcel;
@@ -70,9 +71,15 @@ public class ThirtyTeachController {
public void index() {
}
@At("/h5")
@Ok("beetl:/platform/zhghh5/staffmanage/thirtyTeach/manage/index.html")
@SaCheckPermission("h5.thirtyTeach.manage")
public void h5Index() {
}
@At
@ApiOperation("分页查询")
@SaCheckPermission("thirtyTeach.manage")
@SaCheckPermission(value = {"thirtyTeach.manage", "h5.thirtyTeach.manage"}, mode = SaMode.OR)
public Result pageData(ThirtyTeachPageForm pageForm) {
Sql sql = thirtyTeachService.getSql(pageForm);
Pagination pagination = thirtyTeachService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
@@ -98,7 +105,7 @@ public class ThirtyTeachController {
@At
@ApiOperation("批量删除三十龄教工")
@SaCheckPermission("thirtyTeach.manage")
@SaCheckPermission(value = {"thirtyTeach.manage", "h5.thirtyTeach.manage"}, mode = SaMode.OR)
@SLog(type = "30龄教工-教职工管理", tag = "批量删除三十龄教工",msg = "批量删除三十龄教工${args[0]}")
public Result doBatchDelete(@Param("userIds") String[] userIds) {
List<String> userIdList = Arrays.asList(userIds);
@@ -156,7 +163,7 @@ public class ThirtyTeachController {
@At
@ApiOperation("修改荣誉证办理年月")
@SaCheckPermission("thirtyTeach.manage")
@SaCheckPermission(value = {"thirtyTeach.manage", "h5.thirtyTeach.manage"}, mode = SaMode.OR)
public Result doEditThirtyCertificateProcessingTime(String id,String thirtyCertificateProcessingTime){
sysUserService.update(Chain.make("thirtyCertificateProcessingTime", thirtyCertificateProcessingTime), Cnd.where("id", "=", id));
return Result.success();
@@ -0,0 +1,23 @@
-- 单身教职工管理手机端初始化脚本
-- 说明:PC端单身教职工管理已部署时,只需要执行本脚本新增手机端入口和权限。
SET @now := CAST(UNIX_TIMESTAMP(NOW()) * 1000 AS UNSIGNED);
INSERT INTO `sys_module` (`id`, `platform`, `name`, `icon`, `faIcon`, `sortNum`, `createdBy`, `createdAt`, `updatedBy`, `updatedAt`, `delFlag`)
SELECT 'b1f00005000000000000000000000001', 'H5', '教职工管理', NULL, 'ti-user', 9902, '', @now, '', @now, 0
FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `sys_module` WHERE `id` = 'b1f00005000000000000000000000001' OR (`platform` = 'H5' AND `name` = '教职工管理'));
INSERT INTO `sys_menu` (`id`, `parentId`, `path`, `name`, `initialPinyinName`, `aliasName`, `type`, `href`, `target`, `icon`, `picIcon`, `showit`, `disabled`, `permission`, `note`, `location`, `hasChildren`, `createdBy`, `createdAt`, `updatedBy`, `updatedAt`, `delFlag`, `platform`, `moduleId`, `isRecommendApp`, `isRecommendService`)
SELECT 'b1f00006000000000000000000000001', '', 'H9911', '单身教职工管理', 'D', null, 'menu', '/platform/singleTeacher/ledger/h5', 'data-pjax', 'friends-o', NULL, 1, 0, 'h5.singleTeacher.ledger', NULL, 9911, 0, '', @now, '', @now, 0, 'H5', module.`id`, 0, 0
FROM `sys_module` module
WHERE module.`platform` = 'H5'
AND module.`name` = '教职工管理'
AND NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission` = 'h5.singleTeacher.ledger' OR `path` = 'H9911');
INSERT INTO `sys_role_menu` (`roleId`, `menuId`)
SELECT r.`id`, m.`id`
FROM `sys_role` r
JOIN `sys_menu` m ON m.`permission` = 'h5.singleTeacher.ledger'
WHERE r.`code` IN ('SYSADMIN', 'SCHOOL_UNION_ADMIN')
AND NOT EXISTS (SELECT 1 FROM `sys_role_menu` rm WHERE rm.`roleId` = r.`id` AND rm.`menuId` = m.`id`);
@@ -0,0 +1,23 @@
-- 30教龄教职工管理手机端初始化脚本
-- 说明:PC端30教龄教职工管理已部署时,只需要执行本脚本新增手机端入口和权限。
SET @now := CAST(UNIX_TIMESTAMP(NOW()) * 1000 AS UNSIGNED);
INSERT INTO `sys_module` (`id`, `platform`, `name`, `icon`, `faIcon`, `sortNum`, `createdBy`, `createdAt`, `updatedBy`, `updatedAt`, `delFlag`)
SELECT 'b1f00005000000000000000000000001', 'H5', '教职工管理', NULL, 'ti-user', 9902, '', @now, '', @now, 0
FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `sys_module` WHERE `id` = 'b1f00005000000000000000000000001' OR (`platform` = 'H5' AND `name` = '教职工管理'));
INSERT INTO `sys_menu` (`id`, `parentId`, `path`, `name`, `initialPinyinName`, `aliasName`, `type`, `href`, `target`, `icon`, `picIcon`, `showit`, `disabled`, `permission`, `note`, `location`, `hasChildren`, `createdBy`, `createdAt`, `updatedBy`, `updatedAt`, `delFlag`, `platform`, `moduleId`, `isRecommendApp`, `isRecommendService`)
SELECT 'b1f00006000000000000000000000002', '', 'H9912', '30教龄教职工管理', 'S', null, 'menu', '/platform/thirtyTeach/manage/h5', 'data-pjax', 'medal-o', NULL, 1, 0, 'h5.thirtyTeach.manage', NULL, 9912, 0, '', @now, '', @now, 0, 'H5', module.`id`, 0, 0
FROM `sys_module` module
WHERE module.`platform` = 'H5'
AND module.`name` = '教职工管理'
AND NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission` = 'h5.thirtyTeach.manage' OR `path` = 'H9912');
INSERT INTO `sys_role_menu` (`roleId`, `menuId`)
SELECT r.`id`, m.`id`
FROM `sys_role` r
JOIN `sys_menu` m ON m.`permission` = 'h5.thirtyTeach.manage'
WHERE r.`code` IN ('SYSADMIN', 'SCHOOL_UNION_ADMIN')
AND NOT EXISTS (SELECT 1 FROM `sys_role_menu` rm WHERE rm.`roleId` = r.`id` AND rm.`menuId` = m.`id`);
@@ -0,0 +1,286 @@
<!--#
layout("/layouts/platform_h5.html"){
#-->
<div id="app" v-cloak>
<van-nav-bar title="单身教职工管理" left-text="返回" right-text="新增" left-arrow @click-left="historyBack" @click-right="onAdd" fixed placeholder></van-nav-bar>
<van-sticky offset-top="46px">
<van-search v-model="pageForm.searchKeyword" placeholder="请输入姓名或工号搜索" show-action input-align="left" @search="doSearch">
<template #action>
<div @click="doSearch">搜索</div>
</template>
</van-search>
<van-dropdown-menu :close-on-click-outside="false" :close-on-click-overlay="false">
<van-dropdown-item v-model="pageForm.unionId" :options="unionOptions" @change="unionChange"></van-dropdown-item>
<van-dropdown-item v-model="pageForm.unitId" :options="unitOptions" @change="doSearch"></van-dropdown-item>
</van-dropdown-menu>
</van-sticky>
<table-list api="/platform/singleTeacher/ledger/pageData" :page_form.sync="pageForm" json ref="tableListRef" title="username" @ready="onReady">
<template v-slot="{row}">
<table-column label="工号">{{row.loginname}}</table-column>
<table-column label="性别">{{row.sex}}</table-column>
<table-column label="手机号码">{{row.mobile}}</table-column>
<table-column label="出生日期">{{formatDate(row.birthday)}}</table-column>
<table-column label="学历">{{row.education}}</table-column>
<table-column label="婚姻状况">{{row.maritalStatus}}</table-column>
<table-column label="所属单位">{{row.unitName}}</table-column>
</template>
<template #actions="{row}">
<div class="action-btn" @click="onView(row)">
<i class="fa fa-eye"></i>
<span>查看</span>
</div>
<div class="action-btn" @click="onEdit(row)">
<i class="fa fa-edit"></i>
<span>编辑</span>
</div>
<div class="action-btn delete" @click="onDelete(row)">
<i class="fa fa-trash"></i>
<span>删除</span>
</div>
</template>
</table-list>
<van-action-sheet v-model="infoVisible" title="单身教职工详情">
<div class="detail-container">
<van-cell-group title="基本信息">
<van-cell title="姓名">{{viewData.username || '暂无'}}</van-cell>
<van-cell title="工号">{{viewData.loginname || '暂无'}}</van-cell>
<van-cell title="性别">{{viewData.sex || '暂无'}}</van-cell>
<van-cell title="手机号码">{{viewData.mobile || '暂无'}}</van-cell>
<van-cell title="出生日期">{{formatDate(viewData.birthday) || '暂无'}}</van-cell>
<van-cell title="学历">{{viewData.education || '暂无'}}</van-cell>
<van-cell title="婚姻状况">{{viewData.maritalStatus || '暂无'}}</van-cell>
<van-cell title="所属工会">{{viewData.unionName || '暂无'}}</van-cell>
<van-cell title="所属单位">{{viewData.unitName || '暂无'}}</van-cell>
<van-cell title="身高">{{viewData.height || '暂无'}}</van-cell>
<van-cell title="籍贯">{{viewData.nativePlace || '暂无'}}</van-cell>
<van-cell title="月收入">{{viewData.monthlyIncome || '暂无'}}</van-cell>
<van-cell title="住房情况">{{viewData.housingSituation || '暂无'}}</van-cell>
<van-cell title="兴趣爱好" class="direction-column-cell">{{viewData.hobby || '暂无'}}</van-cell>
<van-cell title="交友意向" class="direction-column-cell">{{viewData.intentionFriends || '暂无'}}</van-cell>
<van-cell title="个人介绍" class="direction-column-cell">{{viewData.introduction || '暂无'}}</van-cell>
<van-cell title="形象照片" class="direction-column-cell">
<van-image v-if="viewData.photo" :src="viewData.photo" width="120" height="120" fit="cover"></van-image>
<span v-else>暂无</span>
</van-cell>
</van-cell-group>
</div>
</van-action-sheet>
<van-action-sheet v-model="formVisible" :title="formData.id ? '编辑单身教职工' : '新增单身教职工'">
<van-form ref="formRef" class="h5-form-sheet">
<van-field v-if="!formData.id" v-model="userLabel" name="userId" label="选择用户" placeholder="请选择用户" required readonly is-link :rules="[{required:true,message:'请选择用户'}]" @click="openUserPicker"></van-field>
<van-field v-else :value="formData.username" label="用户信息" readonly></van-field>
<van-field v-model="formData.mobile" name="mobile" label="联系方式" placeholder="请输入手机号" required :rules="mobileRules"></van-field>
<van-field v-model="formData.birthday" name="birthday" label="出生日期" type="date" placeholder="请选择出生日期" required :rules="[{required:true,message:'请选择出生日期'}]"></van-field>
<van-field v-model="formData.height" name="height" label="身高(cm)" placeholder="请输入身高" :rules="[{pattern:/^\d{2,3}$/,message:'请输入正确的身高'}]"></van-field>
<van-field v-model="formData.nativePlace" label="籍贯" placeholder="请输入籍贯"></van-field>
<van-field v-model="formData.education" name="education" label="学历" placeholder="请选择学历" required readonly is-link :rules="[{required:true,message:'请选择学历'}]" @click="showEducationPicker = true"></van-field>
<van-field v-model="formData.maritalStatus" name="maritalStatus" label="婚姻状况" placeholder="请选择婚姻状况" required readonly is-link :rules="[{required:true,message:'请选择婚姻状况'}]" @click="showMaritalPicker = true"></van-field>
<van-field v-model="formData.monthlyIncome" label="月收入" placeholder="请选择月收入" readonly is-link @click="showIncomePicker = true"></van-field>
<van-field v-model="formData.housingSituation" label="住房情况" placeholder="请选择住房情况" readonly is-link @click="showHousingPicker = true"></van-field>
<van-field v-model="formData.hobby" label="兴趣爱好" placeholder="请输入兴趣爱好"></van-field>
<van-cell title="形象照片" class="direction-column-cell">
<h5-file-upload :value.sync="formData.photo" :upload_number="1" upload_mode="image" upload_result_category="interval" upload_result_type="url"></h5-file-upload>
</van-cell>
<van-field v-model="formData.intentionFriends" label="交友意向" type="textarea" rows="3" autosize placeholder="请描述交友意向"></van-field>
<van-field v-model="formData.introduction" name="introduction" label="个人介绍" type="textarea" rows="4" autosize placeholder="请简要介绍一下自己" required :rules="[{required:true,message:'请填写个人介绍'}]"></van-field>
</van-form>
<div class="h5-form-actions">
<van-button block @click="formVisible = false">取消</van-button>
<van-button block type="primary" @click="submitForm">确定</van-button>
</div>
</van-action-sheet>
<van-action-sheet v-model="userPickerVisible" title="选择用户">
<van-search v-model="userKeyword" placeholder="请输入姓名或工号搜索" show-action @search="searchUsers">
<template #action>
<div @click="searchUsers">搜索</div>
</template>
</van-search>
<van-cell v-for="item in userOptions" :key="item.id" :title="item.username + '(' + item.loginname + ')'" :label="item.mobile" is-link @click="selectUser(item)"></van-cell>
<van-empty v-if="!userOptions.length" description="暂无用户"></van-empty>
</van-action-sheet>
<van-popup v-model="showEducationPicker" position="bottom">
<van-picker show-toolbar :columns="dict.type.USER_EDUCATION.map(item => item.name || item.label)" @confirm="onEducationConfirm" @cancel="showEducationPicker = false"></van-picker>
</van-popup>
<van-popup v-model="showMaritalPicker" position="bottom">
<van-picker show-toolbar :columns="maritalOptions" @confirm="(value)=>{formData.maritalStatus=value;showMaritalPicker=false}" @cancel="showMaritalPicker = false"></van-picker>
</van-popup>
<van-popup v-model="showIncomePicker" position="bottom">
<van-picker show-toolbar :columns="incomeOptions" @confirm="(value)=>{formData.monthlyIncome=value;showIncomePicker=false}" @cancel="showIncomePicker = false"></van-picker>
</van-popup>
<van-popup v-model="showHousingPicker" position="bottom">
<van-picker show-toolbar :columns="housingOptions" @confirm="(value)=>{formData.housingSituation=value;showHousingPicker=false}" @cancel="showHousingPicker = false"></van-picker>
</van-popup>
</div>
<script nonce="${cspNonce!}">
new Vue({
el: "#app",
store,
dicts: ["USER_EDUCATION"],
data() {
return {
pageForm: {pageNumber: 1, pageSize: 10, totalCount: 0, age: [0, 100], unionId: "", unitId: ""},
unionOptions: [],
unitOptions: [],
infoVisible: false,
formVisible: false,
userPickerVisible: false,
showEducationPicker: false,
showMaritalPicker: false,
showIncomePicker: false,
showHousingPicker: false,
viewData: {},
formData: {},
userLabel: "",
userKeyword: "",
userOptions: [],
maritalOptions: ["未婚", "离婚", "丧偶"],
incomeOptions: ["5000以下", "5000-8000", "8000-10000", "10000-15000", "15000以上"],
housingOptions: ["已购房", "租房", "与父母同住", "单位宿舍", "其他"],
mobileRules: [
{required: true, message: "请输入联系方式"},
{pattern: /^1[3-9]\d{9}$/, message: "请输入正确的手机号码"}
]
}
},
methods: {
async onReady() {
await this.initUnion()
await this.flushUnits()
this.doSearch()
},
async initUnion() {
const hasAdmin = this.$auth.hasRoleOr(["SYSADMIN", "SCHOOL_UNION_ADMIN"])
const unionId = hasAdmin ? null : this.$store.state.user.union.id
this.unionOptions = await this.$businessTool.listUnion(unionId)
this.unionOptions.forEach((v) => {
v.text = v.name
v.value = v.id
})
if (hasAdmin) this.unionOptions.unshift({text: "全部工会", value: null})
if (this.unionOptions.length) this.$set(this.pageForm, "unionId", this.unionOptions[0].value)
},
async flushUnits() {
const hasAdmin = this.$auth.hasRoleOr(["SYSADMIN", "SCHOOL_UNION_ADMIN"])
const unionId = hasAdmin ? this.pageForm.unionId : this.$store.state.user.union.id
this.unitOptions = await this.$businessTool.listUnit(unionId)
this.unitOptions.forEach((v) => {
v.text = v.name
v.value = v.id
})
if (hasAdmin && !this.pageForm.unionId) this.unitOptions.unshift({text: "全部单位", value: null})
if (this.unitOptions.length) this.$set(this.pageForm, "unitId", this.unitOptions[0].value)
},
async unionChange() {
this.$set(this.pageForm, "unitId", null)
await this.flushUnits()
this.doSearch()
},
doSearch() {
this.$nextTick(() => {
this.pageForm.pageNumber = 1
this.pageForm.totalCount = 0
this.$refs.tableListRef.doSearch()
})
},
onView(row) {
this.viewData = {...row}
this.infoVisible = true
},
onAdd() {
this.userLabel = ""
this.formData = {picFiles: []}
this.formVisible = true
},
onEdit(row) {
this.formData = {...row, birthday: this.formatDate(row.birthday), picFiles: this.parsePicFiles(row.picFiles)}
this.userLabel = row.username ? row.username + "(" + row.loginname + ")" : ""
this.formVisible = true
},
openUserPicker() {
this.userKeyword = ""
this.userOptions = []
this.userPickerVisible = true
},
searchUsers() {
if (!this.userKeyword) {
this.$toast("请输入姓名或工号")
return
}
this.$axios.post("/platform/singleTeacher/ledger/queryNotSingleTeacher", {key: this.userKeyword}).then((res) => {
if (res.code === 0) this.userOptions = res.data || []
})
},
selectUser(item) {
this.$set(this.formData, "userId", item.id)
this.$set(this.formData, "username", item.username)
this.$set(this.formData, "loginname", item.loginname)
this.$set(this.formData, "mobile", item.mobile || "")
this.$set(this.formData, "birthday", this.formatDate(item.birthday))
this.$set(this.formData, "education", item.education || "")
this.userLabel = item.username + "(" + item.loginname + ")"
this.userPickerVisible = false
},
onEducationConfirm(value) {
this.$set(this.formData, "education", value)
this.showEducationPicker = false
},
submitForm() {
this.$refs.formRef.validate().then(() => {
const url = this.formData.id ? "/platform/singleTeacher/ledger/update" : "/platform/singleTeacher/ledger/insert"
this.$axios.post(url, {singleTeacher: JSON.stringify(this.formData)}).then((res) => {
if (res.code === 0) {
this.$toast.success(res.msg)
this.formVisible = false
this.doSearch()
}
})
})
},
onDelete(row) {
this.$dialog.confirm({title: "提示", message: "您确定要删除吗?"}).then(() => {
this.$axios.post("/platform/singleTeacher/ledger/delete", {id: row.id}).then((res) => {
if (res.code === 0) {
this.$toast.success(res.msg)
this.doSearch()
}
})
}).catch(() => {})
},
formatDate(value) {
return value ? this.$moment(value).format("YYYY-MM-DD") : ""
},
parsePicFiles(value) {
if (!value) return []
if (Array.isArray(value)) return value
try {
const list = JSON.parse(value)
return Array.isArray(list) ? list : []
} catch (e) {
return []
}
}
},
})
</script>
<style>
.h5-form-sheet {
max-height: 70vh;
overflow-y: auto;
}
.h5-form-actions {
display: flex;
column-gap: 10px;
padding: 10px;
}
</style>
<!--#
}
#-->
@@ -0,0 +1,196 @@
<!--#
layout("/layouts/platform_h5.html"){
#-->
<div id="app" v-cloak>
<van-nav-bar title="30教龄教职工管理" left-text="返回" left-arrow @click-left="historyBack" fixed placeholder></van-nav-bar>
<van-sticky offset-top="46px">
<van-search v-model="pageForm.searchKeyword" placeholder="请输入姓名或工号搜索" show-action input-align="left" @search="doSearch">
<template #action>
<div @click="doSearch">搜索</div>
</template>
</van-search>
<van-dropdown-menu :close-on-click-outside="false" :close-on-click-overlay="false">
<van-dropdown-item v-model="pageForm.unionId" :options="unionOptions" @change="unionChange"></van-dropdown-item>
<van-dropdown-item v-model="pageForm.unitId" :options="unitOptions" @change="doSearch"></van-dropdown-item>
</van-dropdown-menu>
</van-sticky>
<table-list api="/platform/thirtyTeach/manage/pageData" :page_form.sync="pageForm" ref="tableListRef" title="username" @ready="onReady">
<template v-slot="{row}">
<table-column label="工号">{{row.loginname}}</table-column>
<table-column label="性别">{{row.sex}}</table-column>
<table-column label="进校时长">{{row.teachNum}}年</table-column>
<table-column label="教职工类别">{{row.personType}}</table-column>
<table-column label="在职状态">{{row.userState}}</table-column>
<table-column label="所属工会">{{row.unionName}}</table-column>
<table-column label="所属单位">{{row.unitName}}</table-column>
<table-column label="办理年月">{{row.thirtyCertificateProcessingTime || '暂无'}}</table-column>
</template>
<template #actions="{row}">
<div class="action-btn" @click="onView(row)">
<i class="fa fa-eye"></i>
<span>查看</span>
</div>
<div class="action-btn" @click="onEditCertificate(row)">
<i class="fa fa-edit"></i>
<span>编辑</span>
</div>
<div class="action-btn delete" @click="onDelete(row)">
<i class="fa fa-trash"></i>
<span>删除</span>
</div>
</template>
</table-list>
<van-action-sheet v-model="infoVisible" title="30教龄教职工详情">
<div class="detail-container">
<van-cell-group title="基本信息">
<van-cell title="姓名">{{viewData.username || '暂无'}}</van-cell>
<van-cell title="工号">{{viewData.loginname || '暂无'}}</van-cell>
<van-cell title="性别">{{viewData.sex || '暂无'}}</van-cell>
<van-cell title="是否会员">{{viewData.member == 1 ? '是' : '否'}}</van-cell>
<van-cell title="联系电话">{{viewData.mobile || '暂无'}}</van-cell>
<van-cell title="出生日期">{{formatDate(viewData.birthday) || '暂无'}}</van-cell>
<van-cell title="进校时长">{{viewData.teachNum ? viewData.teachNum + '年' : '暂无'}}</van-cell>
<van-cell title="教职工类别">{{viewData.personType || '暂无'}}</van-cell>
<van-cell title="在职状态">{{viewData.userState || '暂无'}}</van-cell>
<van-cell title="所属工会">{{viewData.unionName || '暂无'}}</van-cell>
<van-cell title="所属单位">{{viewData.unitName || '暂无'}}</van-cell>
<van-cell title="荣誉证办理年月">{{viewData.thirtyCertificateProcessingTime || '暂无'}}</van-cell>
</van-cell-group>
</div>
</van-action-sheet>
<van-action-sheet v-model="editVisible" title="编辑荣誉证办理年月">
<van-form ref="formRef" class="h5-form-sheet">
<van-field :value="editData.username" label="姓名" readonly></van-field>
<van-field :value="editData.loginname" label="工号" readonly></van-field>
<van-field v-model="editData.thirtyCertificateProcessingTime" name="thirtyCertificateProcessingTime" label="办理年月" placeholder="请选择办理年月" readonly is-link required :rules="[{required:true,message:'请选择办理年月'}]" @click="showMonthPicker = true"></van-field>
</van-form>
<div class="h5-form-actions">
<van-button block @click="editVisible = false">取消</van-button>
<van-button block type="primary" @click="submitCertificate">确定</van-button>
</div>
</van-action-sheet>
<van-popup v-model="showMonthPicker" position="bottom">
<van-datetime-picker v-model="monthValue" type="year-month" title="选择办理年月" @confirm="onMonthConfirm" @cancel="showMonthPicker = false"></van-datetime-picker>
</van-popup>
</div>
<script nonce="${cspNonce!}">
new Vue({
el: "#app",
store,
data() {
return {
pageForm: {pageNumber: 1, pageSize: 10, totalCount: 0, unionId: "", unitId: ""},
unionOptions: [],
unitOptions: [],
infoVisible: false,
editVisible: false,
showMonthPicker: false,
viewData: {},
editData: {},
monthValue: new Date()
}
},
methods: {
async onReady() {
await this.initUnion()
await this.flushUnits()
this.doSearch()
},
async initUnion() {
const hasAdmin = this.$auth.hasRoleOr(["SYSADMIN", "SCHOOL_UNION_ADMIN"])
const unionId = hasAdmin ? null : this.$store.state.user.union.id
this.unionOptions = await this.$businessTool.listUnion(unionId)
this.unionOptions.forEach((v) => {
v.text = v.name
v.value = v.id
})
if (hasAdmin) this.unionOptions.unshift({text: "全部工会", value: null})
if (this.unionOptions.length) this.$set(this.pageForm, "unionId", this.unionOptions[0].value)
},
async flushUnits() {
const hasAdmin = this.$auth.hasRoleOr(["SYSADMIN", "SCHOOL_UNION_ADMIN"])
const unionId = hasAdmin ? this.pageForm.unionId : this.$store.state.user.union.id
this.unitOptions = await this.$businessTool.listUnit(unionId)
this.unitOptions.forEach((v) => {
v.text = v.name
v.value = v.id
})
if (hasAdmin && !this.pageForm.unionId) this.unitOptions.unshift({text: "全部单位", value: null})
if (this.unitOptions.length) this.$set(this.pageForm, "unitId", this.unitOptions[0].value)
},
async unionChange() {
this.$set(this.pageForm, "unitId", null)
await this.flushUnits()
this.doSearch()
},
doSearch() {
this.$nextTick(() => {
this.pageForm.pageNumber = 1
this.pageForm.totalCount = 0
this.$refs.tableListRef.doSearch()
})
},
onView(row) {
this.viewData = {...row}
this.infoVisible = true
},
onEditCertificate(row) {
this.editData = {...row}
this.monthValue = row.thirtyCertificateProcessingTime ? new Date(row.thirtyCertificateProcessingTime + "-01") : new Date()
this.editVisible = true
},
onMonthConfirm(value) {
this.$set(this.editData, "thirtyCertificateProcessingTime", this.$moment(value).format("YYYY-MM"))
this.showMonthPicker = false
},
submitCertificate() {
this.$refs.formRef.validate().then(() => {
this.$axios.post("/platform/thirtyTeach/manage/doEditThirtyCertificateProcessingTime", {
id: this.editData.id,
thirtyCertificateProcessingTime: this.editData.thirtyCertificateProcessingTime
}).then((res) => {
if (res.code === 0) {
this.$toast.success(res.msg)
this.editVisible = false
this.doSearch()
}
})
})
},
onDelete(row) {
this.$dialog.confirm({title: "提示", message: "您确定要删除吗?"}).then(() => {
this.$axios.post("/platform/thirtyTeach/manage/doBatchDelete", {userIds: JSON.stringify([row.id])}).then((res) => {
if (res.code === 0) {
this.$toast.success(res.msg)
this.doSearch()
}
})
}).catch(() => {})
},
formatDate(value) {
return value ? this.$moment(value).format("YYYY-MM-DD") : ""
}
},
})
</script>
<style>
.h5-form-sheet {
max-height: 70vh;
overflow-y: auto;
}
.h5-form-actions {
display: flex;
column-gap: 10px;
padding: 10px;
}
</style>
<!--#
}
#-->