605 lines
18 KiB
Java
605 lines
18 KiB
Java
<template>
|
|
<a-card :bordered="false">
|
|
<div class="table-page-search-wrapper">
|
|
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
|
<a-row :gutter="24">
|
|
<a-col :md="6" :sm="8">
|
|
<div class="box-title-text">
|
|
<div class="title-text" :title="$t('VirtualListName')">
|
|
<span>{{$t('VirtualListName')}}</span>
|
|
</div>
|
|
<j-input class="box-input" :placeholder="$t('PleaseEnter')+$t('VirtualListName')"
|
|
v-model="queryParam.name"></j-input>
|
|
</div>
|
|
</a-col>
|
|
<a-col :md="6" :sm="8">
|
|
<div class="box-title-text">
|
|
<div class="title-text" :title="$t('listStatus')">
|
|
<span>{{$t('listStatus')}}</span>
|
|
</div>
|
|
<j-dict-select-tag class="box-input" v-model="queryParam.state"
|
|
:placeholder="$t('PleaseSelect')+$t('listStatus')"
|
|
:type="'select'"
|
|
:triggerChange="false" :dictCode="'dummy_inventory_state'"/>
|
|
</div>
|
|
</a-col>
|
|
<span style="float: right;overflow: hidden;margin-right: 11px" class="table-page-search-submitButtons">
|
|
<a-col :md="6" :sm="24">
|
|
<a-button class="box-button" type="primary" @click="searchQuery">{{$t('query')}}</a-button>
|
|
<a-button class="box-button" style="margin-left: 8px" @click="searchReset">{{$t('reset')}}</a-button>
|
|
</a-col>
|
|
</span>
|
|
</a-row>
|
|
</a-form>
|
|
</div>
|
|
<div class="table-operator">
|
|
<div @click="setCreatorClick" class="operator-text" v-has="'virtual:set:creater'">
|
|
<a-icon type="setting"/>
|
|
{{$t('setCreator')}}
|
|
</div>
|
|
<div @click="handleAdd" class="operator-text" v-has="'dummyInventoryBase:add'">
|
|
<a-icon type="plus"/>
|
|
{{$t('newlyAdded')}}
|
|
</div>
|
|
<div @click="handleDel" class="operator-text" v-has="'dummyInventoryBase:deleteBatch'">
|
|
<a-icon type="delete"/>
|
|
{{$t('BatchDelete')}}
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<!-- :components="drag(columns)" bordered-->
|
|
<a-table
|
|
ref="table"
|
|
size="middle"
|
|
:loading="loading"
|
|
:pagination="false"
|
|
:scroll="{x: '100%'}"
|
|
rowKey="id"
|
|
:data-source="dataSource"
|
|
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
|
|
:columns="columns"
|
|
>
|
|
<span slot="VirtualListName" slot-scope="text,record">
|
|
<a @click="VirtualListNameClick(record)">{{text}}</a>
|
|
</span>
|
|
<span slot="operation" slot-scope="text,record">
|
|
<a class="text-operation" @click="edit(record)"
|
|
v-has="'dummyInventoryBase:deleteBatch'"
|
|
v-if="record.createBy == userData.username || administrators"
|
|
:disabled="record.state == 1?true:false">{{$t('edit')}}</a>
|
|
<a class="text-operation"
|
|
v-if="record.createBy == userData.username || administrators"
|
|
v-has="'dummyInventoryBase:issue'"
|
|
@click="withdraw(record)">
|
|
{{record.state == 2 ? $t('release') : $t('withdraw')}}
|
|
</a>
|
|
<a class="text-operation" :disabled="record.state == 1?true:false"
|
|
v-if="record.createBy == userData.username || administrators"
|
|
v-has="'dummyInventoryBase:deleteBatch'"
|
|
@click="maintenanceList(record)">{{$t('maintenanceList')}}</a>
|
|
<a class="text-operation"
|
|
v-has="'dummyInventoryBase:read'"
|
|
:disabled="record.state == 2?true:false" @click="subscribe(record)">
|
|
{{!record.readFlag || record.readFlag == 0 ? $t('subscribe') :$t('CancelSubscribe')}}
|
|
</a>
|
|
<a class="text-operation" :disabled="record.state == 1?true:false"
|
|
v-has="'dummyInventoryBase:deleteBatch'"
|
|
v-if="record.createBy == userData.username || administrators"
|
|
@click="deleteLib(record)">{{$t('deleteLib')}}</a>
|
|
</span>
|
|
</a-table>
|
|
</div>
|
|
<div class="page">
|
|
<a-pagination
|
|
:show-total="total => $t('total')+` ${total} `+$t('strip')"
|
|
show-quick-jumper
|
|
show-size-changer
|
|
:page-size.sync="pageSize"
|
|
:total="total"
|
|
:current="pageNo"
|
|
@change="pageOnChange"
|
|
@showSizeChange="SizeChange"
|
|
/>
|
|
</div>
|
|
<a-drawer
|
|
:title="title"
|
|
:maskClosable="false"
|
|
:width="600"
|
|
placement="right"
|
|
:closable="true"
|
|
@close="handleCancel"
|
|
:visible="visible"
|
|
style="height: 100%;overflow: auto;padding-bottom: 53px;">
|
|
<a-spin :spinning="confirmLoading">
|
|
<a-form-model :model="formInline" class="formAdd" :rules="rules" ref="ruleForm">
|
|
<a-row :gutter="24">
|
|
<a-col :span="24">
|
|
<div class="box-title-text-add">
|
|
<div class="title-text-add">
|
|
<span class="Required">*</span>
|
|
<span class="title-text-text" :title="$t('VirtualListName')">{{$t('VirtualListName')}}</span>
|
|
</div>
|
|
<a-form-model-item class="itemModel" prop="name">
|
|
<a-input class="box-input-add"
|
|
v-model.trim="formInline.name"
|
|
:placeholder="$t('PleaseEnter')+$t('VirtualListName')"/>
|
|
</a-form-model-item>
|
|
</div>
|
|
</a-col>
|
|
<a-col :span="24">
|
|
<div class="box-title-text-add">
|
|
<div class="title-text-add">
|
|
<span class="Required">*</span>
|
|
<span class="title-text-text" :title="$t('instructionForUse')">{{$t('instructionForUse')}}</span>
|
|
</div>
|
|
<a-form-model-item class="itemModel" prop="useExplain">
|
|
<a-textarea
|
|
:placeholder="$t('PleaseEnter')+$t('instructionForUse')"
|
|
v-model.trim="formInline.useExplain" :rows="4"/>
|
|
</a-form-model-item>
|
|
</div>
|
|
</a-col>
|
|
</a-row>
|
|
</a-form-model>
|
|
</a-spin>
|
|
<div class="drawer-bootom-button">
|
|
<a-button style="margin-right: .8rem" @click="handleCancel">{{$t('cancel')}}</a-button>
|
|
<a-button @click="handleSubmit" type="primary" :loading="confirmLoading">{{$t('submit')}}</a-button>
|
|
</div>
|
|
</a-drawer>
|
|
<setCreator ref="setCreatorRef" @clearSelected="clearSelected"/>
|
|
</a-card>
|
|
</template>
|
|
|
|
<script>
|
|
import { getAction, postAction, downloadFile } from '@/api/manage'
|
|
import eventBUs from '../../../common/event'
|
|
import Vue from 'vue'
|
|
import VueDraggableResizable from 'vue-draggable-resizable'
|
|
import tableDragResize from '@/mixins/tableDragResize'
|
|
import setCreator from '@/components/setCreator/index'
|
|
import { mapGetters } from 'vuex'
|
|
|
|
export default {
|
|
name: 'index',
|
|
components: {
|
|
VueDraggableResizable,
|
|
setCreator
|
|
},
|
|
mixins: [tableDragResize],
|
|
data() {
|
|
return {
|
|
loading: false,
|
|
selectedRowKeys: [],
|
|
formInline: {},
|
|
userData: {},
|
|
rules: {
|
|
name: [
|
|
{
|
|
required: true,
|
|
message: this.$t('VirtualListName') + this.$t('cannotEmpty'),
|
|
trigger: 'blur'
|
|
},
|
|
{
|
|
max: 100,
|
|
message: this.$t('VirtualListName') + this.$t('cannotExceed') + 100 + this.$t('Characters'),
|
|
trigger: 'blur'
|
|
}
|
|
],
|
|
useExplain: [
|
|
{
|
|
required: true,
|
|
message: this.$t('instructionForUse') + this.$t('cannotEmpty'),
|
|
trigger: 'blur'
|
|
},
|
|
{
|
|
max: 500,
|
|
message: this.$t('instructionForUse') + this.$t('cannotExceed') + 500 + this.$t('Characters'),
|
|
trigger: 'blur'
|
|
}
|
|
]
|
|
},
|
|
visible: false,
|
|
dataSource: [],
|
|
confirmLoading: false,
|
|
url: {
|
|
list: '/dummy/dummyInventoryBaseEO/page',
|
|
add: '/dummy/dummyInventoryBaseEO/add',
|
|
edit: '/dummy/dummyInventoryBaseEO/edit',
|
|
deleteBatch: '/dummy/dummyInventoryBaseEO/deleteBatch',
|
|
urlWithdraw: '/dummy/dummyInventoryBaseEO/issue'//撤回&发布
|
|
},
|
|
total: 0,
|
|
pageSize: 10,
|
|
pageNo: 1,
|
|
title: this.$t('newlyAdded'),
|
|
columns: [
|
|
{
|
|
title: this.$t('VirtualListName'),
|
|
align: 'left',
|
|
dataIndex: 'name',
|
|
width: '25%',
|
|
ellipsis: true,
|
|
scopedSlots: { customRender: 'VirtualListName' }
|
|
},
|
|
{
|
|
title: this.$t('listStatus'),
|
|
align: 'left',
|
|
width: '25%',
|
|
ellipsis: true,
|
|
dataIndex: 'state_dictText'
|
|
},
|
|
{
|
|
title: this.$t('creater'),
|
|
align: 'left',
|
|
width: '25%',
|
|
ellipsis: true,
|
|
dataIndex: 'createBy'
|
|
},
|
|
{
|
|
title: this.$t('operation'),
|
|
align: 'left',
|
|
fixed: 'right',
|
|
width: 400,
|
|
scopedSlots: { customRender: 'operation' }
|
|
}
|
|
],
|
|
queryParam: {},
|
|
administrators:false,
|
|
}
|
|
},
|
|
mounted() {
|
|
this.getList()
|
|
this.userData = this.userInfo()
|
|
this.administrators = false
|
|
if (this.userInfo().userRoleList && this.userInfo().userRoleList.length > 0) {
|
|
this.userInfo().userRoleList.forEach(res => {
|
|
if (res.roleCode == 'admin') {
|
|
this.administrators = true
|
|
}
|
|
})
|
|
}
|
|
},
|
|
methods: {
|
|
...mapGetters(['userInfo']),
|
|
onSelectChange(value) {
|
|
this.selectedRowKeys = value
|
|
},
|
|
clearSelected() {
|
|
this.selectedRowKeys = []
|
|
this.getList()
|
|
},
|
|
setCreatorClick() {
|
|
if (this.selectedRowKeys.length > 0) {
|
|
let selectedRowKeys = JSON.parse(JSON.stringify(this.selectedRowKeys))
|
|
this.$refs.setCreatorRef.getPush(selectedRowKeys.join(','))
|
|
} else {
|
|
this.$message.warning(this.$t('PleaseSelectData'))
|
|
}
|
|
},
|
|
//添加
|
|
handleAdd() {
|
|
this.title = this.$t('newlyAdded')
|
|
this.formInline = {}
|
|
this.visible = true
|
|
this.$nextTick(() => {
|
|
this.$refs.ruleForm.clearValidate()
|
|
})
|
|
},
|
|
//批量删除
|
|
handleDel() {
|
|
if (this.selectedRowKeys.length > 0) {
|
|
let _this = this
|
|
this.$confirm({
|
|
content: _this.$t('ConfirmBatchDeletion'),
|
|
onOk() {
|
|
let idList = JSON.parse(JSON.stringify(_this.selectedRowKeys))
|
|
getAction(_this.url.deleteBatch, { ids: idList.join(',') }).then((res) => {
|
|
if (res.success) {
|
|
_this.$message.success(_this.$t('OperationSuccessful'))
|
|
_this.selectedRowKeys = []
|
|
_this.getList()
|
|
} else {
|
|
_this.$message.warning(res.message)
|
|
}
|
|
})
|
|
}
|
|
})
|
|
} else {
|
|
this.$message.warning(this.$t('selectLeastOne'))
|
|
}
|
|
},
|
|
//编辑
|
|
edit(item) {
|
|
this.title = this.$t('edit')
|
|
this.formInline = JSON.parse(JSON.stringify(item))
|
|
this.visible = true
|
|
this.$nextTick(() => {
|
|
this.$refs.ruleForm.clearValidate()
|
|
})
|
|
},
|
|
//撤回
|
|
withdraw(val) {
|
|
let item = {}
|
|
let content = ''
|
|
if (val.state == 2) {
|
|
content = this.$t('confirmRelease')
|
|
item.state = 1
|
|
} else {
|
|
item.state = 2
|
|
content = this.$t('confirmWithdraw')
|
|
}
|
|
item.id = val.id
|
|
let _this = this
|
|
this.$confirm({
|
|
content: content,
|
|
onOk() {
|
|
postAction(_this.url.urlWithdraw, item).then((res) => {
|
|
if (res.success) {
|
|
_this.$message.success(_this.$t('OperationSuccessful'))
|
|
_this.getList()
|
|
} else {
|
|
_this.$message.warning(res.message)
|
|
}
|
|
})
|
|
}
|
|
})
|
|
},
|
|
//维护清单
|
|
maintenanceList(item) {
|
|
let newUrl = this.$router.resolve({
|
|
path: '/virtualListDetails',
|
|
query: {
|
|
name: item.name,
|
|
useExplain: item.useExplain,
|
|
id: item.id,
|
|
title: '维护虚拟清单'
|
|
}
|
|
})
|
|
window.open(newUrl.href, '_blank')
|
|
},
|
|
//订阅
|
|
subscribe(val) {
|
|
let _this = this
|
|
this.$confirm({
|
|
content: val.readFlag == 0 || !val.readFlag ? _this.$t('ConfirmSubscribe') : _this.$t('cancelConfirmSubscribe'),
|
|
onOk() {
|
|
let url = ''
|
|
if (val.readFlag == 0 || !val.readFlag) {
|
|
url = 'dummy/dummyInventoryBaseEO/read'
|
|
} else {
|
|
url = 'dummy/dummyInventoryBaseEO/cancelRead'
|
|
}
|
|
getAction(url, { id: val.id }).then((res) => {
|
|
if (res.success) {
|
|
_this.$message.success(_this.$t('OperationSuccessful'))
|
|
_this.getList()
|
|
} else {
|
|
_this.$message.warning(_this.$t('operationFailed'))
|
|
}
|
|
})
|
|
}
|
|
})
|
|
},
|
|
//删除
|
|
deleteLib(val) {
|
|
let _this = this
|
|
this.$confirm({
|
|
content: _this.$t('ConfirmDelete'),
|
|
onOk() {
|
|
getAction(_this.url.deleteBatch, { ids: val.id }).then((res) => {
|
|
if (res.success) {
|
|
_this.$message.success(_this.$t('OperationSuccessful'))
|
|
_this.getList()
|
|
} else {
|
|
_this.$message.warning(res.message)
|
|
}
|
|
})
|
|
}
|
|
})
|
|
},
|
|
//虚拟清单名称事件
|
|
VirtualListNameClick(item) {
|
|
let newUrl = this.$router.resolve({
|
|
path: '/virtualListDetails',
|
|
query: {
|
|
name: item.name,
|
|
useExplain: item.useExplain,
|
|
id: item.id,
|
|
title: '虚拟清单详情'
|
|
}
|
|
})
|
|
window.open(newUrl.href, '_blank')
|
|
},
|
|
getList() {
|
|
let query = {
|
|
pageNo: this.pageNo,
|
|
pageSize: this.pageSize,
|
|
...this.queryParam
|
|
}
|
|
this.loading = true
|
|
getAction(this.url.list, query).then((res) => {
|
|
if (res.success) {
|
|
if (res.result.current > 1 && res.result.records.length == 0) {
|
|
this.pageNo = 1
|
|
this.getList()
|
|
return
|
|
}
|
|
this.dataSource = res.result.records || []
|
|
this.total = res.result.total
|
|
this.loading = false
|
|
} else {
|
|
this.loading = false
|
|
}
|
|
})
|
|
},
|
|
searchQuery() {
|
|
this.pageNo = 1
|
|
this.getList()
|
|
},
|
|
searchReset() {
|
|
this.queryParam = {}
|
|
this.pageNo = 1
|
|
this.getList()
|
|
},
|
|
pageOnChange(page, pageSize) {
|
|
this.pageNo = page
|
|
this.getList()
|
|
},
|
|
SizeChange(page, pageSize) {
|
|
this.pageNo = 1
|
|
this.pageSize = pageSize
|
|
this.getList()
|
|
},
|
|
handleCancel() {
|
|
this.visible = false
|
|
},
|
|
handleSubmit() {
|
|
this.$refs.ruleForm.validate(valid => {
|
|
if (valid) {
|
|
let url = ''
|
|
if (this.formInline.id) {
|
|
url = this.url.edit
|
|
} else {
|
|
url = this.url.add
|
|
}
|
|
this.confirmLoading = true
|
|
postAction(url, this.formInline).then((res) => {
|
|
if (res.success) {
|
|
this.confirmLoading = false
|
|
this.$message.success(this.$t('OperationSuccessful'))
|
|
this.visible = false
|
|
this.getList()
|
|
} else {
|
|
this.$message.warning(this.$t('operationFailed'))
|
|
this.confirmLoading = false
|
|
}
|
|
})
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
@import '~@assets/less/common.less';
|
|
|
|
.box-title-text {
|
|
line-height: 1.4;
|
|
display: flex;
|
|
align-items: center;
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.title-text {
|
|
width: 20%;
|
|
min-width: 110px;
|
|
color: #000F16;
|
|
display: inline-block;
|
|
font-weight: 500;
|
|
font-size: 14px;
|
|
margin-right: 16px;
|
|
margin-top: 3px;
|
|
text-align: right;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
|
|
.box-input {
|
|
display: inline-block;
|
|
width: 70%;
|
|
height: 38px;
|
|
margin-top: 2px;
|
|
}
|
|
|
|
.box-button {
|
|
height: 38px;
|
|
/*margin-top: 2px;*/
|
|
}
|
|
|
|
.text-operation {
|
|
margin-right: 8px;
|
|
}
|
|
|
|
.page {
|
|
text-align: right;
|
|
margin-top: 20px;
|
|
}
|
|
|
|
.box-title-text-add {
|
|
line-height: 1.4;
|
|
display: flex;
|
|
}
|
|
|
|
.title-text-add {
|
|
width: 114px;
|
|
text-align: right;
|
|
display: inline-block;
|
|
font-weight: 500;
|
|
font-size: 14px;
|
|
margin-right: 16px;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
height: 42px;
|
|
line-height: 42px;
|
|
margin-top: 3px;
|
|
}
|
|
|
|
.box-input-add {
|
|
display: inline-block;
|
|
height: 38px;
|
|
width: 100%;
|
|
}
|
|
|
|
.itemModel {
|
|
width: calc(100% - 130px);
|
|
display: inline-block;
|
|
margin-top: 2px;
|
|
}
|
|
|
|
.Required {
|
|
color: red;
|
|
margin-right: 4px;
|
|
}
|
|
|
|
.title-text-text {
|
|
margin-top: 9px;
|
|
}
|
|
|
|
.formAdd {
|
|
margin-bottom: 40px;
|
|
}
|
|
|
|
.drawer-bootom-button {
|
|
position: absolute;
|
|
bottom: 0;
|
|
z-index: 100;
|
|
width: 100%;
|
|
border-top: 1px solid #e8e8e8;
|
|
padding: 10px 16px;
|
|
text-align: right;
|
|
left: 0;
|
|
background: #fff;
|
|
border-radius: 0 0 2px 2px;
|
|
}
|
|
</style>
|
|
<style lang="less">
|
|
.resize-table-th {
|
|
position: relative;
|
|
|
|
.table-draggable-handle {
|
|
transform: none !important;
|
|
position: absolute;
|
|
height: 100% !important;
|
|
bottom: 0;
|
|
left: auto !important;
|
|
right: -5px;
|
|
cursor: col-resize;
|
|
touch-action: none;
|
|
will-change: transform !important;
|
|
}
|
|
}
|
|
</style> |