VersionInfo.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <div>
  3. <crumbs title="版本信息维护">
  4. <el-form :inline="true" class="demo-form-inline">
  5. <el-form-item label="查询版本号:">
  6. <el-input size="mini" v-model="filter.name" 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-TJBBXX" style="margin:0 10px">
  11. <el-button size="mini" type="warning">添加版本信息</el-button>
  12. </router-link> -->
  13. <el-button size="mini" type="warning" style="margin:0 10px" @click="addVersion">添加版本信息</el-button>
  14. </el-form-item>
  15. </el-form>
  16. </crumbs>
  17. <div class="contents">
  18. <el-table :data="list"
  19. border
  20. style="width: 100%">
  21. <el-table-column
  22. type="index"
  23. :index="indexMethod"
  24. label="编号"
  25. width="60">
  26. </el-table-column>
  27. <el-table-column
  28. prop="gmtCreate"
  29. label="操作时间"
  30. :show-overflow-tooltip="true">
  31. </el-table-column>
  32. <el-table-column
  33. prop="name"
  34. label="版本号"
  35. show-overflow-tooltip>
  36. </el-table-column>
  37. <el-table-column
  38. prop="refreshTime"
  39. label="版本时间">
  40. </el-table-column>
  41. <el-table-column
  42. prop="modifierid"
  43. label="操作人">
  44. </el-table-column>
  45. <el-table-column
  46. label="操作">
  47. <template slot-scope="scope">
  48. <el-button type="text" size="small" :class="{forbid:scope.row.id != canModiId}" @click="scope.row.id ==canModiId?toEditVersion(scope.row,false):''">修改</el-button>
  49. <span style="margin:0 3px;">|</span>
  50. <el-button type="text" size="small" :class="{forbid:scope.row.id != canModiId}" @click="scope.row.id ==canModiId?toEditVersion(scope.row,true):''">复制</el-button>
  51. </template>
  52. </el-table-column>
  53. <el-table-column
  54. label="详情">
  55. <template slot-scope="scope">
  56. <el-button type="text" size="small" @click="getDetail(scope.row)">详情</el-button>
  57. </template>
  58. </el-table-column>
  59. </el-table>
  60. <el-pagination v-if="total>pageSize"
  61. :current-page.sync="currentPage"
  62. @current-change="currentChange"
  63. background
  64. :page-size="pageSize"
  65. layout="total,prev, pager, next, jumper"
  66. :total="total">
  67. </el-pagination>
  68. </div>
  69. </div>
  70. </template>
  71. <script>
  72. import api from '@api/icss.js';
  73. export default {
  74. name: 'VersionInfo',
  75. data: function () {
  76. return {
  77. list: [],
  78. cacheData: {},
  79. currentPage: 1,
  80. pageSize: 10,
  81. total: 0,
  82. searched: false,
  83. filter: {
  84. name: ''
  85. },
  86. canModiId:null, //标识列表中的第一个可修改和复制项,区分分页和搜索
  87. flag:true
  88. }
  89. },
  90. created() {
  91. this.getDataList();
  92. },
  93. watch: {
  94. 'filter': {
  95. handler: function () {
  96. this.searched = false;
  97. },
  98. deep: true
  99. }
  100. },
  101. beforeRouteEnter(to, from, next) {
  102. next(vm => {
  103. //const pm = to.param;
  104. Object.assign(vm, to.params);
  105. })
  106. },
  107. methods: {
  108. addVersion(){
  109. // 添加版本信息
  110. const pam = this.searched ? {
  111. currentPage: this.currentPage,
  112. filter: this.filter
  113. } : {currentPage: this.currentPage};
  114. this.$router.push({
  115. name:'AddVersion',
  116. params: pam
  117. })
  118. },
  119. toEditVersion(row,flag){
  120. const pam = this.searched ? {
  121. currentPage: this.currentPage,
  122. filter: this.filter
  123. } : {currentPage: this.currentPage};
  124. this.$router.push({
  125. name:'AddVersion',
  126. params: Object.assign(pam, {info: row, copy: flag})
  127. })
  128. },
  129. filterDatas(){
  130. this.currentPage = 1;
  131. this.getDataList();
  132. },
  133. getDataList(isTurnPage) {
  134. const param = this.getFilterItems(isTurnPage);
  135. this.searched = true;
  136. api.versionInfo(param).then((res) => {
  137. if (res.data.code == '0') {
  138. const data = res.data.data;
  139. this.list = data.records;
  140. this.cacheData[param.current] = data.records;
  141. this.total = data.total;
  142. if(this.flag){
  143. this.canModiId = this.list[0].id;
  144. }
  145. this.flag = false;
  146. }
  147. }).catch((error) => {
  148. console.log(error);
  149. });
  150. },
  151. getDetail(item) {//详情页内不能修改明细 4-11
  152. // let isFirst = item.id==this.list[0].id?true:false;
  153. let isFirst = false;
  154. this.$router.push({name:'VersionDetail', params:{info:item,isFirst}});
  155. },
  156. getFilterItems(isTurnPage) {
  157. //翻页时筛选条件没点确定则清空
  158. if(isTurnPage&&!this.searched){
  159. this.filter.name='';
  160. };
  161. const param = {
  162. name: this.filter.name,
  163. current: this.currentPage,
  164. size: this.pageSize
  165. };
  166. return param;
  167. },
  168. indexMethod(index) {
  169. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  170. },
  171. currentChange(next) {
  172. this.currentPage = next;
  173. if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  174. this.list = this.cacheData[next];
  175. } else {
  176. this.getDataList(true);
  177. }
  178. }
  179. }
  180. }
  181. </script>
  182. <style lang="less" scoped>
  183. @import "../../less/admin.less";
  184. .delete{
  185. color: red !important;
  186. }
  187. .forbid{
  188. color: #BFBFBF !important;
  189. }
  190. </style>