Plan.vue 12 KB

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