AddLis.vue 12 KB

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