ConceptRelation.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  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. relationId: 17
  111. }
  112. },
  113. created() {
  114. let typeList = JSON.parse(localStorage.getItem("knowledgeEnumsData"));
  115. this.typeList = typeList.relationModelTypeEnum;
  116. this.filter.type = this.typeList[0].key;//默认展示科室,请置于第一位
  117. const that = this;
  118. //返回时避免参数未赋值就获取列表
  119. setTimeout(function(){
  120. that.getDataList();
  121. });
  122. },
  123. watch: {
  124. 'filter': {
  125. handler: function () {
  126. this.searched = false;
  127. },
  128. deep: true
  129. }
  130. },
  131. beforeRouteEnter(to, from, next) {
  132. next(vm => {
  133. //const pm = to.param;
  134. Object.assign(vm, to.params);
  135. vm.inCurrentPage=to.params.currentPage;
  136. vm.relationId=to.params.relationId || 17;
  137. })
  138. },
  139. methods: {
  140. handleSizeChange(val){
  141. this.pageSize = val;
  142. this.currentPage = utils.getCurrentPage(this.currentPage, this.total, this.pageSize);
  143. this.getDataList();
  144. },
  145. toggTab(item){
  146. // bug2348 搜索后切换tab时清空搜索条件
  147. this.filter.conceptName = '';
  148. this.filter.type = item.key;
  149. this.currentPage = 1;
  150. if(item.key === 181011) {
  151. this.relationId = 4
  152. } else {
  153. this.relationId = 17
  154. }
  155. this.getDataList();
  156. },
  157. getDataList(isTurnPage) {
  158. const param = this.getFilterItems(isTurnPage);
  159. this.searched = true;
  160. const loading = this.$loading({
  161. lock: true,
  162. text: 'Loading',
  163. spinner: 'el-icon-loading',
  164. background: 'rgba(0, 0, 0, 0.7)'
  165. });
  166. api.getConceptRelation(param).then((res) => {
  167. loading.close()
  168. if(res.data.code == '0') {
  169. this.list = res.data.data.records
  170. this.total = res.data.data.total;
  171. if(this.inCurrentPage!==undefined){
  172. this.currentPage=this.inCurrentPage;
  173. this.inCurrentPage = undefined;
  174. }
  175. }
  176. })
  177. },
  178. filterDatas() {
  179. this.currentPage = 1;
  180. this.getDataList();
  181. },
  182. addRelation() {
  183. const pam = this.searched ? {
  184. currentPage: this.currentPage,
  185. pageSize:this.pageSize,
  186. filter: this.filter,
  187. relationId: this.relationId
  188. } : {currentPage: this.currentPage,
  189. pageSize:this.pageSize,relationId: this.relationId,filter:Object.assign(this.filter,{conceptName:''})};
  190. this.$router.push({name:'AddConceptRelation',params:pam})
  191. },
  192. modifyRelation(row) {
  193. const typeL = this.filter.type.toString().split('101');
  194. const typeId = [];
  195. const relationIds = []
  196. relationIds.push(this.relationId)
  197. typeId[0] = +typeL[1];
  198. const param = {
  199. "conceptId": row.conceptId,
  200. // "relationId":17
  201. "relationIds":relationIds,//9-20新增
  202. "typeIds":typeId
  203. }
  204. const pam = this.searched ? {
  205. currentPage: this.currentPage,
  206. pageSize:this.pageSize,
  207. filter: this.filter
  208. } : {currentPage: this.currentPage,
  209. pageSize:this.pageSize,filter:Object.assign(this.filter,{conceptName:''})};
  210. api.getConceptRelationDet(param).then((res) => {
  211. if(res.data.code=='0'){
  212. const { data } = res.data;
  213. this.$router.push({name:'AddConceptRelation',params:Object.assign(pam, {isEdit: true, relationId: this.relationId,data: data})});
  214. } else {
  215. this.warning(res.data.msg);
  216. }
  217. }).catch((error)=>{
  218. this.warning(error)
  219. })
  220. },
  221. currentChange(next) {
  222. this.currentPage = next;
  223. this.getDataList(true);
  224. },
  225. getFilterItems(isTurnPage) {
  226. //翻页时筛选条件没点确定则清空
  227. if(isTurnPage&&!this.searched){
  228. this.filter.conceptName='';
  229. };
  230. const param = {
  231. current: this.inCurrentPage||this.currentPage,
  232. size: this.pageSize,
  233. name:this.filter.conceptName.trim(),
  234. relationId:this.relationId,
  235. relationModelTypeCode:this.filter.type
  236. };
  237. return param;
  238. },
  239. indexMethod(index) {
  240. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  241. },
  242. getTagType(val) {
  243. return val
  244. },
  245. warning(msg,type){
  246. this.$message({
  247. showClose: true,
  248. message:msg,
  249. type:type||'warning'
  250. })
  251. },
  252. showConfirmDialog(msg,resolve){
  253. this.$alert(msg, '提示', {
  254. confirmButtonText: '确定',
  255. type: 'warning'
  256. }).then(() => {
  257. resolve();
  258. }).catch(() => {});
  259. },
  260. showDelDialog(row){
  261. this.showConfirmDialog('是否删除该关联?',()=>{
  262. const typeL = this.filter.type.toString().split('101');
  263. const typeId = [];
  264. typeId[0] = +typeL[1];
  265. const relationIds = []
  266. relationIds.push(this.relationId)
  267. const param = {
  268. "conceptId": row.conceptId,
  269. // "isDeleted": row.isDeleted=== 'N'?'Y':'N',
  270. "relationIds":relationIds,//9-20新增
  271. "typeIds":typeId
  272. }
  273. api.delConceptRelation(param).then((res)=>{
  274. if(res.data.code=='0'){
  275. if(!this.searched){
  276. //未点确认时清空搜索条件
  277. this.filter.conceptName='';
  278. }
  279. if(this.list.length==1){
  280. //当前在最后一页且只有一条数据时,删除后跳到前一页
  281. this.currentPage = this.currentPage===1?1:this.currentPage-1;
  282. }
  283. this.getDataList();
  284. this.warning(res.data.msg || '操作成功','success');
  285. }else{
  286. this.warning(res.data.msg);
  287. }
  288. }).catch((error)=>{
  289. this.warning(error);
  290. })
  291. });
  292. }
  293. }
  294. }
  295. </script>
  296. <style lang="less">
  297. @import "../../less/admin.less";
  298. .tab{
  299. background:#fff;
  300. padding: 5px 0;
  301. position: relative;
  302. top:40px;
  303. span{
  304. display: inline-block;
  305. // width:145px;
  306. padding: 0 20px;
  307. height: 45px;
  308. line-height: 45px;
  309. text-align: center;
  310. // border: 1px solid #ccc;
  311. margin-right: 5px;
  312. cursor: pointer;
  313. }
  314. .curr{
  315. color: #48C5D7;
  316. &:after{
  317. content: '';
  318. width:50px;
  319. height: 2px;
  320. background:#48C5D7;
  321. display: block;
  322. margin: 0 auto;
  323. }
  324. }
  325. }
  326. .delete{
  327. color: red;
  328. }
  329. .delete:hover {
  330. color: red;
  331. }
  332. .pagination {
  333. min-width: 1010px;
  334. }
  335. </style>