NoiseTemplate.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  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(parseFloat(this.dataPub.region8) >= parseFloat(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 || this.dataPub.region2 == 3)&& detailLis.length == 0) {
  209. this.warning('请选择标签明细')
  210. return
  211. }
  212. this.showDelDialog(param)
  213. },
  214. showDelDialog(param) {
  215. /*this.showConfirmDialog('是否保存该标签组?', () => {
  216. api.saveOrUpdate(param).then((res) => {
  217. if (res.data.code === '0') {
  218. this.warning(res.data.msg || '保存成功', 'success','1000')
  219. setTimeout(() => {
  220. this.$router.push({
  221. path:'/admin/LT-YXSJWH-BQZWH'
  222. })
  223. }, 1000);
  224. } else {
  225. this.warning(res.data.msg)
  226. }
  227. }).catch((err) => {
  228. this.warning(err);
  229. })
  230. });*/
  231. const h = this.$createElement;
  232. const {isEdit} = this.$route.params;
  233. const addMsg = h('div',{style:'padding-bottom:10px'},[
  234. h('p',{style:'font-size:15px;margin-bottom:10px'},'是否保存该标签组?')
  235. ])
  236. const modMsg = h('div',{style:'padding-bottom:10px'},[
  237. h('p',{style:'font-size:15px;margin-bottom:10px'},'是否保存该标签组?'),
  238. h('span',{style:'color:red;font-size:12px'},'若标签系统名称已经改变,请去别名维护中修改相关信息'),
  239. ])
  240. this.$msgbox({
  241. title:'提示',
  242. message:isEdit?modMsg:addMsg,
  243. showCancelButton: true,
  244. distinguishCancelAndClose:true,
  245. confirmButtonText: '确认并前往别名维护',
  246. cancelButtonText:'确认',
  247. // type: 'warning',
  248. cancelButtonClass:'toast-cancel'
  249. }).then(()=>{
  250. api.saveOrUpdate(param).then((res) => {
  251. if (res.data.code === '0') {
  252. this.warning(res.data.msg || '保存成功', 'success');
  253. // 判断是否已有别名--有(修改),无(新增)
  254. const item = {id:param.questionWrapper.id,name:param.questionWrapper.tagName};
  255. api.similarNameDetl(item).then((res)=>{
  256. if(res.data.code=='0'){
  257. this.$router.push({
  258. name:'AddSimilarName',
  259. params: item
  260. })
  261. }else{
  262. this.$router.push({
  263. name:'AddSimilarName',
  264. params: {}
  265. })
  266. }
  267. })
  268. } else {
  269. this.warning(res.data.msg)
  270. }
  271. }).catch((err) => {
  272. this.warning(err);
  273. })
  274. }).catch((action)=>{
  275. // action :cancel--取消,close--关闭
  276. if(action=='cancel'){
  277. api.saveOrUpdate(param).then((res) => {
  278. if (res.data.code === '0') {
  279. this.warning(res.data.msg || '保存成功', 'success');
  280. setTimeout(() => {
  281. this.$router.push({
  282. path:'/admin/LT-YXSJWH-BQZWH'
  283. })
  284. }, 1000);
  285. } else {
  286. this.warning(res.data.msg)
  287. }
  288. }).catch((err) => {
  289. this.warning(err);
  290. })
  291. }
  292. })
  293. },
  294. showConfirmDialog(msg, resolve) {
  295. this.$alert(msg, '提示', {
  296. confirmButtonText: '确定',
  297. type: 'warning'
  298. }).then(() => {
  299. resolve();
  300. }).catch(() => {});
  301. },
  302. warning(msg, type,time) {
  303. this.$message({
  304. showClose: true,
  305. message: msg,
  306. type: type || 'warning',
  307. duration:time || '3000'
  308. })
  309. },
  310. },
  311. components: {
  312. PubTagGroup,
  313. PubTagPartDetail,
  314. SymptomTagGroup,
  315. BloodPressTagGroup,
  316. SymptomPush,
  317. InspactTagGroup,
  318. }
  319. }
  320. </script>
  321. <style lang="less">
  322. @import "../../less/common.less";
  323. .NoiseTemplateWrapper {
  324. .groupTitle {
  325. background-color: #fff;
  326. height: 40px;
  327. line-height: 40px;
  328. padding-left: 20px;
  329. }
  330. .main {
  331. background-color: #fff;
  332. margin: 0 20px 20px;
  333. padding: 20px;
  334. border-top: 1px solid @icssBorder;
  335. box-sizing: border-box;
  336. font-size: 14px;
  337. color: #606266;
  338. .title {
  339. margin-bottom: 20px;
  340. min-width: 915px;
  341. i {
  342. color: #f56c6c;
  343. }
  344. span {
  345. color:#22ccc8;
  346. font-size: 12px;
  347. }
  348. }
  349. }
  350. .btn {
  351. text-align: right;
  352. margin-top: 10px;
  353. }
  354. .order {
  355. margin-bottom: 20px;
  356. .el-input__inner {
  357. line-height: 30px;
  358. height: 30px;
  359. }
  360. }
  361. }
  362. </style>