NEZ-3349 feat:software asset列表页面开发
This commit is contained in:
@@ -83,11 +83,11 @@
|
||||
<!-- notebook Tab -->
|
||||
<notebook-tab @getTableData="getTableData" v-if="from === fromRoute.notebook && targetTab === 'notebookTab'" :from="from" :obj="obj" :tabs="tabs.notebook" @changeTab="changeTab" :targetTab.sync="targetTab"></notebook-tab>
|
||||
<!--softwareAsset列表的tab-->
|
||||
<endpointTabNew v-if="from === fromRoute.softwareAsset && targetTab === 'endpoint'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="softwareAssetTbas" :targetTab="targetTab" @changeTab="changeTab"></endpointTabNew>
|
||||
<licenseManagementTab v-if="from === fromRoute.softwareAsset && targetTab === 'licenseManagement'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="softwareAssetTbas" :targetTab="targetTab" @changeTab="changeTab"></licenseManagementTab>
|
||||
<!-- <endpointTabNew v-if="from === fromRoute.softwareAsset && targetTab === 'endpoint'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="softwareAssetTbas" :targetTab="targetTab" @changeTab="changeTab"></endpointTabNew> -->
|
||||
<!-- <licenseManagementTab v-if="from === fromRoute.softwareAsset && targetTab === 'licenseManagement'" v-show="subResizeShow" :from="from" :obj="obj" :tabs="softwareAssetTbas" :targetTab="targetTab" @changeTab="changeTab"></licenseManagementTab> -->
|
||||
|
||||
<!--softwareType 下滑-->
|
||||
<softwareAsset v-if="(from === fromRoute.softwareType) && targetTab === 'softwareAsset'" :tabs="tabs.softwareType" ref="assetTab" :from="from" :obj="obj" @changeTab="changeTab" @exit="closeSubList" :targetTab.sync="targetTab"></softwareAsset>
|
||||
<softwareAssetTab v-if="(from === fromRoute.softwareType) && targetTab === 'softwareAsset'" :tabs="tabs.softwareType" ref="assetTab" :from="from" :obj="obj" @changeTab="changeTab" @exit="closeSubList" :targetTab.sync="targetTab"></softwareAssetTab>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -126,7 +126,7 @@ import discoveryTab from '@/components/common/bottomBox/tabs/discoveryTab'
|
||||
import IpDetails from '@/components/common/bottomBox/tabs/IpDetails'
|
||||
import recordRuleEvalLog from '@/components/common/bottomBox/tabs/recordRuleEvalLog'
|
||||
import notebookTab from '@/components/common/bottomBox/tabs/notebookTab'
|
||||
import softwareAsset from '@/components/common/bottomBox/tabs/softwareAsset'
|
||||
import softwareAssetTab from '@/components/common/bottomBox/tabs/softwareAssetTab'
|
||||
import licenseManagementTab from '@/components/common/bottomBox/tabs/licenseManagementTab'
|
||||
|
||||
export default {
|
||||
@@ -163,7 +163,7 @@ export default {
|
||||
vsysBottomTab,
|
||||
rolesTab,
|
||||
notebookTab,
|
||||
softwareAsset,
|
||||
softwareAssetTab,
|
||||
licenseManagementTab
|
||||
},
|
||||
props: {
|
||||
|
||||
@@ -1,57 +1,62 @@
|
||||
<template>
|
||||
<nz-bottom-data-list
|
||||
:showTitle='showTitle'
|
||||
:obj='obj'
|
||||
:targetTab.sync="targetTab"
|
||||
:api="url"
|
||||
style="height: 100%"
|
||||
:custom-table-title.sync="tools.customTableTitle"
|
||||
:layout="['searchInput', 'elementSet']"
|
||||
:search-msg="searchMsg"
|
||||
:tableId="tableId"
|
||||
:tabs="tabs"
|
||||
@search="search"
|
||||
@changeTab="changeTab"
|
||||
>
|
||||
<template v-slot:title><span :title="obj.name">{{obj.name}}</span></template>
|
||||
<template v-slot>
|
||||
<softwareAssetTable
|
||||
ref="dataTable"
|
||||
:orderByFa="orderBy"
|
||||
v-my-loading="tools.loading"
|
||||
:loading="tools.loading"
|
||||
:api="url"
|
||||
:custom-table-title="tools.customTableTitle"
|
||||
:height="mainTableHeight"
|
||||
:table-data="tableData"
|
||||
@del="del"
|
||||
@edit="edit"
|
||||
@copy="copy"
|
||||
@orderBy="tableDataSort"
|
||||
@reload="getTableData"
|
||||
@selectionChange="selectionChange"
|
||||
@showBottomBox="(targetTab, object) => { $refs.dataList.showBottomBox(targetTab, object) }"></softwareAssetTable>
|
||||
</template>
|
||||
<template v-slot:pagination>
|
||||
<Pagination ref="Pagination" :pageObj="pageObj" :tableId="tableId" @pageNo='pageNo' @pageSize='pageSize'></Pagination>
|
||||
</template>
|
||||
</nz-bottom-data-list>
|
||||
<div>
|
||||
<nz-bottom-data-list
|
||||
:showTitle='showTitle'
|
||||
:obj='obj'
|
||||
:targetTab.sync="targetTab"
|
||||
:api="url"
|
||||
style="height: 100%"
|
||||
:custom-table-title.sync="tools.customTableTitle"
|
||||
:layout="['searchInput', 'elementSet']"
|
||||
:search-msg="searchMsg"
|
||||
:tableId="tableId"
|
||||
:tabs="tabs"
|
||||
@search="search"
|
||||
@changeTab="changeTab"
|
||||
>
|
||||
<template v-slot:title><span :title="obj.name">{{obj.name}}</span></template>
|
||||
<template v-slot>
|
||||
<softwareAssetTable
|
||||
ref="dataTable"
|
||||
:orderByFa="orderBy"
|
||||
v-my-loading="tools.loading"
|
||||
:loading="tools.loading"
|
||||
:api="url"
|
||||
:custom-table-title="tools.customTableTitle"
|
||||
:height="subTableHeight"
|
||||
:table-data="tableData"
|
||||
@del="del"
|
||||
@edit="edit"
|
||||
@copy="copy"
|
||||
@orderBy="tableDataSort"
|
||||
@reload="getTableData"
|
||||
@selectionChange="selectionChange"
|
||||
@showBottomBox="(targetTab, object) => { $refs.dataList.showBottomBox(targetTab, object) }"></softwareAssetTable>
|
||||
</template>
|
||||
<template v-slot:pagination>
|
||||
<Pagination ref="Pagination" :pageObj="pageObj" :tableId="tableId" @pageNo='pageNo' @pageSize='pageSize'></Pagination>
|
||||
</template>
|
||||
</nz-bottom-data-list>
|
||||
<transition name="right-box">
|
||||
<softwareAssetBox v-if="rightBox.show" :obj="object" @close="closeRightBox"></softwareAssetBox>
|
||||
</transition>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import dataListMixin from '@/components/common/mixin/dataList'
|
||||
import subDataListMixin from '@/components/common/mixin/subDataList'
|
||||
import nzBottomDataList from '@/components/common/bottomBox/nzBottomDataList'
|
||||
import { fromRoute } from '@/components/common/js/constants'
|
||||
import detailViewRightMixin from '@/components/common/mixin/detailViewRightMixin'
|
||||
import softwareAssetTable from '@/components/common/table/settings/softwareAssetTable'
|
||||
|
||||
import softwareAssetBox from '@/components/common/rightBox/software/softwareAssetBox'
|
||||
export default {
|
||||
name: 'softwareAssetTab',
|
||||
mixins: [dataListMixin, subDataListMixin, detailViewRightMixin],
|
||||
components: {
|
||||
nzBottomDataList,
|
||||
softwareAssetTable
|
||||
softwareAssetTable,
|
||||
softwareAssetBox
|
||||
},
|
||||
computed: {
|
||||
externalTerminal () {
|
||||
@@ -89,14 +94,6 @@ export default {
|
||||
},
|
||||
objectSilence: {},
|
||||
silenceBoxShow: false,
|
||||
searchLabel: { dcIds: this.obj.id },
|
||||
brandData: [],
|
||||
modelData: [],
|
||||
stateData: [],
|
||||
typeData: [],
|
||||
dcData: [],
|
||||
snmpCredentialData: [],
|
||||
fieldGroupData: [],
|
||||
needAlertDaysData: true,
|
||||
trendKey: 'assetId',
|
||||
fromBottom: true
|
||||
@@ -163,19 +160,10 @@ export default {
|
||||
this.tableData = response.data.list
|
||||
const globalSearchId = this.$store.getters.getGlobalSearchId
|
||||
let detailViewRightObj = ''
|
||||
if (this.tableId === 'notebookTable' && this.detailType === 'view') { // 防止详情视图编辑后切换到别的数据
|
||||
const obj = this.tableData.find(item => item.id === this.detailViewRightObj.id)
|
||||
if (obj) {
|
||||
detailViewRightObj = obj
|
||||
} else {
|
||||
detailViewRightObj = this.tableData[0]
|
||||
}
|
||||
if (globalSearchId) {
|
||||
detailViewRightObj = this.tableData.find(item => item.id === globalSearchId)
|
||||
} else {
|
||||
if (globalSearchId) {
|
||||
detailViewRightObj = this.tableData.find(item => item.id === globalSearchId)
|
||||
} else {
|
||||
detailViewRightObj = this.tableData[0]
|
||||
}
|
||||
detailViewRightObj = this.tableData[0]
|
||||
}
|
||||
this.detailViewRightObj = this.$lodash.cloneDeep(detailViewRightObj)
|
||||
this.pageObj.total = response.data.total
|
||||
@@ -193,7 +181,7 @@ export default {
|
||||
this.$message.error(response.error || response.msg)
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
obj: {
|
||||
@@ -447,22 +447,24 @@ export default {
|
||||
if (!tableTitle || !this.tableId) {
|
||||
return
|
||||
}
|
||||
const preferenceTableTitle = (tableHeaders && tableHeaders.length) ? tableHeaders : tableTitle
|
||||
if (tableTitle) {
|
||||
// 先根据本地缓存中的prop进行排序
|
||||
tableTitle.sort(function (a, b) {
|
||||
return preferenceTableTitle.findIndex(function (c) {
|
||||
return c.prop === a.prop
|
||||
}) - preferenceTableTitle.findIndex(function (c) {
|
||||
return c.prop === b.prop
|
||||
})
|
||||
})
|
||||
this.tools.customTableTitle = tableTitle.map((item, index) => { // 修复切换中英文的问题
|
||||
item.show = preferenceTableTitle[index].show
|
||||
return item
|
||||
})
|
||||
}
|
||||
if (preferenceTableTitle && (preferenceTableTitle.length > tableTitle.length)) {
|
||||
let preferenceTableTitle = (tableHeaders && tableHeaders.length) ? tableHeaders : tableTitle
|
||||
preferenceTableTitle = preferenceTableTitle.filter(item => tableTitle.find(t => item.prop === t.prop || item.type === 'label'))
|
||||
|
||||
// 先根据本地缓存中的prop进行排序
|
||||
tableTitle.sort((a, b) => {
|
||||
const indexA = preferenceTableTitle.findIndex(item => item.prop === a.prop)
|
||||
const indexB = preferenceTableTitle.findIndex(item => item.prop === b.prop)
|
||||
if (indexA === -1) return 1
|
||||
if (indexB === -1) return -1
|
||||
return indexA - indexB
|
||||
})
|
||||
|
||||
this.tools.customTableTitle = tableTitle.map((item, index) => { // 修复切换中英文的问题
|
||||
item.show = preferenceTableTitle[index] ? preferenceTableTitle[index].show : true
|
||||
return item
|
||||
})
|
||||
|
||||
if (preferenceTableTitle.length > tableTitle.length) { // asset label
|
||||
const arr = preferenceTableTitle.splice(tableTitle.length, preferenceTableTitle.length)
|
||||
arr.forEach(item => {
|
||||
item.minWidth = item.label.length * 16 + 20
|
||||
@@ -832,10 +834,10 @@ export default {
|
||||
},
|
||||
jsonKey: 'val'
|
||||
},
|
||||
dc: {
|
||||
dcIds: {
|
||||
target: this.searchLabel,
|
||||
isSearchInput: true,
|
||||
propertyName: 'dc',
|
||||
propertyName: 'dcIds',
|
||||
type: 'number',
|
||||
defaultJson: {
|
||||
name: 'Date center',
|
||||
@@ -1135,10 +1137,10 @@ export default {
|
||||
},
|
||||
jsonKey: 'val'
|
||||
},
|
||||
dc: {
|
||||
dcIds: {
|
||||
target: this.searchLabel,
|
||||
isSearchInput: true,
|
||||
propertyName: 'dc',
|
||||
propertyName: 'dcIds',
|
||||
type: 'number',
|
||||
defaultJson: {
|
||||
name: 'Date center',
|
||||
|
||||
@@ -75,17 +75,14 @@ export default {
|
||||
break
|
||||
}
|
||||
case 'sync': {
|
||||
// this.$emit('copy', row)
|
||||
this.$emit('sync', row)
|
||||
break
|
||||
}
|
||||
case 'fastSilence': {
|
||||
// this.$emit('copy', row)
|
||||
this.$emit('addSilence', row, param)
|
||||
break
|
||||
}
|
||||
case 'topology': {
|
||||
// this.$emit('copy', row)
|
||||
this.$emit('topology', row, param)
|
||||
break
|
||||
}
|
||||
|
||||
@@ -43,6 +43,14 @@
|
||||
</template>
|
||||
</copy>
|
||||
</template>
|
||||
<template v-else-if="item.prop === 'category'">
|
||||
<div>
|
||||
{{scope.row.type ? scope.row.type.category : '-'}}
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="item.prop === 'type'">
|
||||
{{scope.row.type ? scope.row.type.name : '-'}}
|
||||
</template>
|
||||
<template v-else-if="item.prop === 'asset'">
|
||||
<div>
|
||||
<div class="document-copy-block" v-if="scope.row.asset">
|
||||
@@ -59,27 +67,18 @@
|
||||
<span v-else>--</span>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="item.prop === 'category'">
|
||||
<div>
|
||||
{{scope.row.type ? scope.row.type.category : '-'}}
|
||||
<span v-else-if="item.prop === 'dateIssued' || item.prop === 'dateExpires'">{{ scope.row[item.prop] ? momentTz(scope.row[item.prop] ) : '-'}}</span>
|
||||
<!-- status -->
|
||||
<template v-else-if="item.prop === 'status'">
|
||||
<div v-if="scope.row.status === 1">
|
||||
<i class="nz-icon nz-icon-import-success1" style="color:#8dcb4b;"></i>
|
||||
<span>{{$t('licenseMange.licensed')}}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="item.prop === 'project'">
|
||||
<div>
|
||||
<div class="document-copy-block" v-if="scope.row.project">
|
||||
<span class="document-copy-text"
|
||||
:title="scope.row[item.prop].name"
|
||||
@mouseenter="labelHover(scope.row, item.prop, true,true, $event)"
|
||||
@mouseleave="labelHover(scope.row, item.prop, false,true)">
|
||||
{{scope.row[item.prop].name}}
|
||||
</span>
|
||||
<i v-if="scope.row[item.prop].name" class="nz-icon nz-icon-override" style="visibility: hidden" @click="onCopy(scope.row[item.prop].name)" :title="$t('overall.copyText')"></i>
|
||||
</div>
|
||||
<span v-else>--</span>
|
||||
<div v-else-if="scope.row.status == 2">
|
||||
<i class="nz-icon nz-icon-stop" style="color:#bebebe;"></i>
|
||||
<span>{{ $t('licenseMange.notLicensed') }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="item.prop === 'type'">
|
||||
{{scope.row.type ? scope.row.type.name : '-'}}
|
||||
<div v-else>-</div>
|
||||
</template>
|
||||
<span v-else-if="scope.row[item.prop]" :class="item.prop === 'remark'? 'el-table-remark':''">{{scope.row[item.prop]}}</span>
|
||||
<span v-else>-</span>
|
||||
@@ -91,16 +90,21 @@
|
||||
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" v-has="'softwareAsset_edit'" @click="$emit('edit', scope.row)" :title="$t('overall.edit')"><i class="nz-icon nz-icon-edit"></i></button> -->
|
||||
<button class="table-operation-item" @click="showBottomBox('endpoint', scope.row)" :title="$t('overall.view')"><i class="nz-icon nz-icon-view1"></i></button>
|
||||
<el-dropdown size="medium" v-has="['softwareAsset_delete','main_edit','softwareAsset_edit']" trigger="click" @command="tableOperation">
|
||||
<!-- <button class="table-operation-item" @click="showBottomBox('endpoint', scope.row)" :title="$t('overall.view')"><i class="nz-icon nz-icon-view1"></i></button> -->
|
||||
<button class="table-operation-item" v-has="'softwareAsset_edit'" @click="tableOperation(['edit', scope.row])" :title="$t('overall.edit')"><i class="nz-icon nz-icon-edit"></i></button>
|
||||
<el-dropdown size="medium" v-has="['softwareAsset_edit','softwareAsset_add','softwareAsset_delete']" trigger="click" @command="tableOperation">
|
||||
<div class="table-operation-item table-operation-item--more" :title="$t('overall.moreOperations')">
|
||||
<i class="nz-icon nz-icon-more3"></i>
|
||||
</div>
|
||||
<el-dropdown-menu slot="dropdown" class="right-box-select-top right-public-box-dropdown-top">
|
||||
<el-dropdown-item v-has="'softwareAsset_edit'" :command="['edit', 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 v-has="'softwareAsset_edit'" :command="['copy', scope.row]"><i class="nz-icon nz-icon-override"></i><span class="operation-dropdown-text">{{$t('overall.duplicate')}}</span></el-dropdown-item>
|
||||
<el-dropdown-item v-has="'softwareAsset_delete'" :command="['delete-rel', scope.row, {forceDeleteShow:true, single:true,from:'model'}]"><i class="nz-icon nz-icon-delete"></i><span class="operation-dropdown-text">{{$t('overall.delete')}}</span></el-dropdown-item>
|
||||
<el-dropdown-item v-has="'softwareAsset_add'" :command="['copy', scope.row]"><i class="nz-icon nz-icon-override"></i><span class="operation-dropdown-text">{{$t('overall.duplicate')}}</span></el-dropdown-item>
|
||||
<el-dropdown-item v-has="'softwareAsset_delete'" :command="['delete-rel', scope.row, {forceDeleteShow:true, single:true,from:'softwareAsset'}]"><i class="nz-icon nz-icon-delete"></i><span class="operation-dropdown-text">{{$t('overall.delete')}}</span></el-dropdown-item>
|
||||
<el-dropdown-item v-has="'softwareAsset_edit'" :command="['upload', scope.row]" @click.native="upload(scope.row)">
|
||||
<i class="nz-icon nz-icon-upload"></i><span class="operation-dropdown-text">{{$t('softwareAsset.upload')}}</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item v-has="'softwareAsset_edit'" :command="['download', scope.row]" @click.native="download(scope.row)">
|
||||
<i class="nz-icon nz-icon-download1"></i><span class="operation-dropdown-text">{{$t('softwareAsset.download')}}</span>
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
@@ -121,6 +125,15 @@
|
||||
:that="alertLabelObj"
|
||||
:type="alertLabelType"
|
||||
></alertLabel>
|
||||
<el-upload
|
||||
action=""
|
||||
:auto-upload="false"
|
||||
accept=".v2c,.V2CP,.H2R,.R2H,.H2H,.ID "
|
||||
:on-change="uploadChange"
|
||||
style="display: none"
|
||||
ref="upload"
|
||||
>
|
||||
</el-upload>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -128,8 +141,9 @@
|
||||
import table from '@/components/common/mixin/table'
|
||||
import copy from '@/components/common/copy'
|
||||
import alertLabelMixin from '@/components/common/mixin/alertLabelMixin'
|
||||
import axios from 'axios'
|
||||
export default {
|
||||
name: 'softwareTypeTable',
|
||||
name: 'softwareTable',
|
||||
mixins: [table, alertLabelMixin],
|
||||
components: { copy },
|
||||
props: {
|
||||
@@ -143,13 +157,13 @@ export default {
|
||||
label: 'ID',
|
||||
prop: 'id',
|
||||
show: true,
|
||||
width: 120,
|
||||
width: 80,
|
||||
sortable: 'custom'
|
||||
}, {
|
||||
label: this.$t('overall.name'),
|
||||
prop: 'name',
|
||||
show: true,
|
||||
width: 350,
|
||||
width: 200,
|
||||
sortable: 'custom'
|
||||
}, {
|
||||
label: this.$t('softwareType.category'),
|
||||
@@ -157,62 +171,113 @@ export default {
|
||||
show: true,
|
||||
minWidth: 200,
|
||||
sortable: 'custom'
|
||||
},
|
||||
// {
|
||||
// label: this.$t('config.menus.icon'),
|
||||
// prop: 'icon',
|
||||
// show: true,
|
||||
// width: 120,
|
||||
// sortable: 'custom'
|
||||
// },
|
||||
{
|
||||
}, {
|
||||
label: this.$t('overall.type'),
|
||||
prop: 'type',
|
||||
minWidth: 200,
|
||||
show: true
|
||||
},
|
||||
{
|
||||
label: this.$t('project.project.projectName'),
|
||||
prop: 'project',
|
||||
minWidth: 200,
|
||||
show: true
|
||||
}, {
|
||||
label: this.$t('asset.asset'),
|
||||
prop: 'asset',
|
||||
minWidth: 200,
|
||||
show: true
|
||||
},
|
||||
|
||||
{
|
||||
}, {
|
||||
label: this.$t('licenseMange.dateIssue'),
|
||||
prop: 'dateIssued',
|
||||
minWidth: 200,
|
||||
show: true
|
||||
}, {
|
||||
label: this.$t('licenseMange.dateExpire'),
|
||||
prop: 'dateExpires',
|
||||
minWidth: 200,
|
||||
show: true
|
||||
}, {
|
||||
label: this.$t('licenseMange.licenseStatus'),
|
||||
prop: 'status',
|
||||
minWidth: 200,
|
||||
show: true
|
||||
}, {
|
||||
label: this.$t('licenseMange.concurrency'),
|
||||
prop: 'concurrency',
|
||||
minWidth: 150,
|
||||
show: true
|
||||
}, {
|
||||
label: this.$t('licenseMange.logins'),
|
||||
prop: 'logins',
|
||||
minWidth: 100,
|
||||
show: true
|
||||
}, {
|
||||
label: this.$t('overall.remark'),
|
||||
prop: 'remark',
|
||||
minWidth: 200,
|
||||
show: true
|
||||
}
|
||||
]
|
||||
],
|
||||
uploadId: undefined
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 上传V2C
|
||||
upload (row) {
|
||||
this.uploadId = row.id
|
||||
this.$refs.upload.$children[0].$refs.input.click()
|
||||
},
|
||||
async uploadChange (file) {
|
||||
const form = new FormData()
|
||||
form.append('file', file.raw)
|
||||
form.append('saId', this.uploadId)
|
||||
const res = await this.$post('/license/uploadV2C', form, { 'Content-Type': 'multipart/form-data' })
|
||||
if (res.code === 200) {
|
||||
this.$emit('reload')
|
||||
this.$message.success(this.$t('tip.uploadSuccess'))
|
||||
} else {
|
||||
this.$message.error(res.msg)
|
||||
}
|
||||
},
|
||||
// 下载C2V
|
||||
download (row) {
|
||||
const params = {
|
||||
saId: row.id
|
||||
}
|
||||
axios.get('/license/downloadC2V', { responseType: 'blob', params: params }).then(res => {
|
||||
const filename = row.name + '.c2v'
|
||||
if (window.navigator.msSaveOrOpenBlob) {
|
||||
// 兼容ie11
|
||||
const blobObject = new Blob([res.data])
|
||||
window.navigator.msSaveOrOpenBlob(blobObject, filename)
|
||||
} else {
|
||||
const url = URL.createObjectURL(new Blob([res.data]))
|
||||
const a = document.createElement('a')
|
||||
document.body.appendChild(a) // 此处增加了将创建的添加到body当中
|
||||
a.href = url
|
||||
a.download = filename
|
||||
a.target = '_blank'
|
||||
a.click()
|
||||
a.remove() // 将a标签移除
|
||||
}
|
||||
}, error => {
|
||||
const $self = this
|
||||
const reader = new FileReader()
|
||||
reader.onload = function (event) {
|
||||
const responseText = reader.result
|
||||
const exception = JSON.parse(responseText)
|
||||
if (exception.message) {
|
||||
$self.$message.error(exception.message)
|
||||
} else if (exception.msg) {
|
||||
$self.$message.error(exception.msg)
|
||||
} else {
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
reader.readAsText(error.response.data)
|
||||
})
|
||||
},
|
||||
copyValue (item) {
|
||||
const str = item
|
||||
// const domUrl = document.createElement('input')
|
||||
// domUrl.value = JSON.stringify(str)
|
||||
// domUrl.id = 'creatDom'
|
||||
// document.body.appendChild(domUrl)
|
||||
// domUrl.select() // 选择对象
|
||||
// document.execCommand('Copy') // 执行浏览器复制命令
|
||||
// const creatDom = document.getElementById('creatDom')
|
||||
// creatDom.parentNode.removeChild(creatDom)
|
||||
// this.$message.success(this.$t('overall.copySuccess'))
|
||||
this.$copyText(JSON.stringify(str)).then(() => {
|
||||
this.$message.success({ message: this.$t('overall.copySuccess') })
|
||||
})
|
||||
}
|
||||
},
|
||||
created () {
|
||||
},
|
||||
computed: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -75,17 +75,15 @@
|
||||
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" v-has="'model_edit'" @click="$emit('edit', scope.row)" :title="$t('overall.edit')"><i class="nz-icon nz-icon-edit"></i></button> -->
|
||||
<button class="table-operation-item" @click="showBottomBox('softwareAsset', scope.row)" :title="$t('overall.view')"><i class="nz-icon nz-icon-view1"></i></button>
|
||||
<el-dropdown size="medium" v-has="['model_delete','main_edit','model_edit']" trigger="click" @command="tableOperation">
|
||||
<el-dropdown size="medium" v-has="['software_type_add','software_type_edit','software_type_delete']" trigger="click" @command="tableOperation">
|
||||
<div class="table-operation-item table-operation-item--more" :title="$t('overall.moreOperations')">
|
||||
<i class="nz-icon nz-icon-more3"></i>
|
||||
</div>
|
||||
<el-dropdown-menu slot="dropdown" class="right-box-select-top right-public-box-dropdown-top">
|
||||
<el-dropdown-item v-has="'model_edit'" :command="['edit', 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 v-has="'model_edit'" :command="['copy', scope.row]"><i class="nz-icon nz-icon-override"></i><span class="operation-dropdown-text">{{$t('overall.duplicate')}}</span></el-dropdown-item>
|
||||
<el-dropdown-item v-has="'model_delete'" :command="['delete-rel', scope.row, {forceDeleteShow:true, single:true,from:'model'}]"><i class="nz-icon nz-icon-delete"></i><span class="operation-dropdown-text">{{$t('overall.delete')}}</span></el-dropdown-item>
|
||||
<el-dropdown-item v-has="'main_edit'" :command="['sync', scope.row]"><i class="nz-icon nz-icon-sync"></i><span class="operation-dropdown-text">{{$t('overall.syncChart')}}</span></el-dropdown-item>
|
||||
<el-dropdown-item v-has="'software_type_add'" :command="['edit', 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 v-has="'software_type_edit'" :command="['copy', scope.row]"><i class="nz-icon nz-icon-override"></i><span class="operation-dropdown-text">{{$t('overall.duplicate')}}</span></el-dropdown-item>
|
||||
<el-dropdown-item v-has="'software_type_delete'" :command="['delete-rel', scope.row, {forceDeleteShow:true, single:true,from:'softwareType'}]"><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>
|
||||
|
||||
@@ -97,6 +97,7 @@ export default {
|
||||
data () {
|
||||
return {
|
||||
url: '/asset/software',
|
||||
tableId: 'softwareAssetTable',
|
||||
blankObject: { // 空白对象
|
||||
id: '',
|
||||
name: '',
|
||||
@@ -106,7 +107,6 @@ export default {
|
||||
params: {},
|
||||
remark: ''
|
||||
},
|
||||
tableId: 'softwareAssetTable',
|
||||
searchMsg: { // 给搜索框子组件传递的信息
|
||||
searchLabelList: [{
|
||||
name: 'ID',
|
||||
@@ -123,7 +123,44 @@ export default {
|
||||
}
|
||||
},
|
||||
created () {
|
||||
|
||||
const searchKeys = {
|
||||
// key: path 键
|
||||
// value: vue set 参数
|
||||
pageNo: { target: this.pageObj, propertyName: 'pageNo', type: 'number' },
|
||||
pageSize: { target: this.pageObj, propertyName: 'pageSize', type: 'number' },
|
||||
orderBy: { target: this.$data, propertyName: 'orderBy', type: 'string' },
|
||||
ids: {
|
||||
target: this.searchLabel,
|
||||
isSearchInput: true,
|
||||
propertyName: 'ids',
|
||||
type: 'string',
|
||||
defaultJson: {
|
||||
disabled: false,
|
||||
id: 'ids',
|
||||
label: 'ids',
|
||||
name: 'ID',
|
||||
type: 'input',
|
||||
val: ''
|
||||
},
|
||||
jsonKey: 'val'
|
||||
},
|
||||
name: {
|
||||
target: this.searchLabel,
|
||||
isSearchInput: true,
|
||||
propertyName: 'name',
|
||||
type: 'string',
|
||||
defaultJson: {
|
||||
disabled: false,
|
||||
id: 'name',
|
||||
label: 'name',
|
||||
name: 'Name',
|
||||
type: 'input',
|
||||
val: ''
|
||||
},
|
||||
jsonKey: 'val'
|
||||
}
|
||||
}
|
||||
this.initQueryFromPath(searchKeys)
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user