|
@@ -5,20 +5,84 @@
|
|
|
class="topBack"
|
|
|
linkTo="/admin/LT-YWZSJWH-MBWH"
|
|
|
></crumbs>
|
|
|
- <PubIndeptQa
|
|
|
- @changeVal="changeVal"
|
|
|
- @changeSex="changeSex"
|
|
|
- @changeType="changeType"
|
|
|
- @validatePass="validatePass"
|
|
|
- qaType="2"
|
|
|
- :editData="editData"
|
|
|
- ref="submitForm"
|
|
|
- ></PubIndeptQa>
|
|
|
+ <div class="PubTagGroupWrapper">
|
|
|
+ <el-form class="groups"
|
|
|
+ :rules="rules"
|
|
|
+ ref="groups"
|
|
|
+ :model="form"
|
|
|
+ label-width="150px">
|
|
|
+ <el-form-item
|
|
|
+ label="模板类型:"
|
|
|
+ prop="moduleType">
|
|
|
+ <span class="changeTips">改变类型后,填写单明细将会恢复到默认状态</span>
|
|
|
+ <el-select
|
|
|
+ v-model="form.moduleType"
|
|
|
+ placeholder="请选择模板类型"
|
|
|
+ @change="changeType(1)"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in moduleTypes"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.val"
|
|
|
+ :key="item.id"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ label="模板归属:"
|
|
|
+ prop="type"
|
|
|
+ >
|
|
|
+ <span class="changeTips">改变归属后,填写单明细将会恢复到默认状态</span>
|
|
|
+ <el-select
|
|
|
+ v-model="form.type"
|
|
|
+ placeholder="请选择模板归属"
|
|
|
+ @change="changeType(0)"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in typeList"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.val"
|
|
|
+ :key="item.id"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ v-if="form.moduleType==1"
|
|
|
+ label="选择科室:"
|
|
|
+ prop="relationId">
|
|
|
+ <span class="changeTips">改变类型后,填写单明细将会恢复到默认状态</span>
|
|
|
+ <el-select
|
|
|
+ v-model="form.relationId"
|
|
|
+ placeholder="请选择科室"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in deptList"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.val"
|
|
|
+ :key="item.id"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ label="模板名称:"
|
|
|
+ prop="name"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="form.name"
|
|
|
+ maxLength="30"
|
|
|
+ placeholder="请输入模板名称"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="备注:">
|
|
|
+ <el-input type="textarea" v-model="form.desc"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
<div class="main">
|
|
|
<p class="title">
|
|
|
填写单明细:
|
|
|
</p>
|
|
|
- <QuestionTagGroup :ascription="dataPub.region1" :sexType="dataPub.region7" :type="dataPub.region2" @changeActionData="pushValues" :options="editData.questionMapping"></QuestionTagGroup>
|
|
|
+ <QuestionTagGroup :type="form.moduleType" @changeActionData="pushValues" :options="editData.modelDetils"></QuestionTagGroup>
|
|
|
<div class="btn">
|
|
|
<el-button
|
|
|
type="primary"
|
|
@@ -30,92 +94,98 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
/**
|
|
|
- * dataPub.region2 判断底部显示哪些
|
|
|
+ *
|
|
|
*/
|
|
|
- import PubIndeptQa from './PubIndeptQa';
|
|
|
import QuestionTagGroup from './QuestionTagGroup';
|
|
|
import api from '@api/preTreat.js';
|
|
|
import utils from '@api/utils.js';
|
|
|
|
|
|
export default {
|
|
|
name: 'addCombinQuestion',
|
|
|
+ props:[''],
|
|
|
data() {
|
|
|
return {
|
|
|
txt:'模板维护-添加模板',
|
|
|
- imgList:[],
|
|
|
- dataPub: {}, //公用组件传的值都在这
|
|
|
- itemsTypes:[1,2], //有明细的类型
|
|
|
+ form:{
|
|
|
+ name:"",
|
|
|
+ type:"",
|
|
|
+ moduleType:"",
|
|
|
+ relationId:"",
|
|
|
+ remark:''
|
|
|
+ },
|
|
|
+ typeList:[],
|
|
|
+ moduleTypes:[],
|
|
|
+ deptList:[],
|
|
|
editData:{}, //编辑数据
|
|
|
options: [], //标签明细右侧操作数据
|
|
|
+ rules: {
|
|
|
+ type: [
|
|
|
+ { required: true, message: '请选择归属', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ moduleType: [
|
|
|
+ { required: true, message: '请选择类型', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ name: [
|
|
|
+ { required: true, message: '请输入模板名称', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ relationId: [
|
|
|
+ { required: true, message: '请选择模板归属科室', trigger: 'change' },
|
|
|
+ ],
|
|
|
+ },
|
|
|
}
|
|
|
},
|
|
|
beforeMount:function(){
|
|
|
const {isEdit,data} = this.$route.params;
|
|
|
+ this.getDropDatas();
|
|
|
if(isEdit){
|
|
|
this.txt = '模板维护-修改模板';
|
|
|
- this.editData = data;console.log(data)
|
|
|
+ this.editData = data;
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
back() { this.$router.go(-1) },
|
|
|
- changeVal(val) { //子组件数据改变传递到父组件
|
|
|
- this.dataPub = val;
|
|
|
- //console.log('公用组件传的值都在这', val);
|
|
|
- },
|
|
|
- changeSex(sex) { //性别改变,清空填写单明细
|
|
|
- //console.log(sex)
|
|
|
+ getDropDatas(){
|
|
|
+ api.getPreTypeList().then((res) =>{
|
|
|
+ if(res.data.code === '0') {
|
|
|
+ this.typeList = res.data.data[1];
|
|
|
+ this.moduleTypes = res.data.data[4];
|
|
|
+ }
|
|
|
+ });
|
|
|
+ api.getDeptList({moduleType:0,type:1}).then((res) =>{
|
|
|
+ if(res.data.code === '0') {
|
|
|
+ this.deptList = res.data.data&&res.data.data.deptDTOS||[];
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
- changeType(type) { //填写单类型改变,标签明细左侧更新,右侧清空
|
|
|
+ changeType(flag) { //填写单类型改变,标签明细左侧更新,右侧清空
|
|
|
// console.log('type',type)
|
|
|
+ if(flag){
|
|
|
+ this.form.type='';
|
|
|
+ }
|
|
|
this.options = [];
|
|
|
},
|
|
|
pushValues(its){
|
|
|
- const arr = its.map((it,i)=>{
|
|
|
+ const arr = its.map((it)=>{
|
|
|
return {
|
|
|
- sonQuestion:it.id,
|
|
|
- orderNo:+i+1,
|
|
|
- exclusionType:0
|
|
|
+ questionId:it.id,
|
|
|
}
|
|
|
});
|
|
|
this.options = arr;
|
|
|
},
|
|
|
submitForm() { // 调用子组件的方法验证公用部分
|
|
|
- this.$refs.submitForm.submitForm('groups');
|
|
|
- },
|
|
|
- validatePass() { //验证成功回调,调取接口
|
|
|
- //仍需验证填写单明细是否选择
|
|
|
- if(parseFloat(this.dataPub.region8) >= parseFloat(this.dataPub.region9)) {
|
|
|
- this.warning('最小年龄不能大于或等于最大年龄');
|
|
|
- return;
|
|
|
- }
|
|
|
- if(parseFloat(this.dataPub.minNormalVal) >= parseFloat(this.dataPub.maxNormalVal)) {
|
|
|
- this.warning('最小正常值不能大于或等于最大正常值');
|
|
|
- return;
|
|
|
- }
|
|
|
- const {isEdit,data} = this.$route.params;
|
|
|
- let param = {
|
|
|
- "questionWrapper": {
|
|
|
- //"controlType": this.dataPub.region2, //控件类型(0:默认值 1:下拉单选 2:下拉多选 6:文本框 7:数字键盘文本框 99:联合推送)
|
|
|
- "id": isEdit?data.id:'', //新增id置空
|
|
|
- "type": this.dataPub.region1, //填写单归属
|
|
|
- "tagType": this.dataPub.region2, //模板类型
|
|
|
- "tagName": this.dataPub.region3, //系统名称
|
|
|
- "name": this.dataPub.region4, //医生界面名称
|
|
|
- "description":this.dataPub.region5,
|
|
|
- "sexType": this.dataPub.region7, //1:男,2:女,3:通用
|
|
|
- "ageBegin": this.dataPub.region8, //最小年龄
|
|
|
- "ageEnd": this.dataPub.region9, //最大年龄
|
|
|
- "itemType" :this.dataPub.region12, //是否为主要内容
|
|
|
- "url":this.dataPub.region13, //上传图片
|
|
|
- //"questionDetails": this.options, //明细项
|
|
|
- "questionMappings": this.options, //映射关系,
|
|
|
+ this.$refs.groups.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ let param = this.form;
|
|
|
+ param.modelDetils = this.options;
|
|
|
+ this.showSaveDialog(param);
|
|
|
+ }else{
|
|
|
+ return false;
|
|
|
}
|
|
|
- };
|
|
|
- this.showSaveDialog(param);
|
|
|
+ });
|
|
|
},
|
|
|
showSaveDialog(param) {
|
|
|
this.showConfirmDialog('是否保存该模板?', () => {
|
|
|
- api.questionAdd(param).then((res) => {
|
|
|
+ api.addModule(param).then((res) => {
|
|
|
if (res.data.code === '0') {
|
|
|
this.warning(res.data.msg || '保存成功', 'success');
|
|
|
this.$router.push("/admin/LT-YWZSJWH-MBWH");
|
|
@@ -144,13 +214,15 @@
|
|
|
},
|
|
|
},
|
|
|
components: {
|
|
|
- PubIndeptQa,
|
|
|
QuestionTagGroup
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
<style lang="less">
|
|
|
@import "../../less/common.less";
|
|
|
+ .PubTagGroupWrapper{
|
|
|
+ padding-bottom: 10px;
|
|
|
+ }
|
|
|
.NoiseTemplateWrapper {
|
|
|
.groupTitle {
|
|
|
background-color: #fff;
|