From 678e404569a93b997a3a2606e4e7fd43bf4f0c0f Mon Sep 17 00:00:00 2001
From: xiaofajia <1665375861@qq.com>
Date: Sat, 26 Oct 2024 12:01:55 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E6=8F=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../stockOperate/Components/SoIndex.vue | 10 +-
.../stockOperate/Components/WaresItem.vue | 188 +++++++++---------
2 files changed, 98 insertions(+), 100 deletions(-)
diff --git a/src/views/repair/stockOperate/Components/SoIndex.vue b/src/views/repair/stockOperate/Components/SoIndex.vue
index 415bbf4..49bb6cd 100644
--- a/src/views/repair/stockOperate/Components/SoIndex.vue
+++ b/src/views/repair/stockOperate/Components/SoIndex.vue
@@ -108,9 +108,9 @@
查看
-
-
-
+ 入库
+
作废
@@ -283,6 +283,10 @@ export default {
async handleShow(row){
const res = await getRepairSoById(row.id)
await this.$refs.soShow.open(res.data)
+ },
+ // 入库操作
+ handleInWares(row){
+
}
}
}
diff --git a/src/views/repair/stockOperate/Components/WaresItem.vue b/src/views/repair/stockOperate/Components/WaresItem.vue
index 9871ece..46c48a6 100644
--- a/src/views/repair/stockOperate/Components/WaresItem.vue
+++ b/src/views/repair/stockOperate/Components/WaresItem.vue
@@ -21,15 +21,15 @@
-
-
-
+
+
+
-
+
-
+
@@ -55,7 +55,7 @@
@selection-change="handleSelect"
:key="tableKey"
>
-
+
@@ -76,10 +76,12 @@
@@ -182,12 +184,12 @@ import {getUserProfile} from "@/api/system/user";
export default {
name: "WaresItem",
components: {WarehouseChoose, SoTable},
- props:{
+ props: {
type: Boolean,
},
- data(){
- return{
- queryParams:{
+ data() {
+ return {
+ queryParams: {
pageNo: 1,
pageSize: 10,
query: null,
@@ -196,13 +198,13 @@ export default {
},
showSearch: true,
loading: false,
- list:[],
+ list: [],
total: 0,
dialogVisible: false,
- items:[],
+ items: [],
dialogLoading: false,
- selections:[],
- formData:{},
+ selections: [],
+ formData: {},
inStockDialog: false,
partList: [],
includeColumn: ['count', 'totalPrice'],
@@ -217,86 +219,75 @@ export default {
mounted() {
this.getList()
},
- methods:{
+ methods: {
// 通过 true是全部、false是选择
- async handlePass(){
+ async handlePass() {
// 生成领料单、退料单
- this.formData.repairSo = {
- soType: this.type ? "02" : "04",
- soNo: createUniqueCodeByHead(this.type ? "LL" : "TL"),
- userId: this.formData.repairId,
- userName: this.formData.repairName,
- soTime: parseTime(Date.now(), '{y}-{m}-{d}'),
- soStatus: this.type ? "04" : "07",
- // purchaseType: "01"
+ this.formData.repairSo = {
+ soType: this.type ? "02" : "04",
+ soNo: createUniqueCodeByHead(this.type ? "LL" : "TL"),
+ userId: this.formData.repairId,
+ userName: this.formData.repairName,
+ soTime: parseTime(Date.now(), '{y}-{m}-{d}'),
+ soStatus: this.type ? "04" : "07",
+ // purchaseType: "01"
+ }
+ this.formData.repairSois = [...this.selections.map(item => {
+ return {
+ soiType: this.type ? '02' : "04",
+ goodsId: item.waresId,
+ goodsCount: item.waresCount,
}
- this.formData.repairSois = [...this.selections.map(item => {
+ })]
+ if (this.type) {
+ this.formData.items = [...this.selections.map(item => {
return {
- soiType: this.type ? '02' : "04",
- goodsId: item.waresId,
- goodsCount: item.waresCount,
- }
- })]
- if (this.type){
- this.formData.items = [...this.selections.map(item => {
- return {
- id: item.id,
- }
- })]
- }
- try {
- await pass(this.formData)
- this.$modal.msgSuccess("处理成功")
- await this.getList()
- }finally {
- this.dialogVisible = false
- }
- },
- // 生成采购 true是全部、false是选择
- async handleCreate(flag){
- this.inStockDialog = true
- if (flag){
- this.partList = [...this.items.map(item => {
- return {
- ...item.wares,
- count: item.waresCount,
- newPrice: item.wares.purPrice,
- totalPrice: item.waresCount * item.wares.purPrice
- }
- })]
- }else {
- this.partList = [...this.selections.map(item => {
- return {
- ...item.wares,
- count: item.waresCount,
- newPrice: item.wares.price,
- totalPrice: item.waresCount * item.wares.price
+ id: item.id,
}
})]
}
+ try {
+ await pass(this.formData)
+ this.$modal.msgSuccess("处理成功")
+ await this.getList()
+ } finally {
+ this.dialogVisible = false
+ }
+ },
+ // 生成采购 true是全部、false是选择
+ async handleCreate() {
+ this.inStockDialog = true
+ this.partList = [...this.selections.map(item => {
+ return {
+ ...item.wares,
+ count: item.waresCount,
+ newPrice: item.wares.purPrice,
+ totalPrice: item.waresCount * item.wares.purPrice
+ }
+ })]
this.dialogVisible = false
},
- async getList(){
+ async getList() {
try {
this.loading = true
const res = await getPage(this.queryParams)
- if (res.data){
+ if (res.data) {
this.list = res.data.records
this.total = res.data.total
}
- }finally {
+ } finally {
this.loading = false
}
},
- handleQuery(){
+ handleQuery() {
this.queryParams.pageNo = 1
this.getList()
},
- resetQuery(){
+ resetQuery() {
this.resetForm('queryForm')
this.handleQuery()
},
- async handleDispose(row){
+ async handleDispose(row) {
this.formData = {}
this.formData = {
...row
@@ -308,25 +299,25 @@ export default {
const res = await listTwItem(data)
this.items = res.data
this.items.forEach(item => {
- const count = item.waresAlreadyCount ? parseInt(item.waresCount) - parseInt(item.waresAlreadyCount) : item.waresCount
- item.waresCount = this.type ? count : item.waresAlreadyCount
- item.isStock = this.type ? count <= item.wares.stock : true
- })
+ const count = item.waresAlreadyCount ? parseInt(item.waresCount) - parseInt(item.waresAlreadyCount) : item.waresCount
+ item.waresCount = this.type ? count : item.waresAlreadyCount
+ item.isStock = this.type ? count <= item.wares.stock : true
+ })
this.items = this.items.filter(item => this.type ? item.waresStatus === '02' : item.waresAlreadyCount)
- if (!this.type){
+ if (!this.type) {
this.items = this.items.filter(item => item.waresAlreadyCount !== item.waresBackCount)
}
- }finally {
+ } finally {
this.dialogLoading = false
}
},
- getRowClass(row){
- if (this.type && !row.row.isStock){
+ getRowClass(row) {
+ if (this.type && !row.row.isStock) {
return 'stock'
}
return ''
},
- handleSelect(row){
+ handleSelect(row) {
this.selections = row
},
// 设置不统计的字段
@@ -398,7 +389,7 @@ export default {
save(row) {
// 更新表格的数据
row.isStock = this.type ? row.waresCount <= row.wares.stock : row.waresCount <= row.waresAlreadyCount
- if (!this.type && !row.isStock){
+ if (!this.type && !row.isStock) {
this.$modal.msgWarning("退料数量不能超过领取数量")
row.waresCount = row.waresAlreadyCount
}
@@ -424,18 +415,18 @@ export default {
this.partList.splice(index, 1)
},
// 提交
- async handleSubmit(){
+ async handleSubmit() {
try {
await this.createInit()
await createRepairSo(this.formData)
this.inStockDialog = false
this.$modal.msgSuccess("新增成功")
await this.getList()
- }catch{
+ } catch {
}
},
// 提交前的构建
- async createInit(){
+ async createInit() {
const res = await getUserProfile()
this.formData = {}
this.formData = {
@@ -446,8 +437,10 @@ export default {
userName: res.data.nickname,
soTime: parseTime(Date.now(), '{y}-{m}-{d}'),
itemCount: this.partList.length,
- totalPrice: this.partList.reduce((x, y) => {return x + y.totalPrice}, 0),
- soStatus: "03",
+ totalPrice: this.partList.reduce((x, y) => {
+ return x + y.totalPrice
+ }, 0),
+ soStatus: "02",
remark: this.remark,
}
this.formData.goodsList = [...this.partList.map(item => {
@@ -467,9 +460,10 @@ export default {