editDeclareDrawer.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <!-- 编辑 回显且可编辑-->
  3. <div id="editDeclareDrawer">
  4. <a-drawer
  5. title="编辑"
  6. width="89%"
  7. placement="right"
  8. :closable="true"
  9. :visible="visible"
  10. @close="handleCancel">
  11. <!-- 主表信息 回显可编辑信息 -->
  12. <a-card :bordered="false">
  13. <div class="table-page-search-wrapper">
  14. <a-form-model layout="inline" ref="form" :model="editDeclareDrawer">
  15. <a-row :gutter="24">
  16. <a-col :md="6" :sm="8">
  17. <a-form-model-item label="商品税号" prop="proTaxNum">
  18. <a-input v-model="editDeclareDrawer.proTaxNum"></a-input>
  19. </a-form-model-item>
  20. </a-col>
  21. <a-col :md="6" :sm="8">
  22. <a-form-model-item label="商品名称" prop="proName">
  23. <a-input v-model="editDeclareDrawer.proName"></a-input>
  24. </a-form-model-item>
  25. </a-col>
  26. <a-col :md="6" :sm="8">
  27. <a-form-model-item label="订单号" prop="orderNum">
  28. <a-input v-model="editDeclareDrawer.orderNum"></a-input>
  29. </a-form-model-item>
  30. </a-col>
  31. </a-row>
  32. </a-form-model>
  33. </div>
  34. </a-card>
  35. <!--操作按钮区域 选择托书 増行-->
  36. <a-card :bordered="false" style="margin:10px 0 60px 0;">
  37. <div class="table-operator">
  38. <a-button type="primary" @click="selectBook" icon="ordered-list">选择托书</a-button>
  39. <a-button type="primary" @click="handleAddColumn" icon="plus" style="margin-left: 20px">増行</a-button>
  40. </div>
  41. <!-- 子表-->
  42. <a-spin :spinning="confirmLoading">
  43. <a-form-model ref="formRef">
  44. <a-table
  45. bordered
  46. rowKey="id"
  47. :columns="editDeclareColumns"
  48. :data-source="editDeclareData"
  49. :loading="loading"
  50. :pagination="false"
  51. @change="handleTableChange"
  52. >
  53. <!-- 操作 -->
  54. <span slot="operationSlot" slot-scope="text, record">
  55. <a-popconfirm title="确定删除吗?" ok-text="是" cancel-text="否" @confirm="handleDelete(record.id)">
  56. <a href="javascript:void(0);" style="color:red;">删除</a>
  57. </a-popconfirm>
  58. </span>
  59. </a-table>
  60. </a-form-model>
  61. </a-spin>
  62. </a-card>
  63. <!-- 页面底部提交取消 -->
  64. <div
  65. :style="{
  66. position: 'absolute',
  67. right: 0,
  68. bottom: 0,
  69. width: '100%',
  70. borderTop: '1px solid #e9e9e9',
  71. padding: '10px 16px',
  72. background: '#fff',
  73. textAlign: 'right',
  74. zIndex: 1
  75. }"
  76. >
  77. <a-popconfirm title="确定放弃编辑?" @confirm="handleCancel" okText="确定" cancelText="取消">
  78. <a-button :style="{ marginRight: '8px' }">取消</a-button>
  79. </a-popconfirm>
  80. <a-button type="primary" @click="submitAdd">
  81. 提交
  82. </a-button>
  83. </div>
  84. </a-drawer>
  85. <!-- 选择托书 弹框 -->
  86. <selectBook-modal ref="selectBookModal" :father="aa" @ok="modalFormOk"></selectBook-modal>
  87. </div>
  88. </template>
  89. <script>
  90. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  91. import JEllipsis from '@/components/jeecg/JEllipsis'
  92. import SelectBookModal from '@views/declare-elements/selectBookModal.vue'
  93. export default {
  94. name: 'EditDeclareDrawer', // 编辑 申报要素
  95. mixins: [JeecgListMixin],
  96. components: { SelectBookModal, JEllipsis }, // 选择托书
  97. data() {
  98. // let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} />
  99. return {
  100. // 表头
  101. editDeclareColumns: [
  102. {
  103. title: '序号',
  104. width: 90,
  105. dataIndex: 'index',
  106. customRender: (text, record, index) => `${index + 1}`,
  107. className: 'replacecolor'
  108. },
  109. {
  110. title: '申报要素内容',
  111. dataIndex: 'decEleContent',
  112. width: 90,
  113. className: 'replacecolor'
  114. },
  115. {
  116. title: '描述',
  117. dataIndex: 'desc',
  118. width: 160,
  119. className: 'replacecolor'
  120. },
  121. {
  122. title: '操作',
  123. dataIndex: 'operation',
  124. scopedSlots: { customRender: 'operationSlot' },
  125. width: 120,
  126. className: 'replacecolor'
  127. }
  128. ],
  129. editDeclareData: [
  130. { decEleContent: '品名', desc: '化纤制针织毛圈布' },
  131. { decEleContent: '织造方法', desc: '针织/钩编' },
  132. {}
  133. ],
  134. loading: false, // 表格加载
  135. visible: false,
  136. editDeclareDrawer: {},
  137. confirmLoading: false
  138. }
  139. },
  140. created() {},
  141. methods: {
  142. // 选择托书
  143. selectBook() {
  144. console.log('打开选择托书 弹框')
  145. this.$refs.selectBookModal.selectBookModVis = true
  146. },
  147. // 増行
  148. handleAddColumn() {
  149. console.log('増行')
  150. const addrow = {
  151. index: '',
  152. decEleContent: '',
  153. desc: '',
  154. operation: ''
  155. }
  156. this.editDeclareData.push(addrow)
  157. },
  158. // ----------------------------------------
  159. // 操作按钮 删除
  160. handleDelete(record) {},
  161. // 抽屉 取消
  162. handleCancel() {
  163. console.log('点击抽屉取消')
  164. this.close()
  165. },
  166. // 抽屉 提交
  167. submitAdd() {
  168. console.log('保存编辑、刷新申报列表')
  169. const that = this
  170. // 触发表单验证
  171. this.$refs.form.validate(valid => {
  172. if (valid) {
  173. that.confirmLoading = true
  174. }
  175. })
  176. this.close()
  177. // this.getShipmentList() // 刷新 申报列表
  178. },
  179. // -------------------------------------
  180. close() {
  181. this.$emit('close')
  182. this.visible = false
  183. this.$refs.form.resetFields()
  184. },
  185. aa() {},
  186. modalFormOk() {}
  187. },
  188. computed: {},
  189. mounted() {}
  190. }
  191. </script>
  192. <style lang="less" scoped>
  193. @import '~@assets/less/common.less';
  194. /deep/ .ant-table-thead > tr > th {
  195. text-align: center;
  196. // font-weight: 700;
  197. }
  198. /deep/ .ant-table-tbody {
  199. text-align: center;
  200. }
  201. // /deep/ th.replacecolor {
  202. // background-color: #ccc;
  203. // }
  204. // 抽屉里的card样式
  205. /deep/ .ant-drawer-content {
  206. background-color: #f0f2f5;
  207. }
  208. /deep/ .ant-drawer-body {
  209. padding: 10px;
  210. }
  211. </style>