Files
laws-sinotruk-client/src/components/selection/EnterprisePlanSelectionModal.vue
T

433 lines
16 KiB
Vue

<template>
<a-drawer
:title="$t('enterprisePlanSelect.title')"
: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 :span="8">
<a-form-item :label="$t('enterpriseStandardLibrary.plan.oldEnterpriseStandardNum')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input :placeholder="$t('pleaseEnter')+$t('enterpriseStandardLibrary.plan.oldEnterpriseStandardNum')" v-model="queryParam.originEnStandardNo"></a-input>
</a-form-item>
</a-col>
<!-- 原企标名称 -->
<a-col :span="8">
<a-form-item :label="$t('enterpriseStandardLibrary.plan.oldEnterpriseStandardName')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input :placeholder="$t('pleaseEnter')+$t('enterpriseStandardLibrary.plan.oldEnterpriseStandardName')" v-model="queryParam.originEnStandardName"></a-input>
</a-form-item>
</a-col>
<template v-if="toggleSearchStatus">
<!-- 新企标编号 -->
<a-col :span="8">
<a-form-item :label="$t('enterpriseStandardLibrary.plan.newEnterpriseStandardNum')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input :placeholder="$t('pleaseEnter')+$t('enterpriseStandardLibrary.plan.newEnterpriseStandardNum')" v-model="queryParam.newEnStandardNo"></a-input>
</a-form-item>
</a-col>
<!-- 新企标名称 -->
<a-col :span="8">
<a-form-item :label="$t('enterpriseStandardLibrary.plan.newEnterpriseStandardName')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input :placeholder="$t('pleaseEnter')+$t('enterpriseStandardLibrary.plan.newEnterpriseStandardName')" v-model="queryParam.newEnStandardName"></a-input>
</a-form-item>
</a-col>
<!-- 主起草人 -->
<a-col :span="8">
<a-form-item :label="$t('enterpriseStandardLibrary.plan.principalDrafter')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input :placeholder="$t('pleaseEnter')+$t('enterpriseStandardLibrary.plan.principalDrafter')" v-model="queryParam.mainDraftingUser"></a-input>
</a-form-item>
</a-col>
<!-- 主起草单位 -->
<a-col :span="8">
<a-form-item :label="$t('enterpriseStandardLibrary.plan.mainDraftingUnit')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-tree-select
tree-node-filter-prop="title"
v-model="queryParam.mainDraftingUnit"
:maxTagCount="1"
:show-search="true"
:getPopupContainer="triggerNode=> triggerNode.parentNode"
class="box-input"
style="width: 100%"
:tree-data="categoryTreeList"
:placeholder="$t('pleaseSelect') + $t('enterpriseStandardLibrary.plan.mainDraftingUnit')"
/>
</a-form-item>
</a-col>
<!-- 主起草单位负责人 -->
<a-col :span="8">
<a-form-item :label="$t('enterpriseStandardLibrary.plan.headOfMainDraftingUnit')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input :placeholder="$t('pleaseEnter')+$t('enterpriseStandardLibrary.plan.headOfMainDraftingUnit')" v-model="queryParam.mainDraftingUnitResponsiblePerson"></a-input>
</a-form-item>
</a-col>
<!-- 制修订类型 -->
<a-col :span="8">
<a-form-item :label="$t('enterpriseStandardLibrary.plan.revisionType')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-dict-select-tag
:placeholder="$t('pleaseEnter')+$t('enterpriseStandardLibrary.plan.revisionType')"
dict-code="esp_revision_type"
v-model="queryParam.revisionType">
</j-dict-select-tag>
</a-form-item>
</a-col>
<!-- 标准推进人 -->
<a-col :span="8">
<a-form-item :label="$t('enterpriseStandardLibrary.plan.standardPusher')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input :placeholder="$t('pleaseEnter')+$t('enterpriseStandardLibrary.plan.standardPusher')+$t('workNo')" v-model="queryParam.standardPromoter"></a-input>
</a-form-item>
</a-col>
</template>
<div style="float: right;overflow: hidden;" class="table-page-search-submitButtons">
<a @click="handleToggleSearch">
{{ toggleSearchStatus ? $t('putAway') : $t('open') }}
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
</a>
<a-button type="primary" @click="searchQuery" icon="search" style="margin-left: 8px">{{ $t('query') }}</a-button>
<a-button type="primary" ghost @click="searchReset" icon="reload" style="margin-left: 8px">{{ $t('reset') }}</a-button>
</div>
</a-row>
</a-form>
</div>
<a-table
:columns="columns"
rowKey="id"
:scroll="{x: 900}"
:data-source="dataList"
:pagination="ipagination"
:row-selection="{ type: type, selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:loading="loading"
@change="handleTableChange">
<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>
<!-- 原企标编号/企标名称 -->
<template v-slot:toDetailOld="text, record">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<a v-if="text" class="link-a" @click="handleGoDetailOld(record)">{{ text }}</a>
<div v-else class="table-text">{{ global.emptyLine }}</div>
</a-tooltip>
</template>
<!-- 新企标编号/新企标名称 -->
<template v-slot:toDetailNew="text, record">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<a v-if="text && ['3', '5'].includes(record.projectStatus)" class="link-a" @click="handleGoDetailNew(record)">{{ text }}</a>
<div v-else-if="text" class="table-text">{{ text }}</div>
<div v-else class="table-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 { getEnterpriseStandardPlanPage } from '@/api/enterpriseStandardLibraryApi'
import { queryDepartTreeList } from '@/api/api'
export default {
name: 'EnterprisePlanSelectionModal',
props: {
value: {
type: String,
default: ''
},
type: {
type: String,
required: false,
default: 'checkbox'
},
searchParam: { // 根据不同模块传入固定的查询参数
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', '30', '50', '100', '150', '200'],
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('enterpriseStandardLibrary.plan.revisionType'),
align: 'center',
width: 180,
dataIndex: 'applicationCategory_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 原企标编号
title: this.$t('enterpriseStandardLibrary.plan.oldEnterpriseStandardNum'),
align: 'center',
width: 180,
dataIndex: 'originEnStandardNo',
scopedSlots: { customRender: 'toDetailOld' }
},
{ // 新企标编号
title: this.$t('enterpriseStandardLibrary.plan.newEnterpriseStandardNum'),
align: 'center',
width: 180,
dataIndex: 'newEnStandardNo',
scopedSlots: { customRender: 'toDetailNew' }
},
{ // 原企标名称
title: this.$t('enterpriseStandardLibrary.plan.oldEnterpriseStandardName'),
align: 'center',
width: 180,
dataIndex: 'originEnStandardName',
scopedSlots: { customRender: 'toDetailOld' }
},
{ // 新企标名称
title: this.$t('enterpriseStandardLibrary.plan.newEnterpriseStandardName'),
align: 'center',
width: 180,
dataIndex: 'newEnStandardName',
scopedSlots: { customRender: 'toDetailNew' }
},
{ // 授权部门
title: this.$t('enterpriseStandardLibrary.plan.authDepartment'),
align: 'center',
width: 180,
dataIndex: 'authDept_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 企业标准代号
title: this.$t('enterpriseStandardLibrary.plan.enterpriseStandardCode'),
align: 'center',
width: 180,
dataIndex: 'enStandardCode_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 配合单位
title: this.$t('enterpriseStandardLibrary.plan.suitUnit'),
align: 'center',
width: 180,
dataIndex: 'cooperationUnit_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 主起草人
title: this.$t('enterpriseStandardLibrary.plan.principalDrafter'),
align: 'center',
width: 180,
dataIndex: 'mainDraftingUser_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 主起草单位
title: this.$t('enterpriseStandardLibrary.plan.mainDraftingUnit'),
align: 'center',
width: 180,
dataIndex: 'mainDraftingUnit_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 主起草单位负责人
title: this.$t('enterpriseStandardLibrary.plan.headOfMainDraftingUnit'),
align: 'center',
width: 180,
dataIndex: 'mainDraftingUnitResponsiblePerson_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 标准推进人
title: this.$t('enterpriseStandardLibrary.plan.standardPusher'),
align: 'center',
width: 180,
dataIndex: 'standardPromoter_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 草稿计划完成日期
title: this.$t('enterpriseStandardLibrary.plan.draftPlanFinishDate'),
align: 'center',
width: 180,
dataIndex: 'draftPlannedCompleteDate',
scopedSlots: { customRender: 'specialDate' }
},
{ // 征求意见稿计划完成日期
title: this.$t('enterpriseStandardLibrary.plan.exposureDraftPlanFinishDate'),
align: 'center',
width: 200,
dataIndex: 'solicitationDraftPlanCompleteDate',
scopedSlots: { customRender: 'specialDate' }
},
{ // 计划报批日期
title: this.$t('enterpriseStandardLibrary.plan.planSubmissionDate'),
align: 'center',
width: 180,
dataIndex: 'planApprovalDate',
scopedSlots: { customRender: 'specialDate' }
},
{ // 项目状态
title: this.$t('enterpriseStandardLibrary.plan.projectStatus'),
align: 'center',
width: 180,
dataIndex: 'projectStatus_dictText',
scopedSlots: { customRender: 'text' }
}
],
dataList: [],
categoryTreeList: [], // 组织机构下拉框数据
toggleSearchStatus: false
}
},
mounted () {
this.getSysCategoryTree()
},
methods: {
open () {
this.visible = true
this.queryParam = {}
this.$nextTick(() => {
this.replacePage()
})
},
handleToggleSearch () {
this.toggleSearchStatus = !this.toggleSearchStatus
},
// 获取组织机构树
getSysCategoryTree () {
queryDepartTreeList().then((res) => {
if (res.success) {
this.categoryTreeList = res.result
} else {
this.categoryTreeList = []
}
})
},
// 企标编号,企标名称跳转详情,原企标
handleGoDetailOld (record) {
this.$openPageNewSheet({
path: '/enterpriseStandardLibrary/enterpriseStandardDetail',
query: {
standardNumber: record.originEnStandardNo
}
})
},
// 新企标点击跳转企标详情
handleGoDetailNew (record) {
this.$openPageNewSheet({
path: '/enterpriseStandardLibrary/enterpriseStandardDetail',
query: {
standardNumber: record.newEnStandardNo
}
})
},
// 获取表格数据
replacePage (arg) {
if (arg === 1) {
this.ipagination.current = 1
}
const query = {
...this.queryParam,
...this.searchParam,
pageNo: this.ipagination.current,
pageSize: this.ipagination.pageSize
}
this.selectedRowKeys = []
this.loading = true
getEnterpriseStandardPlanPage(query).then((res) => {
if (res.success) {
this.dataList = res.result.records
this.ipagination.total = res.result.total
this.selectedRowKeys = this.value.split(',')
} else {
this.dataList = []
}
}).finally(() => {
this.loading = false
})
},
handleTableChange (pagination) {
// 分页、排序、筛选变化时触发
this.ipagination = pagination
this.replacePage()
},
searchQuery () {
this.replacePage(1)
},
searchReset () {
this.queryParam = {}
this.replacePage(1)
},
// 表格选择改变
onSelectChange (value, row) {
this.selectedRowKeys = value
this.selectedRowList = row
},
handleCancel () {
this.close()
},
handleSubmit () {
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
const standardNumberList = this.selectedRowList.map(item => item.originEnStandardNo)
this.$emit('change', this.selectedRowKeys.join(','))
this.$emit('standardNumberChange', standardNumberList.join(','))
this.$emit('listChange', this.selectedRowList)
this.close()
} else {
this.$message.warning(this.$t('selectLeastOne'))
}
},
close () {
this.visible = false
this.ipagination = {
current: 1,
pageSize: 10,
pageSizeOptions: ['10', '30', '50', '100', '150', '200'],
showTotal: (total, range) => {
return range[0] + '-' + range[1] + ' ' + this.$t('total') + ' ' + total + ' ' + this.$t('strip')
},
showQuickJumper: true,
showSizeChanger: true,
total: 0
}
this.toggleSearchStatus = false
}
}
}
</script>
<style scoped lang="less">
@import '~@assets/less/common.less';
</style>