123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- <template>
- <div id="declareElementsModal">
- <a-modal
- title="报关要素"
- v-model="declareElementsModVis"
- :confirmLoading="confirmLoading"
- @cancel="handleCancel"
- width="60%"
- style="top:330px;left:100px;"
- >
- <!-- 主表信息 回显 -->
- <a-card :bordered="false">
- <div class="table-page-search-wrapper">
- <a-form-model layout="inline" ref="form" :model="declareElements">
- <a-row :gutter="24">
- <a-col :md="6" :sm="8" style="display: none;">
- <a-form-model-item label="ID" prop="id">
- {{ declareElements.id }}
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8" style="display: none;">
- <a-form-model-item label="账套" prop="acSetNo">
- {{ declareElements.acSetNo }}
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8" style="display: none;">
- <a-form-model-item label="款号" prop="itemNumber">
- {{ declareElements.itemNumber }}
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8" style="display: none;">
- <a-form-model-item label="存货名称" prop="inventoryName">
- {{ declareElements.inventoryName }}
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-model-item label="报关品名" prop="declarationName">
- <a-input placeholder="请输入报关品名" v-model="declareElements.declarationName"></a-input>
- </a-form-model-item>
- </a-col>
- <!-- <a-col :md="6" :sm="8">
- <a-form-model-item label="报关品名" prop="declarationName">
- {{ declareElements.declarationName }}
- </a-form-model-item>
- </a-col> -->
- <a-col :md="6" :sm="8">
- <a-form-model-item label="HSCODE" prop="hsCode">
- <a-input placeholder="请输入HSCODE" v-model="declareElements.hsCode"></a-input>
- </a-form-model-item>
- </a-col>
- <!-- <a-col :md="6" :sm="8">
- <a-form-model-item label="HSCODE" prop="hsCode">
- {{ declareElements.hsCode }}
- </a-form-model-item>
- </a-col> -->
- <a-col :md="6" :sm="8">
- <a-form-model-item label="英文品名" prop="englishProductName">
- <a-input placeholder="请输入英文品名" v-model="declareElements.englishProductName"></a-input>
- </a-form-model-item>
- </a-col>
- <!-- <a-col :md="6" :sm="8">
- <a-form-model-item label="英文品名" prop="englishProductName">
- {{ declareElements.englishProductName }}
- </a-form-model-item>
- </a-col> -->
- </a-row>
- </a-form-model>
- </div>
- </a-card>
- <!-- 増行 子表 -->
- <a-card :bordered="false" style="margin:10px 0">
- <a-button type="primary" @click="handleAddColumn" icon="plus" style="margin:10px 0;">
- 増行
- </a-button>
- <!-- 子表 -->
- <a-spin :spinning="confirmLoading">
- <a-form-model ref="formRef">
- <a-table
- v-if="declareElementsData"
- bordered
- rowKey="id"
- :columns="declareElementsColumns"
- :data-source="declareElementsData"
- :loading="loading"
- :pagination="false"
- >
- <!-- 类型 下拉选择 -->
- <template slot="typeValueSlot" slot-scope="text, record, index">
- <a-form-model-item prop="typeValue">
- <a-select v-model="record.typeValue" style="width:100%">
- <a-select-option value="">请选择</a-select-option>
- <a-select-option :value="0">品名</a-select-option>
- <a-select-option :value="1">织造方法(针织或钩编)</a-select-option>
- <a-select-option :value="2">种类(西服、便服套装、上衣、长裤、马裤、工装裤等)</a-select-option>
- <a-select-option :value="3">类别(女式)</a-select-option>
- <a-select-option :value="4">成分含量</a-select-option>
- <a-select-option :value="5">品牌</a-select-option>
- <a-select-option :value="6">货号</a-select-option>
- <a-select-option :value="7">品牌类型</a-select-option>
- <a-select-option :value="8">出口享惠情况</a-select-option>
- </a-select>
- </a-form-model-item>
- </template>
- <!-- 描述 输入框-->
- <template slot="describeText" slot-scope="text, record, index">
- <a-form-model-item prop="describeText">
- <a-input style="width:100%" type="text" v-model="record.describeText" />
- </a-form-model-item>
- </template>
- <!-- 操作 -->
- <span slot="operationSlot" slot-scope="text, record, index">
- <a-popconfirm title="确定删除吗?" ok-text="是" cancel-text="否" @confirm="handleDelete(index)">
- <a href="javascript:void(0);" style="color:red;">删除</a>
- </a-popconfirm>
- </span>
- </a-table>
- </a-form-model>
- </a-spin>
- </a-card>
- <!-- 页面底部保存取消 -->
- <div
- :style="{
- position: 'absolute',
- right: 0,
- bottom: 0,
- width: '100%',
- borderTop: '1px solid #e9e9e9',
- padding: '10px 16px',
- background: '#fff',
- textAlign: 'right',
- zIndex: 1
- }"
- >
- <a-popconfirm title="确定放弃?" @confirm="handleCancel" okText="确定" cancelText="取消">
- <a-button :style="{ marginRight: '8px' }">返回</a-button>
- </a-popconfirm>
- <a-button type="primary" @click="addSave">
- 保存
- </a-button>
- </div>
- </a-modal>
- </div>
- </template>
- <script>
- import { JeecgListMixin } from '@/mixins/JeecgListMixin'
- import JEllipsis from '@/components/jeecg/JEllipsis'
- import moment from 'moment'
- import { syDeclarationElementsAdd } from '@api/document/shipmentList'
- export default {
- name: 'DeclareElementsModal', // 报关要素
- mixins: [JeecgListMixin],
- components: { JEllipsis, moment },
- data() {
- let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} /> // 省略
- return {
- loading: false, // 表格加载
- // 子表表头
- declareElementsColumns: [
- {
- title: '序号',
- width: 30,
- dataIndex: 'index',
- customRender: (text, record, index) => `${index + 1}`,
- className: 'replacecolor'
- },
- {
- title: '类型',
- dataIndex: 'typeValue',
- width: 80,
- scopedSlots: { customRender: 'typeValueSlot' },
- // customRender: t => ellipsis(t),
- className: 'replacecolor'
- },
- {
- title: '描述',
- dataIndex: 'describeText',
- width: 80,
- scopedSlots: { customRender: 'describeText' },
- className: 'replacecolor'
- },
- {
- title: '操作',
- dataIndex: 'operation',
- scopedSlots: { customRender: 'operationSlot' },
- width: 30,
- className: 'replacecolor'
- }
- ],
- declareElements: {}, // 主表信息
- declareElementsData: [], // 子表信息
- confirmLoading: false,
- declareElementsModVis: false
- }
- },
- // 接收父组件 方法
- props: {},
- created() {},
- methods: {
- // 増行
- handleAddColumn() {
- console.log('増行')
- const addrow = {
- index: '',
- typeValue: '',
- describeText: '',
- operation: ''
- }
- this.declareElementsData.push(addrow)
- },
- // 报关要素 保存
- addSave() {
- console.log('点击报关要素对话框 保存')
- var newObj = {} // 新增主表
- newObj.id = this.declareElements.id
- newObj.declarationName = this.declareElements.declarationName //报关品名
- newObj.hsCode = this.declareElements.hsCode //报关品名
- newObj.englishProductName = this.declareElements.englishProductName //英文品名
- newObj.acSetNo = this.declareElements.acSetNo //账套
- newObj.inventoryName = this.declareElements.inventoryName //物料名称
- newObj.itemNumber = this.declareElements.itemNumber //款号
- // 新增子表
- newObj.syDeclarationElementsItemList = this.declareElementsData
- // newDeclareElement.documentNo = this.addShipDet.documentNo // 单据号
- syDeclarationElementsAdd(newObj).then(res => {
- if (res.success) {
- this.$message.success('新增成功')
- console.log('新增的对象', newObj)
- this.close()
- }
- })
- this.close()
- // 刷新
- },
- handletypeValue(e) {
- console.log('类型下拉菜单click', e)
- },
- // 操作 删除
- handleDelete(index) {
- console.log('index', index)
- console.log('删除报关要素数据', index)
- return this.declareElementsData.splice(index, 1)
- },
- close() {
- this.$emit('close')
- this.declareElementsModVis = false
- this.declareElements = {}
- this.declareElementsData = []
- // console.log('清空')
- },
- handleCancel() {
- this.close()
- },
- handleTableChange() {
- console.log('??这是啥')
- }
- },
- computed: {}
- }
- </script>
- <style lang="less" scoped>
- @import '~@assets/less/common.less';
- @import '~@assets/less/overwriter.less';
- /deep/ .ant-table-thead > tr > th {
- text-align: center;
- // font-weight: 700;
- }
- /deep/ .ant-table-tbody {
- text-align: center;
- }
- // th.replacecolor {
- // background-color: #ccc;
- // }
- // 对话框里的card样式
- /deep/ .ant-modal-content {
- background-color: #f0f2f5;
- }
- /deep/ .ant-modal-body {
- padding: 10px;
- }
- </style>
|