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.

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