NoiseTemplate.vue 13 KB

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