SyCarryModal.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <a-modal
  3. :title="title"
  4. width="85%"
  5. :visible="visible"
  6. :maskClosable="false"
  7. :confirmLoading="confirmLoading"
  8. @ok="handleOk"
  9. @cancel="handleCancel">
  10. <a-spin :spinning="confirmLoading">
  11. <!-- 主表单区域 -->
  12. <a-form :form="form">
  13. <a-row>
  14. <a-col :span="12">
  15. <a-form-item
  16. :labelCol="labelCol"
  17. :wrapperCol="wrapperCol"
  18. label="编号">
  19. <a-input placeholder="请输入编号" v-decorator="['code', {}]"/>
  20. </a-form-item>
  21. </a-col>
  22. <a-col :span="12">
  23. <a-form-item
  24. :labelCol="labelCol"
  25. :wrapperCol="wrapperCol"
  26. label="名称">
  27. <a-input placeholder="请输入名称" v-decorator="['name', {}]"/>
  28. </a-form-item>
  29. </a-col>
  30. </a-row>
  31. <a-row>
  32. <a-col :span="24">
  33. <a-form-item
  34. :labelCol="labelCol"
  35. :wrapperCol="wrapperCol"
  36. label="备注">
  37. <a-input type="textarea" placeholder="请输入备注" v-decorator="['demo', {}]"/>
  38. </a-form-item>
  39. </a-col>
  40. </a-row>
  41. </a-form>
  42. <!-- 子表单区域 -->
  43. <a-tabs v-model="activeKey" @change="handleChangeTabs">
  44. <a-tab-pane tab="搬运工对账单" :key="refKeys[0]" :forceRender="true">
  45. <j-editable-table
  46. :ref="refKeys[0]"
  47. :loading="syCarryBTable.loading"
  48. :columns="syCarryBTable.columns"
  49. :dataSource="syCarryBTable.dataSource"
  50. :maxHeight="300"
  51. :rowNumber="true"
  52. :rowSelection="true"
  53. :actionButton="true"/>
  54. </a-tab-pane>
  55. </a-tabs>
  56. </a-spin>
  57. </a-modal>
  58. </template>
  59. <script>
  60. import moment from 'moment'
  61. import pick from 'lodash.pick'
  62. import { FormTypes } from '@/utils/JEditableTableUtil'
  63. import { JEditableTableMixin } from '@/mixins/JEditableTableMixin'
  64. export default {
  65. name: 'SyCarryModal',
  66. mixins: [JEditableTableMixin],
  67. data() {
  68. return {
  69. // 新增时子表默认添加几行空数据
  70. addDefaultRowNum: 1,
  71. validatorRules: {
  72. },
  73. refKeys: ['syCarryB', ],
  74. activeKey: 'syCarryB',
  75. // 搬运装卸费用-搬运工对账单-子表
  76. syCarryBTable: {
  77. loading: false,
  78. dataSource: [],
  79. columns: [
  80. {
  81. title: '日期',
  82. key: 'orderDate',
  83. type: FormTypes.datetime,
  84. defaultValue: '',
  85. placeholder: '请输入${title}',
  86. },
  87. {
  88. title: '总件数',
  89. key: 'allNum',
  90. type: FormTypes.inputNumber,
  91. defaultValue: '',
  92. placeholder: '请输入${title}',
  93. },
  94. {
  95. title: '明细',
  96. key: 'detailedNum',
  97. type: FormTypes.inputNumber,
  98. defaultValue: '',
  99. placeholder: '请输入${title}',
  100. },
  101. {
  102. title: '衣架',
  103. key: 'coatHanger',
  104. type: FormTypes.inputNumber,
  105. defaultValue: '',
  106. placeholder: '请输入${title}',
  107. },
  108. {
  109. title: '集装箱号',
  110. key: 'containerNo',
  111. type: FormTypes.input,
  112. defaultValue: '',
  113. placeholder: '请输入${title}',
  114. },
  115. {
  116. title: '发票号',
  117. key: 'invoiceNo',
  118. type: FormTypes.input,
  119. defaultValue: '',
  120. placeholder: '请输入${title}',
  121. },
  122. {
  123. title: '价格',
  124. key: 'price',
  125. type: FormTypes.inputNumber,
  126. defaultValue: '',
  127. placeholder: '请输入${title}',
  128. },
  129. {
  130. title: '计划员',
  131. key: 'jhyName',
  132. type: FormTypes.input,
  133. defaultValue: '',
  134. placeholder: '请输入${title}',
  135. },
  136. {
  137. title: '签名',
  138. key: 'jhyNameData',
  139. type: FormTypes.input,
  140. defaultValue: '',
  141. placeholder: '请输入${title}',
  142. },
  143. {
  144. title: '备注',
  145. key: 'demo',
  146. type: FormTypes.input,
  147. defaultValue: '',
  148. placeholder: '请输入${title}',
  149. },
  150. ]
  151. },
  152. url: {
  153. add: "/oa/syCarry/add",
  154. edit: "/oa/syCarry/edit",
  155. syCarryB: {
  156. list: '/oa/syCarry/querySyCarryBByMainId'
  157. },
  158. }
  159. }
  160. },
  161. methods: {
  162. /** 调用完edit()方法之后会自动调用此方法 */
  163. editAfter() {
  164. this.$nextTick(() => {
  165. this.form.setFieldsValue(pick(this.model, 'name', 'code', 'demo', ))
  166. // 时间格式化
  167. // this.form.setFieldsValue({ ckTime: this.model.ckTime ? moment(this.model.ckTime) : null })
  168. // this.form.setFieldsValue({ rsxzTime: this.model.rsxzTime ? moment(this.model.rsxzTime) : null })
  169. // this.form.setFieldsValue({ cwjlTime: this.model.cwjlTime ? moment(this.model.cwjlTime) : null })
  170. })
  171. // 加载子表数据
  172. if (this.model.id) {
  173. let params = { id: this.model.id }
  174. this.requestSubTableData(this.url.syCarryB.list, params, this.syCarryBTable)
  175. }
  176. },
  177. /** 整理成formData */
  178. classifyIntoFormData(allValues) {
  179. let main = Object.assign(this.model, allValues.formValue)
  180. //时间格式化
  181. // main.ckTime = main.ckTime ? main.ckTime.format('YYYY-MM-DD HH:mm:ss') : null;
  182. // main.rsxzTime = main.rsxzTime ? main.rsxzTime.format('YYYY-MM-DD HH:mm:ss') : null;
  183. // main.cwjlTime = main.cwjlTime ? main.cwjlTime.format('YYYY-MM-DD HH:mm:ss') : null;
  184. return {
  185. ...main, // 展开
  186. syCarryBList: allValues.tablesValue[0].values,
  187. }
  188. }
  189. }
  190. }
  191. </script>
  192. <style scoped>
  193. </style>