NoiseTemplate.vue 11 KB

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