PhysicalExamTemplate.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. <template>
  2. <div>
  3. <crumbs title="查体模板维护">
  4. <el-form :inline="true" class="demo-form-inline">
  5. <el-form-item label="科室名称:">
  6. <el-select v-model="filter.deptId" clearable placeholder="请选择" size="mini">
  7. <el-option
  8. v-for="item in deptList"
  9. :key="item.id"
  10. :label="item.name"
  11. :value="item.id">
  12. </el-option>
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item>
  16. <el-button size="mini" @click="filterDatas">确认</el-button>
  17. <el-button size="mini" type="warning" @click="addModule" style="margin:0 10px">添加模板</el-button>
  18. </el-form-item>
  19. </el-form>
  20. </crumbs>
  21. <div class="contents">
  22. <el-table :data="list"
  23. border
  24. style="width: 100%">
  25. <el-table-column
  26. :resizable = "false"
  27. type="index"
  28. :index="indexMethod"
  29. label="编号"
  30. width="60">
  31. </el-table-column>
  32. <el-table-column
  33. :resizable = "false"
  34. prop="gmtOperate"
  35. label="操作时间"
  36. :show-overflow-tooltip="true">
  37. </el-table-column>
  38. <el-table-column
  39. :resizable = "false"
  40. prop="name"
  41. label="科室名称">
  42. </el-table-column>
  43. <el-table-column
  44. :resizable = "false"
  45. prop="operatorName"
  46. label="操作人"
  47. width="180">
  48. </el-table-column>
  49. <el-table-column
  50. :resizable = "false"
  51. label="操作" width="200">
  52. <template slot-scope="scope">
  53. <el-button type="text" size="small" @click="toEditProduct(scope.row)">修改</el-button>
  54. <span style="margin:0 3px;">|</span>
  55. <el-button type="text" size="small" class="delete" @click="showDelDialog(scope.row.deptId)">删除</el-button>
  56. </template>
  57. </el-table-column>
  58. <el-table-column
  59. :resizable = "false"
  60. label="详情">
  61. <template slot-scope="scope">
  62. <el-button type="text" size="small" @click="getDetailList(scope.row)">详情</el-button>
  63. </template>
  64. </el-table-column>
  65. </el-table>
  66. <el-pagination :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. </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: 'PhysicalExamTemplate',
  84. data: function () {
  85. return {
  86. list: [], //常见症状列表
  87. cacheData: {},
  88. deptList: [], //科室下拉列表
  89. currentPage: 1,
  90. pageSize: config.pageSize,
  91. pageSizeArr:config.pageSizeArr,
  92. pageLayout:config.pageLayout,
  93. total: 0,
  94. linkIn:[],
  95. pays:[],
  96. searched: false,
  97. filter: {
  98. deptId: ''
  99. }
  100. }
  101. },
  102. created() {
  103. this.getDeptShortListSearh();
  104. const that = this;
  105. setTimeout(function () {
  106. that.getDataList();
  107. }, 200);
  108. },
  109. watch: {
  110. 'filter': {
  111. handler: function () {
  112. this.searched = false;
  113. },
  114. deep: true
  115. }
  116. },
  117. beforeRouteEnter(to, from, next) {
  118. next(vm => {
  119. //const pm = to.param;
  120. Object.assign(vm, to.params);
  121. vm.inCurrentPage=to.params.currentPage;
  122. })
  123. },
  124. methods: {
  125. handleSizeChange(val){
  126. this.pageSize = val;
  127. this.currentPage = utils.getCurrentPage(this.currentChange, this.total, this.pageSize);
  128. this.getDataList();
  129. },
  130. addModule() {
  131. const pam = this.searched ? {
  132. currentPage: this.currentPage,
  133. pageSize:this.pageSize,
  134. filter: this.filter
  135. } : {currentPage: this.currentPage,
  136. pageSize:this.pageSize};
  137. this.$router.push({name: 'AddPhysicalExamTemp', params: pam});
  138. },
  139. toEditProduct(row){
  140. this.getPhysicalExamTempByDepId('isEdit', row)
  141. },
  142. getPhysicalExamTempByDepId(type, row) {
  143. const param = {'deptId': row.deptId,};
  144. api.getPhysicalExamTempByDepId(param).then((res)=>{
  145. const {code,data,msg} = res.data;
  146. if(code=='0'){
  147. const pam = this.searched ? {
  148. currentPage: this.currentPage,
  149. filter: this.filter
  150. } : {currentPage: this.currentPage};
  151. const item = Object.assign({},row,data);
  152. this.$router.push({name: 'AddPhysicalExamTemp', params: Object.assign(pam, {[type]: true, data: item})});
  153. }else{
  154. this.$message({
  155. message: msg,
  156. type: 'warning'
  157. });
  158. }
  159. });
  160. },
  161. filterDatas(){
  162. this.currentPage = 1;
  163. this.getDataList();
  164. },
  165. getDeptShortListSearh() {
  166. api.getDeptShortListSearh().then((res) => {
  167. const { data } = res
  168. if(data.code == 0) {
  169. this.deptList = data.data
  170. }
  171. })
  172. },
  173. getDataList(isTurnPage) {
  174. const param = this.getFilterItems(isTurnPage);
  175. this.searched = true;
  176. const loading = this.$loading({
  177. lock: true,
  178. text: 'Loading',
  179. spinner: 'el-icon-loading',
  180. background: 'rgba(0, 0, 0, 0.7)'
  181. });
  182. api.getPhysicalExamTempList(param).then((res) => {
  183. loading.close()
  184. if (res.data.code == '0') {
  185. const data = res.data.data;
  186. this.list = data.records;
  187. this.total = data.total;
  188. if(this.inCurrentPage!==undefined){
  189. this.currentPage=this.inCurrentPage;
  190. this.inCurrentPage = undefined;
  191. }
  192. }
  193. }).catch((error) => {
  194. console.log(error);
  195. });
  196. },
  197. getDetailList(row) {
  198. this.getPhysicalExamTempByDepId('isDetail', row)
  199. },
  200. getFilterItems(isTurnPage) {
  201. //翻页时筛选条件没点确定则清空
  202. if(isTurnPage&&!this.searched){
  203. this.filter.deptId='';
  204. };
  205. const param = {
  206. deptId: this.filter.deptId,
  207. current: this.inCurrentPage||this.currentPage,
  208. size: this.pageSize
  209. };
  210. return param;
  211. },
  212. indexMethod(index) {
  213. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  214. },
  215. currentChange(next) {
  216. this.currentPage = next;
  217. if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  218. this.list = this.cacheData[next];
  219. } else {
  220. this.getDataList(true);
  221. }
  222. },
  223. warning(msg,type){
  224. this.$message({
  225. showClose: true,
  226. message:msg,
  227. type:type||'warning'
  228. })
  229. },
  230. showConfirmDialog(msg,resolve){
  231. this.$alert(msg, '提示', {
  232. confirmButtonText: '确定',
  233. type: 'warning'
  234. }).then(() => {
  235. resolve();
  236. }).catch(() => {});
  237. },
  238. showDelDialog(deptId){
  239. this.showConfirmDialog('是否删除该科室查体模板?',()=>{
  240. api.delPhysicalExamTemp({'deptId':deptId}).then((res)=>{
  241. if(res.data.code=='0'){
  242. if(!this.searched){
  243. //未点确认时清空搜索条件
  244. this.filter={
  245. deptId: ''
  246. };
  247. }
  248. if(this.list.length==1){
  249. //当前在最后一页且只有一条数据时,删除后跳到前一页
  250. this.currentPage = this.currentPage===1?1:this.currentPage-1;
  251. }
  252. this.warning(res.data.msg||'操作成功','success');
  253. this.getDataList();
  254. }else{
  255. this.warning(res.data.msg);
  256. }
  257. }).catch((error)=>{
  258. this.warning(error);
  259. })
  260. });
  261. }
  262. }
  263. }
  264. </script>
  265. <style lang="less">
  266. @import "../../less/admin.less";
  267. .status-span{
  268. font-size: 12px;
  269. margin-right:10px;
  270. color: unset;
  271. }
  272. .delete{
  273. color: red
  274. }
  275. </style>