first commit
This commit is contained in:
@@ -0,0 +1,354 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
<style>
|
||||
.el-tabs__content {
|
||||
padding-top: 20px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava ref="guava">
|
||||
<template>
|
||||
<el-card shadow="never">
|
||||
<div class="search">
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">年度:</div>
|
||||
<div class="search-item-option">
|
||||
<el-date-picker
|
||||
:clearable="false"
|
||||
@change="yearChange"
|
||||
placeholder="选择年"
|
||||
style="width: 100%"
|
||||
type="year"
|
||||
v-model="pageForm.year"
|
||||
value-format="yyyy">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">所属问卷:</div>
|
||||
<div class="search-item-option">
|
||||
<el-select filterable="true" placeholder="所属问卷" style="width: 100%;"
|
||||
v-model="pageForm.questionId">
|
||||
<el-option :label="item.qtitle" :value="item.qid" v-for="item in questions"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="search-item" v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')}">
|
||||
<div class="search-item-label">所属工会:</div>
|
||||
<div class="search-item-option">
|
||||
<el-select @change="getData()" clearable="true" filterable="true"
|
||||
placeholder="所属工会" style="width: 100%;" v-model="pageForm.unionId">
|
||||
<el-option :label="item.unionname" :value="item.id" v-for="item in unions"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="search-query">
|
||||
<el-button @click="doSearch" icon="el-icon-search" type="primary">搜索</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<el-card class="mt10" shadow="never">
|
||||
<table-tool :app="this" label="工会列表">
|
||||
<template #func>
|
||||
<template
|
||||
v-if="questions.find(v => v.qid === pageForm.questionId) && questions.find(v => v.qid === pageForm.questionId).qlx === 3">
|
||||
<el-button :disabled="!pageForm.questionId" @click="doExportInventory"
|
||||
icon="el-icon-printer"
|
||||
size="small"
|
||||
type="primary">导出购物清单
|
||||
</el-button>
|
||||
|
||||
|
||||
<el-button :disabled="!pageForm.questionId" @click="doExport" icon="el-icon-printer"
|
||||
size="small"
|
||||
type="primary">导出汇总
|
||||
</el-button>
|
||||
</template>
|
||||
<template
|
||||
v-if="questions.find(v => v.qid === pageForm.questionId) && questions.find(v => v.qid === pageForm.questionId).qlx === 4 && ${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')}">
|
||||
<el-button @click="sendMsg" icon="el-icon-s-promotion" size="small" type="primary">
|
||||
短信通知
|
||||
</el-button>
|
||||
<el-button
|
||||
@click="shopExport(true)" icon="el-icon-printer"
|
||||
size="small"
|
||||
type="primary">按商品导出
|
||||
</el-button>
|
||||
<el-button
|
||||
@click="doUnionUserExport(true)" icon="el-icon-printer"
|
||||
size="small"
|
||||
type="primary">导出已选名单
|
||||
</el-button>
|
||||
|
||||
<el-button
|
||||
@click="doUnionUserExport(false)" icon="el-icon-printer"
|
||||
size="small"
|
||||
type="primary">导出未选名单
|
||||
</el-button>
|
||||
<el-button :disabled="!pageForm.questionId" @click="doExportCakeUnion"
|
||||
icon="el-icon-printer"
|
||||
size="small"
|
||||
type="primary">导出汇总表
|
||||
</el-button>
|
||||
</template>
|
||||
</template>
|
||||
</table-tool>
|
||||
|
||||
<el-table :data="tableData"
|
||||
:show-summary="questions.find(v => v.qid === pageForm.questionId) && questions.find(v => v.qid === pageForm.questionId).qlx === 4"
|
||||
:size="tableSize" @sort-change="pageOrder"
|
||||
class="vi-table"
|
||||
ref="table" row-key="id" style="width: 100%" v-loading="tableLoading">
|
||||
<el-table-column type="index" width="50"></el-table-column>
|
||||
<el-table-column
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:sortable="column.sortable"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
v-for="column in tableColumns"
|
||||
>
|
||||
<template scope="{row}" v-if="column.prop=='unselectedTeacherSum'">
|
||||
<el-link @click="viewUnselectedUser(row)" type="primary">
|
||||
{{row.unselectedTeacherSum}}
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="center" header-align="center" label="操作"
|
||||
prop="userOnline" v-if="tableData && tableData.length>0 && [2,3,4].includes(qlx)"
|
||||
width="100px">
|
||||
<template scope="{ row }">
|
||||
<el-button @click="openView(row.unionId)" size="mini" type="primary"
|
||||
v-if="[2,3,4].includes(qlx)">
|
||||
查看
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<template #view>
|
||||
<question-x ref="questionX"></question-x>
|
||||
</template>
|
||||
</guava>
|
||||
|
||||
<el-dialog :title="unselectUserDialogTitle" :visible.sync="unselectUserDialog" width="50%">
|
||||
<div>
|
||||
<el-button @click="doExportUnselectedCakeUser"
|
||||
class="pull-right"
|
||||
icon="el-icon-printer"
|
||||
type="primary">导出未领取人员
|
||||
</el-button>
|
||||
</div>
|
||||
<el-table :data="unselectUserTable" height="500px">
|
||||
<el-table-column label="姓名" prop="username"></el-table-column>
|
||||
<el-table-column label="工号" prop="loginname"></el-table-column>
|
||||
<el-table-column label="单位" prop="unitname"></el-table-column>
|
||||
<el-table-column label="手机号" prop="mobile"></el-table-column>
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var vue = new Vue({
|
||||
el: '#app',
|
||||
data() {
|
||||
return {
|
||||
unions: [],
|
||||
questions: [],
|
||||
personnelData: [],
|
||||
personnelLoading: false,
|
||||
tableLoading: false,
|
||||
tableData: [],
|
||||
tableSize: '',
|
||||
tableKey: '',
|
||||
tableColumns: [],
|
||||
personnelColumns: [
|
||||
{prop: 'username', label: '姓名'},
|
||||
{prop: 'loginname', label: '工号'},
|
||||
{prop: 'unitname', label: '所属单位'},
|
||||
{prop: 'unionname', label: '所属工会'},
|
||||
{prop: 'fraction', label: '分值'}
|
||||
],
|
||||
pageForm: {
|
||||
year: new Date().getFullYear() + ''
|
||||
},
|
||||
unselectUserDialog: false,
|
||||
unselectUserDialogTitle: '',
|
||||
unselectUserTable: [],
|
||||
selectUnion: {}
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'guava': httpVueLoader('/components/plugins/Guava.vue'),
|
||||
'question-x': httpVueLoader('/components/question/QuestionDetail.vue')
|
||||
},
|
||||
computed: {
|
||||
qlx() {
|
||||
const qs = this.questions
|
||||
const qid = this.pageForm.questionId
|
||||
if (qs && qs.length > 0 && qid) {
|
||||
return qs.find(v => v.qid === qid).qlx
|
||||
}
|
||||
return null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
sendMsg() {
|
||||
this.$confirm('您确定要向未领取人员发送短信提醒吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(async () => {
|
||||
const resp = await $.post(loc()+'/sendMsg', {questionId: this.pageForm.questionId})
|
||||
if (resp.code === 0) {
|
||||
this.$message.success(resp.msg)
|
||||
} else {
|
||||
this.$message.error(resp.msg)
|
||||
}
|
||||
}).catch(() => {
|
||||
|
||||
});
|
||||
},
|
||||
shopExport() {
|
||||
if (!this.pageForm.questionId) {
|
||||
this.$notify.warning({title: '警告', message: '请先选择问卷!'});
|
||||
return
|
||||
}
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: '正在努力导出中,感谢您的耐心等待!',
|
||||
spinner: 'el-icon-loading',
|
||||
background: COVER_LAYER_COLOR
|
||||
});
|
||||
axios.post(loc() + "/shopExport?questionId=" + this.pageForm.questionId, {}, {responseType: 'blob'})
|
||||
.then((res) => {
|
||||
const {data, headers} = res
|
||||
const fileName = headers['content-disposition'].replace(/\w+;filename=(.*)/, '$1')
|
||||
// 此处当返回json文件时需要先对data进行JSON.stringify处理,其他类型文件不用做处理
|
||||
//const blob = new Blob([JSON.stringify(data)], ...)
|
||||
const blob = new Blob([data], {type: headers['content-type']})
|
||||
let dom = document.createElement('a')
|
||||
let url = window.URL.createObjectURL(blob)
|
||||
dom.href = url
|
||||
dom.download = decodeURI(fileName)
|
||||
dom.style.display = 'none'
|
||||
document.body.appendChild(dom)
|
||||
dom.click()
|
||||
dom.parentNode.removeChild(dom)
|
||||
window.URL.revokeObjectURL(url)
|
||||
loading.close();
|
||||
}).catch((err) => {
|
||||
})
|
||||
//window.open(loc() + "/shopExport?questionId=" + this.pageForm.questionId)
|
||||
},
|
||||
doUnionUserExport(flag) {
|
||||
window.open(loc() + "/doUnionUserExport?questionId=" + this.pageForm.questionId + "&flag=" + flag)
|
||||
},
|
||||
doExportUnselectedCakeUser() {
|
||||
window.open(loc() + "/doExportCakeUser?questionId=" + this.pageForm.questionId + '&ghId=' + this.selectUnion.unionId + '&isSelected=false')
|
||||
},
|
||||
async viewUnselectedUser(row) {
|
||||
this.unselectUserDialogTitle = row.unionName + '未选人员名单'
|
||||
this.unselectUserDialog = true
|
||||
this.selectUnion = row
|
||||
const params = {
|
||||
unionId: row.unionId,
|
||||
questionId: this.pageForm.questionId
|
||||
}
|
||||
const {data} = await $.get('/platform/zgfw/question/cake/getUnselectedUser', params)
|
||||
this.unselectUserTable = data
|
||||
},
|
||||
|
||||
doExportCakeUnion() {
|
||||
window.open('/platform/zgfw/question/cake/doExportCakeUnion?questionId=' + this.pageForm.questionId)
|
||||
},
|
||||
|
||||
doExport() {
|
||||
location.href = loc() + '/doExport?questionId=' + (this.pageForm.questionId ? this.pageForm.questionId : '') + '&unionId=' + (this.pageForm.unionId ? this.pageForm.unionId : '')
|
||||
},
|
||||
doExportInventory() {
|
||||
location.href = loc() + '/doExportInventory?questionId=' + this.pageForm.questionId
|
||||
},
|
||||
async getData() {
|
||||
this.tableLoading = true
|
||||
const {data} = await $.post(loc() + "/getData", this.pageForm)
|
||||
this.tableColumns = data.label
|
||||
this.tableData = data.list
|
||||
|
||||
console.log(data)
|
||||
this.tableLoading = false
|
||||
|
||||
},
|
||||
async openView(unionId) {
|
||||
|
||||
const {data, code, msg} = await this.getAnswerData(unionId)
|
||||
if (code !== 0) {
|
||||
this.$notify.error({title: '错误', message: msg});
|
||||
return
|
||||
}
|
||||
this.personnelData = data
|
||||
this.personnelLoading = true
|
||||
this.$refs.guava.view()
|
||||
setTimeout(() => {
|
||||
this.$refs['questionX'].openView(this.pageForm.questionId, this.questions, unionId)
|
||||
}, 100)
|
||||
this.personnelLoading = false
|
||||
},
|
||||
async getAnswerData(unionId) {
|
||||
return await $.get(loc() + "/getAnswerData", {
|
||||
questionId: this.pageForm.questionId,
|
||||
unionId: unionId
|
||||
});
|
||||
},
|
||||
async yearChange() {
|
||||
this.questions = await this.getQuestion()
|
||||
this.$set(this.pageForm, "questionId", this.questions.length > 0 ? this.questions[0].qid : '')
|
||||
},
|
||||
async getQuestion() {
|
||||
const {data} = await $.get(loc() + "/getQuestion", {year: this.pageForm.year})
|
||||
return data
|
||||
},
|
||||
tableSizeChange(size) {
|
||||
this.tableSize = size
|
||||
},
|
||||
columnChange(val) {
|
||||
this.tableLoading = true
|
||||
this.tableColumns = val
|
||||
this.tableLoading = false
|
||||
},
|
||||
doSearch() {
|
||||
this.tableKey = new Date().getTime()
|
||||
this.getData()
|
||||
},
|
||||
pageOrder(column) {
|
||||
this.pageForm.pageOrderName = column.prop;
|
||||
this.pageForm.pageOrderBy = column.order;
|
||||
this.getData();
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
this.questions = await this.getQuestion()
|
||||
this.questions = this.questions.filter(v => [1, 3, 4].includes(v.qlx))
|
||||
this.$set(this.pageForm, "questionId", this.questions.length > 0 ? this.questions[0].qid : '')
|
||||
this.unions = await getUnions(null)
|
||||
if (this.pageForm.questionId !== "") {
|
||||
this.getData();
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
Reference in New Issue
Block a user