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

298 lines
11 KiB
Vue
Raw Normal View History

2024-02-28 17:17:16 +08:00
<template>
<div class="app-container">
<el-row :gutter="20">
<!--部门数据-->
<el-col :span="4" :xs="24">
<div class="head-container">
<el-input v-model="departmentName" placeholder="请输入科室名称" clearable size="small" prefix-icon="el-icon-search"
style="margin-bottom: 20px" />
</div>
<div class="head-container">
<el-tree :data="deptOptions" :props="defaultProps" :expand-on-click-node="false"
:filter-node-method="filterNode" ref="tree" default-expand-all highlight-current
@node-click="handleNodeClick" />
</div>
</el-col>
<!--用户数据-->
<el-col :span="20" :xs="24">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="70px">
<el-form-item label="病种名称" prop="diseaseTypeName">
<el-input v-model="queryParams.diseaseTypeName" placeholder="请输入病种名称" clearable
@keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="问卷标题" prop="questionnaireName">
<el-input v-model="queryParams.questionnaireName" placeholder="请输入问卷标题" clearable
@keyup.enter.native="handleQuery" />
</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-item style="float:right">
<el-button type="primary" size="mini" @click="handleAdd"
v-hasPermi="['system:question:add']">新增问卷模板</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="questionList">
<el-table-column label="序号" type="index" width="55" align="center" />
<el-table-column label="问卷模板名称" align="center" prop="questionnaireName" />
<el-table-column label="问题个数" align="center" prop="questionCount" />
<el-table-column label="问卷模板ID" align="center" prop="questionnaireId" />
<el-table-column label="问卷状态" align="center" prop="questionnaireStatus">
<template slot-scope="scope">
2024-03-08 09:38:07 +08:00
<!-- active-text="已发布" inactive-text="未发布" -->
2024-03-07 16:46:38 +08:00
<el-switch v-model="scope.row.questionnaireStatus" active-color="#13ce66" inactive-color="#ff4949"
2024-03-08 09:38:07 +08:00
active-value="PUBLISHED" inactive-value="UNPUBLISHED" @change="switchstatus($event, scope.row)">
2024-03-07 16:46:38 +08:00
</el-switch>
2024-02-28 17:17:16 +08:00
</template>
</el-table-column>
<el-table-column label="病种名称" align="center" prop="diseaseTypeName" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
2024-03-05 17:15:25 +08:00
2024-02-28 17:17:16 +08:00
<template slot-scope="scope">
2024-03-07 16:46:38 +08:00
<el-button size="mini" type="text" @click="handleClassification(scope.row)"
v-hasPermi="['system:question:edit']">分类管理</el-button>
<el-button size="mini" type="text" @click="handleUpdate(scope.row)"
2024-02-28 17:17:16 +08:00
v-hasPermi="['system:question:edit']">编辑</el-button>
2024-03-07 16:46:38 +08:00
<el-button size="mini" type="text" @click="handleDelete(scope.row)"
2024-02-28 17:17:16 +08:00
v-hasPermi="['system:question:remove']">删除</el-button>
</template>
</el-table-column>
</el-table>
2024-03-05 17:15:25 +08:00
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" @pagination="getList" />
2024-02-28 17:17:16 +08:00
</el-col>
</el-row>
2024-03-07 16:46:38 +08:00
<el-dialog title="提示" :visible.sync="classificationOpen" width="30%" :before-close="classificationOpenfalse">
<el-form ref="form" :model="classificationform" label-width="80px" :rules="rules">
<el-form-item label="科室名称" prop="departmentId">
<el-select v-model="classificationform.departmentId" placeholder="请选择科室" clearable style="width:300px"
@clear="cleardepartment" @change="changedepartment">
<el-option v-for="item in departmentlist" :key="item.id" :label="item.departmentName" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="病种名称">
<el-select v-model="classificationform.diseaseTypeId" placeholder="请选择病种" clearable style="width:300px"
@change="changediseaseType">
<el-option v-for="item in diseaselist" :key="item.id" :label="item.diseaseTypeName" :value="item.id" />
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="classificationupload"> </el-button>
<el-button @click="classificationOpenfalse"> </el-button>
</div>
</el-dialog>
2024-02-28 17:17:16 +08:00
</div>
</template>
<script>
2024-03-07 16:46:38 +08:00
import { listQuestion, getQuestion, delQuestion, addQuestion, updateQuestion, getDepartmentList, selectUserDepartment, diseaseList, updateclassification } from "@/api/system/question";
2024-02-28 17:17:16 +08:00
export default {
name: "Question",
data() {
return {
2024-03-07 16:46:38 +08:00
classificationOpen: false,
classificationform: {},
2024-02-28 17:17:16 +08:00
//科室名称
departmentName: '',
defaultProps: {
children: "children",
label: "label"
},
// 部门树选项
deptOptions: undefined,
// 遮罩层
loading: true,
// 总条数
total: 0,
// 问卷基本信息表格数据
questionList: [],
2024-03-07 16:46:38 +08:00
departmentlist: [],
diseaselist: [],
2024-02-28 17:17:16 +08:00
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
departmentId: null,
departmentName: null,
diseaseTypeId: null,
diseaseTypeName: null,
questionnaireName: null,
questionnaireDescription: null,
answeringMethod: null,
questionnaireId: null,
questionCount: null,
questionnaireTotalScore: null,
questionnaireStatus: null,
questionnaireSort: null,
questionnaireRemark: null,
},
2024-03-07 16:46:38 +08:00
rules: {
departmentId: [
{ required: true, message: '请选择科室', trigger: 'change' }
],
}
2024-02-28 17:17:16 +08:00
};
},
watch: {
// 根据名称筛选部门树
departmentName(val) {
this.$refs.tree.filter(val);
}
},
created() {
this.getTreeselect();
this.getList();
},
methods: {
2024-03-07 16:46:38 +08:00
classificationupload() {
let query = {
id: this.classificationform.id,
diseaseTypeId: this.classificationform.diseaseTypeId,
diseaseTypeName: this.classificationform.diseaseTypeName,
departmentId: this.classificationform.departmentId,
departmentName: this.classificationform.departmentName,
}
updateclassification(query).then(res => {
this.classificationform = {}
this.$modal.msgSuccess("修改成功");
this.getList();
this.classificationOpen = false
})
},
//分类管理
handleClassification(row) {
this.classificationform = row
if (this.classificationform.departmentId) {
let query = {
departmentId: this.classificationform.departmentId
}
diseaseList(query).then(res => {
this.diseaselist = res.data
})
}
this.classificationOpen = true
},
classificationOpenfalse() {
this.classificationOpen = false
this.classificationform = {}
},
cleardepartment() {
this.classificationform.diseaseTypeId = ''
2024-03-08 09:38:07 +08:00
this.classificationform.departmentName = ''
this.classificationform.diseaseTypeName = ''
2024-03-07 16:46:38 +08:00
},
changedepartment(e) {
this.classificationform.departmentName = this.departmentlist.find(el => el.id == e).departmentName
let query = {
departmentId: e
}
diseaseList(query).then(res => {
this.diseaselist = res.data
})
},
changediseaseType(e) {
this.classificationform.diseaseTypeName = this.diseaselist.find(el => el.id == e).diseaseTypeName
},
//切换发布状态
switchstatus(e, item) {
2024-03-08 09:38:07 +08:00
if (!item.departmentId && !this.diseaseTypeId) {
this.$message.error('请选择问卷所属的科室以及科室病种后发布!');
this.getList();
return
}
let query = {
id: item.id,
questionnaireStatus: e
}
updateclassification(query).then(res => {
if (e == 'PUBLISHED') {
this.$modal.msgSuccess("修改为已发布");
} else if (e == 'UNPUBLISHED') {
this.$modal.msgSuccess("修改为未发布");
}
})
this.getList();
2024-03-07 16:46:38 +08:00
},
2024-02-28 17:17:16 +08:00
// 节点单击事件
handleNodeClick(data) {
this.queryParams.departmentId = data.id;
this.handleQuery();
},
// 筛选节点
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
/** 查询科室下拉树结构 */
getTreeselect() {
getDepartmentList({}).then(response => {
response.data.forEach(e => {
e.label = e.departmentName
})
this.deptOptions = response.data;
});
2024-03-07 16:46:38 +08:00
selectUserDepartment().then(res => {
this.departmentlist = res.data
})
2024-02-28 17:17:16 +08:00
},
/** 查询问卷基本信息列表 */
getList() {
this.loading = true;
listQuestion(this.queryParams).then(response => {
this.questionList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
2024-03-20 11:33:48 +08:00
this.$store.dispatch('tagsView/delView', this.$route).then(({ visitedViews }) => {
this.$router.push({
path: "/question/addQuestionnaire",
});
})
2024-02-28 17:17:16 +08:00
},
/** 修改按钮操作 */
handleUpdate(row) {
2024-03-20 11:33:48 +08:00
this.$store.dispatch('tagsView/delView', this.$route).then(({ visitedViews }) => {
this.$router.push({
path: "/question/addQuestionnaire",
query: {
id: row.id,
},
});
})
2024-02-28 17:17:16 +08:00
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除问卷?').then(function () {
return delQuestion(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => { });
},
/** 导出按钮操作 */
handleExport() {
this.download('system/question/export', {
...this.queryParams
}, `question_${new Date().getTime()}.xlsx`)
}
}
};
</script>