468 lines
21 KiB
HTML
468 lines
21 KiB
HTML
<!--#
|
||
layout("/layouts/platform.html"){
|
||
#-->
|
||
<link href="${base!}/assets/platform/plugins/wp-upload-vue/css/wpupload.css" rel="stylesheet">
|
||
<link href="${base!}/assets/platform/plugins/wp-upload-vue/font/iconfont.css" rel="stylesheet">
|
||
<script src="${base!}/assets/platform/plugins/wp-upload-vue/font/iconfont.js" type="text/javascript"></script>
|
||
<script src="${base!}/assets/platform/plugins/wp-upload-vue/js/wpupload.js" type="text/javascript"></script>
|
||
<style>
|
||
.el-form .el-select {
|
||
width: 100% !important;
|
||
}
|
||
|
||
.wp-upload .wp-upload-button-select-file {
|
||
margin: 0 !important;
|
||
}
|
||
</style>
|
||
|
||
<div :style="{padding:(tabShow?'0':'10px')}" id="app" 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 placeholder="查询" slot="prepend" style="width: 100px;"
|
||
v-model="pageForm.searchName">
|
||
<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 filterable placeholder="请选择教代会" style="width:180px;" v-model="pageForm.jdhid">
|
||
<el-option :key="item.id" :label="item.jdhallname" :value="item.id"
|
||
v-for="item in searchJdhList"></el-option>
|
||
</el-select>
|
||
</div>
|
||
|
||
<div class="btn-group tool-button">
|
||
<el-button @click="doSearch" icon="el-icon-search" type="primary"></el-button>
|
||
</div>
|
||
|
||
<div class="pull-right offscreen-right">
|
||
<el-button @click="openExport" size="medium"><i class="el-icon-upload2"></i> 导入</el-button>
|
||
<el-button @click="openAdd" size="medium"><i class="ti-plus"></i> 添加</el-button>
|
||
</div>
|
||
</el-card>
|
||
|
||
<el-dialog :visible.sync="addDialogVisible" title="上传名单">
|
||
<el-form :model="formData" :rules="rules" label-width="80px" ref="AddForm">
|
||
<el-form-item label="教代会" prop="jdhid">
|
||
<el-select @change="jdhChange" filterable placeholder="代表所属教代会" style="width:180px;"
|
||
v-model="formData.jdhid">
|
||
<el-option :key="item.id" :label="item.jdhallname" :value="item.id"
|
||
v-for="item in searchJdhList"></el-option>
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="代表团" prop="dbtid">
|
||
<el-select @change="dbtChange" filterable v-model="formData.dbtid">
|
||
<el-option :key="i.id" :label="i.dbtname" :value="i.id"
|
||
v-for="i in dbtList"></el-option>
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="代表类型" prop="role">
|
||
<el-select v-model="formData.role">
|
||
<el-option :key="i.value" :label="i.label" :value="i.value"
|
||
v-for="i in representativeRoleOptions"></el-option>
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="人员" prop="user">
|
||
<el-select
|
||
:remote-method="queryNotDbUser"
|
||
filterable
|
||
multiple
|
||
placeholder="请输入工号或者姓名"
|
||
remote
|
||
reserve-keyword
|
||
v-model="formData.user"
|
||
value-key="id">
|
||
<el-option
|
||
:key="item.id"
|
||
:label="item.username+'-'+item.loginname+'-'+item.dwname"
|
||
:value="item"
|
||
v-for="item in notDbUserList">
|
||
</el-option>
|
||
</el-select>
|
||
</el-form-item>
|
||
</el-form>
|
||
<span class="dialog-footer" slot="footer">
|
||
<el-button @click="addDialogVisible = false">取 消</el-button>
|
||
<el-button @click="doAdd" type="primary">确 定</el-button>
|
||
</span>
|
||
</el-dialog>
|
||
|
||
<el-card class="mt20" shadow="never">
|
||
<el-table :data="tableData" @sort-change='pageOrder'>
|
||
<el-table-column align="center" header-align="center" label="序号" type="index">
|
||
<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 label="姓名" prop="username" sortable></el-table-column>
|
||
<el-table-column label="性别" prop="sex" sortable></el-table-column>
|
||
<el-table-column label="联系方式" prop="mobile"></el-table-column>
|
||
<el-table-column label="所属单位" prop="dbunitname" show-overflow-tooltip
|
||
sortable>
|
||
<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 label="状态" prop="dbzt" sortable>
|
||
<template slot-scope="scope">
|
||
<span class="text-primary" v-if="scope.row.dbzt===1">待校工会确认</span>
|
||
<span class="text-success" v-if="scope.row.dbzt===2">校工会已确认</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 @click="tabShow=true;exportShow=false" class="text-primary pointer" style="font-size: 20px;">
|
||
<i class="el-icon-arrow-left"></i>
|
||
返回
|
||
</div>
|
||
|
||
<el-select placeholder="请选择教代会" style="width: 50%" v-model="exportjdhid">
|
||
<el-option :key="item.id" :label="item.jdhallname" :value="item.id"
|
||
v-for="item in jdhList"></el-option>
|
||
</el-select>
|
||
<div style="padding: 10px 0">
|
||
<wp-upload
|
||
:allow-files="['xls','xlsx']"
|
||
:max-file-number="1"
|
||
:upload-auto="false"
|
||
@on-select="selectFile"
|
||
ref="upload"></wp-upload>
|
||
</div>
|
||
<el-button @click="downLoadTemp" size="medium" type="primary">模板下载</el-button>
|
||
<el-button @click="readExcel" size="medium" type="primary">读取数据</el-button>
|
||
<el-button @click="doSubmitExcel" size="medium" type="primary">提交</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 label="提示" prop="info" 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="操作" show-overflow-tooltip width="100">
|
||
<template slot-scope="{$index}">
|
||
<el-button @click="scexcelTable.splice($index,1)" circle icon="el-icon-delete"
|
||
size="mini"
|
||
type="danger"></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>
|
||
<!--#
|
||
}
|
||
#-->
|
||
|