225 lines
6.5 KiB
Vue
225 lines
6.5 KiB
Vue
<template>
|
|
<a-drawer
|
|
:title="$t('standardSelect.standardSelection')"
|
|
:maskClosable="false"
|
|
:width="1000"
|
|
placement="right"
|
|
:closable="true"
|
|
@close="handleCancel"
|
|
:visible="visible"
|
|
class="custom-drawer-style">
|
|
<div class="custom-drawer-style-scroll">
|
|
<div class="table-page-search-wrapper">
|
|
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
|
<a-row :gutter="24">
|
|
<a-col :sm="8">
|
|
<a-form-item :label="$t('standardSelect.standardNumOrName')" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
|
<a-input :placeholder="$t('pleaseEnter')+$t('standardSelect.standardNumOrName')"
|
|
v-model="queryParam.standardNumberOrName"></a-input>
|
|
</a-form-item>
|
|
</a-col>
|
|
<div style="float: right;overflow: hidden;margin-right: 41px;margin-bottom: 20px" class="table-page-search-submitButtons">
|
|
<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>
|
|
</div>
|
|
</a-row>
|
|
</a-form>
|
|
</div>
|
|
<a-table
|
|
:columns="columns"
|
|
rowKey="id"
|
|
:scroll="{x: 900}"
|
|
:data-source="dataList"
|
|
:pagination="ipagination"
|
|
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
|
|
:loading="loading"
|
|
@change="handleTableChange">
|
|
|
|
<!-- 标准编号、标准名称跳转详情-->
|
|
<template v-slot:detail="text, record">
|
|
<a-tooltip overlay-class-name="tooltip-style">
|
|
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
|
|
<div class="table-text can-click-table-text" v-if="text || text === 0" @click="toDetailPage(record)">{{ text }}</div>
|
|
<div v-else class="table-text">{{ global.emptyLine }}</div>
|
|
</a-tooltip>
|
|
</template>
|
|
|
|
<template slot="text" slot-scope="text">
|
|
<a-tooltip overlay-class-name="tooltip-style">
|
|
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
|
|
<div class="table-text">{{ text || text === 0 ? text : global.emptyLine }}</div>
|
|
</a-tooltip>
|
|
</template>
|
|
|
|
</a-table>
|
|
</div>
|
|
|
|
<div class="custom-drawer-style-bottom-btn">
|
|
<a-button @click="handleCancel">{{ $t('cancel') }}</a-button>
|
|
<a-button @click="handleSubmit" type="primary" :loading="confirmLoading">{{ $t('submit') }}</a-button>
|
|
</div>
|
|
</a-drawer>
|
|
</template>
|
|
|
|
<script>
|
|
import { allocationStandardList, allocationStandard } from '@/api/enterpriseStandardLibraryApi'
|
|
|
|
export default {
|
|
name: 'AllocationStandardDrawer',
|
|
props: {
|
|
query: {
|
|
type: Object,
|
|
required: false,
|
|
default: () => {
|
|
return {}
|
|
}
|
|
}
|
|
},
|
|
data () {
|
|
return {
|
|
visible: false,
|
|
confirmLoading: false,
|
|
labelCol: {
|
|
sm: 8
|
|
},
|
|
wrapperCol: {
|
|
sm: 14
|
|
},
|
|
selectedRowKeys: [],
|
|
selectedRowList: [],
|
|
loading: false,
|
|
queryParam: {},
|
|
/* 分页参数 */
|
|
ipagination: {
|
|
current: 1,
|
|
pageSize: 10,
|
|
pageSizeOptions: ['10', '20', '30'],
|
|
showTotal: (total, range) => {
|
|
return range[0] + '-' + range[1] + ' ' + this.$t('total') + ' ' + total + ' ' + this.$t('strip')
|
|
},
|
|
showQuickJumper: true,
|
|
showSizeChanger: true,
|
|
total: 0
|
|
},
|
|
columns: [
|
|
{
|
|
title: this.$t('standardSelect.standardNumber'),
|
|
dataIndex: 'standardNumber',
|
|
align: 'center',
|
|
width: 150,
|
|
scopedSlots: { customRender: 'detail' }
|
|
},
|
|
{
|
|
title: this.$t('standardSelect.standardName'),
|
|
dataIndex: 'standardName',
|
|
align: 'center',
|
|
width: 150,
|
|
scopedSlots: { customRender: 'detail' }
|
|
},
|
|
{
|
|
title: this.$t('standardSelect.releaseDate'),
|
|
dataIndex: 'releaseDate',
|
|
align: 'center',
|
|
width: 120,
|
|
scopedSlots: { customRender: 'text' }
|
|
},
|
|
{
|
|
title: this.$t('standardSelect.textState'),
|
|
dataIndex: 'standardState_dictText',
|
|
align: 'center',
|
|
width: 120,
|
|
scopedSlots: { customRender: 'text' }
|
|
}
|
|
],
|
|
dataList: [],
|
|
nodeCode: '' // 选中节点code
|
|
}
|
|
},
|
|
methods: {
|
|
open (nodeCode) {
|
|
this.visible = true
|
|
this.queryParam = {}
|
|
this.nodeCode = nodeCode
|
|
this.replacePage()
|
|
},
|
|
// 获取表格数据
|
|
replacePage () {
|
|
const query = {
|
|
...this.queryParam,
|
|
pageNo: this.ipagination.current,
|
|
pageSize: this.ipagination.pageSize,
|
|
nodeCode: this.nodeCode,
|
|
source: '3'
|
|
}
|
|
this.selectedRowKeys = []
|
|
this.loading = true
|
|
allocationStandardList(query).then((res) => {
|
|
if (res.success) {
|
|
this.dataList = res.result.records
|
|
this.ipagination.total = res.result.total
|
|
} else {
|
|
this.dataList = []
|
|
}
|
|
}).finally(() => {
|
|
this.loading = false
|
|
})
|
|
},
|
|
searchQuery () {
|
|
this.replacePage()
|
|
},
|
|
searchReset () {
|
|
this.queryParam = {}
|
|
this.replacePage()
|
|
},
|
|
// 表格选择改变
|
|
onSelectChange (value, row) {
|
|
this.selectedRowKeys = value
|
|
this.selectedRowList = row
|
|
},
|
|
handleTableChange (pagination) {
|
|
// 分页、排序、筛选变化时触发
|
|
this.ipagination = pagination
|
|
this.replacePage()
|
|
},
|
|
handleCancel () {
|
|
this.visible = false
|
|
},
|
|
handleSubmit () {
|
|
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
|
|
const params = {
|
|
nodeCode: this.nodeCode,
|
|
ids: this.selectedRowKeys.join(',')
|
|
}
|
|
allocationStandard(params).then(res => {
|
|
if (res.success) {
|
|
this.$message.success(res.message)
|
|
this.$emit('ok')
|
|
} else {
|
|
this.$message.warn(res.message)
|
|
}
|
|
})
|
|
this.visible = false
|
|
} else {
|
|
this.$message.warning(this.$t('pleaseSelectOneStandard'))
|
|
}
|
|
},
|
|
/**
|
|
* 跳转详情页
|
|
* @param id
|
|
*/
|
|
toDetailPage ({ id }) {
|
|
this.$openPageNewSheet({
|
|
path: '/enterpriseStandardLibrary/enterpriseStandardDetail',
|
|
query: {
|
|
id
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
|
|
</style>
|