NoiseTemplate.vue 14 KB

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