Files
UNION_NSI/target/classes/views/platform/honor/apply.html
T
2026-09-08 19:49:21 +08:00

630 lines
32 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!--#
layout("/layouts/platform.html"){
#-->
<style>
.el-select {
width: 100%;
}
</style>
<div id="app" v-cloak>
<guava ref="guava">
<template>
<el-card shadow="never">
<div class="btn-group tool-button">
<div class="block">
<el-date-picker
v-model="pageForm.year"
type="year"
value-format="yyyy"
placeholder="年度">
</el-date-picker>
</div>
</div>
<div class="btn-group tool-button">
<el-select v-model="pageForm.honorLevel" placeholder="请选择级别" style="width: 100%"
@change="doSearch"
clearable>
<el-option v-for="o in honorLevelList"
:key="o.id"
:label="o.name"
:value="o.id"
></el-option>
</el-select>
</div>
<div class="btn-group tool-button mt5">
<el-radio-group v-model="pageForm.honorType" @change="doSearch">
<el-radio-button v-for="v in honorTypeList" :label="v.id">{{v.name}}</el-radio-button>
</el-radio-group>
</div>
<div class="btn-group tool-button">
<el-button type="primary" @click="doSearch" icon="el-icon-search"></el-button>
</div>
<div class="pull-right offscreen-right">
<el-button size="medium" type="primary" @click="applyHonor">申请荣誉</el-button>
</div>
</el-card>
<honor-apply-table :loading="tableLoading" :page="pageForm" :data="tableData"
ref="hat"
@order="pageOrder">
<template #vi-title>
<vi-title title="申请列表"></vi-title>
</template>
<template #column>
<el-table-column align="center" header-align="center" label="操作" fixed="right" width="150px">
<template scope="{row}">
<el-dropdown @command="dropdownCommand">
<el-button plain size="mini">
<i class="ti-settings"></i>
<span class="ti-angle-down"></span>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="{type:'view',data:row}">
查看
</el-dropdown-item>
<el-dropdown-item :command="{type:'edit',data:row}"
:disabled="(row.honorType=='101'&&row.stateId>1500)||(row.honorType=='102'&&row.stateId>1600)">
编辑
</el-dropdown-item>
<!--#if(@shiro.hasRole('sysadmin')){#-->
<el-dropdown-item :command="{type:'delete',data:row}"
:loading="row.delLoading">
删除
</el-dropdown-item>
<!--#}else{#-->
<el-dropdown-item :command="{type:'delete',data:row}"
:disabled="(row.honorType=='101'&&row.stateId>1500)||(row.honorType=='102'&&row.stateId>1600)"
:loading="row.delLoading">
删除
</el-dropdown-item>
<!--#}#-->
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</template>
<template #pagination>
<!--#include("/layouts/pagination.html"){}#-->
</template>
</honor-apply-table>
</template>
<template #edit>
<template #header>
<el-row type="flex" justify="space-between">
<h3>{{isEdit?'修改数据':'添加数据'}}</h3>
</el-row>
</template>
<el-form :model="formData" label-width="120px" ref="form">
<el-row type="flex" :gutter="20">
<el-col :span="24">
<el-form-item label="荣誉类型" prop="honorType">
<el-select v-model="formData.honorType" @change="honorTypeChange" :disabled="isEdit">
<el-option v-for="o in honorTypeList"
:key="o.id"
:label="o.name"
:value="o.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-collapse v-model="collapse">
<el-collapse-item title="" name="basic">
<template slot="title">
<div class="text-primary" style="width: 100%">
基础信息
</div>
</template>
<template v-if="formData.honorType===HonorApi.honor_single_id">
<el-row type="flex" :gutter="20">
<el-col :span="24" prop="userId">
<el-form-item prop="userId" label="获奖人员">
<el-select
style="width: 100%"
v-model="formData.userId"
filterable
clearable
remote
reserve-keyword
placeholder="请输入姓名或工号查找"
:remote-method="userRemoteMethod"
:loading="userLoading"
@change="userChange"
:disabled="isEdit">
<el-option
v-for="item in userOptions"
:key="item.id"
:label="item.username+''+item.loginname+''"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row type="flex" :gutter="20">
<el-col :span="12">
<el-form-item label="性别" prop="userSex">
<el-radio-group v-model="formData.userSex" :disabled="isEdit">
<el-radio-button label="男"></el-radio-button>
<el-radio-button label="女"></el-radio-button>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="在职状态" prop="jobStatus">
<el-input v-model="formData.jobStatus"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row type="flex" :gutter="20">
<el-col :span="12">
<el-form-item label="担任工会职务" prop="post">
<el-input v-model="formData.post"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="职称" prop="title">
<el-input v-model="formData.title"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row type="flex" :gutter="20">
<el-col :span="12">
<el-form-item label="生日" prop="birthday">
<el-date-picker
style="width: 100%"
v-model="formData.birthday"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="政治面貌" prop="political">
<el-input v-model="formData.political"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row type="flex" :gutter="20">
<el-col :span="12">
<el-form-item label="民族" prop="nation">
<el-select placeholder="民族" style="width: 100%" filterable
v-model="formData.nation">
<el-option v-for="nation in nationOptions" :key="nation" :value="nation"
:label="nation"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="加入工会时间" prop="joinTime">
<el-date-picker
style="width: 100%"
v-model="formData.joinTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row type="flex" :gutter="20">
<el-col :span="12">
<el-form-item label="所属单位" prop="unitId">
<el-select placeholder="所属单位" v-model="formData.unitId" clearable
style="width: 100%;"
clearable="true"
filterable="true"
:disabled="isEdit">
<el-option v-for="item in units"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所属工会" prop="unionId">
<el-select placeholder="所属工会" v-model="formData.unionId" clearable
style="width: 100%;"
clearable="true"
filterable="true"
:disabled="isEdit">
<el-option v-for="item in unions"
:label="item.unionname"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</template>
<template v-else>
<el-row type="flex">
<el-col :span="12">
<!--<el-form-item label="获奖单位" prop="unitName">
<el-select placeholder="获奖单位" v-model="formData.unitName"
style="width: 100%;"
clearable="true"
filterable
allow-create
:disabled="isEdit">
<el-option v-for="item in units"
:label="item.name"
:value="item.name"></el-option>
</el-select>
</el-form-item>-->
<el-form-item label="申报院级工会" prop="unionId">
<el-select placeholder="请选择申报院级工会" v-model="formData.unionId"
style="width: 100%;"
clearable="true"
filterable
@change="unionSelectChange"
:disabled="isEdit">
<el-option v-for="item in unions"
:label="item.unionname"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<!--<el-form-item label="所属工会" prop="unionId">
<el-select placeholder="所属工会" v-model="formData.unionId"
style="width: 100%;"
clearable="true"
filterable="true"
:disabled="isEdit">
<el-option v-for="item in unions"
:label="item.unionname"
:value="item.id"></el-option>
</el-select>
</el-form-item>-->
<el-form-item label="工会主席" prop="unionLeader">
<el-input v-model="formData.unionLeader"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row type="flex">
<!--<el-col :span="8">
<el-form-item label="单位负责人" prop="unitLeader">
<el-input v-model="formData.unitLeader"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="单位人数" prop="unitPeopleNum">
<el-input-number v-model="formData.unitPeopleNum" :min="0"
:max="2000" style="width: 100%"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="女职工人员" prop="unitFemalePeopleNum">
<el-input-number
v-model.number="formData.unitFemalePeopleNum" :min="0"
:max="2000" style="width: 100%"></el-input-number>
</el-form-item>
</el-col>-->
<el-col :span="12">
<el-form-item label="会员人数" prop="memberNumber">
<el-input-number v-model="formData.memberNumber" :min="0"
:max="2000" style="width: 100%"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工会小组数" prop="unionGroupNumber">
<el-input-number v-model="formData.unionGroupNumber" :min="0"
:max="2000" style="width: 100%"></el-input-number>
</el-form-item>
</el-col>
</el-row>
</template>
<el-row type="flex" :gutter="20">
<el-col :span="24">
<el-form-item label="曾受何种奖励" prop="award">
<el-input v-model="formData.award" type="textarea" rows="4"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row type="flex" :gutter="20">
<el-col :span="24">
<el-form-item label="主要事迹" prop="Deeds">
<el-input v-model="formData.Deeds" type="textarea" rows="4"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-collapse-item>
<el-collapse-item title="获奖信息" name="prize">
<template slot="title">
<div class="text-primary" style="width: 100%">
获奖信息
</div>
</template>
<template>
<!-- <el-row type="flex" :gutter="20">
<el-col :span="12">
<el-form-item label="奖项" prop="prize">
<el-select v-model="formData.prize">
<el-option v-for="o in honorPrizeList"
:key="o.id"
:label="o.name"
:value="o.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="奖项说明" prop="prizeDesc">
<el-input v-model="formData.prizeDesc" maxlength="100"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row type="flex" :gutter="20">
<el-col :span="12">
<el-form-item label="级别">
<el-select v-model="formData.honorLevel" placeholder="">
<el-option v-for="o in honorLevelList"
:key="o.id"
:label="o.name"
:value="o.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
-->
</el-row>
<el-col :span="24">
<el-form-item label="附件" prop="files">
<file-upload card :files.sync="formData.files" :max-size="50 * 1024 * 1024"></file-upload>
</el-form-item>
</el-col>
</template>
</el-collapse-item>
</el-collapse>
</el-form>
<el-row class="m20 text-right">
<el-button type="primary" @click="doSubmit">提交</el-button>
</el-row>
</template>
<template #view>
<honor-info ref="info"></honor-info>
</template>
</guava>
</div>
<script>
var vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
units: [],
unions: [],
nationOptions: nation,
honorTypeList: [],
honorLevelList: [],
honorAwardList: [],
honorPrizeList: [],
collapse: ['basic', 'prize'],
userLoading: false,
userOptions: [],
isEdit: false,
pageForm: {
year: new Date().getFullYear() + "",
honorType: '',
honorLevel: ''
},
firstInPage: true,
}
},
components: {
'file-upload': httpVueLoader('/components/plugins/FileUpload.vue'),
'honor-apply-table': httpVueLoader('/components/honor/honorApplyTable.vue'),
'honor-info': httpVueLoader('/components/honor/honorInfo.vue'),
},
methods: {
unionSelectChange(val) {
},
dropdownCommand(command) {
const {type, data} = command
if (type == 'view') {
this.openView(data)
} else if (type == 'edit') {
this.openEdit(data)
} else if (type == 'delete') {
this.doDelete(data)
}
},
openView(data) {
this.$refs.info.getInfo(data.id)
this.$refs.guava.view()
},
doDelete(row) {
this.$confirm('确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" == a) {//确认后再执行
this.$set(row, "delLoading", true)
const resp = await $.post(loc() + '/doDelete', {id: row.id})
if (resp.code === 0) {
this.pageData()
this.notifySuccess(resp.msg)
}else{
this.notifyError(resp.msg)
}
this.$set(row, "delLoading", false)
}
}
});
},
openEdit(data) {
this.isEdit = true
this.findData(data)
this.$refs.guava.edit()
},
applyHonor() {
this.initData()
this.isEdit = false
this.$refs.guava.edit()
if (this.$refs['form']) {
this.$refs['form'].resetFields()
}
},
async userChange() {
const user = await queryUserById(this.formData.userId)
this.setFormData(user)
},
setFormData(user) {
this.$set(this.formData, "userSex", user[0].sex)
this.$set(this.formData, "userName", user[0].username)
this.$set(this.formData, "unitId", user[0].unitid)
this.$set(this.formData, "unionId", user[0].unionid)
this.$set(this.formData, "birthday", user[0].birthday)
this.$set(this.formData, "title", user[0].jobTitle)
//this.$set(this.formData, "post", user[0].position)
this.$set(this.formData, "unionName", user[0].unionname)
this.$set(this.formData, "unitName", user[0].unitname)
this.$set(this.formData, "jobStatus", user[0].userState)
this.$set(this.formData, "political", user[0].political)
},
async userRemoteMethod(query) {
if (query) {
this.userLoading = true
const arr = await searchUser(query)
this.userOptions = arr
this.userLoading = false
}
},
async initData() {
this.honorTypeList = await HonorApi.getHonorType()
if (this.honorTypeList) {
this.$set(this.pageForm,"honorType",this.honorTypeList[0].id)
this.formData = {
honorType: this.honorTypeList[0].id
}
this.honorPrizeList = await HonorApi.getHonorPrize(this.formData.honorType)
}
this.honorLevelList = await HonorApi.getHonorLevel()
this.honorAwardList = await HonorApi.getHonorAwardType()
this.units = await getUnits(null)
this.unions = await getUnions(null)
if (this.formData.honorType === HonorApi.honor_single_id) {
await this.userRemoteMethod("${@shiro.getPrincipalProperty('loginname')}")
this.$set(this.formData, "userId", this.userOptions[0].id)
await this.userChange()
}
},
async honorTypeChange(val) {
this.$set(this.formData, "prize", null)
this.honorPrizeList = await HonorApi.getHonorPrize(val)
if (this.formData.honorType === HonorApi.honor_single_id) {
await this.userRemoteMethod("${@shiro.getPrincipalProperty('loginname')}")
this.$set(this.formData, "userId", this.userOptions[0].id)
await this.userChange()
} else {
}
},
async doSubmit() {
this.formData.files = JSON.stringify(this.formData.files)
const resp = await $.post(loc() + '/doSubmit', this.formData)
if(resp.code===0){
this.$notify.success({title: '成功', message: resp.msg});
this.pageData()
this.$refs.guava.index()
}else{
this.$notify.error({title: '失败', message: resp.msg});
}
},
async findData(data) {
this.formData = {}
const data1 = clone(data)
this.honorPrizeList = await HonorApi.getHonorPrize(data.honorType)
this.formData = data1
if (this.formData.userId && this.formData.userId !== '') {
const user = await queryUserById(this.formData.userId)
this.setFormData(user)
} else {
this.$set(this.formData, 'userName', this.formData.userName)
}
this.$set(this.formData, "prize", data.prize)
this.$set(this.formData, "honorLevel", data.honorLevel)
this.$set(this.formData, "political", data.political)
this.$set(this.formData, "post", data.post)
this.$set(this.formData, "title", data.title)
this.$set(this.formData, "unionId", data1.unionId)
this.$set(this.formData, "unionLeader", data1.unionLeader)
if (data.files && data.files.length > 0) this.$set(this.formData, "files", JSON.parse(data.files))
}
},
watch: {
"formData.prize"(newVal) {
if (this.firstInPage === false && newVal) {
this.$set(this.formData, "honorLevel", this.honorPrizeList.find(v => v.id === newVal).level)
this.firstInPage = false
}
},
"formData.unitName"(newVal) {
const isExist = this.units.some(v => v.name == newVal)
if(this.formData.honorType === HonorApi.honor_single_id) {
if (isExist) {
const unionId = this.units.find(v => v.name == newVal).unionid
this.$set(this.formData, "unionId", unionId ? unionId : "")
} else {
this.$set(this.formData, "unionId", "")
}
}
},
"formData.unionId"(newVal) {
if(this.formData.honorType === HonorApi.honor_list_id) {
if(this.firstInPage === false) {
const un = this.unions.find(o => o.id === newVal)
this.formData.unionLeader = un ? un.leadername : ''
this.formData.unionName = un ? un.unionname : ''
} else {
this.firstInPage = false
}
}
}
},
async created() {
await this.initData()
this.pageData()
}
})
</script>
<!--#
}
#-->