ChemicalAndCommonMapping.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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="化验大项:">
  6. <el-input size="mini" v-model="filter.mealName" placeholder="化验大项" clearable></el-input>
  7. </el-form-item>
  8. <el-form-item label="化验小项:">
  9. <el-input size="mini" v-model="filter.itemName" placeholder="化验小项" clearable></el-input>
  10. </el-form-item>
  11. <el-form-item label="化验公表项:">
  12. <el-input size="mini" v-model="filter.uniqueName" placeholder="化验公表项" clearable></el-input>
  13. </el-form-item>
  14. <el-form-item>
  15. <el-button size="mini" @click="filterDatas">确认</el-button>
  16. <el-button size="mini" type="warning" @click="addRelation">添加关联</el-button>
  17. </el-form-item>
  18. </el-form>
  19. </crumbs>
  20. <div class="contents">
  21. <el-table
  22. :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. width="180">
  37. </el-table-column>
  38. <el-table-column
  39. :resizable = "false"
  40. prop="mealName"
  41. label="化验大项"
  42. show-overflow-tooltip>
  43. </el-table-column>
  44. <el-table-column
  45. :resizable = "false"
  46. prop="itemName"
  47. label="化验小项"
  48. show-overflow-tooltip>
  49. </el-table-column>
  50. <el-table-column
  51. :resizable = "false"
  52. prop="uniqueName"
  53. label="对应项"
  54. show-overflow-tooltip>
  55. </el-table-column>
  56. <el-table-column
  57. :resizable = "false"
  58. prop="modifier"
  59. label="操作人">
  60. </el-table-column>
  61. <el-table-column
  62. :resizable = "false"
  63. prop="operate"
  64. label="操作">
  65. <template slot-scope="scope">
  66. <!-- 没有修改 -->
  67. <!-- <el-button @click="modifyRelation(scope.row)" type="text" size="small">修改</el-button> -->
  68. <el-button @click="showDelDialog(scope.row.id)" class="delete" type="text" size="small">删除</el-button>
  69. </template>
  70. </el-table-column>
  71. </el-table>
  72. <div class="pagination">
  73. <el-pagination v-if="total>pageSize"
  74. :current-page.sync="currentPage"
  75. @current-change="currentChange"
  76. background
  77. :page-size="pageSize"
  78. layout="total,prev, pager, next, jumper"
  79. :total="total">
  80. </el-pagination>
  81. </div>
  82. </div>
  83. <!-- <div class="pagination">
  84. <el-pagination v-if="total>pageSize"
  85. :current-page.sync="currentPage"
  86. @current-change="currentChange"
  87. background
  88. :page-size="pageSize"
  89. layout="total,prev, pager, next, jumper"
  90. :total="total">
  91. </el-pagination>
  92. </div> -->
  93. </div>
  94. </template>
  95. <script>
  96. import api from '@api/icss.js';
  97. export default {
  98. name: 'ChemicalAndCommonMapping', //化验大小项和公表维护
  99. data: function() {
  100. return {
  101. list: [],
  102. filter: {
  103. mealName:'',
  104. itemName:'',
  105. uniqueName:''
  106. },
  107. currentPage: 1,
  108. pageSize: 10,
  109. total: 0,
  110. }
  111. },
  112. created() {
  113. this.getDataList()
  114. },
  115. methods: {
  116. getDataList() {
  117. const param = this.getFilterItems();
  118. api.getLisMappingPage(param).then((res) => {
  119. if(res.data.code == '0') {
  120. this.list = res.data.data.records
  121. }
  122. this.total = res.data.data.total;
  123. })
  124. },
  125. filterDatas() {
  126. this.currentPage = 1;
  127. this.getDataList();
  128. },
  129. addRelation() {
  130. this.$router.push({name:'AddChemicalAndCommonMapping'})
  131. },
  132. modifyRelation(row) {
  133. console.log(row,'row')
  134. const item = Object.assign({},row);
  135. this.$router.push({name:'AddChemicalAndCommonMapping',params:{isEdit:true,data:item}});
  136. },
  137. currentChange(next) {
  138. this.currentPage = next;
  139. this.getDataList();
  140. // if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  141. // this.list = this.cacheData[next];
  142. // } else {
  143. // this.getDataList();
  144. // }
  145. },
  146. getFilterItems() {
  147. const param = {
  148. current: this.currentPage,
  149. size: this.pageSize,
  150. mealName:this.filter.mealName,
  151. itemName:this.filter.itemName,
  152. uniqueName:this.filter.uniqueName
  153. };
  154. return param;
  155. },
  156. indexMethod(index) {
  157. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  158. },
  159. getTagType(val) {
  160. return val
  161. },
  162. warning(msg,type){
  163. this.$message({
  164. showClose: true,
  165. message:msg,
  166. type:type||'warning'
  167. })
  168. },
  169. showConfirmDialog(msg,resolve){
  170. this.$alert(msg, '提示', {
  171. confirmButtonText: '确定',
  172. type: 'warning'
  173. }).then(() => {
  174. resolve();
  175. }).catch(() => {});
  176. },
  177. showDelDialog(id){
  178. this.showConfirmDialog('是否删除该关联?',()=>{
  179. api.delLisMappingById({id:id}).then((res)=>{
  180. if(res.data.code=='0'){
  181. this.getDataList();
  182. this.warning(res.data.msg || '操作成功','success');
  183. }else{
  184. this.warning(res.data.msg);
  185. }
  186. }).catch((error)=>{
  187. this.warning(error);
  188. })
  189. });
  190. }
  191. }
  192. }
  193. </script>
  194. <style lang="less">
  195. @import "../../less/admin.less";
  196. .delete{
  197. color: red;
  198. }
  199. .delete:hover {
  200. color: red;
  201. }
  202. .pagination {
  203. min-width: 1010px;
  204. }
  205. </style>