2020-03-11 12:27:00 +08:00
|
|
|
|
<template>
|
2021-04-08 20:28:54 +08:00
|
|
|
|
<div style="height: 100%">
|
|
|
|
|
|
<nz-data-list
|
|
|
|
|
|
ref="dataList"
|
|
|
|
|
|
:components="['searchInput', 'elementSet']"
|
|
|
|
|
|
:custom-table-title.sync="tools.customTableTitle"
|
|
|
|
|
|
:from="fromRoute.model"
|
|
|
|
|
|
:search-msg="searchMsg"
|
|
|
|
|
|
:table-id="tableId"
|
|
|
|
|
|
:table-title="tableTitle">
|
|
|
|
|
|
<template v-slot:top-tool-right>
|
|
|
|
|
|
<button id="model-add" v-has="'model_toAdd'" :title="$t('overall.createModel')" class="top-tool-btn margin-l-20" @click="add">
|
|
|
|
|
|
<i class="nz-icon-create-square nz-icon"></i>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<delete-button id="model-list-batch-delete" v-has="'model_delete'" :delete-objs="batchDeleteObjs" api="model" @after="getTableData" @before="delFlag=true"></delete-button>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-slot:default="slotProps">
|
|
|
|
|
|
<el-table
|
|
|
|
|
|
id="model-list-table"
|
|
|
|
|
|
ref="dataTable"
|
|
|
|
|
|
v-loading="tools.loading"
|
|
|
|
|
|
:data="tableData"
|
|
|
|
|
|
:height="mainTableHeight"
|
|
|
|
|
|
border
|
|
|
|
|
|
@header-dragend="dragend"
|
|
|
|
|
|
@sort-change="tableDataSort"
|
|
|
|
|
|
@selection-change="(selection)=>{batchDeleteObjs=selection}"
|
2021-04-07 09:58:34 +08:00
|
|
|
|
>
|
|
|
|
|
|
<el-table-column
|
|
|
|
|
|
:resizable="false"
|
|
|
|
|
|
align="center"
|
|
|
|
|
|
type="selection"
|
|
|
|
|
|
width="55">
|
|
|
|
|
|
</el-table-column>
|
2021-04-08 20:28:54 +08:00
|
|
|
|
<el-table-column
|
|
|
|
|
|
v-for="(item, index) in tools.customTableTitle"
|
|
|
|
|
|
v-if="item.show"
|
|
|
|
|
|
:key="`col-${index}`"
|
|
|
|
|
|
:fixed="item.fixed"
|
|
|
|
|
|
:label="item.label"
|
|
|
|
|
|
:prop="item.prop"
|
|
|
|
|
|
:resizable="true"
|
|
|
|
|
|
:sort-orders="['ascending', 'descending']"
|
|
|
|
|
|
:width="`${item.width}`"
|
|
|
|
|
|
class="data-column"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template slot="header">
|
|
|
|
|
|
<span>
|
|
|
|
|
|
<span>{{item.label}}</span>
|
|
|
|
|
|
<div class="col-resize-area"></div>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</template>
|
2021-04-07 09:58:34 +08:00
|
|
|
|
<template slot-scope="scope" :column="item">
|
2021-04-08 20:28:54 +08:00
|
|
|
|
<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" >
|
2021-04-07 09:58:34 +08:00
|
|
|
|
<el-popover
|
|
|
|
|
|
: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"
|
|
|
|
|
|
placement="top"
|
|
|
|
|
|
trigger="hover">
|
2021-04-08 20:28:54 +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>
|
|
|
|
|
|
<span class="dc-asset-state dc-asset-state-suspended">{{scope.row.assetStat.suspended}}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</el-popover>
|
2021-04-07 09:58:34 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else-if="scope.row[item.prop]">{{scope.row[item.prop]}}</template>
|
|
|
|
|
|
<template v-else>-</template>
|
2020-05-19 20:26:11 +08:00
|
|
|
|
</template>
|
2021-04-07 09:58:34 +08:00
|
|
|
|
</el-table-column>
|
2021-04-08 20:28:54 +08:00
|
|
|
|
<el-table-column
|
|
|
|
|
|
:resizable="false"
|
|
|
|
|
|
:width="operationWidth"
|
|
|
|
|
|
fixed="right">
|
|
|
|
|
|
<div slot="header" class="table-operation-title">{{$t('overall.option')}}</div>
|
|
|
|
|
|
<div slot-scope="scope" class="table-operation-items">
|
|
|
|
|
|
<button class="table-operation-item" @click="$refs.dataList.showBottomBox('operationLog', scope.row)"><i class="nz-icon nz-icon-view1"></i></button>
|
|
|
|
|
|
<el-dropdown size="medium" trigger="hover" @command="tableOperation">
|
|
|
|
|
|
<div class="table-operation-item table-operation-item--more">
|
|
|
|
|
|
<span>…</span><i class="nz-icon nz-icon-arrow-down"></i>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<el-dropdown-menu slot="dropdown">
|
|
|
|
|
|
<el-dropdown-item :command="['edit', scope.row]" :disabled="isBuildIn(scope.row)"><i class="nz-icon nz-icon-edit"></i><span class="operation-dropdown-text">{{$t('overall.edit')}}</span></el-dropdown-item>
|
|
|
|
|
|
<el-dropdown-item :command="['delete', scope.row, `sys/role?ids=${scope.row.id}`]" :disabled="isBuildIn(scope.row)"><i class="nz-icon nz-icon-delete"></i><span class="operation-dropdown-text">{{$t('overall.delete')}}</span></el-dropdown-item>
|
|
|
|
|
|
</el-dropdown-menu>
|
|
|
|
|
|
</el-dropdown>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</el-table-column>
|
2021-04-07 09:58:34 +08:00
|
|
|
|
</el-table>
|
2021-04-08 20:28:54 +08:00
|
|
|
|
<!-- 回到table顶部的按钮 -->
|
|
|
|
|
|
<button v-show="tools.showTopBtn && slotProps.mainResizeShow" id="role-list-totop" :class="{'to-top-is-hover': tools.tableHover}" :style="{top: tools.toTopBtnTop}" class="to-top" @click="toTop(scrollbarWrap)"><i class="nz-icon nz-icon-top"></i></button>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<!-- 分页组件 -->
|
|
|
|
|
|
<template v-slot:pagination>
|
|
|
|
|
|
<Pagination ref="Pagination" :pageObj="pageObj" :tableId="tableId" @pageNo='pageNo' @pageSize='pageSize'></Pagination>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</nz-data-list>
|
2020-07-20 11:43:10 +08:00
|
|
|
|
<transition name="right-box">
|
2021-04-08 20:28:54 +08:00
|
|
|
|
<model-box v-if="rightBox.show" ref="modelBox" :model="object" @close="closeRightBox" @reload="getTableData"></model-box>
|
2020-07-20 11:43:10 +08:00
|
|
|
|
</transition>
|
2020-03-11 12:27:00 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<script>
|
2021-04-08 20:28:54 +08:00
|
|
|
|
import modelBox from '@/components/common/rightBox/modelBox'
|
|
|
|
|
|
import deleteButton from '@/components/common/deleteButton'
|
|
|
|
|
|
import nzDataList from '@/components/common/table/nzDataList'
|
|
|
|
|
|
import tableMixin from '@/components/common/mixin/table'
|
2021-03-19 18:52:19 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
name: 'model',
|
|
|
|
|
|
components: {
|
2021-04-08 20:28:54 +08:00
|
|
|
|
deleteButton,
|
|
|
|
|
|
modelBox,
|
|
|
|
|
|
nzDataList
|
2021-03-19 18:52:19 +08:00
|
|
|
|
},
|
2021-04-08 20:28:54 +08:00
|
|
|
|
mixins: [tableMixin],
|
2021-03-19 18:52:19 +08:00
|
|
|
|
data () {
|
|
|
|
|
|
return {
|
|
|
|
|
|
tableId: 'modelTable', // 需要分页的table的id,用于记录每页数量
|
|
|
|
|
|
|
2021-04-08 20:28:54 +08:00
|
|
|
|
blankObject: {
|
2021-03-19 18:52:19 +08:00
|
|
|
|
id: '',
|
|
|
|
|
|
name: '',
|
|
|
|
|
|
vendor: { id: '', value: '', code: '', type: '' },
|
|
|
|
|
|
type: { id: '', value: '', code: '', type: '' },
|
|
|
|
|
|
assetStat: { total: '', inStock: '', outStock: '' },
|
|
|
|
|
|
remark: '',
|
|
|
|
|
|
vendorCode: '',
|
|
|
|
|
|
typeCode: '',
|
|
|
|
|
|
uSize: 1
|
2020-03-11 12:27:00 +08:00
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
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
|
2020-07-20 11:43:10 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
],
|
|
|
|
|
|
searchMsg: { // 给搜索框子组件传递的信息
|
|
|
|
|
|
zheze_none: true,
|
|
|
|
|
|
searchLabelList: [{
|
|
|
|
|
|
id: 1,
|
|
|
|
|
|
name: 'ID',
|
|
|
|
|
|
type: 'input',
|
|
|
|
|
|
label: 'id',
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
}, {
|
|
|
|
|
|
id: 5,
|
|
|
|
|
|
name: this.$t('config.promServer.dataCenter'),
|
|
|
|
|
|
type: 'dc',
|
|
|
|
|
|
label: 'dc',
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
}]
|
2021-04-08 20:28:54 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
assetStatClassName (param) {
|
|
|
|
|
|
if (param.column.label == this.$t('config.model.assets')) {
|
|
|
|
|
|
return 'asset-state'
|
|
|
|
|
|
}
|
|
|
|
|
|
return ''
|
|
|
|
|
|
},
|
|
|
|
|
|
panel (obj) {
|
|
|
|
|
|
if (!this.hasButton('model_chart_view')) {
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
this.bottomBox.showSubList = true
|
|
|
|
|
|
this.bottomBox.model = obj
|
|
|
|
|
|
this.bottomBox.targetTab = 'panel'
|
|
|
|
|
|
},
|
|
|
|
|
|
getTableData () {
|
|
|
|
|
|
if (!this.hasButton('model_view')) {
|
|
|
|
|
|
this.$message.error(this.$t('tip.noAccess'))
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo)
|
|
|
|
|
|
this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize)
|
|
|
|
|
|
this.$set(this.searchLabel, 'stat', 1)
|
|
|
|
|
|
this.tools.loading = true
|
|
|
|
|
|
this.$get('model', this.searchLabel).then(response => {
|
|
|
|
|
|
this.tools.loading = false
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.tableData = response.data.list
|
|
|
|
|
|
this.pageObj.total = response.data.total
|
|
|
|
|
|
if (!this.scrollbarWrap) {
|
|
|
|
|
|
this.$nextTick(() => {
|
2021-04-08 20:28:54 +08:00
|
|
|
|
this.scrollbarWrap = this.$refs.dataTable.bodyWrapper
|
2021-03-19 18:52:19 +08:00
|
|
|
|
this.toTopBtnHandler(this.scrollbarWrap)
|
|
|
|
|
|
})
|
2020-03-11 12:27:00 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
})
|
2020-03-11 12:27:00 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
}
|
2020-03-11 12:27:00 +08:00
|
|
|
|
</script>
|
2020-07-24 19:22:52 +08:00
|
|
|
|
`
|