form.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  1. <template>
  2. <el-drawer
  3. title="外协单信息"
  4. :with-header="false"
  5. v-model="visible"
  6. direction="rtl"
  7. size="100%"
  8. >
  9. <div class="form-container column-container">
  10. <div class="form-btns-container">
  11. <span class="title-label">
  12. <el-icon>
  13. <Document />
  14. </el-icon>
  15. <span>盘点批次</span>
  16. </span>
  17. <div class="close-btn" @click="cancel">
  18. <i class="fa fa-times" aria-hidden="true" />
  19. <!-- <span>关闭</span> -->
  20. </div>
  21. </div>
  22. <el-form
  23. class="list-search-container"
  24. :model="queryParams"
  25. ref="queryRef"
  26. :inline="true"
  27. style="margin-right: 0px"
  28. >
  29. <el-form-item class="section-title" label="盘点批次列表" />
  30. <el-form-item label="批次号:">
  31. <el-input
  32. placeholder="请输入批次号"
  33. v-model.trim="queryParams.lotCode"
  34. @keydown.enter.prevent
  35. clearable
  36. style="width: 130px"
  37. />
  38. </el-form-item>
  39. <el-form-item label="产品描述:">
  40. <el-input
  41. placeholder="请输入产品描述"
  42. v-model.trim="queryParams.productDescription"
  43. @keydown.enter.prevent
  44. clearable
  45. style="width: 130px"
  46. />
  47. </el-form-item>
  48. <el-form-item label="生产状态:">
  49. <el-select
  50. v-model="queryParams.isProductStatus"
  51. clearable
  52. placeholder="请选择生产状态"
  53. style="width: 145px"
  54. >
  55. <el-option
  56. v-for="dict in inventory_production_status"
  57. :key="dict.value"
  58. :label="dict.label"
  59. :value="dict.value"
  60. ></el-option>
  61. </el-select>
  62. </el-form-item>
  63. <el-form-item label="标识:">
  64. <el-select
  65. style="width: 160px"
  66. multiple
  67. v-model="queryParams.flags"
  68. collapse-tags
  69. collapse-tags-tooltip
  70. clearable
  71. placeholder="请选择标识"
  72. >
  73. <el-option
  74. v-for="item in is_identification"
  75. :key="item.value"
  76. :label="item.label"
  77. :value="item.value"
  78. ></el-option>
  79. </el-select>
  80. </el-form-item>
  81. <el-form-item class="section-title" label="请选择当前工段:">
  82. <el-select-v2
  83. v-model="queryParams.deptId"
  84. :options="deptList"
  85. placeholder="请选择工段"
  86. style="width: 120px"
  87. />
  88. </el-form-item>
  89. <el-form-item label="盘点状态:">
  90. <el-select
  91. v-model="queryParams.isTaksStock"
  92. clearable
  93. placeholder="请选择盘点状态"
  94. style="width: 145px"
  95. >
  96. <el-option
  97. v-for="dict in is_taks_stock"
  98. :key="dict.value"
  99. :label="dict.label"
  100. :value="dict.value"
  101. ></el-option>
  102. </el-select>
  103. </el-form-item>
  104. <el-form-item style="margin-left: 0">
  105. <el-button type="info" icon="Search" @click="handleQuery"
  106. >搜索
  107. </el-button>
  108. <el-button
  109. type="info"
  110. icon="Download"
  111. @click="handleExport"
  112. v-hasPermi="['business:inventoryCheck:inventoryDetailCheck']"
  113. >导出盘点明细
  114. </el-button>
  115. <el-button
  116. :disabled="queryParams.deptId == null || queryParams.deptId == '0'"
  117. type="primary"
  118. icon="Check"
  119. v-hasPermi="['business:inventoryCheck:notProductionCheck']"
  120. @click="handleTaksLot"
  121. >未生产批次盘点
  122. </el-button>
  123. <el-button
  124. v-if="detailInfo.status != 2"
  125. type="primary"
  126. icon="List"
  127. @click="outsourceCheckFrom"
  128. >外协发出盘点
  129. </el-button>
  130. <!-- <el-button
  131. v-if="detailInfo.status != 2"
  132. type="primary"
  133. icon="List"
  134. @click="showOutsourceCheckDialog"
  135. >外协发出单盘点
  136. </el-button> -->
  137. <el-button
  138. type="info"
  139. icon="Download"
  140. @click="handleExportStorage"
  141. v-hasPermi="['business:inventoryCheck:notRetrievalCheck']"
  142. >导出零存库未领取批次
  143. </el-button>
  144. <el-button
  145. type="primary"
  146. icon="List"
  147. v-hasPermi="['business:inventoryCheck:notInboundCheck']"
  148. @click="handleNotInboundCheckFrom"
  149. >未入库盘点
  150. </el-button>
  151. <el-button
  152. type="primary"
  153. icon="List"
  154. v-hasPermi="['business:inventoryCheck:anyInboundCheck']"
  155. @click="handleAnyInboundCheckFrom"
  156. >部分入库盘点
  157. </el-button>
  158. </el-form-item>
  159. </el-form>
  160. <div class="el-table-container">
  161. <div class="el-table-inner-container">
  162. <el-table
  163. v-loading="loading"
  164. :data="dataList"
  165. size="small"
  166. border
  167. height="100%"
  168. >
  169. <el-table-column
  170. label="行号"
  171. type="index"
  172. align="center"
  173. width="48"
  174. />
  175. <el-table-column
  176. label="批次号"
  177. prop="lotCode"
  178. align="center"
  179. width="120px"
  180. >
  181. <template #default="scope">
  182. <el-button
  183. link
  184. type="primary"
  185. @click="handleColumnClick(scope.row.lotCode)"
  186. ><span>{{ scope.row.lotCode }}</span></el-button
  187. >
  188. </template>
  189. </el-table-column>
  190. <el-table-column
  191. label="产品描述"
  192. align="center"
  193. prop="productDescription"
  194. />
  195. <el-table-column
  196. label="箱号"
  197. align="center"
  198. prop="carrierName"
  199. width="110"
  200. />
  201. <el-table-column
  202. label="生产状态"
  203. prop="isProductStatus"
  204. width="90"
  205. align="center"
  206. >
  207. <template #default="scope">
  208. <dict-tag
  209. :options="inventory_production_status"
  210. :value="scope.row.isProductStatus"
  211. />
  212. </template>
  213. </el-table-column>
  214. <el-table-column
  215. label="工段"
  216. align="center"
  217. prop="deptName"
  218. width="90"
  219. />
  220. <el-table-column
  221. label="工序"
  222. align="center"
  223. prop="processAlias"
  224. width="110"
  225. />
  226. <el-table-column
  227. label="投入数"
  228. align="center"
  229. prop="prodNum"
  230. width="80"
  231. />
  232. <el-table-column
  233. label="盘点数量"
  234. align="center"
  235. prop="taksStockNum"
  236. width="90"
  237. >
  238. <template #default="scope">
  239. <el-input-number
  240. v-if="scope.row.editStatus"
  241. v-model="scope.row.taksStockNum"
  242. controls-position="right"
  243. style="width: 100px"
  244. :min="0"
  245. :precision="0"
  246. :max="99999"
  247. @input="
  248. (val) => {
  249. handleChangeTaksStockNum(val, scope.row, scope.$index);
  250. }
  251. "
  252. />
  253. <div v-else>{{ scope.row.taksStockNum }}</div>
  254. </template>
  255. </el-table-column>
  256. <el-table-column
  257. label="外协单号"
  258. align="center"
  259. prop="outsourceFormNo"
  260. width="110"
  261. />
  262. <el-table-column
  263. label="报工状态"
  264. align="center"
  265. prop="statusLabel"
  266. width="110"
  267. >
  268. <template #default="scope">
  269. <span v-if="scope.row.statusLabel == 0">未开始</span>
  270. <span v-if="scope.row.statusLabel == 1">进行中</span>
  271. <span v-if="scope.row.statusLabel == 2">结束报工</span>
  272. <span v-if="scope.row.statusLabel == 3">工序已完成</span>
  273. <span v-if="scope.row.statusLabel == 4">待领取</span>
  274. <span v-if="scope.row.statusLabel == 6">已周转</span>
  275. <span v-if="scope.row.statusLabel == 7">已接收</span>
  276. </template>
  277. </el-table-column>
  278. <el-table-column label="标识" width="300" align="center">
  279. <template #default="scope">
  280. <el-tag
  281. v-if="scope.row.isWaste == 1"
  282. class="spacing"
  283. type="danger"
  284. >{{ "批废" }}</el-tag
  285. >
  286. <el-tag
  287. v-if="scope.row.isAmend == 1"
  288. class="spacing"
  289. type="danger"
  290. >{{ "工艺修改" }}</el-tag
  291. >
  292. <el-tag
  293. v-if="scope.row.isWasteRecycling == 1"
  294. class="spacing"
  295. type="primary"
  296. >{{ "废品回用" }}</el-tag
  297. >
  298. <el-tag
  299. v-if="scope.row.fromLotId != 0"
  300. class="spacing"
  301. type="warning"
  302. >{{ "分批" }}</el-tag
  303. >
  304. <el-tag
  305. v-if="scope.row.isSuperaddition == 1"
  306. class="spacing"
  307. type="info"
  308. >{{ "追增" }}</el-tag
  309. >
  310. </template>
  311. </el-table-column>
  312. <el-table-column
  313. label="盘点状态"
  314. prop="isTaksStock"
  315. width="200"
  316. align="center"
  317. >
  318. <template #default="scope">
  319. <el-select
  320. v-model="scope.row.isTaksStock"
  321. placeholder="请选择盘点状态"
  322. style="width: 160px"
  323. v-if="scope.row.editStatus"
  324. @change="
  325. (val) => {
  326. handleChangeTaksStock(val, scope.row, scope.$index);
  327. }
  328. "
  329. >
  330. <el-option
  331. v-for="dict in is_taks_stock"
  332. :key="dict.value"
  333. :label="dict.label"
  334. :value="dict.value"
  335. ></el-option>
  336. </el-select>
  337. <div v-else>
  338. <dict-tag
  339. :options="is_taks_stock"
  340. :value="scope.row.isTaksStock"
  341. />
  342. </div>
  343. </template>
  344. </el-table-column>
  345. <el-table-column
  346. label="操作"
  347. width="160"
  348. align="center"
  349. v-if="detailInfo.status != 2"
  350. >
  351. <template #default="scope">
  352. <el-button
  353. link
  354. icon="Check"
  355. v-if="scope.row.editStatus"
  356. type="success"
  357. @click="handleSave(scope.row)"
  358. >保存</el-button
  359. >
  360. <el-button
  361. link
  362. icon="Edit"
  363. v-else
  364. type="warning"
  365. @click="handleEdit(scope.row, scope.$index)"
  366. v-hasPermi="['business:inventoryCheck:editDetail']"
  367. >编辑</el-button
  368. >
  369. <el-button
  370. link
  371. icon="Close"
  372. v-if="scope.row.editStatus"
  373. type="danger"
  374. @click="handleCancel(scope.row, scope.$index)"
  375. >取消</el-button
  376. >
  377. </template>
  378. </el-table-column>
  379. </el-table>
  380. </div>
  381. </div>
  382. <!-- 分页 -->
  383. <paginationMax
  384. v-show="total > 0"
  385. :total="total"
  386. v-model:page="queryParams.pageNum"
  387. v-model:limit="queryParams.pageSize"
  388. @pagination="getList"
  389. />
  390. </div>
  391. <OutsourceCheckDialog ref="outsourceCheckDialogRef" />
  392. <taksForm ref="taksFormRef" @handleSaveSuccess="getList" />
  393. <OutsourceCheckFom ref="outsourceCheckFom" @handleSaveSuccess="getList" />
  394. <NotInboundCheckForm ref="notInboundCheckForm" />
  395. <AnyInboundCheckForm ref="anyInboundCheckForm" />
  396. </el-drawer>
  397. </template>
  398. <script setup>
  399. import {
  400. listTaksStockLot,
  401. updateTaksStockLot,
  402. updateNoStartLot,
  403. exportNoStartLot,
  404. getProductionPlanDetail,
  405. } from "@/api/business/taksStockLot";
  406. import { exportStorageLot } from "@/api/business/storageRetrieval";
  407. import { getDeptList } from "@/api/business/planDetailSubDetail.js";
  408. import taksForm from "./notTaksForm.vue";
  409. import { ref } from "vue";
  410. import router from "@/router";
  411. import OutsourceCheckDialog from "./OutsourceCheckDialog.vue";
  412. import OutsourceCheckFom from "./OutsourceCheckFom.vue";
  413. import NotInboundCheckForm from "./notInboundCheckForm.vue";
  414. import AnyInboundCheckForm from "./anyInboundCheckForm.vue";
  415. const { proxy } = getCurrentInstance();
  416. /** 字典 */
  417. const { is_identification } = proxy.useDict("is_identification");
  418. const { is_taks_stock } = proxy.useDict("is_taks_stock");
  419. const { inventory_production_status } = proxy.useDict(
  420. "inventory_production_status"
  421. );
  422. // 组件
  423. const outsourceCheckDialogRef = ref(null);
  424. /** 表单抽屉 页变量 */
  425. const loading = ref(false);
  426. const visible = ref(false);
  427. const detailInfo = ref({});
  428. const total = ref(0);
  429. const isDispatch = ref(false);
  430. const deptList = ref([]);
  431. const dataList = ref([]);
  432. /** 查询对象 */
  433. const queryParams = ref({
  434. pageNum: 1,
  435. pageSize: 50,
  436. productDescription: "",
  437. lotCode: "",
  438. deptId: null,
  439. flags: null,
  440. isTaksStock: null,
  441. });
  442. /**************************** 方法区 ****************************/
  443. /** 打开抽屉 */
  444. const open = (row) => {
  445. visible.value = true;
  446. console.log(is_identification.value);
  447. is_identification.value = is_identification.value.filter(
  448. (item) => item.value != 0
  449. );
  450. reset();
  451. detailInfo.value = proxy.deepClone(row);
  452. getDeptList().then((response) => {
  453. deptList.value = response.data.rows;
  454. isDispatch.value = response.data.others.isDispatch;
  455. if (isDispatch.value) {
  456. deptList.value.unshift({ label: "全部", value: "0" });
  457. }
  458. queryParams.value.deptId = deptList.value[0].value;
  459. queryParams.value.takeStockPeriodId = row.id;
  460. getList();
  461. });
  462. };
  463. function getList() {
  464. loading.value = true;
  465. listTaksStockLot(queryParams.value).then((res) => {
  466. res.rows.forEach((element) => {
  467. element.isTaksStock = element.isTaksStock + "";
  468. element.taksStockNum = Number(element.taksStockNum);
  469. });
  470. dataList.value = res.rows;
  471. total.value = res.total;
  472. loading.value = false;
  473. });
  474. }
  475. function handleEdit(row, index) {
  476. row.editStatus = true;
  477. console.log(row);
  478. if (row.isTaksStock != 1) {
  479. row.taksStockNum = row.prodNum;
  480. row.isTaksStock = "1";
  481. }
  482. console.log(row);
  483. }
  484. //一键盘点
  485. // function handleTaksLot() {
  486. // console.log(queryParams.value.deptId)
  487. // updateNoStartLot({ takeStockPeriodId: queryParams.value.takeStockPeriodId, deptId: queryParams.value.deptId }).then(res => {
  488. // if (res.code == 200) {
  489. // proxy.$modal.msgSuccess("盘点成功");
  490. // getList()
  491. // }
  492. // })
  493. // }
  494. //发出盘点按钮
  495. function outsourceCheckFrom() {
  496. proxy.$refs.outsourceCheckFom.open(detailInfo.value);
  497. }
  498. function handleNotInboundCheckFrom(){
  499. proxy.$refs.notInboundCheckForm.open(detailInfo.value);
  500. }
  501. function handleAnyInboundCheckFrom(){
  502. proxy.$refs.anyInboundCheckForm.open(detailInfo.value);
  503. }
  504. function handleTaksLot() {
  505. getProductionPlanDetail(queryParams.value).then((res) => {
  506. if (res.data.length > 0) {
  507. let detail = {};
  508. detail.deptId = queryParams.value.deptId;
  509. detail.deptList = deptList.value;
  510. detail.takeStockPeriodId = queryParams.value.takeStockPeriodId;
  511. detail.status = detailInfo.value.status;
  512. proxy.$refs.taksFormRef.open(detail);
  513. } else {
  514. proxy.$modal.msgError("当前工段无未生产的批次");
  515. }
  516. });
  517. }
  518. function handleSave(row) {
  519. updateTaksStockLot(row).then((res) => {
  520. if (res.code == 200) {
  521. proxy.$modal.msgSuccess("保存成功");
  522. getList();
  523. }
  524. });
  525. }
  526. /** 打开批次详情页 */
  527. // function handleColumnClick(lotCode) {
  528. // router.push({ path: "/reviseBath/lotFormParticulars/" + lotCode });
  529. // }
  530. function handleColumnClick(lotCode) {
  531. // 拼接 URL
  532. const url = "/reviseBath/lotFormParticulars/" + lotCode;
  533. // 在新标签页打开 URL
  534. window.open(url, "_blank");
  535. }
  536. function handleChangeTaksStock(value, row, index) {
  537. if (value == 0) {
  538. dataList.value[index].taksStockNum = 0;
  539. }
  540. }
  541. function handleChangeTaksStockNum(value, row, index) {
  542. if (value != 0) {
  543. dataList.value[index].isTaksStock = "1";
  544. }
  545. }
  546. function handleCancel(row, index) {
  547. dataList.value[index].editStatus = false;
  548. getList();
  549. }
  550. function handleQuery() {
  551. getList();
  552. }
  553. /** 取消按钮 */
  554. const cancel = () => {
  555. visible.value = false;
  556. reset();
  557. };
  558. /** 表单重置 */
  559. const reset = () => {
  560. queryParams.value = {
  561. pageNum: 1,
  562. pageSize: 50,
  563. productDescription: "",
  564. lotCode: "",
  565. deptId: null,
  566. flags: null,
  567. isTaksStock: null,
  568. };
  569. dataList.value = [];
  570. };
  571. function handleExport() {
  572. exportNoStartLot({ takeStockPeriodId: queryParams.value.takeStockPeriodId });
  573. }
  574. function handleExportStorage() {
  575. exportStorageLot({ takeStockPeriodId: queryParams.value.takeStockPeriodId });
  576. }
  577. function showOutsourceCheckDialog() {
  578. outsourceCheckDialogRef.value.open(detailInfo.value);
  579. }
  580. /** 暴露给父组件的方法 */
  581. defineExpose({
  582. open,
  583. });
  584. </script>