AddChronicAndIndexRelation.vue 12 KB

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