AddIndeptLabel.vue 5.8 KB

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