ConceptRelation.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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="contents">
  15. <el-table
  16. :data="list"
  17. border
  18. style="width: 100%">
  19. <el-table-column
  20. :resizable = "false"
  21. type="index"
  22. :index = 'indexMethod'
  23. label="编号"
  24. width="60">
  25. </el-table-column>
  26. <el-table-column
  27. :resizable = "false"
  28. prop="operTime"
  29. label="操作时间"
  30. width="180">
  31. </el-table-column>
  32. <el-table-column
  33. :resizable = "false"
  34. prop="libNameType"
  35. label="医学标准术语"
  36. show-overflow-tooltip>
  37. </el-table-column>
  38. <el-table-column
  39. :resizable = "false"
  40. prop="otherNames"
  41. label="关联术语"
  42. show-overflow-tooltip>
  43. </el-table-column>
  44. <!-- <el-table-column
  45. label="状态">
  46. <template slot-scope="scope">
  47. <span :class="scope.row.isDeleted == 'N'?'':'delete'">
  48. {{scope.row.isDeleted == 'N'?'启用中':'已删除'}}
  49. </span>
  50. </template>
  51. </el-table-column> -->
  52. <el-table-column
  53. :resizable = "false"
  54. prop="operName"
  55. label="操作人">
  56. </el-table-column>
  57. <el-table-column
  58. label="操作"
  59. width="160"
  60. :resizable = "false">
  61. <template slot-scope="scope">
  62. <el-button type="text" size="small" :disabled="scope.row.isDeleted != 'N'" @click="modifyRelation(scope.row)">修改</el-button>
  63. <span style="margin:0 3px;">|</span>
  64. <el-button type="text" size="small" :class="scope.row.isDeleted == 'N'?'delete':'review'" @click="showDelDialog(scope.row)">{{scope.row.isDeleted == 'N'?'删除':'恢复'}}</el-button>
  65. </template>
  66. </el-table-column>
  67. </el-table>
  68. <div class="pagination">
  69. <el-pagination v-if="total>pageSize"
  70. :current-page.sync="currentPage"
  71. @current-change="currentChange"
  72. background
  73. :page-size="pageSize"
  74. layout="total,prev, pager, next, jumper"
  75. :total="total">
  76. </el-pagination>
  77. </div>
  78. </div>
  79. </div>
  80. </template>
  81. <script>
  82. import api from '@api/icss.js';
  83. export default {
  84. name: 'ConceptRelation', //诊断量表关联维护
  85. data: function() {
  86. return {
  87. list: [],
  88. searched: false,
  89. filter:{
  90. conceptName:''
  91. },
  92. currentPage: 1,
  93. pageSize: 10,
  94. total: 0,
  95. }
  96. },
  97. created() {
  98. const that = this;
  99. //返回时避免参数未赋值就获取列表
  100. setTimeout(function(){
  101. that.getDataList();
  102. });
  103. },
  104. watch: {
  105. 'filter': {
  106. handler: function () {
  107. this.searched = false;
  108. },
  109. deep: true
  110. }
  111. },
  112. beforeRouteEnter(to, from, next) {
  113. next(vm => {
  114. //const pm = to.param;
  115. Object.assign(vm, to.params);
  116. })
  117. },
  118. methods: {
  119. getDataList() {
  120. const param = this.getFilterItems();
  121. this.searched = true;
  122. api.getConceptRelation(param).then((res) => {
  123. if(res.data.code == '0') {
  124. this.list = res.data.data.records
  125. this.total = res.data.data.total;
  126. }
  127. })
  128. },
  129. filterDatas() {
  130. this.currentPage = 1;
  131. this.getDataList();
  132. },
  133. addRelation() {
  134. const pam = this.searched ? {
  135. currentPage: this.currentPage,
  136. filter: this.filter
  137. } : {currentPage: this.currentPage};
  138. this.$router.push({name:'AddConceptRelation',params:pam})
  139. },
  140. modifyRelation(row) {
  141. const param = {
  142. "conceptId": row.conceptId,
  143. "relationId":17
  144. }
  145. const pam = this.searched ? {
  146. currentPage: this.currentPage,
  147. filter: this.filter
  148. } : {currentPage: this.currentPage};
  149. api.getConceptRelationDet(param).then((res) => {
  150. if(res.data.code=='0'){
  151. const { data } = res.data;
  152. this.$router.push({name:'AddConceptRelation',params:Object.assign(pam, {isEdit: true, data: data})});
  153. } else {
  154. this.warning(res.data.msg);
  155. }
  156. }).catch((error)=>{
  157. this.warning(error)
  158. })
  159. },
  160. currentChange(next) {
  161. this.currentPage = next;
  162. this.getDataList();
  163. },
  164. getFilterItems() {
  165. const param = {
  166. current: this.currentPage,
  167. size: this.pageSize,
  168. name:this.filter.conceptName
  169. };
  170. return param;
  171. },
  172. indexMethod(index) {
  173. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  174. },
  175. getTagType(val) {
  176. return val
  177. },
  178. warning(msg,type){
  179. this.$message({
  180. showClose: true,
  181. message:msg,
  182. type:type||'warning'
  183. })
  184. },
  185. showConfirmDialog(msg,resolve){
  186. this.$alert(msg, '提示', {
  187. confirmButtonText: '确定',
  188. type: 'warning'
  189. }).then(() => {
  190. resolve();
  191. }).catch(() => {});
  192. },
  193. showDelDialog(row){
  194. this.showConfirmDialog('是否删除该关联?',()=>{
  195. const param = {
  196. "conceptId": row.conceptId,
  197. "isDeleted": row.isDeleted=== 'N'?'Y':'N',
  198. "relationId": 17
  199. }
  200. api.delConceptRelation(param).then((res)=>{
  201. if(res.data.code=='0'){
  202. this.getDataList();
  203. this.warning(res.data.msg || '操作成功','success');
  204. }else{
  205. this.warning(res.data.msg);
  206. }
  207. }).catch((error)=>{
  208. this.warning(error);
  209. })
  210. });
  211. }
  212. }
  213. }
  214. </script>
  215. <style lang="less">
  216. @import "../../less/admin.less";
  217. .delete{
  218. color: red;
  219. }
  220. .delete:hover {
  221. color: red;
  222. }
  223. .pagination {
  224. min-width: 1010px;
  225. }
  226. </style>