AddIndeptLabel.vue 6.8 KB

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