docOrderHeader-add-or-update.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <el-dialog
  3. :title="!dataFormHead.orderNo ? '新增' : '修改'"
  4. :close-on-click-modal="false"
  5. :fullscreen="true"
  6. :modal="false"
  7. :visible.sync="visible">
  8. <div style="border: 1px solid rgba(0, 0, 0, 0.1);height: 150px;margin-top: -30px;padding: 10px;">
  9. <el-form :model="dataFormHead" ref="dataFormHead" label-width="105px">
  10. <el-row>
  11. <el-col :span="6">
  12. <el-form-item label="出库单号" prop="orderNo">
  13. <el-input v-model="dataFormHead.orderNo" placeholder="" :disabled="true"></el-input>
  14. </el-form-item>
  15. </el-col>
  16. <el-col :span="6">
  17. <el-form-item label="单据类型" prop="orderType">
  18. <el-select v-model="dataFormHead.orderType" placeholder="请选择" style="width: 100%">
  19. <el-option
  20. v-for="dict in dict.type.so_type"
  21. :key="dict.value"
  22. :label="dict.label"
  23. :value="dict.value"
  24. />
  25. </el-select>
  26. </el-form-item>
  27. </el-col>
  28. <el-col :span="6">
  29. <el-form-item label="单据状态" prop="orderStatus">
  30. <el-select v-model="dataFormHead.orderStatus" :disabled=" id === '' ? true : false" placeholder="请选择" style="width: 100%">
  31. <el-option
  32. v-for="dict in dict.type.so_status"
  33. :key="dict.value"
  34. :label="dict.label"
  35. :value="dict.value"
  36. />
  37. </el-select>
  38. </el-form-item>
  39. </el-col>
  40. <!-- <el-col :span="6">-->
  41. <!-- <el-form-item label="发货时间" prop="shipmentTime">-->
  42. <!-- <el-date-picker-->
  43. <!-- v-model="dataFormHead.shipmentTime"-->
  44. <!-- type="date"-->
  45. <!-- placeholder="选择日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" style="width: 100%">-->
  46. <!-- </el-date-picker>-->
  47. <!-- </el-form-item>-->
  48. <!-- </el-col>-->
  49. <!-- <el-col :span="6">-->
  50. <!-- <el-form-item label="客户" prop="customerId">-->
  51. <!-- <el-select v-model="dataFormHead.customerId" placeholder="请选择" style="width: 100%" clearable>-->
  52. <!-- <el-option-->
  53. <!-- v-for="item in customerIdCombo"-->
  54. <!-- :key="item.value"-->
  55. <!-- :label="item.customerName"-->
  56. <!-- :value="item.customerId">-->
  57. <!-- </el-option>-->
  58. <!-- </el-select>-->
  59. <!-- </el-form-item>-->
  60. <!-- </el-col>-->
  61. <el-col :span="6">
  62. <el-form-item label="ERP单号" prop="soReference1">
  63. <el-input v-model="dataFormHead.soReference1" placeholder=""></el-input>
  64. </el-form-item>
  65. </el-col>
  66. <!-- <el-col :span="6">-->
  67. <!-- <el-form-item label="客户单号2" prop="soReference2">-->
  68. <!-- <el-input v-model="dataFormHead.soReference2" placeholder=""></el-input>-->
  69. <!-- </el-form-item>-->
  70. <!-- </el-col>-->
  71. <el-col :span="6" style="text-align: right;">
  72. <el-button size="mini" type="primary" :disabled="viewTag || isAdd === false" @click="dataFormHeadSubmit()">提交</el-button>
  73. <el-button size="mini" type="primary" :disabled="viewTag || isAdd === true" @click="dataFormHeadSubmit()">修改</el-button>
  74. </el-col>
  75. </el-row>
  76. </el-form>
  77. </div>
  78. <div>
  79. <el-tabs v-model="activeTap">
  80. <el-tab-pane label="出库明细" name="orderDetails">
  81. <OrderDetails ref="orderDetails"/>
  82. </el-tab-pane>
  83. </el-tabs>
  84. </div>
  85. </el-dialog>
  86. </template>
  87. <script>
  88. import { initOrderHeader, addDocOrderHeader, updateDocOrderHeader } from '@/api/docOrder/docOrder'
  89. import OrderDetails from './docOrderDetails'
  90. import {queryCustomerDict} from "@/api/base/customer";
  91. export default {
  92. dicts: ['so_status', 'so_type'],
  93. data () {
  94. return {
  95. choseId: '',
  96. id: '',
  97. visible: false,
  98. roleList: [],
  99. dataFormHead: {
  100. orderNo: '',
  101. orderType: 'ZC',
  102. orderStatus: '',
  103. shipmentTime: '',
  104. soReference1: '',
  105. soReference2: '',
  106. soReference3: '',
  107. customerId: 1
  108. },
  109. activeTap: 'orderDetails',
  110. customerIdCombo: [],
  111. addDisable: false,
  112. viewTag: false,
  113. isAdd: true
  114. }
  115. },
  116. components: {
  117. OrderDetails
  118. },
  119. methods: {
  120. initData () {
  121. queryCustomerDict().then(response => {
  122. this.customerIdCombo = response.data;
  123. });
  124. },
  125. init (id, viewTag) {
  126. this.viewTag = viewTag
  127. this.initData()
  128. this.visible = true
  129. this.$nextTick(() => {
  130. initOrderHeader(id).then(response => {
  131. if(response.code == 200) {
  132. this.isAdd = response.data.isAdd
  133. let orderHeader = response.data.header;
  134. this.dataFormHead.orderNo = orderHeader.orderNo
  135. this.dataFormHead.orderType = orderHeader.orderType
  136. this.dataFormHead.orderStatus = orderHeader.orderStatus
  137. this.dataFormHead.shipmentTime = orderHeader.shipmentTime
  138. this.dataFormHead.soReference1 = orderHeader.soReference1
  139. this.dataFormHead.soReference2 = orderHeader.soReference2
  140. this.dataFormHead.soReference3 = orderHeader.soReference3
  141. if(orderHeader.customerId && orderHeader.customerId != '') {
  142. this.dataFormHead.customerId = parseInt(orderHeader.customerId)
  143. }
  144. this.$refs.orderDetails.getDataList(this.dataFormHead.orderNo,this.viewTag)
  145. } else {
  146. this.$modal.msgError(response.msg);
  147. }
  148. })
  149. })
  150. },
  151. // 表单提交
  152. dataFormHeadSubmit () {
  153. if(this.isAdd) {
  154. addDocOrderHeader(this.dataFormHead).then(response => {
  155. if(response.code == 200) {
  156. this.$modal.msgSuccess(response.msg);
  157. this.addDisable = true
  158. } else {
  159. this.$modal.msgError(response.msg);
  160. }
  161. this.$emit('refreshDataList')
  162. })
  163. } else {
  164. updateDocOrderHeader(this.dataFormHead).then(response => {
  165. if(response.code == 200) {
  166. this.$modal.msgSuccess(response.msg);
  167. } else {
  168. this.$modal.msgError(response.msg);
  169. }
  170. this.$emit('refreshDataList')
  171. })
  172. }
  173. }
  174. }
  175. }
  176. </script>