123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- <template>
- <div>
- <crumbs title="版本信息维护">
- <el-form :inline="true" class="demo-form-inline">
- <el-form-item label="版本号归属:">
- <el-select v-model="filter.type" placeholder="请选择" size="mini" clearable>
- <el-option
- v-for="item in typeList"
- :key="item.key"
- :label="item.name"
- :value="item.key">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="查询版本号:">
- <el-input size="mini" v-model="filter.name" placeholder="输入版本号"></el-input>
- </el-form-item>
- <el-form-item>
- <el-button size="mini" @click="filterDatas">确认</el-button>
- <!-- <router-link to="/admin/LT-YXSJWH-TJBBXX" style="margin:0 10px">
- <el-button size="mini" type="warning">添加版本信息</el-button>
- </router-link> -->
- <el-button size="mini" type="warning" style="margin:0 10px" @click="addVersion">添加版本信息</el-button>
- </el-form-item>
- </el-form>
- </crumbs>
- <div class="contents">
- <el-table :data="list"
- border
- style="width: 100%">
- <el-table-column
- type="index"
- :index="indexMethod"
- label="编号"
- width="60">
- </el-table-column>
- <el-table-column
- prop="gmtCreate"
- label="操作时间"
- :show-overflow-tooltip="true">
- </el-table-column>
- <el-table-column
- prop="name"
- label="版本号"
- show-overflow-tooltip>
- </el-table-column>
- <el-table-column
- prop="refreshTime"
- label="版本时间">
- </el-table-column>
- <el-table-column
- label="版本号归属">
- <template slot-scope="scope">
- <span>{{getProdType(scope.row)}}</span>
- </template>
- </el-table-column>
- <el-table-column
- prop="modifierid"
- label="操作人">
- </el-table-column>
- <el-table-column
- label="操作">
- <template slot-scope="scope">
- <!-- <el-button type="text" size="small" :class="{forbid:scope.row.id != canModiId}" @click="scope.row.id ==canModiId?toEditVersion(scope.row,false):''">修改</el-button> -->
- <el-button type="text" size="small" :class="{forbid:scope.row.status != 1}" @click="scope.row.status == 1?toEditVersion(scope.row,false):''">修改</el-button>
- <span style="margin:0 3px;">|</span>
- <el-button type="text" size="small" :class="{forbid:scope.row.status != 1}" @click="scope.row.status ==1?toEditVersion(scope.row,true):''">复制</el-button>
- </template>
- </el-table-column>
- <el-table-column
- label="详情">
- <template slot-scope="scope">
- <el-button type="text" size="small" @click="getDetail(scope.row)">详情</el-button>
- </template>
- </el-table-column>
- </el-table>
- <el-pagination :current-page.sync="currentPage"
- @current-change="currentChange"
- background
- :page-size="pageSize"
- :page-sizes="pageSizeArr"
- @size-change="handleSizeChange"
- :layout="pageLayout"
- :total="total">
- </el-pagination>
- </div>
- </div>
- </template>
- <script>
- import api from '@api/icss.js';
- import config from '@api/config.js';
- import utils from '@api/utils.js';
- export default {
- name: 'VersionInfo',
- data: function () {
- return {
- list: [],
- cacheData: {},
- currentPage: 1,
- pageSize: config.pageSize,
- pageSizeArr:config.pageSizeArr,
- pageLayout:config.pageLayout,
- total: 0,
- searched: false,
- filter: {
- name: '',
- type:null
- },
- canModiId:null, //标识列表中的第一个可修改和复制项,区分分页和搜索
- flag:true,
- typeList:[]
- }
- },
- created() {
- this.$nextTick(()=>{
- this.getDataList();
- let typeList = JSON.parse(localStorage.getItem("knowledgeEnumsData"));
- this.typeList = typeList.productTypeEnum;
- })
- },
- watch: {
- 'filter': {
- handler: function () {
- this.searched = false;
- },
- deep: true
- }
- },
- beforeRouteEnter(to, from, next) {
- next(vm => {
- //const pm = to.param;
- Object.assign(vm, to.params);
- })
- },
- methods: {
- handleSizeChange(val){
- this.pageSize = val;
- this.currentPage = utils.getCurrentPage(this.currentChange, this.total, this.pageSize);
- this.getDataList();
- },
- getProdType(item){
- let name = "";
- let type = item.productType;
- for(let i in this.typeList){
- if(this.typeList[i].key == type){
- name = this.typeList[i].name;
- }
- }
- return name;
- },
- addVersion(){
- // 添加版本信息
- const pam = this.searched ? {
- currentPage: this.currentPage,
- pageSize:this.pageSize,
- filter: this.filter
- } : {currentPage: this.currentPage,
- pageSize:this.pageSize};
- this.$router.push({
- name:'AddVersion',
- params: pam
- })
- },
- toEditVersion(row,flag){
- const pam = this.searched ? {
- currentPage: this.currentPage,
- pageSize:this.pageSize,
- filter: this.filter
- } : {currentPage: this.currentPage,
- pageSize:this.pageSize};
- this.$router.push({
- name:'AddVersion',
- params: Object.assign(pam, {info: row, copy: flag})
- })
- },
- filterDatas(){
- this.currentPage = 1;
- this.getDataList();
- },
- getDataList(isTurnPage) {
- const param = this.getFilterItems(isTurnPage);
- this.searched = true;
- const loading = this.$loading({
- lock: true,
- text: 'Loading',
- spinner: 'el-icon-loading',
- background: 'rgba(0, 0, 0, 0.7)'
- });
- api.versionInfo(param).then((res) => {
- loading.close()
- if (res.data.code == '0') {
- const data = res.data.data;
- this.list = data.records;
- this.cacheData[param.current] = data.records;
- this.total = data.total;
- if(this.flag){
- this.canModiId = this.list[0].id;
- }
- this.flag = false;
- }
- }).catch((error) => {
- console.log(error);
- });
- },
- getDetail(item) {//详情页内不能修改明细 4-11
- // let isFirst = item.id==this.list[0].id?true:false;
- let isFirst = false;
- this.$router.push({name:'VersionDetail', params:{info:item,isFirst}});
- },
- getFilterItems(isTurnPage) {
- //翻页时筛选条件没点确定则清空
- if(isTurnPage&&!this.searched){
- this.filter.name='';
- this.filter.type = null;
- };
- const param = {
- name: this.filter.name.trim(),
- current: this.currentPage,
- size: this.pageSize,
- productType:this.filter.type?this.filter.type:0
- };
- return param;
- },
- indexMethod(index) {
- return ((this.currentPage - 1) * this.pageSize) + index + 1;
- },
- currentChange(next) {
- this.currentPage = next;
- if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
- this.list = this.cacheData[next];
- } else {
- this.getDataList(true);
- }
- }
- }
- }
- </script>
- <style lang="less" scoped>
- @import "../../less/admin.less";
- .delete{
- color: red !important;
- }
- .forbid{
- color: #BFBFBF !important;
- }
- </style>
|