Plan.vue 12 KB

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