orderHomogeneityInspectDialog.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  1. <template>
  2. <div>
  3. <ele-modal
  4. width="80vw"
  5. :visible.sync="visible"
  6. :close-on-click-modal="false"
  7. row-key="code"
  8. custom-class="ele-dialog-form"
  9. :title="'齐套性检查'"
  10. :maxable="true"
  11. >
  12. <div v-loading="loading">
  13. <el-form label-width="80px" :model="form" class="order_form">
  14. <el-row :gutter="20" type="flex" style="flex-wrap: wrap">
  15. <el-col :span="8">
  16. <el-form-item label="单据编码:">
  17. <el-input readonly v-model="form.planCode"></el-input>
  18. </el-form-item>
  19. </el-col>
  20. </el-row>
  21. </el-form>
  22. <div>
  23. <ele-pro-table
  24. ref="table"
  25. :needPage="false"
  26. :columns="columns"
  27. key="checkTable"
  28. :init-load="false"
  29. :selection.sync="selection"
  30. :datasource="datasourceList"
  31. >
  32. <template v-slot:toolbar>
  33. <el-button
  34. size="small"
  35. type="primary"
  36. icon="el-icon-plus"
  37. class="ele-btn-icon"
  38. @click="issuePurchaseOrder"
  39. v-if="form.status == 2"
  40. >
  41. 下发采购订单
  42. </el-button>
  43. </template>
  44. <template v-slot:inventoryQuantity="{ row }">
  45. <el-link
  46. type="primary"
  47. :underline="false"
  48. @click="stockDetail(row)"
  49. >
  50. {{ row.inventoryQuantity }}
  51. </el-link>
  52. </template>
  53. <template v-slot:inTransitNum="{ row }">
  54. <el-link
  55. type="primary"
  56. :underline="false"
  57. @click="currentDetail(row)"
  58. >
  59. {{ row.inTransitNum }}
  60. </el-link>
  61. </template>
  62. <template v-slot:inventoryStatusText="{ row }">
  63. <div
  64. :class="
  65. row.inventoryStatusText == '缺料'
  66. ? 'statusRed'
  67. : 'statusGreen'
  68. "
  69. >
  70. {{ row.inventoryStatusText }}
  71. </div>
  72. </template>
  73. <template v-slot:inTransitStatusText="{ row }">
  74. <div
  75. :class="
  76. row.inTransitStatusText == '缺料'
  77. ? 'statusRed'
  78. : 'statusGreen'
  79. "
  80. >
  81. {{ row.inTransitStatusText }}
  82. </div>
  83. </template>
  84. <template v-slot:finalStateText="{ row }">
  85. <div
  86. :class="
  87. row.finalStateText == '缺料' ? 'statusRed' : 'statusGreen'
  88. "
  89. >
  90. {{ row.finalStateText }}
  91. </div>
  92. </template>
  93. </ele-pro-table>
  94. </div>
  95. </div>
  96. <div slot="footer">
  97. <el-button plain @click="cancel">取消</el-button>
  98. </div>
  99. </ele-modal>
  100. <stockDetailDialog ref="stockDetailDialog" />
  101. <currentDetailDialog ref="currentDetailDialog" />
  102. </div>
  103. </template>
  104. <script>
  105. import {
  106. getMaterialInfo,
  107. issuePurchaseOrder
  108. } from '@/api/purchasingManage/purchasePlanManage';
  109. import stockDetailDialog from './stockDetailDialog.vue';
  110. import currentDetailDialog from './currentDetailDialog.vue';
  111. export default {
  112. components: {
  113. stockDetailDialog,
  114. currentDetailDialog
  115. },
  116. data() {
  117. return {
  118. visible: false,
  119. loading: false,
  120. datasourceList: [], // 表格物料数据
  121. form: {},
  122. selection: [],
  123. columns: [
  124. {
  125. columnKey: 'index',
  126. label: '序号',
  127. type: 'index',
  128. width: 55,
  129. align: 'center',
  130. fixed: 'left'
  131. },
  132. {
  133. width: 45,
  134. type: 'selection',
  135. columnKey: 'selection',
  136. align: 'center',
  137. slot: 'selection',
  138. fixed: 'left',
  139. selectable: (row, index) => {
  140. return !row.hasIssued;
  141. }
  142. },
  143. {
  144. prop: 'supplierName',
  145. label: '供应商名称',
  146. align: 'center',
  147. minWidth: 100,
  148. showOverflowTooltip: true
  149. },
  150. {
  151. prop: 'productCode',
  152. label: '物料编码',
  153. align: 'center',
  154. minWidth: 100,
  155. showOverflowTooltip: true
  156. },
  157. {
  158. prop: 'productName',
  159. label: '物料名称',
  160. align: 'center',
  161. minWidth: 100,
  162. showOverflowTooltip: true
  163. },
  164. {
  165. prop: 'totalCount',
  166. label: '需求数量',
  167. showOverflowTooltip: true,
  168. align: 'center'
  169. },
  170. {
  171. prop: 'inventoryQuantity',
  172. slot: 'inventoryQuantity',
  173. label: '库存数量',
  174. showOverflowTooltip: true,
  175. align: 'center'
  176. },
  177. {
  178. prop: 'secureInventory',
  179. label: '安全库存',
  180. showOverflowTooltip: true,
  181. align: 'center'
  182. },
  183. {
  184. prop: 'lockQuantity',
  185. label: '锁库数量',
  186. showOverflowTooltip: true,
  187. align: 'center'
  188. },
  189. {
  190. slot: 'inventoryStatusText',
  191. prop: 'inventoryStatusText',
  192. label: '库存状态',
  193. align: 'center',
  194. minWidth: 80
  195. },
  196. {
  197. slot: 'inTransitNum',
  198. prop: 'inTransitNum',
  199. label: '在途数量',
  200. align: 'center',
  201. minWidth: 80
  202. },
  203. {
  204. prop: 'inTransitOrdersNum',
  205. label: '在途已关联数量 ',
  206. align: 'center',
  207. minWidth: 120
  208. },
  209. {
  210. slot: 'inTransitStatusText',
  211. prop: 'inTransitStatusText',
  212. label: '在途状态',
  213. align: 'center',
  214. minWidth: 80
  215. },
  216. {
  217. label: '最终可用数量',
  218. prop: 'finalAvailableQuantity',
  219. align: 'center',
  220. minWidth: 110
  221. },
  222. {
  223. label: '最终缺料数量',
  224. prop: 'finalShortageQuantity',
  225. align: 'center',
  226. minWidth: 120
  227. },
  228. {
  229. prop: 'hasIssued',
  230. label: '下发状态',
  231. align: 'center',
  232. minWidth: 80,
  233. formatter: (row) => {
  234. return row.hasIssued ? '已下发' : '未下发';
  235. }
  236. },
  237. {
  238. slot: 'finalStateText',
  239. prop: 'finalStateText',
  240. label: '最终状态',
  241. align: 'center',
  242. minWidth: 80
  243. }
  244. // {
  245. // columnKey: 'action',
  246. // label: '操作',
  247. // width: 120,
  248. // align: 'center',
  249. // resizable: false,
  250. // fixed: 'right',
  251. // slot: 'action'
  252. // }
  253. ]
  254. };
  255. },
  256. methods: {
  257. // 定额数量
  258. stockDetail(row) {
  259. this.$refs.stockDetailDialog.open({ bomCode: row.productCode });
  260. },
  261. // 在途
  262. currentDetail(row) {
  263. this.$refs.currentDetailDialog.open({ bomCode: row.productCode });
  264. },
  265. async issuePurchaseOrder() {
  266. if (!this.selection.length) {
  267. return this.$message.warning('请选择一条数据!');
  268. }
  269. let productData = [];
  270. this.selection.forEach((item) => {
  271. if (!item.supplierName) {
  272. productData.push(item.productName);
  273. }
  274. });
  275. if (productData.length) {
  276. this.$confirm(
  277. `物料${productData.join(',')}没有维护供应商,${
  278. productData.length > 1 ? '会合并下发为一个采购订单,' : ''
  279. }是否继续下发!`,
  280. {
  281. confirmButtonText: '是',
  282. cancelButtonText: '否'
  283. }
  284. ).then(() => {
  285. this.issuePurchaseOrderFn();
  286. });
  287. } else {
  288. this.issuePurchaseOrderFn();
  289. }
  290. },
  291. issuePurchaseOrderFn() {
  292. issuePurchaseOrder({
  293. planId: this.form.id,
  294. detailList: this.selection.map((item) => {
  295. return {
  296. detailId: item.detailId,
  297. finalShortageQuantity: item.finalShortageQuantity
  298. };
  299. })
  300. })
  301. .then((res) => {
  302. if (res) {
  303. this.$message.success('下发成功');
  304. this.visible = false;
  305. this.$emit('reload');
  306. }
  307. })
  308. .catch(() => {});
  309. },
  310. open(data) {
  311. this.visible = true;
  312. this.$set(this, 'form', data);
  313. this.getMaterialData();
  314. },
  315. cancel() {
  316. this.clearData();
  317. this.visible = false;
  318. },
  319. // 获取物料数据信息
  320. async getMaterialData() {
  321. const result = await getMaterialInfo({
  322. planId: this.form.id
  323. });
  324. // result.map((item) => {
  325. // item.batchNo = this.dataObj.batchNo;
  326. // item.productCode = this.dataObj.productCode;
  327. // item.finalState =
  328. // item.finalStateText == '齐套'
  329. // ? 1
  330. // : item.finalStateText == '缺料'
  331. // ? 2
  332. // : '';
  333. // });
  334. this.datasourceList = result;
  335. },
  336. clearData() {
  337. this.datasourceList = [];
  338. this.form = {};
  339. this.selection = [];
  340. }
  341. }
  342. };
  343. </script>
  344. <style lang="scss" scoped>
  345. .mt20 {
  346. margin-top: 20px;
  347. }
  348. .el-form-item {
  349. margin-bottom: 0 !important;
  350. }
  351. .planInfo {
  352. display: flex;
  353. font-size: 16px;
  354. }
  355. .form-wrapper {
  356. display: flex;
  357. }
  358. .order_form {
  359. .el-col {
  360. margin-bottom: 16px;
  361. }
  362. }
  363. .statusRed {
  364. color: red;
  365. }
  366. .statusGreen {
  367. color: green;
  368. }
  369. .left_tree {
  370. width: 250px;
  371. max-height: 600px;
  372. min-height: 300px;
  373. overflow: auto;
  374. border: 1px solid #ccc;
  375. margin-right: 10px;
  376. }
  377. </style>