PhysicalExamTemplate.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  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. export default {
  82. name: 'PhysicalExamTemplate',
  83. data: function () {
  84. return {
  85. list: [], //常见症状列表
  86. cacheData: {},
  87. deptList: [], //科室下拉列表
  88. currentPage: 1,
  89. pageSize: config.pageSize,
  90. pageSizeArr:config.pageSizeArr,
  91. pageLayout:config.pageLayout,
  92. total: 0,
  93. linkIn:[],
  94. pays:[],
  95. searched: false,
  96. filter: {
  97. deptId: ''
  98. }
  99. }
  100. },
  101. created() {
  102. this.getDeptShortListSearh();
  103. const that = this;
  104. setTimeout(function () {
  105. that.getDataList();
  106. }, 200);
  107. },
  108. watch: {
  109. 'filter': {
  110. handler: function () {
  111. this.searched = false;
  112. },
  113. deep: true
  114. }
  115. },
  116. beforeRouteEnter(to, from, next) {
  117. next(vm => {
  118. //const pm = to.param;
  119. Object.assign(vm, to.params);
  120. })
  121. },
  122. methods: {
  123. handleSizeChange(val){
  124. this.pageSize = val;
  125. this.getDataList();
  126. },
  127. addModule() {
  128. const pam = this.searched ? {
  129. currentPage: this.currentPage,
  130. pageSize:this.pageSize,
  131. filter: this.filter
  132. } : {currentPage: this.currentPage,
  133. pageSize:this.pageSize};
  134. this.$router.push({name: 'AddPhysicalExamTemp', params: pam});
  135. },
  136. toEditProduct(row){
  137. this.getPhysicalExamTempByDepId('isEdit', row)
  138. },
  139. getPhysicalExamTempByDepId(type, row) {
  140. const param = {'deptId': row.deptId,};
  141. api.getPhysicalExamTempByDepId(param).then((res)=>{
  142. const {code,data,msg} = res.data;
  143. if(code=='0'){
  144. const pam = this.searched ? {
  145. currentPage: this.currentPage,
  146. filter: this.filter
  147. } : {currentPage: this.currentPage};
  148. const item = Object.assign({},row,data);
  149. this.$router.push({name: 'AddPhysicalExamTemp', params: Object.assign(pam, {[type]: true, data: item})});
  150. }else{
  151. this.$message({
  152. message: msg,
  153. type: 'warning'
  154. });
  155. }
  156. });
  157. },
  158. filterDatas(){
  159. this.currentPage = 1;
  160. this.getDataList();
  161. },
  162. getDeptShortListSearh() {
  163. api.getDeptShortListSearh().then((res) => {
  164. const { data } = res
  165. if(data.code == 0) {
  166. this.deptList = data.data
  167. }
  168. })
  169. },
  170. getDataList(isTurnPage) {
  171. const param = this.getFilterItems(isTurnPage);
  172. this.searched = true;
  173. api.getPhysicalExamTempList(param).then((res) => {
  174. if (res.data.code == '0') {
  175. const data = res.data.data;
  176. this.list = data.records;
  177. this.total = data.total;
  178. }
  179. }).catch((error) => {
  180. console.log(error);
  181. });
  182. },
  183. getDetailList(row) {
  184. this.getPhysicalExamTempByDepId('isDetail', row)
  185. },
  186. getFilterItems(isTurnPage) {
  187. //翻页时筛选条件没点确定则清空
  188. if(isTurnPage&&!this.searched){
  189. this.filter.deptId='';
  190. };
  191. const param = {
  192. deptId: this.filter.deptId,
  193. current: this.currentPage,
  194. size: this.pageSize
  195. };
  196. return param;
  197. },
  198. indexMethod(index) {
  199. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  200. },
  201. currentChange(next) {
  202. this.currentPage = next;
  203. if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  204. this.list = this.cacheData[next];
  205. } else {
  206. this.getDataList(true);
  207. }
  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. type: 'warning'
  220. }).then(() => {
  221. resolve();
  222. }).catch(() => {});
  223. },
  224. showDelDialog(deptId){
  225. this.showConfirmDialog('是否删除该科室查体模板?',()=>{
  226. api.delPhysicalExamTemp({'deptId':deptId}).then((res)=>{
  227. if(res.data.code=='0'){
  228. if(!this.searched){
  229. //未点确认时清空搜索条件
  230. this.filter={
  231. deptId: ''
  232. };
  233. }
  234. if(this.list.length==1){
  235. //当前在最后一页且只有一条数据时,删除后跳到前一页
  236. this.currentPage = this.currentPage===1?1:this.currentPage-1;
  237. }
  238. this.warning(res.data.msg||'操作成功','success');
  239. this.getDataList();
  240. }else{
  241. this.warning(res.data.msg);
  242. }
  243. }).catch((error)=>{
  244. this.warning(error);
  245. })
  246. });
  247. }
  248. }
  249. }
  250. </script>
  251. <style lang="less">
  252. @import "../../less/admin.less";
  253. .status-span{
  254. font-size: 12px;
  255. margin-right:10px;
  256. color: unset;
  257. }
  258. .delete{
  259. color: red
  260. }
  261. </style>