This commit is contained in:
xiaofajia 2024-10-17 17:29:58 +08:00
parent d79160ac53
commit 7d87a13ea0
3 changed files with 176 additions and 7 deletions

View File

@ -56,7 +56,7 @@
<el-dropdown-item v-if="!isFinish && scope.row.ticketsWorkStatus === '02' && (userRole === 3 || userRole === 4)" command="handleGet" size="mini" type="text" icon="el-icon-document-add" <el-dropdown-item v-if="!isFinish && scope.row.ticketsWorkStatus === '02' && (userRole === 3 || userRole === 4)" command="handleGet" size="mini" type="text" icon="el-icon-document-add"
>申请领料 >申请领料
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item v-if="isFinish" @click="handleBack(scope.row)" size="mini" type="text" icon="el-icon-document-delete" <el-dropdown-item v-if="scope.row.ticketsWorkStatus === '02' && (userRole === 3 || userRole === 4)" command="handleBack" size="mini" type="text" icon="el-icon-document-delete"
>申请退料 >申请退料
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item v-if="userRole !== 4" command="handleReTake" size="mini" type="text" icon="el-icon-refresh" <el-dropdown-item v-if="userRole !== 4" command="handleReTake" size="mini" type="text" icon="el-icon-refresh"
@ -74,6 +74,40 @@
<TicketsShow ref="ticketsShow"/> <TicketsShow ref="ticketsShow"/>
<UpdateRepair ref="updateRepair" @success="listTickets"/> <UpdateRepair ref="updateRepair" @success="listTickets"/>
<TWOperate ref="twOperate" @success="listTickets"/> <TWOperate ref="twOperate" @success="listTickets"/>
<el-dialog title="退料申请" :visible.sync="backVisible" width="60%" v-dialogDrag append-to-body>
<el-table v-loading="backLoading" :data="partList" :stripe="true" :show-overflow-tooltip="true"
@cell-mouse-enter="handleCellEnter"
@cell-mouse-leave="handleCellLeave"
@cell-click="handleCellClick"
@selection-change="rowSelect"
>
<el-table-column type="selection" align="center" />
<el-table-column label="商品名称" prop="waresName" align="center"/>
<el-table-column label="规格" prop="wares.model" align="center"/>
<el-table-column label="数量" prop="waresCount" align="center">
<div v-if="scope.row.id" class="item" slot-scope="scope">
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.waresCount"/>
<span class="item__txt">{{ scope.row.waresCount }}</span>
</div>
</el-table-column>
<el-table-column label="备注" prop="remark" align="center">
<div v-if="scope.row.id" class="item" slot-scope="scope">
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.remark"/>
<span class="item__txt">{{ scope.row.remark }}</span>
</div>
</el-table-column>
</el-table>
<el-row :gutter="1" style="margin-top: 1rem">
<el-col :span="24">
<el-input v-model="remark" placeholder="备注" />
</el-col>
</el-row>
<div slot="footer" class="dialog-footer">
<el-button @click="doBack(false)" type="primary" :disabled="selections.length === 0">退料选择</el-button>
<el-button @click="doBack(true)" type="success">退料全部</el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
@ -82,6 +116,9 @@ import {getPageType, updateTake} from "@/api/repair/tickets/Tickets";
import TicketsShow from "@/views/repair/tickets/Components/TicketsShow.vue"; import TicketsShow from "@/views/repair/tickets/Components/TicketsShow.vue";
import UpdateRepair from "@/views/repair/tickets/form/UpdateRepair.vue"; import UpdateRepair from "@/views/repair/tickets/form/UpdateRepair.vue";
import TWOperate from "@/views/repair/tickets/form/TWOperate.vue"; import TWOperate from "@/views/repair/tickets/form/TWOperate.vue";
import {listTwItem} from "@/api/repair/tickets/TWItem";
import {createUniqueCodeByHead} from "@/utils/createUniqueCode";
import {updateTicketWares} from "@/api/repair/tickets/TicketWares";
export default { export default {
name: "TicketManagerItem", name: "TicketManagerItem",
@ -108,7 +145,17 @@ export default {
showSearch: true, showSearch: true,
loading: false, loading: false,
list: [], list: [],
total: 0 total: 0,
backVisible: false,
partList: [],
backLoading: false,
// cell
clickCellMap: {},
//
editProp: ['remark', 'waresCount'],
selections: [],
formData: {},
remark: null
} }
}, },
mounted() { mounted() {
@ -162,8 +209,20 @@ export default {
} }
}, },
// 退 // 退
handleBack(row){ async handleBack(row){
this.formData = {}
this.formData = row
this.remark = null
this.backVisible = true
try {
this.backLoading = true
const res = await listTwItem({twId: row.twId})
this.partList = res.data
//
this.partList = this.partList.filter(item => item.waresStatus === '01')
}finally {
this.backLoading = false
}
}, },
// //
handleReTake(row){ handleReTake(row){
@ -186,14 +245,123 @@ export default {
case 'handleGet': case 'handleGet':
this.handleGet(row) this.handleGet(row)
break break
case 'handleBack':
this.handleBack(row)
break
default: default:
break break
} }
},
/** 鼠标移入cell */
handleCellEnter(row, column, cell, event) {
const property = column.property
if (this.editProp.includes(property)) {
cell.querySelector('.item__txt').classList.add('item__txt--hover')
}
},
/** 鼠标移出cell */
handleCellLeave(row, column, cell, event) {
const property = column.property
if (this.editProp.includes(property)) {
cell.querySelector('.item__txt').classList.remove('item__txt--hover')
}
},
/** 点击cell */
handleCellClick(row, column, cell, event) {
const property = column.property
if (this.editProp.includes(property)) {
// cell
this.saveCellClick(row, cell)
cell.querySelector('.item__txt').style.display = 'none'
cell.querySelector('.item__input').style.display = 'inline'
cell.querySelector('input').focus()
}
},
/** 取消编辑状态 */
cancelEditable(cell) {
cell.querySelector('.item__txt').style.display = 'inline'
cell.querySelector('.item__input').style.display = 'none'
},
/** 保存进入编辑的cell */
saveCellClick(row, cell) {
const id = row.id
if (this.clickCellMap[id] !== undefined) {
if (!this.clickCellMap[id].includes(cell)) {
this.clickCellMap[id].push(cell)
}
} else {
this.clickCellMap[id] = [cell]
}
},
/** 保存数据 */
save(row) {
//
row.totalPrice = row.count * row.newPrice
const id = row.id
// cell
this.clickCellMap[id].forEach(cell => {
this.cancelEditable(cell)
})
this.clickCellMap[id] = []
},
rowSelect(val){
this.selections = val
},
async doBack(flag){
const data = {
no: createUniqueCodeByHead("TLSQ"),
ticketId: this.formData.id,
type: "02",
status: "01",
remark: this.remark,
adviserId: this.formData.adviserId,
adviserName: this.formData.adviserName
}
if (flag){
data.items = this.partList
}else {
data.items = this.selections
}
await updateTicketWares(data)
this.backVisible = false
this.$modal.msgSuccess("申请成功");
await this.listTickets()
} }
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.item {
.item__input {
display: none;
width: 100px;
/* 调整elementUI中样式 如果不需要调整请忽略 */
.el-input__inner {
height: 24px !important;
}
/* 调整elementUI中样式 如果不需要调整请忽略 */
.el-input__suffix {
i {
font-size: 12px !important;
line-height: 26px !important;
}
}
}
.item__txt {
box-sizing: border-box;
border: 1px solid transparent;
width: 100px;
line-height: 24px;
padding: 0 8px;
}
.item__txt--hover {
border: 1px solid #dddddd;
border-radius: 4px;
cursor: text;
}
}
</style> </style>

View File

@ -52,7 +52,7 @@
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
<TicketWaresShow ref="ticketWaresShow" :user-role="userRole" @success="getList"/> <TicketWaresShow ref="ticketWaresShow" :user-role="userRole" @success="getList" :type="type"/>
<el-dialog title="领料确认" :visible.sync="dialogVisible" width="80%" v-dialogDrag append-to-body> <el-dialog title="领料确认" :visible.sync="dialogVisible" width="80%" v-dialogDrag append-to-body>
<el-table el-table v-loading="dialogLoading" :data="items" :stripe="true" :show-overflow-tooltip="true" @selection-change="handleSelect"> <el-table el-table v-loading="dialogLoading" :data="items" :stripe="true" :show-overflow-tooltip="true" @selection-change="handleSelect">

View File

@ -151,7 +151,7 @@
<span>{{ scope.$index + 1 }}</span> <span>{{ scope.$index + 1 }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="客户可见" prop="isShow" v-if="userRole === 2" width="180"> <el-table-column align="center" label="客户可见" prop="isShow" v-if="userRole === 2 && type" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <el-switch
v-model="scope.row.isShow" v-model="scope.row.isShow"
@ -201,7 +201,8 @@ import {listTwItem, updateIsShow} from "@/api/repair/tickets/TWItem";
export default { export default {
name: "TicketWaresShow", name: "TicketWaresShow",
props:{ props:{
userRole: Number userRole: Number,
type: Boolean
}, },
data(){ data(){
return{ return{