ConceptRelation.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <template>
  2. <div>
  3. <crumbs title="医学术语关联维护" style="min-width: 980px">
  4. <el-form :inline="true" class="demo-form-inline">
  5. <el-form-item label="标准术语名称:">
  6. <el-input size="mini" v-model="filter.conceptName" placeholder="术语名称" clearable></el-input>
  7. </el-form-item>
  8. <el-form-item>
  9. <el-button size="mini" @click="filterDatas">确认</el-button>
  10. <el-button size="mini" type="warning" @click="addRelation">添加关联</el-button>
  11. </el-form-item>
  12. </el-form>
  13. </crumbs>
  14. <div class="tab">
  15. <span v-for="it in typeList"
  16. :key="it.key"
  17. :class="{'curr':it.key==filter.type}"
  18. @click="toggTab(it)">
  19. {{it.name}}
  20. </span>
  21. </div>
  22. <div class="contents">
  23. <el-table
  24. :data="list"
  25. border
  26. style="width: 100%">
  27. <el-table-column
  28. :resizable = "false"
  29. type="index"
  30. :index = 'indexMethod'
  31. label="编号"
  32. width="60">
  33. </el-table-column>
  34. <el-table-column
  35. :resizable = "false"
  36. prop="operTime"
  37. label="操作时间"
  38. width="180">
  39. </el-table-column>
  40. <el-table-column
  41. :resizable = "false"
  42. prop="libNameType"
  43. label="医学标准术语"
  44. show-overflow-tooltip>
  45. </el-table-column>
  46. <el-table-column
  47. :resizable = "false"
  48. prop="otherNames"
  49. label="关联术语"
  50. show-overflow-tooltip>
  51. </el-table-column>
  52. <!-- <el-table-column
  53. label="状态">
  54. <template slot-scope="scope">
  55. <span :class="scope.row.isDeleted == 'N'?'':'delete'">
  56. {{scope.row.isDeleted == 'N'?'启用中':'已删除'}}
  57. </span>
  58. </template>
  59. </el-table-column> -->
  60. <el-table-column
  61. :resizable = "false"
  62. prop="operName"
  63. label="操作人">
  64. </el-table-column>
  65. <el-table-column
  66. label="操作"
  67. width="160"
  68. :resizable = "false">
  69. <template slot-scope="scope">
  70. <el-button type="text" size="small" :disabled="scope.row.isDeleted != 'N'" @click="modifyRelation(scope.row)">修改</el-button>
  71. <span style="margin:0 3px;">|</span>
  72. <el-button type="text" size="small" :class="scope.row.isDeleted == 'N'?'delete':'review'" @click="showDelDialog(scope.row)">{{scope.row.isDeleted == 'N'?'删除':'恢复'}}</el-button>
  73. </template>
  74. </el-table-column>
  75. </el-table>
  76. <div class="pagination">
  77. <el-pagination :current-page.sync="currentPage"
  78. @current-change="currentChange"
  79. background
  80. :page-size="pageSize"
  81. :page-sizes="pageSizeArr"
  82. @size-change="handleSizeChange"
  83. :layout="pageLayout"
  84. :total="total">
  85. </el-pagination>
  86. </div>
  87. </div>
  88. </div>
  89. </template>
  90. <script>
  91. import api from '@api/icss.js';
  92. import config from '@api/config.js';
  93. import utils from '@api/utils.js';
  94. export default {
  95. name: 'ConceptRelation', //诊断量表关联维护
  96. data: function() {
  97. return {
  98. list: [],
  99. searched: false,
  100. filter:{
  101. conceptName:'',
  102. type:''
  103. },
  104. currentPage: 1,
  105. pageSize: config.pageSize,
  106. pageSizeArr:config.pageSizeArr,
  107. pageLayout:config.pageLayout,
  108. total: 0,
  109. typeList:[]
  110. }
  111. },
  112. created() {
  113. let typeList = JSON.parse(localStorage.getItem("knowledgeEnumsData"));
  114. this.typeList = typeList.relationModelTypeEnum;
  115. this.filter.type = this.typeList[0].key;//默认展示科室,请置于第一位
  116. const that = this;
  117. //返回时避免参数未赋值就获取列表
  118. setTimeout(function(){
  119. that.getDataList();
  120. });
  121. },
  122. watch: {
  123. 'filter': {
  124. handler: function () {
  125. this.searched = false;
  126. },
  127. deep: true
  128. }
  129. },
  130. beforeRouteEnter(to, from, next) {
  131. next(vm => {
  132. //const pm = to.param;
  133. Object.assign(vm, to.params);
  134. vm.inCurrentPage=to.params.currentPage;
  135. })
  136. },
  137. methods: {
  138. handleSizeChange(val){
  139. this.pageSize = val;
  140. this.currentPage = utils.getCurrentPage(this.currentChange, this.total, this.pageSize);
  141. this.getDataList();
  142. },
  143. toggTab(item){
  144. // bug2348 搜索后切换tab时清空搜索条件
  145. this.filter.conceptName = '';
  146. this.filter.type = item.key;
  147. this.currentPage = 1;
  148. this.getDataList();
  149. },
  150. getDataList(isTurnPage) {
  151. const param = this.getFilterItems(isTurnPage);
  152. this.searched = true;
  153. const loading = this.$loading({
  154. lock: true,
  155. text: 'Loading',
  156. spinner: 'el-icon-loading',
  157. background: 'rgba(0, 0, 0, 0.7)'
  158. });
  159. api.getConceptRelation(param).then((res) => {
  160. loading.close()
  161. if(res.data.code == '0') {
  162. this.list = res.data.data.records
  163. this.total = res.data.data.total;
  164. if(this.inCurrentPage!==undefined){
  165. this.currentPage=this.inCurrentPage;
  166. this.inCurrentPage = undefined;
  167. }
  168. }
  169. })
  170. },
  171. filterDatas() {
  172. this.currentPage = 1;
  173. this.getDataList();
  174. },
  175. addRelation() {
  176. const pam = this.searched ? {
  177. currentPage: this.currentPage,
  178. pageSize:this.pageSize,
  179. filter: this.filter
  180. } : {currentPage: this.currentPage,
  181. pageSize:this.pageSize,filter:Object.assign(this.filter,{conceptName:''})};
  182. this.$router.push({name:'AddConceptRelation',params:pam})
  183. },
  184. modifyRelation(row) {
  185. const typeL = this.filter.type.toString().split('101');
  186. const typeId = [];
  187. typeId[0] = +typeL[1];
  188. const param = {
  189. "conceptId": row.conceptId,
  190. // "relationId":17
  191. "relationIds":[17],//9-20新增
  192. "typeIds":typeId
  193. }
  194. const pam = this.searched ? {
  195. currentPage: this.currentPage,
  196. pageSize:this.pageSize,
  197. filter: this.filter
  198. } : {currentPage: this.currentPage,
  199. pageSize:this.pageSize,filter:Object.assign(this.filter,{conceptName:''})};
  200. api.getConceptRelationDet(param).then((res) => {
  201. if(res.data.code=='0'){
  202. const { data } = res.data;
  203. this.$router.push({name:'AddConceptRelation',params:Object.assign(pam, {isEdit: true, data: data})});
  204. } else {
  205. this.warning(res.data.msg);
  206. }
  207. }).catch((error)=>{
  208. this.warning(error)
  209. })
  210. },
  211. currentChange(next) {
  212. this.currentPage = next;
  213. this.getDataList(true);
  214. },
  215. getFilterItems(isTurnPage) {
  216. //翻页时筛选条件没点确定则清空
  217. if(isTurnPage&&!this.searched){
  218. this.filter.conceptName='';
  219. };
  220. const param = {
  221. current: this.inCurrentPage||this.currentPage,
  222. size: this.pageSize,
  223. name:this.filter.conceptName.trim(),
  224. relationId:17,
  225. relationModelTypeCode:this.filter.type
  226. };
  227. return param;
  228. },
  229. indexMethod(index) {
  230. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  231. },
  232. getTagType(val) {
  233. return val
  234. },
  235. warning(msg,type){
  236. this.$message({
  237. showClose: true,
  238. message:msg,
  239. type:type||'warning'
  240. })
  241. },
  242. showConfirmDialog(msg,resolve){
  243. this.$alert(msg, '提示', {
  244. confirmButtonText: '确定',
  245. type: 'warning'
  246. }).then(() => {
  247. resolve();
  248. }).catch(() => {});
  249. },
  250. showDelDialog(row){
  251. this.showConfirmDialog('是否删除该关联?',()=>{
  252. const typeL = this.filter.type.toString().split('101');
  253. const typeId = [];
  254. typeId[0] = +typeL[1];
  255. const param = {
  256. "conceptId": row.conceptId,
  257. // "isDeleted": row.isDeleted=== 'N'?'Y':'N',
  258. "relationIds":[17],//9-20新增
  259. "typeIds":typeId
  260. }
  261. api.delConceptRelation(param).then((res)=>{
  262. if(res.data.code=='0'){
  263. if(!this.searched){
  264. //未点确认时清空搜索条件
  265. this.filter.conceptName='';
  266. }
  267. if(this.list.length==1){
  268. //当前在最后一页且只有一条数据时,删除后跳到前一页
  269. this.currentPage = this.currentPage===1?1:this.currentPage-1;
  270. }
  271. this.getDataList();
  272. this.warning(res.data.msg || '操作成功','success');
  273. }else{
  274. this.warning(res.data.msg);
  275. }
  276. }).catch((error)=>{
  277. this.warning(error);
  278. })
  279. });
  280. }
  281. }
  282. }
  283. </script>
  284. <style lang="less">
  285. @import "../../less/admin.less";
  286. .tab{
  287. background:#fff;
  288. padding: 5px 0;
  289. position: relative;
  290. top:40px;
  291. span{
  292. display: inline-block;
  293. // width:145px;
  294. padding: 0 20px;
  295. height: 45px;
  296. line-height: 45px;
  297. text-align: center;
  298. // border: 1px solid #ccc;
  299. margin-right: 5px;
  300. cursor: pointer;
  301. }
  302. .curr{
  303. color: #48C5D7;
  304. &:after{
  305. content: '';
  306. width:50px;
  307. height: 2px;
  308. background:#48C5D7;
  309. display: block;
  310. margin: 0 auto;
  311. }
  312. }
  313. }
  314. .delete{
  315. color: red;
  316. }
  317. .delete:hover {
  318. color: red;
  319. }
  320. .pagination {
  321. min-width: 1010px;
  322. }
  323. </style>