You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1845 lines
62 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  1. <template>
  2. <div class="mod-config">
  3. <!-- 条件查询 -->
  4. <el-form :inline="true" label-position="top" :model="searchData">
  5. <el-form-item :label="'单据号'">
  6. <el-input v-model="searchData.orderNo" clearable style="width: 120px"></el-input>
  7. </el-form-item>
  8. <el-form-item :label="'单据类型'">
  9. <el-select v-model="searchData.orderType" clearable style="width: 100px">
  10. <el-option label="采购退货" value="采购退货"></el-option>
  11. <el-option label="销售出库" value="销售出库"></el-option>
  12. <el-option label="其他出库" value="其他出库"></el-option>
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item :label="'单据状态'">
  16. <el-select multiple collapse-tags v-model="searchData.orderStatusList" clearable style="width: 160px">
  17. <el-option label="草稿" value="草稿"></el-option>
  18. <el-option label="待检验" value="待检验"></el-option>
  19. <el-option label="编辑中" value="编辑中"></el-option>
  20. <el-option label="待包装" value="待包装"></el-option>
  21. <el-option label="待出库" value="待出库"></el-option>
  22. <el-option label="已完成" value="已完成"></el-option>
  23. <el-option label="已关闭" value="已关闭"></el-option>
  24. <el-option label="已归档" value="已归档"></el-option>
  25. </el-select>
  26. </el-form-item>
  27. <el-form-item :label="'要求出库日期'">
  28. <el-date-picker
  29. style="width: 120px"
  30. v-model="searchData.startDate"
  31. type="date"
  32. value-format="yyyy-MM-dd"
  33. placeholder="选择日期">
  34. </el-date-picker>
  35. </el-form-item>
  36. <el-form-item style="margin-top: 23px;">
  37. <laber style="margin-left: -9px;font-size: 19px">&#10142</laber>
  38. </el-form-item>
  39. <el-form-item :label="' '">
  40. <el-date-picker
  41. style="width: 120px"
  42. v-model="searchData.endDate"
  43. type="date"
  44. value-format="yyyy-MM-dd"
  45. placeholder="选择日期">
  46. </el-date-picker>
  47. </el-form-item>
  48. <el-form-item :label="' '">
  49. <el-button v-if="!authSearch" type="primary" :loading="searchLoading" @click="getDataList()">查询</el-button>
  50. <el-button v-if="!authSave" type="primary" @click="saveModal()">新增</el-button>
  51. <el-button v-if="!authDelete" type="primary" @click="deleteModal()">删除</el-button>
  52. <el-button v-if="!authArchive" type="primary" @click="archiveModal()">归档</el-button>
  53. </el-form-item>
  54. <el-form-item :label="' '">
  55. <el-button @click="exportExcel()" type="primary" style="margin-left: 2px">{{'导出'}}</el-button>
  56. <el-button @click="packingModal()" type="primary" style="margin-left: 2px">包装</el-button>
  57. </el-form-item>
  58. </el-form>
  59. <!-- 展示列表 -->
  60. <el-table
  61. :height="height"
  62. :data="dataList"
  63. border
  64. v-loading="searchLoading"
  65. ref="outboundTable"
  66. :row-style="rowStyle"
  67. @row-click="inboundClickRow"
  68. @current-change="changeCurrentRow"
  69. @selection-change="selectionInbound"
  70. style="width: 100%;">
  71. <el-table-column
  72. type="selection"
  73. header-align="center"
  74. align="center"
  75. width="50">
  76. </el-table-column>
  77. <el-table-column
  78. v-for="(item,index) in columnList" :key="index"
  79. :sortable="item.columnSortable"
  80. :prop="item.columnProp"
  81. :header-align="item.headerAlign"
  82. :show-overflow-tooltip="item.showOverflowTooltip"
  83. :align="item.align"
  84. :fixed="item.fixed==''?false:item.fixed"
  85. :min-width="item.columnWidth"
  86. :label="item.columnLabel">
  87. <template slot-scope="scope">
  88. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  89. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  90. </template>
  91. </el-table-column>
  92. <el-table-column
  93. fixed="right"
  94. header-align="center"
  95. align="center"
  96. width="120"
  97. label="操作">
  98. <template slot-scope="scope">
  99. <template v-if="!authUpdate">
  100. <el-link v-if="scope.row.orderStatus === '草稿' || scope.row.orderStatus === '待检验' || scope.row.orderStatus === '编辑中'" style="cursor: pointer" @click="updateModal(scope.row)">编辑</el-link>
  101. </template>
  102. <template v-if="!authClose">
  103. <el-link v-if="scope.row.orderStatus !== '草稿' && scope.row.orderStatus !== '已关闭'" style="cursor: pointer" @click="closeModal(scope.row)">关闭</el-link>
  104. </template>
  105. <template v-if="!authIssue">
  106. <el-link v-if="scope.row.orderStatus === '草稿' || scope.row.orderStatus === '编辑中'" style="cursor: pointer" @click="issueModal(scope.row)">下达</el-link>
  107. </template>
  108. </template>
  109. </el-table-column>
  110. </el-table>
  111. <!-- 分页栏 -->
  112. <el-pagination
  113. style="margin-top: 0px"
  114. @size-change="sizeChangeHandle"
  115. @current-change="currentChangeHandle"
  116. :current-page="pageIndex"
  117. :page-sizes="[20, 50, 100, 200, 500]"
  118. :page-size="pageSize"
  119. :total="totalPage"
  120. layout="total, sizes, prev, pager, next, jumper">
  121. </el-pagination>
  122. <!-- 拣货出库通知新增/修改 -->
  123. <el-dialog title="拣货出库通知" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="525px">
  124. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  125. <el-form-item label="BU" prop="bu">
  126. <el-select v-model="modalData.bu" placeholder="请选择" :disabled="modalDisableFlag" style="width: 100px">
  127. <el-option
  128. v-for = "i in userBuList"
  129. :key = "i.buNo"
  130. :label = "i.sitename"
  131. :value = "i.buNo">
  132. <span style="float: left;width: 60px">{{ i.sitename }}</span>
  133. <span style="float: right; color: #8492a6;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; font-size: 11px;width: 70px">
  134. {{ i.buDesc }}
  135. </span>
  136. </el-option>
  137. </el-select>
  138. </el-form-item>
  139. <el-form-item label="单据类型" prop="orderType">
  140. <el-select v-model="modalData.orderType" :disabled="modalDisableFlag" @change="onOrderTypeChange" style="width: 100px">
  141. <el-option label="采购退货" value="采购退货"></el-option>
  142. <el-option label="其他出库" value="其他出库"></el-option>
  143. </el-select>
  144. </el-form-item>
  145. <el-form-item label="要求出库日期" prop="requiredOutboundDate">
  146. <el-date-picker
  147. style="width: 120px"
  148. v-model="modalData.requiredOutboundDate"
  149. type="date"
  150. value-format="yyyy-MM-dd">
  151. </el-date-picker>
  152. </el-form-item>
  153. </el-form>
  154. <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px">
  155. <!-- 采购退货时显示供应商 -->
  156. <el-form-item v-if="modalData.orderType === '采购退货'">
  157. <span style="cursor: pointer" slot="label" @click="getBaseList(506)"><a href="#">供应商</a></span>
  158. <el-input v-model="modalData.customerId" @change="customerBlur(506)" style="width: 100px"></el-input>
  159. <el-input v-model="modalData.customerName" disabled style="width: 380px"></el-input>
  160. </el-form-item>
  161. <!-- 其他出库时显示直接客户 -->
  162. <el-form-item v-else-if="modalData.orderType === '其他出库'">
  163. <span style="cursor: pointer" slot="label" @click="getBaseList(507)"><a href="#">直接客户</a></span>
  164. <el-input v-model="modalData.customerId" @change="customerBlur(507)" style="width: 100px"></el-input>
  165. <el-input v-model="modalData.customerName" disabled style="width: 380px"></el-input>
  166. </el-form-item>
  167. </el-form>
  168. <el-form :inline="true" label-position="top" style="margin-left: 7px">
  169. <el-form-item :label="'备注'">
  170. <el-input type="textarea" v-model="modalData.remarks" :rows="3" resize='none' show-word-limit style="width: 485px;height: 20px"></el-input>
  171. </el-form-item>
  172. </el-form>
  173. <el-footer style="height:35px;margin-top: 55px;text-align:center">
  174. <el-button type="primary" :loading="saveLoading" @click="saveData()">保存</el-button>
  175. <el-button type="primary" @click="modalFlag = false">关闭</el-button>
  176. </el-footer>
  177. </el-dialog>
  178. <!-- 页签 -->
  179. <el-tabs v-model="activeTable" style="width: 100%" :style="{height: secondHeight + 'px'}" type="border-card" @tab-click="tabClick" class="customer-tab">
  180. <el-tab-pane label="出库明细" name="outboundDetail">
  181. <el-form label-position="top" style="margin-left: 2px;">
  182. <el-button type="primary" @click="addOutboundDetailModal()" icon="el-icon-plus">新增</el-button>
  183. <el-button type="primary" @click="deleteOutboundDetail()" icon="el-icon-minus">删除</el-button>
  184. <el-button v-if="!editBatchVisible" @click="editBatchModel">批量编辑</el-button>
  185. <el-button v-if="editBatchVisible" @click="batchModel" :loading="saveLoading">批量保存</el-button>
  186. <el-button v-if="editBatchVisible" @click="editBatchVisible = false" type="info">取消编辑</el-button>
  187. </el-form>
  188. <el-table
  189. :data="detailList"
  190. :height="secondHeight - 68"
  191. border
  192. @selection-change="selectionInboundDetail"
  193. style="width: 100%;">
  194. <el-table-column
  195. type="selection"
  196. header-align="center"
  197. align="center"
  198. width="50">
  199. </el-table-column>
  200. <el-table-column
  201. v-for="(item,index) in columnDetailList" :key="index"
  202. :sortable="item.columnSortable"
  203. :prop="item.columnProp"
  204. :header-align="item.headerAlign"
  205. :show-overflow-tooltip="item.showOverflowTooltip"
  206. :align="item.align"
  207. :fixed="item.fixed===''?false:item.fixed"
  208. :min-width="item.columnWidth"
  209. :label="item.columnLabel">
  210. <template slot-scope="scope">
  211. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  212. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  213. </template>
  214. </el-table-column>
  215. <el-table-column
  216. prop="requiredQty"
  217. header-align="center"
  218. align="right"
  219. min-width="100"
  220. label="要求出库数量">
  221. <template slot-scope="scope">
  222. <span v-if="editBatchVisible">
  223. <el-input :controls="false" v-model="scope.row.requiredQty"
  224. @input="value => scope.row.requiredQty = value.match(/^(\d+\.?\d*|\.\d+)$/) ? value : ''"
  225. style="height: 11px; width: 98%;">
  226. </el-input>
  227. </span>
  228. <span v-else>
  229. <span>{{scope.row[scope.column.property]}}</span>
  230. </span>
  231. </template>
  232. </el-table-column>
  233. <el-table-column
  234. prop="outWarehouseName"
  235. header-align="center"
  236. align="center"
  237. min-width="180"
  238. label="出库仓库">
  239. <template slot-scope="scope">
  240. <span v-if="editBatchVisible">
  241. <el-button type="text" @click="chooseWareHouse(scope.row)" style="width:18%;padding: 3px 7px">选择</el-button>
  242. <el-input v-model="scope.row.outWarehouseName" readonly style="width:77%"></el-input>
  243. </span>
  244. <span v-else>
  245. <span>{{scope.row[scope.column.property]}}</span>
  246. </span>
  247. </template>
  248. </el-table-column>
  249. <el-table-column
  250. prop="relatedOrderNo"
  251. header-align="center"
  252. align="left"
  253. min-width="120"
  254. label="关联单号">
  255. <template slot-scope="scope">
  256. <span v-if="editBatchVisible">
  257. <el-input v-model="scope.row.relatedOrderNo" clearable style="width: 98%;"></el-input>
  258. </span>
  259. <span v-else>
  260. <span>{{scope.row[scope.column.property]}}</span>
  261. </span>
  262. </template>
  263. </el-table-column>
  264. <el-table-column
  265. prop="relatedOrderLineNo"
  266. header-align="center"
  267. align="left"
  268. min-width="100"
  269. label="关联单行号">
  270. <template slot-scope="scope">
  271. <span v-if="editBatchVisible">
  272. <el-input v-model="scope.row.relatedOrderLineNo" clearable style="width: 98%;"></el-input>
  273. </span>
  274. <span v-else>
  275. <span>{{scope.row[scope.column.property]}}</span>
  276. </span>
  277. </template>
  278. </el-table-column>
  279. <el-table-column
  280. prop="actualStockOutQty"
  281. header-align="center"
  282. align="right"
  283. min-width="100"
  284. label="实际出库数量">
  285. </el-table-column>
  286. <el-table-column
  287. fixed="right"
  288. header-align="center"
  289. align="center"
  290. width="90"
  291. label="操作">
  292. <template slot-scope="scope">
  293. <el-link style="cursor: pointer" @click="outboundDetailModal(scope.row)">出库明细</el-link>
  294. </template>
  295. </el-table-column>
  296. </el-table>
  297. </el-tab-pane>
  298. </el-tabs>
  299. <!-- 拣货出库单明细新增 -->
  300. <el-dialog title="拣货出库单明细" :close-on-click-modal="false" v-drag :visible.sync="detailModal" width="900px">
  301. <div style="font-size: 12px">
  302. <el-form :inline="true" label-position="top" :model="detailSearchData">
  303. <el-form-item :label="'物料编码'">
  304. <el-input v-model="detailSearchData.partNo" clearable style="width: 120px"></el-input>
  305. </el-form-item>
  306. <el-form-item :label="'物料名称'">
  307. <el-input v-model="detailSearchData.partDesc" clearable style="width: 120px"></el-input>
  308. </el-form-item>
  309. <template v-if="detailSearchData.orderType === '采购退货'">
  310. <el-form-item :label="'采购订单'">
  311. <el-input v-model="detailSearchData.relatedOrderNo" clearable style="width: 120px"></el-input>
  312. </el-form-item>
  313. <el-form-item :label="'行号'">
  314. <el-input v-model="detailSearchData.relatedOrderLineNo" clearable style="width: 120px"></el-input>
  315. </el-form-item>
  316. <el-form-item :label="'状态'">
  317. <el-select v-model="detailSearchData.closeFlag" clearable style="width: 80px">
  318. <el-option label="启用" value="N"></el-option>
  319. <el-option label="关闭" value="Y"></el-option>
  320. </el-select>
  321. </el-form-item>
  322. </template>
  323. <el-form-item label=" ">
  324. <el-button type="primary" @click="searchTypeChange">查询</el-button>
  325. </el-form-item>
  326. </el-form>
  327. </div>
  328. <el-container v-if="detailSearchData.orderType === '其他出库'">
  329. <el-header style="width: 880px;height: 200px;padding: 0 0 0 0">
  330. <span style="font-size: 12px" >可选物料</span>
  331. <el-table
  332. height="200px"
  333. :data="partList1"
  334. border
  335. ref="partTable1"
  336. @selection-change="selectionPart1"
  337. highlight-current-row
  338. style="width: 100%">
  339. <el-table-column
  340. type="selection"
  341. header-align="center"
  342. align="center"
  343. width="50">
  344. </el-table-column>
  345. <el-table-column
  346. prop="partNo"
  347. header-align="center"
  348. align="left"
  349. min-width="120"
  350. label="物料编码">
  351. </el-table-column>
  352. <el-table-column
  353. prop="partDesc"
  354. header-align="center"
  355. align="left"
  356. min-width="200"
  357. label="物料名称">
  358. </el-table-column>
  359. <el-table-column
  360. prop="umName"
  361. header-align="center"
  362. align="center"
  363. min-width="100"
  364. label="物料单位">
  365. </el-table-column>
  366. </el-table>
  367. <!-- 分页-->
  368. <el-pagination
  369. style="margin-top: 5px"
  370. @size-change="sizeChangeHandle2"
  371. @current-change="currentChangeHandle2"
  372. :current-page="pageIndex2"
  373. :page-sizes="[20, 50, 100, 200, 500]"
  374. :page-size="pageSize2"
  375. :total="totalPage2"
  376. layout="total, sizes, prev, pager, next, jumper">
  377. </el-pagination>
  378. </el-header>
  379. <el-main style="width: 880px;height: 27px;margin-top: 70px;padding: 0 0 0 0;text-align:center">
  380. <div>
  381. <el-button type="primary" @click="addPart">添加>></el-button>
  382. <el-button type="primary" @click="deletePart">删除<<</el-button>
  383. </div>
  384. </el-main>
  385. <el-footer style="width: 880px;height: 200px;padding: 0 0 0 0;">
  386. <span style="font-size: 12px" >已选物料</span>
  387. <div class="rq">
  388. <el-table
  389. height="200px"
  390. :data="partList2"
  391. border
  392. ref="partTable2"
  393. @selection-change="selectionPart2"
  394. highlight-current-row
  395. style="width: 100%">
  396. <el-table-column
  397. type="selection"
  398. header-align="center"
  399. align="center"
  400. width="50">
  401. </el-table-column>
  402. <el-table-column
  403. prop="partNo"
  404. header-align="center"
  405. align="center"
  406. min-width="80"
  407. label="物料编码">
  408. </el-table-column>
  409. <el-table-column
  410. prop="partDesc"
  411. header-align="center"
  412. align="left"
  413. min-width="120"
  414. label="物料名称">
  415. </el-table-column>
  416. <el-table-column
  417. prop=""
  418. header-align="center"
  419. align="center"
  420. min-width="100"
  421. label="要求出库数量">
  422. <template slot-scope="scope">
  423. <el-input
  424. :controls="false"
  425. v-model="scope.row.requiredQty"
  426. @input="value => scope.row.requiredQty = value.match(/^(\d+\.?\d*|\.\d+)$/) ? value : ''"
  427. style="height: 11px; width: 98%;">
  428. </el-input>
  429. </template>
  430. </el-table-column>
  431. </el-table>
  432. </div>
  433. </el-footer>
  434. </el-container>
  435. <el-container v-else-if="detailSearchData.orderType === '采购退货'">
  436. <el-header style="width: 880px;height: 200px;padding: 0 0 0 0">
  437. <span style="font-size: 12px" >可选物料</span>
  438. <el-table
  439. height="200px"
  440. :data="partList1"
  441. border
  442. ref="partTable1"
  443. @selection-change="selectionPart1"
  444. highlight-current-row
  445. style="width: 100%">
  446. <el-table-column
  447. type="selection"
  448. header-align="center"
  449. align="center"
  450. width="50">
  451. </el-table-column>
  452. <el-table-column
  453. prop="relatedOrderNo"
  454. header-align="center"
  455. align="left"
  456. min-width="150"
  457. label="采购订单">
  458. </el-table-column>
  459. <el-table-column
  460. prop="relatedOrderLineNo"
  461. header-align="center"
  462. align="left"
  463. min-width="200"
  464. label="行号">
  465. </el-table-column>
  466. <el-table-column
  467. prop="partNo"
  468. header-align="center"
  469. align="left"
  470. min-width="120"
  471. label="物料编码">
  472. </el-table-column>
  473. <el-table-column
  474. prop="partDesc"
  475. header-align="center"
  476. align="left"
  477. min-width="200"
  478. label="物料名称">
  479. </el-table-column>
  480. <el-table-column
  481. prop="umName"
  482. header-align="center"
  483. align="center"
  484. min-width="100"
  485. label="物料单位">
  486. </el-table-column>
  487. <el-table-column
  488. prop="requiredQty"
  489. header-align="center"
  490. align="right"
  491. min-width="100"
  492. label="可出库数">
  493. </el-table-column>
  494. </el-table>
  495. <!-- 分页-->
  496. <el-pagination
  497. style="margin-top: 5px"
  498. @size-change="sizeChangeHandle2"
  499. @current-change="currentChangeHandle2"
  500. :current-page="pageIndex2"
  501. :page-sizes="[20, 50, 100, 200, 500]"
  502. :page-size="pageSize2"
  503. :total="totalPage2"
  504. layout="total, sizes, prev, pager, next, jumper">
  505. </el-pagination>
  506. </el-header>
  507. <el-main style="width: 880px;height: 27px;margin-top: 70px;padding: 0 0 0 0;text-align:center">
  508. <div>
  509. <el-button type="primary" @click="addPart">添加>></el-button>
  510. <el-button type="primary" @click="deletePart">删除<<</el-button>
  511. </div>
  512. </el-main>
  513. <el-footer style="width: 880px;height: 200px;padding: 0 0 0 0;">
  514. <span style="font-size: 12px" >已选物料</span>
  515. <div class="rq">
  516. <el-table
  517. height="200px"
  518. :data="partList2"
  519. border
  520. ref="partTable2"
  521. @selection-change="selectionPart2"
  522. highlight-current-row
  523. style="width: 100%">
  524. <el-table-column
  525. type="selection"
  526. header-align="center"
  527. align="center"
  528. width="50">
  529. </el-table-column>
  530. <el-table-column
  531. prop="relatedOrderNo"
  532. header-align="center"
  533. align="center"
  534. min-width="80"
  535. label="采购订单">
  536. </el-table-column>
  537. <el-table-column
  538. prop="partNo"
  539. header-align="center"
  540. align="center"
  541. min-width="80"
  542. label="物料编码">
  543. </el-table-column>
  544. <el-table-column
  545. prop="partDesc"
  546. header-align="center"
  547. align="left"
  548. min-width="150"
  549. label="物料名称">
  550. </el-table-column>
  551. <el-table-column
  552. prop=""
  553. header-align="center"
  554. align="center"
  555. min-width="100"
  556. label="要求出库数量">
  557. <template slot-scope="scope">
  558. <el-input
  559. :controls="false"
  560. v-model="scope.row.requiredQty"
  561. @input="value => scope.row.requiredQty = value.match(/^(\d+\.?\d*|\.\d+)$/) ? value : ''"
  562. style="height: 11px; width: 98%;">
  563. </el-input>
  564. </template>
  565. </el-table-column>
  566. </el-table>
  567. </div>
  568. </el-footer>
  569. </el-container>
  570. <el-footer style="height:30px;margin-top: 35px;text-align:center">
  571. <el-button type="primary" :loading="saveLoading" @click="saveOutboundDetail">保存</el-button>
  572. <el-button type="primary" @click="detailModal = false">关闭</el-button>
  573. </el-footer>
  574. </el-dialog>
  575. <!-- 出库明细 -->
  576. <el-dialog title="出库明细" :close-on-click-modal="false" v-drag :visible.sync="detailModal2" width="900px">
  577. <el-table
  578. height="400px"
  579. :data="detailList2"
  580. border
  581. style="width: 100%;">
  582. <el-table-column
  583. v-for="(item,index) in columnDetailList2" :key="index"
  584. :sortable="item.columnSortable"
  585. :prop="item.columnProp"
  586. :header-align="item.headerAlign"
  587. :show-overflow-tooltip="item.showOverflowTooltip"
  588. :align="item.align"
  589. :fixed="item.fixed===''?false:item.fixed"
  590. :min-width="item.columnWidth"
  591. :label="item.columnLabel">
  592. </el-table-column>
  593. </el-table>
  594. <el-footer style="height:35px;margin-top: 15px;text-align:center">
  595. <el-button type="primary" @click="detailModal2 = false">关闭</el-button>
  596. </el-footer>
  597. </el-dialog>
  598. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  599. </div>
  600. </template>
  601. <script>
  602. import {
  603. searchOutboundNotification, // 查询拣货出库单
  604. saveOutboundNotification, // 新增拣货出库单
  605. updateOutboundNotification, // 编辑拣货出库单
  606. deleteOutboundNotification, // 删除拣货出库单
  607. closeOutboundNotification, // 关闭拣货出库单
  608. issueOutboundNotification, // 下达拣货出库单
  609. getOutboundDetail, // 查询拣货出库明细
  610. saveOutboundDetail, // 新增拣货出库单明细
  611. deleteOutboundDetail, // 删除拣货出库单明细
  612. getOutboundPartList, // 查物料
  613. updateOutboundDetail, // 批量编辑明细
  614. getOutboundDetail2, // 获取出库明细
  615. } from "@/api/qc/outbound_notification.js"
  616. import {
  617. getSiteAndBuByUserName,
  618. } from "@/api/qc/qc.js"
  619. import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js"
  620. import Chooselist from '@/views/modules/common/Chooselist_eam'
  621. import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
  622. import excel from "@/utils/excel-util.js"
  623. import {verifyData} from "@/api/chooselist/chooselist.js"
  624. export default {
  625. components: {
  626. Chooselist,
  627. },
  628. data () {
  629. return {
  630. columnsProp:['createBy', 'updateBy'],
  631. // 是否收藏
  632. favorite: false,
  633. // 导出 start
  634. exportData: [],
  635. exportName: "拣货出库" + this.dayjs().format('YYYYMMDDHHmmss'),
  636. exportHeader: ["拣货出库"],
  637. exportFooter: [],
  638. exportList: [],
  639. // 导出 end
  640. tagNo: '',
  641. tagType: '',
  642. searchData: {
  643. site: '',
  644. userName: this.$store.state.user.name,
  645. orderNo: '',
  646. orderType: '',
  647. orderStatus: '',
  648. orderStatusList: ['草稿'],
  649. startDate: '',
  650. endDate: '',
  651. page: 1,
  652. limit: 10,
  653. },
  654. detailSearchData: {
  655. site: '',
  656. buNo: '',
  657. orderNo: '',
  658. partNo: '',
  659. partDesc: '',
  660. partNos: '',
  661. orderType: '',
  662. relatedOrderNo: '',
  663. relatedOrderLineNo: '',
  664. closeFlag: '',
  665. page: 1,
  666. limit: 10,
  667. },
  668. height: 200,
  669. secondHeight: 200,
  670. pageIndex: 1,
  671. pageSize: 20,
  672. totalPage: 0,
  673. pageIndex2: 1,
  674. pageSize2: 20,
  675. totalPage2: 0,
  676. modalFlag: false,
  677. modalDisableFlag: false,
  678. modalData: {
  679. site: '',
  680. bu: '',
  681. buNo: '',
  682. flag: '',
  683. orderNo: '',
  684. orderType: '',
  685. orderStatus: '',
  686. requiredOutboundDate: '',
  687. customerId: '',
  688. customerName: '',
  689. remarks: '',
  690. createdBy: '',
  691. updatedBy: '',
  692. },
  693. dataList: [],
  694. detailList: [],
  695. userBuList: [],
  696. outboundSelection: [],
  697. outboundDetailSelection: [],
  698. partSelections1: [],
  699. partSelections2: [],
  700. partList1: [],
  701. partList2: [],
  702. dataListLoading: false,
  703. // 展示列集
  704. columnList: [
  705. {
  706. userId: this.$store.state.user.name,
  707. functionId: 620,
  708. serialNumber: '620Table1OrderNo',
  709. tableId: "620Table1",
  710. tableName: "拣货出库任务表",
  711. columnProp: 'orderNo',
  712. headerAlign: "center",
  713. align: "center",
  714. columnLabel: '单据号',
  715. columnHidden: false,
  716. columnImage: false,
  717. columnSortable: false,
  718. sortLv: 0,
  719. status: true,
  720. fixed: '',
  721. columnWidth: 120,
  722. },
  723. {
  724. userId: this.$store.state.user.name,
  725. functionId: 620,
  726. serialNumber: '620Table1OrderType',
  727. tableId: "620Table1",
  728. tableName: "拣货出库任务表",
  729. columnProp: 'orderType',
  730. headerAlign: "center",
  731. align: "center",
  732. columnLabel: '单据类型',
  733. columnHidden: false,
  734. columnImage: false,
  735. columnSortable: false,
  736. sortLv: 0,
  737. status: true,
  738. fixed: '',
  739. columnWidth: 100,
  740. },
  741. {
  742. userId: this.$store.state.user.name,
  743. functionId: 620,
  744. serialNumber: '620Table1OrderStatus',
  745. tableId: "620Table1",
  746. tableName: "拣货出库任务表",
  747. columnProp: 'orderStatus',
  748. headerAlign: "center",
  749. align: "left",
  750. columnLabel: '单据状态',
  751. columnHidden: false,
  752. columnImage: false,
  753. columnSortable: false,
  754. sortLv: 0,
  755. status: true,
  756. fixed: '',
  757. columnWidth: 100,
  758. },
  759. {
  760. userId: this.$store.state.user.name,
  761. functionId: 620,
  762. serialNumber: '620Table1CustomerId',
  763. tableId: "620Table1",
  764. tableName: "拣货出库任务表",
  765. columnProp: 'customerId',
  766. headerAlign: "center",
  767. align: "left",
  768. columnLabel: '客户 / 供应商编码',
  769. columnHidden: false,
  770. columnImage: false,
  771. columnSortable: false,
  772. sortLv: 0,
  773. status: true,
  774. fixed: '',
  775. columnWidth: 120,
  776. },
  777. {
  778. userId: this.$store.state.user.name,
  779. functionId: 620,
  780. serialNumber: '620Table1CustomerName',
  781. tableId: "620Table1",
  782. tableName: "拣货出库任务表",
  783. columnProp: 'customerName',
  784. headerAlign: "center",
  785. align: "left",
  786. columnLabel: '客户 / 供应商名称',
  787. columnHidden: false,
  788. columnImage: false,
  789. columnSortable: false,
  790. sortLv: 0,
  791. status: true,
  792. fixed: '',
  793. columnWidth: 200,
  794. },
  795. {
  796. userId: this.$store.state.user.name,
  797. functionId: 620,
  798. serialNumber: '620Table1CustomerAbb',
  799. tableId: "620Table1",
  800. tableName: "拣货出库任务表",
  801. columnProp: 'customerAbb',
  802. headerAlign: "center",
  803. align: "left",
  804. columnLabel: '客户简称',
  805. columnHidden: false,
  806. columnImage: false,
  807. columnSortable: false,
  808. sortLv: 0,
  809. status: true,
  810. fixed: '',
  811. columnWidth: 120,
  812. },
  813. {
  814. userId: this.$store.state.user.name,
  815. functionId: 620,
  816. serialNumber: '620Table1RequiredInboundDate',
  817. tableId: "620Table1",
  818. tableName: "拣货出库任务表",
  819. columnProp: 'requiredOutboundDate',
  820. headerAlign: "center",
  821. align: "center",
  822. columnLabel: '要求出库日期',
  823. columnHidden: false,
  824. columnImage: false,
  825. columnSortable: false,
  826. sortLv: 0,
  827. status: true,
  828. fixed: '',
  829. columnWidth: 150,
  830. },
  831. {
  832. userId: this.$store.state.user.name,
  833. functionId: 620,
  834. serialNumber: '620Table1CreatedDate',
  835. tableId: "620Table1",
  836. tableName: "拣货出库任务表",
  837. columnProp: 'createdDate',
  838. headerAlign: "center",
  839. align: "center",
  840. columnLabel: '创建时间',
  841. columnHidden: false,
  842. columnImage: false,
  843. columnSortable: false,
  844. sortLv: 0,
  845. status: true,
  846. fixed: '',
  847. columnWidth: 170,
  848. },
  849. {
  850. userId: this.$store.state.user.name,
  851. functionId: 620,
  852. serialNumber: '620Table1CreatedBy',
  853. tableId: "620Table1",
  854. tableName: "拣货出库任务表",
  855. columnProp: 'createdBy',
  856. headerAlign: "center",
  857. align: "center",
  858. columnLabel: '创建人',
  859. columnHidden: false,
  860. columnImage: false,
  861. columnSortable: false,
  862. sortLv: 0,
  863. status: true,
  864. fixed: '',
  865. columnWidth: 100,
  866. },
  867. {
  868. userId: this.$store.state.user.name,
  869. functionId: 620,
  870. serialNumber: '620Table1UpdatedDate',
  871. tableId: "620Table1",
  872. tableName: "拣货出库任务表",
  873. columnProp: 'updatedDate',
  874. headerAlign: "center",
  875. align: "center",
  876. columnLabel: '更新时间',
  877. columnHidden: false,
  878. columnImage: false,
  879. columnSortable: false,
  880. sortLv: 0,
  881. status: true,
  882. fixed: '',
  883. columnWidth: 170,
  884. },
  885. {
  886. userId: this.$store.state.user.name,
  887. functionId: 620,
  888. serialNumber: '620Table1UpdatedBy',
  889. tableId: "620Table1",
  890. tableName: "拣货出库任务表",
  891. columnProp: 'updatedBy',
  892. headerAlign: "center",
  893. align: "center",
  894. columnLabel: '更新人',
  895. columnHidden: false,
  896. columnImage: false,
  897. columnSortable: false,
  898. sortLv: 0,
  899. status: true,
  900. fixed: '',
  901. columnWidth: 100,
  902. },
  903. ],
  904. columnDetailList: [
  905. {
  906. columnProp: 'partNo',
  907. headerAlign: "center",
  908. align: "left",
  909. columnLabel: '物料编码',
  910. columnHidden: false,
  911. columnImage: false,
  912. columnSortable: false,
  913. sortLv: 0,
  914. status: true,
  915. fixed: '',
  916. columnWidth: 120,
  917. },
  918. {
  919. columnProp: 'partDesc',
  920. headerAlign: "center",
  921. align: "left",
  922. columnLabel: '物料名称',
  923. columnHidden: false,
  924. columnImage: false,
  925. columnSortable: false,
  926. sortLv: 0,
  927. status: true,
  928. fixed: '',
  929. columnWidth: 200,
  930. },
  931. {
  932. columnProp: 'umName',
  933. headerAlign: "center",
  934. align: "center",
  935. columnLabel: '单位',
  936. columnHidden: false,
  937. columnImage: false,
  938. columnSortable: false,
  939. sortLv: 0,
  940. status: true,
  941. fixed: '',
  942. columnWidth: 80,
  943. },
  944. ],
  945. columnDetailList2: [
  946. {
  947. columnProp: 'subNo',
  948. headerAlign: "center",
  949. align: "left",
  950. columnLabel: '标签条码',
  951. columnHidden: false,
  952. columnImage: false,
  953. columnSortable: false,
  954. sortLv: 0,
  955. status: true,
  956. fixed: '',
  957. columnWidth: 100,
  958. },
  959. {
  960. columnProp: 'subQty',
  961. headerAlign: "center",
  962. align: "right",
  963. columnLabel: '出库数量',
  964. columnHidden: false,
  965. columnImage: false,
  966. columnSortable: false,
  967. sortLv: 0,
  968. status: true,
  969. fixed: '',
  970. columnWidth: 100,
  971. },
  972. {
  973. columnProp: 'orderRef4',
  974. headerAlign: "center",
  975. align: "left",
  976. columnLabel: '出库仓库',
  977. columnHidden: false,
  978. columnImage: false,
  979. columnSortable: false,
  980. sortLv: 0,
  981. status: true,
  982. fixed: '',
  983. columnWidth: 150,
  984. },
  985. {
  986. columnProp: 'orderRef5',
  987. headerAlign: "center",
  988. align: "left",
  989. columnLabel: '出库库位',
  990. columnHidden: false,
  991. columnImage: false,
  992. columnSortable: false,
  993. sortLv: 0,
  994. status: true,
  995. fixed: '',
  996. columnWidth: 150,
  997. },
  998. {
  999. columnProp: 'userName',
  1000. headerAlign: "center",
  1001. align: "left",
  1002. columnLabel: '操作员',
  1003. columnHidden: false,
  1004. columnImage: false,
  1005. columnSortable: false,
  1006. sortLv: 0,
  1007. status: true,
  1008. fixed: '',
  1009. columnWidth: 100,
  1010. },
  1011. {
  1012. columnProp: 'transDate',
  1013. headerAlign: "center",
  1014. align: "center",
  1015. columnLabel: '操作时间',
  1016. columnHidden: false,
  1017. columnImage: false,
  1018. columnSortable: false,
  1019. sortLv: 0,
  1020. status: true,
  1021. fixed: '',
  1022. columnWidth: 170,
  1023. },
  1024. ],
  1025. rules: {
  1026. bu: [
  1027. {
  1028. required: true,
  1029. message: ' ',
  1030. trigger: ['blur','change']
  1031. }
  1032. ],
  1033. orderType: [
  1034. {
  1035. required: true,
  1036. message: ' ',
  1037. trigger: ['blur','change']
  1038. }
  1039. ],
  1040. requiredOutboundDate: [
  1041. {
  1042. required: true,
  1043. message: ' ',
  1044. trigger: ['blur','change']
  1045. }
  1046. ]
  1047. },
  1048. searchLoading: false,
  1049. saveLoading: false,
  1050. activeTable: 'outboundDetail',
  1051. detailModal: false,
  1052. authSearch: false,
  1053. authSave: false,
  1054. authUpdate: false,
  1055. authDelete: false,
  1056. authArchive: false,
  1057. authClose: false,
  1058. authIssue: false,
  1059. editBatchVisible: false,
  1060. menuId: this.$route.meta.menuId,
  1061. tempWareHouseRow: {},
  1062. detailList2: [],
  1063. detailModal2: false,
  1064. currentRow: {}
  1065. }
  1066. },
  1067. mounted () {
  1068. this.$nextTick(() => {
  1069. this.height = window.innerHeight / 2 - 100
  1070. /*第二个表格高度的动态调整*/
  1071. this.secondHeight = window.innerHeight - this.height - 170
  1072. })
  1073. },
  1074. created () {
  1075. // 按钮控制
  1076. this.getButtonAuthData()
  1077. // 获取用户的 site 和 bu
  1078. this.getSiteAndBuByUserName()
  1079. // 校验用户是否收藏
  1080. this.favoriteIsOk()
  1081. // 动态列
  1082. this.getTableUserColumn(this.$route.meta.menuId+'table1',1)
  1083. this.getTableUserColumn(this.$route.meta.menuId+'table2',2)
  1084. if (!this.authSearch) {
  1085. // 获取数据列表
  1086. this.getDataList()
  1087. }
  1088. },
  1089. methods: {
  1090. // 获取用户的bu
  1091. getSiteAndBuByUserName () {
  1092. let tempData = {
  1093. username: this.$store.state.user.name,
  1094. }
  1095. getSiteAndBuByUserName(tempData).then(({data}) => {
  1096. if (data.code === 0) {
  1097. this.userBuList = data.rows
  1098. }
  1099. })
  1100. },
  1101. // 获取数据列表
  1102. getDataList () {
  1103. this.searchData.limit = this.pageSize
  1104. this.searchData.page = this.pageIndex
  1105. this.searchData.orderStatus = this.searchData.orderStatusList.join(',')
  1106. this.searchLoading = true
  1107. searchOutboundNotification(this.searchData).then(({data}) => {
  1108. if (data.code === 0) {
  1109. this.dataList = data.page.list
  1110. this.pageIndex = data.page.currPage
  1111. this.pageSize = data.page.pageSize
  1112. this.totalPage = data.page.totalCount
  1113. // 判断是否全部存在数据
  1114. if (this.dataList.length > 0) {
  1115. // 设置选中行
  1116. this.$refs.outboundTable.setCurrentRow(this.dataList[0])
  1117. this.inboundClickRow(this.dataList[0])
  1118. } else {
  1119. this.currentRow = {}
  1120. this.refreshCurrentTabTable()
  1121. }
  1122. }
  1123. }).finally(()=>{
  1124. this.searchLoading = false
  1125. })
  1126. },
  1127. // 每页数
  1128. sizeChangeHandle (val) {
  1129. this.pageSize = val
  1130. this.pageIndex = 1
  1131. this.getDataList()
  1132. },
  1133. // 当前页
  1134. currentChangeHandle (val) {
  1135. this.pageIndex = val
  1136. this.getDataList()
  1137. },
  1138. // 子明细每页数
  1139. sizeChangeHandle2 (val) {
  1140. this.pageSize2 = val
  1141. this.pageIndex2 = 1
  1142. this.searchTypeChange()
  1143. },
  1144. // 子明细当前页
  1145. currentChangeHandle2 (val) {
  1146. this.pageIndex2 = val
  1147. this.searchTypeChange()
  1148. },
  1149. saveModal () {
  1150. this.modalData = {
  1151. flag: '1',
  1152. site: '',
  1153. bu: this.userBuList[0].buNo,
  1154. buNo: '',
  1155. orderNo: '',
  1156. orderType: '采购退货', // 默认为采购退货
  1157. orderStatus: '草稿',
  1158. requiredOutboundDate: '',
  1159. customerId: '',
  1160. customerName: '',
  1161. remarks: '',
  1162. createdBy: this.$store.state.user.name,
  1163. }
  1164. this.modalDisableFlag = false
  1165. this.modalFlag = true
  1166. },
  1167. updateModal (row) {
  1168. if (this.currentRow.orderType === '销售出库') {
  1169. this.$message.warning('销售出库单据不能编辑!')
  1170. return
  1171. }
  1172. this.modalData = {
  1173. flag: '2',
  1174. site: row.site,
  1175. bu: row.site + '_' + row.buNo,
  1176. buNo: row.buNo,
  1177. orderNo: row.orderNo,
  1178. orderType: row.orderType,
  1179. requiredOutboundDate: row.requiredOutboundDate,
  1180. customerId: row.customerId,
  1181. customerName: row.customerName,
  1182. remarks: row.remarks,
  1183. updatedBy: this.$store.state.user.name,
  1184. }
  1185. this.modalDisableFlag = true
  1186. this.modalFlag = true
  1187. },
  1188. saveData () {
  1189. if (this.modalData.bu === '' || this.modalData.bu == null) {
  1190. this.$message.warning('请选择BU!')
  1191. return
  1192. }
  1193. if (this.modalData.orderType === '' || this.modalData.orderType == null) {
  1194. this.$message.warning('请选择单据类型!')
  1195. return
  1196. }
  1197. if (this.modalData.requiredOutboundDate === '' || this.modalData.requiredOutboundDate == null) {
  1198. this.$message.warning('请选择要求出库日期!')
  1199. return
  1200. }
  1201. this.saveLoading = true
  1202. if (this.modalData.flag === '1') { // 新增
  1203. saveOutboundNotification(this.modalData).then(({data}) => {
  1204. if (data && data.code === 0) {
  1205. this.getDataList()
  1206. this.modalFlag = false
  1207. this.$message.success('操作成功')
  1208. } else {
  1209. this.$message.error(data.msg)
  1210. }
  1211. }).finally(()=>{
  1212. this.saveLoading = false
  1213. })
  1214. } else { // 修改
  1215. updateOutboundNotification(this.modalData).then(({data}) => {
  1216. if (data && data.code === 0) {
  1217. this.getDataList()
  1218. this.modalFlag = false
  1219. this.$message.success('操作成功')
  1220. } else {
  1221. this.$message.error(data.msg)
  1222. }
  1223. }).finally(()=>{
  1224. this.saveLoading = false
  1225. })
  1226. }
  1227. },
  1228. // 删除
  1229. deleteModal () {
  1230. if (this.currentRow.orderType === '销售出库') {
  1231. this.$message.warning('销售出库单据不能编辑!')
  1232. return
  1233. }
  1234. if (this.outboundSelection.length === 0) {
  1235. this.$message.warning('请勾选要删除的单据!')
  1236. return
  1237. }
  1238. this.$confirm(`是否删除该 `+ this.outboundSelection.length +` 条记录?`, '提示', {
  1239. confirmButtonText: '确定',
  1240. cancelButtonText: '取消',
  1241. type: 'warning'
  1242. }).then(() => {
  1243. let tempData = {
  1244. submitList: this.outboundSelection
  1245. }
  1246. deleteOutboundNotification(tempData).then(({data}) => {
  1247. if (data && data.code === 0) {
  1248. this.getDataList()
  1249. this.outboundSelection = []
  1250. this.$message.success('操作成功')
  1251. } else {
  1252. this.$message.error(data.msg)
  1253. }
  1254. })
  1255. })
  1256. },
  1257. // 归档
  1258. archiveModal () {
  1259. },
  1260. // 包装
  1261. packingModal () {
  1262. // 校验是否选择了单据
  1263. if (this.outboundSelection.length === 0) {
  1264. this.$message.warning('请勾选要包装的单据!')
  1265. return
  1266. }
  1267. // 校验选中的单据是否都是"销售出库"类型且状态为"待出库"
  1268. const invalidOrders = this.outboundSelection.filter(item => {
  1269. return item.orderType !== '销售出库' || item.orderStatus !== '待出库'
  1270. })
  1271. if (invalidOrders.length > 0) {
  1272. this.$message.warning('只能对"销售出库"类型且状态为"待出库"的单据进行包装操作!')
  1273. return
  1274. }
  1275. // 确认操作
  1276. this.$confirm(`是否重新包装"?`, '提示', {
  1277. confirmButtonText: '确定',
  1278. cancelButtonText: '取消',
  1279. type: 'warning'
  1280. }).then(() => {
  1281. // 调用后端接口更新状态
  1282. const updateList = this.outboundSelection.map(item => ({
  1283. site: item.site,
  1284. buNo: item.buNo,
  1285. orderNo: item.orderNo,
  1286. orderStatus: '待包装'
  1287. }))
  1288. this.batchUpdateOrderStatus(updateList)
  1289. }).catch(() => {
  1290. // 用户取消操作
  1291. })
  1292. },
  1293. // 批量更新单据状态
  1294. batchUpdateOrderStatus (updateList) {
  1295. // 这里需要调用后端API,暂时使用循环调用单个更新接口
  1296. let successCount = 0
  1297. let errorCount = 0
  1298. const totalCount = updateList.length
  1299. const updatePromises = updateList.map(item => {
  1300. return this.$http({
  1301. url: this.$http.adornUrl('/outbound/updateOrderStatus'),
  1302. method: 'post',
  1303. data: this.$http.adornData(item)
  1304. }).then(({data}) => {
  1305. if (data && data.code === 0) {
  1306. successCount++
  1307. } else {
  1308. errorCount++
  1309. }
  1310. }).catch(() => {
  1311. errorCount++
  1312. })
  1313. })
  1314. Promise.all(updatePromises).then(() => {
  1315. if (errorCount === 0) {
  1316. this.$message.success(`成功更新 ${successCount} 条单据状态为"待包装"`)
  1317. } else {
  1318. this.$message.warning(`成功 ${successCount} 条,失败 ${errorCount}`)
  1319. }
  1320. this.getDataList()
  1321. this.outboundSelection = []
  1322. })
  1323. },
  1324. // 关闭
  1325. closeModal (row) {
  1326. if (this.currentRow.orderType === '销售出库') {
  1327. this.$message.warning('销售出库单据不能编辑!')
  1328. return
  1329. }
  1330. closeOutboundNotification(row).then(({data}) => {
  1331. if (data && data.code === 0) {
  1332. this.getDataList()
  1333. this.$message.success('操作成功')
  1334. } else {
  1335. this.$message.error(data.msg)
  1336. }
  1337. })
  1338. },
  1339. // 下达
  1340. issueModal (row) {
  1341. if (this.currentRow.orderType === '销售出库') {
  1342. this.$message.warning('销售出库单据不能编辑!')
  1343. return
  1344. }
  1345. issueOutboundNotification(row).then(({data}) => {
  1346. if (data && data.code === 0) {
  1347. this.getDataList()
  1348. this.$message.success('操作成功')
  1349. } else {
  1350. this.$message.error(data.msg)
  1351. }
  1352. })
  1353. },
  1354. // 列表表格选择替换
  1355. tabClick (tab, event) {
  1356. // 刷新列表数据
  1357. this.refreshCurrentTabTable()
  1358. },
  1359. // 当前值发生变化的时候修改
  1360. changeCurrentRow (row, oldRow) {
  1361. // 判断是否是获取焦点的事件
  1362. if (row) {
  1363. this.currentRow = JSON.parse(JSON.stringify(row))
  1364. //刷新当前页表
  1365. this.refreshCurrentTabTable()
  1366. }
  1367. },
  1368. // 复选
  1369. selectionInbound (val) {
  1370. this.outboundSelection = val
  1371. },
  1372. // 明细复选
  1373. selectionInboundDetail (val) {
  1374. this.outboundDetailSelection = val
  1375. },
  1376. rowStyle ({row}) {
  1377. if (this.currentRow.orderNo === row.orderNo) {
  1378. return { 'background-color': '#E8F7F6', cursor: 'pointer' }
  1379. }
  1380. },
  1381. // 单机选中信息
  1382. inboundClickRow (row,column) {
  1383. this.currentRow = JSON.parse(JSON.stringify(row))
  1384. },
  1385. // 刷新页签的table数据
  1386. refreshCurrentTabTable () {
  1387. if (this.activeTable === 'outboundDetail') {
  1388. this.getOutboundDetail()
  1389. }
  1390. },
  1391. // 查询物料缺陷跟踪
  1392. getOutboundDetail () {
  1393. let templateData = {
  1394. site: this.currentRow.site,
  1395. buNo: this.currentRow.buNo,
  1396. orderNo: this.currentRow.orderNo,
  1397. }
  1398. getOutboundDetail(templateData).then(({data}) => {
  1399. this.detailList = data.rows
  1400. })
  1401. },
  1402. // 新增明细
  1403. addOutboundDetailModal () {
  1404. if (this.currentRow.orderType === '销售出库') {
  1405. this.$message.warning('销售出库单据不能编辑!')
  1406. return
  1407. }
  1408. this.detailSearchData = {
  1409. site: this.currentRow.site,
  1410. buNo: this.currentRow.buNo,
  1411. orderNo: this.currentRow.orderNo,
  1412. orderType: this.currentRow.orderType,
  1413. relatedOrderNo: '',
  1414. relatedOrderLineNo: '',
  1415. closeFlag: '',
  1416. partNo: '',
  1417. partDesc: '',
  1418. partNos: '',
  1419. page: 1,
  1420. limit: 10,
  1421. }
  1422. this.partSelections1 = []
  1423. this.partSelections2 = []
  1424. this.partList1 = []
  1425. this.partList2 = []
  1426. this.pageIndex2 = 1
  1427. this.pageSize2 = 20
  1428. this.totalPage2 = 0
  1429. if (this.currentRow.orderType === '采购退货') {
  1430. this.detailSearchData.closeFlag = 'N'
  1431. }
  1432. this.handleGetProjectPartList()
  1433. },
  1434. handleGetProjectPartList () {
  1435. this.detailSearchData.limit = this.pageSize2
  1436. this.detailSearchData.page = this.pageIndex2
  1437. getOutboundPartList(this.detailSearchData).then(({data}) => {
  1438. if (data && data.code === 0){
  1439. this.partList1 = data.page.list
  1440. this.pageIndex2 = data.page.currPage
  1441. this.pageSize2 = data.page.pageSize
  1442. this.totalPage2 = data.page.totalCount
  1443. this.detailModal = true
  1444. }
  1445. })
  1446. },
  1447. // 可选物料
  1448. partClickRow1 (row) {
  1449. this.$refs.partTable1.toggleRowSelection(row)
  1450. },
  1451. // 已有物料
  1452. partClickRow2 (row) {
  1453. this.$refs.partTable2.toggleRowSelection(row)
  1454. },
  1455. selectionPart1 (val) {
  1456. this.partSelections1 = val
  1457. },
  1458. selectionPart2 (val) {
  1459. this.partSelections2 = val
  1460. },
  1461. // 改变事件
  1462. searchTypeChange () {
  1463. // 使用 map 提取 partNo 并加上单引号
  1464. let partNos = this.partList2.map(part => part.partNo)
  1465. // 使用 join 将 partNo 连接成一个字符串
  1466. this.detailSearchData.partNos = partNos.join(",")
  1467. this.handleGetProjectPartList()
  1468. },
  1469. // 添加物料
  1470. addPart () {
  1471. if (this.partSelections1 == null || this.partSelections1.length === 0) {
  1472. this.$message.warning('请选择可选物料!')
  1473. return
  1474. }
  1475. this.partSelections1.forEach(item => {
  1476. this.partList2.push(item)
  1477. })
  1478. this.searchTypeChange()
  1479. },
  1480. // 删除物料
  1481. deletePart () {
  1482. if(this.partSelections2 == null || this.partSelections2.length === 0) {
  1483. this.$message.warning('请选择已选物料!')
  1484. return
  1485. }
  1486. this.partSelections2.forEach(item => {
  1487. // 使用 filter 过滤掉 partList2 中与 selection.part_no 相同的项
  1488. this.partList2 = this.partList2.filter(part => part.partNo !== item.partNo)
  1489. })
  1490. this.searchTypeChange()
  1491. },
  1492. // 新增明细
  1493. saveOutboundDetail () {
  1494. let tempData = {
  1495. orderNo: this.detailSearchData.orderNo,
  1496. createdBy: this.$store.state.user.name,
  1497. partList: this.partList2,
  1498. }
  1499. this.saveLoading = true
  1500. saveOutboundDetail(tempData).then(({data}) => {
  1501. if (data && data.code === 0) {
  1502. this.getOutboundDetail()
  1503. this.detailModal = false
  1504. this.$message.success('操作成功')
  1505. } else {
  1506. this.$message.error(data.msg)
  1507. }
  1508. }).finally(()=>{
  1509. this.saveLoading = false
  1510. })
  1511. },
  1512. // 删除物料缺陷跟踪
  1513. deleteOutboundDetail () {
  1514. if (this.currentRow.orderType === '销售出库') {
  1515. this.$message.warning('销售出库单据不能编辑!')
  1516. return
  1517. }
  1518. if (this.outboundDetailSelection.length === 0) {
  1519. this.$message.warning('请勾选要删除的单据!')
  1520. return
  1521. }
  1522. this.$confirm(`是否删除该 `+ this.outboundDetailSelection.length +` 条记录?`, '提示', {
  1523. confirmButtonText: '确定',
  1524. cancelButtonText: '取消',
  1525. type: 'warning'
  1526. }).then(() => {
  1527. let tempData = {
  1528. submitList: this.outboundDetailSelection
  1529. }
  1530. deleteOutboundDetail(tempData).then(({data}) => {
  1531. if (data && data.code === 0) {
  1532. this.getOutboundDetail()
  1533. this.outboundDetailSelection = []
  1534. this.$message.success('操作成功')
  1535. } else {
  1536. this.$message.error(data.msg)
  1537. }
  1538. })
  1539. })
  1540. },
  1541. // 批量编辑模态框
  1542. editBatchModel() {
  1543. if (this.currentRow.orderType === '销售出库') {
  1544. this.$message.warning('销售出库单据不能编辑!')
  1545. return
  1546. }
  1547. if (this.editBatchVisible) {
  1548. this.editBatchVisible = false
  1549. } else {
  1550. this.editBatchVisible = true
  1551. }
  1552. },
  1553. // 批量保存
  1554. batchModel() {
  1555. let params = []
  1556. params = this.detailList
  1557. this.saveLoading = true
  1558. updateOutboundDetail(params).then(({data}) => {
  1559. if (data && data.code === 0) {
  1560. this.getOutboundDetail()
  1561. this.$message.success('操作成功')
  1562. this.editBatchVisible = false
  1563. } else {
  1564. this.$message.error(data.msg)
  1565. }
  1566. }).finally(() => {
  1567. this.saveLoading = false
  1568. })
  1569. },
  1570. // 出库明细
  1571. outboundDetailModal (row) {
  1572. let tempData = {
  1573. ...row,
  1574. orderType: this.currentRow.orderType
  1575. }
  1576. getOutboundDetail2(tempData).then(({data}) => {
  1577. if (data && data.code === 0) {
  1578. this.detailList2 = data.rows
  1579. } else {
  1580. this.detailList2 = []
  1581. }
  1582. })
  1583. this.detailModal2 = true
  1584. },
  1585. // 客户/供应商输入校验
  1586. customerBlur (tagNo) {
  1587. let tempData = {
  1588. tagno: tagNo,
  1589. conditionSql: ''
  1590. }
  1591. if (tagNo === 506) {
  1592. // 供应商校验
  1593. tempData.conditionSql = " and SupplierID = '" + this.modalData.customerId + "'" + " and site = '" + this.modalData.site + "'"
  1594. } else if (tagNo === 507) {
  1595. // 客户校验
  1596. tempData.conditionSql = " and CustomerID = '" + this.modalData.customerId + "'" + " and site = '" + this.modalData.site + "'"
  1597. }
  1598. verifyData(tempData).then(({data}) => {
  1599. if (data && data.code === 0) {
  1600. if (data.baseListData.length > 0) {
  1601. if (tagNo === 506) {
  1602. this.modalData.customerId = data.baseListData[0].SupplierID
  1603. this.modalData.customerName = data.baseListData[0].SupplierName
  1604. } else if (tagNo === 507) {
  1605. this.modalData.customerId = data.baseListData[0].CustomerID
  1606. this.modalData.customerName = data.baseListData[0].CustomerName
  1607. }
  1608. } else {
  1609. this.modalData.customerName = ''
  1610. }
  1611. }
  1612. })
  1613. },
  1614. // 单据类型变更时清空客户/供应商信息
  1615. onOrderTypeChange () {
  1616. this.modalData.customerId = ''
  1617. this.modalData.customerName = ''
  1618. },
  1619. chooseWareHouse (row) {
  1620. this.tempWareHouseRow = row
  1621. this.getBaseList(20)
  1622. },
  1623. // 获取基础数据列表S
  1624. getBaseList (val, type) {
  1625. this.tagNo = val
  1626. this.tagType = type
  1627. this.$nextTick(() => {
  1628. let strVal = ''
  1629. if (val === 506) {
  1630. // 供应商列表
  1631. strVal = this.modalData.customerId
  1632. this.$refs.baseList.init(val, strVal)
  1633. }
  1634. if (val === 507) {
  1635. // 直接客户列表
  1636. strVal = this.modalData.customerId
  1637. this.$refs.baseList.init(val, strVal)
  1638. }
  1639. if (val === 20) {
  1640. strVal = this.tempWareHouseRow.outWarehouse
  1641. this.$refs.baseList.init(val, strVal)
  1642. }
  1643. })
  1644. },
  1645. // 列表方法的回调
  1646. getBaseData (val) {
  1647. if (this.tagNo === 506) {
  1648. // 供应商回调
  1649. this.modalData.customerId = val.SupplierID
  1650. this.modalData.customerName = val.SupplierName
  1651. }
  1652. if (this.tagNo === 507) {
  1653. // 直接客户回调
  1654. this.modalData.customerId = val.CustomerID
  1655. this.modalData.customerName = val.CustomerName
  1656. }
  1657. if (this.tagNo === 20) {
  1658. this.tempWareHouseRow.outWarehouse = val.WareHouseID
  1659. this.tempWareHouseRow.outWarehouseName = val.WareHouseName
  1660. console.log(this.tempWareHouseRow)
  1661. }
  1662. },
  1663. // 校验用户是否收藏
  1664. favoriteIsOk () {
  1665. let userFavorite = {
  1666. userId: this.$store.state.user.id,
  1667. languageCode: this.$i18n.locale
  1668. }
  1669. userFavoriteList(userFavorite).then(({data}) => {
  1670. for (let i = 0; i < data.list.length; i++) {
  1671. if (this.$route.meta.menuId === data.list[i].menuId) {
  1672. this.favorite = true
  1673. }
  1674. }
  1675. })
  1676. },
  1677. // 收藏 OR 取消收藏
  1678. favoriteFunction () {
  1679. let userFavorite = {
  1680. userId: this.$store.state.user.id,
  1681. functionId: this.$route.meta.menuId,
  1682. }
  1683. if (this.favorite) {
  1684. removeUserFavorite(userFavorite).then(({data}) => {
  1685. this.$message.success('操作成功')
  1686. this.favorite = false
  1687. })
  1688. } else {
  1689. // 收藏
  1690. saveUserFavorite(userFavorite).then(({data}) => {
  1691. this.$message.success('操作成功')
  1692. this.favorite = true
  1693. })
  1694. }
  1695. },
  1696. async exportExcel() {
  1697. this.searchData.limit = -1
  1698. this.searchData.page = 1
  1699. excel.exportTable({
  1700. url: "/inbound/searchOutboundNotification",
  1701. columnMapping: this.columnList, //可以直接用table,不需要的列就剔除
  1702. mergeSetting: [],//需要合并的列
  1703. params: this.searchData,
  1704. fileName: this.exportName+".xlsx",
  1705. rowFetcher: res => res.data,
  1706. columnFormatter: [],
  1707. dropColumns: [],
  1708. })
  1709. },
  1710. // 动态列开始 获取 用户保存的 格式列
  1711. async getTableUserColumn (tableId, columnId) {
  1712. let queryTableUser = {
  1713. userId: this.$store.state.user.name,
  1714. functionId: this.$route.meta.menuId,
  1715. tableId: tableId,
  1716. status: true,
  1717. languageCode: this.$i18n.locale
  1718. }
  1719. await getTableUserListLanguage(queryTableUser).then(({data}) => {
  1720. if (data.rows.length > 0) {
  1721. switch (columnId) {
  1722. case 1:
  1723. this.columnList = data.rows
  1724. break;
  1725. }
  1726. } else {
  1727. this.getColumnList(tableId, columnId)
  1728. }
  1729. })
  1730. },
  1731. // 获取 tableDefault 列
  1732. async getColumnList (tableId, columnId) {
  1733. let queryTable = {
  1734. functionId: this.$route.meta.menuId,
  1735. tableId: tableId,
  1736. languageCode: this.$i18n.locale
  1737. }
  1738. await getTableDefaultListLanguage(queryTable).then(({data}) => {
  1739. if (data.rows.length !== 0) {
  1740. switch (columnId) {
  1741. case 1:
  1742. this.columnList = data.rows
  1743. break;
  1744. }
  1745. }
  1746. })
  1747. },
  1748. //获取按钮的权限数据
  1749. getButtonAuthData () {
  1750. let searchFlag = this.isAuth(this.menuId + ":search")
  1751. let saveFlag = this.isAuth(this.menuId + ":save")
  1752. let updateFlag = this.isAuth(this.menuId + ":update")
  1753. let deleteFlag = this.isAuth(this.menuId + ":delete")
  1754. let archiveFlag = this.isAuth(this.menuId + ":archive")
  1755. let closeFlag = this.isAuth(this.menuId + ":close")
  1756. let issueFlag = this.isAuth(this.menuId + ":issue")
  1757. //处理页面的权限数据
  1758. this.authSearch = !searchFlag
  1759. this.authSave = !saveFlag
  1760. this.authUpdate = !updateFlag
  1761. this.authDelete = !deleteFlag
  1762. this.authArchive = !archiveFlag
  1763. this.authClose = !closeFlag
  1764. this.authIssue = !issueFlag
  1765. },
  1766. }
  1767. }
  1768. </script>
  1769. <style scoped>
  1770. /deep/ .customer-tab .el-tabs__content {
  1771. padding: 5px !important;
  1772. }
  1773. .el-table /deep/ .cell{
  1774. height: auto;
  1775. line-height: 1.5;
  1776. }
  1777. </style>