OutsourceCheckFom.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  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="queryTaksParams"
  25. ref="queryRef"
  26. :inline="true"
  27. style="margin-right: 0px"
  28. >
  29. <!-- style="float: inline-end" -->
  30. <!-- && dataList.length > 0 -->
  31. <el-form-item label="批次号:">
  32. <el-input
  33. placeholder="请输入批次号"
  34. v-model.trim="queryTaksParams.lotCode"
  35. @keydown.enter.prevent
  36. clearable
  37. style="width: 130px"
  38. />
  39. </el-form-item>
  40. <el-form-item label="外协单号:">
  41. <el-input
  42. placeholder="请输入外协单号"
  43. v-model.trim="queryTaksParams.outsourceFormNo"
  44. @keydown.enter.prevent
  45. clearable
  46. style="width: 130px"
  47. />
  48. </el-form-item>
  49. <el-form-item style="margin-left: 0">
  50. <el-button type="info" icon="Search" @click="getList"
  51. >搜索
  52. </el-button>
  53. <el-button
  54. type="primary"
  55. style="background-color: #409eff"
  56. v-if="!loading && detailInfo.status != 2"
  57. @click="handleInventory"
  58. >一键盘点
  59. </el-button>
  60. </el-form-item>
  61. </el-form>
  62. <div class="el-table-container">
  63. <div class="el-table-inner-container">
  64. <el-table
  65. ref="tableRef"
  66. v-loading="loading"
  67. :data="dataList"
  68. size="small"
  69. border
  70. height="100%"
  71. @selection-change="handleSelectionChange"
  72. >
  73. <!-- <el-table-column type="selection" width="48" align="center" /> -->
  74. <el-table-column
  75. label="行号"
  76. type="index"
  77. align="center"
  78. width="48"
  79. />
  80. <el-table-column
  81. label="外协单号"
  82. align="center"
  83. prop="outsourceFormNo"
  84. width="110"
  85. />
  86. <el-table-column
  87. label="批次号"
  88. prop="lotCode"
  89. align="center"
  90. width="120px"
  91. >
  92. </el-table-column>
  93. <el-table-column
  94. label="产品描述"
  95. align="center"
  96. prop="productDescription"
  97. />
  98. <el-table-column
  99. label="生产状态"
  100. prop="isProductStatus"
  101. width="90"
  102. align="center"
  103. >
  104. <template #default="scope">
  105. <dict-tag
  106. :options="inventory_production_status"
  107. :value="scope.row.isProductStatus"
  108. />
  109. </template>
  110. </el-table-column>
  111. <el-table-column
  112. label="投入数"
  113. align="center"
  114. prop="prodNum"
  115. width="80"
  116. />
  117. <el-table-column
  118. label="盘点数量"
  119. align="center"
  120. prop="taksStockNum"
  121. width="100"
  122. >
  123. <!-- <template #default="scope">
  124. <el-input-number
  125. v-if="scope.row.editStatus"
  126. v-model="scope.row.taksStockNum"
  127. controls-position="right"
  128. style="width: 100px"
  129. :min="0"
  130. :precision="0"
  131. :max="99999"
  132. @input="
  133. (val) => {
  134. handleChangeTaksStockNum(val, scope.row, scope.$index);
  135. }
  136. "
  137. />
  138. <div v-else>{{ scope.row.taksStockNum }}</div>
  139. </template> -->
  140. </el-table-column>
  141. <el-table-column label="标识" width="300" align="center">
  142. <template #default="scope">
  143. <el-tag
  144. v-if="scope.row.isWaste == 1"
  145. class="spacing"
  146. type="danger"
  147. >{{ "批废" }}</el-tag
  148. >
  149. <el-tag
  150. v-if="scope.row.isAmend == 1"
  151. class="spacing"
  152. type="danger"
  153. >{{ "工艺修改" }}</el-tag
  154. >
  155. <el-tag
  156. v-if="scope.row.isWasteRecycling == 1"
  157. class="spacing"
  158. type="primary"
  159. >{{ "废品回用" }}</el-tag
  160. >
  161. <el-tag
  162. v-if="scope.row.fromLotId != 0"
  163. class="spacing"
  164. type="warning"
  165. >{{ "分批" }}</el-tag
  166. >
  167. <el-tag
  168. v-if="scope.row.isSuperaddition == 1"
  169. class="spacing"
  170. type="info"
  171. >{{ "追增" }}</el-tag
  172. >
  173. </template>
  174. </el-table-column>
  175. <el-table-column
  176. label="盘点状态"
  177. prop="isTaksStock"
  178. width="200"
  179. align="center"
  180. >
  181. <template #default="scope">
  182. <dict-tag
  183. :options="is_taks_stock"
  184. :value="scope.row.isTaksStock"
  185. />
  186. </template>
  187. </el-table-column>
  188. </el-table>
  189. </div>
  190. </div>
  191. <!-- 分页 -->
  192. <paginationMax
  193. v-show="total > 0"
  194. :total="total"
  195. v-model:page="queryTaksParams.pageNum"
  196. v-model:limit="queryTaksParams.pageSize"
  197. @pagination="getList"
  198. />
  199. </div>
  200. </el-drawer>
  201. </template>
  202. <script setup>
  203. import {
  204. getProductionPlanDetail,
  205. getNotTaksLot,
  206. getLotNumber,
  207. getOutsourceInfo,
  208. singleInventoryCheck,
  209. multiplyInventoryCheck,
  210. saveOutsourceInfo,
  211. } from "@/api/business/taksStockLot";
  212. import { ref } from "vue";
  213. import router from "@/router";
  214. import { ElMessageBox } from "element-plus";
  215. const emit = defineEmits(["handleSaveSuccess"]);
  216. const { proxy } = getCurrentInstance();
  217. /** 字典 */
  218. const { is_identification } = proxy.useDict("is_identification");
  219. const { is_taks_stock } = proxy.useDict("is_taks_stock");
  220. const { inventory_production_status } = proxy.useDict(
  221. "inventory_production_status"
  222. );
  223. /** 表单抽屉 页变量 */
  224. const loading = ref(false);
  225. const visible = ref(false);
  226. const detailInfo = ref({});
  227. const dataList = ref([]);
  228. const total = ref(0);
  229. const productionPlanDetaiList = ref([]);
  230. const tableRef = ref(null);
  231. const isInventoryMode = ref(true);
  232. const deptList = ref([]);
  233. const selections = ref([]);
  234. /** 查询对象 */
  235. const queryTaksParams = ref({
  236. pageNum: 1,
  237. pageSize: 50,
  238. productionPlanDetailId: null,
  239. deptId: null,
  240. });
  241. /**************************** 方法区 ****************************/
  242. /** 打开抽屉 */
  243. const open = (row) => {
  244. visible.value = true;
  245. detailInfo.value = proxy.deepClone(row);
  246. reset();
  247. getList();
  248. };
  249. function getProductionPlanDetailList() {
  250. getProductionPlanDetail(queryTaksParams.value).then((res) => {
  251. if (res.data.length > 0) {
  252. productionPlanDetaiList.value = res.data;
  253. queryTaksParams.value.productionPlanDetailId = res.data[0].value;
  254. getList();
  255. } else {
  256. productionPlanDetaiList.value = [];
  257. queryTaksParams.value.productionPlanDetailId = null;
  258. dataList.value = [];
  259. proxy.$modal.msgError("当前工段无未生产的批次");
  260. return;
  261. }
  262. });
  263. }
  264. function handleSelectionChange(selection) {
  265. if (isInventoryMode.value) {
  266. selections.value = selection;
  267. console.log(selections.value);
  268. }
  269. }
  270. //一键盘点
  271. function handleInventory() {
  272. loading.value = true;
  273. //弹出确认框,确认用户是否确认盘点
  274. ElMessageBox.confirm("是否确认一键盘点,将会盘点所有未收回的批次?")
  275. .then(() => {
  276. saveOutsourceInfo({ takeStockPeriodId: detailInfo.value.id }).then(
  277. (res) => {
  278. if (res.code == 200) {
  279. proxy.$modal.msgSuccess("操作成功");
  280. loading.value = false;
  281. reset();
  282. getList();
  283. } else {
  284. proxy.$modal.msgError("操作失败");
  285. }
  286. }
  287. );
  288. })
  289. .catch(() => {});
  290. }
  291. function getList() {
  292. loading.value = true;
  293. console.log("盘点明细", detailInfo.value);
  294. queryTaksParams.value.takeStockPeriodId = detailInfo.value.id;
  295. getOutsourceInfo(queryTaksParams.value).then((res) => {
  296. if (res.code == 200) {
  297. dataList.value = res.rows;
  298. total.value = res.total;
  299. loading.value = false;
  300. console.log("外协信息", dataList.value);
  301. }
  302. });
  303. }
  304. function handleProductionPlanChange() {
  305. proxy.$refs.tableRef.clearSelection();
  306. getList();
  307. }
  308. //编辑
  309. function handleEdit(row, index) {
  310. //判断是否能编辑
  311. //分批,废品回用,增批不算在允许盘点的个数内
  312. if (
  313. row.isWasteRecycling == 1 ||
  314. row.fromLotId != 0 ||
  315. row.isSuperaddition == 1
  316. ) {
  317. row.editStatus = true;
  318. row.taksStockNum = row.prodNum;
  319. row.isTaksStock = "1";
  320. } else {
  321. getLotNumber(queryTaksParams.value).then((res) => {
  322. if (res.data.allowLotNum > 0) {
  323. row.editStatus = true;
  324. console.log(row);
  325. row.taksStockNum = row.prodNum;
  326. row.isTaksStock = "1";
  327. console.log(row);
  328. } else {
  329. proxy.$modal.msgError(
  330. "当前常规未生产批次数量多于可盘点批次数量,不可编辑!"
  331. );
  332. return;
  333. }
  334. });
  335. }
  336. }
  337. //取消编辑
  338. function handleCancel(row, index) {
  339. dataList.value[index].editStatus = false;
  340. getList();
  341. }
  342. //保存
  343. function handleSave(row) {
  344. singleInventoryCheck(row).then((res) => {
  345. if (res.code == 200) {
  346. proxy.$modal.msgSuccess("盘点成功");
  347. if (res.data) {
  348. getList();
  349. } else {
  350. //重新查计划单
  351. getProductionPlanDetailList();
  352. }
  353. }
  354. });
  355. }
  356. function handleDeptChange() {
  357. proxy.$refs.tableRef.clearSelection();
  358. console.log(queryTaksParams.value);
  359. getProductionPlanDetailList();
  360. }
  361. /** 取消按钮 */
  362. const cancel = () => {
  363. visible.value = false;
  364. reset();
  365. emit("handleSaveSuccess");
  366. };
  367. /** 表单重置 */
  368. const reset = () => {
  369. const queryTaksParams = ref({
  370. pageNum: 1,
  371. pageSize: 50,
  372. });
  373. };
  374. /** 暴露给父组件的方法 */
  375. defineExpose({
  376. open,
  377. });
  378. </script>
  379. <style scoped>
  380. .el-message-box {
  381. max-width: none !important;
  382. width: 420px;
  383. }
  384. </style>