ConceptRelation.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  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. this.filter.type = item.key;
  134. this.getDataList();
  135. },
  136. getDataList(isTurnPage) {
  137. const param = this.getFilterItems(isTurnPage);
  138. this.searched = true;
  139. api.getConceptRelation(param).then((res) => {
  140. if(res.data.code == '0') {
  141. this.list = res.data.data.records
  142. this.total = res.data.data.total;
  143. }
  144. })
  145. },
  146. filterDatas() {
  147. this.currentPage = 1;
  148. this.getDataList();
  149. },
  150. addRelation() {
  151. const pam = this.searched ? {
  152. currentPage: this.currentPage,
  153. filter: this.filter
  154. } : {currentPage: this.currentPage,filter:Object.assign(this.filter,{conceptName:''})};
  155. this.$router.push({name:'AddConceptRelation',params:pam})
  156. },
  157. modifyRelation(row) {
  158. const param = {
  159. "conceptId": row.conceptId,
  160. "relationId":17
  161. }
  162. const pam = this.searched ? {
  163. currentPage: this.currentPage,
  164. filter: this.filter
  165. } : {currentPage: this.currentPage,filter:Object.assign(this.filter,{conceptName:''})};
  166. api.getConceptRelationDet(param).then((res) => {
  167. if(res.data.code=='0'){
  168. const { data } = res.data;
  169. this.$router.push({name:'AddConceptRelation',params:Object.assign(pam, {isEdit: true, data: data})});
  170. } else {
  171. this.warning(res.data.msg);
  172. }
  173. }).catch((error)=>{
  174. this.warning(error)
  175. })
  176. },
  177. currentChange(next) {
  178. this.currentPage = next;
  179. this.getDataList(true);
  180. },
  181. getFilterItems(isTurnPage) {
  182. //翻页时筛选条件没点确定则清空
  183. if(isTurnPage&&!this.searched){
  184. this.filter={
  185. conceptName:''
  186. };
  187. };
  188. const param = {
  189. current: this.currentPage,
  190. size: this.pageSize,
  191. name:this.filter.conceptName,
  192. relationId:17,
  193. relationModelTypeCode:this.filter.type
  194. };
  195. return param;
  196. },
  197. indexMethod(index) {
  198. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  199. },
  200. getTagType(val) {
  201. return val
  202. },
  203. warning(msg,type){
  204. this.$message({
  205. showClose: true,
  206. message:msg,
  207. type:type||'warning'
  208. })
  209. },
  210. showConfirmDialog(msg,resolve){
  211. this.$alert(msg, '提示', {
  212. confirmButtonText: '确定',
  213. type: 'warning'
  214. }).then(() => {
  215. resolve();
  216. }).catch(() => {});
  217. },
  218. showDelDialog(row){
  219. this.showConfirmDialog('是否删除该关联?',()=>{
  220. const param = {
  221. "conceptId": row.conceptId,
  222. "isDeleted": row.isDeleted=== 'N'?'Y':'N',
  223. "relationId": 17
  224. }
  225. api.delConceptRelation(param).then((res)=>{
  226. if(res.data.code=='0'){
  227. if(!this.searched){
  228. //未点确认时清空搜索条件
  229. this.filter={
  230. conceptName:''
  231. };
  232. }
  233. if(this.list.length==1){
  234. //当前在最后一页且只有一条数据时,删除后跳到前一页
  235. this.currentPage = this.currentPage===1?1:this.currentPage-1;
  236. }
  237. this.getDataList();
  238. this.warning(res.data.msg || '操作成功','success');
  239. }else{
  240. this.warning(res.data.msg);
  241. }
  242. }).catch((error)=>{
  243. this.warning(error);
  244. })
  245. });
  246. }
  247. }
  248. }
  249. </script>
  250. <style lang="less">
  251. @import "../../less/admin.less";
  252. .tab{
  253. background:#fff;
  254. padding: 5px 0;
  255. position: relative;
  256. top:40px;
  257. span{
  258. display: inline-block;
  259. // width:145px;
  260. padding: 0 20px;
  261. height: 45px;
  262. line-height: 45px;
  263. text-align: center;
  264. // border: 1px solid #ccc;
  265. margin-right: 5px;
  266. cursor: pointer;
  267. }
  268. .curr{
  269. color: #48C5D7;
  270. &:after{
  271. content: '';
  272. width:50px;
  273. height: 2px;
  274. background:#48C5D7;
  275. display: block;
  276. margin: 0 auto;
  277. }
  278. }
  279. }
  280. .delete{
  281. color: red;
  282. }
  283. .delete:hover {
  284. color: red;
  285. }
  286. .pagination {
  287. min-width: 1010px;
  288. }
  289. </style>