Plan.vue 11 KB

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