add 自定义比对(未完成)
This commit is contained in:
@@ -0,0 +1,240 @@
|
||||
<template>
|
||||
<a-drawer
|
||||
:title="title"
|
||||
:width="width"
|
||||
placement="right"
|
||||
:closable="true"
|
||||
@close="handleCancel"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
class="custom-drawer-style">
|
||||
|
||||
<div class="custom-drawer-style-scroll">
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-form :form="form">
|
||||
<!--清单名称-->
|
||||
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('docTool.customComparison.listName')">
|
||||
<a-input :placeholder="$t('pleaseEnter') + $t('docTool.customComparison.listName')"
|
||||
@change="event => event.target.value = event.target.value.trim()"
|
||||
:maxLength="50"
|
||||
v-decorator="['title', validatorRules.title]" />
|
||||
</a-form-item>
|
||||
<!--涉及标准-->
|
||||
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('docTool.customComparison.referenceStandard')">
|
||||
<standard-selection :placeholder="$t('pleaseSelect') + $t('docTool.customComparison.referenceStandard')"
|
||||
v-decorator="['serialNumber', validatorRules.serialNumber]" />
|
||||
</a-form-item>
|
||||
<!--涉及国家-->
|
||||
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('docTool.customComparison.countriesInvolved')">
|
||||
</a-form-item>
|
||||
<!--是否公开-->
|
||||
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('docTool.customComparison.whetherToMakePublic')">
|
||||
<j-dict-select-tag v-decorator="['serialNumber', validatorRules.serialNumber]"
|
||||
:placeholder="$t('pleaseSelect')+$t('docTool.customComparison.whetherToMakePublic')"
|
||||
type="radio"
|
||||
:triggerChange="false"
|
||||
dict-code="yn" />
|
||||
</a-form-item>
|
||||
<!--在线对比-->
|
||||
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('docTool.customComparison.onlineComparison')">
|
||||
<a-switch default-checked v-model="isStartComparison" />
|
||||
</a-form-item>
|
||||
<div v-show="isStartComparison" class="comparison-box">
|
||||
<div class="operation-box">
|
||||
<!--标准列表-->
|
||||
<a-button type="primary" ghost @click="viewStandardList">{{ $t('docTool.customComparison.standardList') }}</a-button>
|
||||
<!--对比维护-->
|
||||
<a-button type="primary" ghost @click="handleComparisonMaintain">
|
||||
{{ $t('docTool.customComparison.comparisonMaintain') }}
|
||||
</a-button>
|
||||
<!--编辑 preservation 点了编辑之后就变成保存了,保存成功之后再变成编辑-->
|
||||
<a-button type="primary" ghost @click="handleChangeEditState">
|
||||
{{ isEdit ? $t('docTool.customComparison.exitEdit') : $t('edit') }}
|
||||
</a-button>
|
||||
<!--导出-->
|
||||
<a-button type="primary" ghost @click="handleExportXls">{{ $t('export') }}</a-button>
|
||||
<!--对比分析结果-->
|
||||
<a-button type="primary" ghost>{{ $t('docTool.customComparison.comparativeAnalysisResult') }}</a-button>
|
||||
</div>
|
||||
<div>
|
||||
<a-table>
|
||||
|
||||
</a-table>
|
||||
</div>
|
||||
</div>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</div>
|
||||
|
||||
<!--标准列表-->
|
||||
<standard-list-drawer ref="standardListDrawer" @delete="handleDeleteStandard" />
|
||||
<!--对比维护-->
|
||||
<comparison-maintain-drawer ref="comparisonMaintainDrawer" @ok="reloadTableData" />
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import StandardSelection from '../../../../components/selection/StandardSelection'
|
||||
import { downFile } from '../../../../api/manage'
|
||||
import StandardListDrawer from './StandardListDrawer'
|
||||
import ComparisonMaintainDrawer from './ComparisonMaintainDrawer'
|
||||
|
||||
export default {
|
||||
name: 'CustomComparisonDrawer',
|
||||
components: { StandardSelection, StandardListDrawer, ComparisonMaintainDrawer },
|
||||
data () {
|
||||
return {
|
||||
title: '',
|
||||
confirmLoading: false,
|
||||
width: 900,
|
||||
visible: false,
|
||||
modal: {},
|
||||
form: this.$form.createForm(this),
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 3 }
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 20 }
|
||||
},
|
||||
validatorRules: {
|
||||
// 清单名称
|
||||
title: {
|
||||
rules: [{ required: true, message: this.$t('pleaseEnter') + this.$t('standardSelect.standardName') }],
|
||||
validateTrigger: 'blur'
|
||||
},
|
||||
// 涉及标准
|
||||
serialNumber: {
|
||||
rules: [{ required: true, message: this.$t('pleaseSelect') + this.$t('standardSelect.standardNumber') }],
|
||||
validateTrigger: 'change'
|
||||
},
|
||||
// 文本状态
|
||||
fileType: {
|
||||
rules: [{ required: true, message: this.$t('pleaseSelect') + this.$t('docTool.comparison.textStatus') }],
|
||||
validateTrigger: 'change'
|
||||
},
|
||||
// 拆分结果文件
|
||||
splitFileId: {
|
||||
rules: [{ required: true, message: this.$t('uploadFile.pleaseUpload') + this.$t('docTool.split.splitResultFile') }],
|
||||
validateTrigger: 'change'
|
||||
}
|
||||
},
|
||||
isStartComparison: true, // 是否发起比对,为是的时候显示下面的内容
|
||||
isEdit: false // 是否在编辑状态里
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
add () {
|
||||
this.visible = true
|
||||
},
|
||||
edit (record) {
|
||||
this.modal = Object.assign({}, record)
|
||||
},
|
||||
handleCancel () {
|
||||
this.close()
|
||||
},
|
||||
close () {
|
||||
this.visible = false
|
||||
},
|
||||
/**
|
||||
* 导出
|
||||
*/
|
||||
handleExportXls () {
|
||||
const fileName = this.$t('docTool.customComparison.listDetails')
|
||||
const fileSuffix = '.zip'
|
||||
// 加一个大的提示
|
||||
const modalLoading = this.$info({
|
||||
title: '提示',
|
||||
content: <span>正在导出,请稍候 <a-spin size="small" /></span>,
|
||||
keyboard: false
|
||||
})
|
||||
// 把知道了这个按钮去掉
|
||||
this.$nextTick(() => {
|
||||
document.getElementsByClassName('ant-modal-confirm-btns')[0].style = 'display:none'
|
||||
})
|
||||
downFile(this.url.exportXlsUrl).then((data) => {
|
||||
if (!data) {
|
||||
this.$message.warning('文件下载失败')
|
||||
return
|
||||
}
|
||||
if (typeof window.navigator.msSaveBlob !== 'undefined') {
|
||||
window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + fileSuffix)
|
||||
} else {
|
||||
const url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
|
||||
const link = document.createElement('a')
|
||||
link.style.display = 'none'
|
||||
link.href = url
|
||||
link.setAttribute('download', fileName + fileSuffix)
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link) // 下载完成移除元素
|
||||
window.URL.revokeObjectURL(url) // 释放掉blob对象
|
||||
}
|
||||
}).finally(() => {
|
||||
// 销毁这个提示
|
||||
modalLoading.destroy()
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 切换编辑状态
|
||||
*/
|
||||
handleChangeEditState () {
|
||||
this.isEdit = !this.isEdit
|
||||
},
|
||||
/**
|
||||
* 查看标准列表
|
||||
*/
|
||||
viewStandardList () {
|
||||
console.log(this.form.getFieldValue('serialNumber'))
|
||||
this.$refs.standardListDrawer.open()
|
||||
},
|
||||
/**
|
||||
* 删除标准
|
||||
* @param standardNumber
|
||||
*/
|
||||
handleDeleteStandard (standardNumber) {
|
||||
let selectedStandards = this.form.getFieldValue('serialNumber').split(',')
|
||||
selectedStandards = selectedStandards.filter(tt => tt !== standardNumber)
|
||||
const str = selectedStandards.join(',')
|
||||
this.form.setFieldsValue({ serialNumber: str })
|
||||
},
|
||||
/**
|
||||
* 重新加载表格数据
|
||||
*/
|
||||
reloadTableData () {
|
||||
|
||||
},
|
||||
/**
|
||||
* 对比维护
|
||||
*/
|
||||
handleComparisonMaintain () {
|
||||
this.$refs.comparisonMaintainDrawer.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
@import '~@assets/less/common.less';
|
||||
|
||||
.comparison-box {
|
||||
margin: 0 36px 0 30px;
|
||||
}
|
||||
|
||||
.operation-box {
|
||||
margin-bottom: 20px;
|
||||
|
||||
.ant-btn {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.ant-btn:first-child {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.custom-drawer-style-scroll {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user