AssistCheckMultRelation.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <div>
  3. <crumbs title="辅检层级关联维护" minWidth="995px">
  4. <el-form :inline="true" class="demo-form-inline">
  5. <el-form-item label="医学标准术语:">
  6. <el-input size="mini" v-model="filter.term" placeholder="输入术语"></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" style="margin:0 10px" @click="addMedicalMultR">添加</el-button>
  11. </el-form-item>
  12. </el-form>
  13. </crumbs>
  14. <div class="contents">
  15. <el-table :data="list"
  16. border
  17. style="width: 100%">
  18. <el-table-column
  19. type="index"
  20. :index="indexMethod"
  21. label="编号"
  22. width="60">
  23. </el-table-column>
  24. <el-table-column
  25. prop="operTime"
  26. label="操作时间"
  27. :show-overflow-tooltip="true">
  28. </el-table-column>
  29. <el-table-column
  30. prop="libNameType"
  31. label="医学标准术语"
  32. show-overflow-tooltip>
  33. </el-table-column>
  34. <el-table-column
  35. prop="otherNames"
  36. label="一级关联标准术语"
  37. show-overflow-tooltip>
  38. </el-table-column>
  39. <!-- <el-table-column
  40. label="状态">
  41. <template slot-scope="scope">
  42. <span :class="scope.row.isDeleted == 'N'?'':'delete'">
  43. {{scope.row.isDeleted == 'N'?'启用中':'已删除'}}
  44. </span>
  45. </template>
  46. </el-table-column> -->
  47. <el-table-column
  48. prop="operName"
  49. label="操作人">
  50. </el-table-column>
  51. <el-table-column
  52. label="操作" width="160">
  53. <template slot-scope="scope">
  54. <el-button type="text" size="small" @click="toEditProduct(scope.row)">修改</el-button>
  55. <span style="margin:0 3px;">|</span>
  56. <el-button type="text" size="small" :class="scope.row.isDeleted == 'N'?'delete':'review'" @click="showDelDialog(scope.row)">{{scope.row.isDeleted == 'N'?'删除':'恢复'}}</el-button>
  57. </template>
  58. </el-table-column>
  59. </el-table>
  60. <el-pagination v-if="total>pageSize"
  61. :current-page.sync="currentPage"
  62. @current-change="currentChange"
  63. background
  64. :page-size="pageSize"
  65. layout="total,prev, pager, next, jumper"
  66. :total="total">
  67. </el-pagination>
  68. </div>
  69. </div>
  70. </template>
  71. <script>
  72. import api from '@api/medicalTerm.js';
  73. export default {
  74. name: 'AssistCheckMultRelation',
  75. data: function () {
  76. return {
  77. list: [],
  78. stateSelect:[
  79. {id:'N',name:'启用中'},
  80. {id:'Y',name:'已删除'},
  81. ],
  82. isState:'',
  83. cacheData: {},
  84. currentPage: 1,
  85. pageSize: 10,
  86. total: 0,
  87. searched: false,
  88. filter: {
  89. term:'',
  90. },
  91. }
  92. },
  93. created() {
  94. const that = this;
  95. //返回时避免参数未赋值就获取列表
  96. setTimeout(function(){
  97. that.getDataList();
  98. });
  99. },
  100. watch: {
  101. 'filter': {
  102. handler: function () {
  103. this.searched = false;
  104. },
  105. deep: true
  106. }
  107. },
  108. beforeRouteEnter(to, from, next){
  109. next(vm => {
  110. //const pm = to.param;
  111. Object.assign(vm,to.params);
  112. })
  113. },
  114. methods: {
  115. addMedicalMultR(){
  116. const pam = this.searched ? {
  117. currentPage: this.currentPage,
  118. filter: this.filter
  119. } : {currentPage: this.currentPage};
  120. this.$router.push({name:'AddAssistCheckMultRelation',
  121. params:pam});
  122. },
  123. toEditProduct(row){
  124. const param = {
  125. conceptId: row.conceptId,
  126. relationIds: [17,17,17],
  127. typeIds: [16,16,16]
  128. };
  129. const pam = this.searched ? {
  130. currentPage: this.currentPage,
  131. filter: this.filter
  132. } : {currentPage: this.currentPage};
  133. api.assistCheckMultRelationDetail(param).then((res) => {
  134. const {code,data,msg} = res.data;
  135. if(code=='0'){
  136. const item = Object.assign({},row,data);
  137. this.$router.push({name:'AddAssistCheckMultRelation',params:Object.assign(pam, {isEdit: true, data: item})});
  138. }else{
  139. this.$message({
  140. message: msg,
  141. type: 'warning'
  142. });
  143. }
  144. })
  145. },
  146. filterDatas(){
  147. this.currentPage = 1;
  148. this.getDataList();
  149. },
  150. getDataList(isTurnPage) {
  151. const param = this.getFilterItems(isTurnPage);
  152. this.searched = true;
  153. api.assistCheckMultContactList(param).then((res) => {
  154. if (res.data.code == '0') {
  155. const data = res.data.data;
  156. this.list = data.records;
  157. this.cacheData[param.current] = data.records;
  158. this.total = data.total;
  159. }
  160. }).catch((error) => {
  161. console.log(error);
  162. });
  163. },
  164. getFilterItems(isTurnPage) {
  165. //翻页时筛选条件没点确定则清空
  166. if(isTurnPage&&!this.searched){
  167. this.clearFilter();
  168. };
  169. const param = {
  170. name: this.filter.term,
  171. current: this.currentPage,
  172. size: this.pageSize,
  173. relationId: 17,
  174. startTypeIds: [71],
  175. isOnlyHasRoot: 0
  176. };
  177. return param;
  178. },
  179. indexMethod(index) {
  180. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  181. },
  182. currentChange(next) {
  183. this.currentPage = next;
  184. if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  185. this.list = this.cacheData[next];
  186. } else {
  187. this.getDataList(true);
  188. }
  189. },
  190. warning(msg,type){
  191. this.$message({
  192. showClose: true,
  193. message:msg,
  194. type:type||'warning'
  195. })
  196. },
  197. showConfirmDialog(msg,resolve){
  198. this.$alert(msg, '提示', {
  199. confirmButtonText: '确定',
  200. type: 'warning'
  201. }).then(() => {
  202. resolve();
  203. }).catch(() => {});
  204. },
  205. showDelDialog(item){
  206. /*const param = {
  207. term:item.term,
  208. type:item.type,
  209. id:item.id
  210. }*/
  211. const param = {
  212. conceptId:item.conceptId,
  213. // isDeleted:item.isDeleted === 'N'?'Y':'N',
  214. relationIds: [17,17],
  215. typeIds: [3,1]
  216. }
  217. let waringTxt = '是否删除该关系,可能对现有系统造成影响'
  218. this.showConfirmDialog(waringTxt,()=>{
  219. api.removeRelationContact(param).then((res)=>{
  220. if(res.data.code=='0'){
  221. if(!this.searched){
  222. //未点确认时清空搜索条件
  223. this.clearFilter();
  224. }
  225. if(this.list.length==1){
  226. //当前在最后一页且只有一条数据时,删除后跳到前一页
  227. this.currentPage = this.currentPage===1?1:this.currentPage-1;
  228. }
  229. this.warning(res.data.msg||'操作成功','success');
  230. this.getDataList();
  231. }else{
  232. this.warning(res.data.msg);
  233. }
  234. }).catch((error)=>{
  235. this.warning(error);
  236. })
  237. });
  238. },
  239. clearFilter(){
  240. this.filter={
  241. term:'',
  242. };
  243. },
  244. }
  245. }
  246. </script>
  247. <style lang="less" scoped>
  248. @import "../../less/admin.less";
  249. .delete{
  250. color: red;
  251. }
  252. .review{
  253. color: #22ccc8;
  254. }
  255. .el-table .cell{
  256. overflow: hidden;
  257. white-space: nowrap;
  258. }
  259. </style>