任务清单-添加-法规编号抽屉

This commit is contained in:
刘彦泽
2023-04-06 16:38:43 +08:00
parent c7f58a3e9a
commit 25e099d80b
@@ -0,0 +1,281 @@
<template>
<div>
<a-drawer
:title="$t('regulationNo')"
:width="1000"
:visible="visible"
placement="right"
:maskClosable="false"
:closable="true"
@close="handleCancel"
style="height: 100%;overflow: auto;padding-bottom: 53px;">
<div style="margin-bottom: 60px">
<div class="table-page-search-wrapper">
<a-form layout="inline">
<a-row :gutter="24">
<a-col :md="12" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('standard')">
<span>{{$t('standard')}}</span>
</div>
<a-input class="box-input" :placeholder="$t('PleaseEnter')+$t('standard')"
v-model="queryParam.serialNumber"></a-input>
</div>
</a-col>
<template v-if="toggleSearchStatus">
<a-col :md="12" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('title')">
<span>{{$t('title')}}</span>
</div>
<a-input class="box-input" :placeholder="$t('PleaseEnter')+$t('title')"
v-model="queryParam.title"></a-input>
</div>
</a-col>
<a-col :md="12" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('areaOfResponsibility')">
<span>{{$t('areaOfResponsibility')}}</span>
</div>
<j-dict-select-tag class="box-input"
v-model="queryParam.dutyTerritory"
:placeholder="$t('PleaseSelect')+$t('areaOfResponsibility')"
:type="'select'"
:triggerChange="false" :dictCode="'duty_territory'"/>
</div>
</a-col>
</template>
<span style="float: right;overflow: hidden;" class="table-page-search-submitButtons">
<a-col :md="12" :sm="24">
<a @click="handleToggleSearch">
{{ !toggleSearchStatus ? $t('open') : $t('away') }}
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
</a>
<a-button class="box-button" style="margin-left: 8px" @click="searchReset">{{$t('reset')}}</a-button>
<a-button class="box-button" style="margin-left: 8px" type="primary" @click="searchQuery">{{$t('query')}}</a-button>
</a-col>
</span>
</a-row>
</a-form>
</div>
<div style="width: 100%">
<a-table
:columns="columns"
:components="drag(columns,'columns')"
rowKey="id"
:scroll="{x: '100%'}"
:data-source="dataList"
:pagination="false"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:loading="loading">
</a-table>
</div>
<div class="page" v-if="dataList.length > 0">
<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="onChange"
@showSizeChange="SizeChange"
/>
</div>
</div>
<div class="drawer-bootom-button">
<a-button @click="handleCancel" style="margin-right: 16px">{{$t('cancel')}}</a-button>
<a-button @click="handleSubmit" type="primary" :loading="confirmLoading">{{$t('submit')}}</a-button>
</div>
</a-drawer>
</div>
</template>
<script>
import { getAction, postAction } from '@/api/manage'
import { ResizeHeader, ResizeColumnProvide } from '@/mixins/header'
export default {
name: 'addCodeNumber',
mixins: [ResizeHeader, ResizeColumnProvide],
data() {
return {
url: {
addModelList: '/project/projectLawsInventoryEO/page',
},
visible: false,
toggleSearchStatus: false,
columns: [
{
title: this.$t('standard'),
dataIndex: 'serialNumber',
align: 'left',
ellipsis: true,
width: 250
},
{
title: this.$t('title'),
dataIndex: 'title',
align: 'left',
ellipsis: true,
width: 250
},
{
title: this.$t('certificationType'),
dataIndex: 'attestationType_dictText',
align: 'left',
ellipsis: true,
width: 190
},
{
title: this.$t('areaOfResponsibility'),
dataIndex: 'dutyTerritory_dictText',
align: 'left',
ellipsis: true,
width: 190
}
],
dataList: [],
selectedRowKeys: [],
loading: false,
pageNo: 1,
pageSize: 10,
total: 0,
queryParam: {},
confirmLoading: false,
}
},
mounted() {
},
methods: {
handleToggleSearch() {
this.toggleSearchStatus = !this.toggleSearchStatus
},
add() {
this.visible = true
this.replacePage()
},
handleCancel() {
this.visible = false
},
searchQuery() {
this.pageNo = 1
this.replacePage()
},
searchReset() {
this.pageNo = 1
this.queryParam = {}
this.replacePage()
},
onChange(page, pageSize) {
this.pageNo = page
this.replacePage()
},
SizeChange(page, pageSize) {
this.pageNo = 1
this.pageSize = pageSize
this.replacePage()
},
replacePage() {
let query = {
pageNo: this.pageNo,
pageSize: this.pageSize,
...this.queryParam,
projectLibraryId: this.$route.query.id,
}
this.loading = true
getAction(this.url.addModelList, query).then((res) => {
if (res.success) {
this.dataList = res.result.records || []
this.total = res.result.total
this.loading = false
} else {
this.dataList = []
this.total = 0
this.loading = false
}
})
},
onSelectChange(value,row) {
this.selectedRowKeys = value
this.selectedRowList = row
},
handleSubmit() {
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
this.confirmLoading = true
let selectedRowKeys = JSON.parse(JSON.stringify(this.selectedRowKeys))
if (this.selectedRowKeys.length < 2){
let fgid = this.selectedRowList[0].id
let regulationIndex = this.selectedRowList[0].serialNumber
this.confirmLoading = false
this.visible = false
this.$emit('regulation',regulationIndex,fgid)
} else {
this.$message.warning(this.$t('OnlyOneSelected'))
this.confirmLoading = false
}
} else {
this.$message.warning(this.$t('selectLeastOne'))
this.confirmLoading = false
}
}
}
}
</script>
<style lang='less' scoped>
@import '~@assets/less/common.less';
.box-title-text {
line-height: 1.4;
display: flex;
align-items: center;
margin-bottom: 10px;
}
.title-text {
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: 100%;
height: 38px;
}
.box-button {
height: 38px;
}
.page {
text-align: right;
margin-top: 20px;
}
.drawer-bootom-button {
position: absolute;
bottom: 0;
width: 100%;
z-index: 100;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
left: 0;
background: #fff;
border-radius: 0 0 2px 2px;
}
</style>