BasicRelationship.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. <template>
  2. <div>
  3. <crumbs title="基础关系类型维护" minWidth="995px" class="knowledgeTitle">
  4. <el-form :inline="true" class="demo-form-inline">
  5. <el-form-item label="关系类型名称:">
  6. <el-select v-model="filter.type" clearable filterable placeholder="请选择" size="mini">
  7. <el-option
  8. v-for="item in typeList"
  9. :key="item.id"
  10. :label="item.name"
  11. :value="item.name"
  12. ></el-option>
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item label="数字编码:">
  16. <el-input size="mini" type="number" v-model="filter.term" placeholder="请输入编码"></el-input>
  17. </el-form-item>
  18. <el-form-item>
  19. <el-button size="mini" @click="filterDatas">搜索</el-button>
  20. </el-form-item>
  21. </el-form>
  22. </crumbs>
  23. <div class="contents knowledgeContents">
  24. <el-table :data="list" border style="width: 100%">
  25. <el-table-column type="index" :index="indexMethod" label="编号" width="60"></el-table-column>
  26. <el-table-column prop="name" label="关系类型名称" show-overflow-tooltip></el-table-column>
  27. <el-table-column prop="code" label="数字编码" show-overflow-tooltip></el-table-column>
  28. <el-table-column prop="modifier" label="操作人" show-overflow-tooltip></el-table-column>
  29. <el-table-column prop="gmtModified" label="操作时间" show-overflow-tooltip></el-table-column>
  30. <el-table-column label="操作" width="160">
  31. <template slot-scope="scope">
  32. <el-button
  33. type="text"
  34. size="small"
  35. :disabled="true"
  36. >修改</el-button>
  37. </template>
  38. </el-table-column>
  39. </el-table>
  40. <el-pagination
  41. :current-page.sync="currentPage"
  42. @current-change="currentChange"
  43. background
  44. :page-size="pageSize"
  45. :page-sizes="pageSizeArr"
  46. @size-change="handleSizeChange"
  47. :layout="pageLayout"
  48. :total="total"
  49. ></el-pagination>
  50. </div>
  51. </div>
  52. </template>
  53. <script>
  54. import api from '@api/knowledgeTree.js';
  55. import config from '@api/config.js';
  56. import utils from '@api/utils.js';
  57. export default {
  58. name: 'BasicTermsMaintenance',
  59. data: function() {
  60. return {
  61. list: [],
  62. stateSelect:[
  63. {id:'N',name:'启用'},
  64. {id:'Y',name:'禁用'},
  65. ],
  66. // isState:'',
  67. cacheData: {}, //因为删除和恢复要及时更新,所以不做缓存
  68. currentPage: 1,
  69. pageSize: config.pageSize,
  70. pageSizeArr: config.pageSizeArr,
  71. pageLayout: config.pageLayout,
  72. total: 0,
  73. searched: false,
  74. filter: {
  75. term: '',
  76. type: '',
  77. libName: '',
  78. },
  79. typeList: [],
  80. reloadFlag: true
  81. };
  82. },
  83. created() {
  84. // this.getDataList();
  85. this.getTypeList();
  86. const that = this;
  87. //返回时避免参数未赋值就获取列表
  88. setTimeout(function() {
  89. });
  90. this.$nextTick(()=>{
  91. that.getDataList();
  92. })
  93. },
  94. watch: {
  95. filter: {
  96. handler: function() {
  97. this.searched = false;
  98. },
  99. deep: true
  100. }
  101. },
  102. beforeRouteEnter(to, from, next) {
  103. next(vm => {
  104. //const pm = to.param;
  105. Object.assign(vm, to.params);
  106. vm.inCurrentPage = to.params.currentPage;
  107. });
  108. },
  109. methods: {
  110. handleSizeChange(val) {
  111. this.pageSize = val;
  112. this.currentPage = utils.getCurrentPage(
  113. this.currentPage,
  114. this.total,
  115. this.pageSize
  116. );
  117. this.getDataList();
  118. },
  119. reloadLib() {
  120. if (this.reloadFlag) {
  121. this.reloadFlag = false;
  122. api.clearStandRuleDrug().then(res => {
  123. if (res.data.code == 0) {
  124. this.reloadFlag = true;
  125. }
  126. });
  127. }
  128. },
  129. addMedicalName() {
  130. const pam = this.searched
  131. ? {
  132. currentPage: this.currentPage,
  133. pageSize: this.pageSize,
  134. filter: this.filter
  135. }
  136. : { currentPage: this.currentPage, pageSize: this.pageSize };
  137. this.$router.push({ name: 'AddTerm', params: pam });
  138. },
  139. filterDatas() {
  140. this.currentPage = 1;
  141. this.getDataList();
  142. },
  143. getDataList(isTurnPage) {
  144. const param = this.getFilterItems(isTurnPage);
  145. this.searched = true;
  146. // const loading = this.$loading({
  147. // lock: true,
  148. // text: 'Loading',
  149. // spinner: 'el-icon-loading',
  150. // background: 'rgba(0, 0, 0, 0.7)'
  151. // });
  152. api.baseRelationTypeGetPage(param)
  153. .then(res => {
  154. // loading.close();
  155. if (res.data.code == '0') {
  156. const data = res.data.data;
  157. const templis = data.records;
  158. for(let i = 0;i < templis.length;i++){
  159. templis[i].isDeleted = templis[i].status=='1'?'N':'Y'
  160. }
  161. this.list = templis;
  162. // this.cacheData[param.current] = data.records;
  163. this.total = data.total;
  164. if (this.inCurrentPage !== undefined) {
  165. this.currentPage = this.inCurrentPage;
  166. this.inCurrentPage = undefined;
  167. }
  168. }
  169. })
  170. .catch(error => {
  171. console.log(error);
  172. });
  173. },
  174. getTypeList() {
  175. api
  176. .baseRelationTypeGetPage({ name: '',size: 1000 })
  177. .then(res => {
  178. const data = res.data;
  179. if (data.code == 0) {
  180. this.typeList = data.data.records||[];
  181. } else {
  182. console.log(res.msg);
  183. }
  184. })
  185. .catch(error => {
  186. console.log(error);
  187. });
  188. },
  189. /*getDetailList(id) {
  190. this.$router.push({name:'DeptInfoDetail', params:{id: id}})
  191. },*/
  192. getFilterItems(isTurnPage) {
  193. //翻页时筛选条件没点确定则清空
  194. if (isTurnPage && !this.searched) {
  195. this.clearFilter();
  196. }
  197. const param = {
  198. "code": this.filter.term.trim(),
  199. "name": this.filter.type,
  200. current: this.inCurrentPage || this.currentPage,
  201. size: this.pageSize,
  202. };
  203. return param;
  204. },
  205. indexMethod(index) {
  206. return (this.currentPage - 1) * this.pageSize + index + 1;
  207. },
  208. currentChange(next) {
  209. this.currentPage = next;
  210. // if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  211. // this.list = this.cacheData[next];
  212. // } else {
  213. this.getDataList(true);
  214. // }
  215. },
  216. warning(msg, type) {
  217. this.$message({
  218. showClose: true,
  219. message: msg,
  220. type: type || 'warning'
  221. });
  222. },
  223. showConfirmDialog(msg, resolve) {
  224. this.$alert(msg, '提示', {
  225. confirmButtonText: '确定',
  226. type: 'warning'
  227. })
  228. .then(() => {
  229. resolve();
  230. })
  231. .catch(() => {});
  232. },
  233. showDelDialog(item) {
  234. /*const param = {
  235. term:item.term,
  236. type:item.type,
  237. id:item.id
  238. }*/
  239. const param = {
  240. conceptId: item.conceptId
  241. };
  242. let url = item.isDeleted === 'N'?'disableConcept':'startConcept'
  243. let waringTxt =
  244. item.isDeleted === 'N'
  245. ? '是否禁用该标准术语?'
  246. : '是否重新启用该条数据?';
  247. this.showConfirmDialog(waringTxt, () => {
  248. api[url](param)
  249. .then(res => {
  250. if (res.data.code == '0') {
  251. if (!this.searched) {
  252. //未点确认时清空搜索条件
  253. this.clearFilter();
  254. }
  255. if (item.isDeleted !== 'N') {
  256. //恢复成功后跳转到筛选条件的首页
  257. this.currentPage = 1;
  258. } else {
  259. if (this.filter.isState !== '' && this.list.length === 1) {
  260. //有启用状态筛选条件且当前页只有最后一条数据删除时,删除成功后跳转到前一页
  261. this.currentPage =
  262. this.currentPage === 1 ? 1 : this.currentPage - 1;
  263. }
  264. }
  265. this.warning(res.data.msg || '操作成功', 'success');
  266. this.getDataList();
  267. } else {
  268. this.warning(res.data.msg);
  269. }
  270. })
  271. .catch(error => {
  272. this.warning(error);
  273. });
  274. });
  275. },
  276. clearFilter() {
  277. this.filter = {
  278. term: '',
  279. type: '',
  280. libName: '',
  281. isState: ''
  282. };
  283. }
  284. }
  285. };
  286. </script>
  287. <style lang="less" scoped>
  288. @import '../../less/admin.less';
  289. /deep/ .container.knowledgeTitle {
  290. height: 40px;
  291. }
  292. /deep/ .contents.knowledgeContents {
  293. padding: 64px 20px 0;
  294. }
  295. /deep/ .secLine.el-form {
  296. float: right;
  297. display: block;
  298. position: relative;
  299. top: -5px;
  300. }
  301. .delete {
  302. color: red;
  303. }
  304. .review {
  305. color: #22ccc8;
  306. }
  307. .deletes {
  308. cursor: default;
  309. color: red;
  310. }
  311. .reviews {
  312. color: #606266;
  313. cursor: default;
  314. }
  315. .el-table .cell {
  316. overflow: hidden;
  317. white-space: nowrap;
  318. }
  319. #upFile {
  320. display: none !important;
  321. }
  322. </style>