AddFusion.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  1. <template>
  2. <div class="AddChemicalAndCommonMappingWrapper clearfix" @click="close">
  3. <crumbs title="血库关联维护-添加关联" class="topBack" :param="$route.params" linkTo="Fusion"></crumbs>
  4. <div class="AddChemicalAndCommonMappingBox clearfix">
  5. <div class="titleBox clearfix">
  6. <p class="title">医院术语</p>
  7. <p class="title">标准术语</p>
  8. </div>
  9. <div class="leftBox clearfix">
  10. <div class="itemLabel clearfix">
  11. <label class="itemLabelName">用血类型</label>
  12. <input class="searchInput" type="text" v-model="hisName" />
  13. </div>
  14. <div class="itemLabel clearfix">
  15. <label class="itemLabelName">用血类型预览:</label>
  16. <span class="selectItemName">{{hisName}}</span>
  17. </div>
  18. </div>
  19. <div class="midBox">
  20. <img class="midLogo" src="../../../images/relation.png" alt />
  21. <p class="midTitle">相互关联</p>
  22. </div>
  23. <div class="rightBox">
  24. <div class="itemLabel">
  25. <label class="itemLabelName">用血类型</label>
  26. <input class="searchInput" @focus="focuInput" type="text" v-model="uniqueText" />
  27. <span class="searchName" @click="searchMealItem(3)">搜索</span>
  28. <ul
  29. v-if="showUniqueNameList&&uniqueNameList.length >0"
  30. class="itemList uniqueNameList"
  31. ref="uniqueNameList"
  32. >
  33. <li
  34. v-for="item in uniqueNameList"
  35. class="mealNameItem ellipsis"
  36. :title="item"
  37. @click="selectUniqueName(item)"
  38. :key="item"
  39. >{{item}}</li>
  40. </ul>
  41. </div>
  42. <div class="itemLabel">
  43. <!-- <label class="itemLabelName isRequired">诊断名称预览:</label> -->
  44. <label class="itemLabelName">用血类型预览:</label>
  45. <span class="selectItemName">{{form.uniqueName}}</span>
  46. </div>
  47. </div>
  48. </div>
  49. <div class="btn">
  50. <!-- <span class="sumbit" @click="submitForm">建立关联</span> -->
  51. <el-button type="primary" :disabled="saveDisable" @click="submitForm">建立关联</el-button>
  52. </div>
  53. </div>
  54. </template>
  55. <script>
  56. import api from '@api/icss.js';
  57. export default {
  58. name: 'AddFusion',
  59. data() {
  60. return {
  61. hisName: '', //检查项目
  62. itemText: '', //化验小项搜索文字内容
  63. uniqueText: '', //公表项搜索文字内容
  64. isEdit: false,
  65. editId: '',
  66. mealNameList: [],
  67. itemNameList: [],
  68. uniqueNameList: [],
  69. showMealNameList: false,
  70. showItemNameList: false,
  71. showUniqueNameList: false,
  72. form: {
  73. mealName: '', //大项名称
  74. mealId: '', //大项Id
  75. itemName: '', //小项名称
  76. itemId: '', //小项Id
  77. uniqueName: '', //公表名称,必填
  78. uniqueId: '' //公表项Id
  79. },
  80. saveDisable: false //保存按钮禁止点击
  81. };
  82. },
  83. created() {
  84. //修改
  85. const { isEdit, data } = this.$route.params;
  86. if (isEdit) {
  87. this.isEdit = isEdit;
  88. this.editId = data.id;
  89. this.uniqueText = data.uniqueName;
  90. this.hisName = data.hisName;
  91. this.form.uniqueName = data.uniqueName;
  92. }
  93. },
  94. methods: {
  95. close() {
  96. this.mealNameList = [];
  97. this.itemNameList = [];
  98. this.uniqueNameList = [];
  99. this.showSearchList();
  100. },
  101. // 搜索
  102. searchMealItem(type) {
  103. if (type == '1' || type == '2') {
  104. this.getTagList(type);
  105. } else if (type == '3') {
  106. // 搜索标准术语列表
  107. this.getAllLisConcept();
  108. }
  109. },
  110. // 标准术语搜索列表
  111. getAllLisConcept() {
  112. let params = {
  113. type: 8, //血液
  114. inputStr: this.uniqueText,
  115. sex: 3,
  116. age: 0
  117. };
  118. if (!params.inputStr) {
  119. return;
  120. }
  121. api.retrievalSearch(params).then(res => {
  122. if (res.data.code === '0') {
  123. this.uniqueNameList = res.data.data.transfusionNames;
  124. this.showSearchList('showUniqueNameList');
  125. }
  126. });
  127. },
  128. // 获取焦点搜索
  129. focuInput() {
  130. this.showSearchList();
  131. },
  132. // 显示搜索列表数据
  133. showSearchList(type) {
  134. this.showMealNameList = false;
  135. this.showItemNameList = false;
  136. this.showUniqueNameList = false;
  137. if (type === 'showMealNameList') {
  138. this.showMealNameList = true;
  139. } else if (type === 'showItemNameList') {
  140. this.showItemNameList = true;
  141. } else if (type === 'showUniqueNameList') {
  142. this.showUniqueNameList = true;
  143. }
  144. },
  145. selectMealName(item) {
  146. this.form.mealName = item.conceptName;
  147. this.form.mealId = item.conceptId;
  148. // this.$refs['mealNameList'].style.display='none'
  149. this.hisName = '';
  150. this.mealNameList = [];
  151. },
  152. selectItemName(item) {
  153. this.form.itemName = item.conceptName;
  154. this.form.itemId = item.conceptId;
  155. this.itemText = '';
  156. this.itemNameList = [];
  157. },
  158. // 选中诊断标准术语
  159. selectUniqueName(item) {
  160. this.form.uniqueName = item;
  161. this.uniqueNameList = [];
  162. },
  163. // 初始化表单数据
  164. initForm() {
  165. this.form.uniqueName = '';
  166. this.hisName = '';
  167. this.uniqueText = '';
  168. },
  169. // 建立关联-参数处理
  170. submitForm() {
  171. const { hisName } = this;
  172. const { uniqueName } = this.form;
  173. if (!hisName || !uniqueName) {
  174. this.warning('请填写相关数据');
  175. return;
  176. }
  177. let params = {
  178. hisName: hisName,
  179. uniqueName: uniqueName
  180. };
  181. this.showSaveDialog(params);
  182. },
  183. // 建立关联-映射关系是否已存在
  184. showSaveDialog(params) {
  185. this.saveDisable = true; //提交保存按钮不可点击,返回结果时才可点击,防止频繁发送请求
  186. api
  187. .fusionIsExistRecord(params)
  188. .then(res => {
  189. if (!res.data.data) {
  190. // 不存在,创建新的关联
  191. // 如果是编辑时,需要携带id
  192. if (this.isEdit) {
  193. params = { ...params, id: this.editId };
  194. }
  195. this.saveLisMapping(params, '关联建立成功', 'success');
  196. } else {
  197. // 已存在,提示修改
  198. // this.showConfirmDialog('该关联已存在是否替换旧的关系信息', () => {
  199. // this.saveLisMapping(params, '关联建立成功', 'success');
  200. // });
  201. this.warning('该条关联已存在,请重新编辑!');
  202. this.saveDisable = false;
  203. }
  204. })
  205. .catch(err => {
  206. this.warning(err);
  207. });
  208. },
  209. // 映射关系不存在-建立关联
  210. saveLisMapping(params, msg, type) {
  211. api.saveOrUpdateFusionRecord(params).then(res => {
  212. if (res.data.code === '0') {
  213. this.warning(res.data.msg || msg, type);
  214. // this.$router.push({name: 'ChemicalAndCommonMapping'});
  215. this.initForm();
  216. } else {
  217. this.warning(res.data.msg);
  218. }
  219. this.saveDisable = false;
  220. });
  221. },
  222. // 关联已存在模态框
  223. showConfirmDialog(msg, resolve) {
  224. this.$confirm(msg, '提示', {
  225. customClass: 'confirmRealation',
  226. confirmButtonText: '是',
  227. cancelButtonText: '否',
  228. cancelButtonClass: 'cancelButton',
  229. type: 'warning'
  230. })
  231. .then(() => {
  232. resolve();
  233. })
  234. .catch(() => {
  235. this.saveDisable = false;
  236. this.warning('建立失败', 'error');
  237. });
  238. },
  239. warning(msg, type) {
  240. this.$message({
  241. showClose: true,
  242. message: msg,
  243. type: type || 'warning'
  244. });
  245. }
  246. }
  247. };
  248. </script>
  249. <style lang="less">
  250. .AddChemicalAndCommonMappingWrapper {
  251. .AddChemicalAndCommonMappingBox {
  252. min-width: 940px;
  253. }
  254. color: #606266;
  255. .topBack {
  256. top: 0;
  257. }
  258. // .groupTitle {
  259. // width: calc(100% - 50px);
  260. // height: 40px;
  261. // background: #fff;
  262. // padding: 0 20px 0 30px;
  263. // margin-bottom: 20px;
  264. // line-height: 40px;
  265. // position: relative;
  266. // z-index: 5;
  267. // }
  268. .titleBox {
  269. padding: 0 0 10px 0px;
  270. }
  271. .title {
  272. width: 50%;
  273. float: left;
  274. font-size: 14px;
  275. }
  276. .AddChemicalAndCommonMappingBox {
  277. padding: 20px 30px 20px 30px;
  278. margin: 70px 20px 0 20px;
  279. background: #fff;
  280. }
  281. .leftBox,
  282. .midBox,
  283. .rightBox {
  284. width: 40%;
  285. float: left;
  286. min-height: 200px;
  287. font-size: 14px;
  288. }
  289. .midBox {
  290. width: 6%;
  291. padding: 50px 0 0 0;
  292. text-align: center;
  293. }
  294. .midTitle {
  295. width: 40px;
  296. margin: 0 auto;
  297. }
  298. .midLogo {
  299. margin: 0 auto;
  300. }
  301. .leftBox,
  302. .rightBox {
  303. border: 1px solid #a9a9a9;
  304. padding: 20px 20px;
  305. }
  306. .itemLabel {
  307. width: 100%;
  308. min-height: 50px;
  309. line-height: 50px;
  310. position: relative;
  311. }
  312. .itemLabelName,
  313. .searchInput,
  314. .searchName {
  315. float: left;
  316. color: #606266;
  317. }
  318. .itemLabelName {
  319. width: 150px;
  320. }
  321. .isRequired::before {
  322. content: '*';
  323. color: red;
  324. }
  325. .searchInput,
  326. .mealNameItem {
  327. padding: 0 5px;
  328. }
  329. .searchInput,
  330. .searchName {
  331. display: inline-block;
  332. height: 32px;
  333. line-height: 32px;
  334. border: 1px solid #a9a9a9;
  335. margin: 8px 0 0 0;
  336. }
  337. .searchName {
  338. text-align: center;
  339. border-left: none;
  340. cursor: pointer;
  341. padding: 0 12px;
  342. font-size: 16px;
  343. }
  344. .itemList {
  345. position: absolute;
  346. background: #fff;
  347. width: 162px;
  348. max-height: 150px;
  349. border: 1px solid #a9a9a9;
  350. left: 150px;
  351. top: 42px;
  352. z-index: 2;
  353. overflow-y: auto;
  354. }
  355. .itemList {
  356. width: calc(100% - 131px);
  357. }
  358. .mealNameItem {
  359. height: 30px;
  360. line-height: 30px;
  361. font-size: 14px;
  362. cursor: pointer;
  363. }
  364. .mealNameItem:hover {
  365. background: #f5f7fa;
  366. }
  367. .selectItemName {
  368. display: inline-block;
  369. width: calc(100% - 160px);
  370. }
  371. .btn {
  372. position: relative;
  373. background-color: #fff;
  374. margin: 0px 20px;
  375. padding: 20px;
  376. min-width: 960px;
  377. height: 80px;
  378. .el-button {
  379. position: absolute;
  380. right: 80px;
  381. top: 20px;
  382. }
  383. }
  384. .sumbit {
  385. position: absolute;
  386. display: inline-block;
  387. width: 80px;
  388. height: 30px;
  389. line-height: 30px;
  390. border: 1px solid #a9a9a9;
  391. text-align: center;
  392. right: 100px;
  393. }
  394. }
  395. .confirmRealation {
  396. .cancelButton {
  397. border: 1px solid #a9a9a9;
  398. span {
  399. color: #606266;
  400. }
  401. }
  402. }
  403. </style>