ConceptRelation.vue 9.7 KB

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