TemplateMaintenanceWrap.vue 5.9 KB

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