first commit

This commit is contained in:
2026-09-20 15:46:34 +08:00
parent 72fb5eae10
commit e558339dcc
3340 changed files with 671310 additions and 251 deletions
@@ -0,0 +1,543 @@
const BASE_URL = '/mobile/question/h5'
const onlineAnswer = {
template:
`
<div style="height: 100%">
<div style="max-height: 700px;overflow-y: scroll">
<div class="btDiv mb10" title="">
<el-row style="text-align: center">
<h2>{{questionData.qtitle}}</h2>
</el-row>
</div>
<div class="survey-container" v-if="!mLoading">
<!-- 顶部信息区 -->
<el-card class="survey-head-top" shadow="never">
<!-- 轮次/日期选择 -->
<template v-if="questionData.qlx==2">
<el-dropdown @command="randomCountSelect"
v-if="questionData.ctMode==2 && isSameDay && randomCount > 0">
<el-button>
第{{randomCount}}轮<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item v-for="i in userHasAnswerRandomNum" :key="i"
:command="{val: i}">第{{i}}轮
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-date-picker
v-else-if="questionData.ctMode==1 || (questionData.ctMode==2 && !isSameDay)"
v-model="currentDate"
type="date"
:disabled-date="disabledDate"
@change="dateChange">
</el-date-picker>
</template>
<!-- 分数显示 -->
<span class="score" v-if="finishAnswer && (currentScore || currentScore===0)">
{{questionData.calcScoreMode==1 ? '今日最高成绩' : '得分'}}:{{currentScore}}
</span>
<!-- 计时器 -->
<span v-if="questionData.enableTimer && !finishAnswer">
剩余时间:{{remainder}}
</span>
</el-card>
<!-- 题目列表 -->
<el-table :data="issueList"
class="issueList mt10"
default-expand-all="true"
highlight-current-row="true"
style="width: 100%">
<el-table-column align="left" header-align="left" label="">
<template scope="issue">
<el-col :span="1">
<span style="color: red" v-if="issue.row.iisbd">*</span>
<span style="font-weight: bolder">{{issue.$index+1}}.</span>
</el-col>
<el-col :span="23">
<el-row>
<el-col :span="1" v-if="issue.row.fraction">
<span>({{issue.row.fraction}}分)</span>
</el-col>
<el-col :span="23" style="display: flex">
<span v-html="issue.row.iname"></span>
<span v-if="issue.row.itx===1" size="mini" style="font-weight: bold">
({{issue.row.iisdx ? '单选' : '多选'}})
</span>
</el-col>
</el-row>
<el-row>
<div style="color: rgb(160,160,160)" v-html="issue.row.its"
v-if="!isNull(issue.row.its)"></div>
</el-row>
<el-row>
<el-row v-for="wor,idx in issue.row.wors">
<el-row style="margin-top: 5px" v-if="wor.wimg">
<el-image
:src="FILE_STREAM_PREVIEW_ADDRESS + '?id=' +wor.wimg"
fit="fill"
style="max-width: 100px;max-height: 100px"></el-image>
</el-row>
<el-row style="margin-top: 5px"
v-if="!isNull(wor.wimg)">
<div style="color: rgb(160,160,160);text-align: left">
<div v-html="wor.wsm"></div>
</div>
</el-row>
<!-- <el-radio v-if="issue.row.iisdx==true"-->
<!-- :label="idx"-->
<!-- v-model="issue.row.userSelect"-->
<!-- border-->
<!-- style="margin-bottom: 5px;"-->
<!-- :disabled="finishAnswer || finishAllAnswer"-->
<!-- size="small">-->
<!-- <span>{{wor.wtxt}}</span>-->
<!-- </el-radio>-->
<!-- :disabled="finishAnswer || finishAllAnswer"-->
<el-checkbox style="margin-bottom: 5px;"
class="custom-disabled-checkbox"
border
size="small"
v-model="issue.row.userSelect"
:key="idx"
:label="wor.wid">
<span>{{wor.wtxt}}</span>
</el-checkbox>
<span v-else-if="wor.wistk==true" class="inputParent">
<el-input
size="mini"
style="border-top: none"
disabled
v-model="wor.tktxt"></el-input>
<span style="color:red;"
v-if="wor.wisbt==true">*</span>
</span>
<el-row style="margin-top: 5px"
v-if="isNull(wor.wimg)&&!isNull(wor.wsm)">
<div style="color: rgb(160,160,160)">
<div v-html="wor.wsm"></div>
</div>
</el-row>
</el-row>
</el-row>
<el-row v-if="issue.row.itx==2">
<el-input size="small" style="width: 50%"
v-for="wor in issue.row.wors"
v-model="issue.row.tktxt"></el-input>
</el-row>
<div v-if="finishAnswer" class="question-result">
<span :class="issue.row.isEqual ? 'text-success' : 'text-danger'">
{{issue.row.isEqual ? '回答正确' : '回答错误'}}
</span>
<span>
正确答案:{{issue.row.wors.filter(v=>v.correct).map(v=>v.wtxt).join('')}}
</span>
</div>
</el-col>
</template>
</el-table-column>
</el-table>
</div>
</div>
<div class="page-control" style="display: flex;justify-content: center;margin-top: 10px">
<el-button v-if="!finishAnswer && !questionData.enableTimer"
type="primary"
@click="save">保存
</el-button>
<el-button v-if="!finishAnswer"
type="primary"
@click="submit">提交
</el-button>
<el-button v-if="canAnswerAgain && finishAnswer"
type="primary"
@click="answerAgain">再答一次
</el-button>
</div>
</div>
`, data() {
return {
questionData: {
issues: []
},
currentIssueIndex: 0,
replyInfo: [],
finishAnswer: false,
finishAllAnswer: false,
mLoading: true,
//用户已答题总轮数
randomCount: null,
currentRandomCountScore: 0,
sumScore: 0,
randomCountSheetShow: false,
randomActions: [],
currentRandomCount: null,
//能否再次答题
canAnswerAgain: false,
//当前的时间(针对定时定题)
currentDate: moment().format('YYYY-MM-DD'),
//当前分数
currentScore: null,
//获取用户已回答的轮数 针对单天随机
userHasAnswerRandomNum: 0,
//倒计时计时器
timerInterval: null, //答题时间(使用秒)
countDownSeconds: 0, //剩余时间
remainder: null,
isNull(val) {
return !val
},
}
},
computed: {
issueList() {
return this.questionData.issues
}, titleMsg() {
const radios = this.issueList.filter(v => v.itx === 1 && v.iisdx)
const checkBoxes = this.issueList.filter(v => v.itx === 1 && !v.iisdx)
const radioScore = radios && radios.length > 0 ? radios[0].fraction : 0
const checkBoxesScore = checkBoxes && checkBoxes.length > 0 ? checkBoxes[0].fraction : 0
const radioScoreSum = radios.map(v => v.fraction ? v.fraction : 0).reduce((a, b) => a + b, 0)
const checkBoxesScoreSum = checkBoxes.map(v => v.fraction ? v.fraction : 0).reduce((a, b) => a + b, 0)
const sumScore = radioScoreSum + checkBoxesScoreSum
let radiosText = ''
let checkBoxesText = ''
if (radios && radios.length > 0) {
radiosText = "单选题" + radios.length + "题,每题" + radioScore + "分,合计" + radioScoreSum + "分;"
}
if (checkBoxes && checkBoxes.length > 0) {
checkBoxesText = "多选题" + checkBoxes.length + "题,每题" + checkBoxesScore + "分,合计" + checkBoxesScoreSum + "分;总分" + sumScore + "分。"
}
return "说明:" + radiosText + checkBoxesText
},
fullScore() {
return this.issueList.map(v => v.fraction ? v.fraction : 0).reduce((a, b) => a + b)
}, radioNum() {
return this.issueList.filter(v => v.idx === 1 && v.iisdx).map(v => v.fraction ? v.fraction : 0).reduce((a, b) => a + b)
}, checkBoxNum() {
},
//判断是否为同一天
isSameDay() {
if (this.questionData.startTime && this.questionData.endTime) {
return moment(this.questionData.startTime).isSame(moment(this.questionData.endTime), 'day')
}
return false
}
},
methods: {
openRandomCount() {
this.randomCountSheetShow = true
this.randomActions = []
if (this.questionData.qlx == 2 && this.questionData.ctMode == 2 && this.isSameDay) {
for (let i = 0; i < this.userHasAnswerRandomNum; i++) {
this.randomActions.push({
name: '第' + (i + 1) + '轮', val: i + 1
})
}
} else if (this.questionData.qlx == 2 && (this.questionData.ctMode == 1 || (this.questionData.ctMode == 2 && !this.isSameDay))) {
const {startTime, endTime} = this.questionData
const startMoment = moment(startTime)
const endMoment = moment(endTime)
const now = moment()
// 计算两个日期之间相差的天数
const daysDifference = endMoment.diff(startMoment, 'days')
for (let i = 0; i <= daysDifference; i++) {
this.randomActions.push({
name: startMoment.clone().add(i, 'days').format('YYYY-MM-DD'),
val: startMoment.clone().add(i, 'days').format('YYYY-MM-DD'),
disabled: moment(startMoment.clone().add(i, 'days').format('YYYY-MM-DD')).isAfter(now)
})
}
}
}, async randomCountSelect(val) {
if (this.questionData.qlx == 2 && this.questionData.ctMode == 2 && this.isSameDay) {
this.randomCount = val.val
} else if (this.questionData.qlx == 2 && this.questionData.ctMode == 2 && !this.isSameDay) {
this.currentDate = val.val
} else if (this.questionData.qlx == 2 && this.questionData.ctMode == 1) {
this.currentDate = val.val
}
await this.getQuestionData()
await this.checkUserFinishAnswer()
await this.checkCanAnswerAgain()
await this.getScore()
},
async getQuestionData() {
const resp = await $.get(BASE_URL + '/questionInfo/' + this.id, {
currentDate: this.currentDate, randomCount: this.randomCount
})
this.questionData = resp.data
},
// cellToggle(issue, worId) {
// if (this.finishAnswer || this.finishAllAnswer) {
// return
// }
// this.toggle(issue, worId)
// },
//
// toggle(issue, worId) {
// //单选
// if (issue.iisdx) {
// this.$refs['checkboxGroup' + issue.iid][0].toggleAll(false)
// } else {
//
// }
// console.log(issue.userSelect)
// this.$refs['checkboxes' + worId][0].toggle()
// setTimeout(() => {
// console.log(issue.userSelect)
// })
// },
save() {
this.$confirm('保存后下次可继续做答,您确定要保存吗?').then(async () => {
const replies = this.questionData.issues.map(v => {
return {
qid: v.iid, issueId: v.iid, userSelect: v.userSelect,
}
})
const {code} = await $.post(BASE_URL + '/saveAnswer', {
replies: JSON.stringify(replies),
questionId: this.questionData.qid,
isSave: true,
randomCount: this.randomCount
})
this.$modal.closeLoading()
if (code === 0) {
this.$message.success('保存成功')
} else {
this.$message.success('保存失败')
}
})
},
submit() {
const iids = this.questionData.issues.filter(v => !v.userSelect).map(v => v.iid)
if (iids.length > 0) {
this.$toast('您还有' + iids.length + '题未作答,请答完后再提交!')
document.getElementById('issue' + iids[0]).scrollIntoView({
behavior: 'smooth', block: 'center', 'inline': 'start'
});
return
}
const msg = '一旦提交不可修改,您确定要提交吗?'
this.$modal.confirm(msg).then(async () => {
this.autoSubmit()
})
},
async autoSubmit() {
const replies = this.questionData.issues.map(v => {
return {
qid: this.id, issueId: v.iid, userSelect: v.userSelect,
}
})
let takeTime = null
if (this.questionData.enableTimer) {
takeTime = this.questionData.timerMinute * 60 - this.countDownSeconds
}
const {code} = await $.post(BASE_URL + '/saveAnswer', {
replies: JSON.stringify(replies),
questionId: this.questionData.qid,
isSave: false,
randomCount: this.randomCount,
takeTime: takeTime
})
this.$modal.closeLoading()
if (code === 0) {
this.$modal.msg('提交成功')
await this.getUserHasAnswerRandomNum()
await this.checkUserFinishAnswer()
await this.getReply()
await this.assignmentAnswer()
await this.checkUserFinishAnswer()
await this.checkCanAnswerAgain()
await this.getScore()
}
},
//获取回答信息
async getReply() {
const resp = await $.get(BASE_URL + '/answerInfo/' + this.id, {
randomCount: this.randomCount, currentDate: this.currentDate
})
this.replyInfo = resp.data
},
//用户是否全部答完提交
async checkUserFinishAnswer() {
this.mLoading = true
const resp = await $.get(BASE_URL + '/checkUserFinishAnswer', {
questionId: this.id, randomCount: this.randomCount, currentDate: this.currentDate
})
this.mLoading = false
this.finishAnswer = resp.data
await this.getReply()
await this.assignmentAnswer()
},
//答案赋值
assignmentAnswer() {
this.questionData.issues.forEach((issue,issueIndex) => {
const rwids = this.replyInfo.filter(v => v.issueId === issue.iid).map(v => v.rwid)
// rwids.forEach(rwid => {
// // this.toggle(issue, rwid)
// issue.userSelect = rwid
// })
// issue.userSelect = rwids
this.$set(this.questionData.issues[issueIndex],'userSelect',rwids)
const wids = issue.wors.filter(v => v.correct).map(v => v.wid)
const userSelects = this.replyInfo.filter(v => v.issueId === issue.iid).map(v => v.rwid)
const isEqual = wids.length === userSelects.length && wids.every(value => userSelects.includes(value))
issue.isEqual = isEqual
})
},
async answerAgain() {
if (this.questionData.ctMode === 3) {
await this.onOpen(this.id)
this.finishAnswer = false
this.questionData.issues.forEach((issue,issueIndex) => {
issue.wors.forEach(wor => {
this.$set(this.questionData.issues[issueIndex],'userSelect',[])
})
})
this.checkTimer()
} else {
// this.finishAnswer = false
// setTimeout(() => {
// this.questionData.issues.forEach(issue => {
// issue.wors.forEach(wor => {
// // this.$refs['checkboxes' + wor.wid][0].toggle(false)
// wor.userSelect = []
// })
// })
// }, 0)
// this.checkTimer()
}
},
async getUserHasAnswerRandomNum() {
const resp = await $.get(BASE_URL + '/getUserHasAnswerRandomNum', {
questionId: this.id
})
this.userHasAnswerRandomNum = resp.data
this.randomCount = this.userHasAnswerRandomNum
},
async checkCanAnswerAgain() {
const resp = await $.get(BASE_URL + '/checkCanAnswerAgain', {
questionId: this.id, randomCount: this.randomCount, currentDate: this.currentDate
})
this.canAnswerAgain = resp.data
},
async getScore() {
const resp = await $.get(BASE_URL + '/getScore/', {
questionId: this.id, randomCount: this.randomCount, currentDate: this.currentDate
})
this.currentScore = resp.data
},
checkTimer() {
if (this.questionData.enableTimer) {
if (this.timerInterval) {
clearInterval(this.timerInterval)
}
if (!this.finishAnswer) {
this.$alert(
'本次答题时间' + this.questionData.timerMinute + '分钟,请尽快完成!', '提示'
).then(() => {
this.countDownSeconds = this.questionData.timerMinute * 60
this.updateCountdown()
this.timerInterval = setInterval(() => {
this.updateCountdown()
}, 1000)
});
}
}
},
updateCountdown() {
// 计算剩余的分钟和秒数
let mins = Math.floor(this.countDownSeconds / 60)
let secs = this.countDownSeconds % 60
// 格式化时间,确保分钟和秒数始终是两位数
mins = mins < 10 ? '0' + mins : mins;
secs = secs < 10 ? '0' + secs : secs;
this.remainder = mins + ':' + secs
// 如果倒计时结束,显示结束信息
if (this.countDownSeconds <= 0) {
this.remainder = '时间到'
clearInterval(this.timerInterval)
this.$alert(
'答题时间到,请点击确认提交答案!', '提示'
).then(() => {
this.autoSubmit()
})
} else {
this.countDownSeconds = this.countDownSeconds - 1
}
},
async onOpen(id) {
if (this.timerInterval) {
clearInterval(this.timerInterval)
}
this.id = id
await this.getQuestionData()
await this.checkCanAnswerAgain()
await this.getUserHasAnswerRandomNum()
await this.checkUserFinishAnswer()
await this.getScore()
await this.checkTimer()
}
},
async created() {
},
style: /*language=CSS*/ `
.custom-disabled-checkbox{
pointer-events: none;
}
`
}
@@ -0,0 +1,156 @@
const batchInsert = {
template: `
<el-dialog title="批量添加1111" :visible.sync="visible" width="70%" top="50px" :close-on-click-modal="false">
<div style="display: flex;justify-content: space-between;align-items: center">
<p style="line-height: 24px;margin-bottom: 10px;color: #333;">1、题目的识别基于标题前的题型说明,放在标题的前面,格式为“<span>[题型]标题内容((描述))</span>“<br>2、题干与选项,及各选项之间需回车换行</p>
<el-button size="medium">清空文本</el-button>
<div>
{{errorMsg}}
</div>
</div>
<div style="display: flex;height: 60vh;max-height: 1000px;border: 1px solid #ccc;">
<div style="border-right: 1px solid #ccc;height: 100%;width: 50%;overflow: auto">
<textarea name="txtContentNew"
v-model="txt"
cols="20"
rows="2"
wrap="off"
style="height: 59vh;width: 100%;overflow: auto;border: none;padding: 20px 10px 10px;display:inline-block;line-height: 20px;outline: none;"
placeholder=""></textarea>
</div>
<div style="height: 100%;width: 50%;overflow: auto;padding: 20px 10px 10px">
<div v-for="(issue,index) in issues" :key="index" style="margin-bottom: 10px">
<div style="display: flex">
<div>{{index+1}}、{{issue.iname}}</div>
</div>
<div v-if="issue.wors">
<el-radio-group v-if="issue.iisdx">
<div v-for="wor in issue.wors" :key="wor.wtxt">
<el-radio :label="wor.wtxt">{{wor.wtxt}}</el-radio>
</div>
</el-radio-group>
<el-checkbox-group v-if="!issue.iisdx">
<el-radio :label="wor.wtxt" :key="wor.wtxt" v-for="wor in issue.wors">{{wor.wtxt}}</el-radio>
</el-checkbox-group>
</div>
</div>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="visible = false">取 消</el-button>
<el-button type="primary" @click="confirm">确 定</el-button>
</div>
</el-dialog>
`,
data() {
return {
visible: false,
txt: null,
errorMsg: null
}
},
computed: {
issues() {
if (!this.txt) {
return []
}
let errorMsg = ''
// 使用正则表达式分割文本为单独的问题
// const questionTexts = this.txt.split('\n').map(line => line.trim()).join(); // 每个问题之间用换行符分隔
const questionTexts = this.txt.split('\n').map(v => v.trim()).join('\n').split("\n\n")
// 初始化问题数组
const questions = [];
// 遍历每个问题文本
questionTexts.forEach((questionText, index) => {
debugger
// 提取问题编号和题干
const match = questionText.trim().split('\n').slice(0, 1).join('').match(/^(?:\d+\.|\d+、)?\s*(.*?)\s*\[(.*题)\]\s*(?:\((\d+)分\)|\((\d+)分\))?$/);
if (match) {
const questionContent = match[1].trim();
const questionType = match[2];
const scoreChinese = match[3];
const scoreEnglish = match[4];
const score = scoreChinese || scoreEnglish;
// 题型合法性校验
const validTypes = ['多选题', '单选题'];
if (!validTypes.includes(questionType)) {
console.warn('问题' + (index + 1) + '的题型不合法: ' + questionType);
errorMsg += '\n问题' + (index + 1) + '的题型不合法: ' + questionType;
return;
}
// 分数格式校验
if (score) {
const scoreNumber = parseInt(score, 10);
if (isNaN(scoreNumber)) {
console.warn('问题' + (index + 1) + '的分数格式无效: ' + score);
errorMsg += '\n问题' + (index + 1) + '的分数格式无效: ' + score;
return;
}
}
// 提取选项
const optionTexts = questionText.replaceAll(match.input, "").split('\n').slice(1).filter(line => line.trim()); // 假设选项从第二行开始
const options = [];
optionTexts.forEach(optionText => {
// 使用正则表达式提取选项名称和是否正确
const optionMatch = optionText.match(/^([A-Z])\.?(.+?)\((正确答案|错误答案)\)/);
if (optionMatch) {
const optionName = optionMatch[1] + optionMatch[2].trim();
const isCorrect = optionMatch[3] === '正确答案';
options.push({wtxt: optionName, correct: isCorrect});
} else {
options.push({wtxt: optionText.trim(), correct: false});
}
});
// 构建问题对象
const question = {
//是否必答
iisbd: true,
//单选还是多选
iisdx: questionType === '单选题',
//是否随机选项???
iisrandom: false,
//题干
iname: questionContent,
//排列方式 没用
iplfs: 1,
//提示
its: null,
//题型 (1 选择题 2 填空题 3 判断题)
itx: (questionType === '单选题' || questionType === '多选题') ? 1 : 3,
//分数
fraction: score,
//选项
wors: options
};
// 添加到问题数组中
questions.push(question);
}
});
this.errorMsg = errorMsg
console.log(questions)
return questions
}
},
methods: {
onOpen() {
debugger
this.txt = null
this.visible = true
},
async confirm() {
if (this.errorMsg) {
this.$message.warning('存在不合法的题目,请调整后再提交')
return
}
this.$emit('confirm', this.issues)
this.visible = false
},
}
}
@@ -0,0 +1,513 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
#qsmEditor .w-e-text-container {
height: 200px !important;
}
.btDiv {
cursor: pointer;
}
.btDiv:hover {
background-color: rgb(240, 240, 240);
}
.shou {
cursor: pointer;
}
.issue {
cursor: pointer;
padding: 20px 0;
}
.issue:hover {
background-color: rgb(240, 240, 240);
}
.el-divider {
background-color: #409EFF;
}
.el-divider__text {
color: #409EFF;
}
.inputParent input {
border: none;
border-bottom: 1px solid rgb(220, 223, 230);
border-radius: 0;
}
.issueList > .el-table__header-wrapper {
display: none;
}
.issueList .el-table__expanded-cell {
background-color: rgb(250, 250, 250) !important;
}
.el-table .last-row {
background-color: rgb(250, 250, 250);
}
</style>
<div id="app" v-cloak>
<guava ref="guava">
<template>
<el-card shadow="never">
<div class="btn-group tool-button mt5">
<el-input placeholder="请输入内容" v-model="pageForm.qtitle">
<template slot="prepend">标题</template>
</el-input>
</div>
<div class="btn-group tool-button mt5">
<el-button @click="doSearch" icon="el-icon-search"
style="background-color:#409eff;color: white;"></el-button>
</div>
</el-card>
<el-card class="mt20" shadow="never">
<el-table
:data="tableData"
header-align="center"
size="medium"
style="width: 100%"
>
<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
align="center"
header-align="center"
label="标题"
prop="qtitle">
</el-table-column>
<el-table-column
align="center"
header-align="center"
label="说明"
prop="qsm"
show-overflow-tooltip="true">
<template scope="scope">
<div v-html="scope.row.qsm" v-if="scope.row.qsm">{{scope.row.qsm}}</div>
<span v-else>暂无</span>
</template>
</el-table-column>
<el-table-column
align="center"
header-align="center"
label="创建人"
prop="username">
</el-table-column>
<el-table-column
align="center"
header-align="center"
label="创建时间"
prop="qctime">
</el-table-column>
<el-table-column
align="center"
header-align="center"
label="类型"
prop="qlx">
<template scope="scope">
<span style="color: #67C23A" v-if="scope.row.qlx==1">问卷调查</span>
<span style="color: #67C23A" v-if="scope.row.qlx==2">在线答题</span>
<span style="color: #67C23A" v-if="scope.row.qlx==3">购物问卷</span>
<span style="color: #67C23A" v-if="scope.row.qlx==4">意向选择</span>
</template>
</el-table-column>
<el-table-column
align="center"
header-align="center"
label="状态"
prop="qflag">
<template scope="scope">
<span style="color: #E6A23C" v-if="scope.row.qflag==1">未开启</span>
<span style="color: #67C23A" v-if="scope.row.qflag==2">已开启</span>
<span style="color: #F56C6C" v-if="scope.row.qflag==3">已关闭</span>
</template>
</el-table-column>
<el-table-column
align="center"
header-align="center"
label="操作" width="250px">
<template scope="{row}">
<el-button @click="openFill(row.qid,row.activityuserscopeid)" plain size="small"
type="primary">填写问卷
</el-button>
</template>
</el-table-column>
</el-table>
<el-row class="el-pagination-container">
<el-pagination
:current-page="pageForm.pageNumber"
:page-size="pageForm.pageSize"
:page-sizes="[10, 20, 30, 50]"
:total="pageForm.totalCount"
@current-change="pageNumberChange"
@size-change="pageSizeChange"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
</el-row>
</el-card>
</template>
<template #view>
<div style="padding-left: 20px;padding-right: 20px">
<el-row style="text-align: center">
<h2>{{viewData.qtitle}}</h2>
</el-row>
<el-row style="margin-bottom: 20px">
<div v-html="viewData.qsm"></div>
</el-row>
<el-row style="border-bottom: 1px solid rgb(200,200,200);padding: 20px 0;margin-bottom: 20px"
v-for="issue,idx in viewData.issues">
<el-col :span="1">
<span style="color: red" v-if="issue.iisbd">*</span>
<span style="font-weight: bolder">{{idx+1}}.</span>
</el-col>
<el-col :span="23">
<el-row>
<div v-html="issue.iname"></div>
</el-row>
<el-row>
<div style="color: rgb(160,160,160)" v-html="issue.its"
v-if="issue.its"></div>
</el-row>
<el-row v-if="issue.itx==1">
<template v-if="issue.iplfs==1">
<!--竖向排列-->
<el-row v-for="wor,idx in issue.wors">
<el-row style="margin-top: 5px" v-if="wor.wimg">
<el-image :src="FILE_STREAM_PREVIEW_ADDRESS + '?id=' +wor.wimg"
fit="cover"
style="width: 100px;max-width: 100px"></el-image>
</el-row>
<el-row style="margin-top: 5px" v-if="wor.wimg">
<div v-html="wor.wsm"></div>
</el-row>
<el-row style="margin-top: 5px">
<el-radio-group v-if="issue.iisdx==true" v-model="issue.rwid">
<el-radio :label="wor.wid">
{{wor.wtxt}} &nbsp;
<span class="inputParent" v-if="wor.wistk==true">
<el-input size="mini" style="border-top: none"
v-model="wor.tktxt"></el-input>
<span style="color:red;" v-if="wor.wisbt==true">*</span>
</span>
</el-radio>
</el-radio-group>
<el-checkbox-group v-if="issue.iisdx==false" v-model="issue.rwid">
<el-checkbox :label="wor.wid">
{{wor.wtxt}}
<span class="inputParent" v-if="wor.wistk==true">
<el-input size="mini"
style="border-top: none"></el-input>
<span style="color:red;" v-if="wor.wisbt==true">*</span>
</span>
</el-checkbox>
</el-checkbox-group>
<el-row style="margin-top: 5px"
v-if="!wor.wimg&&wor.wsm">
<div v-html="wor.wsm"></div>
</el-row>
</el-row>
</el-row>
</template>
<template v-if="issue.iplfs==2">
<!--横向排列-->
<el-row :gutter="20" v-for="idx1 in issue.wors.length">
<el-col :span="parseInt(24/issue.icolnum)"
v-for="idx2 in issue.icolnum">
<div :style="!issue.wors[((idx1-1)*issue.icolnum+idx2)-1].wimg?'':'text-align: center'"
v-if="(idx1-1)*issue.icolnum+idx2<=issue.wors.length">
<el-row style="margin-top: 5px"
v-if="issue.wors[((idx1-1)*issue.icolnum+idx2)-1].wimg">
<el-image
:src="issue.wors[((idx1-1)*issue.icolnum+idx2)-1].islocal?issue.wors[((idx1-1)*issue.icolnum+idx2)-1].wimg:FILE_STREAM_PREVIEW_ADDRESS + '?id=' +issue.wors[((idx1-1)*issue.icolnum+idx2)-1].wimg"
fit="cover"
style="width: 100%;max-width: 300px"></el-image>
</el-row>
<el-row style="margin-top: 5px"
v-if="issue.wors[((idx1-1)*issue.icolnum+idx2)-1].wimg">
<div style="color: rgb(160,160,160);text-align: left">
{{issue.wors[((idx1-1)*issue.icolnum+idx2)-1].wsm}}
</div>
</el-row>
<el-row style="margin-top: 5px">
<el-radio :label="idx1+'-'+idx2" v-if="issue.iisdx==true"
v-model="issue.rwid">
{{issue.wors[((idx1-1)*issue.icolnum+idx2)-1].wtxt}}
&nbsp;<span
class="inputParent"
v-if="issue.wors[((idx1-1)*issue.icolnum+idx2)-1].wistk==true"><el-input
size="mini"
style="border-top: none"
v-model="issue.wors[((idx1-1)*issue.icolnum+idx2)-1].tktxt"></el-input> <span
style="color:red;"
v-if="issue.wors[((idx1-1)*issue.icolnum+idx2)-1].wisbt==true">*</span></span>
</el-radio>
<el-checkbox :key="idx1+'-'+idx2" :label="idx1+'-'+idx2"
v-if="issue.iisdx==false">
{{issue.wors[((idx1-1)*issue.icolnum+idx2)-1].wtxt}}
<span class="inputParent"
v-if="issue.wors[((idx1-1)*issue.icolnum+idx2)-1].wistk==true"><el-input
size="mini"
style="border-top: none"
v-model="issue.wors[((idx1-1)*issue.icolnum+idx2)-1].tktxt"></el-input> <span
style="color:red;"
v-if="issue.wors[((idx1-1)*issue.icolnum+idx2)-1].wisbt==true">*</span></span>
</el-checkbox>
<el-row style="margin-top: 5px"
v-if="!issue.wors[((idx1-1)*issue.icolnum+idx2)-1].wimg&&issue.wors[((idx1-1)*issue.icolnum+idx2)-1].wsm">
<div style="color: rgb(160,160,160)">
&nbsp;&nbsp;&nbsp;&nbsp;{{issue.wors[((idx1-1)*issue.icolnum+idx2)-1].wsm}}
</div>
</el-row>
</el-row>
</div>
</el-col>
</el-row>
</template>
</el-row>
<el-row v-if="issue.itx==2">
<el-input size="small" style="width: 50%"
v-model="issue.wors[0].rval">
</el-input>
</el-row>
</el-col>
</el-row>
<div style="width: 100%;text-align: center;margin-top: 30px">
<el-button @click="subData" style="width: 70%" type="primary">提交问卷</el-button>
</div>
</div>
</template>
</guava>
<el-row class="transition-row">
<!-- <transition name="el-zoom-in-center">
<div class="transition-item" v-show="v=='fill'">
<el-card class="box-card v-box" shadow="never">
<div class="clearfix" slot="header">
<el-button @click="v='index'" icon="el-icon-back" style="font-size: 18px"
type="text">返回
</el-button>
</div>
</el-card>
</div>
</transition>-->
</el-row>
</div>
<script>
let E = window.wangEditor
let qsmEditor
let upTxtEditor
let vue = new Vue({
el: '#app',
data() {
return {
v: "index",
tableData: [],
viewData: [],
formData: [],
pageForm: {
searchName: "",
searchKeyword: "",
pageNumber: 1,
pageSize: 10,
totalCount: 0,
pageOrderName: "",
pageOrderBy: ""
},
qid: ""
}
},
methods: {
async openFill(id, activityuserscopeid) {
const resp = await $.post('/platform/activity/basic/scope/getScopeUser', {activityGroupId: activityuserscopeid})
if (resp.data === 0) {
this.$notify.warning('您没有此次答题的权限')
return
}
this.qid = id
$.get(loc() + "/findOne", {"qid": id}, res => {
const {code, data, msg} = res
if (code == 0) {
data.issues.forEach(issue => {
if (!issue.iisdx) {
issue.rwid = []
}
})
this.viewData = data
this.$refs.guava.view()
} else {
this.$message.warning(msg);
}
})
},
subData() {
let flag = true
let msg
let issues = this.viewData.issues
i:
for (let i = 0; i < issues.length; i++) {
w:
for (let j = 0; j < issues[i].wors.length; j++) {
let wor = issues[i].wors[j]
if (issues[i].iisbd) {
if (issues[i].itx == 1 && !issues[i].rwid) {
flag = false
msg = '第' + (i + 1) + '题未作答!'
break i
}
if (issues[i].itx == 2 && !wor.rval) {
flag = false
msg = '第' + (i + 1) + '题未作答!'
break i
}
if (issues[i].rwid == wor.wid && wor.wisbt && !wor.rval) {
flag = false
msg = '第' + (i + 1) + '题内容未填写!'
break i
}
}
}
if (issues[i].itx == 1 && issues[i].iisbd && !issues[i].rwid) {
flag = false
msg = '第' + (i + 1) + '题未作答!'
break i
}
}
if (!flag) {
this.$notify({
title: '提示',
message: msg,
type: 'warning'
});
} else {
issues.forEach((issue) => {
if (issue.itx == 1) {
if (issue.iisdx == false) {
issue.rwid.forEach((wid) => {
issue.wors.forEach((wor) => {
if (wor.wid == wid) {
let reply = {"rwid": wor.wid, "rval": wor.rval}
this.formData.push(reply)
}
})
})
} else {
issue.wors.forEach((wor) => {
if (wor.wid == issue.rwid) {
let reply = {"rwid": wor.wid, "rval": wor.rval}
this.formData.push(reply)
}
})
}
} else {
issue.wors.forEach((wor) => {
let reply = {"rwid": wor.wid, "rval": wor.rval}
this.formData.push(reply)
})
}
})
$.post(loc() + "/subData", {
json: JSON.stringify(this.formData),
"qid": this.qid
}, (data) => {
if (data.code == 0) {
this.$notify({
title: '成功',
message: "您的答卷已提交,感谢您的参与!",
type: 'success'
});
this.$refs.guava.index()
this.flag = true
} else {
this.$notify({
title: '错误',
message: data.msg,
type: 'error'
});
}
})
}
},
doSearch() {
this.pageForm.pageNumber = 1;
this.pageData();
},
pageOrder(column) {
switch (column.order) {
case 'descending':
column.order = 'desc'
break
case "ascending":
column.order = 'asc'
break
}
this.pageForm.pageOrderName = column.prop;
this.pageForm.pageOrderBy = column.order;
this.pageData();
},
pageNumberChange(val) {//页码更新操作
this.pageForm.pageNumber = val;
this.pageData();
},
pageSizeChange(val) {//分页大小更新操作
this.pageForm.pageSize = val;
this.pageData();
},
pageData() {//加载分页数据
sublime.showLoadingbar();
$.post(loc() + "/data", this.pageForm, (data) => {
sublime.closeLoadingbar();
if (data.code == 0) {
this.tableData = data.data.list;
this.pageForm.totalCount = data.data.totalCount;
} else {
this.$message({
message: data.msg,
type: 'error'
});
}
}, "json");
}
},
created() {
this.pageData();
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,342 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
</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 && [4].includes(qlx)"
width="100px">
<template scope="{ row }">
<el-button @click="openView(row.unionId)" size="mini" type="primary"
v-if="[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>
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
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.location.href = 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(loc() + '/getUnselectedUser', params)
this.unselectUserTable = data
},
doExportCakeUnion() {
window.open('/platform/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
},
doSearch() {
this.getData()
},
async getData() {
this.tableLoading = true
const {data} = await $.post(loc() + "/getData", {...this.pageForm})
this.tableColumns = data.label
this.tableData = data.list
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
}
},
async created() {
this.questions = await this.getQuestion()
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>
<!--#
}
#-->
@@ -0,0 +1,307 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<!-- 在 head 标签中添加 meta 标签,并设置 viewport-fit=cover 值 -->
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover"
name="viewport">
<title>智慧工会问卷调查</title>
<!-- 引入样式文件 -->
<link href="https://cdn.jsdelivr.net/npm/vant@2.5/lib/index.css" rel="stylesheet">
<link href="https://cdn.bootcss.com/weui/2.2.0/style/weui.min.css" rel="stylesheet">
</head>
<style>
[v-clock] {
display: none
}
.van-radio__label {
width: 100%;
}
.van-checkbox__label {
width: 100%;
}
.weui-msg {
width: 100%;
height: 100%;
}
.myHide {
display: none;
}
.max50 {
max-width: 50%;
}
</style>
<body>
<div id="app" style="padding: 0 10px;" v-clock v-if="showPage">
<van-nav-bar @click-left="history.back()" fixed left-arrow placeholder title="问卷调查"></van-nav-bar>
<div style="margin: 1.2rem 0.20rem 0.4rem 0.20rem;padding: 0.3rem 0.34rem;text-align: center"
v-show="showMsg==true">
<div class="weui-msg">
<div class="weui-msg__icon-area">
<i class="weui-icon-success weui-icon_msg" v-if="flag"></i>
<i class="weui-icon-warn weui-icon_msg" v-else></i>
</div>
<div class="weui-msg__text-area">
<h2 class="weui-msg__title">{{msg}}</h2>
</div>
</div>
</div>
<div style="padding-top: 20px" v-show="showMsg==false">
<div style="width: 100%;text-align: center;color: #1ea0fa"><h2>{{data.qtitle}}</h2></div>
<div style="width: 100%;margin-top: 20px" v-html="data.qsm" v-if="data.qsm">
</div>
<hr style="margin-top: 20px;border: none;border-bottom: 1px rgb(150,150,150) dashed" v-if="data.qsm"/>
<div style="margin-top: 50px;">
<van-panel :desc="getTxt(issue.its)" :status="issue.iisbd?'必答':''"
:title="(iidx+1)+'. '+ getTxt(issue.iname)"
style="margin: 20px 0;box-shadow: 0 0 10px rgb(220,220,220)" v-for="issue,iidx in data.issues">
<!-- 单选-->
<div style="padding: 10px" v-if="issue.itx==1&&issue.iisdx==true">
<van-radio-group :direction="issue.iplfs==1?'vertical':'horizontal'"
style="position: relative;box-sizing: border-box;"
v-model="issue.rwid">
<van-radio :class="issue.iplfs==2?'max50':''" :name="wor.wid"
style="padding: 10px 10px;margin: 0;box-sizing: border-box;"
v-for="wor in issue.wors">
<div style="width: 100%" v-if="wor.wimg">
<van-image
:src="'${AppFileDomain!}'+wor.wimg"
fit="cover"
height="100px"
width="100px"/>
</div>
<div style="width: 100%;margin: 5px 0" v-html="wor.wtxt"></div>
<div style="width: 100%;margin: 5px 0;color: rgb(180,180,180);font-size: 12px"
v-html="wor.wsm">
</div>
<div style="width: 100%;margin: 5px 0" v-if="wor.wistk==true">
<van-field :required="wor.wisbt" style="border: 1px rgb(240,240,240) solid"
v-model="wor.rval"/>
</div>
</van-radio>
</van-radio-group>
</div>
<!-- 多选-->
<div style="padding: 10px" v-if="issue.itx==1&&issue.iisdx==false">
<van-checkbox-group :direction="issue.iplfs==1?'vertical':'horizontal'"
:max="issue.imaxselect?issue.imaxselect:9999999"
style="position: relative;box-sizing: border-box;"
v-model="issue.rwid">
<van-checkbox :class="issue.iplfs==2?'max50':''" :name="wor.wid" shape="square"
style="padding: 10px 10px;margin: 0;box-sizing: border-box;"
v-for="wor in issue.wors">
<div style="width: 100%" v-if="wor.wimg">
<van-image
:src="'${AppFileDomain!}'+wor.wimg"
fit="cover"
height="100px"
width="100px"/>
</div>
<div style="width: 100%;margin: 5px 0" v-html="wor.wtxt"></div>
<div style="width: 100%;margin: 5px 0;color: rgb(180,180,180);font-size: 12px"
v-html="wor.wsm">
</div>
<div style="width: 100%;margin: 5px 0" v-if="wor.wistk==true">
<van-field :required="wor.wisbt" style="border: 1px rgb(240,240,240) solid"
v-model="wor.rval"/>
</div>
</van-checkbox>
</van-checkbox-group>
</div>
<!-- 填空-->
<div style="padding: 10px" v-if="issue.itx==2">
<van-field
autosize
placeholder="请输入内容"
rows="2"
show-word-limit
style="border: 1px rgb(240,240,240) solid"
type="textarea"
v-model="issue.wors[0].rval"
/>
</div>
</van-panel>
</div>
<div style="width: 100%;text-align: center;margin-top: 30px">
<van-button :loading="loading" @click.native="subData" color="#1ea0fa" style="width: 70%" type="primary"
v-show="data!={}">
提交问卷
</van-button>
</div>
</div>
<div class="weui-footer" style="margin-top: 80px;margin-bottom: 10px" v-if="showPage">
<p class="weui-footer__text">Copyright © 2019-2020 智慧工会平台</p>
</div>
</div>
<van-number-keyboard safe-area-inset-bottom/>
<!-- 引入 Vue 和 Vant 的 JS 文件 -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vant@2.5/lib/vant.min.js"></script>
<script src="https://cdn.bootcss.com/jquery/1.11.0/jquery.min.js"></script>
<script>
let vue = new Vue({
el: "#app",
data: function () {
return {
loading: false,
showMsg: false,
showPage: false,
msg: '',
flag: null,
data: {},
formData: [],
getTxt(val) {
if (val) {
return val.replace(/<(style|script|iframe)[^>]*?>[\s\S]+?<\/\1\s*>/gi, '').replace(/<[^>]+?>/g, '').replace(/\s+/g, ' ').replace(/&nbsp;/g, ' ').replace(/>/g, ' ');
}
return ''
},
}
},
methods: {
subData: function () {
let flag = true
let msg = ""
vue.formData = []
let issues = vue.data.issues
i:
for (let i = 0; i < issues.length; i++) {
w:
for (let j = 0; j < issues[i].wors.length; j++) {
let wor = issues[i].wors[j]
if (issues[i].iisbd) {
if (issues[i].itx == 1 && !issues[i].rwid) {
flag = false
msg = '第' + (i + 1) + '题未作答!'
break i
}
if (issues[i].itx == 2 && !wor.rval) {
flag = false
msg = '第' + (i + 1) + '题未作答!'
break i
}
if (issues[i].rwid == wor.wid && wor.wisbt && !wor.rval) {
flag = false
msg = '第' + (i + 1) + '题内容未填写!'
break i
}
}
}
if (issues[i].itx == 1 && issues[i].iisbd && issues[i].rwid.length == 0) {
flag = false
msg = '第' + (i + 1) + '题未作答!'
break i
}
}
if (!flag) {
vue.$notify({type: 'danger', message: msg})
} else {
issues.forEach(function (issue) {
if (issue.iisdx == false) {
issue.rwid.forEach(function (wid) {
issue.wors.forEach(function (wor) {
if (wor.wid == wid) {
let reply = {"rwid": wor.wid, "rval": wor.rval}
vue.formData.push(reply)
}
})
})
} else {
issue.wors.forEach(function (wor) {
if (wor.wid == issue.rwid) {
let reply = {"rwid": wor.wid, "rval": wor.rval}
vue.formData.push(reply)
}
})
}
})
vue.loading = true
$.post("/platform/zgfw/mobile/questionnaire/subData", {json: JSON.stringify(vue.formData)}, function (data) {
if (data.code == 0) {
vue.loading = false
vue.msg = '您的答卷已提交,感谢您的参与!'
vue.flag = true
vue.showMsg = true
} else {
vue.$notify({type: 'danger', message: data.msg})
}
})
}
},
getData: function () {
$.get("/platform/zgfw/mobile/questionnaire/data", function (data) {
if (data.code == 0) {
if (data.data.qflag == 1 || data.data.qflag == 3) {
vue.msg = '该问卷尚未开启!'
vue.flag = false
vue.showMsg = true
} else {
if (data.data.qdtkssj && data.data.qdtjssj) {
let now = new Date()
let qdtkssj = now.getFullYear() + '-' + (now.getMonth() + 1) + '-' + now.getDate() + ' ' + data.data.qdtkssj
let qdtjssj = now.getFullYear() + '-' + (now.getMonth() + 1) + '-' + now.getDate() + ' ' + data.data.qdtjssj
qdtkssj = new Date(qdtkssj).getTime()
qdtjssj = new Date(qdtjssj).getTime()
if (!(qdtkssj < now.getTime() && now.getTime() < qdtjssj)) {
vue.msg = '该问卷每日答题时间为:' + data.data.qdtkssj + '-' + data.data.qdtjssj
vue.flag = false
vue.showMsg = true
}
}
}
data.data.issues.forEach(function (issue) {
if (issue.itx == 1 && issue.iisdx) {
issue.rwid = ''
} else if (issue.itx == 1 && !issue.iisdx) {
issue.rwid = []
} else if (issue.itx == 2) {
issue.rwid = issue.wors[0].wid
}
issue.wors.forEach(function (wor) {
if (wor.wismr) {
if (issue.itx == 1 && issue.iisdx) {
issue.rwid = wor.wid
} else if (issue.itx == 1 && !issue.iisdx) {
issue.rwid.push(wor.wid)
}
}
})
})
vue.showMsg = false
vue.data = data.data
} else {
vue.msg = data.msg
vue.flag = false
vue.showMsg = true
// window.close()
// wx.closeWindow();
}
vue.showPage = true
})
}
},
created: function () {
this.getData()
}
})
</script>
</body>
</html>
@@ -0,0 +1,154 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app">
<guava ref="guava">
<el-card shadow="never">
<div class="btn-group tool-button">
<el-date-picker
:clearable="false"
placeholder="选择年"
type="year"
v-model="pageForm.year"
value-format="yyyy">
</el-date-picker>
</div>
<div class="btn-group tool-button">
<el-input placeholder="请输入内容" v-model="pageForm.qtitle">
<template slot="prepend">标题</template>
</el-input>
</div>
<div class="btn-group tool-button">
<el-button @click="doSearch" icon="el-icon-search" type="primary"></el-button>
</div>
</el-card>
<el-card shadow="never" class="mt20">
<el-table :data="tableData" align="center" header-align="center" size="medium" style="width: 100%">
<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 align="center" header-align="center" label="标题" prop="qtitle"></el-table-column>
<el-table-column align="center" header-align="center" label="说明" prop="qsm"
show-overflow-tooltip>
<template scope="scope">
<div v-html="scope.row.qsm" v-if="!isNull(scope.row.qsm)">
{{scope.row.qsm}}
</div>
<span v-else>暂无</span>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="开始时间" prop="startTime">
<template slot-scope="scope">
{{moment(scope.row.startTime).format('YYYY-MM-DD HH:mm')}}
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="结束时间" prop="endTime">
<template slot-scope="scope">
{{moment(scope.row.endTime).format('YYYY-MM-DD HH:mm')}}
</template>
</el-table-column>
<el-table-column align="center" label="类型" prop="qlx">
<template scope="{row}">
<span v-if="row.qlx===1">调查</span>
<span v-if="row.qlx===2">答题</span>
<!-- <span v-if="row.qlx===3">购物调查</span>-->
<span v-if="row.qlx===4">意向选择</span>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="状态" prop="qflag">
<template scope="scope">
<span style="color: #E6A23C" v-if="scope.row.qflag==1">未开启</span>
<span style="color: #67C23A" v-if="scope.row.qflag==2">已开启</span>
<span style="color: #F56C6C" v-if="scope.row.qflag==3">已关闭</span>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="操作">
<template scope="scope">
<el-button @click="openStart(scope.row)" size="mini" type="primary">
开始答题
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<template #edit>
<online-answer ref="onlineAnswerRef"></online-answer>
</template>
</guava>
</div>
<script>
<!--#include('/platform/question/components/answer.js'){}#-->
new Vue({
el: '#app',
mixins: [initTableMixins],
components: {
onlineAnswer
},
data() {
return {
pageForm: {
status: 1,
type: 2
},
isNull(val) {
return !val
},
dialogVisible: false
}
},
methods: {
async openStart(row) {
const {qid, qlx, qflag, activityUserScopeId} = row
if (qflag !== 2) {
this.$message.warning('该问卷未发布')
return
}
const now = new Date().getTime()
if (now < row.startTime || now > row.endTime) {
this.$message.warning('不在开启时间内')
return
}
if (activityUserScopeId) {
const resp = await $.get('/mobile/question/h5/checkPermission/' + activityUserScopeId)
if (!resp.data) {
this.$message.warning('您无权限参加')
return
}
}
if (qlx === 2) {
this.$refs.guava.edit()
this.$nextTick(() => {
this.$refs.onlineAnswerRef.onOpen(qid)
})
}
},
pageData() {
$.post('/mobile/question/h5/pageData', this.pageForm).then(res => {
if (res.code === 0) {
this.tableData = res.data.list;
this.pageForm.totalCount = res.data.totalCount;
}
})
}
},
created() {
this.pageData()
}
})
</script>
<!--#
}
#-->
@@ -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>
const 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>
<!--#
}
#-->
@@ -0,0 +1,308 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
.issueList > .el-table__header-wrapper {
display: none;
}
.issueList .el-table__expanded-cell {
background-color: rgb(250, 250, 250) !important;
}
.el-table .last-row {
background-color: rgb(250, 250, 250);
}
</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
style="width: 100%"
:clearable="false"
placeholder="选择年"
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-input placeholder="请输入内容" v-model="pageForm.qtitle">
</el-input>
</div>
</div>
<div class="search-query">
<el-button @click="doSearch" icon="el-icon-search" type="primary">搜索</el-button>
</div>
</div>
</el-card>
<el-card shadow="never" class="mt20">
<el-table :data="tableData" header-align="center" style="width: 100%">
<el-table-column align="center" label="序号" type="index" :index="indexMethod"></el-table-column>
<el-table-column align="center" label="标题" prop="qtitle"></el-table-column>
<el-table-column align="center" label="说明" prop="qsm" show-overflow-tooltip="true">
<template scope="scope">
<div v-html="scope.row.qsm" v-if="scope.row.qsm">{{scope.row.qsm}}</div>
<span v-else>暂无</span>
</template>
</el-table-column>
<el-table-column align="center" label="创建人" prop="username"></el-table-column>
<el-table-column align="center" label="调查时间" prop="qctime"></el-table-column>
<el-table-column align="center" label="类型" prop="qlx">
<template scope="scope">
<span style="color: #67C23A" v-if="scope.row.qlx==1">在线调查</span>
<span style="color: #67C23A" v-if="scope.row.qlx==2">在线答题</span>
<span style="color: #67C23A" v-if="scope.row.qlx==3">购物问卷</span>
<span style="color: #67C23A" v-if="scope.row.qlx==4">意向选择</span>
</template>
</el-table-column>
<el-table-column align="center" label="状态" prop="qflag">
<template scope="scope">
<span style="color: #E6A23C" v-if="scope.row.qflag==1">未开启</span>
<span style="color: #67C23A" v-if="scope.row.qflag==2">已开启</span>
<span style="color: #F56C6C" v-if="scope.row.qflag==3">已关闭</span>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="250px">
<template scope="scope">
<el-button @click="openView(scope.row.qid)" size="mini" type="primary">查看报告
</el-button>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</template>
<template #edit_func>
<el-button @click="doExport" icon="el-icon-printer" type="primary">导出</el-button>
</template>
<template #edit>
<div class="pl10 pr10">
<el-row class="text-center">
<h2 style="margin: 0">{{viewData.q.qtitle}}</h2>
</el-row>
<el-row class="mb20">
<div v-html="viewData.q.qsm"></div>
</el-row>
<div id="issue-wrap" :style="{'height':issueWrapHeight+'px'}"
style="overflow-y: scroll;transition-duration: .5s;transition-timing-function: ease-in-out">
<el-row v-for="issue,idx in viewData.q.issues">
<el-row>
<span style="font-weight: bolder;color: rgb(120,120,120)">第 {{idx+1}} 题:</span>
<div style="display: inline-block" v-html="issue.iname"></div>
<span style="color: rgb(180,180,180)" v-if="issue.itx==1&&issue.iisdx">[单选题]</span>
<span style="color: rgb(180,180,180)" v-if="issue.itx==1&&!issue.iisdx">[多选题]</span>
<span style="color: rgb(180,180,180)" v-if="issue.itx==2">[填空题]</span>
</el-row>
<el-row class="mt20 mb20">
<el-table
:data="issue.wors"
header-align="center"
style="width: 100%"
v-if="issue.itx==1"
>
<el-table-column
align="center"
header-align="center"
label="选项"
prop="wtxt">
<template scope="scope">
{{scope.row.wtxt}}
<span @click="openTkView(scope.row.wid)"
style="color: #409EFF;cursor:pointer;text-decoration: underline"
v-if="scope.row.wistk">详细</span>
</template>
</el-table-column>
<el-table-column
align="center"
header-align="center"
label="小计"
prop="xj">
</el-table-column>
<el-table-column
align="center"
header-align="center"
label="比例"
prop="bl">
<template scope="scope">
<el-progress :percentage="scope.row.bl"
v-if="scope.row.bl!=undefined"></el-progress>
</template>
</el-table-column>
</el-table>
<el-button @click="openTkView(issue.wors[0].wid)" size="small" type="primary"
v-else>
查看详细信息
</el-button>
</el-row>
</el-row>
</div>
</div>
</template>
</guava>
<el-dialog
:close-on-click-modal="false"
:visible.sync="tkViewDialogVisible"
custom-class="ViewDialogClass"
title="详细信息"
width="50%"
>
<el-row>
<div class="btn-group tool-button mt5">
<el-input placeholder="请输入内容" size="small" v-model="tkPageForm.searchKeyword">
<template slot="prepend">文本</template>
</el-input>
</div>
<div class="btn-group tool-button mt5">
<el-button @click="doTkSearch" icon="el-icon-search" size="small" type="primary"></el-button>
</div>
</el-row>
<el-row class="el-table-container" style="margin-top: 20px;">
<el-table
:data="tkTableData"
header-align="center"
size="medium"
style="width: 100%"
>
<el-table-column
align="center"
header-align="center"
label="序号"
type="index"
>
<template scope="scope">
<span>{{scope.$index+(tkPageForm.pageNumber - 1) * tkPageForm.pageSize + 1}} </span>
</template>
</el-table-column>
<el-table-column
align="center"
header-align="center"
label="提交时间"
prop="rtime"
width="200px">
</el-table-column>
<el-table-column
header-align="center"
label="文本"
prop="rval">
</el-table-column>
</el-table>
</el-row>
<el-row class="el-pagination-container">
<el-pagination
:current-page="tkPageForm.pageNumber"
:page-size="tkPageForm.pageSize"
:page-sizes="[10, 20, 30, 50]"
:total="pageForm.totalCount"
@current-change="(val)=>{tkPageForm.pageNumber = val;tkPageData();}"
@size-change="(val)=>{tkPageForm.pageSize = val;tkPageData();}"
layout="total, prev, pager, next">
</el-pagination>
</el-row>
</el-dialog>
</div>
<script>
let vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
v: "index",
tableData: [],
tkTableData: [],
pageForm: {
searchName: "",
searchKeyword: "",
pageNumber: 1,
pageSize: 10,
totalCount: 0,
pageOrderName: "",
pageOrderBy: "",
year: new Date().getFullYear() + ''
},
tkPageForm: {
searchKeyword: "",
pageNumber: 1,
pageSize: 10,
totalCount: 0,
title: '',
},
viewData: {q: {issue: [{word: []}]}},
tkViewDialogVisible: false,
questionId: '',
issueWrapHeight: 0
}
},
methods: {
doExport() {
location.href = loc() + '/doExport?questionId=' + this.questionId
},
openTkView(wid) {
this.tkPageForm.wid = wid
this.tkPageData()
this.tkViewDialogVisible = true
},
doTkSearch() {
this.tkPageForm.pageNumber = 1;
this.tkPageData();
},
async tkPageData() {
const {data} = await $.post(loc() + "/tkData", this.tkPageForm)
this.tkTableData = data.list
this.tkPageForm.totalCount = data.totalCount
},
async openView(qid) {
this.issueWrapHeight = 0
this.questionId = qid
const {data} = await $.get(loc() + "/getReplyData", {qid: qid})
data.q.issues.forEach(function (issue) {
issue.wors.forEach(function (wor) {
const xj = data[issue.iid].hasOwnProperty(wor.wid) ? data[issue.iid][wor.wid] : 0
wor.xj = xj
console.log(data[issue.iid].num)
wor.bl = (xj / data[issue.iid].num).toFixed(2) * 100
wor.bl = isNaN(wor.bl) ? 0 : wor.bl
})
}
)
this.viewData = data
this.$refs.guava.edit()
this.$nextTick(() => {
setTimeout(() => {
this.issueWrapHeight = window.innerHeight - 10 - 20 - document.getElementById('issue-wrap').getBoundingClientRect().top - 1
}, 500)
})
},
},
created() {
this.pageData()
}
})
</script>
<!--#
}
#-->
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,278 @@
<!--#
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%;" @change="doSearch"
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">
<div class="search-item-label">工号姓名:</div>
<div class="search-item-option">
<el-input placeholder="输入关键字" v-model="pageForm.searchKeyword"
maxlength="10"></el-input>
</div>
</div>
<div class="search-item"
v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}">
<div class="search-item-label">所属工会:</div>
<div class="search-item-option">
<el-select @change="flushUnits" @clear="flushUnits" 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-item">
<div class="search-item-label">所属单位:</div>
<div class="search-item-option">
<el-select clearable="true" filterable="true" placeholder="所属单位"
style="width: 100%;"
v-model="pageForm.unitId">
<el-option :label="item.name" :value="item.id" v-for="item in units"></el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">答题日期:</div>
<div class="search-item-option">
<el-date-picker
@change="doSearch"
style="width: 100%"
v-model="pageForm.answerDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择答题日期">
</el-date-picker>
</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>
<el-button :disabled="!pageForm.questionId" @click="doExportInventory" icon="el-icon-printer"
size="small"
type="primary">导出得分名单
</el-button>
<!--<el-button :disabled="!pageForm.questionId" @click="doExportAll" icon="el-icon-printer"
size="small"
type="primary">导出分工会阶段得分
</el-button>-->
</template>
</table-tool>
<el-table :data="tableData" :size="tableSize" @sort-change="pageOrder" class="vi-table"
ref="table" row-key="id" style="width: 100%" v-loading="tableLoading">
<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="column.label"
:prop="column.prop"
:key="column.key"
:sortable="column.sortable"
align="center"
header-align="center"
show-overflow-tooltip
v-for="column in tableColumns">
<template v-if="column.prop=='dayCount'" scope="{row}">
<span @click="showDays(row)" style="color: #236eb4; cursor: pointer">{{ row.dayCount ? row.dayCount : 0 }}</span>
</template>
</el-table-column>
<el-table-column label="每轮得分" prop="everyRandomScore"
v-if="questionCtMode==2 && isSameDay"></el-table-column>
<el-table-column label="答题用时" prop="takeTime" v-if="enableTimer">
<template scope="scope">
{{moment.utc(moment.duration(scope.row.takeTime,"seconds").asMilliseconds()).format("HH时mm分ss秒")}}
</template>
</el-table-column>
</el-table>
<!--# include("/layouts/pagination.html"){}#-->
</el-card>
</template>
</guava>
<el-dialog title="答题次数" :visible.sync="dayDialogVisible" width="40%">
<el-table :data="dayTableData" style="width: 100%;" max-height="400">
<el-table-column align="center" header-align="center" show-overflow-tooltip label="姓名"
prop="username"></el-table-column>
<el-table-column align="center" header-align="center" show-overflow-tooltip label="工号"
prop="loginname"></el-table-column>
<el-table-column align="center" header-align="center" show-overflow-tooltip label="答题时间"
prop="day"></el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="dayDialogVisible = false">确 定</el-button>
</span>
</el-dialog>
</div>
<script>
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
dayDialogVisible: false,
dayTableData: [],
unions: [],
units: [],
questions: [],
tableLoading: false,
tableKey: '',
tableColumns: [
{prop: 'username', label: '姓名'},
{prop: 'loginname', label: '工号'},
{prop: 'sex', label: '性别'},
{prop: 'unitname', label: '单位'},
{prop: 'unionname', label: '工会'},
{prop: 'mobile', label: '联系方式'},
// {prop: 'answerTotal', label: '答题次数(第几回答题)', sortable: true},
{prop: 'answerDate', label: '答题日期'},
{prop: 'score', label: '得分'},
],
pageForm: {
unionId: '',
unitId: '',
year: new Date().getFullYear() + '',
keyWord: '',
answerDate: moment().format("YYYY-MM-DD")
}
}
},
computed: {
//判断是否为同一天
isSameDay() {
if (this.pageForm.questionId) {
const currentQuestion = this.questions.find(v => v.qid === this.pageForm.questionId)
if (currentQuestion) {
const {startTime, endTime} = currentQuestion
return moment(startTime).isSame(moment(endTime), 'day')
}
return false
}
return false
},
questionCtMode(){
if (this.pageForm.questionId) {
const currentQuestion = this.questions.find(v => v.qid === this.pageForm.questionId)
if (currentQuestion) {
return currentQuestion.ctMode
}
return null
}
return null
},
enableTimer(){
if(this.pageForm.questionId){
const currentQuestion = this.questions.find(v => v.qid === this.pageForm.questionId)
if (currentQuestion) {
return currentQuestion.enableTimer
}
return null
}
}
},
methods: {
showDays(row) {
if (!row.days || row.dayCount === 0) {
return
}
this.dayTableData = []
row.days.split(',').map(o => {
this.dayTableData.push({username: row.username, loginname: row.loginname, day: o})
})
this.dayDialogVisible = true
},
doExportInventory() {
let {questionId, unionId, unitId, answerDate} = this.pageForm
answerDate = answerDate == null ? '' : answerDate
window.open(loc() + "/doExport?questionId=" + questionId + "&unionId=" + unionId + "&unitId=" + unitId + "&answerDate=" + answerDate)
},
doExportAll() {
const {questionId, unionId, unitId} = this.pageForm
window.open(loc() + "/doExportAll?questionId=" + questionId)
},
async yearChange() {
this.questions = await this.getQuestion()
this.questions = this.questions.filter(v => v.qlx === 2)
this.$set(this.pageForm, "questionId", this.questions.length > 0 ? this.questions[0].qid : '')
this.doSearch()
},
async getQuestion() {
const {data} = await $.get(loc() + "/getQuestion", {year: this.pageForm.year})
return data
},
async flushUnits() {
this.$set(this.pageForm, "unitId", "")
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}" === 'true') {
this.units = await getUnits(this.pageForm.unionId)
} else {
this.units = await getUnits("${@shiro.getPrincipalProperty('unit').getUnionid()}")
}
},
},
async created() {
this.questions = await this.getQuestion()
this.questions = this.questions.filter(v => v.qlx === 2)
this.$set(this.pageForm, "questionId", this.questions.length > 0 ? this.questions[0].qid : '')
this.pageData();
this.unions = await getUnions(null)
this.flushUnits();
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,481 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
#qsmEditor .w-e-text-container {
height: 200px !important;
}
.btDiv {
cursor: pointer;
}
.btDiv:hover {
background-color: rgb(240, 240, 240);
}
.shou {
cursor: pointer;
}
.issue {
cursor: pointer;
padding: 20px 0;
}
.issue:hover {
background-color: rgb(240, 240, 240);
}
.el-divider {
background-color: #409EFF;
}
.el-divider__text {
color: #409EFF;
}
.inputParent input {
border: none;
border-bottom: 1px solid rgb(220, 223, 230);
border-radius: 0;
}
.issueList > .el-table__header-wrapper {
display: none;
}
.issueList .el-table__expanded-cell {
background-color: rgb(250, 250, 250) !important;
}
.el-table .last-row {
background-color: rgb(250, 250, 250);
}
</style>
<div id="app" v-cloak>
<guava ref="guava">
<template>
<el-card shadow="never">
<div class="btn-group tool-button mt5">
<el-date-picker
:clearable="false"
placeholder="选择年"
type="year"
v-model="pageForm.year"
value-format="yyyy">
</el-date-picker>
</div>
<div class="btn-group tool-button mt5">
<el-input placeholder="请输入内容" v-model="pageForm.qtitle">
<template slot="prepend">标题</template>
</el-input>
</div>
<!-- <div class="btn-group tool-button mt5">-->
<!-- <el-select v-model="pageForm.qlx"-->
<!-- placeholder="类型">-->
<!-- <el-option-->
<!-- v-for="item in [{x:1,y:'问卷调查'},{x:2,y:'投票'}]"-->
<!-- :key="item.x"-->
<!-- :label="item.y"-->
<!-- :value="item.x">-->
<!-- </el-option>-->
<!-- </el-select>-->
<!-- </div>-->
<div class="btn-group tool-button mt5">
<el-button @click="doSearch" icon="el-icon-search"
style="background-color:#409eff;color: white;"></el-button>
</div>
</el-card>
<el-card shadow="never" class="mt20">
<el-table
:data="tableData"
header-align="center"
size="medium"
style="width: 100%"
>
<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
align="center"
header-align="center"
label="标题"
prop="qtitle">
</el-table-column>
<el-table-column
align="center"
header-align="center"
label="说明"
prop="qsm"
show-overflow-tooltip="true">
<template scope="scope">
<div v-html="scope.row.qsm" v-if="scope.row.qsm">{{scope.row.qsm}}</div>
<span v-else>暂无</span>
</template>
</el-table-column>
<el-table-column
align="center"
header-align="center"
label="创建人"
prop="username">
</el-table-column>
<el-table-column
align="center"
header-align="center"
label="调查时间"
prop="qctime">
</el-table-column>
<el-table-column
align="center"
header-align="center"
label="类型"
prop="qlx">
<template scope="scope">
<span style="color: #67C23A" v-if="scope.row.qlx==1">问卷调查</span>
<span style="color: #67C23A" v-if="scope.row.qlx==2">在线答题</span>
<span style="color: #67C23A" v-if="scope.row.qlx==3">购物问卷</span>
<span style="color: #67C23A" v-if="scope.row.qlx==4">意向选择</span>
</template>
</el-table-column>
<el-table-column
align="center"
header-align="center"
label="状态"
prop="qflag">
<template scope="scope">
<span style="color: #E6A23C" v-if="scope.row.qflag==1">未开启</span>
<span style="color: #67C23A" v-if="scope.row.qflag==2">已开启</span>
<span style="color: #F56C6C" v-if="scope.row.qflag==3">已关闭</span>
</template>
</el-table-column>
<el-table-column
align="center"
header-align="center"
label="操作" width="250px">
<template scope="scope">
<el-button @click="openView(scope.row.qid)" plain size="small" type="primary">查看报告
</el-button>
</template>
</el-table-column>
</el-table>
<el-row class="el-pagination-container">
<el-pagination
:current-page="pageForm.pageNumber"
:page-size="pageForm.pageSize"
:page-sizes="[10, 20, 30, 50]"
:total="pageForm.totalCount"
@current-change="pageNumberChange"
@size-change="pageSizeChange"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
</el-row>
</el-card>
</template>
<template #edit_func>
<el-button @click="doExport" icon="el-icon-printer" type="primary">导出</el-button>
</template>
<template #edit>
<div style="padding: 0 150px">
<el-row style="text-align: center">
<h2>{{viewData.q.qtitle}}</h2>
</el-row>
<el-row style="margin-bottom: 20px">
<div v-html="viewData.q.qsm"></div>
</el-row>
<el-row v-for="issue,idx in viewData.q.issues">
<el-row>
<span style="font-weight: bolder;color: rgb(120,120,120)">第 {{idx+1}} 题:</span>
<div style="display: inline-block" v-html="issue.iname"></div>
<span style="color: rgb(180,180,180)" v-if="issue.itx==1&&issue.iisdx">[单选题]</span>
<span style="color: rgb(180,180,180)" v-if="issue.itx==1&&!issue.iisdx">[多选题]</span>
<span style="color: rgb(180,180,180)" v-if="issue.itx==2">[填空题]</span>
</el-row>
<el-row style="margin: 20px 0">
<el-table
:data="issue.wors"
:row-class-name="tableRowClassName"
header-align="center"
style="width: 100%"
v-if="issue.itx==1"
>
<el-table-column
align="center"
header-align="center"
label="选项"
prop="wtxt">
<template scope="scope">
{{scope.row.wtxt}}
<span @click="openTkView(scope.row.wid)"
style="color: #409EFF;cursor:pointer;text-decoration: underline"
v-if="scope.row.wistk">详细</span>
</template>
</el-table-column>
<el-table-column
align="center"
header-align="center"
label="小计"
prop="xj">
</el-table-column>
<el-table-column
align="center"
header-align="center"
label="比例"
prop="bl">
<template scope="scope">
<el-progress :percentage="scope.row.bl"
v-if="scope.row.bl!=undefined"></el-progress>
</template>
</el-table-column>
</el-table>
<el-button @click="openTkView(issue.wors[0].wid)" plain size="small" type="primary"
v-else>
查看详细信息
</el-button>
</el-row>
</el-row>
</div>
</template>
</guava>
<el-dialog
:close-on-click-modal="false"
:visible.sync="tkViewDialogVisible"
custom-class="ViewDialogClass"
title="详细信息"
width="50%"
>
<el-row>
<div class="btn-group tool-button mt5">
<el-input placeholder="请输入内容" size="small" v-model="tkPageForm.searchKeyword">
<template slot="prepend">文本</template>
</el-input>
</div>
<div class="btn-group tool-button mt5">
<el-button @click="doTkSearch" icon="el-icon-search" size="small"
style="background-color:#409eff;color: white;"></el-button>
</div>
</el-row>
<el-row class="el-table-container" style="margin-top: 20px;">
<el-table
:data="tkTableData"
header-align="center"
size="medium"
style="width: 100%"
>
<el-table-column
align="center"
header-align="center"
label="序号"
type="index"
>
<template scope="scope">
<span>{{scope.$index+(tkPageForm.pageNumber - 1) * tkPageForm.pageSize + 1}} </span>
</template>
</el-table-column>
<el-table-column
align="center"
header-align="center"
label="提交时间"
prop="rtime"
width="200px">
</el-table-column>
<el-table-column
header-align="center"
label="文本"
prop="rval">
</el-table-column>
</el-table>
</el-row>
<el-row class="el-pagination-container">
<el-pagination
:current-page="tkPageForm.pageNumber"
:page-size="tkPageForm.pageSize"
:page-sizes="[10, 20, 30, 50]"
:total="pageForm.totalCount"
@current-change="tkPageNumberChange"
@size-change="tkPageSizeChange"
layout="total, prev, pager, next">
</el-pagination>
</el-row>
</el-dialog>
</div>
<script>
let E = window.wangEditor
let qsmEditor
let upTxtEditor
let vue = new Vue({
el: '#app',
data() {
return {
v: "index",
tableData: [],
tkTableData: [],
pageForm: {
searchName: "",
searchKeyword: "",
pageNumber: 1,
pageSize: 10,
totalCount: 0,
pageOrderName: "",
pageOrderBy: "",
year: new Date().getFullYear() + ''
},
tkPageForm: {
searchKeyword: "",
pageNumber: 1,
pageSize: 10,
totalCount: 0,
title: '',
},
viewData: {q: {issue: [{word: []}]}},
tkViewDialogVisible: false,
questionId: ''
}
},
methods: {
doExport() {
location.href = loc() + '/doExport?questionId=' + this.questionId
},
tableRowClassName(row, rowIndex) {
if (row.row.bl == undefined) {
return 'last-row';
}
return '';
},
openTkView(wid) {
this.tkPageForm.wid = wid
this.tkPageData()
this.tkViewDialogVisible = true
},
doTkSearch() {
this.tkPageForm.pageNumber = 1;
this.tkPageData();
},
tkPageNumberChange(val) {//页码更新操作
this.tkPageForm.pageNumber = val;
this.tkPageData();
}
,
tkPageSizeChange(val) {//分页大小更新操作
this.tkPageForm.pageSize = val;
this.tkPageData();
}
,
tkPageData() {//加载分页数据
let self = this;
sublime.showLoadingbar();//显示loading
$.post(loc() + "/tkData", self.tkPageForm, function (data) {
sublime.closeLoadingbar();//关闭loading
if (data.code == 0) {
self.tkTableData = data.data.list;
self.tkPageForm.totalCount = data.data.totalCount;
} else {
self.$message({
message: data.msg,
type: 'error'
});
}
}, "json");
},
openView(qid) {
this.questionId = qid
$.get(loc() + "/getReplyData", {qid: qid}, (data) => {
if (data.code == 0) {
data.data.q.issues.forEach(function (issue) {
issue.wors.forEach(function (wor) {
xj = data.data[issue.iid].hasOwnProperty(wor.wid) ? data.data[issue.iid][wor.wid] : 0
wor.xj = xj
console.log(data.data[issue.iid].num)
wor.bl = (xj / data.data[issue.iid].num).toFixed(2) * 100
wor.bl = isNaN(wor.bl) ? 0 : wor.bl
})
// issue.wors.push({wtxt: '本题有效填写人次', xj: data.data[issue.iid].yxs})
}
)
this.viewData = data.data
// this.v = "view"
this.$refs.guava.edit()
} else {
this.$message({
message: data.msg,
type: 'error'
});
}
})
},
doSearch() {
this.pageForm.pageNumber = 1;
this.pageData();
}
,
pageOrder(column) {//按字段排序
switch (column.order) {
case 'descending':
column.order = 'desc'
break
case "ascending":
column.order = 'asc'
break
}
this.pageForm.pageOrderName = column.prop;
this.pageForm.pageOrderBy = column.order;
this.pageData();
}
,
pageNumberChange(val) {//页码更新操作
this.pageForm.pageNumber = val;
this.pageData();
}
,
pageSizeChange(val) {//分页大小更新操作
this.pageForm.pageSize = val;
this.pageData();
}
,
pageData() {//加载分页数据
let self = this;
sublime.showLoadingbar();//显示loading
$.post(loc() + "/data", self.pageForm, function (data) {
sublime.closeLoadingbar();//关闭loading
if (data.code == 0) {
self.tableData = data.data.list;
self.pageForm.totalCount = data.data.totalCount;
} else {
self.$message({
message: data.msg,
type: 'error'
});
}
}, "json");
}
,
},
created() {
this.pageData();
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,198 @@
<!--#
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%;" @change="doSearch"
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">
<div class="search-item-label">工号姓名:</div>
<div class="search-item-option">
<el-input placeholder="输入关键字" v-model="pageForm.searchKeyword" maxlength="10"></el-input>
</div>
</div>
<div class="search-item"
v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}">
<div class="search-item-label">所属工会:</div>
<div class="search-item-option">
<el-select @change="flushUnits" @clear="flushUnits" 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-item">
<div class="search-item-label">所属单位:</div>
<div class="search-item-option">
<el-select clearable="true" filterable="true" placeholder="所属单位"
style="width: 100%;"
v-model="pageForm.unitId">
<el-option :label="item.name" :value="item.id" v-for="item in units"></el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">中奖日期:</div>
<div class="search-item-option">
<el-date-picker
@change="doSearch"
style="width: 100%"
v-model="pageForm.winDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择中奖日期">
</el-date-picker>
</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>
<el-button :disabled="!pageForm.questionId" @click="exportWinners" icon="el-icon-printer"
size="small"
type="primary">导出中奖名单
</el-button>
</template>
</table-tool>
<el-table :data="tableData" :size="tableSize" @sort-change="pageOrder" class="vi-table"
ref="table" row-key="id" style="width: 100%" v-loading="tableLoading">
<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="column.label"
:prop="column.prop"
:sortable="column.sortable"
align="center"
header-align="center"
show-overflow-tooltip
:key="column.prop"
v-for="column in tableColumns">
</el-table-column>
</el-table>
<!--# include("/layouts/pagination.html"){}#-->
</el-card>
</template>
</guava>
</div>
<script>
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
dayDialogVisible: false,
dayTableData: [],
unions: [],
units: [],
questions: [],
tableLoading: false,
tableKey: '',
tableColumns: [
{prop: 'username', label: '姓名'},
{prop: 'loginname', label: '工号'},
{prop: 'sex', label: '性别'},
{prop: 'unitname', label: '单位'},
{prop: 'unionname', label: '工会'},
{prop: 'mobile', label: '联系方式'},
{prop: 'winDate', label: '中奖日期'},
{prop: 'score', label: '抽奖分数'},
],
pageForm: {
unionId: '',
unitId: '',
year: new Date().getFullYear() + '',
keyWord: ''
}
}
},
methods: {
exportWinners() {
const {questionId, unionId, unitId} = this.pageForm
window.open(loc() + "/exportWinners?questionId=" + questionId + "&unionId=" + unionId + "&unitId=" + unitId)
},
async yearChange() {
this.questions = await this.getQuestion()
this.questions = this.questions.filter(v => v.qlx === 2)
this.$set(this.pageForm, "questionId", this.questions.length > 0 ? this.questions[0].qid : '')
this.doSearch()
},
async getQuestion() {
const {data} = await $.get("/platform/question/answer/winners/getQuestion", {year: this.pageForm.year})
return data
},
async flushUnits() {
this.$set(this.pageForm, "unitId", "")
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}" === 'true') {
this.units = await getUnits(this.pageForm.unionId)
} else {
this.units = await getUnits("${@shiro.getPrincipalProperty('unit').getUnionid()}")
}
},
},
async created() {
this.questions = await this.getQuestion()
this.questions = this.questions.filter(v => v.qlx === 2)
this.$set(this.pageForm, "questionId", this.questions.length > 0 ? this.questions[0].qid : '')
this.pageData();
this.unions = await getUnions(null)
this.flushUnits();
}
})
</script>
<!--#
}
#-->