2020-03-11 12:27:00 +08:00
|
|
|
|
<style scoped>
|
|
|
|
|
|
.model {
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|
|
|
|
|
|
<template>
|
|
|
|
|
|
<div class="model">
|
2020-08-02 22:43:53 +08:00
|
|
|
|
<div class="main-list" :class="{'main-list-with-sub': bottomBox.showSubList}">
|
|
|
|
|
|
<div class="main-modal"></div>
|
|
|
|
|
|
<div class="top-tools" v-show="bottomBox.mainResizeShow">
|
2020-10-30 12:49:30 +08:00
|
|
|
|
<div class="top-tool-main-right" :class="{'top-tool-main-right-to-left-small': bottomBox.showSubList}">
|
2020-08-02 22:43:53 +08:00
|
|
|
|
<div class="top-tool-search">
|
|
|
|
|
|
<search-input :searchMsg="searchMsg" @search="search" :bottomBox.inTransform="bottomBox.inTransform"></search-input>
|
2020-03-19 20:44:14 +08:00
|
|
|
|
</div>
|
2020-12-08 21:53:37 +08:00
|
|
|
|
<button :title="$t('overall.createModel')" @click="add" class="nz-btn nz-btn-size-normal nz-btn-style-light margin-l-20" id="model-add" v-has="'model_toAdd'">
|
|
|
|
|
|
<i class="nz-icon-create-square nz-icon"></i>
|
2020-08-02 22:43:53 +08:00
|
|
|
|
</button>
|
2020-10-29 19:11:46 +08:00
|
|
|
|
<delete-button :delete-objs="batchDeleteObjs" api="model" @after="getTableData"></delete-button>
|
2020-03-11 12:27:00 +08:00
|
|
|
|
</div>
|
2020-08-02 22:43:53 +08:00
|
|
|
|
<div class="pagination-top pagination-top-hide display-none"></div>
|
|
|
|
|
|
</div>
|
2020-08-04 21:53:06 +08:00
|
|
|
|
<!-- 自定义table列 -->
|
|
|
|
|
|
<transition name="el-zoom-in-top">
|
|
|
|
|
|
<element-set
|
|
|
|
|
|
v-if="tools.showCustomTableTitle"
|
|
|
|
|
|
@close="tools.showCustomTableTitle = false"
|
|
|
|
|
|
:custom-table-title.sync="tools.customTableTitle"
|
|
|
|
|
|
:original-table-title="tableTitle"
|
|
|
|
|
|
ref="customTableTitle"
|
|
|
|
|
|
></element-set>
|
|
|
|
|
|
</transition>
|
2020-08-02 22:43:53 +08:00
|
|
|
|
<el-table :data="tableData"
|
|
|
|
|
|
border style="width: 100%;"
|
|
|
|
|
|
ref="modelTable"
|
|
|
|
|
|
class="nz-table"
|
|
|
|
|
|
v-loading="tools.loading"
|
|
|
|
|
|
:cell-class-name="assetStatClassName"
|
|
|
|
|
|
v-show="bottomBox.mainResizeShow"
|
|
|
|
|
|
:height="mainTableHeight"
|
|
|
|
|
|
@sort-change="tableDataSort"
|
2020-09-24 11:38:13 +08:00
|
|
|
|
@row-dblclick="panel"
|
2020-10-29 19:11:46 +08:00
|
|
|
|
@selection-change="(selection)=>{this.batchDeleteObjs=selection}"
|
2020-08-02 22:43:53 +08:00
|
|
|
|
>
|
2020-10-29 19:11:46 +08:00
|
|
|
|
<el-table-column
|
|
|
|
|
|
:resizable="false"
|
|
|
|
|
|
type="selection"
|
|
|
|
|
|
width="40"
|
|
|
|
|
|
align="center">
|
|
|
|
|
|
</el-table-column>
|
2020-11-04 15:38:34 +08:00
|
|
|
|
<el-table-column :resizable="true"
|
2020-08-04 21:53:06 +08:00
|
|
|
|
v-for="(item, index) in tools.customTableTitle"
|
2020-08-02 22:43:53 +08:00
|
|
|
|
v-if="item.show"
|
|
|
|
|
|
:key="`col-${index}`"
|
|
|
|
|
|
:label="item.label"
|
2020-08-07 11:11:43 +08:00
|
|
|
|
:sortable="$tableSet.sortableShow(item.prop,'model')"
|
|
|
|
|
|
:prop="$tableSet.propTitle(item.prop,'model')"
|
2020-08-02 22:43:53 +08:00
|
|
|
|
:sort-orders="['ascending', 'descending']">
|
|
|
|
|
|
<template slot-scope="scope" :column="item">
|
|
|
|
|
|
<template v-if="item.prop == 'vendor'" >{{scope.row[item.prop].value}}</template>
|
|
|
|
|
|
<template v-else-if="item.prop == 'type'" >{{scope.row[item.prop].value}}</template>
|
|
|
|
|
|
<template v-else-if="item.prop == 'assetStat' && scope.row.assetStat" >
|
|
|
|
|
|
<el-popover
|
|
|
|
|
|
placement="top"
|
|
|
|
|
|
trigger="hover"
|
2020-11-21 13:04:53 +08:00
|
|
|
|
:content="$t('overall.result.total') + ':' + scope.row.assetStat.total + ',' + $t('asset.inStock') + ':' + scope.row.assetStat.inStock + ',' + $t('asset.notInStock') + ':' + scope.row.assetStat.outStock + ',' + $t('asset.suspended') + ':' + scope.row.assetStat.suspended">
|
2020-08-02 22:43:53 +08:00
|
|
|
|
<div slot="reference" class="dc-asset-states">
|
|
|
|
|
|
<span class="dc-asset-state dc-asset-state-total">{{scope.row.assetStat.total}}</span>
|
|
|
|
|
|
<span class="dc-asset-state dc-asset-state-in">{{scope.row.assetStat.inStock}}</span>
|
|
|
|
|
|
<span class="dc-asset-state dc-asset-state-out">{{scope.row.assetStat.outStock}}</span>
|
2020-11-21 11:27:55 +08:00
|
|
|
|
<span class="dc-asset-state dc-asset-state-suspended">{{scope.row.assetStat.suspended}}</span>
|
2020-08-02 22:43:53 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</el-popover>
|
2020-05-19 20:26:11 +08:00
|
|
|
|
</template>
|
2020-08-02 22:43:53 +08:00
|
|
|
|
<div v-else-if="item.prop == 'option'" class="content-right-options">
|
2020-12-15 21:13:07 +08:00
|
|
|
|
<span :id="'model-panel-'+scope.row.id" :title="$t('dashboard.panel.title')" @click="panel(scope.row)" class="content-right-option" v-has="'model_chart_view'"><i class="nz-icon nz-icon-template"></i></span>
|
2020-12-08 21:53:37 +08:00
|
|
|
|
<span :id="'model-edit-'+scope.row.id" :title="$t('overall.edit')" @click="edit(scope.row)" class="content-right-option" v-has="'model_toEdit'"><i class="nz-icon nz-icon-edit"></i></span>
|
|
|
|
|
|
<span :id="'model-del-'+scope.row.id" :title="$t('overall.delete')" @click="del(scope.row)" class="content-right-option" v-has="'model_delete'"><i class="nz-icon nz-icon-delete"></i></span>
|
2020-08-02 22:43:53 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<template v-else-if="scope.row[item.prop]">{{scope.row[item.prop]}}</template>
|
|
|
|
|
|
<template v-else>-</template>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column :resizable="false" width="28">
|
|
|
|
|
|
<template slot="header" slot-scope="scope">
|
2020-08-04 21:53:06 +08:00
|
|
|
|
<span @mousedown.stop="!tools.showCustomTableTitle && (tools.showCustomTableTitle = true)" class="nz-table-gear">
|
2020-08-02 22:43:53 +08:00
|
|
|
|
<i class="nz-icon nz-icon-gear"></i>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
</el-table>
|
2020-12-15 21:13:07 +08:00
|
|
|
|
<button :class="{'to-top-is-hover': tools.tableHover}" :style="{top: tools.toTopBtnTop}" @click="toTop(scrollbarWrap)" class="to-top" v-show="tools.showTopBtn"><i class="nz-icon nz-icon-top"></i></button>
|
2020-08-02 22:43:53 +08:00
|
|
|
|
<div class="pagination-bottom" v-show="!bottomBox.showSubList">
|
|
|
|
|
|
<Pagination :tableId="tableId" :pageObj="pageObj" @pageNo='pageNo' @pageSize='pageSize' ref="Pagination"></Pagination>
|
2020-05-19 20:26:11 +08:00
|
|
|
|
</div>
|
2020-03-11 12:27:00 +08:00
|
|
|
|
</div>
|
2020-08-02 22:43:53 +08:00
|
|
|
|
<transition name="el-zoom-in-bottom">
|
2020-12-08 21:53:37 +08:00
|
|
|
|
<bottom-box :from="$CONSTANTS.fromRoute.model" :is-fullscreen="bottomBox.isFullScreen" :obj="bottomBox.model" :sub-resize-show="bottomBox.subResizeShow" :target-tab.sync="bottomBox.targetTab" v-if="bottomBox.showSubList"
|
2020-08-02 22:43:53 +08:00
|
|
|
|
@closeSubList="bottomBox.showSubList = false" @fullScreen="fullScreen" @exitFullScreen="exitFullScreen" @listResize="listResize" ref="panelBox"></bottom-box>
|
|
|
|
|
|
</transition>
|
2020-07-20 11:43:10 +08:00
|
|
|
|
<transition name="right-box">
|
|
|
|
|
|
<model-box v-if="rightBox.show" ref="modelBox" :model="model" @close="closeRightBox" @reload="getTableData"></model-box>
|
|
|
|
|
|
</transition>
|
2020-03-11 12:27:00 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<script>
|
2020-04-06 22:11:25 +08:00
|
|
|
|
import bus from '../../../libs/bus';
|
2020-10-29 19:11:46 +08:00
|
|
|
|
import deleteButton from "../../common/deleteButton";
|
2020-03-11 12:27:00 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
name: "model",
|
2020-10-29 19:11:46 +08:00
|
|
|
|
components: {
|
|
|
|
|
|
'delete-button':deleteButton,
|
|
|
|
|
|
},
|
2020-03-11 12:27:00 +08:00
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
2020-07-24 19:22:52 +08:00
|
|
|
|
/*二级页面相关*/
|
|
|
|
|
|
bottomBox: {
|
|
|
|
|
|
modelDetail: {}, //asset详情
|
|
|
|
|
|
model: {}, //告警信息对应的asset对象
|
|
|
|
|
|
mainResizeShow: true, //dom高度改变时是否展示|隐藏
|
|
|
|
|
|
subResizeShow: true,
|
|
|
|
|
|
isFullScreen: false, //全屏状态
|
|
|
|
|
|
showSubList: false, //是否显示二级列表
|
|
|
|
|
|
targetTab: '', //显示二级列表中的哪个页签
|
|
|
|
|
|
inTransform: false, //搜索框相关,搜索条件下拉框是否在transform里
|
|
|
|
|
|
},
|
2020-05-19 20:26:11 +08:00
|
|
|
|
mainTableHeight: this.$tableHeight.normal, //主列表table高度
|
2020-07-24 19:22:52 +08:00
|
|
|
|
/*工具参数*/
|
|
|
|
|
|
tools: {
|
|
|
|
|
|
loading: false, //是否显示table加载动画
|
|
|
|
|
|
toTopBtnTop: this.$tableHeight.toTopBtnTop, //to-top按钮的top属性
|
|
|
|
|
|
tableHover: false, //控制滚动条和top按钮同时出现
|
|
|
|
|
|
showTopBtn: false, //显示To top按钮
|
2020-08-04 21:53:06 +08:00
|
|
|
|
showCustomTableTitle: false, //自定义列弹框是否显示
|
|
|
|
|
|
customTableTitle: [], //自定义列工具的数据
|
2020-07-24 19:22:52 +08:00
|
|
|
|
},
|
2020-10-29 19:11:46 +08:00
|
|
|
|
batchDeleteObjs:[],
|
2020-03-13 12:20:02 +08:00
|
|
|
|
tableId: 'modelTable', //需要分页的table的id,用于记录每页数量
|
2020-04-21 18:00:21 +08:00
|
|
|
|
|
2020-07-20 11:43:10 +08:00
|
|
|
|
rightBox: {show: false},
|
2020-09-24 11:38:13 +08:00
|
|
|
|
|
2020-07-20 11:43:10 +08:00
|
|
|
|
model: {},
|
|
|
|
|
|
blankModel: {
|
2020-03-11 12:27:00 +08:00
|
|
|
|
id: '',
|
|
|
|
|
|
name: '',
|
|
|
|
|
|
vendor: {id: '', value: '', code: '', type: ''},
|
|
|
|
|
|
type: {id: '', value: '', code: '', type: ''},
|
|
|
|
|
|
assetStat: {total: '', inStock: '', outStock: ''},
|
2020-03-11 14:40:21 +08:00
|
|
|
|
remark: '',
|
|
|
|
|
|
vendorCode: '',
|
2020-04-07 22:30:36 +08:00
|
|
|
|
typeCode: '',
|
|
|
|
|
|
uSize:1,
|
2020-03-11 12:27:00 +08:00
|
|
|
|
},
|
|
|
|
|
|
pageObj: {
|
|
|
|
|
|
pageNo: 1,
|
2020-07-13 17:26:06 +08:00
|
|
|
|
pageSize: 50,
|
2020-03-11 12:27:00 +08:00
|
|
|
|
total: 0
|
|
|
|
|
|
},
|
|
|
|
|
|
tableTitle: [
|
|
|
|
|
|
{
|
|
|
|
|
|
label: 'ID',
|
|
|
|
|
|
prop: 'id',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
width: 80
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('overall.name'),
|
|
|
|
|
|
prop: 'name',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('overall.type'),
|
|
|
|
|
|
prop: 'type',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('config.model.vendor'),
|
|
|
|
|
|
prop: 'vendor',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t("config.model.assets"),
|
|
|
|
|
|
prop: 'assetStat',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('config.account.option'),
|
|
|
|
|
|
prop: 'option',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
width: 120
|
|
|
|
|
|
}
|
|
|
|
|
|
],
|
|
|
|
|
|
tableData: [],
|
|
|
|
|
|
searchMsg: { //给搜索框子组件传递的信息
|
|
|
|
|
|
zheze_none: true,
|
|
|
|
|
|
searchLabelList: [{
|
|
|
|
|
|
id: 1,
|
|
|
|
|
|
name: 'ID',
|
|
|
|
|
|
type: 'input',
|
|
|
|
|
|
label: 'id',
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
}, {
|
|
|
|
|
|
id: 5,
|
|
|
|
|
|
name: 'DC',
|
|
|
|
|
|
type: 'dc',
|
|
|
|
|
|
label: 'dc',
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
}],
|
|
|
|
|
|
},
|
|
|
|
|
|
searchLabel: {}, //搜索参数
|
2020-12-15 21:13:07 +08:00
|
|
|
|
scrollbarWrap: null,
|
2020-03-11 12:27:00 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
2020-04-16 18:49:55 +08:00
|
|
|
|
assetStatClassName(param) {
|
|
|
|
|
|
if (param.column.label == this.$t("config.model.assets")) {
|
|
|
|
|
|
return "asset-state";
|
|
|
|
|
|
}
|
|
|
|
|
|
return "";
|
|
|
|
|
|
},
|
2020-05-19 20:26:11 +08:00
|
|
|
|
panel(obj) {
|
2020-12-15 21:13:07 +08:00
|
|
|
|
if (!this.hasButton('model_chart_view')) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2020-07-24 19:22:52 +08:00
|
|
|
|
this.bottomBox.showSubList = true;
|
|
|
|
|
|
this.bottomBox.model = obj;
|
|
|
|
|
|
this.bottomBox.targetTab = "panel";
|
2020-05-19 20:26:11 +08:00
|
|
|
|
},
|
|
|
|
|
|
// 全屏
|
|
|
|
|
|
fullScreen() {
|
2020-07-20 11:43:10 +08:00
|
|
|
|
let vm = this;
|
2020-05-19 20:26:11 +08:00
|
|
|
|
this.$bottomBoxWindow.fullScreen(vm);
|
|
|
|
|
|
},
|
|
|
|
|
|
// 退出全屏
|
|
|
|
|
|
exitFullScreen() {
|
2020-07-20 11:43:10 +08:00
|
|
|
|
let vm = this;
|
2020-05-19 20:26:11 +08:00
|
|
|
|
this.$bottomBoxWindow.exitFullScreen(vm);
|
|
|
|
|
|
},
|
|
|
|
|
|
// 鼠标拖动二级列表
|
|
|
|
|
|
listResize(e) {
|
2020-07-20 11:43:10 +08:00
|
|
|
|
let vm = this;
|
2020-05-19 20:26:11 +08:00
|
|
|
|
this.$bottomBoxWindow.listResize(vm, e);
|
|
|
|
|
|
},
|
2020-07-20 11:43:10 +08:00
|
|
|
|
edit(u) {
|
2020-03-11 12:27:00 +08:00
|
|
|
|
this.model = Object.assign({}, u);
|
2020-07-20 11:43:10 +08:00
|
|
|
|
this.rightBox.show = true;
|
2020-03-11 12:27:00 +08:00
|
|
|
|
},
|
2020-07-20 11:43:10 +08:00
|
|
|
|
del(u) {
|
2020-03-11 12:27:00 +08:00
|
|
|
|
this.$confirm(this.$t("tip.confirmDelete"), {
|
|
|
|
|
|
confirmButtonText: this.$t("tip.yes"),
|
|
|
|
|
|
cancelButtonText: this.$t("tip.no"),
|
|
|
|
|
|
type: 'warning'
|
|
|
|
|
|
}).then(() => {
|
|
|
|
|
|
this.$delete("model?ids=" + u.id).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.$message({duration: 1000, type: 'success', message: this.$t("tip.deleteSuccess")});
|
|
|
|
|
|
this.getTableData();
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(response.msg);
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
2020-07-20 11:43:10 +08:00
|
|
|
|
add() {
|
|
|
|
|
|
this.model = this.newModel();
|
|
|
|
|
|
this.rightBox.show = true;
|
2020-03-11 12:27:00 +08:00
|
|
|
|
},
|
2020-07-20 11:43:10 +08:00
|
|
|
|
newModel() {
|
|
|
|
|
|
return JSON.parse(JSON.stringify(this.blankModel));
|
2020-03-11 12:27:00 +08:00
|
|
|
|
},
|
2020-07-20 11:43:10 +08:00
|
|
|
|
closeRightBox(refresh) {
|
2020-03-11 12:27:00 +08:00
|
|
|
|
this.rightBox.show = false;
|
2020-07-20 11:43:10 +08:00
|
|
|
|
if (refresh) {
|
|
|
|
|
|
this.getTableData();
|
|
|
|
|
|
}
|
2020-03-11 12:27:00 +08:00
|
|
|
|
},
|
|
|
|
|
|
jumpTo(data, id) {
|
2020-04-06 22:11:25 +08:00
|
|
|
|
bus.$emit("menu-change", data);
|
2020-03-11 12:27:00 +08:00
|
|
|
|
this.$router.push({
|
|
|
|
|
|
path: "/" + data,
|
|
|
|
|
|
query: {
|
|
|
|
|
|
t: +new Date()
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
2020-07-20 11:43:10 +08:00
|
|
|
|
getTableData() {
|
2020-12-15 21:13:07 +08:00
|
|
|
|
if (!this.hasButton('model_view')) {
|
|
|
|
|
|
this.$message.error(this.$t("tip.noAccess"));
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2020-03-11 12:27:00 +08:00
|
|
|
|
this.tableData = [];
|
|
|
|
|
|
this.$set(this.searchLabel, "pageNo", this.pageObj.pageNo);
|
|
|
|
|
|
this.$set(this.searchLabel, "pageSize", this.pageObj.pageSize);
|
2020-04-16 18:49:55 +08:00
|
|
|
|
this.$set(this.searchLabel, "stat", 1);
|
2020-07-24 19:22:52 +08:00
|
|
|
|
this.tools.loading = true;
|
2020-03-11 12:27:00 +08:00
|
|
|
|
this.$get('model', this.searchLabel).then(response => {
|
2020-07-24 19:22:52 +08:00
|
|
|
|
this.tools.loading = false;
|
2020-03-11 12:27:00 +08:00
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.tableData = response.data.list;
|
2020-12-14 20:25:24 +08:00
|
|
|
|
this.pageObj.total = response.data.total;
|
2020-12-15 21:13:07 +08:00
|
|
|
|
if (!this.scrollbarWrap) {
|
2020-12-14 20:25:24 +08:00
|
|
|
|
this.$nextTick(() => {
|
2020-12-15 21:13:07 +08:00
|
|
|
|
this.scrollbarWrap = this.$refs.modelTable.bodyWrapper;
|
|
|
|
|
|
this.toTopBtnHandler(this.scrollbarWrap);
|
2020-12-14 20:25:24 +08:00
|
|
|
|
});
|
|
|
|
|
|
}
|
2020-03-11 12:27:00 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
pageNo(val) {
|
|
|
|
|
|
this.pageObj.pageNo = val;
|
|
|
|
|
|
this.getTableData();
|
|
|
|
|
|
},
|
|
|
|
|
|
pageSize(val) {
|
|
|
|
|
|
this.pageObj.pageSize = val;
|
2020-03-13 12:20:02 +08:00
|
|
|
|
localStorage.setItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId, val);
|
2020-03-11 12:27:00 +08:00
|
|
|
|
this.getTableData();
|
|
|
|
|
|
},
|
2020-07-20 11:43:10 +08:00
|
|
|
|
search(searchObj) {
|
|
|
|
|
|
let orderBy = '';
|
|
|
|
|
|
if(this.searchLabel.orderBy) {
|
|
|
|
|
|
orderBy = this.searchLabel.orderBy
|
2020-07-15 18:32:25 +08:00
|
|
|
|
}
|
2020-03-11 12:27:00 +08:00
|
|
|
|
this.pageObj.pageNo = 1;
|
|
|
|
|
|
this.searchLabel = {};
|
|
|
|
|
|
for (let item in searchObj) {
|
|
|
|
|
|
if (searchObj[item]) {
|
|
|
|
|
|
this.$set(this.searchLabel, item, searchObj[item]);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-07-20 11:43:10 +08:00
|
|
|
|
if(orderBy) {
|
2020-07-15 18:32:25 +08:00
|
|
|
|
this.$set(this.searchLabel, 'orderBy', orderBy);
|
|
|
|
|
|
}
|
2020-11-17 09:05:43 +08:00
|
|
|
|
if(this.$refs.modelTable&&this.$refs.modelTable.bodyWrapper){
|
|
|
|
|
|
this.$refs.modelTable.bodyWrapper.scrollTop = 0;
|
|
|
|
|
|
}
|
2020-03-11 12:27:00 +08:00
|
|
|
|
this.getTableData();
|
|
|
|
|
|
},
|
2020-07-15 18:32:25 +08:00
|
|
|
|
// 数据排序
|
2020-07-20 11:43:10 +08:00
|
|
|
|
tableDataSort(item) {
|
2020-07-15 18:32:25 +08:00
|
|
|
|
let orderBy='';
|
|
|
|
|
|
if(item.order==='ascending'){
|
|
|
|
|
|
orderBy=item.prop;
|
|
|
|
|
|
}
|
|
|
|
|
|
if(item.order==='descending'){
|
|
|
|
|
|
orderBy='-'+item.prop;
|
|
|
|
|
|
}
|
|
|
|
|
|
this.$set(this.searchLabel, "orderBy", orderBy);
|
|
|
|
|
|
this.getTableData();
|
|
|
|
|
|
},
|
2020-03-11 12:27:00 +08:00
|
|
|
|
},
|
2020-11-21 12:21:27 +08:00
|
|
|
|
created(){
|
|
|
|
|
|
//是否存在分页缓存
|
|
|
|
|
|
let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);
|
|
|
|
|
|
if (pageSize != 'undefined' && pageSize != null) {
|
|
|
|
|
|
this.pageObj.pageSize = pageSize
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2020-07-20 11:43:10 +08:00
|
|
|
|
mounted() {
|
2020-08-04 21:53:06 +08:00
|
|
|
|
//初始化表头
|
|
|
|
|
|
this.tools.customTableTitle = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path)
|
|
|
|
|
|
? JSON.parse(localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path))
|
|
|
|
|
|
: this.tableTitle;
|
2020-10-30 15:54:47 +08:00
|
|
|
|
this.tableTitleReset(this.tableTitle,this.tools.customTableTitle);
|
2020-03-13 12:20:02 +08:00
|
|
|
|
|
2020-03-11 12:27:00 +08:00
|
|
|
|
this.getTableData();
|
|
|
|
|
|
},
|
|
|
|
|
|
watch: {
|
2020-07-24 19:22:52 +08:00
|
|
|
|
'bottomBox.showSubList': function(n) {
|
2020-07-20 11:43:10 +08:00
|
|
|
|
let vm = this;
|
2020-05-19 20:26:11 +08:00
|
|
|
|
this.$bottomBoxWindow.showSubListWatch(vm, n);
|
|
|
|
|
|
},
|
2020-11-20 15:02:36 +08:00
|
|
|
|
},
|
2020-12-14 20:25:24 +08:00
|
|
|
|
beforeDestroy() {
|
|
|
|
|
|
this.scrollbarWrap.removeEventListener('scroll', bus.debounce);
|
2020-03-11 12:27:00 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
2020-07-24 19:22:52 +08:00
|
|
|
|
`
|