AddChronicAndIndexRelation.vue 13 KB

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