AddAssaySon.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. <template>
  2. <div class="assayBox" @click="close">
  3. <crumbs
  4. :title="'化验子项维护-'+titleText"
  5. class="topBack"
  6. :param="$route.params"
  7. linkTo="AssaySon"
  8. ></crumbs>
  9. <el-form :model="form" ref="ruleForm" class="addDepartForm">
  10. <p class="assayTitle">添加化验标准术语</p>
  11. <el-form-item class="addDepartFormItem" v-if="!isEdit" label="添加:" prop="department">
  12. <input class="searchInput" @focus="focuInput" type="text" v-model = "searchConcept">
  13. <span class="searchName" @click="searchDiag">搜索</span>
  14. <ul class="itemList" v-show="conceptList.length>0">
  15. <li
  16. v-for="item in conceptList"
  17. class="diagItem ellipsis"
  18. :title="item.conceptName"
  19. @click="selectDiag(item)"
  20. :key="item.conceptId">
  21. {{item.conceptNameType||item.conceptName}}
  22. </li>
  23. </ul>
  24. </el-form-item>
  25. <el-form-item class="isRequired" label="已选择化验标准术语:" prop="type">
  26. {{form.conceptNameType||form.conceptName}}
  27. </el-form-item>
  28. </el-form>
  29. <div class="symptomList">
  30. <div class="screenIndex clearfix">
  31. <p class="assayTitle">化验子项添加</p>
  32. <label class="screenIndexLabel">添加:</label>
  33. <input class="searchInput" @focus="focuInput" type="text" v-model = "searchIndexVal">
  34. <span class="searchName" @click="searchIndex">搜索</span>
  35. <ul class="itemList indexList" v-show="indexList.length>0">
  36. <li
  37. v-for="item in indexList"
  38. class="diagItem ellipsis"
  39. :title="item.conceptName"
  40. @click="selectIndex(item)"
  41. :key="item.conceptName">
  42. {{item.conceptNameType||item.conceptName}}
  43. </li>
  44. </ul>
  45. </div>
  46. <table class="indexTab">
  47. <tr>
  48. <td class="selectedContent">已选择内容</td>
  49. <td class="selectedContentOpera">操作</td>
  50. </tr>
  51. <tr v-for="(item, index) in selectedIndexList" :key="item.conceptId">
  52. <!-- <td class="selectedContent ">{{item.parentConceptName?item.conceptName+'('+item.parentConceptName+')':item.conceptName}}</td> -->
  53. <td class="selectedContent ">{{item.conceptNameType||item.conceptName}}</td>
  54. <td class="selectedContentOpera"><el-button type="text" size="small" class="delete" @click="delSelectedIndex(item, index)">删除</el-button></td>
  55. </tr>
  56. </table>
  57. </div>
  58. <div class="btn">
  59. <el-button
  60. type="primary"
  61. :disabled = 'saveDisable'
  62. @click="submitForm('ruleForm')"
  63. >确 定</el-button>
  64. </div>
  65. </div>
  66. </template>
  67. <script>
  68. import api from '@api/icss.js';
  69. export default {
  70. name: 'AddAssaySon',
  71. data() {
  72. return{
  73. form: {
  74. conceptId: '',
  75. conceptName:'' ,
  76. conceptNameType:''
  77. },
  78. titleText: '添加化验子项',
  79. conceptList: [],
  80. indexList: [],
  81. selectedIndexList: [], //选择的同义词
  82. searchConcept: '',
  83. searchIndexVal: '',
  84. isEdit: false,
  85. nodeList:[], //化验子项列表
  86. saveDisable: false
  87. }
  88. },
  89. created(){
  90. const { isEdit, data } = this.$route.params;
  91. if(isEdit) {
  92. this.isEdit = isEdit;
  93. this.titleText = '修改化验子项';
  94. this.form.conceptId = data.conceptId;
  95. this.form.conceptName = data.conceptName;
  96. this.form.conceptNameType = data.conceptNameType;
  97. this.selectedIndexList = data.nodeList;
  98. }
  99. },
  100. methods: {
  101. close() {
  102. this.conceptList = [];
  103. this.indexList = [];
  104. },
  105. back(){
  106. this.$router.go(-1);
  107. },
  108. searchDiag() {
  109. const param = {
  110. "name": this.searchConcept,
  111. "relationId": 18,
  112. "relationPosition": 1,
  113. "typeId": 12
  114. }
  115. api.getConceptInfoAssay(param).then((res)=>{
  116. if(res.data.code === '0') {
  117. this.conceptList = res.data.data
  118. }
  119. })
  120. },
  121. selectDiag(item) {
  122. this.form.conceptId = item.conceptId;
  123. this.form.conceptName = item.conceptName;
  124. this.form.conceptNameType = item.conceptNameType;
  125. this.searchConcept = '';
  126. this.conceptList=[];
  127. },
  128. focuInput() {
  129. // 聚焦时清空搜索结果?
  130. },
  131. selectedTags() {//已选项ids
  132. let selectedTags = []
  133. for (let i =0; i < this.selectedIndexList.length; i++) {
  134. selectedTags.push(this.selectedIndexList[i].conceptId)
  135. }
  136. return selectedTags
  137. },
  138. searchIndex() {
  139. const notIds = this.selectedTags();
  140. const param = {
  141. "name": this.searchIndexVal,
  142. "relationId": 18,
  143. "relationPosition": 2,
  144. "typeId": 13,
  145. "relationConceptId":this.form.conceptId,
  146. "excludedConceptIds":notIds
  147. }
  148. api.getConceptInfoAssay(param).then((res)=>{
  149. if(res.data.code === '0') {
  150. this.indexList = res.data.data;
  151. }
  152. })
  153. },
  154. selectIndex(item) {
  155. this.selectedIndexList.push(item);
  156. this.indexList = [];
  157. },
  158. delSelectedIndex(selectedItem, index) {
  159. this.selectedIndexList.splice(index, 1)
  160. this.nodeList.splice(index, 1)
  161. },
  162. submitForm(formName) {
  163. if(!this.form.conceptId) {
  164. this.warning('请选择化验标准术语')
  165. return
  166. }
  167. if(this.selectedIndexList.length === 0) {
  168. this.warning('请添加化验子项')
  169. return
  170. }
  171. this.showDelDialog();
  172. },
  173. showDelDialog() {
  174. const selected = this.selectedIndexList;
  175. for (let i = 0; i < selected.length; i++) {
  176. let item = {};
  177. item.conceptId = selected[i].conceptId;
  178. item.relationId = 18;
  179. this.nodeList.push(item);
  180. }
  181. const param ={
  182. "conceptId": this.form.conceptId,
  183. "nodeList": this.nodeList,
  184. "sonRelationId": 18
  185. }
  186. this.showConfirmDialog('是否建立该关联?', () => {
  187. this.saveDisable = true //提交保存按钮不可点击,返回结果时才可点击,防止频繁发送请求
  188. api.addAssaySon(param).then((res) => {
  189. if (res.data.code === '0') {
  190. this.warning(res.data.msg || '关联成功', 'success','1000')
  191. setTimeout(() => {
  192. //返回带搜索条件的首页
  193. this.$router.push({
  194. path:'AssaySon',
  195. params: Object.assign({}, this.$route.params, {currentPage: 1})
  196. })
  197. }, 1000);
  198. } else {
  199. this.warning(res.data.msg)
  200. }
  201. this.saveDisable = false
  202. }).catch((err) => {
  203. this.warning(err);
  204. })
  205. });
  206. },
  207. showConfirmDialog(msg, resolve) {
  208. this.$alert(msg, '提示', {
  209. confirmButtonText: '确定',
  210. type: 'warning'
  211. }).then(() => {
  212. resolve();
  213. }).catch(() => {});
  214. },
  215. warning(msg, type,time) {
  216. this.$message({
  217. showClose: true,
  218. message: msg,
  219. type: type || 'warning',
  220. duration:time || '3000'
  221. })
  222. },
  223. }
  224. }
  225. </script>
  226. <style lang="less">
  227. @import '../../less/common.less';
  228. .assayBox {
  229. color: #606266;
  230. min-width: 980px;
  231. .topBack {
  232. top: 0;
  233. }
  234. .assayTitle{
  235. font-weight: bold;
  236. margin-bottom: 20px;
  237. }
  238. .groupTitle {
  239. background-color: #fff;
  240. height: 40px;
  241. line-height: 40px;
  242. padding-left: 20px;
  243. }
  244. .searchInput, .searchName {
  245. display: inline-block;
  246. height: 32px;
  247. line-height: 32px;
  248. border: 1px solid #a9a9a9;
  249. margin: 0px 0 0 0;
  250. padding: 0 5px;
  251. float: left;
  252. margin-top: 4px;
  253. }
  254. .isRequired .el-form-item__label::before {
  255. content: '*';
  256. color: red;
  257. }
  258. .searchName {
  259. border-left: none;
  260. cursor: pointer;
  261. font-size: 16px;
  262. padding: 0 14px;
  263. }
  264. .itemList {
  265. position: absolute;
  266. // display: none;
  267. background: #fff;
  268. width: 162px;
  269. max-height: 150px;
  270. border: 1px solid #a9a9a9;
  271. left: 54px;
  272. top: 37px;
  273. z-index: 2;
  274. overflow-y: auto;
  275. }
  276. .diagItem {
  277. padding: 0 5px;
  278. height: 30px;
  279. line-height: 30px;
  280. font-size: 14px;
  281. cursor: pointer;
  282. }
  283. .diagItem:hover {
  284. background: #f5f7fa;
  285. }
  286. .addDepartForm {
  287. position: relative;
  288. background-color: #fff;
  289. padding: 20px;
  290. margin: 70px 20px 0px 20px;
  291. border-bottom: 1px solid #c0c4cc;
  292. }
  293. .addDepartFormItem {
  294. position: relative;
  295. }
  296. .symptomList {
  297. background-color: #fff;
  298. padding: 20px;
  299. margin: 0px 20px 0px 20px;
  300. min-height: 400px;
  301. }
  302. .screenIndexLabel {
  303. float: left;
  304. height: 40px;
  305. line-height: 40px;
  306. font-size: 14px;
  307. }
  308. .indexTab {
  309. // width: 100%;
  310. width: 600px;
  311. border-collapse: collapse;
  312. tr {
  313. td {
  314. padding: 5px 10px;
  315. border-bottom: 1px solid #a9a9a9;
  316. text-align: center;
  317. }
  318. }
  319. .selectedContent {
  320. width: 25%;
  321. }
  322. .selectedContentGrop {
  323. width: 55%;
  324. }
  325. .selectedContentOpera {
  326. width: 20%;
  327. }
  328. }
  329. .screenIndex {
  330. width: 100%;
  331. margin-bottom: 30px;
  332. position: relative;
  333. }
  334. .indexList {
  335. left: 42px;
  336. top: 78px;
  337. }
  338. .groupInput {
  339. text-align: center;
  340. height: 28px;
  341. color: #606266;
  342. width: 60%;
  343. }
  344. .btn {
  345. position: relative;
  346. background-color: #fff;
  347. margin: 0px 20px;
  348. height: 40px;
  349. padding: 20px;
  350. .el-button {
  351. position: absolute;
  352. right: 20px;
  353. }
  354. }
  355. .selectDepart {
  356. }
  357. }
  358. </style>