| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
| | | <el-form |
| | | :model="queryParams" |
| | | ref="queryForm" |
| | | size="small" |
| | | :inline="true" |
| | | v-show="showSearch" |
| | | label-width="68px" |
| | | > |
| | | <el-form-item label="模板名称" prop="tempName"> |
| | | <el-input v-model="queryParams.tempName" placeholder="请输入模板名称" clearable @keyup.enter.native="handleQuery" /> |
| | | <el-input |
| | | v-model="queryParams.tempName" |
| | | 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-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> |
| | | |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-col :span="1.5"> |
| | | <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd" |
| | | v-hasPermi="['hosp:surveyTemplate:add']">新增 |
| | | <el-button |
| | | type="primary" |
| | | icon="el-icon-plus" |
| | | size="mini" |
| | | @click="handleAdd" |
| | | v-hasPermi="['hosp:surveyTemplate:add']" |
| | | >新增 |
| | | </el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button type="primary" icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate" |
| | | v-hasPermi="['hosp:surveyTemplate:edit']">修改 |
| | | <el-button |
| | | type="primary" |
| | | icon="el-icon-edit" |
| | | size="mini" |
| | | :disabled="single" |
| | | @click="handleUpdate" |
| | | v-hasPermi="['hosp:surveyTemplate:edit']" |
| | | >修改 |
| | | </el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button type="primary" icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" |
| | | v-hasPermi="['hosp:surveyTemplate:remove']">删除 |
| | | <el-button |
| | | type="primary" |
| | | icon="el-icon-delete" |
| | | size="mini" |
| | | :disabled="multiple" |
| | | @click="handleDelete" |
| | | v-hasPermi="['hosp:surveyTemplate:remove']" |
| | | >删除 |
| | | </el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button type="primary" icon="el-icon-download" size="mini" @click="handleExport" |
| | | v-hasPermi="['hosp:surveyTemplate:export']">导出 |
| | | <el-button |
| | | type="primary" |
| | | icon="el-icon-download" |
| | | size="mini" |
| | | @click="handleExport" |
| | | v-hasPermi="['hosp:surveyTemplate:export']" |
| | | >导出 |
| | | </el-button> |
| | | </el-col> |
| | | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
| | | <right-toolbar |
| | | :showSearch.sync="showSearch" |
| | | @queryTable="getList" |
| | | ></right-toolbar> |
| | | </el-row> |
| | | |
| | | <el-table border v-loading="loading" :data="surveyTemplateList" @selection-change="handleSelectionChange"> |
| | | <el-table |
| | | border |
| | | v-loading="loading" |
| | | :data="surveyTemplateList" |
| | | @selection-change="handleSelectionChange" |
| | | > |
| | | <el-table-column type="selection" width="40px" align="center" /> |
| | | <el-table-column label="序号" align="center" prop="newID" width="50px" /> |
| | | <el-table-column label="模板名称" align="center" prop="tempName" /> |
| | | <el-table-column label="模板类型" align="center" prop="tempType"> |
| | | <template slot-scope="scope"> |
| | | <dict-tag :options="dict.type.question_template_type" :value="scope.row.tempType" /> |
| | | <dict-tag |
| | | :options="dict.type.question_template_type" |
| | | :value="scope.row.tempType" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="创建人" align="center" prop="createBy" /> |
| | | <el-table-column label="创建时间" align="center" prop="createTime" width="180"> |
| | | <el-table-column |
| | | label="创建时间" |
| | | align="center" |
| | | prop="createTime" |
| | | width="180" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <span>{{ parseTime(scope.row.createTime) }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="修改人" align="center" prop="updateBy" /> |
| | | <el-table-column label="修改时间" align="center" prop="updateTime" width="180"> |
| | | <el-table-column |
| | | label="修改时间" |
| | | align="center" |
| | | prop="updateTime" |
| | | width="180" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <span>{{ parseTime(scope.row.updateTime) }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="启用标志" align="center" prop="qybz"> |
| | | <template slot-scope="scope" v-if="scope.row.userId !== 1"> |
| | | <el-switch |
| | | v-model="scope.row.qybz" |
| | | active-value="0" |
| | | inactive-value="1" |
| | | @change="handleStatusChange(scope.row)" |
| | | ></el-switch> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="备注" align="center" prop="remark" /> |
| | | <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="80px"> |
| | | <el-table-column |
| | | label="操作" |
| | | align="center" |
| | | class-name="small-padding fixed-width" |
| | | width="80px" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" |
| | | v-hasPermi="['hosp:surveyTemplate:edit']" title="修改"> |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | icon="el-icon-view" |
| | | @click="xiangqing(scope.row)" |
| | | v-hasPermi="['web:tags:edit']" |
| | | title="预览" |
| | | ></el-button> |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | icon="el-icon-edit" |
| | | @click="handleUpdate(scope.row)" |
| | | v-hasPermi="['hosp:surveyTemplate:edit']" |
| | | title="修改" |
| | | > |
| | | </el-button> |
| | | <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" |
| | | v-hasPermi="['hosp:surveyTemplate:remove']" title="删除"> |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | icon="el-icon-delete" |
| | | @click="handleDelete(scope.row)" |
| | | v-hasPermi="['hosp:surveyTemplate:remove']" |
| | | title="删除" |
| | | > |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | |
| | | <div class="pag"> |
| | | <div class="pag1"> |
| | | <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" |
| | | @pagination="getList" /> |
| | | <pagination |
| | | v-show="total > 0" |
| | | :total="total" |
| | | :page.sync="queryParams.pageNum" |
| | | :limit.sync="queryParams.pageSize" |
| | | @pagination="getList" |
| | | /> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | <!-- 添加或修改问卷模板对话框 --> |
| | | <el-dialog :title="title" :visible.sync="open" width="450px" append-to-body> |
| | |
| | | <el-form-item label="模板名称" prop="tempName"> |
| | | <el-input v-model="form.tempName" placeholder="请输入模板名称" /> |
| | | </el-form-item> |
| | | <el-form-item label="模板类型" prop="tempType"> |
| | | <el-select v-model="form.tempType" style="width: 100%"> |
| | | <el-option |
| | | v-for="dict in dict.type.question_template_type" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="备注" prop="remark"> |
| | | <el-input v-model="form.remark" placeholder="请输入备注" /> |
| | | </el-form-item> |
| | | <el-divider content-position="center">问卷模板问题信息</el-divider> |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-col :span="1.5"> |
| | | <el-button type="primary" icon="el-icon-plus" size="mini" @click="addmembers()">添加 |
| | | </el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button type="danger" icon="el-icon-delete" size="mini" @click.native.prevent="Delete()">删除 |
| | | </el-button> |
| | | </el-col> |
| | | </el-row> |
| | | <el-table style="width:450px" border :data="form.tjSurveyTempQuesList" |
| | | @selection-change="handleTjSurveyTempQuesSelectionChange"> |
| | | <el-table-column type="selection" width="40" align="center" /> |
| | | <el-table-column label="问题id" prop="qid" width="179"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.qid" placeholder="请输入问题id" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="问题名" prop="qname" width="190"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.qname" placeholder="请输入问题名" /> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <div v-if="DaTianYa == false"> |
| | | <el-divider content-position="center">问卷模板问题信息</el-divider> |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="primary" |
| | | icon="el-icon-plus" |
| | | size="mini" |
| | | @click="addmembers()" |
| | | >添加 |
| | | </el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="danger" |
| | | icon="el-icon-delete" |
| | | size="mini" |
| | | @click.native.prevent="Delete()" |
| | | >删除 |
| | | </el-button> |
| | | </el-col> |
| | | </el-row> |
| | | <el-table |
| | | style="width: 450px" |
| | | border |
| | | :data="form.tjSurveyTempQuesList" |
| | | @selection-change="handleTjSurveyTempQuesSelectionChange" |
| | | > |
| | | <el-table-column type="selection" width="40" align="center" /> |
| | | <el-table-column label="问题id" prop="qid" width="179"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.qid" placeholder="请输入问题id" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="问题名" prop="qname" width="190"> |
| | | <template slot-scope="scope"> |
| | | <el-input |
| | | v-model="scope.row.qname" |
| | | placeholder="请输入问题名" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">确 定</el-button> |
| | | <el-button @click="cancel">取 消</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | <el-drawer |
| | | :visible.sync="previewDialogVisible" |
| | | :before-close="handleClose" |
| | | size="40%" |
| | | > |
| | | <pre-view :key="previewKey" :preview-qrcode="true" /> |
| | | </el-drawer> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import PreView from "./editor/preview"; |
| | | import VueQr from "vue-qr"; |
| | | import { |
| | | listSurveyTemplate, |
| | | getSurveyTemplate, |
| | | delSurveyTemplate, |
| | | addSurveyTemplate, |
| | | updateSurveyTemplate, |
| | | getneedDesign, |
| | | getcanDelete, |
| | | updateQybz, |
| | | } from "@/api/hosp/surveyTemplate"; |
| | | import { Message } from "element-ui"; |
| | | export default { |
| | | inject: ["reload"], |
| | | name: "SurveyTemplate", |
| | | components: { |
| | | PreView, |
| | | VueQr, |
| | | }, |
| | | dicts: ["question_template_type"], |
| | | data() { |
| | | let checkPhoneNum = (rule, value, callback) => { |
| | | console.log(value); |
| | | let patter = new RegExp(/^1\s*[3456789]\s*(\d\s*){9}$/); |
| | | if (value == "" && value == undefined && !value) { |
| | | return callback(""); |
| | | } else if (value != undefined && value != "") { |
| | | return callback(); |
| | | } else if (!patter.test(value)) { |
| | | return callback(""); |
| | | } |
| | | }; |
| | | return { |
| | | // 遮罩层 |
| | | loading: true, |
| | | previewKey: +new Date(), |
| | | previewDialogVisible:false, |
| | | // 选中数组 |
| | | ids: [], |
| | | // 子表选中数据 |
| | |
| | | title: "", |
| | | // 是否显示弹出层 |
| | | open: false, |
| | | DaTianYa: false, |
| | | // 查询参数 |
| | | queryParams: { |
| | | pageNum: 1, |
| | |
| | | deleted: [ |
| | | { |
| | | required: true, |
| | | message: "", |
| | | validator: checkPhoneNum, |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | |
| | | this.multiple = !selection.length; |
| | | }, |
| | | handleTjSurveyTempQuesSelectionChange(selection) { |
| | | this.selectionList =[] |
| | | this.selectionList = selection |
| | | |
| | | this.selectionList = []; |
| | | this.selectionList = selection; |
| | | }, |
| | | /** 新增按钮操作 */ |
| | | handleAdd() { |
| | | this.reset(); |
| | | this.open = true; |
| | | this.title = "添加问卷模板"; |
| | | getneedDesign().then((res) => { |
| | | if (res.msg == "false") { |
| | | this.DaTianYa = false; |
| | | } else { |
| | | this.DaTianYa = true; |
| | | } |
| | | this.open = true; |
| | | }); |
| | | }, |
| | | // 新增行 |
| | | addmembers() { |
| | |
| | | }, |
| | | // 删除行 |
| | | Delete() { |
| | | let that = this |
| | | let that = this; |
| | | if (!that.selectionList) { |
| | | that.$modal.msgSuccess('请选择需要删除的数据') |
| | | that.$modal.msgSuccess("请选择需要删除的数据"); |
| | | } else { |
| | | console.log( that.form.tjSurveyTempQuesList) |
| | | that.selectionList.forEach(item =>{ |
| | | that.form.tjSurveyTempQuesList.forEach((item1,index) => { |
| | | if(item.qid == item1.qid){ |
| | | console.log(that.form.tjSurveyTempQuesList); |
| | | that.selectionList.forEach((item) => { |
| | | that.form.tjSurveyTempQuesList.forEach((item1, index) => { |
| | | if (item.qid == item1.qid) { |
| | | that.form.tjSurveyTempQuesList.splice(index, 1); |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | }); |
| | | }); |
| | | } |
| | | }, |
| | | xiangqing(row) { |
| | | const mid = row.mid |
| | | getSurveyTemplate(mid).then((response) => { |
| | | if (response.data.designId == null) { |
| | | |
| | | } else { |
| | | this.$router.push({ |
| | | query: { key:response.data.designId}, |
| | | }); |
| | | this.previewDialogVisible = true; |
| | | } |
| | | }) |
| | | }, |
| | | handleClose() { |
| | | this.reload(); |
| | | this.previewDialogVisible = false; |
| | | }, |
| | | handleStatusChange(row) { |
| | | let text = row.qybz === "0" ? "启用" : "停用"; |
| | | this.$modal |
| | | .confirm('确认要"' + text + '""' + row.tempName + '"问卷吗?') |
| | | .then(function () { |
| | | return updateQybz(row.mid, row.qybz); |
| | | }) |
| | | .then(() => { |
| | | this.$modal.msgSuccess(text + "成功"); |
| | | }) |
| | | .catch(function () { |
| | | row.qybz = row.qybz === "0" ? "1" : "0"; |
| | | }); |
| | | }, |
| | | /** 修改按钮操作 */ |
| | | handleUpdate(row) { |
| | |
| | | const mid = row.mid || this.ids; |
| | | getSurveyTemplate(mid).then((response) => { |
| | | this.form = response.data; |
| | | this.form.tjSurveyTempQuesList = response.data.tjSurveyTempQuesList; |
| | | this.open = true; |
| | | this.title = "修改问卷模板"; |
| | | if (response.data.tjSurveyTempQuesList.length >= 1) { |
| | | this.form.tjSurveyTempQuesList = response.data.tjSurveyTempQuesList; |
| | | } |
| | | if ( this.form.designId == null) { |
| | | this.DaTianYa = false; |
| | | this.title = "修改问卷模板"; |
| | | this.open = true; |
| | | } else { |
| | | this.DaTianYa = true; |
| | | this.form.formKey = this.form.designId; |
| | | this.form.type = 1; |
| | | this.toProjectHandle(this.form, "editor"); |
| | | } |
| | | }); |
| | | }, |
| | | /** 提交按钮 */ |
| | |
| | | }); |
| | | } else { |
| | | addSurveyTemplate(this.form).then((response) => { |
| | | this.$modal.msgSuccess("新增成功"); |
| | | // this.$modal.msgSuccess("新增成功"); |
| | | this.toProjectHandle(response.data, "editor"); |
| | | this.open = false; |
| | | this.getList(); |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | toProjectHandle(form, type) { |
| | | this.$router.push({ |
| | | path: "/editor/moban", |
| | | query: { key: form.formKey, active: type, type: form.type }, |
| | | }); |
| | | }, |
| | | /** 删除按钮操作 */ |
| | |
| | | this.$modal |
| | | .confirm('是否确认删除院区信息编号为"' + mids + '"的数据项?') |
| | | .then(function () { |
| | | return delSurveyTemplate(mids); |
| | | let id = row.mid; |
| | | return getcanDelete(id).then((res) => { |
| | | if (res.data == true) { |
| | | delSurveyTemplate(mids); |
| | | } else { |
| | | this.$modal.msgError("问卷正在使用中"); |
| | | } |
| | | }); |
| | | // return delSurveyTemplate(mids); |
| | | }) |
| | | .then(() => { |
| | | this.getList(); |
| | | this.$modal.msgSuccess("删除成功"); |
| | | }) |
| | | .catch(() => { }); |
| | | .catch(() => { |
| | | this.$modal.msgError("问卷正在使用中"); |
| | | }); |
| | | }, |
| | | /** 导出按钮操作 */ |
| | | handleExport() { |
| | |
| | | |
| | | .pag1 { |
| | | width: 30%; |
| | | }</style> |
| | | } |
| | | </style> |