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.

855 lines
42 KiB

  1. <template>
  2. <!-- 盘点查询页面 - rqrq -->
  3. <div class="mod-config yzz">
  4. <!-- 查询区域 -->
  5. <el-form label-position="top" style="margin-top: 1px; margin-left: 0px;">
  6. <el-form :inline="true" label-position="top" style="margin-top: 0px">
  7. <el-form-item label="盘点单号" style="margin-right: 10px;">
  8. <el-input v-model="queryForm.searchCountNo" placeholder="请输入盘点单号" clearable style="width: 150px;" @keyup.enter.native="search"></el-input>
  9. </el-form-item>
  10. <el-form-item label="盘点类型" style="margin-right: 10px;">
  11. <el-select v-model="queryForm.searchCountType" placeholder="请选择" clearable style="width: 120px;">
  12. <el-option label="循环盘点" value="CYCLE"></el-option>
  13. <el-option label="手工盘点" value="MANUAL"></el-option>
  14. </el-select>
  15. </el-form-item>
  16. <el-form-item label="状态" style="margin-right: 10px;">
  17. <el-select v-model="queryForm.searchStatus" placeholder="请选择" clearable style="width: 120px;">
  18. <el-option label="草稿" value="DRAFT"></el-option>
  19. <el-option label="已下达" value="RELEASED"></el-option>
  20. <el-option label="盘点中" value="CHECKING"></el-option>
  21. <el-option label="已完成" value="COMPLETED"></el-option>
  22. <el-option label="已取消" value="CANCELLED"></el-option>
  23. </el-select>
  24. </el-form-item>
  25. <el-form-item label="申请日期" style="margin-right: 10px;">
  26. <el-date-picker v-model="queryForm.startDate" type="date" placeholder="开始日期" value-format="yyyy-MM-dd" style="width: 130px;"></el-date-picker>
  27. <span style="margin: 0 5px;"></span>
  28. <el-date-picker v-model="queryForm.endDate" type="date" placeholder="结束日期" value-format="yyyy-MM-dd" style="width: 130px;"></el-date-picker>
  29. </el-form-item>
  30. <el-form-item label=" " style="margin-right: 10px;">
  31. <el-button type="primary" @click="search">查询</el-button>
  32. <el-button @click="resetQuery">重置</el-button>
  33. <el-button type="success" @click="showCycleCountDialog">循环盘点</el-button>
  34. <el-button type="warning" @click="handleCreateManualCount">手工盘点</el-button>
  35. </el-form-item>
  36. </el-form>
  37. </el-form>
  38. <!-- 主表格 - rqrq -->
  39. <el-table :data="dataList" @row-click="handleRowClick" :height="height" border highlight-current-row ref="mainTable" v-loading="dataListLoading" style="width: 100%;">
  40. <el-table-column
  41. v-for="(item,index) in mainColumnList" :key="index"
  42. :sortable="item.columnSortable"
  43. :prop="item.columnProp"
  44. :header-align="item.headerAlign"
  45. :show-overflow-tooltip="item.showOverflowTooltip"
  46. :align="item.align"
  47. :fixed="item.fixed==''?false:item.fixed"
  48. :min-width="item.columnWidth"
  49. :label="item.columnLabel">
  50. <template slot-scope="scope">
  51. <span v-if="item.columnProp === 'statusDesc'" :style="{color: getStatusColor(scope.row.status)}">{{ scope.row.statusDesc }}</span>
  52. <span v-else-if="item.columnProp === 'countPercent'">{{ scope.row.countPercent ? scope.row.countPercent + '%' : '' }}</span>
  53. <span v-else-if="item.columnProp === 'countProgress'">{{ scope.row.checkedLabelCount }}/{{ scope.row.totalLabelCount }}</span>
  54. <span v-else-if="item.columnProp === 'applyDate'">{{ formatDateTime(scope.row.applyDate) }}</span>
  55. <span v-else-if="item.columnProp === 'releaseDate'">{{ formatDateTime(scope.row.releaseDate) }}</span>
  56. <span v-else>{{ scope.row[item.columnProp] }}</span>
  57. </template>
  58. </el-table-column>
  59. <el-table-column header-align="center" align="center" fixed="right" width="220" label="操作">
  60. <template slot-scope="scope">
  61. <a type="text" style="margin-right: 10px;" @click.stop="handleAddMaterial(scope.row)" v-if="scope.row.status === 'DRAFT' && scope.row.countType === 'MANUAL'">添加物料</a>
  62. <a type="text" style="margin-right: 10px;" @click.stop="handleRelease(scope.row)" v-if="scope.row.status === 'DRAFT'">下达</a>
  63. <a type="text" style="margin-right: 10px;" @click.stop="handleComplete(scope.row)" v-if="scope.row.status === 'RELEASED' || scope.row.status === 'CHECKING'">完成</a>
  64. <a type="text" style="margin-right: 10px;" @click.stop="handleCancel(scope.row)" v-if="scope.row.status !== 'COMPLETED' && scope.row.status !== 'CANCELLED'">取消</a>
  65. <a type="text" style="color: #F56C6C;" @click.stop="handleDelete(scope.row)" v-if="scope.row.status === 'DRAFT'">删除</a>
  66. </template>
  67. </el-table-column>
  68. </el-table>
  69. <!-- 分页 -->
  70. <el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex" :page-sizes="[20, 50, 100, 1000]" :page-size="pageSize" :total="totalPage" layout="total, sizes, prev, pager, next, jumper">
  71. </el-pagination>
  72. <!-- Tab标签页 -->
  73. <el-tabs style="font-size: 12px;min-height: 200px" class="customer-tab" v-model="activeName" type="border-card" @tab-click="tabClick">
  74. <el-tab-pane label="标签明细" name="label">
  75. <!-- 标签明细表格 - rqrq -->
  76. <el-table :data="labelList" :height="200" border v-loading="labelListLoading" style="width: 100%;">
  77. <el-table-column
  78. v-for="(item,index) in labelColumnList" :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.columnProp === 'countFlagDesc'" :style="{color: scope.row.countFlag === 'Y' ? '#67C23A' : '#F56C6C'}">{{ scope.row.countFlagDesc }}</span>
  89. <span v-else-if="item.columnProp === 'countDate'">{{ formatDateTime(scope.row.countDate) }}</span>
  90. <span v-else>{{ scope.row[item.columnProp] }}</span>
  91. </template>
  92. </el-table-column>
  93. </el-table>
  94. </el-tab-pane>
  95. <el-tab-pane label="栈板明细" name="pallet">
  96. <!-- 栈板明细表格 - rqrq -->
  97. <el-table :data="palletList" :height="200" border v-loading="palletListLoading" style="width: 100%;">
  98. <el-table-column
  99. v-for="(item,index) in palletColumnList" :key="index"
  100. :sortable="item.columnSortable"
  101. :prop="item.columnProp"
  102. :header-align="item.headerAlign"
  103. :show-overflow-tooltip="item.showOverflowTooltip"
  104. :align="item.align"
  105. :fixed="item.fixed==''?false:item.fixed"
  106. :min-width="item.columnWidth"
  107. :label="item.columnLabel">
  108. <template slot-scope="scope">
  109. <span v-if="item.columnProp === 'countFlagDesc'" :style="{color: scope.row.countFlag === 'Y' ? '#67C23A' : '#F56C6C'}">{{ scope.row.countFlagDesc }}</span>
  110. <span v-else-if="item.columnProp === 'countDate'">{{ formatDateTime(scope.row.countDate) }}</span>
  111. <span v-else>{{ scope.row[item.columnProp] }}</span>
  112. </template>
  113. </el-table-column>
  114. </el-table>
  115. </el-tab-pane>
  116. <el-tab-pane label="盘点结果" name="result">
  117. <!-- 盘点结果表格 - rqrq -->
  118. <el-table :data="resultList" :height="200" border v-loading="resultListLoading" style="width: 100%;">
  119. <el-table-column
  120. v-for="(item,index) in resultColumnList" :key="index"
  121. :sortable="item.columnSortable"
  122. :prop="item.columnProp"
  123. :header-align="item.headerAlign"
  124. :show-overflow-tooltip="item.showOverflowTooltip"
  125. :align="item.align"
  126. :fixed="item.fixed==''?false:item.fixed"
  127. :min-width="item.columnWidth"
  128. :label="item.columnLabel">
  129. <template slot-scope="scope">
  130. <span v-if="item.columnProp === 'countResultDesc'" :style="{color: getResultColor(scope.row.countResult)}">{{ scope.row.countResultDesc }}</span>
  131. <span v-else-if="item.columnProp === 'countDate'">{{ formatDateTime(scope.row.countDate) }}</span>
  132. <span v-else>{{ scope.row[item.columnProp] }}</span>
  133. </template>
  134. </el-table-column>
  135. </el-table>
  136. </el-tab-pane>
  137. <el-tab-pane label="物料汇总" name="summary">
  138. <!-- 物料汇总表格 - rqrq -->
  139. <el-table :data="summaryList" :height="200" border v-loading="summaryListLoading" style="width: 100%;">
  140. <el-table-column
  141. v-for="(item,index) in summaryColumnList" :key="index"
  142. :sortable="item.columnSortable"
  143. :prop="item.columnProp"
  144. :header-align="item.headerAlign"
  145. :show-overflow-tooltip="item.showOverflowTooltip"
  146. :align="item.align"
  147. :fixed="item.fixed==''?false:item.fixed"
  148. :min-width="item.columnWidth"
  149. :label="item.columnLabel">
  150. <template slot-scope="scope">
  151. <span>{{ scope.row[item.columnProp] }}</span>
  152. </template>
  153. </el-table-column>
  154. </el-table>
  155. </el-tab-pane>
  156. </el-tabs>
  157. <!-- 循环盘点弹窗 -->
  158. <el-dialog title="创建循环盘点单" :visible.sync="cycleCountDialogVisible" width="400px" :close-on-click-modal="false" v-drag>
  159. <el-form :model="cycleCountForm" label-width="100px">
  160. <el-form-item label="盘点比例(%)">
  161. <el-input v-model="cycleCountForm.countPercent" style="width: 250px;"></el-input>
  162. </el-form-item>
  163. <el-form-item label="备注">
  164. <el-input v-model="cycleCountForm.remark" type="textarea" :rows="3" style="width: 250px;"></el-input>
  165. </el-form-item>
  166. </el-form>
  167. <el-footer style="height:30px;margin-top: 60px;text-align:center">
  168. <el-button type="primary" @click="createCycleCount" :loading="createLoading" :disabled="createLoading">{{ createLoading ? '创建中...' : '创 建' }}</el-button>
  169. <el-button @click="cycleCountDialogVisible = false" :disabled="createLoading"> </el-button>
  170. </el-footer>
  171. </el-dialog>
  172. <!-- 添加物料弹窗显示已有标签列表-->
  173. <el-dialog :title="'添加物料 - ' + (addMaterialRow ? addMaterialRow.countNo : '')" :visible.sync="addMaterialDialogVisible" width="1000px" :close-on-click-modal="false" v-drag>
  174. <div style="margin-bottom: 10px;">
  175. <el-button type="primary" size="small" @click="showMaterialQueryDialog">添加物料</el-button>
  176. </div>
  177. <!-- 当前标签列表表格 - rqrq -->
  178. <el-table :data="currentLabelList" :height="350" border v-loading="currentLabelListLoading" style="width: 100%;">
  179. <el-table-column
  180. v-for="(item,index) in currentLabelColumnList" :key="index"
  181. :sortable="item.columnSortable"
  182. :prop="item.columnProp"
  183. :header-align="item.headerAlign"
  184. :show-overflow-tooltip="item.showOverflowTooltip"
  185. :align="item.align"
  186. :fixed="item.fixed==''?false:item.fixed"
  187. :min-width="item.columnWidth"
  188. :label="item.columnLabel">
  189. <template slot-scope="scope">
  190. <span>{{ scope.row[item.columnProp] }}</span>
  191. </template>
  192. </el-table-column>
  193. </el-table>
  194. <span slot="footer" class="dialog-footer">
  195. <el-button @click="addMaterialDialogVisible = false"> </el-button>
  196. </span>
  197. </el-dialog>
  198. <!-- 物料查询弹窗添加物料时使用-->
  199. <el-dialog title="查询物料" :visible.sync="materialQueryDialogVisible" width="900px" :close-on-click-modal="false" v-drag append-to-body>
  200. <el-form :inline="true" :model="materialQueryForm" label-position="top">
  201. <el-form-item label="物料编码" style="margin-right: 10px;">
  202. <el-input v-model="materialQueryForm.searchPartNo" placeholder="请输入物料编码" clearable style="width: 150px;" @keyup.enter.native="queryMaterialForAdd"></el-input>
  203. </el-form-item>
  204. <el-form-item label="批号" style="margin-right: 10px;">
  205. <el-input v-model="materialQueryForm.searchBatchNo" placeholder="请输入批号" clearable style="width: 120px;"></el-input>
  206. </el-form-item>
  207. <el-form-item label="WDR号" style="margin-right: 10px;">
  208. <el-input v-model="materialQueryForm.searchWdr" placeholder="请输入WDR号" clearable style="width: 120px;"></el-input>
  209. </el-form-item>
  210. <el-form-item label=" ">
  211. <el-button type="primary" @click="queryMaterialForAdd" :loading="materialQueryLoading">查询</el-button>
  212. </el-form-item>
  213. </el-form>
  214. <!-- 物料查询表格 - rqrq -->
  215. <el-table :data="materialQueryList" :height="300" border highlight-current-row ref="materialQueryTable" v-loading="materialQueryLoading" @selection-change="handleMaterialSelectionChange" style="width: 100%;">
  216. <el-table-column type="selection" width="50"></el-table-column>
  217. <el-table-column
  218. v-for="(item,index) in materialQueryColumnList" :key="index"
  219. :sortable="item.columnSortable"
  220. :prop="item.columnProp"
  221. :header-align="item.headerAlign"
  222. :show-overflow-tooltip="item.showOverflowTooltip"
  223. :align="item.align"
  224. :fixed="item.fixed==''?false:item.fixed"
  225. :min-width="item.columnWidth"
  226. :label="item.columnLabel">
  227. <template slot-scope="scope">
  228. <span>{{ scope.row[item.columnProp] }}</span>
  229. </template>
  230. </el-table-column>
  231. </el-table>
  232. <span slot="footer" class="dialog-footer">
  233. <el-button @click="materialQueryDialogVisible = false" :disabled="addMaterialLoading"> </el-button>
  234. <el-button type="primary" @click="confirmAddMaterial" :loading="addMaterialLoading" :disabled="addMaterialLoading || selectedMaterials.length === 0">{{ addMaterialLoading ? '添加中...' : '确认添加' }}</el-button>
  235. </span>
  236. </el-dialog>
  237. </div>
  238. </template>
  239. <script>
  240. import { searchCountHeaderList, createCycleCount, createManualCount, queryMaterialForManualCount, addMaterialToCount, releaseCount, completeCount, cancelCount, deleteCount, searchCountLabelList, searchCountPalletList, searchCountResultList, searchMaterialSummary } from '@/api/check/physicalInventory'
  241. export default {
  242. name: 'searchPhysicalInventory',
  243. data() {
  244. return {
  245. // 主表相关 - rqrq
  246. dataList: [],
  247. dataListLoading: false,
  248. pageIndex: 1,
  249. pageSize: 20,
  250. totalPage: 0,
  251. height: 300,
  252. currentRow: null,
  253. // 查询表单 - rqrq
  254. queryForm: {
  255. searchCountNo: '',
  256. searchCountType: '',
  257. searchStatus: '',
  258. startDate: '',
  259. endDate: ''
  260. },
  261. // 主表格列配置 - rqrq
  262. mainColumnList: [
  263. { columnProp: "countNo", headerAlign: "center", align: "center", columnLabel: "盘点单号", columnWidth: 160, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  264. { columnProp: "countTypeDesc", headerAlign: "center", align: "center", columnLabel: "盘点类型", columnWidth: 100, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  265. { columnProp: "statusDesc", headerAlign: "center", align: "center", columnLabel: "状态", columnWidth: 80, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  266. { columnProp: "countPercent", headerAlign: "center", align: "center", columnLabel: "盘点比例", columnWidth: 80, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  267. { columnProp: "countProgress", headerAlign: "center", align: "center", columnLabel: "盘点进度", columnWidth: 120, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  268. { columnProp: "totalPalletCount", headerAlign: "center", align: "center", columnLabel: "栈板数", columnWidth: 80, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  269. { columnProp: "applyUser", headerAlign: "center", align: "center", columnLabel: "申请人", columnWidth: 100, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  270. { columnProp: "applyDate", headerAlign: "center", align: "center", columnLabel: "申请日期", columnWidth: 140, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  271. { columnProp: "releaseUser", headerAlign: "center", align: "center", columnLabel: "下达人", columnWidth: 100, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  272. { columnProp: "releaseDate", headerAlign: "center", align: "center", columnLabel: "下达日期", columnWidth: 140, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  273. { columnProp: "remark", headerAlign: "center", align: "left", columnLabel: "备注", columnWidth: 150, columnSortable: false, showOverflowTooltip: true, fixed: "" }
  274. ],
  275. // Tab相关 - rqrq
  276. activeName: 'label',
  277. labelList: [],
  278. labelListLoading: false,
  279. palletList: [],
  280. palletListLoading: false,
  281. resultList: [],
  282. resultListLoading: false,
  283. summaryList: [],
  284. summaryListLoading: false,
  285. // 标签明细列配置 - rqrq
  286. labelColumnList: [
  287. { columnProp: "unitId", headerAlign: "center", align: "center", columnLabel: "标签号", columnWidth: 150, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  288. { columnProp: "partNo", headerAlign: "center", align: "center", columnLabel: "物料号", columnWidth: 120, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  289. { columnProp: "partDesc", headerAlign: "center", align: "left", columnLabel: "物料描述", columnWidth: 180, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  290. { columnProp: "qty", headerAlign: "center", align: "center", columnLabel: "数量", columnWidth: 80, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  291. { columnProp: "batchNo", headerAlign: "center", align: "center", columnLabel: "批号", columnWidth: 100, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  292. { columnProp: "palletId", headerAlign: "center", align: "center", columnLabel: "栈板号", columnWidth: 120, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  293. { columnProp: "labelTypeDesc", headerAlign: "center", align: "center", columnLabel: "标签类型", columnWidth: 100, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  294. { columnProp: "countFlagDesc", headerAlign: "center", align: "center", columnLabel: "盘点状态", columnWidth: 80, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  295. { columnProp: "countUser", headerAlign: "center", align: "center", columnLabel: "盘点人", columnWidth: 100, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  296. { columnProp: "countDate", headerAlign: "center", align: "center", columnLabel: "盘点时间", columnWidth: 140, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  297. { columnProp: "warehouseName", headerAlign: "center", align: "center", columnLabel: "仓库", columnWidth: 100, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  298. { columnProp: "locationName", headerAlign: "center", align: "center", columnLabel: "库位", columnWidth: 100, columnSortable: false, showOverflowTooltip: true, fixed: "" }
  299. ],
  300. // 栈板明细列配置 - rqrq
  301. palletColumnList: [
  302. { columnProp: "seqNo", headerAlign: "center", align: "center", columnLabel: "序号", columnWidth: 60, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  303. { columnProp: "palletId", headerAlign: "center", align: "center", columnLabel: "栈板号", columnWidth: 150, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  304. { columnProp: "labelCount", headerAlign: "center", align: "center", columnLabel: "标签数", columnWidth: 80, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  305. { columnProp: "checkedCount", headerAlign: "center", align: "center", columnLabel: "已盘点", columnWidth: 80, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  306. { columnProp: "progressPercent", headerAlign: "center", align: "center", columnLabel: "进度", columnWidth: 80, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  307. { columnProp: "countFlagDesc", headerAlign: "center", align: "center", columnLabel: "盘点状态", columnWidth: 80, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  308. { columnProp: "stationArea", headerAlign: "center", align: "center", columnLabel: "站点区域", columnWidth: 100, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  309. { columnProp: "stationId", headerAlign: "center", align: "center", columnLabel: "站点ID", columnWidth: 100, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  310. { columnProp: "locationCode", headerAlign: "center", align: "center", columnLabel: "位置编码", columnWidth: 120, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  311. { columnProp: "countUser", headerAlign: "center", align: "center", columnLabel: "盘点人", columnWidth: 100, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  312. { columnProp: "countDate", headerAlign: "center", align: "center", columnLabel: "盘点时间", columnWidth: 140, columnSortable: false, showOverflowTooltip: true, fixed: "" }
  313. ],
  314. // 盘点结果列配置 - rqrq
  315. resultColumnList: [
  316. { columnProp: "unitId", headerAlign: "center", align: "center", columnLabel: "标签号", columnWidth: 150, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  317. { columnProp: "partNo", headerAlign: "center", align: "center", columnLabel: "物料号", columnWidth: 120, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  318. { columnProp: "partDesc", headerAlign: "center", align: "left", columnLabel: "物料描述", columnWidth: 180, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  319. { columnProp: "qty", headerAlign: "center", align: "center", columnLabel: "数量", columnWidth: 80, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  320. { columnProp: "batchNo", headerAlign: "center", align: "center", columnLabel: "批号", columnWidth: 100, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  321. { columnProp: "palletId", headerAlign: "center", align: "center", columnLabel: "栈板号", columnWidth: 120, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  322. { columnProp: "countResultDesc", headerAlign: "center", align: "center", columnLabel: "盘点结果", columnWidth: 80, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  323. { columnProp: "countUser", headerAlign: "center", align: "center", columnLabel: "盘点人", columnWidth: 100, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  324. { columnProp: "countDate", headerAlign: "center", align: "center", columnLabel: "盘点时间", columnWidth: 140, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  325. { columnProp: "remark", headerAlign: "center", align: "left", columnLabel: "备注", columnWidth: 150, columnSortable: false, showOverflowTooltip: true, fixed: "" }
  326. ],
  327. // 物料汇总列配置 - rqrq
  328. summaryColumnList: [
  329. { columnProp: "partNo", headerAlign: "center", align: "center", columnLabel: "物料号", columnWidth: 120, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  330. { columnProp: "partDesc", headerAlign: "center", align: "left", columnLabel: "物料描述", columnWidth: 180, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  331. { columnProp: "batchNo", headerAlign: "center", align: "center", columnLabel: "批号", columnWidth: 100, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  332. { columnProp: "wdr", headerAlign: "center", align: "center", columnLabel: "WDR号", columnWidth: 120, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  333. { columnProp: "warehouseName", headerAlign: "center", align: "center", columnLabel: "仓库", columnWidth: 100, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  334. { columnProp: "locationName", headerAlign: "center", align: "center", columnLabel: "库位", columnWidth: 100, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  335. { columnProp: "labelCount", headerAlign: "center", align: "center", columnLabel: "标签数", columnWidth: 80, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  336. { columnProp: "totalQty", headerAlign: "center", align: "center", columnLabel: "总数量", columnWidth: 100, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  337. { columnProp: "palletCount", headerAlign: "center", align: "center", columnLabel: "栈板数", columnWidth: 80, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  338. { columnProp: "checkedLabelCount", headerAlign: "center", align: "center", columnLabel: "已盘点", columnWidth: 80, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  339. { columnProp: "progressPercent", headerAlign: "center", align: "center", columnLabel: "进度", columnWidth: 80, columnSortable: false, showOverflowTooltip: true, fixed: "" }
  340. ],
  341. // 循环盘点弹窗 - rqrq
  342. cycleCountDialogVisible: false,
  343. cycleCountForm: {
  344. countPercent: 10,
  345. remark: ''
  346. },
  347. createLoading: false,
  348. // 添加物料弹窗 - rqrq
  349. addMaterialDialogVisible: false,
  350. addMaterialRow: null,
  351. currentLabelList: [],
  352. currentLabelListLoading: false,
  353. // 当前标签列表列配置 - rqrq
  354. currentLabelColumnList: [
  355. { columnProp: "unitId", headerAlign: "center", align: "center", columnLabel: "标签号", columnWidth: 150, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  356. { columnProp: "partNo", headerAlign: "center", align: "center", columnLabel: "物料号", columnWidth: 120, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  357. { columnProp: "partDesc", headerAlign: "center", align: "left", columnLabel: "物料描述", columnWidth: 180, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  358. { columnProp: "qty", headerAlign: "center", align: "center", columnLabel: "数量", columnWidth: 80, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  359. { columnProp: "batchNo", headerAlign: "center", align: "center", columnLabel: "批号", columnWidth: 100, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  360. { columnProp: "palletId", headerAlign: "center", align: "center", columnLabel: "栈板号", columnWidth: 120, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  361. { columnProp: "labelTypeDesc", headerAlign: "center", align: "center", columnLabel: "标签类型", columnWidth: 100, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  362. { columnProp: "warehouseName", headerAlign: "center", align: "center", columnLabel: "仓库", columnWidth: 100, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  363. { columnProp: "locationName", headerAlign: "center", align: "center", columnLabel: "库位", columnWidth: 100, columnSortable: false, showOverflowTooltip: true, fixed: "" }
  364. ],
  365. // 物料查询弹窗 - rqrq
  366. materialQueryDialogVisible: false,
  367. materialQueryForm: {
  368. searchPartNo: '',
  369. searchBatchNo: '',
  370. searchWdr: ''
  371. },
  372. materialQueryList: [],
  373. materialQueryLoading: false,
  374. selectedMaterials: [],
  375. addMaterialLoading: false,
  376. // 物料查询列配置 - rqrq
  377. materialQueryColumnList: [
  378. { columnProp: "partNo", headerAlign: "center", align: "center", columnLabel: "物料号", columnWidth: 120, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  379. { columnProp: "partDesc", headerAlign: "center", align: "left", columnLabel: "物料描述", columnWidth: 180, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  380. { columnProp: "batchNo", headerAlign: "center", align: "center", columnLabel: "批号", columnWidth: 100, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  381. { columnProp: "wdr", headerAlign: "center", align: "center", columnLabel: "WDR号", columnWidth: 120, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  382. { columnProp: "warehouseName", headerAlign: "center", align: "center", columnLabel: "仓库", columnWidth: 100, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  383. { columnProp: "locationName", headerAlign: "center", align: "center", columnLabel: "库位", columnWidth: 100, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  384. { columnProp: "labelCount", headerAlign: "center", align: "center", columnLabel: "标签数", columnWidth: 80, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  385. { columnProp: "totalQty", headerAlign: "center", align: "center", columnLabel: "总数量", columnWidth: 100, columnSortable: false, showOverflowTooltip: true, fixed: "" },
  386. { columnProp: "palletCount", headerAlign: "center", align: "center", columnLabel: "栈板数", columnWidth: 80, columnSortable: false, showOverflowTooltip: true, fixed: "" }
  387. ]
  388. }
  389. },
  390. mounted() {
  391. // 计算表格高度 - rqrq
  392. this.height = (window.innerHeight - 315) / 2
  393. this.search()
  394. },
  395. methods: {
  396. // 查询 - rqrq
  397. search() {
  398. this.pageIndex = 1
  399. this.getDataList()
  400. },
  401. // 重置查询 - rqrq
  402. resetQuery() {
  403. this.queryForm = {
  404. searchCountNo: '',
  405. searchCountType: '',
  406. searchStatus: '',
  407. startDate: '',
  408. endDate: ''
  409. }
  410. this.search()
  411. },
  412. // 获取主表数据 - rqrq
  413. getDataList() {
  414. this.dataListLoading = true
  415. const params = {
  416. ...this.queryForm,
  417. site: this.$store.state.user.site,
  418. page: this.pageIndex,
  419. limit: this.pageSize
  420. }
  421. searchCountHeaderList(params).then(({ data }) => {
  422. if (data && data.code === 0) {
  423. this.dataList = data.page.list
  424. this.totalPage = data.page.totalCount
  425. } else {
  426. this.$message.error(data.msg || '查询失败')
  427. }
  428. }).catch(() => {
  429. this.$message.error('网络错误')
  430. }).finally(() => {
  431. this.dataListLoading = false
  432. })
  433. },
  434. // 行点击 - rqrq
  435. handleRowClick(row) {
  436. this.currentRow = row
  437. this.loadTabData()
  438. },
  439. // Tab点击 - rqrq
  440. tabClick() {
  441. this.loadTabData()
  442. },
  443. // 加载Tab数据 - rqrq
  444. loadTabData() {
  445. if (!this.currentRow) return
  446. const params = {
  447. site: this.$store.state.user.site,
  448. countNo: this.currentRow.countNo
  449. }
  450. if (this.activeName === 'label') {
  451. this.loadLabelList(params)
  452. } else if (this.activeName === 'pallet') {
  453. this.loadPalletList(params)
  454. } else if (this.activeName === 'result') {
  455. this.loadResultList(params)
  456. } else if (this.activeName === 'summary') {
  457. this.loadSummaryList(params)
  458. }
  459. },
  460. // 加载标签明细 - rqrq
  461. loadLabelList(params) {
  462. this.labelListLoading = true
  463. searchCountLabelList(params).then(({ data }) => {
  464. if (data && data.code === 0) {
  465. this.labelList = data.rows
  466. }
  467. }).finally(() => {
  468. this.labelListLoading = false
  469. })
  470. },
  471. // 加载栈板明细 - rqrq
  472. loadPalletList(params) {
  473. this.palletListLoading = true
  474. searchCountPalletList(params).then(({ data }) => {
  475. if (data && data.code === 0) {
  476. this.palletList = data.rows
  477. }
  478. }).finally(() => {
  479. this.palletListLoading = false
  480. })
  481. },
  482. // 加载盘点结果 - rqrq
  483. loadResultList(params) {
  484. this.resultListLoading = true
  485. searchCountResultList(params).then(({ data }) => {
  486. if (data && data.code === 0) {
  487. this.resultList = data.rows
  488. }
  489. }).finally(() => {
  490. this.resultListLoading = false
  491. })
  492. },
  493. // 加载物料汇总 - rqrq
  494. loadSummaryList(params) {
  495. this.summaryListLoading = true
  496. searchMaterialSummary(params).then(({ data }) => {
  497. if (data && data.code === 0) {
  498. this.summaryList = data.rows
  499. }
  500. }).finally(() => {
  501. this.summaryListLoading = false
  502. })
  503. },
  504. // 分页 - rqrq
  505. sizeChangeHandle(val) {
  506. this.pageSize = val
  507. this.pageIndex = 1
  508. this.getDataList()
  509. },
  510. currentChangeHandle(val) {
  511. this.pageIndex = val
  512. this.getDataList()
  513. },
  514. // 显示循环盘点弹窗 - rqrq
  515. showCycleCountDialog() {
  516. this.cycleCountForm = {
  517. countPercent: 10,
  518. remark: ''
  519. }
  520. this.cycleCountDialogVisible = true
  521. },
  522. // 创建循环盘点 - rqrq
  523. createCycleCount() {
  524. if (!this.cycleCountForm.countPercent || this.cycleCountForm.countPercent < 1 || this.cycleCountForm.countPercent > 50) {
  525. this.$message.warning('盘点比例必须在1-50之间')
  526. return
  527. }
  528. this.createLoading = true
  529. const params = {
  530. site: this.$store.state.user.site,
  531. countPercent: this.cycleCountForm.countPercent,
  532. remark: this.cycleCountForm.remark,
  533. username: this.$store.state.user.name
  534. }
  535. createCycleCount(params).then(({ data }) => {
  536. if (data && data.code === 0) {
  537. this.$message.success('创建成功,盘点单号:' + data.row.countNo)
  538. this.cycleCountDialogVisible = false
  539. this.search()
  540. } else {
  541. this.$alert(data.msg || '创建失败', '提示', { type: 'error' })
  542. }
  543. }).catch(() => {
  544. this.$message.error('网络错误')
  545. }).finally(() => {
  546. this.createLoading = false
  547. })
  548. },
  549. // 创建手工盘点单 - rqrq
  550. handleCreateManualCount() {
  551. this.$confirm('是否创建手工盘点单?', '提示', {
  552. confirmButtonText: '确定',
  553. cancelButtonText: '取消',
  554. type: 'info'
  555. }).then(() => {
  556. this.createLoading = true
  557. const params = {
  558. site: this.$store.state.user.site,
  559. username: this.$store.state.user.name
  560. }
  561. createManualCount(params).then(({ data }) => {
  562. if (data && data.code === 0) {
  563. this.$message.success('创建成功,盘点单号:' + data.row.countNo)
  564. this.search()
  565. // 自动打开添加物料弹窗 - rqrq
  566. this.$nextTick(() => {
  567. this.handleAddMaterial(data.row)
  568. })
  569. } else {
  570. this.$alert(data.msg || '创建失败', '提示', { type: 'error' })
  571. }
  572. }).catch(() => {
  573. this.$message.error('网络错误')
  574. }).finally(() => {
  575. this.createLoading = false
  576. })
  577. }).catch(() => {})
  578. },
  579. // 打开添加物料弹窗 - rqrq
  580. handleAddMaterial(row) {
  581. this.addMaterialRow = row
  582. this.addMaterialDialogVisible = true
  583. this.loadCurrentLabelList()
  584. },
  585. // 加载当前盘点单的标签列表 - rqrq
  586. loadCurrentLabelList() {
  587. if (!this.addMaterialRow) return
  588. this.currentLabelListLoading = true
  589. const params = {
  590. site: this.$store.state.user.site,
  591. countNo: this.addMaterialRow.countNo
  592. }
  593. searchCountLabelList(params).then(({ data }) => {
  594. if (data && data.code === 0) {
  595. this.currentLabelList = data.rows
  596. }
  597. }).finally(() => {
  598. this.currentLabelListLoading = false
  599. })
  600. },
  601. // 显示物料查询弹窗 - rqrq
  602. showMaterialQueryDialog() {
  603. this.materialQueryForm = {
  604. searchPartNo: '',
  605. searchBatchNo: '',
  606. searchWdr: ''
  607. }
  608. this.materialQueryList = []
  609. this.selectedMaterials = []
  610. this.materialQueryDialogVisible = true
  611. },
  612. // 查询物料 - rqrq
  613. queryMaterialForAdd() {
  614. if (!this.materialQueryForm.searchPartNo) {
  615. this.$message.warning('请输入物料编码')
  616. return
  617. }
  618. this.materialQueryLoading = true
  619. const params = {
  620. site: this.$store.state.user.site,
  621. ...this.materialQueryForm
  622. }
  623. queryMaterialForManualCount(params).then(({ data }) => {
  624. if (data && data.code === 0) {
  625. this.materialQueryList = data.rows
  626. if (data.rows.length === 0) {
  627. this.$message.warning('未找到符合条件的物料')
  628. }
  629. } else {
  630. this.$alert(data.msg || '查询失败', '提示', { type: 'error' })
  631. }
  632. }).catch(() => {
  633. this.$message.error('网络错误')
  634. }).finally(() => {
  635. this.materialQueryLoading = false
  636. })
  637. },
  638. // 物料选择变化 - rqrq
  639. handleMaterialSelectionChange(selection) {
  640. this.selectedMaterials = selection
  641. },
  642. // 确认添加物料 - rqrq
  643. confirmAddMaterial() {
  644. if (this.selectedMaterials.length === 0) {
  645. this.$message.warning('请选择要添加的物料')
  646. return
  647. }
  648. this.addMaterialLoading = true
  649. const params = {
  650. site: this.$store.state.user.site,
  651. countNo: this.addMaterialRow.countNo,
  652. selectedMaterials: this.selectedMaterials,
  653. username: this.$store.state.user.name
  654. }
  655. addMaterialToCount(params).then(({ data }) => {
  656. if (data && data.code === 0) {
  657. this.$message.success('添加成功,新增 ' + data.result + ' 个标签')
  658. this.materialQueryDialogVisible = false
  659. this.loadCurrentLabelList()
  660. this.getDataList()
  661. } else {
  662. this.$alert(data.msg || '添加失败', '提示', { type: 'error' })
  663. }
  664. }).catch(() => {
  665. this.$message.error('网络错误')
  666. }).finally(() => {
  667. this.addMaterialLoading = false
  668. })
  669. },
  670. // 下达盘点单 - rqrq
  671. handleRelease(row) {
  672. this.$confirm('确认下达盘点单 ' + row.countNo + '?', '提示', {
  673. confirmButtonText: '确定',
  674. cancelButtonText: '取消',
  675. type: 'warning'
  676. }).then(() => {
  677. const params = {
  678. site: this.$store.state.user.site,
  679. countNo: row.countNo,
  680. username: this.$store.state.user.name
  681. }
  682. releaseCount(params).then(({ data }) => {
  683. if (data && data.code === 0) {
  684. this.$message.success('下达成功')
  685. this.getDataList()
  686. } else {
  687. this.$alert(data.msg || '下达失败', '提示', { type: 'error' })
  688. }
  689. }).catch(() => {
  690. this.$message.error('网络错误')
  691. })
  692. }).catch(() => {})
  693. },
  694. // 完成盘点单 - rqrq
  695. handleComplete(row) {
  696. this.$confirm('确认完成盘点单 ' + row.countNo + '?', '提示', {
  697. confirmButtonText: '确定',
  698. cancelButtonText: '取消',
  699. type: 'warning'
  700. }).then(() => {
  701. const params = {
  702. site: this.$store.state.user.site,
  703. countNo: row.countNo,
  704. username: this.$store.state.user.name
  705. }
  706. completeCount(params).then(({ data }) => {
  707. if (data && data.code === 0) {
  708. this.$message.success('操作成功')
  709. this.getDataList()
  710. } else {
  711. this.$alert(data.msg || '操作失败', '提示', { type: 'error' })
  712. }
  713. }).catch(() => {
  714. this.$message.error('网络错误')
  715. })
  716. }).catch(() => {})
  717. },
  718. // 取消盘点单 - rqrq
  719. handleCancel(row) {
  720. this.$confirm('确认取消盘点单 ' + row.countNo + '?', '提示', {
  721. confirmButtonText: '确定',
  722. cancelButtonText: '取消',
  723. type: 'warning'
  724. }).then(() => {
  725. const params = {
  726. site: this.$store.state.user.site,
  727. countNo: row.countNo,
  728. username: this.$store.state.user.name
  729. }
  730. cancelCount(params).then(({ data }) => {
  731. if (data && data.code === 0) {
  732. this.$message.success('取消成功')
  733. this.getDataList()
  734. } else {
  735. this.$alert(data.msg || '取消失败', '提示', { type: 'error' })
  736. }
  737. }).catch(() => {
  738. this.$message.error('网络错误')
  739. })
  740. }).catch(() => {})
  741. },
  742. // 删除盘点单 - rqrq
  743. handleDelete(row) {
  744. this.$confirm('确认删除盘点单 ' + row.countNo + '?删除后不可恢复!', '警告', {
  745. confirmButtonText: '确定',
  746. cancelButtonText: '取消',
  747. type: 'warning'
  748. }).then(() => {
  749. const params = {
  750. site: this.$store.state.user.site,
  751. countNo: row.countNo
  752. }
  753. deleteCount(params).then(({ data }) => {
  754. if (data && data.code === 0) {
  755. this.$message.success('删除成功')
  756. this.getDataList()
  757. } else {
  758. this.$alert(data.msg || '删除失败', '提示', { type: 'error' })
  759. }
  760. }).catch(() => {
  761. this.$message.error('网络错误')
  762. })
  763. }).catch(() => {})
  764. },
  765. // 格式化日期时间 - rqrq
  766. formatDateTime(dateTime) {
  767. if (!dateTime) return ''
  768. const date = new Date(dateTime)
  769. const year = date.getFullYear()
  770. const month = String(date.getMonth() + 1).padStart(2, '0')
  771. const day = String(date.getDate()).padStart(2, '0')
  772. const hours = String(date.getHours()).padStart(2, '0')
  773. const minutes = String(date.getMinutes()).padStart(2, '0')
  774. return `${year}-${month}-${day} ${hours}:${minutes}`
  775. },
  776. // 获取状态颜色 - rqrq
  777. getStatusColor(status) {
  778. const colorMap = {
  779. 'DRAFT': '#909399',
  780. 'RELEASED': '#409EFF',
  781. 'CHECKING': '#E6A23C',
  782. 'COMPLETED': '#67C23A',
  783. 'CANCELLED': '#F56C6C'
  784. }
  785. return colorMap[status] || '#909399'
  786. },
  787. // 获取盘点结果颜色 - rqrq
  788. getResultColor(result) {
  789. const colorMap = {
  790. 'OK': '#67C23A',
  791. 'MISSING': '#F56C6C',
  792. 'SURPLUS': '#E6A23C'
  793. }
  794. return colorMap[result] || '#909399'
  795. }
  796. }
  797. }
  798. </script>
  799. <style scoped>
  800. /deep/ .el-table a {
  801. color: #409EFF;
  802. cursor: pointer;
  803. }
  804. /deep/ .el-table a:hover {
  805. text-decoration: underline;
  806. }
  807. </style>