dispatch-arrived.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <div>
  3. <div class="my-title">送达</div>
  4. <!-- 表单 -->
  5. <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
  6. <el-table :data="dataForm.list" border>
  7. <el-table-column
  8. label="序号"
  9. type="index"
  10. width="50"
  11. align="center">
  12. </el-table-column>
  13. <el-table-column
  14. prop="productName"
  15. header-align="center"
  16. align="center"
  17. min-width="140"
  18. :show-tooltip-when-overflow="true"
  19. label="名称">
  20. </el-table-column>
  21. <el-table-column
  22. prop="productSpec"
  23. header-align="center"
  24. align="center"
  25. min-width="140"
  26. :show-tooltip-when-overflow="true"
  27. label="型号/规格">
  28. </el-table-column>
  29. <el-table-column
  30. prop="productNumber"
  31. header-align="center"
  32. align="center"
  33. min-width="140"
  34. :show-tooltip-when-overflow="true"
  35. label="编号">
  36. </el-table-column>
  37. <el-table-column
  38. prop="batchNumber"
  39. header-align="center"
  40. align="center"
  41. min-width="140"
  42. :show-tooltip-when-overflow="true"
  43. label="批次号">
  44. </el-table-column>
  45. <el-table-column
  46. prop="deliverCnt"
  47. header-align="center"
  48. align="center"
  49. min-width="140"
  50. :show-tooltip-when-overflow="true"
  51. label="数量">
  52. </el-table-column>
  53. <el-table-column
  54. prop="price"
  55. header-align="center"
  56. align="center"
  57. min-width="140"
  58. :show-tooltip-when-overflow="true"
  59. label="单价">
  60. </el-table-column>
  61. <el-table-column
  62. prop="amount"
  63. header-align="center"
  64. align="center"
  65. min-width="140"
  66. :show-tooltip-when-overflow="true"
  67. label="总价">
  68. </el-table-column>
  69. <el-table-column
  70. prop="notes"
  71. header-align="center"
  72. align="center"
  73. min-width="140"
  74. :show-tooltip-when-overflow="true"
  75. label="备注">
  76. </el-table-column>
  77. <el-table-column
  78. fixed="right"
  79. prop="arriveCnt"
  80. header-align="center"
  81. align="center"
  82. min-width="140"
  83. :show-tooltip-when-overflow="true"
  84. label="送达数量">
  85. <template slot-scope="scope">
  86. <el-input-number v-model="scope.row.arriveCnt" size="mini"></el-input-number>
  87. </template>
  88. </el-table-column>
  89. </el-table>
  90. <el-form-item label="签收附件" prop="attachList">
  91. <upload-component :accept="'*'" v-model="dataForm.attachList" />
  92. </el-form-item>
  93. </el-form>
  94. <span slot="footer" class="dialog-footer">
  95. <el-button @click="onChose">取消</el-button>
  96. <el-button type="primary" @click="dataFormSubmit()" v-reClick>确定</el-button>
  97. </span>
  98. </div>
  99. </template>
  100. <script>
  101. import UploadComponent from '../common/upload-component-v2'
  102. export default {
  103. name: 'dispatch-arrived',
  104. components: { UploadComponent },
  105. data () {
  106. return {
  107. visible: false,
  108. id: 0,
  109. fileList: [],
  110. dataForm: {
  111. list:[],
  112. attachList:[]
  113. },
  114. max: 0,
  115. dataRule: {
  116. attachList: [{ required: true, message: '请上传签收附件', trigger: 'blur' }]
  117. }
  118. }
  119. },
  120. methods: {
  121. onChose () {
  122. this.visible = false
  123. this.$emit('onChose')
  124. },
  125. async init (id) {
  126. this.id = id
  127. this.getDetails()
  128. },
  129. getDetails () {
  130. this.$http({
  131. url: this.$http.adornUrl(`/biz-service/deliver/info/${this.id}`),
  132. method: 'get',
  133. }).then(({data}) => {
  134. if (data && data.code === '200') {
  135. this.dataForm.list = data.data
  136. this.dataForm.list.map(t => t.arriveCnt = t.deliverCnt)
  137. } else {
  138. this.$message.error(data.msg)
  139. }
  140. })
  141. },
  142. uploadSuccess (fileList) {
  143. this.fileList = fileList
  144. },
  145. validateField (type) {
  146. this.$refs.dataForm.validateField(type)
  147. },
  148. // 表单提交
  149. dataFormSubmit () {
  150. this.$refs['dataForm'].validate((valid) => {
  151. if (valid) {
  152. let submitData = this.dataForm.list.map(t => ({
  153. arriveCnt: t.arriveCnt,
  154. deliverId: t.deliverId,
  155. contractId: t.contractId
  156. }))
  157. let attachList = []
  158. for (let i = 0; i < this.dataForm.attachList.length; i++) {
  159. attachList.push({
  160. fileName: this.dataForm.attachList[i].name,
  161. url: this.dataForm.attachList[i].url
  162. })
  163. }
  164. submitData.map(t => t.attachList = attachList)
  165. this.$http({
  166. url: this.$http.adornUrl(`/biz-service/deliver/arrive`),
  167. method: 'post',
  168. data: this.$http.adornData(submitData)
  169. }).then(({data}) => {
  170. if (data && data.code === '200') {
  171. this.$message({
  172. message: '操作成功',
  173. type: 'success',
  174. duration: 1500,
  175. onClose: () => {
  176. this.onChose()
  177. this.$emit('refreshDataList')
  178. }
  179. })
  180. } else {
  181. this.$message.error(data.msg)
  182. }
  183. })
  184. }
  185. })
  186. }
  187. }
  188. }
  189. </script>
  190. <style scoped lang="scss">
  191. /deep/ .el-input-number--mini {
  192. width:100px;
  193. }
  194. </style>