Hospital.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. <template>
  2. <div>
  3. <crumbs title="医院管理" linkTo="MedicalTermCDSS" style="min-width: 1300px">
  4. <el-form :inline="true" class="demo-form-inline">
  5. <el-form-item label="医院名称:" class="selectMedicine">
  6. <el-select size="mini" v-model="filter.hospitalName" placeholder="请选择" clearable>
  7. <el-option
  8. v-for="item in HospitalInfoList"
  9. :label="item.name"
  10. :value="item.name"
  11. :key="item.id"
  12. ></el-option>
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item class="dododo">
  16. <el-button size="mini" @click="filterDatas">检索</el-button>
  17. <el-button size="mini" type="warning" @click="addRelation">添加医院</el-button>
  18. </el-form-item>
  19. </el-form>
  20. </crumbs>
  21. <div class="contents">
  22. <el-table :data="list" border style="width: 100%">
  23. <el-table-column :resizable="false" type="index" :index="indexMethod" label="编号" width="60"></el-table-column>
  24. <el-table-column :resizable="false" prop="code" label="医院编码" width="180"></el-table-column>
  25. <el-table-column :resizable="false" prop="name" label="医院名称" show-overflow-tooltip></el-table-column>
  26. <el-table-column :resizable="false" prop="spell" label="医院名称拼音" show-overflow-tooltip></el-table-column>
  27. <el-table-column :resizable="false" prop="address" label="医院地址" show-overflow-tooltip></el-table-column>
  28. <el-table-column :resizable="false" prop="gmtCreate" label="创建时间" show-overflow-tooltip></el-table-column>
  29. <el-table-column :resizable="false" prop="operate" label="操作">
  30. <template slot-scope="scope">
  31. <el-button @click="modifyRelation(scope.row)" type="text" size="small">修改</el-button>
  32. <span style="margin:0 3px;">|</span>
  33. <el-button @click="showDelDialog(scope.row)" class="delete" type="text" size="small">删除</el-button>
  34. </template>
  35. </el-table-column>
  36. </el-table>
  37. <div class="pagination pagepage">
  38. <el-pagination
  39. :current-page.sync="currentPage"
  40. @current-change="currentChange"
  41. background
  42. :page-size="pageSize"
  43. :page-sizes="pageSizeArr"
  44. @size-change="handleSizeChange"
  45. :layout="pageLayout"
  46. :total="total"
  47. ></el-pagination>
  48. </div>
  49. </div>
  50. </div>
  51. </template>
  52. <script>
  53. import api from '@api/cdss.js';
  54. import config from '@api/config.js';
  55. import utils from '@api/utils.js';
  56. export default {
  57. name: 'HospitalCDSS',
  58. data: function() {
  59. return {
  60. list: [],
  61. searched: false,
  62. filter: {
  63. hospitalName: '' // 医院名称
  64. },
  65. currentPage: 1,
  66. pageSize: config.pageSize,
  67. pageSizeArr: config.pageSizeArr,
  68. pageLayout: config.pageLayout,
  69. total: 0,
  70. HospitalInfoList: []
  71. };
  72. },
  73. created() {
  74. const that = this;
  75. //返回时避免参数未赋值就获取列表
  76. setTimeout(function() {
  77. that.getDataList();
  78. });
  79. // 非首页 编辑页返回 设置 this.currentPage
  80. if (Object.keys(this.$route.params).length !== 0) {
  81. this.currentPage = this.$route.params.currentPage;
  82. }
  83. this._getHospitalInfo();
  84. },
  85. watch: {
  86. filter: {
  87. handler: function() {
  88. this.searched = false;
  89. },
  90. deep: true
  91. }
  92. },
  93. beforeRouteEnter(to, from, next) {
  94. next(vm => {
  95. //const pm = to.param;
  96. Object.assign(vm, to.params);
  97. vm.inCurrentPage = to.params.currentPage;
  98. });
  99. },
  100. methods: {
  101. handleSizeChange(val) {
  102. this.pageSize = val;
  103. this.currentPage = utils.getCurrentPage(
  104. this.currentPage,
  105. this.total,
  106. this.pageSize
  107. );
  108. this.getDataList();
  109. },
  110. // 获取列表数据
  111. getDataList(isTurnPage) {
  112. const params = this.getFilterItems(isTurnPage);
  113. this.searched = true;
  114. const loading = this.$loading({
  115. lock: true,
  116. text: 'Loading',
  117. spinner: 'el-icon-loading',
  118. background: 'rgba(0, 0, 0, 0.7)'
  119. });
  120. api.getHospitalPageCDSS(params).then(res => {
  121. console.log(res, '列表数据');
  122. loading.close();
  123. if (res.data.code === '0') {
  124. this.list = res.data.data && res.data.data.records;
  125. }
  126. this.total = res.data.data && res.data.data.total;
  127. if (this.inCurrentPage !== undefined) {
  128. this.currentPage = this.inCurrentPage;
  129. this.inCurrentPage = undefined;
  130. }
  131. });
  132. },
  133. // 处理列表请求数据参数
  134. getFilterItems(isTurnPage) {
  135. const { data } = this.$route.params;
  136. //翻页时筛选条件没点确定则清空
  137. if (isTurnPage && !this.searched) {
  138. this.clearFilter();
  139. }
  140. const param = {
  141. current: this.inCurrentPage || this.currentPage,
  142. size: this.pageSize,
  143. name: this.filter.hospitalName.trim()
  144. };
  145. return param;
  146. },
  147. // 获取医院下拉列表
  148. _getHospitalInfo() {
  149. api.getHospitalInfo().then(res => {
  150. if (res.data.code === '0') {
  151. this.HospitalInfoList = res.data.data;
  152. }
  153. });
  154. },
  155. filterDatas() {
  156. this.currentPage = 1;
  157. this.getDataList();
  158. },
  159. addRelation() {
  160. const pam = this.searched
  161. ? {
  162. currentPage: this.currentPage,
  163. pageSize: this.pageSize,
  164. filter: this.filter
  165. }
  166. : { currentPage: this.currentPage, pageSize: this.pageSize };
  167. this.$router.push({
  168. name: 'AddHospitalCDSS',
  169. params: Object.assign(pam, {
  170. isEdit: false
  171. })
  172. });
  173. },
  174. // 修改诊断关联-跳转至编辑页面
  175. modifyRelation(row) {
  176. const item = Object.assign({}, row);
  177. const pam = this.searched
  178. ? {
  179. currentPage: this.currentPage,
  180. pageSize: this.pageSize,
  181. filter: this.filter
  182. }
  183. : { currentPage: this.currentPage, pageSize: this.pageSize };
  184. this.$router.push({
  185. name: 'AddHospitalCDSS',
  186. params: Object.assign(pam, {
  187. isEdit: true,
  188. data: { ...item }
  189. // hospitaiName: this.hospitaiName
  190. })
  191. });
  192. },
  193. currentChange(next) {
  194. this.currentPage = next;
  195. this.getDataList(true);
  196. },
  197. // 清空搜索参数
  198. clearFilter() {
  199. this.filter = {
  200. hospitalName: ''
  201. };
  202. },
  203. indexMethod(index) {
  204. return (this.currentPage - 1) * this.pageSize + index + 1;
  205. },
  206. getTagType(val) {
  207. return val;
  208. },
  209. warning(msg, type) {
  210. this.$message({
  211. showClose: true,
  212. message: msg,
  213. type: type || 'warning'
  214. });
  215. },
  216. showConfirmDialog(msg, resolve) {
  217. this.$alert(msg, '提示', {
  218. confirmButtonText: '删除',
  219. // cancelButtonText: '取消',
  220. // cancelButtonClass: 'cancelBtn',
  221. // confirmButtonClass: 'confirmC',
  222. type: 'warning'
  223. })
  224. .then(() => {
  225. resolve();
  226. })
  227. .catch(() => {});
  228. },
  229. // 删除关联
  230. showDelDialog(row) {
  231. this.showConfirmDialog('是否删除该关联?', () => {
  232. api
  233. .deleteHosRecordCDSS({ id: row.id })
  234. .then(res => {
  235. console.log(res, '=============');
  236. if (res.data.code == '0') {
  237. if (!this.searched) {
  238. //未点确认时清空搜索条件
  239. this.clearFilter();
  240. }
  241. if (this.list.length == 1) {
  242. //当前在最后一页且只有一条数据时,删除后跳到前一页
  243. this.currentPage =
  244. this.currentPage === 1 ? 1 : this.currentPage - 1;
  245. }
  246. this.getDataList();
  247. this.warning(res.data.msg || '操作成功', 'success');
  248. } else {
  249. this.warning(res.data.msg);
  250. }
  251. })
  252. .catch(error => {
  253. if (error.code === '900010001') {
  254. return false;
  255. }
  256. this.warning(error);
  257. });
  258. });
  259. }
  260. }
  261. };
  262. </script>
  263. <style lang="less" scoped>
  264. @import '../../../less/admin.less';
  265. .delete {
  266. color: red;
  267. }
  268. .delete:hover {
  269. color: red;
  270. }
  271. .pagination {
  272. min-width: 1010px;
  273. }
  274. .downTemplate {
  275. margin-right: 8px;
  276. span {
  277. color: #02a7f0;
  278. }
  279. }
  280. #upFile {
  281. display: none !important;
  282. }
  283. .el-message-box {
  284. /deep/.cancelBtn {
  285. background-color: #d7d7d7;
  286. border-color: transparent;
  287. }
  288. /deep/.confirmC {
  289. background-color: #ff545b !important;
  290. border-color: transparent !important;
  291. }
  292. }
  293. .exportBox6 {
  294. /deep/ .el-message-box__btns {
  295. margin-top: 20px;
  296. }
  297. /deep/ .el-message-box__message {
  298. // text-align: center;
  299. }
  300. /deep/.leftbtn {
  301. background-color: #d7d7d7;
  302. border-color: transparent !important;
  303. }
  304. /deep/ .el-message-box__header {
  305. border-bottom: 1px solid #dcdfe6;
  306. }
  307. }
  308. </style>