AddChronicAndIndexRelation.vue 13 KB

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