freezeList.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  1. <template>
  2. <div>
  3. <!-- <div class="search">
  4. <el-form ref="advancedForm" :model="advancedForm" label-width="160px">
  5. <el-row>
  6. <el-col :span="12">
  7. <el-form-item label="仓库">
  8. <el-select v-model="advancedForm.out_warehouse_id">
  9. <el-option v-for="item in warehouseList" :key="item.id" :label="item.name"
  10. :value="item.id" />
  11. </el-select>
  12. </el-form-item>
  13. </el-col>
  14. <el-col :span="12">
  15. <el-form-item label="商品编号/sku/序列号">
  16. <el-input v-model="advancedForm.input" placeholder="请输入内容" width="200px"></el-input>
  17. </el-form-item>
  18. </el-col>
  19. </el-row>
  20. </el-form>
  21. <el-button @click="advancedSearchEvent"> 搜索 </el-button>
  22. </div> -->
  23. <en-table-layout :tableData="tableData.data" ref="table" :loading="loading"
  24. @selection-change="handleSelectionChange">
  25. <div slot="toolbar" class="inner-toolbar">
  26. <!-- <div class="toolbar-btns">
  27. </div> -->
  28. </div>
  29. <template slot="table-columns">
  30. <el-table-column type="selection" width="55" />
  31. <el-table-column prop="order_id" label="单据ID">
  32. </el-table-column>
  33. <el-table-column label="单据类型" prop="order_type">
  34. </el-table-column>
  35. <el-table-column label="是否默认解冻" prop="status">
  36. </el-table-column>
  37. <el-table-column prop="locked_num" label="冻结个数" />
  38. <el-table-column prop="locked_time" label="冻结时间">
  39. </el-table-column>
  40. <el-table-column prop="un_locaked_num" label="解冻个数" />
  41. <el-table-column prop="un_locaked_time" label="解冻时间" />
  42. <!-- <el-table-column label="操作" width="250">
  43. <template slot-scope="scope">
  44. <el-button type="success1" size="mini" v-if="checkPermission(['goodsTransfer:submit'])"
  45. @click="handleSubmitGoodsTransfer(scope.row)">设置预警库存</el-button>
  46. <el-button type="success1" size="mini"
  47. v-if="scope.row.allowable.submit && checkPermission(['goodsTransfer:submit'])"
  48. @click="handleSubmitGoodsTransfer(scope.row)">提交</el-button>
  49. <el-button type="danger" size="mini"
  50. v-else-if="scope.row.allowable.withdraw && checkPermission(['goodsTransfer:withdraw'])"
  51. @click="handleWithdrawGoodsTransfer(scope.row)">撤回</el-button>
  52. <el-button size="mini" @click="handleEditGoodsTransfer(scope.row)"
  53. >查看</el-button
  54. >
  55. <el-button size="mini" @click="handleDelGoodsTransfer(scope.row)"
  56. >删除</el-button
  57. >
  58. <el-button size="mini" v-if="scope.row.allowable.confirm && checkPermission(['goodsTransfer:confirm'])"
  59. @click="handleSuccessGoodsTransfer(scope.row)" type="success">确认</el-button>
  60. <el-button size="mini" v-if="scope.row.allowable.confirm && checkPermission(['goodsTransfer:return'])"
  61. @click="handleRejectGoodsTransfer(scope.row)" type="danger">退回</el-button>
  62. </template>
  63. </el-table-column>-->
  64. </template>
  65. <el-pagination v-if="tableData" slot="pagination" @size-change="handlePageSizeChange"
  66. @current-change="handlePageCurrentChange" :current-page="tableData.page_no"
  67. :page-sizes="[10, 20, 50, 100]" :page-size="tableData.page_size"
  68. layout="total, sizes, prev, pager, next, jumper" :total="tableData.data_total">
  69. </el-pagination>
  70. </en-table-layout>
  71. <!-- <el-dialog title="在途明细" :visible.sync="dialogVisible" append-to-body :close-on-click-modal="false"
  72. :close-on-press-escape="false">
  73. <el-table :data="transitDetails" border class="sku-table">
  74. <el-table-column prop="order_sn" label="订单编号" />
  75. <el-table-column prop="num" label="在途数量" />
  76. <el-table-column prop="end_time" label="返回日期" />
  77. </el-table>
  78. </el-dialog>
  79. <el-dialog title="设置预警数量" :visible.sync="numDialogVisible" append-to-body :close-on-click-modal="false"
  80. :close-on-press-escape="false" width="30%">
  81. <el-form ref="numAddForm" :model="numAddForm" :rules="numAddFormRule" label-width="160px" inline
  82. class="change-form">
  83. <el-form-item label="预警数量" prop="num" class="change-form-item">
  84. <el-input v-model="numAddForm.num" placeholder="请输入"></el-input>
  85. </el-form-item>
  86. </el-form>
  87. <span slot="footer" class="dialog-footer">
  88. <el-button @click="numDialogVisible = false">取 消</el-button>
  89. <el-button @click="submitNum" type="primary">确 定</el-button>
  90. </span>
  91. </el-dialog> -->
  92. </div>
  93. </template>
  94. <script>
  95. import * as API_GoodsTransfer from "@/api/goodsTransfer";
  96. import * as API_Setting from "@/api/setting";
  97. import * as API_BasicSetting from "@/api/basicSetting";
  98. import { mapGetters } from "vuex";
  99. export default {
  100. name: "GoodsTransfer",
  101. data() {
  102. return {
  103. warehouseList: [],
  104. goodstransferType: [],
  105. // 列表loading状态
  106. loading: false,
  107. // 列表参数
  108. params: {
  109. page_no: 1,
  110. page_size: 10,
  111. },
  112. // 高级搜索数据
  113. advancedForm: {},
  114. // 列表数据
  115. tableData: "",
  116. // 当前已选择的行
  117. multipleSelection: [],
  118. GoodsTransferForm: {},
  119. dialogVisible: false,
  120. // 在途明细
  121. transitDetails: [],
  122. numDialogVisible: false,
  123. numAddForm: {},
  124. stockId: '',//选择的id
  125. numAddFormRule: {
  126. num: [{
  127. required: true,
  128. message: '请输入预警库存数量',
  129. trigger: 'blur'
  130. },
  131. {
  132. validator: (rule, value, callback) => {
  133. if (/^(?:[1-9]\d*)$/.test(value) == false) {
  134. callback(new Error("请输入正整数"));
  135. } else {
  136. callback();
  137. }
  138. },
  139. trigger: "blur",
  140. },
  141. ],
  142. },
  143. selectedRow: null, // 用于记录当前选中的行
  144. };
  145. },
  146. mounted() {
  147. this.GET_GoodsTransferList();
  148. this.GET_DictDataInfo();
  149. this.GET_WarehouseList();
  150. },
  151. watch: {
  152. $route: function ({ query }) {
  153. this.params.page_no = 1;
  154. this.GET_GoodsTransferList();
  155. },
  156. },
  157. computed: {
  158. ...mapGetters(["user"]),
  159. },
  160. methods: {
  161. /* 提交预警数量 */
  162. submitNum() {
  163. console.log(this.$refs["numAddForm"]);
  164. this.$refs["numAddForm"].validate((valid) => {
  165. if (valid) {
  166. API_GoodsTransfer.updateWarnStock(this.stockId, this.numAddForm.num).then(res => {
  167. this.numDialogVisible = false
  168. this.numAddForm = {}
  169. this.$message.success('预警库存设置成功!')
  170. this.GET_GoodsTransferList();
  171. })
  172. }
  173. })
  174. },
  175. // 删除
  176. handleDelGoodsTransfer(row) {
  177. this.$confirm("确定要删除这些库存吗?", "提示", { type: "warning" })
  178. .then(() => {
  179. const ids = []
  180. ids.push(row.id)
  181. API_GoodsTransfer.deleteGoodsTransfer({ ids: ids }).then((res) => {
  182. this.$message.success("删除成功!");
  183. this.ids = []
  184. this.GET_GoodsTransferList();
  185. });
  186. })
  187. .catch(() => { });
  188. },
  189. // 导出
  190. checkExport() { },
  191. // 查看在途
  192. lookTransit() {
  193. if (!this.selectedRow) return this.$message.error('请先选择!')
  194. API_GoodsTransfer.transitDetail(this.selectedRow.id).then(res => {
  195. console.log(res);
  196. this.dialogVisible = true;
  197. this.transitDetails = res
  198. })
  199. },
  200. handleSuccessGoodsTransfer(row) {
  201. API_GoodsTransfer.successGoodsTransfer(row.id, {
  202. in_handled_by_id: this.user.uid,
  203. in_handled_by_name: this.user.username,
  204. }).then(() => {
  205. this.$message.success("确认成功!");
  206. this.GET_GoodsTransferList();
  207. });
  208. },
  209. handleRejectGoodsTransfer(row) {
  210. API_GoodsTransfer.rejectGoodsTransfer(row.id, {
  211. in_handled_by_id: this.user.uid,
  212. in_handled_by_name: this.user.username,
  213. }).then(() => {
  214. this.$message.success("退回成功!");
  215. this.GET_GoodsTransferList();
  216. });
  217. },
  218. /** 获取仓库 */
  219. GET_WarehouseList() {
  220. API_BasicSetting.getWarehouseListAll().then((response) => {
  221. this.warehouseList = response;
  222. });
  223. },
  224. typeFilter(row) {
  225. return this.goodstransferType.find((type) => type.value === row).label;
  226. },
  227. GET_DictDataInfo() {
  228. API_Setting.getDictDataInfo("erp_goodstransfer_type").then((res) => {
  229. this.goodstransferType = res;
  230. });
  231. },
  232. handleSubmitGoodsTransfer(row) {
  233. this.stockId = row.id
  234. this.numDialogVisible = true
  235. /* API_GoodsTransfer.submitGoodsTransfer(row.id).then(() => {
  236. this.$message.success("提交成功!");
  237. this.GET_GoodsTransferList();
  238. }); */
  239. },
  240. handleWithdrawGoodsTransfer(row) {
  241. API_GoodsTransfer.withdrawGoodsTransfer(row.id).then(() => {
  242. this.$message.success("撤回成功!");
  243. this.GET_GoodsTransferList();
  244. });
  245. },
  246. /** 调拨单状态 */
  247. statusFilter(val) {
  248. switch (val) {
  249. case "NotSubmit":
  250. return "未提交";
  251. case "Submit":
  252. return "已提交";
  253. case "Confirm":
  254. return "已确认";
  255. case "AuditReject ":
  256. return "已退回";
  257. default:
  258. return "";
  259. }
  260. },
  261. handleDeleteGoodsTransfer() {
  262. if (!this.multipleSelection || !this.multipleSelection.length)
  263. return this.$message.error("请先选择!");
  264. this.$confirm("确定要删除这些库存吗?", "提示", { type: "warning" })
  265. .then(() => {
  266. const ids = this.multipleSelection.map((item) => item.id);
  267. API_GoodsTransfer.deleteGoodsTransfer({ ids: ids }).then(() => {
  268. this.$message.success("删除成功!");
  269. this.GET_GoodsTransferList();
  270. });
  271. })
  272. .catch(() => { });
  273. },
  274. /** 多选改变 */
  275. handleSelectionChange(selection, row) {
  276. if (selection.length > 0) {
  277. const lastSelected = selection[selection.length - 1];
  278. if (this.selectedRow && this.selectedRow !== lastSelected) {
  279. this.selectedRow = lastSelected;
  280. } else {
  281. this.selectedRow = lastSelected;
  282. }
  283. } else {
  284. this.selectedRow = null;
  285. }
  286. },
  287. selectableRow(row, index) {
  288. // 这个方法决定了哪些行是可选的
  289. return !this.selectedRow || this.selectedRow === row;
  290. },
  291. /** 分页大小发生改变 */
  292. handlePageSizeChange(size) {
  293. this.params.page_size = size;
  294. this.GET_GoodsTransferList();
  295. },
  296. /** 分页页数发生改变 */
  297. handlePageCurrentChange(page) {
  298. this.params.page_no = page;
  299. this.GET_GoodsTransferList();
  300. },
  301. /** 添加商品调拨 */
  302. handleAddGoodsTransfer() {
  303. this.$router.push({
  304. name: "goodsTransferAdd",
  305. params: { callback: this.GET_GoodsTransferList },
  306. });
  307. },
  308. /** 编辑商品调拨 */
  309. handleEditGoodsTransfer(row) {
  310. this.$router.push({
  311. name: "goodsTransferDetail",
  312. params: { id: row.id },
  313. });
  314. },
  315. /** 搜索事件触发 */
  316. searchEvent(data) {
  317. this.params = {
  318. ...this.params,
  319. sn: data,
  320. };
  321. Object.keys(this.advancedForm).forEach((key) => delete this.params[key]);
  322. this.params.page_no = 1;
  323. this.GET_GoodsTransferList();
  324. },
  325. /** 高级搜索事件触发 */
  326. advancedSearchEvent() {
  327. this.params = {
  328. ...this.params,
  329. ...this.advancedForm,
  330. };
  331. delete this.params.start_time;
  332. delete this.params.end_time;
  333. if (this.advancedForm.purchasePlan_time_range) {
  334. this.params.start_time = parseInt(
  335. Number(this.advancedForm.purchasePlan_time_range[0]) / 1000
  336. );
  337. this.params.end_time = parseInt(
  338. Number(this.advancedForm.purchasePlan_time_range[1]) / 1000
  339. );
  340. }
  341. delete this.params.purchasePlan_time_range;
  342. this.params.page_no = 1;
  343. this.GET_GoodsTransferList();
  344. },
  345. /** 获取商品调拨列表 */
  346. GET_GoodsTransferList() {
  347. this.loading = true;
  348. API_GoodsTransfer.productStock(this.params)
  349. .then((response) => {
  350. this.loading = false;
  351. //this.tableData = response;
  352. })
  353. .catch(() => {
  354. this.loading = false;
  355. });
  356. },
  357. },
  358. };
  359. </script>
  360. <style type="text/scss" lang="scss" scoped>
  361. .search {
  362. display: flex;
  363. align-items: center;
  364. background: #fff;
  365. overflow: hidden;
  366. padding: 30px 10px 10px 10px;
  367. /deep/ .el-form-item {
  368. .el-form-item__content {
  369. .el-input {
  370. width: 200px;
  371. }
  372. }
  373. }
  374. .el-button {
  375. margin-top: -19px;
  376. margin-left: 20px;
  377. }
  378. }
  379. .tips-t {
  380. display: flex;
  381. padding: 10px 0;
  382. div {
  383. flex: 1;
  384. text-align: center;
  385. }
  386. }
  387. .tips-f {
  388. padding: 20px 0;
  389. }
  390. .face-image {
  391. display: block;
  392. width: 50px;
  393. height: 50px;
  394. margin: 0 auto;
  395. }
  396. /deep/ .el-dialog__body {
  397. padding: 10px 20px;
  398. }
  399. </style>