NoiseTemplate.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  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> 标签明细:</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. console.log(44254165456)
  163. this.sendIds = arr
  164. },
  165. submitForm() { // 调用子组件的方法验证公用部分
  166. this.$refs.submitForm.submitForm('groups');
  167. },
  168. validatePass() { //验证成功回调,调取接口
  169. //仍需验证标签明细是否选择
  170. let type = this.dataPub.region1;
  171. if (JSON.stringify(this.sendIds) == '[[],[],[],[],[],[]]' && type != 6 && type != 7 && type != 8 && type != 9) {
  172. this.$message({
  173. message: '请选择标签明细',
  174. type: 'warning'
  175. });
  176. return;
  177. }
  178. let detailLis = utils.dataRecombination(this.sendIds, this.dataPub.region2)
  179. let param = {
  180. "questionWrapper": {
  181. "controlType": 0, //控件类型(0:默认值 1:下拉单选 2:下拉多选 6:文本框 7:数字键盘文本框 99:联合推送)
  182. "id": this.editData.id || '', //新增id空
  183. "type": this.dataPub.region1, //标签归属
  184. // "itemType":0, //0:是症状,1:不是症状
  185. "tagType": this.dataPub.region2, //标签类型
  186. "tagName": this.dataPub.region3, //系统名称
  187. "name": this.dataPub.region4, //界面名称
  188. "joint": this.dataPub.region5, //标签间的连接符
  189. "subType": this.dataPub.region6, //0:可以,1:不可以(当项目检索)
  190. "sexType": this.dataPub.region7, //1:男,2:女,3:通用
  191. "ageBegin": this.dataPub.region8, //最小年龄
  192. "ageEnd": this.dataPub.region9, //最大年龄
  193. "textGenerate": this.form.currentOrder, //成文顺序 默认0
  194. "copyType": this.dataPub.region10, //是否复制
  195. "showAdd": this.dataPub.region11, //是否显示加号血压
  196. "showInfo": 0,
  197. "questionDetails": [],
  198. "questionMappings": detailLis //映射关系,
  199. }
  200. }
  201. this.showDelDialog(param)
  202. },
  203. showDelDialog(param) {
  204. this.showConfirmDialog('是否保存该标签组?', () => {
  205. api.saveOrUpdate(param).then((res) => {
  206. if (res.data.code === '0') {
  207. this.warning(res.data.msg || '保存成功', 'success','1000')
  208. setTimeout(() => {
  209. this.$router.push({
  210. path:'/admin/LT-YXSJWH-BQZWH'
  211. })
  212. }, 1000);
  213. } else {
  214. this.warning(res.data.msg)
  215. }
  216. }).catch((err) => {
  217. this.warning(err);
  218. })
  219. });
  220. },
  221. showConfirmDialog(msg, resolve) {
  222. this.$alert(msg, '提示', {
  223. confirmButtonText: '确定',
  224. type: 'warning'
  225. }).then(() => {
  226. resolve();
  227. }).catch(() => {});
  228. },
  229. warning(msg, type,time) {
  230. this.$message({
  231. showClose: true,
  232. message: msg,
  233. type: type || 'warning',
  234. duration:time || '3000'
  235. })
  236. },
  237. },
  238. components: {
  239. PubTagGroup,
  240. PubTagPartDetail,
  241. SymptomTagGroup,
  242. BloodPressTagGroup,
  243. SymptomPush,
  244. InspactTagGroup,
  245. }
  246. }
  247. </script>
  248. <style lang="less">
  249. @import "../../less/common.less";
  250. .NoiseTemplateWrapper {
  251. .groupTitle {
  252. background-color: #fff;
  253. height: 40px;
  254. line-height: 40px;
  255. padding-left: 20px;
  256. }
  257. .main {
  258. background-color: #fff;
  259. margin: 0 20px 20px;
  260. padding: 20px;
  261. border-top: 1px solid @icssBorder;
  262. box-sizing: border-box;
  263. font-size: 14px;
  264. color: #606266;
  265. .title {
  266. margin-bottom: 20px;
  267. i {
  268. color: #f56c6c;
  269. }
  270. }
  271. }
  272. .btn {
  273. text-align: right;
  274. margin-top: 10px;
  275. }
  276. .order {
  277. margin-bottom: 20px;
  278. .el-input__inner {
  279. line-height: 30px;
  280. height: 30px;
  281. }
  282. }
  283. }
  284. </style>