Merge remote-tracking branch 'origin/dev_2nd_LCYH' into dev_2nd_LCYH

This commit is contained in:
wangzhijiang
2023-03-03 14:37:05 +08:00
3 changed files with 552 additions and 0 deletions
+1
View File
@@ -597,6 +597,7 @@ module.exports = {
selectDisplayList: 'Please select whether to display in list',
documentSplitDisplay: 'Document splitting module display',
VirtualListName: 'Virtual List Name',
CertificationListName:'Certification List Name',
listStatus: 'List Status',
creater: 'Creater',
withdraw: 'Withdraw',
+1
View File
@@ -605,6 +605,7 @@ module.exports = {
selectDisplayList: '请选择是否列表展示',
documentSplitDisplay: '文档拆分模块展示',
VirtualListName: '虚拟清单名称',
CertificationListName:'认证清单名称',
VirtualList: '虚拟清单',
listStatus: '清单状态',
creater: '创建人',
@@ -0,0 +1,550 @@
<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('CertificationListName')">
<span>{{$t('CertificationListName')}}</span>
</div>
<j-input class="box-input" :placeholder="$t('PleaseEnter')+$t('CertificationListName')"
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="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>
<a-table
ref="table"
size="middle"
:components="drag(columns,'columns')"
:loading="loading"
:pagination="false"
:scroll="{x: '100%'}"
rowKey="id"
:data-source="dataSource"
:columns="columns"
@change="tableOnChange"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
>
<span slot="CertificationListName" slot-scope="text,record">
<a>{{text}}</a>
</span>
<span slot="operation" slot-scope="text,record">
<!-- v-if="record.createBy == userData.username || administrators"-->
<a class="text-operation" @click="edit(record)"
v-has="'dummyInventoryBase:deleteBatch'"
:disabled="record.state == 1?true:false">{{$t('edit')}}</a>
<!-- v-if="record.createBy == userData.username || administrators"-->
<a class="text-operation"
v-has="'dummyInventoryBase:issue'"
@click="withdraw(record)">
{{record.state == 2 ? $t('release') : $t('withdraw')}}
</a>
<!-- v-if="record.createBy == userData.username || administrators"-->
<a class="text-operation" :disabled="record.state == 1?true:false"
v-has="'dummyInventoryBase:deleteBatch'"
>{{$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>
<!-- v-if="record.createBy == userData.username || administrators"-->
<a class="text-operation" :disabled="record.state == 1?true:false"
v-has="'dummyInventoryBase:deleteBatch'"
@click="deleteLib(record)">{{$t('deleteLib')}}</a>
</span>
</a-table>
<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('CertificationListName')">{{$t('CertificationListName')}}</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('CertificationListName')"/>
</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>
</a-card>
</template>
<script>
import { getAction, postAction, deleteAction, downloadFile } from '@/api/manage'
import VueDraggableResizable from 'vue-draggable-resizable'
import tableDragResize from '@/mixins/tableDragResize'
import { mapGetters } from 'vuex'
import { ResizeHeader, ResizeColumnProvide } from '@/mixins/header'
export default {
name:'index',
components: {
VueDraggableResizable
},
mixins: [tableDragResize, ResizeHeader, ResizeColumnProvide],
data() {
return {
selectedRowKeys: [],
rules: {
name: [
{
required: true,
message: this.$t('CertificationListName') + this.$t('cannotEmpty'),
trigger: 'blur'
},
{
max: 100,
message: this.$t('CertificationListName') + 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'
}
]
},
confirmLoading: false,
formInline: {},
visible: false,
title: this.$t('newlyAdded'),
userData: {},
administrators:false,
loading: false,
total: 0,
pageSize: 10,
pageNo: 1,
queryParam: {},
orderBy: '1',
orderByField: '',
url: {
list: '/authDummy/authDummyInventoryBaseEO/page',//分页列表查询
add: '/authDummy/authDummyInventoryBaseEO/add',//添加
edit: '/authDummy/authDummyInventoryBaseEO/edit',//编辑
deleteBatch: '/authDummy/authDummyInventoryBaseEO/deleteBatch',//批量删除
urlWithdraw: '/authDummy/authDummyInventoryBaseEO/batchIssueOrWithdraw'//批量发布或撤回
},
dataSource: [],
columns: [
{
title: this.$t('CertificationListName'),
align: 'left',
dataIndex: 'name',
width: 260,
ellipsis: true,
scopedSlots: { customRender: 'CertificationListName' }
},
{
title: this.$t('listStatus'),
align: 'left',
width: 260,
ellipsis: true,
dataIndex: 'state_dictText'
},
{
title: this.$t('creater'),
align: 'left',
width: 260,
ellipsis: true,
dataIndex: 'createBy'
},
{
title: this.$t('operation'),
align: 'left',
fixed: 'right',
width: 400,
scopedSlots: { customRender: 'operation' }
}
],
}
},
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
},
tableOnChange(pagination, filters, sorter) {
this.orderBy = sorter.order == 'ascend' ? '1' : '2'
this.orderByField = sorter.columnKey
this.getList()
},
//添加
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))
deleteAction(_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)
}
})
}
})
},
//订阅
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() {
deleteAction(_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)
}
})
}
})
},
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
}
})
}
})
},
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
}
})
},
}
}
</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;
}
.formAdd {
margin-bottom: 40px;
}
.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;
}
.Required {
color: red;
margin-right: 4px;
}
.title-text-text {
margin-top: 9px;
}
.itemModel {
width: calc(100% - 130px);
display: inline-block;
margin-top: 2px;
}
.box-input-add {
display: inline-block;
height: 38px;
width: 100%;
}
.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>