AddChemicalAndCommonMapping.vue 10.0 KB

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