AddOperation.vue 12 KB

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