DiagnosisTemplate.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <template>
  2. <div class="NoiseTemplateWrapper TemplateWrapper">
  3. <crumbs
  4. :title="txt"
  5. class="topBack"
  6. linkTo="DiagnosisList"
  7. ></crumbs>
  8. <DiagnosisPubTag
  9. :editData="editData"
  10. @changeVal="changeVal"
  11. @changeSex="changeSex"
  12. @changeType="changeType"
  13. @validatePass="validatePass"
  14. ref="submitForm"
  15. ></DiagnosisPubTag>
  16. <div class="main">
  17. <div class="btn">
  18. <el-button
  19. type="primary"
  20. @click="submitForm"
  21. >确 定</el-button>
  22. </div>
  23. </div>
  24. </div>
  25. </template>
  26. <script>
  27. /**
  28. * dataPub.region2 判断底部显示哪些
  29. */
  30. import DiagnosisPubTag from './DiagnosisPubTag';
  31. import api from '@api/icss.js';
  32. export default {
  33. name: 'NoiseTemplateWrapper',
  34. data() {
  35. return {
  36. txt:'诊断标签维护-添加诊断标签',
  37. dataPub: {}, //公用组件传的值都在这
  38. editData:{}, //编辑数据
  39. form: {
  40. currentOrder: '0', //标签成文顺序
  41. },
  42. rules: {
  43. currentOrder: [
  44. { required: true, message: '选择标签成文顺序', trigger: 'change' }
  45. ]
  46. },
  47. sendIds: [[], [], [], [], [], []], //标签明细右侧操作数据
  48. }
  49. },
  50. beforeMount:function(){
  51. const {isEdit,data} = this.$route.params;
  52. if(isEdit){
  53. this.txt = '诊断标签维护-修改诊断标签';
  54. this.editData = data;
  55. // console.log('回读数据', this.editData)
  56. }
  57. },
  58. computed: {
  59. newSign() {
  60. return this.dataPub.region2;
  61. },
  62. },
  63. watch: {
  64. newSign(nextVal, prevVal) {
  65. if (nextVal != prevVal) {
  66. this.form.currentOrder = '0'
  67. }
  68. },
  69. },
  70. methods: {
  71. back() { this.$router.go(-1) },
  72. changeVal(val) { //子组件数据改变传递到父组件
  73. this.dataPub = val
  74. // console.log('公用组件传的值都在这', val)
  75. },
  76. changeSex(sex) { //性别改变,清空标签明细
  77. // console.log(sex)
  78. },
  79. changeType(type) { //填写单类型改变,标签明细左侧更新,右侧清空
  80. // console.log(type)
  81. },
  82. changeActionData(arr) { //标签明细右侧数据id
  83. this.sendIds = arr
  84. },
  85. submitForm() { // 调用子组件的方法验证公用部分
  86. this.$refs.submitForm.submitForm('groups');
  87. },
  88. validatePass() { //验证成功回调,调取接口
  89. //仍需验证标签明细是否选择
  90. let type = this.dataPub.region1;
  91. if (JSON.stringify(this.sendIds) == '[[],[],[],[],[],[]]' && type != 6 && type != 7 && type != 8 && type != 9 && type != 10 && type != 11) {
  92. this.$message({
  93. message: '请选择标签明细',
  94. type: 'warning'
  95. });
  96. return;
  97. }
  98. if(parseInt(this.dataPub.region8) >= parseInt(this.dataPub.region9)) {
  99. this.$message({
  100. message: '最小年龄不能大于或等于最大年龄',
  101. type: 'warning'
  102. });
  103. return;
  104. }
  105. let param = {
  106. "disTypeVO": {
  107. "type": this.dataPub.region13
  108. },
  109. "questionWrapper": {
  110. "controlType": 0, //控件类型(0:默认值 1:下拉单选 2:下拉多选 6:文本框 7:数字键盘文本框 99:联合推送)
  111. "id": this.editData.id || '', //新增id空
  112. "type": this.dataPub.region1, //标签归属
  113. // "itemType":0, //0:是症状,1:不是症状
  114. "tagType": this.dataPub.region2, //标签类型
  115. "tagName": this.dataPub.region3, //系统名称
  116. "name": this.dataPub.region4, //界面名称
  117. "joint": this.dataPub.region5, //标签间的连接符
  118. // "subType": this.dataPub.region6, //0:可以,1:不可以(当项目检索)
  119. "sexType": this.dataPub.region7, //1:男,2:女,3:通用
  120. "ageBegin": this.dataPub.region8, //最小年龄
  121. "ageEnd": this.dataPub.region9, //最大年龄
  122. "textGenerate": this.form.currentOrder, //成文顺序 默认0
  123. "copyType": this.dataPub.region10, //是否复制
  124. "showAdd": this.dataPub.region11, //是否显示加号血压
  125. "itemType" :this.dataPub.region12,
  126. "showInfo": 0,
  127. "questionDetails": [],
  128. "questionMappings": [] //映射关系,
  129. }
  130. }
  131. if((this.dataPub.region2 == 2 || this.dataPub.region2 == 3)&& detailLis.length == 0) {
  132. this.warning('请选择标签明细')
  133. return
  134. }
  135. this.showDelDialog(param)
  136. },
  137. showDelDialog(param) {
  138. this.showConfirmDialog('是否保存该诊断标签?', () => {
  139. api.saveOrUpdate(param).then((res) => {
  140. if (res.data.code === '0') {
  141. this.warning(res.data.msg || '保存成功', 'success','1000')
  142. setTimeout(() => {
  143. this.$router.push({
  144. path:'/admin/LT-YXSJWH-ZDBQWH'
  145. })
  146. }, 1000);
  147. } else {
  148. this.warning(res.data.msg)
  149. }
  150. }).catch((err) => {
  151. this.warning(err);
  152. })
  153. });
  154. },
  155. showConfirmDialog(msg, resolve) {
  156. this.$alert(msg, '提示', {
  157. confirmButtonText: '确定',
  158. type: 'warning'
  159. }).then(() => {
  160. resolve();
  161. }).catch(() => {});
  162. },
  163. warning(msg, type,time) {
  164. this.$message({
  165. showClose: true,
  166. message: msg,
  167. type: type || 'warning',
  168. duration:time || '3000'
  169. })
  170. },
  171. },
  172. components: {
  173. DiagnosisPubTag
  174. }
  175. }
  176. </script>
  177. <style lang="less">
  178. @import "../../less/common.less";
  179. .NoiseTemplateWrapper {
  180. .groupTitle {
  181. background-color: #fff;
  182. height: 40px;
  183. line-height: 40px;
  184. padding-left: 20px;
  185. }
  186. .main {
  187. background-color: #fff;
  188. margin: 0 20px 20px;
  189. padding: 20px;
  190. border-top: 1px solid @icssBorder;
  191. box-sizing: border-box;
  192. font-size: 14px;
  193. color: #606266;
  194. .title {
  195. margin-bottom: 20px;
  196. min-width: 915px;
  197. i {
  198. color: #f56c6c;
  199. }
  200. span {
  201. color:#22ccc8;
  202. font-size: 12px;
  203. }
  204. }
  205. }
  206. .btn {
  207. text-align: right;
  208. margin-top: 10px;
  209. }
  210. .order {
  211. margin-bottom: 20px;
  212. .el-input__inner {
  213. line-height: 30px;
  214. height: 30px;
  215. }
  216. }
  217. }
  218. </style>