This commit is contained in:
xiaofajia 2024-10-26 12:01:55 +08:00
parent 56812a3d60
commit 678e404569
2 changed files with 98 additions and 100 deletions

View File

@ -108,9 +108,9 @@
<el-button size="mini" type="text" icon="el-icon-view" @click="handleShow(scope.row)" <el-button size="mini" type="text" icon="el-icon-view" @click="handleShow(scope.row)"
>查看 >查看
</el-button> </el-button>
<!-- <el-button size="mini" type="text" icon="el-icon-edit-outline"--> <el-button @click="handleInWares(scope.row)" v-if="scope.row.soStatus === '02'" size="mini" type="text" icon="el-icon-edit-outline"
<!-- >修改--> >入库
<!-- </el-button>--> </el-button>
<el-button size="mini" type="text" icon="el-icon-close" @click="handleVoidSo(scope.row)" <el-button size="mini" type="text" icon="el-icon-close" @click="handleVoidSo(scope.row)"
>作废 >作废
</el-button> </el-button>
@ -283,6 +283,10 @@ export default {
async handleShow(row){ async handleShow(row){
const res = await getRepairSoById(row.id) const res = await getRepairSoById(row.id)
await this.$refs.soShow.open(res.data) await this.$refs.soShow.open(res.data)
},
//
handleInWares(row){
} }
} }
} }

View File

@ -21,15 +21,15 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="单据号" align="center" prop="no" width="200"/> <el-table-column label="单据号" align="center" prop="no" width="200"/>
<el-table-column label="客户车牌" align="center" prop="licenseNumber" /> <el-table-column label="客户车牌" align="center" prop="licenseNumber"/>
<el-table-column label="服务顾问" align="center" prop="adviserName" /> <el-table-column label="服务顾问" align="center" prop="adviserName"/>
<el-table-column label="申请人" align="center" prop="repairName" /> <el-table-column label="申请人" align="center" prop="repairName"/>
<el-table-column label="状态" align="center" prop="status"> <el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :type="DICT_TYPE.TICKET_WARES_STATUS" v-model="scope.row.status" /> <dict-tag :type="DICT_TYPE.TICKET_WARES_STATUS" v-model="scope.row.status"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="remark" /> <el-table-column label="备注" align="center" prop="remark"/>
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" size="mini" @click="handleDispose(scope.row)" icon="el-icon-edit"> <el-button type="text" size="mini" @click="handleDispose(scope.row)" icon="el-icon-edit">
@ -55,7 +55,7 @@
@selection-change="handleSelect" @selection-change="handleSelect"
:key="tableKey" :key="tableKey"
> >
<el-table-column type="selection" width="80" align="center" /> <el-table-column type="selection" width="80" align="center"/>
<el-table-column label="名称" align="center" prop="waresName" :show-overflow-tooltip="true"/> <el-table-column label="名称" align="center" prop="waresName" :show-overflow-tooltip="true"/>
<el-table-column label="规格" align="center" prop="wares.model" width="180"/> <el-table-column label="规格" align="center" prop="wares.model" width="180"/>
<el-table-column label="领料数量" v-if="type" align="center" prop="waresCount" width="180"> <el-table-column label="领料数量" v-if="type" align="center" prop="waresCount" width="180">
@ -76,10 +76,12 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" v-if="type" @click="handlePass" :disabled="selections.length === 0 || selections.filter(item => !item.isStock).length !== 0"> <el-button type="primary" v-if="type" @click="handlePass"
:disabled="selections.length === 0 || selections.filter(item => !item.isStock).length !== 0">
通知领料 通知领料
</el-button> </el-button>
<el-button type="primary" v-else @click="handlePass" :disabled="selections.length === 0 || selections.filter(item => !item.isStock).length !== 0"> <el-button type="primary" v-else @click="handlePass"
:disabled="selections.length === 0 || selections.filter(item => !item.isStock).length !== 0">
通知退料 通知退料
</el-button> </el-button>
<el-button v-if="type" type="primary" @click="handleCreate" :disabled="selections.length === 0"> <el-button v-if="type" type="primary" @click="handleCreate" :disabled="selections.length === 0">
@ -90,14 +92,14 @@
<el-dialog title="采购单" :visible.sync="inStockDialog" width="80%" v-dialogDrag append-to-body> <el-dialog title="采购单" :visible.sync="inStockDialog" width="80%" v-dialogDrag append-to-body>
<el-table <el-table
:data="partList" :data="partList"
:stripe="true" :stripe="true"
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
show-summary show-summary
:summary-method="getSummaries" :summary-method="getSummaries"
@cell-mouse-enter="handleCellEnter" @cell-mouse-enter="handleCellEnter"
@cell-mouse-leave="handleCellLeave" @cell-mouse-leave="handleCellLeave"
@cell-click="handleCellClick" @cell-click="handleCellClick"
> >
<el-table-column label="序号" align="center"> <el-table-column label="序号" align="center">
<template scope="scope"> <template scope="scope">
@ -163,7 +165,7 @@
</el-col> </el-col>
</el-row> </el-row>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="danger" @click="handleSubmit">结算</el-button> <el-button type="primary" @click="handleSubmit">确定</el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
@ -182,12 +184,12 @@ import {getUserProfile} from "@/api/system/user";
export default { export default {
name: "WaresItem", name: "WaresItem",
components: {WarehouseChoose, SoTable}, components: {WarehouseChoose, SoTable},
props:{ props: {
type: Boolean, type: Boolean,
}, },
data(){ data() {
return{ return {
queryParams:{ queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
query: null, query: null,
@ -196,13 +198,13 @@ export default {
}, },
showSearch: true, showSearch: true,
loading: false, loading: false,
list:[], list: [],
total: 0, total: 0,
dialogVisible: false, dialogVisible: false,
items:[], items: [],
dialogLoading: false, dialogLoading: false,
selections:[], selections: [],
formData:{}, formData: {},
inStockDialog: false, inStockDialog: false,
partList: [], partList: [],
includeColumn: ['count', 'totalPrice'], includeColumn: ['count', 'totalPrice'],
@ -217,86 +219,75 @@ export default {
mounted() { mounted() {
this.getList() this.getList()
}, },
methods:{ methods: {
// truefalse // truefalse
async handlePass(){ async handlePass() {
// 退 // 退
this.formData.repairSo = { this.formData.repairSo = {
soType: this.type ? "02" : "04", soType: this.type ? "02" : "04",
soNo: createUniqueCodeByHead(this.type ? "LL" : "TL"), soNo: createUniqueCodeByHead(this.type ? "LL" : "TL"),
userId: this.formData.repairId, userId: this.formData.repairId,
userName: this.formData.repairName, userName: this.formData.repairName,
soTime: parseTime(Date.now(), '{y}-{m}-{d}'), soTime: parseTime(Date.now(), '{y}-{m}-{d}'),
soStatus: this.type ? "04" : "07", soStatus: this.type ? "04" : "07",
// purchaseType: "01" // 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 { return {
soiType: this.type ? '02' : "04", id: item.id,
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
}
},
// truefalse
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
} }
})] })]
} }
try {
await pass(this.formData)
this.$modal.msgSuccess("处理成功")
await this.getList()
} finally {
this.dialogVisible = false
}
},
// truefalse
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 this.dialogVisible = false
}, },
async getList(){ async getList() {
try { try {
this.loading = true this.loading = true
const res = await getPage(this.queryParams) const res = await getPage(this.queryParams)
if (res.data){ if (res.data) {
this.list = res.data.records this.list = res.data.records
this.total = res.data.total this.total = res.data.total
} }
}finally { } finally {
this.loading = false this.loading = false
} }
}, },
handleQuery(){ handleQuery() {
this.queryParams.pageNo = 1 this.queryParams.pageNo = 1
this.getList() this.getList()
}, },
resetQuery(){ resetQuery() {
this.resetForm('queryForm') this.resetForm('queryForm')
this.handleQuery() this.handleQuery()
}, },
async handleDispose(row){ async handleDispose(row) {
this.formData = {} this.formData = {}
this.formData = { this.formData = {
...row ...row
@ -308,25 +299,25 @@ export default {
const res = await listTwItem(data) const res = await listTwItem(data)
this.items = res.data this.items = res.data
this.items.forEach(item => { this.items.forEach(item => {
const count = item.waresAlreadyCount ? parseInt(item.waresCount) - parseInt(item.waresAlreadyCount) : item.waresCount const count = item.waresAlreadyCount ? parseInt(item.waresCount) - parseInt(item.waresAlreadyCount) : item.waresCount
item.waresCount = this.type ? count : item.waresAlreadyCount item.waresCount = this.type ? count : item.waresAlreadyCount
item.isStock = this.type ? count <= item.wares.stock : true item.isStock = this.type ? count <= item.wares.stock : true
}) })
this.items = this.items.filter(item => this.type ? item.waresStatus === '02' : item.waresAlreadyCount) 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) this.items = this.items.filter(item => item.waresAlreadyCount !== item.waresBackCount)
} }
}finally { } finally {
this.dialogLoading = false this.dialogLoading = false
} }
}, },
getRowClass(row){ getRowClass(row) {
if (this.type && !row.row.isStock){ if (this.type && !row.row.isStock) {
return 'stock' return 'stock'
} }
return '' return ''
}, },
handleSelect(row){ handleSelect(row) {
this.selections = row this.selections = row
}, },
// //
@ -398,7 +389,7 @@ export default {
save(row) { save(row) {
// //
row.isStock = this.type ? row.waresCount <= row.wares.stock : row.waresCount <= row.waresAlreadyCount 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("退料数量不能超过领取数量") this.$modal.msgWarning("退料数量不能超过领取数量")
row.waresCount = row.waresAlreadyCount row.waresCount = row.waresAlreadyCount
} }
@ -424,18 +415,18 @@ export default {
this.partList.splice(index, 1) this.partList.splice(index, 1)
}, },
// //
async handleSubmit(){ async handleSubmit() {
try { try {
await this.createInit() await this.createInit()
await createRepairSo(this.formData) await createRepairSo(this.formData)
this.inStockDialog = false this.inStockDialog = false
this.$modal.msgSuccess("新增成功") this.$modal.msgSuccess("新增成功")
await this.getList() await this.getList()
}catch{ } catch {
} }
}, },
// //
async createInit(){ async createInit() {
const res = await getUserProfile() const res = await getUserProfile()
this.formData = {} this.formData = {}
this.formData = { this.formData = {
@ -446,8 +437,10 @@ export default {
userName: res.data.nickname, userName: res.data.nickname,
soTime: parseTime(Date.now(), '{y}-{m}-{d}'), soTime: parseTime(Date.now(), '{y}-{m}-{d}'),
itemCount: this.partList.length, itemCount: this.partList.length,
totalPrice: this.partList.reduce((x, y) => {return x + y.totalPrice}, 0), totalPrice: this.partList.reduce((x, y) => {
soStatus: "03", return x + y.totalPrice
}, 0),
soStatus: "02",
remark: this.remark, remark: this.remark,
} }
this.formData.goodsList = [...this.partList.map(item => { this.formData.goodsList = [...this.partList.map(item => {
@ -467,9 +460,10 @@ export default {
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
::v-deep .el-table .stock td{ ::v-deep .el-table .stock td {
color: #ff0000 !important; /* 红色背景 */ color: #ff0000 !important; /* 红色背景 */
} }
.item { .item {
.item__input { .item__input {
display: none; display: none;