AddChronicAndIndexRelation.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. <!-- 添加常见科室症状 -->
  2. <template>
  3. <div class="AddChronicAndIndexRelationWrapper">
  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. back(){
  116. this.$router.go(-1);
  117. },
  118. searchDiag() {
  119. const param = {
  120. "diseaseName": this.searchDiagVal,
  121. }
  122. api.queryIndexConfigDiseaseNames(param).then((res)=>{
  123. if(res.data.code === '0') {
  124. this.diagList = res.data.data
  125. if(this.diagList.length>0) {this.$refs['diagList'].style.display = 'block'}
  126. if(this.indexList.length>0) {this.$refs['indexList'].style.display = 'none'}
  127. }
  128. })
  129. },
  130. selectDiag(item) {
  131. this.form.diseaseId = item.diseaseId
  132. this.form.diseaseName = item.diseaseName
  133. this.$refs['diagList'].style.display='none'
  134. this.searchDiagVal = ''
  135. this.diagList=[]
  136. },
  137. focuInput() {
  138. this.$refs['diagList'].style.display='none'
  139. this.$refs['indexList'].style.display='none'
  140. },
  141. searchIndex() {
  142. const param = {
  143. conceptName: this.searchIndexVal,
  144. excludedConceptNames: this.selectedIndexMap
  145. }
  146. api.getAllLisConcept(param).then((res)=>{
  147. if(res.data.code === '0') {
  148. this.indexList = res.data.data
  149. // this.indexList =[
  150. // {conceptName : '空腹血糖'},
  151. // {conceptName : '餐后2小时血糖'},
  152. // {conceptName : '随机血糖'},
  153. // {conceptName : '糖化血红蛋白'},
  154. // {conceptName : '血常规'},
  155. // ]
  156. if(this.indexList.length > 0){this.$refs['indexList'].style.display='block'}
  157. if(this.diagList.length>0) {this.$refs['diagList'].style.display = 'none'}
  158. }
  159. })
  160. },
  161. selectIndex(item) {
  162. this.selectedIndexList.push({indexUnique: item.conceptName, indexDesc:''})
  163. this.selectedIndexMap.push(item.conceptName)
  164. this.indexList = []
  165. this.$refs['indexList'].style.display='none'
  166. },
  167. delSelectedIndex(selectedItem, index) {
  168. this.selectedIndexMap = this.selectedIndexMap.filter((item) => {return item != selectedItem.indexUnique})
  169. this.selectedIndexList.splice(index, 1)
  170. },
  171. submitForm(formName) {
  172. if(!this.form.diseaseId) {
  173. this.warning('请选择诊断')
  174. return
  175. }
  176. if(this.selectedIndexList.length === 0) {
  177. this.warning('请选择指标')
  178. return
  179. }
  180. for (let i = 0; i < this.selectedIndexList.length; i++) {
  181. if(!this.selectedIndexList[i].indexDesc) {
  182. this.warning('请填写内容分组')
  183. return
  184. }
  185. }
  186. this.showDelDialog()
  187. },
  188. showDelDialog() {
  189. this.selectedIndexList.map((item) => {
  190. item.diseaseId = this.form.diseaseId
  191. return item
  192. })
  193. const param ={
  194. "diseaseId": this.form.diseaseId,
  195. "indexConfigData": this.selectedIndexList
  196. }
  197. this.showConfirmDialog('是否建立该关联?', () => {
  198. const url = this.isEdit ?api.updateIndexConfigList(param) : api.saveIndexConfigLists(param)
  199. url.then((res) => {
  200. if (res.data.code === '0') {
  201. this.warning(res.data.msg || '关联成功', 'success','1000')
  202. setTimeout(() => {
  203. this.$router.push({
  204. path:'/admin/LT-YXSJWH-MBZBZGLWH'
  205. })
  206. }, 1000);
  207. } else {
  208. this.warning(res.data.msg)
  209. }
  210. }).catch((err) => {
  211. this.warning(err);
  212. })
  213. });
  214. },
  215. showConfirmDialog(msg, resolve) {
  216. this.$alert(msg, '提示', {
  217. confirmButtonText: '确定',
  218. type: 'warning'
  219. }).then(() => {
  220. resolve();
  221. }).catch(() => {});
  222. },
  223. warning(msg, type,time) {
  224. this.$message({
  225. showClose: true,
  226. message: msg,
  227. type: type || 'warning',
  228. duration:time || '3000'
  229. })
  230. },
  231. }
  232. }
  233. </script>
  234. <style lang="less">
  235. @import '../../less/common.less';
  236. .AddChronicAndIndexRelationWrapper {
  237. color: #606266;
  238. .topBack {
  239. top: 0;
  240. }
  241. .groupTitle {
  242. background-color: #fff;
  243. height: 40px;
  244. line-height: 40px;
  245. padding-left: 20px;
  246. }
  247. .searchInput, .searchName {
  248. display: inline-block;
  249. height: 32px;
  250. line-height: 32px;
  251. border: 1px solid #a9a9a9;
  252. margin: 0px 0 0 0;
  253. padding: 0 5px;
  254. float: left;
  255. margin-top: 4px;
  256. }
  257. .isRequired .el-form-item__label::before {
  258. content: '*';
  259. color: red;
  260. }
  261. .searchName {
  262. border-left: none;
  263. cursor: pointer;
  264. font-size: 16px;
  265. padding: 0 14px;
  266. }
  267. .itemList {
  268. position: absolute;
  269. display: none;
  270. background: #fff;
  271. width: 162px;
  272. max-height: 150px;
  273. border: 1px solid #a9a9a9;
  274. left: 110px;
  275. top: 35px;
  276. z-index: 2;
  277. overflow-y: auto;
  278. }
  279. .diagItem {
  280. padding: 0 5px;
  281. height: 30px;
  282. line-height: 30px;
  283. font-size: 14px;
  284. cursor: pointer;
  285. }
  286. .diagItem:hover {
  287. background: #f5f7fa;
  288. }
  289. .addDepartForm {
  290. position: relative;
  291. background-color: #fff;
  292. padding: 20px;
  293. margin: 70px 20px 0px 20px;
  294. border-bottom: 1px solid #c0c4cc;
  295. }
  296. .addDepartFormItem {
  297. position: relative;
  298. }
  299. .symptomList {
  300. background-color: #fff;
  301. padding: 20px;
  302. margin: 0px 20px 0px 20px;
  303. min-height: 400px;
  304. }
  305. .screenIndexLabel {
  306. float: left;
  307. height: 40px;
  308. line-height: 40px;
  309. font-size: 14px;
  310. }
  311. .indexTab {
  312. width: 100%;
  313. border-collapse: collapse;
  314. tr {
  315. td {
  316. padding: 5px 10px;
  317. border-bottom: 1px solid #a9a9a9;
  318. text-align: center;
  319. }
  320. }
  321. .selectedContent {
  322. width: 25%;
  323. }
  324. .selectedContentGrop {
  325. width: 55%;
  326. }
  327. .selectedContentOpera {
  328. width: 20%;
  329. }
  330. }
  331. .screenIndex {
  332. width: 100%;
  333. margin-bottom: 30px;
  334. position: relative;
  335. }
  336. .indexList {
  337. left: 112px;
  338. }
  339. .groupInput {
  340. text-align: center;
  341. height: 28px;
  342. color: #606266;
  343. width: 60%;
  344. }
  345. .btn {
  346. position: relative;
  347. background-color: #fff;
  348. margin: 0px 20px;
  349. height: 40px;
  350. padding: 20px;
  351. .el-button {
  352. position: absolute;
  353. right: 20px;
  354. }
  355. }
  356. .selectDepart {
  357. }
  358. }
  359. </style>