Files
zhgh_hhu/target/classes/views/platform/jdh/db/scmd.html
T
2026-09-20 15:46:34 +08:00

469 lines
21 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"){
#-->
<link rel="stylesheet" href="${base!}/assets/platform/plugins/wp-upload-vue/css/wpupload.css">
<link rel="stylesheet" href="${base!}/assets/platform/plugins/wp-upload-vue/font/iconfont.css">
<script type="text/javascript" src="${base!}/assets/platform/plugins/wp-upload-vue/font/iconfont.js"></script>
<script type="text/javascript" src="${base!}/assets/platform/plugins/wp-upload-vue/js/wpupload.js"></script>
<style>
.el-form .el-select {
width: 100% !important;
}
.wp-upload .wp-upload-button-select-file {
margin: 0 !important;
}
</style>
<div id="app" :style="{padding:(tabShow?'0':'10px')}" v-cloak>
<guava ref="guava">
<transition name="el-zoom-in-center">
<div v-show="tabShow">
<el-card shadow="never">
<div class="btn-group tool-button">
<el-input placeholder="请输入内容" v-model="pageForm.searchKeyword">
<el-select v-model="pageForm.searchName" slot="prepend" placeholder="查询"
style="width: 100px;">
<el-option label="工号" value="u.loginname"></el-option>
<el-option label="姓名" value="u.username"></el-option>
</el-select>
</el-input>
</div>
<div class="btn-group tool-button">
<el-select placeholder="请选择教代会" v-model="pageForm.jdhid" filterable style="width:180px;">
<el-option v-for="item in searchJdhList" :label="item.jdhallname" :value="item.id"
:key="item.id"></el-option>
</el-select>
</div>
<div class="btn-group tool-button">
<el-button type="primary" icon="el-icon-search" @click="doSearch"></el-button>
</div>
<div class="pull-right offscreen-right">
<el-button size="medium" @click="openExport"><i class="el-icon-upload2"></i> 导入</el-button>
<el-button size="medium" @click="openAdd"><i class="ti-plus"></i> 添加</el-button>
</div>
</el-card>
<el-dialog title="上传名单" :visible.sync="addDialogVisible">
<el-form :model="formData" ref="AddForm" :rules="rules" label-width="80px">
<el-form-item prop="jdhid" label="教代会">
<el-select placeholder="代表所属教代会" v-model="formData.jdhid" filterable style="width:180px;"
@change="jdhChange">
<el-option v-for="item in searchJdhList" :label="item.jdhallname" :value="item.id"
:key="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item prop="dbtid" label="代表团">
<el-select v-model="formData.dbtid" filterable @change="dbtChange">
<el-option v-for="i in dbtList" :label="i.dbtname" :key="i.id"
:value="i.id"></el-option>
</el-select>
</el-form-item>
<el-form-item prop="role" label="代表类型">
<el-select v-model="formData.role">
<el-option v-for="i in representativeRoleOptions" :label="i.label" :key="i.value"
:value="i.value"></el-option>
</el-select>
</el-form-item>
<el-form-item prop="user" label="人员">
<el-select
v-model="formData.user"
value-key="id"
filterable
remote
multiple
reserve-keyword
placeholder="请输入工号或者姓名"
:remote-method="queryNotDbUser">
<el-option
v-for="item in notDbUserList"
:key="item.id"
:label="item.username+'-'+item.loginname+'-'+item.dwname"
:value="item">
</el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="addDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="doAdd">确 定</el-button>
</span>
</el-dialog>
<el-card shadow="never" class="mt20">
<el-table :data="tableData" @sort-change='pageOrder'>
<el-table-column label="序号" type="index" header-align="center" align="center">
<template scope="scope">
<span>{{scope.$index+(pageForm.pageNumber - 1) * pageForm.pageSize + 1}} </span>
</template>
</el-table-column>
<el-table-column label="工号" prop="loginname"></el-table-column>
<el-table-column sortable label="姓名" prop="username"></el-table-column>
<el-table-column sortable label="性别" prop="sex"></el-table-column>
<el-table-column label="联系方式" prop="mobile"></el-table-column>
<el-table-column sortable label="所属单位" prop="dbunitname"
show-overflow-tooltip>
<template scope="{row}">
{{isDisPlayCode?'('+row.dbunitid+')':null}}{{row.dbunitname}}
</template>
</el-table-column>
<el-table-column label="代表身份" prop="rolename"></el-table-column>
<el-table-column label="代表团" prop="dbtname" show-overflow-tooltip>
<template scope="{row}">
{{isDisPlayCode?'('+row.delegationCode+')':null}}{{row.dbtname}}
</template>
</el-table-column>
<el-table-column sortable label="状态" prop="dbzt">
<template slot-scope="scope">
<span v-if="scope.row.dbzt===1" class="text-primary">待校工会确认</span>
<span v-if="scope.row.dbzt===2" class="text-success">校工会已确认</span>
</template>
</el-table-column>
<el-table-column label="操作" width="200">
<template slot-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:'delete',data:row}" v-if="row.dbzt===1">
撤回
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</div>
</transition>
<template #view>
<db-info :active="'1'" ref="DbInfo"></db-info>
</template>
<transition name="el-zoom-in-center">
<div v-show="exportShow">
<el-card>
<div class="text-primary pointer" style="font-size: 20px;" @click="tabShow=true;exportShow=false">
<i class="el-icon-arrow-left"></i>
返回
</div>
<el-select v-model="exportjdhid" placeholder="请选择教代会" style="width: 50%">
<el-option v-for="item in jdhList" :key="item.id" :label="item.jdhallname"
:value="item.id"></el-option>
</el-select>
<div style="padding: 10px 0">
<wp-upload
ref="upload"
@on-select="selectFile"
:max-file-number="1"
:allow-files="['xls','xlsx']"
:upload-auto="false"></wp-upload>
</div>
<el-button size="medium" type="primary" @click="downLoadTemp">模板下载</el-button>
<el-button size="medium" type="primary" @click="readExcel">读取数据</el-button>
<el-button size="medium" type="primary" @click="doSubmitExcel">提交</el-button>
<el-table :data="scexcelTable" max-height="500px">
<el-table-column label="序号" type="index"></el-table-column>
<el-table-column label="工号" prop="loginname"></el-table-column>
<el-table-column label="姓名" prop="username"></el-table-column>
<el-table-column label="单位" prop="dwname" show-overflow-tooltip></el-table-column>
<el-table-column label="代表团" prop="dbtname" show-overflow-tooltip></el-table-column>
<el-table-column label="代表类型" prop="role" show-overflow-tooltip></el-table-column>
<el-table-column label="校验结果" prop="isok">
<template slot-scope="{row}">
<i class="el-icon-circle-check text-success" v-if="row.isok"></i>
<i class="el-icon-circle-close text-danger" v-else></i>
</template>
</el-table-column>
<el-table-column prop="info" label="提示" show-overflow-tooltip width="250">
<template slot-scope="{row}">
<span :style="{color:(row.isok?'':'red')}">{{row.info}}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="100" show-overflow-tooltip>
<template slot-scope="{$index}">
<el-button @click="scexcelTable.splice($index,1)" type="danger" icon="el-icon-delete"
circle
size="mini"></el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</transition>
</guava>
</div>
<script>
let vue = new Vue({
el: '#app',
data() {
return {
representativeRoleOptions: [],
scexcelTable: [],
exportShow: false,
dbShow: false,
tabShow: true,
addDialogVisible: false,
rules: {},
formData: {
jdhid: '',
dbtid: '',
user: []
},
jdhList: [],
dbtList: [],
notDbUserList: [],
pageForm: {
...getPageForm(),
jdhid: '',
unitid: '',
searchName: 'u.username',
},
searchJdhList: [],
tableData: [],
dbModal: false,
uid: '',
exportjdhid: '',
readingjdhid: ''
}
},
methods: {
async getRepresentativeRoleOptions() {
const {code, data} = await $.get('/platform/jdh/db/dbgl/representativeRoleOptions')
if (!code) {
this.representativeRoleOptions = data
}
},
dropdownCommand(command) {
const {type, data} = command
if (type == 'view') {
this.openView(data)
} else if (type == 'delete') {
this.doDelete(data.id)
}
},
openExport() {
this.tabShow = false
this.exportShow = true
},
selectFile() {
},
downLoadTemp() {
window.location.href = '/platform/basics/downloadTemplate?filePath=jdh/dbImportTemplate.xls&fileName=代表导入模板.xlsx';
},
readExcel() {
if (this.$refs.upload.fileShowArray.length === 0) {
this.$notify.warning('请先上传文件')
return
}
if (this.exportjdhid === '') {
this.$notify.warning('请选择教代会进行数据对比')
return
}
const loading = this.$loading({
lock: true,
text: '读取文件中',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
this.readingjdhid = this.exportjdhid
let fd = new FormData()
fd.append("jdhid", this.exportjdhid)
fd.append("file", this.$refs.upload.fileShowArray[0].file)
$.ajax({
url: base + '/platform/jdh/db/scmd/readScmdExecl',
type: "post",
data: fd,
processData: false,
contentType: false
}).then(({data}) => {
setTimeout(() => {
loading.close()
this.scexcelTable = data
}, 1000)
}).error(()=>{
loading.close()
this.$message.error('系统异常')
})
},
async doSubmitExcel() {
if (this.exportjdhid === '') {
this.$notify.warning('请先选择教代会!')
return
}
if (this.exportjdhid !== this.readingjdhid) {
this.$notify.warning('提交的教代会和数据校验的教代会届次不同!')
return
}
if (this.scexcelTable.length === 0) {
this.$notify.warning('没有数据!')
return
}
const obj = this.scexcelTable.some(o => {
return !o.isok
})
if (obj) {
this.$notify.error('请先处理错误数据!')
return
}
const loading = this.$loading({
lock: true,
text: '提交中',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
const {data} = await POST('/platform/jdh/db/scmd/doAddExcel', {
data: JSON.stringify(this.scexcelTable),
jdhid: this.exportjdhid
})
loading.text = '提交成功'
loading.spinner = 'el-icon-circle-check'
setTimeout(() => {
loading.close()
this.scexcelTable = []
this.exportjdhid = ''
this.exportShow = false
this.tabShow = true
this.doSearch()
}, 1000)
},
openView(row) {
const {dbid} = row
this.$refs.DbInfo.openView(dbid)
this.$refs.guava.view()
},
openAdd() {
this.formData = {
jdhid: '',
dbtid: '',
user: []
}
if (this.jdhList.length > 0) {
this.formData.jdhid = this.jdhList[0].id
this.getDbtList(this.formData.jdhid)
}
this.notDbUserList = []
this.addDialogVisible = true
},
getJdhList() {
$.post(base + '/platform/jdh/db/scmd/getJdhList', {jdhkqzt: 1}).then(res => {
if (res.code === 0) {
this.jdhList = res.data.filter(f => {
return f.jdhkqzt === 1
})
this.searchJdhList = res.data
if (this.searchJdhList.length > 0) {
this.pageForm.jdhid = this.searchJdhList[0].id
this.pageData()
}
}
})
},
getDbtList(jdhid) {
$.post(base + '/platform/jdh/db/scmd/getDbtList', {jdhid: jdhid}).then(res => {
if (res.code === 0) {
this.dbtList = res.data
if ("${@shiro.hasRole('sysadmin')}" !== 'true') {
this.formData.dbtid = this.dbtList[0].id
}
}
})
},
jdhChange(jdhid) {
this.formData.dbtid = ''
this.dbtList = []
this.formData.user = []
this.notDbUserList = []
this.getDbtList(jdhid)
},
dbtChange() {
this.formData.user = []
this.notDbUserList = []
},
queryNotDbUser(key) {
if (this.formData.dbtid === '') {
this.$message.info('请先选择代表团')
return
}
let data = this.formData
data.keyword = key
$.post(base + '/platform/jdh/db/scmd/queryNotDbUser', data).then(res => {
if (res.code === 0) {
//this.notDbUserList = res.data.list
this.notDbUserList = QC(this.formData.user, res.data.list, 'id')
//this.notDbUserList = QC(this.notDbUserList,res.data.list,'id')
}
})
},
doAdd() {
$.post(base + '/platform/jdh/db/scmd/doAdd', this.formData).then(res => {
if (res.code === 0) {
this.addDialogVisible = false
this.doSearch()
}
})
},
doDelete(id) {
this.$confirm('撤回后将删除这条记录, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
$.post(base + '/platform/jdh/db/scmd/doDelete', {id: id}).then(res => {
if (res.code === 0) {
this.doSearch()
this.$message.success(res.msg)
}
})
}).catch(() => {
})
},
...pageSomeThing
},
components: {
'guava': httpVueLoader('/components/plugins/Guava.vue'),
'db-info': httpVueLoader('/components/jdh/dbinfo.vue')
},
async created() {
this.getRepresentativeRoleOptions()
this.getJdhList()
this.searchJdhList = await getOpenJdh()
if (this.searchJdhList.length > 0) {
this.pageForm.jdhid = this.searchJdhList[0].id
this.pageData()
}
}
})
</script>
<!--#
}
#-->