ShipmentNotification.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <template>
  2. <el-dialog
  3. v-dialogDrag
  4. title="送货通知单"
  5. :visible.sync="open"
  6. width="1200px"
  7. append-to-body
  8. @close="dialogClose"
  9. @open="dialogOpen"
  10. >
  11. <!-- 搜索工作栏 -->
  12. <!-- <el-form
  13. v-show="showSearch"
  14. ref="queryForm"
  15. :model="queryParams"
  16. size="small"
  17. label-width="68px"
  18. >
  19. <SearchBar :show-more="false" :collapse-span="6">
  20. <template #header>
  21. <el-col :span="6">
  22. <el-form-item label="出货日期" prop="deliveryTime">
  23. <el-date-picker
  24. v-model="queryParams.deliveryTime"
  25. format="yyyy-MM-dd HH:mm:ss"
  26. value-format="yyyy-MM-dd HH:mm:ss"
  27. type="datetime"
  28. placeholder="请选择出货日期"
  29. />
  30. </el-form-item>
  31. </el-col>
  32. <el-col :span="6">
  33. <el-form-item label="备注" prop="remark" label-width="88px">
  34. <el-input
  35. v-model="queryParams.remark"
  36. placeholder="请输入备注"
  37. clearable
  38. @keyup.enter.native="handleQuery"
  39. />
  40. </el-form-item>
  41. </el-col>
  42. </template>
  43. </SearchBar>
  44. </el-form> -->
  45. <!-- 列表 -->
  46. <el-table v-loading="loading" :data="list" border size="mini">
  47. <el-table-column
  48. label="物料编码"
  49. align="center"
  50. prop="materialNo"
  51. width="160"
  52. show-overflow-tooltip
  53. />
  54. <el-table-column
  55. label="物料名称"
  56. align="center"
  57. prop="materialName"
  58. width="150"
  59. show-overflow-tooltip
  60. />
  61. <el-table-column
  62. label="客户编码"
  63. align="center"
  64. prop="customerCode"
  65. width="150"
  66. show-overflow-tooltip
  67. />
  68. <el-table-column
  69. label="客户名称"
  70. align="center"
  71. prop="customerName"
  72. width="160"
  73. show-overflow-tooltip
  74. />
  75. <el-table-column
  76. label="本次出货数量"
  77. align="center"
  78. prop="nowDeliveredQty"
  79. >
  80. <template slot-scope="scope">
  81. <el-input
  82. v-model="scope.row.nowDeliveredQty"
  83. @change="deliverChange"
  84. />
  85. </template>
  86. </el-table-column>
  87. <el-table-column
  88. label="已出货数量"
  89. align="center"
  90. prop="deliveredQty"
  91. width="120"
  92. />
  93. <el-table-column
  94. label="应出货数量"
  95. align="center"
  96. prop="shouldDeliveredQty"
  97. width="120"
  98. />
  99. <el-table-column
  100. label="单位"
  101. align="center"
  102. prop="unitName"
  103. width="150"
  104. show-overflow-tooltip
  105. />
  106. </el-table>
  107. <div slot="footer" class="dialog-footer">
  108. <el-button @click="cancel">取消</el-button>
  109. <el-button
  110. v-hasPermi="['wms:sale-out-order-master:create']"
  111. type="primary"
  112. :loading="ensureLoading"
  113. @click="submitForm"
  114. >确定</el-button
  115. >
  116. </div>
  117. </el-dialog>
  118. </template>
  119. <script>
  120. import { createSaleOutOrderMaster } from "@/api/wms/orders/sale";
  121. export default {
  122. name: "DeliveryConfimation",
  123. props: {
  124. currentRows: {
  125. type: Array,
  126. default: () => [],
  127. },
  128. model: {
  129. type: Object,
  130. default: () => {},
  131. },
  132. },
  133. data() {
  134. return {
  135. // 遮罩层
  136. loading: false,
  137. // 导出遮罩层
  138. exportLoading: false,
  139. // 显示搜索条件
  140. showSearch: true,
  141. ensureLoading: false,
  142. // 总条数
  143. total: 0,
  144. // ERP采购订单明细列表
  145. list: [],
  146. // 弹出层标题
  147. title: "",
  148. tokens: "",
  149. baseUrl: "",
  150. reportId: "",
  151. // 是否显示弹出层
  152. open: false,
  153. // 查询参数
  154. queryParams: {
  155. pageNo: 1,
  156. pageSize: 10,
  157. remark: null,
  158. noticeDate: null,
  159. },
  160. // 表单参数
  161. form: {},
  162. // 表单校验
  163. rules: {},
  164. };
  165. },
  166. methods: {
  167. /** 取消按钮 */
  168. cancel() {
  169. this.open = false;
  170. this.reset();
  171. },
  172. /** 表单重置 */
  173. reset() {
  174. this.form = {
  175. id: undefined,
  176. detailErpId: undefined,
  177. inStockId: undefined,
  178. erpInStockOrderId: undefined,
  179. erpInStockOrderNo: undefined,
  180. detailNumber: undefined,
  181. materialNo: undefined,
  182. materialName: undefined,
  183. materialQty: undefined,
  184. materialModels: undefined,
  185. unitName: undefined,
  186. shouldReceiveAmount: undefined,
  187. receiveQty: undefined,
  188. returnQty: undefined,
  189. materialStatus: undefined,
  190. supplierCode: undefined,
  191. supplierName: undefined,
  192. batch: undefined,
  193. price: undefined,
  194. taxPrice: undefined,
  195. allAmount: undefined,
  196. taxRate: undefined,
  197. comment: undefined,
  198. deliveryTime: undefined,
  199. erpMark: undefined,
  200. };
  201. this.resetForm("form");
  202. },
  203. dialogClose() {
  204. this.queryParams.remark = null;
  205. this.queryParams.noticeDate = null;
  206. this.$emit("notificationClose", this.queryParams.remark);
  207. },
  208. dialogOpen() {
  209. console.log(this.model);
  210. this.list = this.model.list;
  211. // this.list = this.currentRows.map(item => {
  212. // item.nowDeliveredQty = item.shouldDeliveredQty - item.deliveredQty
  213. // return item
  214. // })
  215. },
  216. // 创建送货通知单
  217. submitForm() {
  218. const { deliveryTime, remark } = this.queryParams;
  219. if (
  220. (deliveryTime === undefined || deliveryTime === null) &&
  221. (remark === null || remark === undefined)
  222. ) {
  223. this.$modal.msgWarning("请选择出货日期和填写备注");
  224. return;
  225. }
  226. const noticeList = this.currentRows.map((item) => {
  227. const {
  228. customerCode,
  229. customerName,
  230. nowDeliveredQty,
  231. id: saleOrderDetailId,
  232. materialName,
  233. materialNo,
  234. } = item;
  235. return {
  236. customerCode,
  237. customerName,
  238. nowDeliveredQty,
  239. saleOrderDetailId,
  240. materialName,
  241. materialNo,
  242. };
  243. });
  244. const params = {
  245. deliveryTime: this.queryParams.deliveryTime,
  246. remark: this.queryParams.remark,
  247. list: noticeList,
  248. };
  249. this.ensureLoading = true;
  250. createSaleOutOrderMaster(params)
  251. .then((res) => {
  252. this.$modal.msgSuccess("创建成功!");
  253. this.open = false;
  254. this.$emit("createComplete");
  255. })
  256. .finally(() => {
  257. this.ensureLoading = false;
  258. });
  259. },
  260. deliverChange(v) {
  261. if (typeof v === "string") {
  262. v = parseFloat(v);
  263. }
  264. },
  265. },
  266. };
  267. </script>