NoiseTemplate.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  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. <PubTagGroup
  8. :editData="editData"
  9. @changeVal="changeVal"
  10. @changeSex="changeSex"
  11. @changeType="changeType"
  12. @validatePass="validatePass"
  13. ref="submitForm"
  14. ></PubTagGroup>
  15. <div class="main">
  16. <p v-if="dataPub.region1 != 6 && dataPub.region1 != 7 && dataPub.region1 != 8 && dataPub.region1 != 9" class="title"> <i>*</i> 标签明细:<span>{{dataPub.region2 == 2?'(操作界面:横栏默认互斥项,只能放入单选类型且明细为一条的标签;每列可以放入单选/多选类型)':dataPub.region2 == 6?'(操作界面:横栏默认互斥项,只能放入单选类型且明细为一条的标签;第一列只可放入带有同伴/无特殊标记的多选类型标签,其余列只可放入症状详情类型标签组)':''}}</span></p>
  17. <PubTagPartDetail
  18. :pool="dataPub.tagPool"
  19. :type="dataPub.region1"
  20. :sign="dataPub.region2"
  21. :order="dataPub.order"
  22. :sexType="dataPub.region7"
  23. :tipLis="dataPub.tipLis"
  24. :choose="dataPub.region2 == 6?'multiple':'single'"
  25. :options="editData.questionMapping"
  26. v-if="dataPub.region2 == 2 || dataPub.region2 == 6"
  27. @changeActionData="changeActionData"
  28. ></PubTagPartDetail>
  29. <SymptomTagGroup
  30. v-if="dataPub.region2 == 4"
  31. :pool="dataPub.tagPool"
  32. :type="dataPub.region1"
  33. :sexType="dataPub.region7"
  34. :options="editData.questionMapping"
  35. @changeActionData="changeActionData"
  36. >
  37. </SymptomTagGroup>
  38. <InspactTagGroup
  39. v-if="dataPub.region2 == 7"
  40. :pool="dataPub.tagPool"
  41. :type="dataPub.region1"
  42. :sexType="dataPub.region7"
  43. :options="editData.questionMapping"
  44. @changeActionData="changeActionData"
  45. >
  46. </InspactTagGroup>
  47. <BloodPressTagGroup
  48. v-if="dataPub.region2 == 3"
  49. :pool="dataPub.tagPool"
  50. :type="dataPub.region1"
  51. :sexType="dataPub.region7"
  52. :options="editData.questionMapping"
  53. @changeActionData="changeActionData"
  54. >
  55. </BloodPressTagGroup>
  56. <SymptomPush
  57. v-if="dataPub.region2 == 11"
  58. :pool="dataPub.tagPool"
  59. :type="dataPub.region1"
  60. :sexType="dataPub.region7"
  61. :options="editData.questionMapping"
  62. :tipLis="dataPub.tipLis"
  63. @changeActionData="changeActionData"
  64. >
  65. </SymptomPush>
  66. <el-form
  67. v-if="dataPub.region2 == 2"
  68. class="order"
  69. :rules="rules"
  70. :model="form"
  71. label-width="150px"
  72. >
  73. <el-form-item
  74. label="选择标签成文顺序:"
  75. prop="currentOrder"
  76. >
  77. <el-select
  78. v-model="form.currentOrder"
  79. placeholder="选择标签成文顺序"
  80. >
  81. <el-option
  82. v-for="item in dataPub.order"
  83. :label="item.name"
  84. :value="item.val"
  85. :key="item.id"
  86. ></el-option>
  87. </el-select>
  88. </el-form-item>
  89. </el-form>
  90. <div class="btn">
  91. <el-button
  92. type="primary"
  93. @click="submitForm"
  94. >确 定</el-button>
  95. </div>
  96. </div>
  97. </div>
  98. </template>
  99. <script>
  100. /**
  101. * dataPub.region2 判断底部显示哪些
  102. */
  103. import PubTagGroup from './PubTagGroup';
  104. import PubTagPartDetail from './PubTagPartDetail';
  105. import SymptomTagGroup from './SymptomTagGroup';
  106. import InspactTagGroup from './InspactTagGroup';
  107. import BloodPressTagGroup from './BloodPressTagGroup';
  108. import SymptomPush from './SymptomPush';
  109. import api from '@api/icss.js';
  110. import utils from '@api/utils.js';
  111. export default {
  112. name: 'NoiseTemplateWrapper',
  113. data() {
  114. return {
  115. txt:'标签组维护--添加标签组',
  116. dataPub: {}, //公用组件传的值都在这
  117. editData:{}, //编辑数据
  118. form: {
  119. currentOrder: '0', //标签成文顺序
  120. },
  121. rules: {
  122. currentOrder: [
  123. { required: true, message: '选择标签成文顺序', trigger: 'change' }
  124. ]
  125. },
  126. sendIds: [[], [], [], [], [], []], //标签明细右侧操作数据
  127. }
  128. },
  129. beforeMount:function(){
  130. const {isEdit,data} = this.$route.params;
  131. if(isEdit){
  132. this.txt = '标签组维护--修改标签组';
  133. this.editData = data;
  134. // console.log('回读数据', this.editData)
  135. }
  136. },
  137. computed: {
  138. newSign() {
  139. return this.dataPub.region2;
  140. },
  141. },
  142. watch: {
  143. newSign(nextVal, prevVal) {
  144. if (nextVal != prevVal) {
  145. this.form.currentOrder = '0'
  146. }
  147. },
  148. },
  149. methods: {
  150. back() { this.$router.go(-1) },
  151. changeVal(val) { //子组件数据改变传递到父组件
  152. this.dataPub = val
  153. // console.log('公用组件传的值都在这', val)
  154. },
  155. changeSex(sex) { //性别改变,清空标签明细
  156. // console.log(sex)
  157. },
  158. changeType(type) { //填写单类型改变,标签明细左侧更新,右侧清空
  159. // console.log(type)
  160. },
  161. changeActionData(arr) { //标签明细右侧数据id
  162. this.sendIds = arr
  163. },
  164. submitForm() { // 调用子组件的方法验证公用部分
  165. this.$refs.submitForm.submitForm('groups');
  166. },
  167. validatePass() { //验证成功回调,调取接口
  168. //仍需验证标签明细是否选择
  169. let type = this.dataPub.region1;
  170. if (JSON.stringify(this.sendIds) == '[[],[],[],[],[],[]]' && type != 6 && type != 7 && type != 8 && type != 9) {
  171. this.$message({
  172. message: '请选择标签明细',
  173. type: 'warning'
  174. });
  175. return;
  176. }
  177. if(this.dataPub.region8 >= this.dataPub.region9) {
  178. this.$message({
  179. message: '最小年龄不能大于或等于最大年龄',
  180. type: 'warning'
  181. });
  182. return;
  183. }
  184. let detailLis = utils.dataRecombination(this.sendIds, this.dataPub.region2)
  185. let param = {
  186. "questionWrapper": {
  187. "controlType": 0, //控件类型(0:默认值 1:下拉单选 2:下拉多选 6:文本框 7:数字键盘文本框 99:联合推送)
  188. "id": this.editData.id || '', //新增id空
  189. "type": this.dataPub.region1, //标签归属
  190. // "itemType":0, //0:是症状,1:不是症状
  191. "tagType": this.dataPub.region2, //标签类型
  192. "tagName": this.dataPub.region3, //系统名称
  193. "name": this.dataPub.region4, //界面名称
  194. "joint": this.dataPub.region5, //标签间的连接符
  195. // "subType": this.dataPub.region6, //0:可以,1:不可以(当项目检索)
  196. "sexType": this.dataPub.region7, //1:男,2:女,3:通用
  197. "ageBegin": this.dataPub.region8, //最小年龄
  198. "ageEnd": this.dataPub.region9, //最大年龄
  199. "textGenerate": this.form.currentOrder, //成文顺序 默认0
  200. "copyType": this.dataPub.region10, //是否复制
  201. "showAdd": this.dataPub.region11, //是否显示加号血压
  202. "itemType" :this.dataPub.region12,
  203. "showInfo": 0,
  204. "questionDetails": [],
  205. "questionMappings": detailLis //映射关系,
  206. }
  207. }
  208. if(this.dataPub.region2 == 2 && detailLis.length == 0) {
  209. this.warning('请选择标签明细')
  210. }
  211. this.showDelDialog(param)
  212. },
  213. showDelDialog(param) {
  214. this.showConfirmDialog('是否保存该标签组?', () => {
  215. api.saveOrUpdate(param).then((res) => {
  216. if (res.data.code === '0') {
  217. this.warning(res.data.msg || '保存成功', 'success','1000')
  218. setTimeout(() => {
  219. this.$router.push({
  220. path:'/admin/LT-YXSJWH-BQZWH'
  221. })
  222. }, 1000);
  223. } else {
  224. this.warning(res.data.msg)
  225. }
  226. }).catch((err) => {
  227. this.warning(err);
  228. })
  229. });
  230. },
  231. showConfirmDialog(msg, resolve) {
  232. this.$alert(msg, '提示', {
  233. confirmButtonText: '确定',
  234. type: 'warning'
  235. }).then(() => {
  236. resolve();
  237. }).catch(() => {});
  238. },
  239. warning(msg, type,time) {
  240. this.$message({
  241. showClose: true,
  242. message: msg,
  243. type: type || 'warning',
  244. duration:time || '3000'
  245. })
  246. },
  247. },
  248. components: {
  249. PubTagGroup,
  250. PubTagPartDetail,
  251. SymptomTagGroup,
  252. BloodPressTagGroup,
  253. SymptomPush,
  254. InspactTagGroup,
  255. }
  256. }
  257. </script>
  258. <style lang="less">
  259. @import "../../less/common.less";
  260. .NoiseTemplateWrapper {
  261. .groupTitle {
  262. background-color: #fff;
  263. height: 40px;
  264. line-height: 40px;
  265. padding-left: 20px;
  266. }
  267. .main {
  268. background-color: #fff;
  269. margin: 0 20px 20px;
  270. padding: 20px;
  271. border-top: 1px solid @icssBorder;
  272. box-sizing: border-box;
  273. font-size: 14px;
  274. color: #606266;
  275. .title {
  276. margin-bottom: 20px;
  277. min-width: 915px;
  278. i {
  279. color: #f56c6c;
  280. }
  281. span {
  282. color:#22ccc8;
  283. font-size: 12px;
  284. }
  285. }
  286. }
  287. .btn {
  288. text-align: right;
  289. margin-top: 10px;
  290. }
  291. .order {
  292. margin-bottom: 20px;
  293. .el-input__inner {
  294. line-height: 30px;
  295. height: 30px;
  296. }
  297. }
  298. }
  299. </style>