Plan.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  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.planName" 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 :data="list" border style="width: 100%">
  16. <el-table-column :resizable="false" type="index" :index="indexMethod" label="编号" width="60"></el-table-column>
  17. <el-table-column :resizable="false" prop="hospitalName" label="医院名称" show-overflow-tooltip></el-table-column>
  18. <el-table-column :resizable="false" prop="hospitalId" label="医院编码"></el-table-column>
  19. <el-table-column :resizable="false" prop="planName" label="方案名称" show-overflow-tooltip></el-table-column>
  20. <el-table-column :resizable="false" prop="planCode" label="方案编码" width="180"></el-table-column>
  21. <el-table-column :resizable="false" prop="planDetail" label="模块配置" show-overflow-tooltip></el-table-column>
  22. <el-table-column
  23. :resizable="false"
  24. prop="gmtCreate"
  25. label="创建时间"
  26. show-overflow-tooltip
  27. width="180"
  28. ></el-table-column>
  29. <el-table-column
  30. :resizable="false"
  31. prop="planStatus"
  32. label="状态"
  33. show-overflow-tooltip
  34. width="180"
  35. >
  36. <template slot-scope="scope">{{scope.row.planStatus == 1 ? '已启用': '已禁用'}}</template>
  37. </el-table-column>
  38. <el-table-column :resizable="false" prop="operate" label="操作">
  39. <template slot-scope="scope">
  40. <el-button
  41. @click="modifyRelation(scope.row)"
  42. type="text"
  43. size="small"
  44. v-if="scope.row.planStatus === 1"
  45. class="disable"
  46. >修改</el-button>
  47. <el-button plain type="text" size="small" v-else disabled>修改</el-button>
  48. <span style="margin:0 3px;">|</span>
  49. <el-button
  50. type="text"
  51. size="small"
  52. class="delete"
  53. @click="enableOrAble(scope.row,0)"
  54. v-if="scope.row.planStatus === 1"
  55. >禁用</el-button>
  56. <el-button type="text" size="small" @click="enableOrAble(scope.row,1)" v-else>启用</el-button>
  57. <span style="margin:0 3px;">|</span>
  58. <el-button
  59. v-if="scope.row.planStatus !== 1"
  60. @click="showDelDialog(scope.row.id,scope.row.planStatus,scope.row.planName)"
  61. class="delete"
  62. type="text"
  63. size="small"
  64. >删除</el-button>
  65. <el-button plain type="text" size="small" v-else disabled>删除</el-button>
  66. </template>
  67. </el-table-column>
  68. </el-table>
  69. <div class="pagination">
  70. <el-pagination
  71. :current-page.sync="currentPage"
  72. @current-change="currentChange"
  73. background
  74. :page-size="pageSize"
  75. :page-sizes="pageSizeArr"
  76. @size-change="handleSizeChange"
  77. :layout="pageLayout"
  78. :total="total"
  79. ></el-pagination>
  80. </div>
  81. </div>
  82. </div>
  83. </template>
  84. <script>
  85. import api from '@api/cdss.js';
  86. import config from '@api/config.js';
  87. import utils from '@api/utils.js';
  88. export default {
  89. name: 'Plan',
  90. data: function() {
  91. return {
  92. list: [],
  93. searched: false,
  94. filter: {
  95. planName: '' //标准诊断名称
  96. },
  97. currentPage: 1,
  98. pageSize: config.pageSize,
  99. pageSizeArr: config.pageSizeArr,
  100. pageLayout: config.pageLayout,
  101. total: 0,
  102. hospitalId: ''
  103. };
  104. },
  105. created() {
  106. const that = this;
  107. //返回时避免参数未赋值就获取列表
  108. setTimeout(function() {
  109. that.getDataList();
  110. });
  111. // 非首页 编辑页返回 设置 this.currentPage
  112. if (Object.keys(this.$route.params).length !== 0) {
  113. this.currentPage = this.$route.params.currentPage;
  114. }
  115. },
  116. watch: {
  117. filter: {
  118. handler: function() {
  119. this.searched = false;
  120. },
  121. deep: true
  122. }
  123. },
  124. beforeRouteEnter(to, from, next) {
  125. next(vm => {
  126. //const pm = to.param;
  127. Object.assign(vm, to.params);
  128. vm.inCurrentPage = to.params.currentPage;
  129. });
  130. },
  131. methods: {
  132. handleSizeChange(val) {
  133. this.pageSize = val;
  134. this.currentPage = utils.getCurrentPage(
  135. this.currentPage,
  136. this.total,
  137. this.pageSize
  138. );
  139. this.getDataList();
  140. },
  141. // 获取列表数据
  142. async getDataList(isTurnPage) {
  143. let params = await this.getFilterItems(isTurnPage);
  144. this.searched = true;
  145. const loading = this.$loading({
  146. lock: true,
  147. text: 'Loading',
  148. spinner: 'el-icon-loading',
  149. background: 'rgba(0, 0, 0, 0.7)'
  150. });
  151. api.getPlanInfoPages(params).then(res => {
  152. loading.close();
  153. if (res.data.code === '0') {
  154. this.list = res.data.data && res.data.data.records;
  155. }
  156. this.total = res.data.data && res.data.data.total;
  157. if (this.inCurrentPage !== undefined) {
  158. this.currentPage = this.inCurrentPage;
  159. this.inCurrentPage = undefined;
  160. }
  161. });
  162. },
  163. // 处理列表请求数据参数
  164. async getFilterItems(isTurnPage) {
  165. //翻页时筛选条件没点确定则清空
  166. if (isTurnPage && !this.searched) {
  167. this.clearFilter();
  168. }
  169. // let res = await api.getHospitalInfo();
  170. // if (res.data.code === '0') {
  171. // this.hospitalId = res.data.data.id;
  172. // }
  173. const param = {
  174. current: this.inCurrentPage || this.currentPage,
  175. size: this.pageSize,
  176. planName: this.filter.planName.trim()
  177. // hospitalId: res.data.data.id
  178. };
  179. return param;
  180. },
  181. filterDatas() {
  182. this.currentPage = 1;
  183. this.getDataList();
  184. },
  185. addRelation() {
  186. const pam = this.searched
  187. ? {
  188. currentPage: this.currentPage,
  189. pageSize: this.pageSize,
  190. filter: this.filter
  191. }
  192. : { currentPage: this.currentPage, pageSize: this.pageSize };
  193. this.$router.push({ name: 'AddPlan', params: pam });
  194. },
  195. // 修改诊断关联-跳转至编辑页面
  196. modifyRelation(row) {
  197. const item = Object.assign({}, row);
  198. const pam = this.searched
  199. ? {
  200. currentPage: this.currentPage,
  201. pageSize: this.pageSize,
  202. filter: this.filter
  203. }
  204. : { currentPage: this.currentPage, pageSize: this.pageSize };
  205. this.$router.push({
  206. name: 'AddPlan',
  207. params: Object.assign(pam, { isEdit: true, data: item })
  208. });
  209. },
  210. currentChange(next) {
  211. this.currentPage = next;
  212. this.getDataList(true);
  213. // if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  214. // this.list = this.cacheData[next];
  215. // } else {
  216. // this.getDataList();
  217. // }
  218. },
  219. // 清空搜索参数
  220. clearFilter() {
  221. this.filter = {
  222. hisName: '',
  223. planName: ''
  224. };
  225. },
  226. indexMethod(index) {
  227. return (this.currentPage - 1) * this.pageSize + index + 1;
  228. },
  229. getTagType(val) {
  230. return val;
  231. },
  232. warning(msg, type) {
  233. this.$message({
  234. showClose: true,
  235. message: msg,
  236. type: type || 'warning'
  237. });
  238. },
  239. showConfirmDialog(msg, resolve, type) {
  240. let showInfo = '启用';
  241. let btnNameClass = 'confirmBtn2';
  242. if (type === 'Del') {
  243. showInfo = '禁用';
  244. btnNameClass = 'delBtn';
  245. } else if (type === 'Del1') {
  246. showInfo = '删除';
  247. btnNameClass = 'delBtn';
  248. }
  249. this.$confirm(msg, '提示', {
  250. confirmButtonText: showInfo,
  251. cancelButtonText: '取消',
  252. cancelButtonClass: 'cancelBtn',
  253. confirmButtonClass: btnNameClass,
  254. type: 'warning'
  255. })
  256. .then(() => {
  257. resolve();
  258. })
  259. .catch(() => {});
  260. },
  261. // 获取医院信息
  262. _getHospital() {
  263. api.getHospitalInfo().then(res => {
  264. if (res.data.code === '0') {
  265. this.hospitalId = res.data.data.id;
  266. }
  267. });
  268. },
  269. // 删除关联
  270. showDelDialog(id, status, info) {
  271. if (status === 1) {
  272. this.$confirm(`${info}正在启用中,无法删除。`, '提示', {
  273. confirmButtonText: '确定',
  274. // cancelButtonText: '取消',
  275. cancelButtonClass: 'cancelSureL',
  276. confirmButtonClass: 'sureL',
  277. customClass: 'exportBoxL',
  278. type: 'warning'
  279. })
  280. .then(() => {})
  281. .catch(() => {});
  282. return false;
  283. }
  284. this.showConfirmDialog(
  285. '是否删除该方案配置?',
  286. () => {
  287. let params = {
  288. planId: id,
  289. hospitalId: this.hospitalId
  290. };
  291. api
  292. .cancelPlanDatas(params)
  293. .then(res => {
  294. if (res.data.code == '0') {
  295. if (!this.searched) {
  296. //未点确认时清空搜索条件
  297. this.clearFilter();
  298. }
  299. if (this.list.length == 1) {
  300. //当前在最后一页且只有一条数据时,删除后跳到前一页
  301. this.currentPage =
  302. this.currentPage === 1 ? 1 : this.currentPage - 1;
  303. }
  304. this.getDataList();
  305. this.warning(res.data.msg || '操作成功', 'success');
  306. } else {
  307. this.warning(res.data.msg);
  308. }
  309. })
  310. .catch(error => {
  311. if (error.code === '900010001') {
  312. return false;
  313. }
  314. this.warning(error);
  315. });
  316. },
  317. 'Del1'
  318. );
  319. },
  320. // 启用/禁用 数据请求
  321. sendAbleOrEn(row, type) {
  322. api
  323. .revStopPlans({
  324. id: row.id,
  325. status: type
  326. })
  327. .then(res => {
  328. if (res.data.code === '0') {
  329. this.$message({
  330. showClose: true,
  331. message: '操作成功',
  332. type: 'success',
  333. duration: 1000
  334. });
  335. this.getDataList();
  336. }
  337. })
  338. .catch(err => {});
  339. },
  340. // 启用/禁用
  341. enableOrAble(row, type) {
  342. // console.log('启用planName', row, type);
  343. if (type === 1) {
  344. // 启用
  345. this.showConfirmDialog(
  346. `确定要启用${row.planName}吗?`,
  347. () => {
  348. this.sendAbleOrEn(row, type);
  349. },
  350. 'Reuse'
  351. );
  352. } else {
  353. // 禁用
  354. this.showConfirmDialog(
  355. `方案禁用后前端页面将无法正常显示内容,确定要禁用${row.planName}吗?`,
  356. () => {
  357. this.sendAbleOrEn(row, type);
  358. },
  359. 'Del'
  360. );
  361. }
  362. }
  363. }
  364. };
  365. </script>
  366. <style lang="less" scoped>
  367. @import '../../../less/admin.less';
  368. .delete {
  369. color: red;
  370. }
  371. .delete:hover {
  372. color: red;
  373. }
  374. .pagination {
  375. min-width: 1010px;
  376. }
  377. .disable {
  378. border-color: transparent;
  379. }
  380. .el-message-box {
  381. /deep/.cancelBtn {
  382. background-color: #d7d7d7;
  383. border-color: transparent;
  384. }
  385. /deep/ .delBtn {
  386. background-color: #ff545b !important;
  387. border-color: transparent !important;
  388. }
  389. /deep/ .confirmBtn2 {
  390. position: relative;
  391. right: 0px !important;
  392. }
  393. }
  394. .exportBoxL {
  395. /deep/ .el-message-box__btns {
  396. margin-top: 20px;
  397. }
  398. /deep/ .el-message-box__message {
  399. text-align: left;
  400. }
  401. /deep/ .el-message-box__btns {
  402. // text-align: center;
  403. margin-bottom: 24px;
  404. }
  405. /deep/ .leftbtn {
  406. margin-right: 46px;
  407. background-color: #d7d7d7;
  408. border-color: transparent;
  409. }
  410. /deep/ .cancelSureL {
  411. // text-align: center;
  412. display: none;
  413. }
  414. /deep/ .sureL {
  415. float: right;
  416. }
  417. }
  418. .contents {
  419. .is-plain {
  420. color: #dad7d7;
  421. }
  422. .is-plain:hover {
  423. color: #dad7d7;
  424. }
  425. }
  426. .el-table__row {
  427. /deep/ .is-disabled {
  428. border-color: transparent !important;
  429. }
  430. }
  431. </style>