123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- <template>
- <a-modal
- centered
- class="chooseImport-modal"
- :footer="null"
- :maskClosable="false"
- title="导入"
- v-model="isShow"
- @cancel="isShow=false"
- width="75%">
- <div class="chooseImport-con">
- <p class="">查询数据{{ loadData.length }}条</p>
- <a-table
- class="sTable"
- ref="table"
- size="small"
- :rowKey="(record) => record.allocateSn"
- :columns="nowColumns"
- :dataSource="loadData"
- :loading="loading"
- :scroll="{ y: 500 }"
- :pagination="false"
- bordered>
- </a-table>
- <!-- 按钮 -->
- <div class="btn-con">
- <a-button
- id="chooseImport-cancel"
- size="large"
- class="button-cancel"
- @click="isShow=false"
- style="padding: 0 40px;margin-left: 15px;">取消</a-button>
- <a-button
- type="primary"
- id="chooseImport-error"
- size="large"
- class="button-error"
- @click="handleExport"
- style="padding: 0 40px;margin-left: 15px;">导出</a-button>
- </div>
- </div>
- </a-modal>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- // 组件
- import { hdExportExcel } from '@/libs/exportExcel'
- // 接口
- import { productForeignQueryList, productForeignExport } from '@/api/productForeign'
- export default {
- name: 'ChooseImportModal',
- mixins: [commonMixin],
- props: {
- openModal: { // 弹框显示状态
- type: Boolean,
- default: false
- },
- paramsData: {
- type: Object,
- default: () => {
- return {}
- }
- }
- },
- data () {
- const _this = this
- return {
- isShow: this.openModal, // 是否打开弹框
- nowColumns: [
- { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
- { title: '查询码', dataIndex: 'queryCode', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '外贸产品编码', dataIndex: 'foreignCode', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '箭冠产品编码', dataIndex: 'productCode', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: 'OE码', dataIndex: 'oeCode', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '大厂码',
- children: [
- {
- title: 'MANN No.', dataIndex: 'mannCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' }
- },
- {
- title: 'MAHLE No.', dataIndex: 'mahleCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' }
- },
- {
- title: 'VIC No.', dataIndex: 'vicCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' }
- },
- {
- title: 'FRAM NO.', dataIndex: 'framCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' }
- },
- {
- title: 'WIX No.', dataIndex: 'wixCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' }
- }
- ]
- },
- { title: '产品尺寸', dataIndex: 'size', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '主材料', dataIndex: 'material', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '含盒报价', dataIndex: 'priceFreeBox', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
- { title: '无盒报价', dataIndex: 'priceWithBox', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
- ],
- loadData: [],
- loading: false
- }
- },
- methods: {
- getData () {
- const _this = this
- _this.loading = true
- const params = {
- path: _this.paramsData.path
- }
- productForeignQueryList(params).then(res => {
- _this.loading = false
- if (res.status == 200) {
- if (res.data && res.data.length > 0) {
- res.data.map((item, index) => {
- item.no = index + 1
- })
- }
- _this.loadData = res.data || []
- }
- })
- },
- // 导出
- handleExport () {
- const _this = this
- if (_this.loadData.length < 1) {
- _this.$message.info('暂无可导出的产品~')
- return
- }
- _this.spinning = true
- const newLoadData = _this.loadData.map(item => {
- if (item.productEntity) {
- item.productName = item.productEntity.name
- item.productCode = item.productEntity.code
- item.productOrigCode = item.productEntity.origCode
- item.productTypeName1 = item.productEntity.productTypeName1
- item.productTypeName2 = item.productEntity.productTypeName2
- item.productTypeName3 = item.productEntity.productTypeName3
- }
- return item
- })
- hdExportExcel(productForeignExport, newLoadData, '外贸产品', function () {
- _this.spinning = false
- })
- }
- },
- watch: {
- // 父页面传过来的弹框状态
- openModal (newValue, oldValue) {
- this.isShow = newValue
- },
- // 重定义的弹框状态
- isShow (newValue, oldValue) {
- if (!newValue) {
- this.$emit('close')
- this.loadData = []
- } else {
- this.getData()
- }
- }
- }
- }
- </script>
- <style lang="less" scoped>
- .chooseImport-modal{
- .chooseImport-con{
- /deep/.sTable td{
- white-space: pre-line;
- }
- .btn-con{
- text-align: center;
- margin: 30px 0 20px;
- .button-cancel,.button-error{
- font-size: 12px;
- }
- }
- }
- }
- </style>
|