Plan.vue 14 KB

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