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.

2530 lines
83 KiB

3 months ago
6 months ago
6 months ago
5 months ago
6 months ago
6 months ago
6 months ago
5 months ago
5 months ago
5 months ago
9 months ago
9 months ago
9 months ago
  1. <template>
  2. <div class="mod-config">
  3. <!-- 条件查询 -->
  4. <el-card :class="['search-card', { 'collapsed': !searchExpanded }]" shadow="hover">
  5. <div slot="header" class="search-header">
  6. <div class="header-left">
  7. <i class="el-icon-search"></i>
  8. <span class="header-title">收货入库任务通知</span>
  9. </div>
  10. <div class="header-right">
  11. <el-button
  12. type="text"
  13. size="small"
  14. @click="toggleSearchExpand"
  15. class="collapse-btn">
  16. <i :class="searchExpanded ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"></i>
  17. {{ searchExpanded ? '收起' : '展开' }}
  18. </el-button>
  19. </div>
  20. </div>
  21. <el-form
  22. :inline="true"
  23. label-position="top"
  24. :model="searchData"
  25. class="search-form"
  26. @keyup.enter.native="getDataList">
  27. <!-- 所有查询条件 - 可展开/收起 -->
  28. <template v-if="searchExpanded">
  29. <!-- 第一行 -->
  30. <el-row :gutter="16">
  31. <el-col :span="4">
  32. <el-form-item label="单据号">
  33. <el-input v-model="searchData.orderNo" placeholder="请输入单据号" clearable></el-input>
  34. </el-form-item>
  35. </el-col>
  36. <el-col :span="4">
  37. <el-form-item label="单据类型">
  38. <el-select v-model="searchData.orderType" placeholder="请选择" clearable style="width: 100%">
  39. <el-option label="采购入库" value="采购入库"></el-option>
  40. <el-option label="生产入库" value="生产入库"></el-option>
  41. <el-option label="销售退货" value="销售退货"></el-option>
  42. <el-option label="其他入库" value="其他入库"></el-option>
  43. </el-select>
  44. </el-form-item>
  45. </el-col>
  46. <el-col :span="4">
  47. <el-form-item label="单据状态">
  48. <el-select multiple collapse-tags v-model="searchData.orderStatusList" placeholder="请选择" clearable style="width: 100%">
  49. <el-option label="草稿" value="草稿"></el-option>
  50. <el-option label="待检验" value="待检验"></el-option>
  51. <el-option label="编辑中" value="编辑中"></el-option>
  52. <el-option label="待入库" value="待入库"></el-option>
  53. <el-option label="已完成" value="已完成"></el-option>
  54. <el-option label="已关闭" value="已关闭"></el-option>
  55. <el-option label="已归档" value="已归档"></el-option>
  56. </el-select>
  57. </el-form-item>
  58. </el-col>
  59. <el-col :span="4">
  60. <el-form-item label="部门">
  61. <el-select v-model="searchData.departmentNo" placeholder="请选择" clearable style="width: 100%">
  62. <el-option
  63. v-for="item in departmentList"
  64. :key="item.departmentNo"
  65. :label="item.departmentDesc"
  66. :value="item.departmentNo">
  67. </el-option>
  68. </el-select>
  69. </el-form-item>
  70. </el-col>
  71. <el-col :span="4">
  72. <el-form-item label="要求入库日期(起)">
  73. <el-date-picker
  74. style="width: 91%"
  75. v-model="searchData.startDate"
  76. type="date"
  77. value-format="yyyy-MM-dd"
  78. placeholder="开始日期">
  79. </el-date-picker>
  80. </el-form-item>
  81. </el-col>
  82. <el-col :span="4">
  83. <el-form-item label="要求入库日期(止)">
  84. <el-date-picker
  85. style="width: 91%"
  86. v-model="searchData.endDate"
  87. type="date"
  88. value-format="yyyy-MM-dd"
  89. placeholder="结束日期">
  90. </el-date-picker>
  91. </el-form-item>
  92. </el-col>
  93. </el-row>
  94. <!-- 第二行 -->
  95. <el-row :gutter="16">
  96. <el-col :span="4">
  97. <el-form-item label="创建日期(起)">
  98. <el-date-picker
  99. style="width: 91%"
  100. v-model="searchData.createdStartDate"
  101. type="date"
  102. value-format="yyyy-MM-dd"
  103. placeholder="开始日期">
  104. </el-date-picker>
  105. </el-form-item>
  106. </el-col>
  107. <el-col :span="4">
  108. <el-form-item label="创建日期(止)">
  109. <el-date-picker
  110. style="width: 91%"
  111. v-model="searchData.createdEndDate"
  112. type="date"
  113. value-format="yyyy-MM-dd"
  114. placeholder="结束日期">
  115. </el-date-picker>
  116. </el-form-item>
  117. </el-col>
  118. </el-row>
  119. </template>
  120. <!-- 操作按钮区域 -->
  121. <el-row :gutter="16">
  122. <el-col :span="24">
  123. <div class="search-actions">
  124. <div class="action-left">
  125. <el-button
  126. v-if="!authSearch"
  127. type="primary"
  128. icon="el-icon-search"
  129. :loading="searchLoading"
  130. @click="getDataList()">
  131. 查询
  132. </el-button>
  133. <el-button
  134. icon="el-icon-refresh"
  135. @click="resetSearch">
  136. 重置
  137. </el-button>
  138. <el-button v-if="!authSave" type="success" icon="el-icon-plus" @click="saveModal()">新增</el-button>
  139. <el-button v-if="!authDelete" type="danger" icon="el-icon-delete" @click="deleteModal()">删除</el-button>
  140. <el-button v-if="!authArchive" type="warning" icon="el-icon-folder" @click="archiveModal()">归档</el-button>
  141. <el-button type="primary" icon="el-icon-download" @click="exportExcel()">导出</el-button>
  142. </div>
  143. </div>
  144. </el-col>
  145. </el-row>
  146. </el-form>
  147. </el-card>
  148. <!-- 展示列表 -->
  149. <el-table
  150. :height="height"
  151. :data="dataList"
  152. border
  153. v-loading="searchLoading"
  154. ref="inboundTable"
  155. :row-style="rowStyle"
  156. @row-click="inboundClickRow"
  157. @current-change="changeCurrentRow"
  158. @selection-change="selectionInbound"
  159. style="width: 100%;">
  160. <el-table-column
  161. type="selection"
  162. header-align="center"
  163. align="center"
  164. width="50">
  165. </el-table-column>
  166. <el-table-column
  167. v-for="(item,index) in columnList" :key="index"
  168. :sortable="item.columnSortable"
  169. :prop="item.columnProp"
  170. :header-align="item.headerAlign"
  171. :show-overflow-tooltip="item.showOverflowTooltip"
  172. :align="item.align"
  173. :fixed="item.fixed==''?false:item.fixed"
  174. :min-width="item.columnWidth"
  175. :label="item.columnLabel">
  176. <template slot-scope="scope">
  177. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  178. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  179. </template>
  180. </el-table-column>
  181. <el-table-column
  182. fixed="right"
  183. header-align="center"
  184. align="center"
  185. width="120"
  186. label="操作">
  187. <template slot-scope="scope">
  188. <template v-if="!authUpdate">
  189. <el-link v-if="scope.row.orderStatus === '草稿' || scope.row.orderStatus === '待检验' || scope.row.orderStatus === '编辑中' || scope.row.orderStatus === '待入库'" style="cursor: pointer" @click="updateModal(scope.row)">编辑</el-link>
  190. </template>
  191. <template v-if="!authClose">
  192. <el-link v-if="scope.row.orderStatus !== '草稿' && scope.row.orderStatus !== '已关闭'" style="cursor: pointer" @click="closeModal(scope.row)">关闭</el-link>
  193. </template>
  194. <template v-if="!authIssue">
  195. <el-link v-if="scope.row.orderStatus === '草稿' || scope.row.orderStatus === '编辑中'" style="cursor: pointer" @click="issueModal(scope.row)">下达</el-link>
  196. </template>
  197. <el-link v-if="(scope.row.orderStatus === '已关闭' || scope.row.orderStatus === '已完成')" style="cursor: pointer" @click="openModal(scope.row)">打开</el-link>
  198. </template>
  199. </el-table-column>
  200. </el-table>
  201. <!-- 分页栏 -->
  202. <el-pagination
  203. style="margin-top: 0px"
  204. @size-change="sizeChangeHandle"
  205. @current-change="currentChangeHandle"
  206. :current-page="pageIndex"
  207. :page-sizes="[20, 50, 100, 200, 500]"
  208. :page-size="pageSize"
  209. :total="totalPage"
  210. layout="total, sizes, prev, pager, next, jumper">
  211. </el-pagination>
  212. <!-- 收货入库通知新增/修改 -->
  213. <el-dialog title="收货入库通知" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="545px">
  214. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" ref="modalForm" style="margin-left: 7px;margin-top: -5px;">
  215. <el-form-item label="BU" prop="bu">
  216. <el-select v-model="modalData.bu" placeholder="请选择" :disabled="modalDisableFlag" style="width: 100px">
  217. <el-option
  218. v-for = "i in userBuList"
  219. :key = "i.buNo"
  220. :label = "i.sitename"
  221. :value = "i.buNo">
  222. <span style="float: left;width: 60px">{{ i.sitename }}</span>
  223. <span style="float: right; color: #8492a6;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; font-size: 11px;width: 70px">
  224. {{ i.buDesc }}
  225. </span>
  226. </el-option>
  227. </el-select>
  228. </el-form-item>
  229. <el-form-item label="单据类型" prop="orderType">
  230. <el-select v-model="modalData.orderType" placeholder="请选择" :disabled="modalDisableFlag" style="width: 100px">
  231. <el-option label="生产入库" value="生产入库"></el-option>
  232. <el-option label="其他入库" value="其他入库"></el-option>
  233. </el-select>
  234. </el-form-item>
  235. <el-form-item label="要求入库日期" prop="requiredInboundDate">
  236. <el-date-picker
  237. style="width: 120px"
  238. v-model="modalData.requiredInboundDate"
  239. type="date"
  240. value-format="yyyy-MM-dd">
  241. </el-date-picker>
  242. </el-form-item>
  243. <el-form-item label="入库类别" prop="category">
  244. <el-select v-model="modalData.category" placeholder="请选择" style="width: 140px">
  245. <el-option
  246. v-for="item in categoryList"
  247. :key="item.crdcode"
  248. :label="item.crdcode + '-' + item.crdname"
  249. :value="item.crdcode">
  250. </el-option>
  251. </el-select>
  252. </el-form-item>
  253. <el-form-item>
  254. <span style="cursor: pointer" slot="label" @click="getBaseList(506)"><a href="#">供应商</a></span>
  255. <el-input v-model="modalData.supplierId" @change="supplierBlur(506)" style="width: 120px"></el-input>
  256. <el-input v-model="modalData.supplierName" disabled style="width: 223px"></el-input>
  257. </el-form-item>
  258. <el-form-item label="部门" prop="departmentNo">
  259. <el-select v-model="modalData.departmentNo" placeholder="请选择" style="width: 140px">
  260. <el-option
  261. v-for="item in departmentList"
  262. :key="item.departmentNo"
  263. :label="item.departmentNo + '-' + item.departmentDesc"
  264. :value="item.departmentNo">
  265. </el-option>
  266. </el-select>
  267. </el-form-item>
  268. <el-form-item :label="'备注'">
  269. <el-input type="textarea" v-model="modalData.remarks" :rows="3" resize='none' show-word-limit style="width: 505px;height: 20px"></el-input>
  270. </el-form-item>
  271. </el-form>
  272. <el-footer style="height:35px;margin-top: 55px;text-align:center">
  273. <el-button type="primary" :loading="saveLoading" @click="saveData()">保存</el-button>
  274. <el-button type="primary" @click="modalFlag = false">关闭</el-button>
  275. </el-footer>
  276. </el-dialog>
  277. <!-- 页签 -->
  278. <el-tabs v-model="activeTable" style="width: 100%" :style="{height: secondHeight + 'px'}" type="border-card" @tab-click="tabClick" class="customer-tab">
  279. <el-tab-pane label="入库明细" name="inboundDetail">
  280. <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px;">
  281. <el-form label-position="top" style="margin-left: 2px; margin-bottom: 0;">
  282. <el-button v-if="(currentRow.orderStatus === '草稿' || currentRow.orderStatus === '编辑中') && !hasActualInboundQty" type="primary" @click="addInboundDetailModal()" icon="el-icon-plus">新增</el-button>
  283. <el-button v-if="(currentRow.orderStatus === '草稿' || currentRow.orderStatus === '编辑中') && !hasActualInboundQty" type="primary" @click="deleteInboundDetail()" icon="el-icon-minus">删除</el-button>
  284. <el-button v-if="!editBatchVisible && (currentRow.orderStatus === '草稿' || currentRow.orderStatus === '编辑中') && !hasActualInboundQty" @click="editBatchModel">批量编辑</el-button>
  285. <el-button v-if="!editBatchVisible && (currentRow.orderStatus === '草稿' || currentRow.orderStatus === '编辑中')" @click="changeWarehouseBatch">更换仓库</el-button>
  286. <el-button v-if="editBatchVisible" @click="batchModel" :loading="saveLoading">批量保存</el-button>
  287. <el-button v-if="editBatchVisible" @click="editBatchVisible = false" type="info">取消编辑</el-button>
  288. </el-form>
  289. <div style="display: flex; align-items: center; font-size: 14px; color: #606266;">
  290. <span style="margin-right: 20px;">总张数<span style="color: #409EFF; font-weight: bold;">{{ detailList.length }}</span></span>
  291. <span>总数量<span style="color: #409EFF; font-weight: bold;">{{ detailTotalQty }}</span></span>
  292. </div>
  293. </div>
  294. <el-table
  295. :data="detailList"
  296. :height="secondHeight - 68"
  297. border
  298. @selection-change="selectionInboundDetail"
  299. style="width: 100%;">
  300. <el-table-column
  301. type="selection"
  302. header-align="center"
  303. align="center"
  304. width="50">
  305. </el-table-column>
  306. <el-table-column
  307. v-for="(item,index) in columnDetailList" :key="index"
  308. :sortable="item.columnSortable"
  309. :prop="item.columnProp"
  310. :header-align="item.headerAlign"
  311. :show-overflow-tooltip="item.showOverflowTooltip"
  312. :align="item.align"
  313. :fixed="item.fixed==''?false:item.fixed"
  314. :min-width="item.columnWidth"
  315. :label="item.columnLabel">
  316. <template slot-scope="scope">
  317. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  318. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  319. </template>
  320. </el-table-column>
  321. <el-table-column
  322. prop="requiredQty"
  323. header-align="center"
  324. align="right"
  325. min-width="100"
  326. label="要求入库数量">
  327. <template slot-scope="scope">
  328. <span v-if="editBatchVisible">
  329. <el-input :controls="false" v-model="scope.row.requiredQty"
  330. @input="value => scope.row.requiredQty = value.match(/^(\d+\.?\d*|\.\d+)$/) ? value : ''"
  331. style="height: 11px; width: 98%;">
  332. </el-input>
  333. </span>
  334. <span v-else>
  335. <span>{{scope.row[scope.column.property]}}</span>
  336. </span>
  337. </template>
  338. </el-table-column>
  339. <el-table-column
  340. prop="inWarehouseName"
  341. header-align="center"
  342. align="center"
  343. min-width="180"
  344. label="入库仓库">
  345. <template slot-scope="scope">
  346. <span v-if="editBatchVisible">
  347. <el-button type="text" @click="chooseWareHouse(scope.row)" style="width:18%;padding: 3px 7px">选择</el-button>
  348. <el-input v-model="scope.row.inWarehouseName" readonly style="width:77%"></el-input>
  349. </span>
  350. <span v-else>
  351. <span>{{scope.row[scope.column.property]}}</span>
  352. </span>
  353. </template>
  354. </el-table-column>
  355. <el-table-column
  356. prop="actualStockInQty"
  357. header-align="center"
  358. align="right"
  359. min-width="100"
  360. label="实际入库数量">
  361. </el-table-column>
  362. <el-table-column
  363. prop="remark"
  364. header-align="center"
  365. align="left"
  366. min-width="150"
  367. label="备注">
  368. <template slot-scope="scope">
  369. <span v-if="editBatchVisible">
  370. <el-input v-model="scope.row.remark" clearable style="width: 98%;"></el-input>
  371. </span>
  372. <span v-else>
  373. <span>{{scope.row[scope.column.property]}}</span>
  374. </span>
  375. </template>
  376. </el-table-column>
  377. <!-- <el-table-column-->
  378. <!-- prop="inBatchNo"-->
  379. <!-- header-align="center"-->
  380. <!-- align="left"-->
  381. <!-- min-width="100"-->
  382. <!-- label="入库批次号">-->
  383. <!-- <template slot-scope="scope">-->
  384. <!-- <span v-if="editBatchVisible">-->
  385. <!-- <el-input :controls="false" v-model="scope.row.inBatchNo" style="height: 11px; width: 98%;"></el-input>-->
  386. <!-- </span>-->
  387. <!-- <span v-else>-->
  388. <!-- <span>{{scope.row[scope.column.property]}}</span>-->
  389. <!-- </span>-->
  390. <!-- </template>-->
  391. <!-- </el-table-column>-->
  392. <el-table-column
  393. fixed="right"
  394. header-align="center"
  395. align="center"
  396. width="150"
  397. label="操作">
  398. <template slot-scope="scope">
  399. <el-link style="cursor: pointer" @click="inboundDetailModal(scope.row)">入库明细</el-link>
  400. <el-link v-if="currentRow.orderStatus === '待入库'" style="cursor: pointer; margin-left: 10px;" type="warning" @click="labelImportModal(scope.row)">标签导入</el-link>
  401. </template>
  402. </el-table-column>
  403. </el-table>
  404. </el-tab-pane>
  405. </el-tabs>
  406. <!-- 收获入库单明细新增 -->
  407. <el-dialog title="收货入库单明细" :close-on-click-modal="false" v-drag :visible.sync="detailModal" width="900px">
  408. <div style="font-size: 12px">
  409. <el-form :inline="true" label-position="top" :model="detailSearchData">
  410. <el-form-item :label="'物料编码'">
  411. <el-input v-model="detailSearchData.partNo" clearable style="width: 120px"></el-input>
  412. </el-form-item>
  413. <el-form-item :label="'物料名称'">
  414. <el-input v-model="detailSearchData.partDesc" clearable style="width: 120px"></el-input>
  415. </el-form-item>
  416. <el-form-item :label="'规格型号'">
  417. <el-input v-model="detailSearchData.spec" clearable style="width: 120px"></el-input>
  418. </el-form-item>
  419. <template v-if="detailSearchData.orderType === '生产入库'">
  420. <el-form-item :label="'生产订单'">
  421. <el-input v-model="detailSearchData.relatedOrderNo" clearable style="width: 120px"></el-input>
  422. </el-form-item>
  423. <el-form-item :label="'订单状态'">
  424. <el-select v-model="detailSearchData.status" clearable style="width: 100px">
  425. <el-option label="已计划" value="已计划"></el-option>
  426. <el-option label="已下达" value="已下达"></el-option>
  427. <el-option label="已排产" value="已排产"></el-option>
  428. <el-option label="已开工" value="已开工"></el-option>
  429. <el-option label="已取消" value="已取消"></el-option>
  430. <el-option label="已停工" value="已停工"></el-option>
  431. <el-option label="已关闭" value="已关闭"></el-option>
  432. </el-select>
  433. </el-form-item>
  434. </template>
  435. <el-form-item label=" ">
  436. <el-button type="primary" @click="searchTypeChange">查询</el-button>
  437. </el-form-item>
  438. </el-form>
  439. </div>
  440. <el-container v-if="detailSearchData.orderType === '其他入库'">
  441. <el-header style="width: 880px;height: 200px;padding: 0 0 0 0">
  442. <span style="font-size: 12px" >可选物料</span>
  443. <el-table
  444. key="otherInboundTablePart1"
  445. height="200px"
  446. :data="partList1"
  447. border
  448. ref="partTable1Other"
  449. @selection-change="selectionPart1"
  450. highlight-current-row
  451. style="width: 100%">
  452. <el-table-column
  453. type="selection"
  454. header-align="center"
  455. align="center"
  456. width="50">
  457. </el-table-column>
  458. <el-table-column
  459. prop="partNo"
  460. header-align="center"
  461. align="left"
  462. min-width="120"
  463. label="物料编码">
  464. </el-table-column>
  465. <el-table-column
  466. prop="partDesc"
  467. header-align="center"
  468. align="left"
  469. min-width="200"
  470. label="物料名称">
  471. </el-table-column>
  472. <el-table-column
  473. prop="spec"
  474. header-align="center"
  475. align="left"
  476. min-width="120"
  477. label="规格型号">
  478. </el-table-column>
  479. <el-table-column
  480. prop="umName"
  481. header-align="center"
  482. align="center"
  483. min-width="100"
  484. label="物料单位">
  485. </el-table-column>
  486. </el-table>
  487. <!-- 分页-->
  488. <el-pagination
  489. style="margin-top: 5px"
  490. @size-change="sizeChangeHandle2"
  491. @current-change="currentChangeHandle2"
  492. :current-page="pageIndex2"
  493. :page-sizes="[20, 50, 100, 200, 500]"
  494. :page-size="pageSize2"
  495. :total="totalPage2"
  496. layout="total, sizes, prev, pager, next, jumper">
  497. </el-pagination>
  498. </el-header>
  499. <el-main style="width: 880px;height: 27px;margin-top: 70px;padding: 0 0 0 0;text-align:center">
  500. <div>
  501. <el-button type="primary" @click="addPart">添加>></el-button>
  502. <el-button type="primary" @click="deletePart">删除<<</el-button>
  503. </div>
  504. </el-main>
  505. <el-footer style="width: 880px;height: 200px;padding: 0 0 0 0;">
  506. <span style="font-size: 12px" >已选物料</span>
  507. <div class="rq">
  508. <el-table
  509. key="otherInboundTable"
  510. height="200px"
  511. :data="partList2"
  512. border
  513. ref="partTable2Other"
  514. @selection-change="selectionPart2"
  515. highlight-current-row
  516. style="width: 100%">
  517. <el-table-column
  518. type="selection"
  519. header-align="center"
  520. align="center"
  521. width="50">
  522. </el-table-column>
  523. <el-table-column
  524. prop="partNo"
  525. header-align="center"
  526. align="left"
  527. min-width="120"
  528. label="物料编码">
  529. </el-table-column>
  530. <el-table-column
  531. prop="partDesc"
  532. header-align="center"
  533. align="left"
  534. min-width="200"
  535. label="物料名称">
  536. </el-table-column>
  537. <el-table-column
  538. prop=""
  539. header-align="center"
  540. align="right"
  541. min-width="80"
  542. label="要求入库数量">
  543. <template slot-scope="scope">
  544. <el-input
  545. :controls="false"
  546. v-model="scope.row.requiredQty"
  547. @input="value => scope.row.requiredQty = value.match(/^(\d+\.?\d*|\.\d+)$/) ? value : ''"
  548. style="height: 11px; width: 98%;">
  549. </el-input>
  550. </template>
  551. </el-table-column>
  552. <el-table-column
  553. prop=""
  554. header-align="center"
  555. align="left"
  556. min-width="100"
  557. label="关联单号">
  558. <template slot-scope="scope">
  559. <el-input
  560. :controls="false"
  561. v-model="scope.row.relatedOrderNo"
  562. style="height: 11px; width: 98%;">
  563. </el-input>
  564. </template>
  565. </el-table-column>
  566. <el-table-column
  567. prop=""
  568. header-align="center"
  569. align="left"
  570. min-width="100"
  571. label="关联单行号">
  572. <template slot-scope="scope">
  573. <el-input
  574. :controls="false"
  575. v-model="scope.row.relatedOrderLineNo"
  576. style="height: 11px; width: 98%;">
  577. </el-input>
  578. </template>
  579. </el-table-column>
  580. </el-table>
  581. </div>
  582. </el-footer>
  583. </el-container>
  584. <el-container v-else-if="detailSearchData.orderType === '生产入库'">
  585. <el-header style="width: 880px;height: 200px;padding: 0 0 0 0">
  586. <span style="font-size: 12px" >可选物料</span>
  587. <el-table
  588. key="productionInboundTablePart1"
  589. height="200px"
  590. :data="partList1"
  591. border
  592. ref="partTable1Production"
  593. @selection-change="selectionPart1"
  594. highlight-current-row
  595. style="width: 100%">
  596. <el-table-column
  597. type="selection"
  598. header-align="center"
  599. align="center"
  600. width="50">
  601. </el-table-column>
  602. <el-table-column
  603. prop="relatedOrderNo"
  604. header-align="center"
  605. align="left"
  606. min-width="120"
  607. label="生产订单">
  608. </el-table-column>
  609. <el-table-column
  610. prop="partNo"
  611. header-align="center"
  612. align="left"
  613. min-width="120"
  614. label="物料编码">
  615. </el-table-column>
  616. <el-table-column
  617. prop="partDesc"
  618. header-align="center"
  619. align="left"
  620. min-width="200"
  621. label="物料名称">
  622. </el-table-column>
  623. <el-table-column
  624. prop="spec"
  625. header-align="center"
  626. align="left"
  627. min-width="120"
  628. label="规格型号">
  629. </el-table-column>
  630. <el-table-column
  631. prop="umName"
  632. header-align="center"
  633. align="center"
  634. min-width="100"
  635. label="物料单位">
  636. </el-table-column>
  637. <el-table-column
  638. prop="orderQty"
  639. header-align="center"
  640. align="right"
  641. min-width="80"
  642. label="订单数量">
  643. </el-table-column>
  644. <el-table-column
  645. prop="requiredQty"
  646. header-align="center"
  647. align="right"
  648. min-width="80"
  649. label="可入库数">
  650. </el-table-column>
  651. <el-table-column
  652. prop="rollNo"
  653. header-align="center"
  654. align="left"
  655. min-width="120"
  656. label="卷号">
  657. </el-table-column>
  658. <el-table-column
  659. prop="packingList"
  660. header-align="center"
  661. align="left"
  662. min-width="150"
  663. show-overflow-tooltip
  664. label="Packing List">
  665. </el-table-column>
  666. <el-table-column
  667. prop="remark"
  668. header-align="center"
  669. align="left"
  670. min-width="150"
  671. show-overflow-tooltip
  672. label="备注">
  673. </el-table-column>
  674. <el-table-column
  675. prop="jobRemark"
  676. header-align="center"
  677. align="left"
  678. min-width="150"
  679. show-overflow-tooltip
  680. label="任务备注">
  681. </el-table-column>
  682. </el-table>
  683. <!-- 分页-->
  684. <el-pagination
  685. style="margin-top: 5px"
  686. @size-change="sizeChangeHandle2"
  687. @current-change="currentChangeHandle2"
  688. :current-page="pageIndex2"
  689. :page-sizes="[20, 50, 100, 200, 500]"
  690. :page-size="pageSize2"
  691. :total="totalPage2"
  692. layout="total, sizes, prev, pager, next, jumper">
  693. </el-pagination>
  694. </el-header>
  695. <el-main style="width: 880px;height: 27px;margin-top: 70px;padding: 0 0 0 0;text-align:center">
  696. <div>
  697. <el-button type="primary" @click="addPart">添加>></el-button>
  698. <el-button type="primary" @click="deletePart">删除<<</el-button>
  699. </div>
  700. </el-main>
  701. <el-footer style="width: 880px;height: 200px;padding: 0 0 0 0;">
  702. <span style="font-size: 12px" >已选物料</span>
  703. <div class="rq">
  704. <el-table
  705. key="productionInboundTable"
  706. height="200px"
  707. :data="partList2"
  708. border
  709. ref="partTable2Production"
  710. @selection-change="selectionPart2"
  711. highlight-current-row
  712. style="width: 100%">
  713. <el-table-column
  714. type="selection"
  715. header-align="center"
  716. align="center"
  717. width="50">
  718. </el-table-column>
  719. <el-table-column
  720. prop="relatedOrderNo"
  721. header-align="center"
  722. align="left"
  723. min-width="100"
  724. label="关联单号">
  725. </el-table-column>
  726. <el-table-column
  727. prop="relatedOrderLineNo"
  728. header-align="center"
  729. align="left"
  730. min-width="80"
  731. label="关联单行号">
  732. </el-table-column>
  733. <el-table-column
  734. prop="partNo"
  735. header-align="center"
  736. align="left"
  737. min-width="100"
  738. label="物料编码">
  739. </el-table-column>
  740. <el-table-column
  741. prop="partDesc"
  742. header-align="center"
  743. align="left"
  744. min-width="150"
  745. label="物料名称">
  746. </el-table-column>
  747. <el-table-column
  748. prop="rollNo"
  749. header-align="center"
  750. align="left"
  751. min-width="100"
  752. label="卷号">
  753. </el-table-column>
  754. <el-table-column
  755. prop=""
  756. header-align="center"
  757. align="center"
  758. min-width="100"
  759. label="要求入库数量">
  760. <template slot-scope="scope">
  761. <el-input
  762. :controls="false"
  763. v-model="scope.row.requiredQty"
  764. @input="value => scope.row.requiredQty = value.match(/^(\d+\.?\d*|\.\d+)$/) ? value : ''"
  765. style="height: 11px; width: 98%;">
  766. </el-input>
  767. </template>
  768. </el-table-column>
  769. </el-table>
  770. </div>
  771. </el-footer>
  772. </el-container>
  773. <el-footer style="height:30px;margin-top: 35px;text-align:center">
  774. <el-button type="primary" :loading="saveLoading" @click="saveInboundDetail">保存</el-button>
  775. <el-button type="primary" @click="detailModal = false">关闭</el-button>
  776. </el-footer>
  777. </el-dialog>
  778. <!-- 入库明细 -->
  779. <el-dialog title="入库明细" :close-on-click-modal="false" v-drag :visible.sync="detailModal2" width="900px">
  780. <el-table
  781. height="400px"
  782. :data="detailList2"
  783. border
  784. style="width: 100%;">
  785. <el-table-column
  786. v-for="(item,index) in columnDetailList2" :key="index"
  787. :sortable="item.columnSortable"
  788. :prop="item.columnProp"
  789. :header-align="item.headerAlign"
  790. :show-overflow-tooltip="item.showOverflowTooltip"
  791. :align="item.align"
  792. :fixed="item.fixed===''?false:item.fixed"
  793. :min-width="item.columnWidth"
  794. :label="item.columnLabel">
  795. </el-table-column>
  796. </el-table>
  797. <el-footer style="height:35px;margin-top: 15px;text-align:center">
  798. <el-button type="primary" @click="detailModal2 = false">关闭</el-button>
  799. </el-footer>
  800. </el-dialog>
  801. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  802. <!-- 标签导入组件 -->
  803. <LabelImportUpload ref="labelImportUpload" @refreshPageTables="getInboundDetail"></LabelImportUpload>
  804. </div>
  805. </template>
  806. <script>
  807. import {
  808. searchInboundNotification, // 查询收获入库单
  809. saveInboundNotification, // 新增收获入库单
  810. updateInboundNotification, // 编辑收获入库单
  811. openInboundNotification, // 打开收获入库单
  812. deleteInboundNotification, // 删除收获入库单
  813. closeInboundNotification, // 关闭收获入库单
  814. issueInboundNotification, // 下达收获入库单
  815. getInboundDetail, // 查询收获入库单明细
  816. saveInboundDetail, // 新增收获入库单明细
  817. deleteInboundDetail, // 删除收获入库单明细
  818. getInboundPartList, // 查物料
  819. updateInboundDetail, // 批量编辑明细
  820. getInboundDetail2, // 获取入库明细
  821. getInboundCategoryList, // 查询入库类别列表
  822. getDepartmentList, // 查询部门列表
  823. } from "@/api/qc/Inbound_notification.js"
  824. import {
  825. getSiteAndBuByUserName,
  826. } from "@/api/qc/qc.js"
  827. import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js"
  828. import Chooselist from '@/views/modules/common/Chooselist_eam'
  829. import LabelImportUpload from './label_import_upload'
  830. import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
  831. import excel from "@/utils/excel-util.js"
  832. import {verifyData} from "@/api/chooselist/chooselist.js"
  833. export default {
  834. components: {
  835. Chooselist,
  836. LabelImportUpload,
  837. },
  838. data () {
  839. return {
  840. searchExpanded: true, // 搜索条件展开状态
  841. columnsProp:['createBy', 'updateBy'],
  842. // 是否收藏
  843. favorite: false,
  844. // 导出 start
  845. exportData: [],
  846. exportName: "收货入库" + this.dayjs().format('YYYYMMDDHHmmss'),
  847. exportHeader: ["收货入库"],
  848. exportFooter: [],
  849. exportList: [],
  850. // 导出 end
  851. tagNo: '',
  852. tagType: '',
  853. searchData: {
  854. site: '',
  855. userName: this.$store.state.user.name,
  856. orderNo: '',
  857. orderType: '',
  858. orderStatus: '',
  859. orderStatusList: ['草稿'],
  860. departmentNo: '', // 部门查询条件
  861. startDate: '',
  862. endDate: '',
  863. createdStartDate: '', // 创建时间开始
  864. createdEndDate: '', // 创建时间结束
  865. page: 1,
  866. limit: 10,
  867. },
  868. detailSearchData: {
  869. site: '',
  870. buNo: '',
  871. orderNo: '',
  872. partNo: '',
  873. partDesc: '',
  874. spec: '',
  875. partNos: '',
  876. orderType: '',
  877. relatedOrderNo: '',
  878. status: '',
  879. page: 1,
  880. limit: 10,
  881. },
  882. height: 200,
  883. secondHeight: 200,
  884. pageIndex: 1,
  885. pageSize: 20,
  886. totalPage: 0,
  887. pageIndex2: 1,
  888. pageSize2: 20,
  889. totalPage2: 0,
  890. modalFlag: false,
  891. modalDisableFlag: false,
  892. modalData: {
  893. site: '',
  894. bu: '',
  895. buNo: '',
  896. flag: '',
  897. orderNo: '',
  898. orderType: '',
  899. orderStatus: '',
  900. requiredInboundDate: '',
  901. supplierId: '',
  902. supplierName: '',
  903. remarks: '',
  904. createdBy: '',
  905. updatedBy: '',
  906. category: '', // 入库类别
  907. },
  908. categoryList: [], // 入库类别列表
  909. departmentList: [], // 部门列表
  910. dataList: [],
  911. detailList: [],
  912. userBuList: [],
  913. inboundSelection: [],
  914. inboundDetailSelection: [],
  915. partSelections1: [],
  916. partSelections2: [],
  917. partList1: [],
  918. partList2: [],
  919. dataListLoading: false,
  920. // 展示列集
  921. columnList: [
  922. {
  923. userId: this.$store.state.user.name,
  924. functionId: 610,
  925. serialNumber: '610Table1OrderNo',
  926. tableId: "610Table1",
  927. tableName: "收货入库任务表",
  928. columnProp: 'orderNo',
  929. headerAlign: "center",
  930. align: "center",
  931. columnLabel: '单据号',
  932. columnHidden: false,
  933. columnImage: false,
  934. columnSortable: false,
  935. sortLv: 0,
  936. status: true,
  937. fixed: '',
  938. columnWidth: 120,
  939. },
  940. {
  941. userId: this.$store.state.user.name,
  942. functionId: 610,
  943. serialNumber: '610Table1OrderType',
  944. tableId: "610Table1",
  945. tableName: "收货入库任务表",
  946. columnProp: 'orderType',
  947. headerAlign: "center",
  948. align: "center",
  949. columnLabel: '单据类型',
  950. columnHidden: false,
  951. columnImage: false,
  952. columnSortable: false,
  953. sortLv: 0,
  954. status: true,
  955. fixed: '',
  956. columnWidth: 100,
  957. },
  958. {
  959. userId: this.$store.state.user.name,
  960. functionId: 610,
  961. serialNumber: '610Table1OrderStatus',
  962. tableId: "610Table1",
  963. tableName: "收货入库任务表",
  964. columnProp: 'orderStatus',
  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: 100,
  975. },
  976. {
  977. userId: this.$store.state.user.name,
  978. functionId: 610,
  979. serialNumber: '610Table1SupplierId',
  980. tableId: "610Table1",
  981. tableName: "收货入库任务表",
  982. columnProp: 'supplierId',
  983. headerAlign: "center",
  984. align: "left",
  985. columnLabel: '供应商编码',
  986. columnHidden: false,
  987. columnImage: false,
  988. columnSortable: false,
  989. sortLv: 0,
  990. status: true,
  991. fixed: '',
  992. columnWidth: 120,
  993. },
  994. {
  995. userId: this.$store.state.user.name,
  996. functionId: 610,
  997. serialNumber: '610Table1SupplierName',
  998. tableId: "610Table1",
  999. tableName: "收货入库任务表",
  1000. columnProp: 'supplierName',
  1001. headerAlign: "center",
  1002. align: "left",
  1003. columnLabel: '供应商名称',
  1004. columnHidden: false,
  1005. columnImage: false,
  1006. columnSortable: false,
  1007. sortLv: 0,
  1008. status: true,
  1009. fixed: '',
  1010. columnWidth: 200,
  1011. },
  1012. {
  1013. userId: this.$store.state.user.name,
  1014. functionId: 610,
  1015. serialNumber: '610Table1RequiredInboundDate',
  1016. tableId: "610Table1",
  1017. tableName: "收货入库任务表",
  1018. columnProp: 'requiredInboundDate',
  1019. headerAlign: "center",
  1020. align: "center",
  1021. columnLabel: '要求入库日期',
  1022. columnHidden: false,
  1023. columnImage: false,
  1024. columnSortable: false,
  1025. sortLv: 0,
  1026. status: true,
  1027. fixed: '',
  1028. columnWidth: 150,
  1029. },
  1030. {
  1031. userId: this.$store.state.user.name,
  1032. functionId: 610,
  1033. serialNumber: '610Table1Category',
  1034. tableId: "610Table1",
  1035. tableName: "收货入库任务表",
  1036. columnProp: 'categoryName',
  1037. headerAlign: "center",
  1038. align: "center",
  1039. columnLabel: '入库类别',
  1040. columnHidden: false,
  1041. columnImage: false,
  1042. columnSortable: false,
  1043. sortLv: 0,
  1044. status: true,
  1045. fixed: '',
  1046. columnWidth: 100,
  1047. },
  1048. {
  1049. userId: this.$store.state.user.name,
  1050. functionId: 610,
  1051. serialNumber: '610Table1DepartmentName',
  1052. tableId: "610Table1",
  1053. tableName: "收货入库任务表",
  1054. columnProp: 'departmentName',
  1055. headerAlign: "center",
  1056. align: "center",
  1057. columnLabel: '部门',
  1058. columnHidden: false,
  1059. columnImage: false,
  1060. columnSortable: false,
  1061. sortLv: 0,
  1062. status: true,
  1063. fixed: '',
  1064. columnWidth: 120,
  1065. },
  1066. {
  1067. userId: this.$store.state.user.name,
  1068. functionId: 610,
  1069. serialNumber: '610Table1CreatedDate',
  1070. tableId: "610Table1",
  1071. tableName: "收货入库任务表",
  1072. columnProp: 'createdDate',
  1073. headerAlign: "center",
  1074. align: "center",
  1075. columnLabel: '创建时间',
  1076. columnHidden: false,
  1077. columnImage: false,
  1078. columnSortable: false,
  1079. sortLv: 0,
  1080. status: true,
  1081. fixed: '',
  1082. columnWidth: 170,
  1083. },
  1084. {
  1085. userId: this.$store.state.user.name,
  1086. functionId: 610,
  1087. serialNumber: '610Table1CreatedBy',
  1088. tableId: "610Table1",
  1089. tableName: "收货入库任务表",
  1090. columnProp: 'createdBy',
  1091. headerAlign: "center",
  1092. align: "center",
  1093. columnLabel: '创建人',
  1094. columnHidden: false,
  1095. columnImage: false,
  1096. columnSortable: false,
  1097. sortLv: 0,
  1098. status: true,
  1099. fixed: '',
  1100. columnWidth: 100,
  1101. },
  1102. {
  1103. userId: this.$store.state.user.name,
  1104. functionId: 610,
  1105. serialNumber: '610Table1UpdatedDate',
  1106. tableId: "610Table1",
  1107. tableName: "收货入库任务表",
  1108. columnProp: 'updatedDate',
  1109. headerAlign: "center",
  1110. align: "center",
  1111. columnLabel: '更新时间',
  1112. columnHidden: false,
  1113. columnImage: false,
  1114. columnSortable: false,
  1115. sortLv: 0,
  1116. status: true,
  1117. fixed: '',
  1118. columnWidth: 170,
  1119. },
  1120. {
  1121. userId: this.$store.state.user.name,
  1122. functionId: 610,
  1123. serialNumber: '610Table1UpdatedBy',
  1124. tableId: "610Table1",
  1125. tableName: "收货入库任务表",
  1126. columnProp: 'updatedBy',
  1127. headerAlign: "center",
  1128. align: "center",
  1129. columnLabel: '更新人',
  1130. columnHidden: false,
  1131. columnImage: false,
  1132. columnSortable: false,
  1133. sortLv: 0,
  1134. status: true,
  1135. fixed: '',
  1136. columnWidth: 100,
  1137. },
  1138. ],
  1139. columnDetailList: [
  1140. {
  1141. columnProp: 'relatedOrderNo',
  1142. headerAlign: "center",
  1143. align: "left",
  1144. columnLabel: '关联单号',
  1145. columnHidden: false,
  1146. columnImage: false,
  1147. columnSortable: false,
  1148. sortLv: 0,
  1149. status: true,
  1150. fixed: '',
  1151. columnWidth: 100,
  1152. },
  1153. {
  1154. columnProp: 'relatedOrderLineNo',
  1155. headerAlign: "center",
  1156. align: "left",
  1157. columnLabel: '关联单行号',
  1158. columnHidden: false,
  1159. columnImage: false,
  1160. columnSortable: false,
  1161. sortLv: 0,
  1162. status: true,
  1163. fixed: '',
  1164. columnWidth: 100,
  1165. },
  1166. {
  1167. columnProp: 'partNo',
  1168. headerAlign: "center",
  1169. align: "left",
  1170. columnLabel: '物料编码',
  1171. columnHidden: false,
  1172. columnImage: false,
  1173. columnSortable: false,
  1174. sortLv: 0,
  1175. status: true,
  1176. fixed: '',
  1177. columnWidth: 120,
  1178. },
  1179. {
  1180. columnProp: 'partDesc',
  1181. headerAlign: "center",
  1182. align: "left",
  1183. columnLabel: '物料名称',
  1184. columnHidden: false,
  1185. columnImage: false,
  1186. columnSortable: false,
  1187. sortLv: 0,
  1188. status: true,
  1189. fixed: '',
  1190. columnWidth: 200,
  1191. },
  1192. {
  1193. columnProp: 'rollNo',
  1194. headerAlign: "center",
  1195. align: "left",
  1196. columnLabel: '卷号',
  1197. columnHidden: false,
  1198. columnImage: false,
  1199. columnSortable: false,
  1200. sortLv: 0,
  1201. status: true,
  1202. fixed: '',
  1203. columnWidth: 120,
  1204. },
  1205. {
  1206. columnProp: 'umName',
  1207. headerAlign: "center",
  1208. align: "center",
  1209. columnLabel: '单位',
  1210. columnHidden: false,
  1211. columnImage: false,
  1212. columnSortable: false,
  1213. sortLv: 0,
  1214. status: true,
  1215. fixed: '',
  1216. columnWidth: 80,
  1217. },
  1218. ],
  1219. columnDetailList2: [
  1220. {
  1221. columnProp: 'subNo',
  1222. headerAlign: "center",
  1223. align: "left",
  1224. columnLabel: '标签条码',
  1225. columnHidden: false,
  1226. columnImage: false,
  1227. columnSortable: false,
  1228. sortLv: 0,
  1229. status: true,
  1230. fixed: '',
  1231. columnWidth: 100,
  1232. },
  1233. {
  1234. columnProp: 'subQty',
  1235. headerAlign: "center",
  1236. align: "right",
  1237. columnLabel: '入库数量',
  1238. columnHidden: false,
  1239. columnImage: false,
  1240. columnSortable: false,
  1241. sortLv: 0,
  1242. status: true,
  1243. fixed: '',
  1244. columnWidth: 100,
  1245. },
  1246. {
  1247. columnProp: 'orderRef4',
  1248. headerAlign: "center",
  1249. align: "left",
  1250. columnLabel: '入库仓库',
  1251. columnHidden: false,
  1252. columnImage: false,
  1253. columnSortable: false,
  1254. sortLv: 0,
  1255. status: true,
  1256. fixed: '',
  1257. columnWidth: 150,
  1258. },
  1259. {
  1260. columnProp: 'orderRef5',
  1261. headerAlign: "center",
  1262. align: "left",
  1263. columnLabel: '入库库位',
  1264. columnHidden: false,
  1265. columnImage: false,
  1266. columnSortable: false,
  1267. sortLv: 0,
  1268. status: true,
  1269. fixed: '',
  1270. columnWidth: 150,
  1271. },
  1272. {
  1273. columnProp: 'userName',
  1274. headerAlign: "center",
  1275. align: "left",
  1276. columnLabel: '操作员',
  1277. columnHidden: false,
  1278. columnImage: false,
  1279. columnSortable: false,
  1280. sortLv: 0,
  1281. status: true,
  1282. fixed: '',
  1283. columnWidth: 100,
  1284. },
  1285. {
  1286. columnProp: 'transDate',
  1287. headerAlign: "center",
  1288. align: "center",
  1289. columnLabel: '操作时间',
  1290. columnHidden: false,
  1291. columnImage: false,
  1292. columnSortable: false,
  1293. sortLv: 0,
  1294. status: true,
  1295. fixed: '',
  1296. columnWidth: 170,
  1297. },
  1298. ],
  1299. rules: {
  1300. bu: [
  1301. {
  1302. required: true,
  1303. message: ' ',
  1304. trigger: ['blur','change']
  1305. }
  1306. ],
  1307. orderType: [
  1308. {
  1309. required: true,
  1310. message: ' ',
  1311. trigger: ['blur','change']
  1312. }
  1313. ],
  1314. requiredInboundDate: [
  1315. {
  1316. required: true,
  1317. message: ' ',
  1318. trigger: ['blur','change']
  1319. }
  1320. ],
  1321. category: [
  1322. {
  1323. required: true,
  1324. message: ' ',
  1325. trigger: ['blur','change']
  1326. }
  1327. ],
  1328. departmentNo: [
  1329. {
  1330. required: true,
  1331. message: ' ',
  1332. trigger: ['blur','change']
  1333. }
  1334. ]
  1335. },
  1336. searchLoading: false,
  1337. saveLoading: false,
  1338. activeTable: 'inboundDetail',
  1339. detailModal: false,
  1340. authSearch: false,
  1341. authSave: false,
  1342. authUpdate: false,
  1343. authDelete: false,
  1344. authArchive: false,
  1345. authClose: false,
  1346. authIssue: false,
  1347. editBatchVisible: false,
  1348. menuId: this.$route.meta.menuId,
  1349. tempWareHouseRow: {},
  1350. isChangeWarehouseBatch: false, // 是否批量更换仓库
  1351. detailList2: [],
  1352. detailModal2: false,
  1353. currentRow: {}
  1354. }
  1355. },
  1356. computed: {
  1357. // 计算明细列表要求入库数量总和
  1358. detailTotalQty() {
  1359. if (!this.detailList || this.detailList.length === 0) {
  1360. return 0;
  1361. }
  1362. return this.detailList.reduce((sum, item) => {
  1363. const qty = parseFloat(item.requiredQty) || 0;
  1364. return sum + qty;
  1365. }, 0);
  1366. },
  1367. // 判断是否有实际入库数量大于零的明细(有则禁止编辑)
  1368. hasActualInboundQty() {
  1369. if (!this.detailList || this.detailList.length === 0) {
  1370. return false;
  1371. }
  1372. return this.detailList.some(item => {
  1373. const qty = parseFloat(item.actualStockInQty) || 0;
  1374. return qty > 0;
  1375. });
  1376. }
  1377. },
  1378. mounted () {
  1379. this.$nextTick(() => {
  1380. this.calculateTableHeight()
  1381. // 监听窗口大小变化
  1382. window.addEventListener('resize', this.calculateTableHeight)
  1383. })
  1384. },
  1385. beforeDestroy() {
  1386. // 移除窗口大小变化监听
  1387. window.removeEventListener('resize', this.calculateTableHeight)
  1388. },
  1389. created () {
  1390. // 按钮控制
  1391. this.getButtonAuthData()
  1392. // 获取用户的 site 和 bu
  1393. this.getSiteAndBuByUserName()
  1394. // 校验用户是否收藏
  1395. this.favoriteIsOk()
  1396. // 加载部门列表(用于查询条件)
  1397. this.loadDepartmentList()
  1398. // 动态列
  1399. this.getTableUserColumn(this.$route.meta.menuId+'table1',1)
  1400. this.getTableUserColumn(this.$route.meta.menuId+'table2',2)
  1401. if (!this.authSearch) {
  1402. // 获取数据列表
  1403. this.getDataList()
  1404. }
  1405. },
  1406. methods: {
  1407. // 切换搜索条件展开/收起
  1408. toggleSearchExpand() {
  1409. this.searchExpanded = !this.searchExpanded
  1410. this.$nextTick(() => {
  1411. this.calculateTableHeight()
  1412. })
  1413. },
  1414. // 计算表格高度
  1415. calculateTableHeight() {
  1416. // 展开时搜索区域高度约180px,收起时约80px
  1417. const windowHeight = window.innerHeight;
  1418. const headerHeight = this.searchExpanded ? 244 : 124;
  1419. this.height = (windowHeight - headerHeight - 85) / 2 - 30;
  1420. this.secondHeight = windowHeight - this.height - headerHeight - 120;
  1421. },
  1422. // 重置搜索条件
  1423. resetSearch() {
  1424. this.searchData = {
  1425. site: '',
  1426. userName: this.$store.state.user.name,
  1427. orderNo: '',
  1428. orderType: '',
  1429. orderStatus: '',
  1430. orderStatusList: ['草稿'],
  1431. departmentNo: '',
  1432. startDate: '',
  1433. endDate: '',
  1434. createdStartDate: '',
  1435. createdEndDate: '',
  1436. page: 1,
  1437. limit: 10,
  1438. }
  1439. this.pageIndex = 1
  1440. },
  1441. // 获取用户的bu
  1442. getSiteAndBuByUserName () {
  1443. let tempData = {
  1444. username: this.$store.state.user.name,
  1445. }
  1446. getSiteAndBuByUserName(tempData).then(({data}) => {
  1447. if (data.code === 0) {
  1448. this.userBuList = data.rows
  1449. }
  1450. })
  1451. },
  1452. // 获取数据列表
  1453. getDataList () {
  1454. this.searchData.limit = this.pageSize
  1455. this.searchData.page = this.pageIndex
  1456. this.searchData.orderStatus = this.searchData.orderStatusList.join(',')
  1457. this.searchLoading = true
  1458. searchInboundNotification(this.searchData).then(({data}) => {
  1459. if (data.code === 0) {
  1460. this.dataList = data.page.list
  1461. this.pageIndex = data.page.currPage
  1462. this.pageSize = data.page.pageSize
  1463. this.totalPage = data.page.totalCount
  1464. // 判断是否全部存在数据
  1465. if (this.dataList.length > 0) {
  1466. // 设置选中行
  1467. this.$refs.inboundTable.setCurrentRow(this.dataList[0])
  1468. this.inboundClickRow(this.dataList[0])
  1469. this.refreshCurrentTabTable()
  1470. } else {
  1471. this.currentRow = {}
  1472. this.refreshCurrentTabTable()
  1473. }
  1474. }
  1475. }).finally(()=>{
  1476. this.searchLoading = false
  1477. })
  1478. },
  1479. // 每页数
  1480. sizeChangeHandle (val) {
  1481. this.pageSize = val
  1482. this.pageIndex = 1
  1483. this.getDataList()
  1484. },
  1485. // 当前页
  1486. currentChangeHandle (val) {
  1487. this.pageIndex = val
  1488. this.getDataList()
  1489. },
  1490. // 子明细每页数
  1491. sizeChangeHandle2 (val) {
  1492. this.pageSize2 = val
  1493. this.pageIndex2 = 1
  1494. this.searchTypeChange()
  1495. },
  1496. // 子明细当前页
  1497. currentChangeHandle2 (val) {
  1498. this.pageIndex2 = val
  1499. this.searchTypeChange()
  1500. },
  1501. saveModal () {
  1502. this.modalData = {
  1503. flag: '1',
  1504. site: '',
  1505. bu: this.userBuList[0].buNo,
  1506. buNo: '',
  1507. orderNo: '',
  1508. orderType: '',
  1509. orderStatus: '草稿',
  1510. requiredInboundDate: this.dayjs().format('YYYY-MM-DD'), // 默认为当天
  1511. supplierId: '',
  1512. supplierName: '',
  1513. remarks: '',
  1514. createdBy: this.$store.state.user.name,
  1515. category: '', // 入库类别
  1516. departmentNo: '', // 部门
  1517. }
  1518. this.modalDisableFlag = false
  1519. this.loadCategoryList() // 加载入库类别列表
  1520. this.loadDepartmentList() // 加载部门列表
  1521. this.modalFlag = true
  1522. // 重置表单验证状态
  1523. this.$nextTick(() => {
  1524. if (this.$refs.modalForm) {
  1525. this.$refs.modalForm.clearValidate()
  1526. }
  1527. })
  1528. },
  1529. updateModal (row) {
  1530. // 先更新当前行数据,确保使用的是点击行的数据
  1531. this.currentRow = JSON.parse(JSON.stringify(row))
  1532. if (this.currentRow.orderType === '采购入库' || this.currentRow.orderType === '销售退货') {
  1533. this.$message.warning('该类型单据不能编辑!')
  1534. return
  1535. }
  1536. // 校验当前行的明细是否有实际入库数量大于零
  1537. if (this.hasActualInboundQty) {
  1538. this.$message.warning('该单据已有实际入库数量,不能编辑主信息!')
  1539. return
  1540. }
  1541. this.modalData = {
  1542. flag: '2',
  1543. site: row.site,
  1544. bu: row.site + '_' + row.buNo,
  1545. buNo: row.buNo,
  1546. orderNo: row.orderNo,
  1547. orderType: row.orderType,
  1548. requiredInboundDate: row.requiredInboundDate,
  1549. supplierId: row.supplierId,
  1550. supplierName: row.supplierName,
  1551. remarks: row.remarks,
  1552. updatedBy: this.$store.state.user.name,
  1553. category: row.category || '', // 入库类别
  1554. departmentNo: row.departmentNo || '', // 部门
  1555. }
  1556. this.modalDisableFlag = true
  1557. this.loadCategoryList() // 加载入库类别列表
  1558. this.loadDepartmentList() // 加载部门列表
  1559. this.modalFlag = true
  1560. // 重置表单验证状态
  1561. this.$nextTick(() => {
  1562. if (this.$refs.modalForm) {
  1563. this.$refs.modalForm.clearValidate()
  1564. }
  1565. })
  1566. },
  1567. saveData () {
  1568. // 使用表单验证
  1569. this.$refs.modalForm.validate((valid) => {
  1570. if (!valid) {
  1571. this.$message.warning('请填写完整的必填项!')
  1572. return false
  1573. }
  1574. this.saveLoading = true
  1575. if (this.modalData.flag === '1') { // 新增
  1576. saveInboundNotification(this.modalData).then(({data}) => {
  1577. if (data && data.code === 0) {
  1578. const newOrderNo = data.orderNo // 获取新创建的单据号
  1579. this.modalFlag = false
  1580. this.$message.success('操作成功')
  1581. // 清空搜索条件,设置为新单据号以便精确查询
  1582. this.searchData.orderNo = newOrderNo
  1583. this.searchData.orderStatusList = [] // 清空状态筛选以确保能找到新单据
  1584. // 刷新列表并定位到新单据
  1585. this.searchData.limit = this.pageSize
  1586. this.searchData.page = 1
  1587. this.pageIndex = 1
  1588. this.searchData.orderStatus = ''
  1589. this.searchLoading = true
  1590. searchInboundNotification(this.searchData).then(({data: listData}) => {
  1591. if (listData.code === 0) {
  1592. this.dataList = listData.page.list
  1593. this.pageIndex = listData.page.currPage
  1594. this.pageSize = listData.page.pageSize
  1595. this.totalPage = listData.page.totalCount
  1596. // 找到新创建的单据并定位
  1597. const foundRow = this.dataList.find(item => item.orderNo === newOrderNo)
  1598. if (foundRow) {
  1599. this.currentRow = JSON.parse(JSON.stringify(foundRow))
  1600. this.$nextTick(() => {
  1601. this.$refs.inboundTable.setCurrentRow(foundRow)
  1602. this.refreshCurrentTabTable()
  1603. })
  1604. } else if (this.dataList.length > 0) {
  1605. this.$refs.inboundTable.setCurrentRow(this.dataList[0])
  1606. this.inboundClickRow(this.dataList[0])
  1607. }
  1608. }
  1609. // 恢复搜索条件
  1610. this.searchData.orderNo = ''
  1611. this.searchData.orderStatusList = ['草稿']
  1612. }).finally(() => {
  1613. this.searchLoading = false
  1614. })
  1615. } else {
  1616. this.$message.error(data.msg)
  1617. }
  1618. }).finally(()=>{
  1619. this.saveLoading = false
  1620. })
  1621. } else { // 修改
  1622. updateInboundNotification(this.modalData).then(({data}) => {
  1623. if (data && data.code === 0) {
  1624. this.getDataList()
  1625. this.modalFlag = false
  1626. this.$message.success('操作成功')
  1627. } else {
  1628. this.$message.error(data.msg)
  1629. }
  1630. }).finally(()=>{
  1631. this.saveLoading = false
  1632. })
  1633. }
  1634. })
  1635. },
  1636. // 删除
  1637. deleteModal () {
  1638. if (this.inboundSelection.length === 0) {
  1639. this.$message.warning('请勾选要删除的单据!')
  1640. return
  1641. }
  1642. this.$confirm(`是否删除该 `+ this.inboundSelection.length +` 条记录?`, '提示', {
  1643. confirmButtonText: '确定',
  1644. cancelButtonText: '取消',
  1645. type: 'warning'
  1646. }).then(() => {
  1647. let tempData = {
  1648. submitList: this.inboundSelection
  1649. }
  1650. deleteInboundNotification(tempData).then(({data}) => {
  1651. if (data && data.code === 0) {
  1652. this.getDataList()
  1653. this.inboundSelection = []
  1654. this.$message.success('操作成功')
  1655. } else {
  1656. this.$message.error(data.msg)
  1657. }
  1658. })
  1659. })
  1660. },
  1661. // 归档
  1662. archiveModal () {
  1663. },
  1664. // 关闭
  1665. closeModal (row) {
  1666. // 先更新当前行数据
  1667. this.currentRow = JSON.parse(JSON.stringify(row))
  1668. // if (this.currentRow.orderType === '采购入库' || this.currentRow.orderType === '销售退货') {
  1669. // this.$message.warning('该类型单据不能编辑!')
  1670. // return
  1671. // }
  1672. closeInboundNotification(row).then(({data}) => {
  1673. if (data && data.code === 0) {
  1674. this.getDataList()
  1675. this.$message.success('操作成功')
  1676. } else {
  1677. this.$message.error(data.msg)
  1678. }
  1679. })
  1680. },
  1681. // 下达
  1682. issueModal (row) {
  1683. // 先更新当前行数据
  1684. this.currentRow = JSON.parse(JSON.stringify(row))
  1685. if (this.currentRow.orderType === '采购入库' || this.currentRow.orderType === '销售退货') {
  1686. this.$message.warning('该类型单据不能编辑!')
  1687. return
  1688. }
  1689. // 校验明细是否有数据
  1690. if (!this.detailList || this.detailList.length === 0) {
  1691. this.$message.warning('入库明细不能为空,请先添加明细!')
  1692. return
  1693. }
  1694. // 校验所有明细的仓库、关联单号、关联单行号必填
  1695. for (let i = 0; i < this.detailList.length; i++) {
  1696. const detail = this.detailList[i]
  1697. if (!detail.inWarehouse) {
  1698. this.$message.warning(`${i + 1}行明细的入库仓库不能为空!`)
  1699. return
  1700. }
  1701. if (!detail.relatedOrderNo) {
  1702. this.$message.warning(`${i + 1}行明细的关联单号不能为空!`)
  1703. return
  1704. }
  1705. if (!detail.relatedOrderLineNo) {
  1706. this.$message.warning(`${i + 1}行明细的关联单行号不能为空!`)
  1707. return
  1708. }
  1709. }
  1710. issueInboundNotification(row).then(({data}) => {
  1711. if (data && data.code === 0) {
  1712. this.getDataList()
  1713. this.$message.success('操作成功')
  1714. } else {
  1715. this.$message.error(data.msg)
  1716. }
  1717. })
  1718. },
  1719. // 打开
  1720. openModal (row) {
  1721. this.$confirm('确认打开?', '提示', {
  1722. confirmButtonText: '确定',
  1723. cancelButtonText: '取消',
  1724. type: 'warning'
  1725. }).then(() => {
  1726. let inData = {
  1727. site: row.site,
  1728. buNo: row.buNo,
  1729. orderNo: row.orderNo
  1730. }
  1731. openInboundNotification(inData).then(({data}) => {
  1732. if (data && data.code === 0) {
  1733. this.getDataList()
  1734. this.$message.success('操作成功')
  1735. } else {
  1736. this.$message.error(data.msg)
  1737. }
  1738. })
  1739. });
  1740. },
  1741. // 列表表格选择替换
  1742. tabClick (tab, event) {
  1743. // 刷新列表数据
  1744. this.refreshCurrentTabTable()
  1745. },
  1746. // 当前值发生变化的时候修改
  1747. changeCurrentRow (row, oldRow) {
  1748. // 判断是否是获取焦点的事件
  1749. if (row) {
  1750. this.currentRow = JSON.parse(JSON.stringify(row))
  1751. //刷新当前页表
  1752. this.refreshCurrentTabTable()
  1753. }
  1754. },
  1755. // 复选
  1756. selectionInbound (val) {
  1757. this.inboundSelection = val
  1758. },
  1759. // 明细复选
  1760. selectionInboundDetail (val) {
  1761. this.inboundDetailSelection = val
  1762. },
  1763. rowStyle ({row}) {
  1764. if (this.currentRow.orderNo === row.orderNo) {
  1765. return { 'background-color': '#E8F7F6', cursor: 'pointer' }
  1766. }
  1767. },
  1768. // 单机选中信息
  1769. inboundClickRow (row,column) {
  1770. this.currentRow = JSON.parse(JSON.stringify(row))
  1771. },
  1772. // 刷新页签的table数据
  1773. refreshCurrentTabTable () {
  1774. if (this.activeTable === 'inboundDetail') {
  1775. this.getInboundDetail()
  1776. }
  1777. },
  1778. // 查询物料缺陷跟踪
  1779. getInboundDetail () {
  1780. let templateData = {
  1781. site: this.currentRow.site,
  1782. buNo: this.currentRow.buNo,
  1783. orderNo: this.currentRow.orderNo,
  1784. }
  1785. getInboundDetail(templateData).then(({data}) => {
  1786. this.detailList = data.rows
  1787. })
  1788. },
  1789. // 新增明细
  1790. addInboundDetailModal () {
  1791. if (this.currentRow.orderType === '采购入库' || this.currentRow.orderType === '销售退货') {
  1792. this.$message.warning('该类型单据不能编辑!')
  1793. return
  1794. }
  1795. this.detailSearchData = {
  1796. site: this.currentRow.site,
  1797. buNo: this.currentRow.buNo,
  1798. orderNo: this.currentRow.orderNo,
  1799. orderType: this.currentRow.orderType,
  1800. relatedOrderNo: '',
  1801. status: '',
  1802. partNo: '',
  1803. partDesc: '',
  1804. spec: '',
  1805. partNos: '',
  1806. page: 1,
  1807. limit: 10,
  1808. }
  1809. this.partSelections1 = []
  1810. this.partSelections2 = []
  1811. this.partList1 = []
  1812. this.partList2 = []
  1813. this.pageIndex2 = 1
  1814. this.pageSize2 = 20
  1815. this.totalPage2 = 0
  1816. if (this.currentRow.orderType === '生产入库') {
  1817. this.detailSearchData.status = ''
  1818. }
  1819. // 仅打开弹窗,不默认查询可选物料,等待用户手动点击“查询”
  1820. this.detailModal = true
  1821. },
  1822. handleGetProjectPartList () {
  1823. this.detailSearchData.limit = this.pageSize2
  1824. this.detailSearchData.page = this.pageIndex2
  1825. getInboundPartList(this.detailSearchData).then(({data}) => {
  1826. if (data && data.code === 0){
  1827. this.partList1 = data.page.list
  1828. this.pageIndex2 = data.page.currPage
  1829. this.pageSize2 = data.page.pageSize
  1830. this.totalPage2 = data.page.totalCount
  1831. }
  1832. })
  1833. },
  1834. // 可选物料
  1835. partClickRow1 (row) {
  1836. const tableRef = this.detailSearchData.orderType === '其他入库'
  1837. ? this.$refs.partTable1Other
  1838. : this.$refs.partTable1Production
  1839. if (tableRef) {
  1840. tableRef.toggleRowSelection(row)
  1841. }
  1842. },
  1843. // 已有物料
  1844. partClickRow2 (row) {
  1845. const tableRef = this.detailSearchData.orderType === '其他入库'
  1846. ? this.$refs.partTable2Other
  1847. : this.$refs.partTable2Production
  1848. if (tableRef) {
  1849. tableRef.toggleRowSelection(row)
  1850. }
  1851. },
  1852. selectionPart1 (val) {
  1853. this.partSelections1 = val
  1854. },
  1855. selectionPart2 (val) {
  1856. this.partSelections2 = val
  1857. },
  1858. // 改变事件
  1859. searchTypeChange () {
  1860. // 生产入库按卷号排除,其他入库按物料编码排除
  1861. if (this.detailSearchData.orderType === '生产入库') {
  1862. let rollNos = this.partList2.map(part => part.rollNo)
  1863. this.detailSearchData.partNos = rollNos.join(",")
  1864. } else {
  1865. let partNos = this.partList2.map(part => part.partNo)
  1866. this.detailSearchData.partNos = partNos.join(",")
  1867. }
  1868. this.handleGetProjectPartList()
  1869. },
  1870. // 添加物料
  1871. addPart () {
  1872. if (this.partSelections1 == null || this.partSelections1.length === 0) {
  1873. this.$message.warning('请选择可选物料!')
  1874. return
  1875. }
  1876. this.partSelections1.forEach(item => {
  1877. this.partList2.push(item)
  1878. })
  1879. this.searchTypeChange()
  1880. },
  1881. // 删除物料
  1882. deletePart () {
  1883. if(this.partSelections2 == null || this.partSelections2.length === 0) {
  1884. this.$message.warning('请选择已选物料!')
  1885. return
  1886. }
  1887. this.partSelections2.forEach(item => {
  1888. // 生产入库按卷号删除,其他入库按物料编码删除
  1889. if (this.detailSearchData.orderType === '生产入库') {
  1890. this.partList2 = this.partList2.filter(part => part.rollNo !== item.rollNo)
  1891. } else {
  1892. this.partList2 = this.partList2.filter(part => part.partNo !== item.partNo)
  1893. }
  1894. })
  1895. this.searchTypeChange()
  1896. },
  1897. // 新增明细
  1898. saveInboundDetail () {
  1899. // 校验已选物料列表不能为空
  1900. if (!this.partList2 || this.partList2.length === 0) {
  1901. this.$message.warning('请选择物料!')
  1902. return
  1903. }
  1904. // 校验关联单号和关联单行号必填
  1905. for (let i = 0; i < this.partList2.length; i++) {
  1906. const part = this.partList2[i]
  1907. if (!part.relatedOrderNo || part.relatedOrderNo.trim() === '') {
  1908. this.$message.warning(`物料 ${part.partNo} 的关联单号不能为空!`)
  1909. return
  1910. }
  1911. if (!part.relatedOrderLineNo || part.relatedOrderLineNo.toString().trim() === '') {
  1912. this.$message.warning(`物料 ${part.partNo} 的关联单行号不能为空!`)
  1913. return
  1914. }
  1915. }
  1916. let tempData = {
  1917. orderNo: this.detailSearchData.orderNo,
  1918. createdBy: this.$store.state.user.name,
  1919. partList: this.partList2,
  1920. }
  1921. this.saveLoading = true
  1922. saveInboundDetail(tempData).then(({data}) => {
  1923. if (data && data.code === 0) {
  1924. this.getInboundDetail()
  1925. this.detailModal = false
  1926. this.$message.success('操作成功')
  1927. } else {
  1928. this.$message.error(data.msg)
  1929. }
  1930. }).finally(()=>{
  1931. this.saveLoading = false
  1932. })
  1933. },
  1934. // 删除入库明细
  1935. deleteInboundDetail () {
  1936. if (this.currentRow.orderType === '采购入库' || this.currentRow.orderType === '销售退货') {
  1937. this.$message.warning('该类型单据不能编辑!')
  1938. return
  1939. }
  1940. if (this.inboundDetailSelection.length === 0) {
  1941. this.$message.warning('请勾选要删除的单据!')
  1942. return
  1943. }
  1944. this.$confirm(`是否删除该 `+ this.inboundDetailSelection.length +` 条记录?`, '提示', {
  1945. confirmButtonText: '确定',
  1946. cancelButtonText: '取消',
  1947. type: 'warning'
  1948. }).then(() => {
  1949. let tempData = {
  1950. submitList: this.inboundDetailSelection
  1951. }
  1952. deleteInboundDetail(tempData).then(({data}) => {
  1953. if (data && data.code === 0) {
  1954. this.getInboundDetail()
  1955. this.inboundDetailSelection = []
  1956. this.$message.success('操作成功')
  1957. } else {
  1958. this.$message.error(data.msg)
  1959. }
  1960. })
  1961. })
  1962. },
  1963. // 批量编辑模态框
  1964. editBatchModel() {
  1965. if (this.currentRow.orderType === '采购入库' || this.currentRow.orderType === '销售退货') {
  1966. this.$message.warning('该类型单据不能编辑!')
  1967. return
  1968. }
  1969. if (this.editBatchVisible) {
  1970. this.editBatchVisible = false
  1971. } else {
  1972. this.editBatchVisible = true
  1973. }
  1974. },
  1975. // 批量保存
  1976. batchModel() {
  1977. let params = []
  1978. params = this.detailList
  1979. this.saveLoading = true
  1980. updateInboundDetail(params).then(({data}) => {
  1981. if (data && data.code === 0) {
  1982. this.getInboundDetail()
  1983. this.$message.success(data.msg)
  1984. this.editBatchVisible = false
  1985. } else {
  1986. this.$message.error(data.msg)
  1987. }
  1988. }).finally(() => {
  1989. this.saveLoading = false
  1990. })
  1991. },
  1992. // 入库明细
  1993. inboundDetailModal (row) {
  1994. let tempData = {
  1995. ...row,
  1996. orderType: this.currentRow.orderType
  1997. }
  1998. getInboundDetail2(tempData).then(({data}) => {
  1999. if (data && data.code === 0) {
  2000. this.detailList2 = data.rows
  2001. } else {
  2002. this.detailList2 = []
  2003. }
  2004. })
  2005. this.detailModal2 = true
  2006. },
  2007. // 库位输入校验
  2008. supplierBlur (tagNo) {
  2009. let tempData = {
  2010. tagno: tagNo,
  2011. conditionSql: " and SupplierID = '" + this.modalData.supplierId + "'" + " and site = '" + this.modalData.site + "'"
  2012. }
  2013. verifyData(tempData).then(({data}) => {
  2014. if (data && data.code === 0) {
  2015. if (data.baseListData.length > 0) {
  2016. this.modalData.supplierId = data.baseListData[0].SupplierID
  2017. this.modalData.supplierName = data.baseListData[0].SupplierName
  2018. } else {
  2019. this.modalData.supplierName = ''
  2020. }
  2021. }
  2022. })
  2023. },
  2024. chooseWareHouse (row) {
  2025. this.isChangeWarehouseBatch = false
  2026. this.tempWareHouseRow = row
  2027. this.getBaseList(20)
  2028. },
  2029. // 批量更换仓库
  2030. changeWarehouseBatch () {
  2031. if (this.currentRow.orderType === '采购入库' || this.currentRow.orderType === '销售退货') {
  2032. this.$message.warning('该类型单据不能编辑!')
  2033. return
  2034. }
  2035. if (this.inboundDetailSelection.length === 0) {
  2036. this.$message.warning('请先勾选需要更换仓库的明细行!')
  2037. return
  2038. }
  2039. this.isChangeWarehouseBatch = true
  2040. this.getBaseList(20)
  2041. },
  2042. // 获取基础数据列表S
  2043. getBaseList (val, type) {
  2044. this.tagNo = val
  2045. this.tagType = type
  2046. this.$nextTick(() => {
  2047. let strVal = ''
  2048. if (val === 506) {
  2049. strVal = this.modalData.supplierId
  2050. this.$refs.baseList.init(val, strVal)
  2051. }
  2052. if (val === 20) {
  2053. strVal = this.tempWareHouseRow.inWarehouse
  2054. this.$refs.baseList.init(val, strVal)
  2055. }
  2056. })
  2057. },
  2058. // 列表方法的回调
  2059. getBaseData (val) {
  2060. if (this.tagNo === 506) {
  2061. this.modalData.supplierId = val.SupplierID
  2062. this.modalData.supplierName = val.SupplierName
  2063. }
  2064. if (this.tagNo === 20) {
  2065. if (this.isChangeWarehouseBatch) {
  2066. // 批量更换仓库
  2067. this.inboundDetailSelection.forEach(row => {
  2068. row.inWarehouse = val.WareHouseID
  2069. row.inWarehouseName = val.WareHouseName
  2070. })
  2071. // 批量保存更新
  2072. this.saveLoading = true
  2073. updateInboundDetail(this.detailList).then(({data}) => {
  2074. if (data && data.code === 0) {
  2075. this.getInboundDetail()
  2076. this.$message.success('更换仓库成功')
  2077. } else {
  2078. this.$message.error(data.msg)
  2079. }
  2080. }).finally(() => {
  2081. this.saveLoading = false
  2082. this.isChangeWarehouseBatch = false
  2083. })
  2084. } else {
  2085. // 单行编辑仓库
  2086. this.tempWareHouseRow.inWarehouse = val.WareHouseID
  2087. this.tempWareHouseRow.inWarehouseName = val.WareHouseName
  2088. }
  2089. }
  2090. },
  2091. // 校验用户是否收藏
  2092. favoriteIsOk () {
  2093. let userFavorite = {
  2094. userId: this.$store.state.user.id,
  2095. languageCode: this.$i18n.locale
  2096. }
  2097. userFavoriteList(userFavorite).then(({data}) => {
  2098. for (let i = 0; i < data.list.length; i++) {
  2099. if (this.$route.meta.menuId === data.list[i].menuId) {
  2100. this.favorite = true
  2101. }
  2102. }
  2103. })
  2104. },
  2105. // 收藏 OR 取消收藏
  2106. favoriteFunction () {
  2107. let userFavorite = {
  2108. userId: this.$store.state.user.id,
  2109. functionId: this.$route.meta.menuId,
  2110. }
  2111. if (this.favorite) {
  2112. removeUserFavorite(userFavorite).then(({data}) => {
  2113. this.$message.success(data.msg)
  2114. this.favorite = false
  2115. })
  2116. } else {
  2117. // 收藏
  2118. saveUserFavorite(userFavorite).then(({data}) => {
  2119. this.$message.success(data.msg)
  2120. this.favorite = true
  2121. })
  2122. }
  2123. },
  2124. async exportExcel() {
  2125. this.searchData.limit = -1
  2126. this.searchData.page = 1
  2127. excel.exportTable({
  2128. url: "/inbound/searchInboundNotification",
  2129. columnMapping: this.columnList, //可以直接用table,不需要的列就剔除
  2130. mergeSetting: [],//需要合并的列
  2131. params: this.searchData,
  2132. fileName: this.exportName+".xlsx",
  2133. rowFetcher: res => res.data,
  2134. columnFormatter: [],
  2135. dropColumns: [],
  2136. })
  2137. },
  2138. // 动态列开始 获取 用户保存的 格式列
  2139. async getTableUserColumn (tableId, columnId) {
  2140. let queryTableUser = {
  2141. userId: this.$store.state.user.name,
  2142. functionId: this.$route.meta.menuId,
  2143. tableId: tableId,
  2144. status: true,
  2145. languageCode: this.$i18n.locale
  2146. }
  2147. await getTableUserListLanguage(queryTableUser).then(({data}) => {
  2148. if (data.rows.length > 0) {
  2149. switch (columnId) {
  2150. case 1:
  2151. this.columnList = data.rows
  2152. break;
  2153. }
  2154. } else {
  2155. this.getColumnList(tableId, columnId)
  2156. }
  2157. })
  2158. },
  2159. // 获取 tableDefault 列
  2160. async getColumnList (tableId, columnId) {
  2161. let queryTable = {
  2162. functionId: this.$route.meta.menuId,
  2163. tableId: tableId,
  2164. languageCode: this.$i18n.locale
  2165. }
  2166. await getTableDefaultListLanguage(queryTable).then(({data}) => {
  2167. if (data.rows.length !== 0) {
  2168. switch (columnId) {
  2169. case 1:
  2170. this.columnList = data.rows
  2171. break;
  2172. }
  2173. }
  2174. })
  2175. },
  2176. //获取按钮的权限数据
  2177. getButtonAuthData () {
  2178. let searchFlag = this.isAuth(this.menuId + ":search")
  2179. let saveFlag = this.isAuth(this.menuId + ":save")
  2180. let updateFlag = this.isAuth(this.menuId + ":update")
  2181. let deleteFlag = this.isAuth(this.menuId + ":delete")
  2182. let archiveFlag = this.isAuth(this.menuId + ":archive")
  2183. let closeFlag = this.isAuth(this.menuId + ":close")
  2184. let issueFlag = this.isAuth(this.menuId + ":issue")
  2185. //处理页面的权限数据
  2186. this.authSearch = !searchFlag
  2187. this.authSave = !saveFlag
  2188. this.authUpdate = !updateFlag
  2189. this.authDelete = !deleteFlag
  2190. this.authArchive = !archiveFlag
  2191. this.authClose = !closeFlag
  2192. this.authIssue = !issueFlag
  2193. },
  2194. // 加载入库类别列表
  2195. loadCategoryList () {
  2196. getInboundCategoryList({}).then(({data}) => {
  2197. if (data && data.code === 0) {
  2198. this.categoryList = (data.rows || []).sort((a, b) => (a.crdcode || '').localeCompare(b.crdcode || ''))
  2199. }
  2200. })
  2201. },
  2202. // 加载部门列表
  2203. loadDepartmentList () {
  2204. getDepartmentList({}).then(({data}) => {
  2205. if (data && data.code === 0) {
  2206. this.departmentList = data.rows || []
  2207. }
  2208. })
  2209. },
  2210. // 标签导入
  2211. labelImportModal (row) {
  2212. // 权限检查:与批量编辑按钮相同的权限控制
  2213. // if (this.currentRow.orderStatus !== '草稿' && this.currentRow.orderStatus !== '编辑中') {
  2214. // this.$message.warning('只有草稿或编辑中状态的单据才能导入标签!')
  2215. // return
  2216. // }
  2217. // 准备传递给组件的数据
  2218. let currentData = {
  2219. site: this.currentRow.site,
  2220. buNo: this.currentRow.buNo,
  2221. orderNo: this.currentRow.orderNo,
  2222. orderType: this.currentRow.orderType,
  2223. orderStatus: this.currentRow.orderStatus,
  2224. relatedOrderNo: row.relatedOrderNo,
  2225. relatedOrderLineNo: row.relatedOrderLineNo,
  2226. partNo: row.partNo
  2227. }
  2228. // 打开标签导入组件
  2229. this.$nextTick(() => {
  2230. this.$refs.labelImportUpload.init(currentData)
  2231. })
  2232. },
  2233. }
  2234. }
  2235. </script>
  2236. <style scoped>
  2237. /deep/ .customer-tab .el-tabs__content {
  2238. padding: 5px !important;
  2239. }
  2240. .el-table /deep/ .cell{
  2241. height: auto;
  2242. line-height: 1.5;
  2243. }
  2244. /* 搜索卡片样式 */
  2245. .search-card {
  2246. margin-bottom: 16px;
  2247. border-radius: 8px;
  2248. overflow: hidden;
  2249. transition: all 0.3s ease;
  2250. }
  2251. .search-card:hover {
  2252. box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  2253. }
  2254. .search-card /deep/ .el-card__header {
  2255. padding: 5px 20px;
  2256. background: linear-gradient(135deg, #9ac3d0 20%, #b6c7dd 80%);
  2257. border-bottom: none;
  2258. }
  2259. .search-header {
  2260. display: flex;
  2261. justify-content: space-between;
  2262. align-items: center;
  2263. }
  2264. .header-left {
  2265. display: flex;
  2266. align-items: center;
  2267. color: #fff;
  2268. }
  2269. .header-left i {
  2270. font-size: 16px;
  2271. margin-right: 8px;
  2272. }
  2273. .header-title {
  2274. font-size: 14px;
  2275. font-weight: 600;
  2276. letter-spacing: 0.5px;
  2277. }
  2278. .header-right {
  2279. color: #fff;
  2280. }
  2281. .collapse-btn {
  2282. color: #fff;
  2283. font-weight: 500;
  2284. transition: all 0.3s ease;
  2285. }
  2286. .collapse-btn:hover {
  2287. color: #f0f0f0;
  2288. transform: translateY(-1px);
  2289. }
  2290. .collapse-btn i {
  2291. transition: transform 0.3s ease;
  2292. }
  2293. /* 搜索表单样式 */
  2294. .search-form {
  2295. padding: 6px 0;
  2296. min-height: 0;
  2297. }
  2298. /* 卡片主体样式 */
  2299. .search-card /deep/ .el-card__body {
  2300. padding: 10px;
  2301. transition: all 0.3s ease;
  2302. }
  2303. /* 收起时的样式 */
  2304. .search-card.collapsed /deep/ .el-card__body {
  2305. padding: 10px 20px;
  2306. }
  2307. .search-form /deep/ .el-form-item {
  2308. margin-bottom: 12px;
  2309. }
  2310. .search-form /deep/ .el-form-item__label {
  2311. font-weight: 500;
  2312. color: #606266;
  2313. padding-bottom: 4px;
  2314. }
  2315. .search-form /deep/ .el-input__inner,
  2316. .search-form /deep/ .el-textarea__inner {
  2317. border-radius: 6px;
  2318. border: 1px solid #DCDFE6;
  2319. transition: all 0.3s ease;
  2320. }
  2321. .search-form /deep/ .el-input__inner:focus,
  2322. .search-form /deep/ .el-textarea__inner:focus {
  2323. border-color: #9ac3d0;
  2324. box-shadow: 0 0 0 2px rgba(154, 195, 208, 0.1);
  2325. }
  2326. .search-form /deep/ .el-select {
  2327. width: 100%;
  2328. }
  2329. /* 操作按钮区域 */
  2330. .search-actions {
  2331. display: flex;
  2332. justify-content: space-between;
  2333. align-items: center;
  2334. padding: 8px 0 2px 0;
  2335. }
  2336. /* 展开时显示上边框 */
  2337. .search-card:not(.collapsed) .search-actions {
  2338. border-top: 1px solid #f0f0f0;
  2339. margin-top: 6px;
  2340. }
  2341. /* 收起时不显示上边框和上边距 */
  2342. .search-card.collapsed .search-actions {
  2343. border-top: none;
  2344. margin-top: 0;
  2345. padding-top: 0;
  2346. }
  2347. .action-left {
  2348. display: flex;
  2349. gap: 8px;
  2350. align-items: center;
  2351. }
  2352. .search-actions .el-button {
  2353. border-radius: 4px;
  2354. padding: 5px 10px;
  2355. font-size: 12px;
  2356. font-weight: 500;
  2357. transition: all 0.3s ease;
  2358. }
  2359. .search-actions .el-button:hover {
  2360. transform: translateY(-2px);
  2361. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  2362. }
  2363. .search-actions .el-button--primary {
  2364. background: #60aeff;
  2365. border-color: #60aeff;
  2366. }
  2367. .search-actions .el-button--primary:hover {
  2368. background: #7dbdff;
  2369. border-color: #7dbdff;
  2370. }
  2371. .search-actions .el-button--success {
  2372. background: #67C23A;
  2373. border-color: #67C23A;
  2374. }
  2375. .search-actions .el-button--success:hover {
  2376. background: #85ce61;
  2377. border-color: #85ce61;
  2378. }
  2379. .search-actions .el-button--danger {
  2380. background: #F56C6C;
  2381. border-color: #F56C6C;
  2382. }
  2383. .search-actions .el-button--danger:hover {
  2384. background: #f78989;
  2385. border-color: #f78989;
  2386. }
  2387. .search-actions .el-button--warning {
  2388. background: #E6A23C;
  2389. border-color: #E6A23C;
  2390. }
  2391. .search-actions .el-button--warning:hover {
  2392. background: #ebb563;
  2393. border-color: #ebb563;
  2394. }
  2395. /* 表格样式 */
  2396. /deep/ .el-table th {
  2397. background-color: #f5f7fa;
  2398. color: #303133;
  2399. font-weight: 600;
  2400. }
  2401. /deep/ .el-table tr:hover > td {
  2402. background-color: #f5f7fa !important;
  2403. }
  2404. /* 响应式设计 */
  2405. @media (max-width: 1200px) {
  2406. .search-actions {
  2407. flex-direction: column;
  2408. gap: 10px;
  2409. }
  2410. .action-left {
  2411. width: 100%;
  2412. justify-content: center;
  2413. }
  2414. }
  2415. </style>