declareElementsModal.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <div id="declareElementsModal">
  3. <a-modal
  4. title="报关要素"
  5. v-model="declareElementsModVis"
  6. :confirmLoading="confirmLoading"
  7. @cancel="handleCancel"
  8. width="60%"
  9. style="top:330px;left:100px;"
  10. >
  11. <!-- 主表信息 回显 -->
  12. <a-card :bordered="false">
  13. <div class="table-page-search-wrapper">
  14. <a-form-model layout="inline" ref="form" :model="declareElements">
  15. <a-row :gutter="24">
  16. <a-col :md="6" :sm="8" style="display: none;">
  17. <a-form-model-item label="ID" prop="id">
  18. {{ declareElements.id }}
  19. </a-form-model-item>
  20. </a-col>
  21. <a-col :md="6" :sm="8" style="display: none;">
  22. <a-form-model-item label="账套" prop="acSetNo">
  23. {{ declareElements.acSetNo }}
  24. </a-form-model-item>
  25. </a-col>
  26. <a-col :md="6" :sm="8" style="display: none;">
  27. <a-form-model-item label="款号" prop="itemNumber">
  28. {{ declareElements.itemNumber }}
  29. </a-form-model-item>
  30. </a-col>
  31. <a-col :md="6" :sm="8" style="display: none;">
  32. <a-form-model-item label="存货名称" prop="inventoryName">
  33. {{ declareElements.inventoryName }}
  34. </a-form-model-item>
  35. </a-col>
  36. <a-col :md="6" :sm="8">
  37. <a-form-model-item label="报关品名" prop="declarationName">
  38. <a-input placeholder="请输入报关品名" v-model="declareElements.declarationName"></a-input>
  39. </a-form-model-item>
  40. </a-col>
  41. <!-- <a-col :md="6" :sm="8">
  42. <a-form-model-item label="报关品名" prop="declarationName">
  43. {{ declareElements.declarationName }}
  44. </a-form-model-item>
  45. </a-col> -->
  46. <a-col :md="6" :sm="8">
  47. <a-form-model-item label="HSCODE" prop="hsCode">
  48. <a-input placeholder="请输入HSCODE" v-model="declareElements.hsCode"></a-input>
  49. </a-form-model-item>
  50. </a-col>
  51. <!-- <a-col :md="6" :sm="8">
  52. <a-form-model-item label="HSCODE" prop="hsCode">
  53. {{ declareElements.hsCode }}
  54. </a-form-model-item>
  55. </a-col> -->
  56. <a-col :md="6" :sm="8">
  57. <a-form-model-item label="英文品名" prop="englishProductName">
  58. <a-input placeholder="请输入英文品名" v-model="declareElements.englishProductName"></a-input>
  59. </a-form-model-item>
  60. </a-col>
  61. <!-- <a-col :md="6" :sm="8">
  62. <a-form-model-item label="英文品名" prop="englishProductName">
  63. {{ declareElements.englishProductName }}
  64. </a-form-model-item>
  65. </a-col> -->
  66. </a-row>
  67. </a-form-model>
  68. </div>
  69. </a-card>
  70. <!-- 増行 子表 -->
  71. <a-card :bordered="false" style="margin:10px 0">
  72. <a-button type="primary" @click="handleAddColumn" icon="plus" style="margin:10px 0;">
  73. 増行
  74. </a-button>
  75. <!-- 子表 -->
  76. <a-spin :spinning="confirmLoading">
  77. <a-form-model ref="formRef">
  78. <a-table
  79. v-if="declareElementsData"
  80. bordered
  81. rowKey="id"
  82. :columns="declareElementsColumns"
  83. :data-source="declareElementsData"
  84. :loading="loading"
  85. :pagination="false"
  86. >
  87. <!-- 类型 下拉选择 -->
  88. <template slot="typeValueSlot" slot-scope="text, record, index">
  89. <a-form-model-item prop="typeValue">
  90. <a-select v-model="record.typeValue" style="width:100%">
  91. <a-select-option value="">请选择</a-select-option>
  92. <a-select-option :value="0">品名</a-select-option>
  93. <a-select-option :value="1">织造方法(针织或钩编)</a-select-option>
  94. <a-select-option :value="2">种类(西服、便服套装、上衣、长裤、马裤、工装裤等)</a-select-option>
  95. <a-select-option :value="3">类别(女式)</a-select-option>
  96. <a-select-option :value="4">成分含量</a-select-option>
  97. <a-select-option :value="5">品牌</a-select-option>
  98. <a-select-option :value="6">货号</a-select-option>
  99. <a-select-option :value="7">品牌类型</a-select-option>
  100. <a-select-option :value="8">出口享惠情况</a-select-option>
  101. </a-select>
  102. </a-form-model-item>
  103. </template>
  104. <!-- 描述 输入框-->
  105. <template slot="describeText" slot-scope="text, record, index">
  106. <a-form-model-item prop="describeText">
  107. <a-input style="width:100%" type="text" v-model="record.describeText" />
  108. </a-form-model-item>
  109. </template>
  110. <!-- 操作 -->
  111. <span slot="operationSlot" slot-scope="text, record, index">
  112. <a-popconfirm title="确定删除吗?" ok-text="是" cancel-text="否" @confirm="handleDelete(index)">
  113. <a href="javascript:void(0);" style="color:red;">删除</a>
  114. </a-popconfirm>
  115. </span>
  116. </a-table>
  117. </a-form-model>
  118. </a-spin>
  119. </a-card>
  120. <!-- 页面底部保存取消 -->
  121. <div
  122. :style="{
  123. position: 'absolute',
  124. right: 0,
  125. bottom: 0,
  126. width: '100%',
  127. borderTop: '1px solid #e9e9e9',
  128. padding: '10px 16px',
  129. background: '#fff',
  130. textAlign: 'right',
  131. zIndex: 1
  132. }"
  133. >
  134. <a-popconfirm title="确定放弃?" @confirm="handleCancel" okText="确定" cancelText="取消">
  135. <a-button :style="{ marginRight: '8px' }">返回</a-button>
  136. </a-popconfirm>
  137. <a-button type="primary" @click="addSave">
  138. 保存
  139. </a-button>
  140. </div>
  141. </a-modal>
  142. </div>
  143. </template>
  144. <script>
  145. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  146. import JEllipsis from '@/components/jeecg/JEllipsis'
  147. import moment from 'moment'
  148. import { syDeclarationElementsAdd } from '@api/document/shipmentList'
  149. export default {
  150. name: 'DeclareElementsModal', // 报关要素
  151. mixins: [JeecgListMixin],
  152. components: { JEllipsis, moment },
  153. data() {
  154. let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} /> // 省略
  155. return {
  156. loading: false, // 表格加载
  157. // 子表表头
  158. declareElementsColumns: [
  159. {
  160. title: '序号',
  161. width: 30,
  162. dataIndex: 'index',
  163. customRender: (text, record, index) => `${index + 1}`,
  164. className: 'replacecolor'
  165. },
  166. {
  167. title: '类型',
  168. dataIndex: 'typeValue',
  169. width: 80,
  170. scopedSlots: { customRender: 'typeValueSlot' },
  171. // customRender: t => ellipsis(t),
  172. className: 'replacecolor'
  173. },
  174. {
  175. title: '描述',
  176. dataIndex: 'describeText',
  177. width: 80,
  178. scopedSlots: { customRender: 'describeText' },
  179. className: 'replacecolor'
  180. },
  181. {
  182. title: '操作',
  183. dataIndex: 'operation',
  184. scopedSlots: { customRender: 'operationSlot' },
  185. width: 30,
  186. className: 'replacecolor'
  187. }
  188. ],
  189. declareElements: {}, // 主表信息
  190. declareElementsData: [], // 子表信息
  191. confirmLoading: false,
  192. declareElementsModVis: false
  193. }
  194. },
  195. // 接收父组件 方法
  196. props: {},
  197. created() {},
  198. methods: {
  199. // 増行
  200. handleAddColumn() {
  201. console.log('増行')
  202. const addrow = {
  203. index: '',
  204. typeValue: '',
  205. describeText: '',
  206. operation: ''
  207. }
  208. this.declareElementsData.push(addrow)
  209. },
  210. // 报关要素 保存
  211. addSave() {
  212. console.log('点击报关要素对话框 保存')
  213. var newObj = {} // 新增主表
  214. newObj.id = this.declareElements.id
  215. newObj.declarationName = this.declareElements.declarationName //报关品名
  216. newObj.hsCode = this.declareElements.hsCode //报关品名
  217. newObj.englishProductName = this.declareElements.englishProductName //英文品名
  218. newObj.acSetNo = this.declareElements.acSetNo //账套
  219. newObj.inventoryName = this.declareElements.inventoryName //物料名称
  220. newObj.itemNumber = this.declareElements.itemNumber //款号
  221. // 新增子表
  222. newObj.syDeclarationElementsItemList = this.declareElementsData
  223. // newDeclareElement.documentNo = this.addShipDet.documentNo // 单据号
  224. syDeclarationElementsAdd(newObj).then(res => {
  225. if (res.success) {
  226. this.$message.success('新增成功')
  227. console.log('新增的对象', newObj)
  228. this.close()
  229. }
  230. })
  231. this.close()
  232. // 刷新
  233. },
  234. handletypeValue(e) {
  235. console.log('类型下拉菜单click', e)
  236. },
  237. // 操作 删除
  238. handleDelete(index) {
  239. console.log('index', index)
  240. console.log('删除报关要素数据', index)
  241. return this.declareElementsData.splice(index, 1)
  242. },
  243. close() {
  244. this.$emit('close')
  245. this.declareElementsModVis = false
  246. this.declareElements = {}
  247. this.declareElementsData = []
  248. // console.log('清空')
  249. },
  250. handleCancel() {
  251. this.close()
  252. },
  253. handleTableChange() {
  254. console.log('??这是啥')
  255. }
  256. },
  257. computed: {}
  258. }
  259. </script>
  260. <style lang="less" scoped>
  261. @import '~@assets/less/common.less';
  262. @import '~@assets/less/overwriter.less';
  263. /deep/ .ant-table-thead > tr > th {
  264. text-align: center;
  265. // font-weight: 700;
  266. }
  267. /deep/ .ant-table-tbody {
  268. text-align: center;
  269. }
  270. // th.replacecolor {
  271. // background-color: #ccc;
  272. // }
  273. // 对话框里的card样式
  274. /deep/ .ant-modal-content {
  275. background-color: #f0f2f5;
  276. }
  277. /deep/ .ant-modal-body {
  278. padding: 10px;
  279. }
  280. </style>