postdischarge-ui/src/views/system/TaskStatistics/index.vue

523 lines
14 KiB
Vue
Raw Normal View History

2024-12-20 17:32:46 +08:00
<template>
<div class="app-container home" ref="layout">
<!-- 搜索条件 -->
<div ref="topform" class="form">
2024-12-23 17:56:27 +08:00
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
<el-form-item label="任务时间" prop="taskStartTime" label-width="90px">
2024-12-20 17:32:46 +08:00
<el-date-picker
v-model="dischargeTime"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
style="width: 220px"
value-format="yyyy-MM-dd"
end-placeholder="结束日期"
@change="changeTime"
>
</el-date-picker>
</el-form-item>
2024-12-23 17:56:27 +08:00
<el-form-item label="模板名称" prop="questionInfoId">
<span>
<TemplateName
@on-template="messageontemplateword"
:templateId="questionInfoId"
:query="questionInfoIdname"
></TemplateName>
</span>
2024-12-20 17:32:46 +08:00
</el-form-item>
2024-12-23 17:56:27 +08:00
<el-form-item
label="出院/就诊时间"
prop="visitStartTime"
label-width="120px"
>
2024-12-20 17:32:46 +08:00
<el-date-picker
2024-12-23 17:56:27 +08:00
v-model="dischargeTimevisit"
2024-12-20 17:32:46 +08:00
type="daterange"
range-separator="至"
start-placeholder="开始日期"
style="width: 220px"
value-format="yyyy-MM-dd"
end-placeholder="结束日期"
>
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
</div>
<!-- 底部 -->
<div
ref="table"
:style="{ 'max-height': maxTableHeight + 'px' }"
class="bottomsstics"
>
<!-- 左侧 -->
<div class="left">
2024-12-23 17:56:27 +08:00
<!-- <div> -->
<div
v-for="(item, index) in NameList"
:key="index"
class="itemlist"
:class="itemid == item.id ? 'allactive' : 'all'"
@click="itemdata(item)"
>
2024-12-20 17:32:46 +08:00
<div
2024-12-23 17:56:27 +08:00
style="width: 88%; margin: 0 auto; border-bottom: 1px solid #dcdfe6"
2024-12-20 17:32:46 +08:00
>
2024-12-23 17:56:27 +08:00
<!-- <el-popover
placement="top"
trigger="hover"
:content="item.questionnaireName"
>
<div class="title" slot="reference">
{{ item.questionnaireName }}
</div>
</el-popover> -->
<div class="title" slot="reference">
{{ item.questionnaireName }}
</div>
<div class="progress">时间:{{ item.createTime }}</div>
<!-- <div class="times">填写率:{{ item.totle }}%</div>
2024-12-20 17:32:46 +08:00
<div class="progress">
<el-progress :percentage="50" :show-text="false"></el-progress>
<span>12/45</span>
2024-12-23 17:56:27 +08:00
</div> -->
2024-12-20 17:32:46 +08:00
</div>
</div>
2024-12-23 17:56:27 +08:00
<!-- </div> -->
2024-12-20 17:32:46 +08:00
</div>
<!-- 右侧 -->
<div class="right">
2024-12-23 17:56:27 +08:00
<div class="righttitle">{{ newname }} {{ time }}</div>
<div class="tabledata" v-for="(item, index) in tableData" :key="index">
<div class="toptitle">
{{ index + 1 }}:{{ item.questionName }}
<span v-if="item.questionType == 'MULTIPLE_CHOICE'"
>单选题</span
>
<span v-if="item.questionType == 'MULTIPLE_CHOICE_QUESTIONS'"
>多选题</span
>
<span v-if="item.questionType == 'COMBINATION_RADIO_SUBJECT'"
>组合单选题</span
>
<span v-if="item.questionType == 'COMBINATION_MULTIPLE_SUBJECT'"
>组合多选题</span
2024-12-20 17:32:46 +08:00
>
</div>
<div ref="table" class="tables">
<el-table
:max-height="maxTableHeight"
v-loading="loading"
2024-12-23 17:56:27 +08:00
:data="item.questionnaireTaskOptionStatisticsVos"
2024-12-20 17:32:46 +08:00
>
2024-12-23 17:56:27 +08:00
<el-table-column label="选项" align="center" prop="optionName" />
2024-12-20 17:32:46 +08:00
<el-table-column
2024-12-23 17:56:27 +08:00
label="人数"
2024-12-20 17:32:46 +08:00
align="center"
2024-12-23 17:56:27 +08:00
prop="choiceNumber"
/>
<el-table-column
label="比例"
align="center"
prop="choiceProportion"
2024-12-20 17:32:46 +08:00
>
2024-12-23 17:56:27 +08:00
<template slot-scope="scope"
2024-12-20 17:32:46 +08:00
>
2024-12-23 17:56:27 +08:00
<el-progress
:percentage="
scope.row.choiceProportion
? scope.row.choiceProportion
: 0
"
></el-progress>
2024-12-20 17:32:46 +08:00
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="handleUpdate(scope.row)"
>查看</el-button
>
</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
2024-12-23 17:56:27 +08:00
import { questionnaireTaskStatistics, selectQuestionInfoList } from '@/api/system/TaskStatistics'
import TemplateName from "@/views/manage/components/TemplateName";
2024-12-20 17:32:46 +08:00
export default {
name: "TaskStatistics",
2024-12-23 17:56:27 +08:00
components: { TemplateName },
2024-12-20 17:32:46 +08:00
data() {
return {
2024-12-23 17:56:27 +08:00
show: false,
2024-12-20 17:32:46 +08:00
maxTableHeight: undefined,
// 任务时间
dischargeTime: [],
2024-12-23 17:56:27 +08:00
// 出院/就诊时间
dischargeTimevisit: [],
2024-12-20 17:32:46 +08:00
loading: false,
2024-12-23 17:56:27 +08:00
newname: '',//标题
time: '',//时间
NameList: [],
2024-12-20 17:32:46 +08:00
// 列表、
2024-12-23 17:56:27 +08:00
tableData: [],
2024-12-20 17:32:46 +08:00
itemid: "",
2024-12-23 17:56:27 +08:00
questionInfoId: '',
questionInfoIdname:0,
2024-12-20 17:32:46 +08:00
queryParams: {
2024-12-23 17:56:27 +08:00
taskStartTime: null,
taskEndTime: null,
visitstartTime: null,
visitEndTime: null,
questionInfoId: null,
2024-12-20 17:32:46 +08:00
},
}
},
created() {
2024-12-24 09:25:24 +08:00
this.getDefaultDateRange()
2024-12-23 17:56:27 +08:00
// this.getlist()
this.getlistleft()
2024-12-20 17:32:46 +08:00
},
mounted() {
this.getMaxTableHeight()
this.screenChange()
2024-12-23 17:56:27 +08:00
2024-12-20 17:32:46 +08:00
},
methods: {
2024-12-23 17:56:27 +08:00
hidePopover() {
this.showPopover = false;
},
// 右侧列表
getlist() {
questionnaireTaskStatistics(this.queryParams).then(res => {
this.tableData = res.data.data
console.log(res)
})
},
// 左侧列表
getlistleft() {
selectQuestionInfoList().then(res => {
this.NameList = res
this.queryParams.questionInfoId = this.NameList[0].id
this.itemid = this.NameList[0].id
this.newname = this.NameList[0].questionnaireName
this.time = this.NameList[0].createTime
this.getlist()
})
},
changeTime(e) {
this.show = false;
},
//模版名称
messageontemplateword(item) {
this.queryParams.questionInfoId = item.questionInfoId;
this.itemid=item.questionInfoId
},
//计算一周的时间
getDefaultDateRange() {
this.show = true;
const endDate = new Date(); // 今天的日期
const startDate = new Date();
startDate.setDate(endDate.getDate() - 6); // 往前倒退七天
console.log(startDate, endDate);
this.dischargeTime[0] = startDate;
this.dischargeTime[1] = endDate;
this.queryParams.taskStartTime = this.formatDate(this.dischargeTime[0]);
this.queryParams.taskEndTime = this.formatDate(this.dischargeTime[1]);
},
formatDate(date) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始需要加1
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
},
2024-12-20 17:32:46 +08:00
// 查看
handleUpdate(row) {
this.$router.push({
path: "/statisticalAnalysis/datialdata",
query: {
path: "/statisticalAnalysis/TaskStatistics",
2024-12-23 17:56:27 +08:00
questionInfoId: row.questionInfoId ? row.questionInfoId : '',
questionSubjectOptionId: row.questionSubjectOptionId ? row.questionSubjectOptionId : '',
optionChooseSign: row.optionChooseSign ? row.optionChooseSign : '',
2024-12-20 17:32:46 +08:00
},
});
},
// 左侧点击
itemdata(item) {
console.log(item, '9999')
this.itemid = item.id
2024-12-23 17:56:27 +08:00
this.newname = item.questionnaireName
this.time = item.createTime
var obj = {
questionInfoId: item.id
}
questionnaireTaskStatistics(obj).then(res => {
this.tableData = res.data.data
})
},
// 重置
resetQuery() {
this.queryParams.questionInfoId=null,
this.questionInfoId = null,
this.dischargeTime = [];
this.dischargeTimevisit = [];
this.queryParams.taskStartTime = "";
this.queryParams.taskEndTime = "";
this.resetForm("queryForm");
this.questionInfoIdname += 1;
console.log(this.queryParams,'queryParams0000000000');
this.getlistleft();
},
// 搜索
handleQuery() {
if (this.dischargeTime?.length > 0) {
if (this.show == true) {
this.queryParams.taskStartTime = this.formatDate(this.dischargeTime[0]);
this.queryParams.taskEndTime = this.formatDate(this.dischargeTime[1]);
} else if (this.show == false) {
this.queryParams.taskStartTime = this.dischargeTime[0];
this.queryParams.taskEndTime = this.dischargeTime[1];
}
}
else {
this.queryParams.taskStartTime = null;
this.queryParams.taskEndTime = null;
}
if (this.dischargeTimevisit?.length > 0) {
this.queryParams.visitStartTime = this.dischargeTimevisit[0];
this.queryParams.visitEndTime = this.dischargeTimevisit[1];
} else {
this.queryParams.visitStartTime = this.dischargeTimevisit[0];
this.queryParams.visitEndTime = this.dischargeTimevisit[1];
}
this.getlist();
2024-12-20 17:32:46 +08:00
},
changeTime() { },
// 获取表格最高高度
getMaxTableHeight() {
const windowInnerHeight = window.innerHeight // 屏幕可视高度
const formDiv = this.$refs.topform
this.maxTableHeight = windowInnerHeight - 104 - this.getBoxHeight(formDiv)
},
// 屏幕resize监听
screenChange() {
// 屏幕resize监听事件一旦屏幕宽高发生变化就会执行resize
window.addEventListener('resize', this.getMaxTableHeight, true)
// 将屏幕监听事件移除
// 这步是必须的。离开页面时不移除,再返回,或者进入到别的有相同元素的页面会报错
// 或者将这里的方法直接写在beforeDestroy函数中也可以
this.$once('hook:beforeDestroy', () => {
window.removeEventListener('resize', this.getMaxTableHeight, true)
})
},
}
}
</script>
<style scoped lang="scss">
2024-12-23 17:56:27 +08:00
::-webkit-scrollbar {
width: 5px;
}
::-webkit-scrollbar-thumb {
border-radius: 5px;
background: #c0c0c0;
}
::-webkit-scrollbar-track {
width: 5px;
}
2024-12-20 17:32:46 +08:00
::v-deep .el-progress {
width: 64%;
display: inline-block;
}
.app-container {
padding: 0 !important;
}
.app-container {
background: #f1f3f5;
width: 100%;
padding: 20px 20px 20px 20px;
}
.home {
.form {
width: 98%;
margin: 10px auto;
padding: 13px 0 0 0;
background-color: #fff !important;
2024-12-23 17:56:27 +08:00
border-top-left-radius: 10px;
border-top-right-radius: 10px;
margin: 10px auto 5px;
2024-12-20 17:32:46 +08:00
}
.bottomsstics {
width: 98%;
margin: 0 auto;
height: 100%;
overflow-y: auto;
display: flex;
justify-content: space-around;
.left {
height: 100%;
width: 18%;
background: #fff;
overflow-y: auto;
.allactive {
width: 100%;
background: #e8f4ff;
}
.all {
width: 100%;
margin: 0 auto;
2024-12-23 17:56:27 +08:00
// height: 99px;
2024-12-20 17:32:46 +08:00
}
.itemlist {
// width: 94%;
margin: 0 auto;
2024-12-23 17:56:27 +08:00
// height: 99px;
2024-12-20 17:32:46 +08:00
.title {
font-size: 19px;
font-weight: 600;
color: black;
2024-12-23 17:56:27 +08:00
// overflow: hidden;
// text-overflow: ellipsis;
// white-space: nowrap;
// padding: 8px 0 10px 0px;
padding: 23px 0 10px 0px;
2024-12-20 17:32:46 +08:00
}
.times {
2024-12-23 17:56:27 +08:00
padding: 0px 0 10px 0px;
2024-12-20 17:32:46 +08:00
font-size: 16px;
color: #aaacb2;
}
.progress {
2024-12-23 17:56:27 +08:00
padding: 0px 0 23px 0px;
2024-12-20 17:32:46 +08:00
}
span {
margin-left: 17px;
color: #aaacb2;
}
}
}
.right {
width: 100%;
height: 100%;
background: #fff;
margin-left: 4px;
overflow-y: auto;
.righttitle {
font-size: 19px;
font-weight: 600;
color: black;
padding: 20px 0 10px 30px;
}
.tabledata {
2024-12-23 17:56:27 +08:00
margin-bottom: 13px;
2024-12-20 17:32:46 +08:00
.tables {
margin: 0 auto;
width: 97%;
}
.toptitle {
font-size: 18px;
font-weight: 600;
color: black;
padding: 20px 0 15px 30px;
}
}
}
}
.col-item {
margin-bottom: 20px;
}
ul {
padding: 0;
margin: 0;
}
font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 13px;
color: #676a6c;
overflow-x: hidden;
overflow-y: hidden;
ul {
list-style-type: none;
}
h4 {
margin-top: 0px;
}
h2 {
margin-top: 10px;
font-size: 26px;
font-weight: 100;
}
p {
margin-top: 10px;
b {
font-weight: 700;
}
}
.update-log {
ol {
display: block;
list-style-type: decimal;
margin-block-start: 1em;
margin-block-end: 1em;
margin-inline-start: 0;
margin-inline-end: 0;
padding-inline-start: 40px;
}
}
}
</style>