CommonSymptom.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <div>
  3. <crumbs title="icss科室维护系统">
  4. <el-form :inline="true" class="demo-form-inline">
  5. <el-form-item label="科室名称:">
  6. <el-input size="mini" v-model="filter.proName" placeholder="科室名称"></el-input>
  7. </el-form-item>
  8. <el-form-item>
  9. <el-button size="mini" @click="filterDatas">确认</el-button>
  10. <router-link to="/admin/LT-YXSJWH-TJCJZZ" style="margin:0 10px">
  11. <el-button size="mini" type="warning">添加科室常见症状</el-button>
  12. </router-link>
  13. </el-form-item>
  14. </el-form>
  15. </crumbs>
  16. <div class="contents">
  17. <el-table :data="list"
  18. border
  19. style="width: 100%">
  20. <el-table-column
  21. :resizable = "false"
  22. type="index"
  23. :index="indexMethod"
  24. label="编号"
  25. width="60">
  26. </el-table-column>
  27. <el-table-column
  28. :resizable = "false"
  29. prop="gmtModified"
  30. label="操作时间"
  31. :show-overflow-tooltip="true">
  32. </el-table-column>
  33. <el-table-column
  34. :resizable = "false"
  35. prop="typeName"
  36. label="类型">
  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="userName"
  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)">删除</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 v-if="total>pageSize"
  67. :current-page.sync="currentPage"
  68. @current-change="currentChange"
  69. background
  70. :page-size="pageSize"
  71. layout="total,prev, pager, next, jumper"
  72. :total="total">
  73. </el-pagination>
  74. </div>
  75. </div>
  76. </template>
  77. <script>
  78. import api from '@api/icss.js';
  79. import utils from '@api/utils.js';
  80. export default {
  81. name: 'CommonSymptom',
  82. data: function () {
  83. return {
  84. list: [], //常见症状列表
  85. cacheData: {},
  86. currentPage: 1,
  87. pageSize: 10,
  88. total: 0,
  89. linkIn:[],
  90. pays:[],
  91. filter: {
  92. proName: ''
  93. }
  94. }
  95. },
  96. created() {
  97. this.getDataList();
  98. },
  99. methods: {
  100. toEditProduct(row){
  101. const param = {
  102. "deptId": row.id,
  103. "type": row.type
  104. }
  105. api.getCommonSymptomById(param).then((res)=>{
  106. const {code,data,msg} = res.data;
  107. if(code=='0'){
  108. const item = Object.assign({},row,data);
  109. this.$router.push({name:'AddCommonSymptom',params:{isEdit:true,data:item}});
  110. }else{
  111. this.$message({
  112. message: msg,
  113. type: 'warning'
  114. });
  115. }
  116. });
  117. },
  118. filterDatas(){
  119. this.currentPage = 1;
  120. this.getDataList();
  121. },
  122. getDataList() {
  123. const param = this.getFilterItems();
  124. // const param = {
  125. // 'name':''
  126. // };
  127. api.commonSymptomList(param).then((res) => {
  128. if (res.data.code == '0') {
  129. console.log('commonSymptomList', res)
  130. const data = res.data.data;
  131. this.list = data.records;
  132. this.total = data.total;
  133. }
  134. }).catch((error) => {
  135. console.log(error);
  136. });
  137. },
  138. getDetailList(row) {
  139. const param = {
  140. "deptId": row.id,
  141. "type": row.type
  142. }
  143. api.getCommonSymptomById(param).then((res)=>{
  144. const {code,data,msg} = res.data;
  145. if(code=='0'){
  146. const item = Object.assign({},row,data);
  147. this.$router.push({name:'AddCommonSymptom',params:{isEdit:true,data:item}});
  148. }else{
  149. this.$message({
  150. message: msg,
  151. type: 'warning'
  152. });
  153. }
  154. });
  155. },
  156. getFilterItems() {
  157. const param = {
  158. name: this.filter.proName,
  159. current: this.currentPage,
  160. size: this.pageSize
  161. };
  162. return param;
  163. },
  164. indexMethod(index) {
  165. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  166. },
  167. currentChange(next) {
  168. this.currentPage = next;
  169. if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  170. this.list = this.cacheData[next];
  171. } else {
  172. this.getDataList();
  173. }
  174. },
  175. warning(msg,type){
  176. this.$message({
  177. showClose: true,
  178. message:msg,
  179. type:type||'warning'
  180. })
  181. },
  182. showConfirmDialog(msg,resolve){
  183. this.$alert(msg, '提示', {
  184. confirmButtonText: '确定',
  185. type: 'warning'
  186. }).then(() => {
  187. resolve();
  188. }).catch(() => {});
  189. },
  190. showDelDialog(row){
  191. this.showConfirmDialog('是否删除该科室症状?',()=>{
  192. const param = {
  193. "deptId": row.id,
  194. "type": row.type
  195. }
  196. api.delCommonSymptom(param).then((res)=>{
  197. if(res.data.code=='0'){
  198. this.warning(res.data.msg||'操作成功','success');
  199. this.getDataList();
  200. }else{
  201. this.warning(res.data.msg);
  202. }
  203. }).catch((error)=>{
  204. this.warning(error);
  205. })
  206. });
  207. }
  208. }
  209. }
  210. </script>
  211. <style lang="less">
  212. @import "../../less/admin.less";
  213. .status-span{
  214. font-size: 12px;
  215. margin-right:10px;
  216. color: unset;
  217. }
  218. .delete{
  219. color: red
  220. }
  221. </style>