This commit is contained in:
Vinjor 2024-10-21 18:09:51 +08:00
commit 611bc1521e
9 changed files with 148 additions and 101 deletions

View File

@ -43,20 +43,36 @@
/> />
<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" :row-class-name="getClass" @selection-change="handleSelect"> <el-table
@cell-mouse-enter="handleCellEnter"
@cell-mouse-leave="handleCellLeave"
@cell-click="handleCellClick"
el-table v-loading="dialogLoading"
:data="items" :stripe="true"
:show-overflow-tooltip="true"
:row-class-name="getRowClass"
@selection-change="handleSelect"
: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="申请数量" align="center" prop="waresCount" width="180"/> <el-table-column label="领料数量" align="center" prop="waresCount" width="180">
<div class="item" slot-scope="scope">
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.waresCount"
placeholder="请输入数量"></el-input>
<span class="item__txt">{{ scope.row.waresCount }}</span>
</div>
</el-table-column>
<el-table-column label="库存数量" align="center" prop="wares.stock" width="180"/> <el-table-column label="库存数量" align="center" prop="wares.stock" width="180"/>
</el-table> </el-table>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handlePass(false)" :disabled="selections.length === 0 || selections.filter(item => !item.isStock).length !== 0">通过选择</el-button> <el-button type="primary" @click="handlePass" :disabled="selections.length === 0 || selections.filter(item => !item.isStock).length !== 0">
<el-button type="success" @click="handlePass(true)" 通知领取
:disabled="this.items.filter(item => !item.isStock).length !== 0" </el-button>
:title="this.items.filter(item => !item.isStock).length !== 0 ? '有配件库存不足':''">通过全部</el-button> <el-button type="primary" @click="handleCreate" :disabled="selections.length === 0">
<el-button v-if="type" type="primary" @click="handleCreate(false)" :disabled="selections.length === 0">选择生成采购单</el-button> 采购
<el-button v-if="type" type="primary" @click="handleCreate(true)">全部生成采购单</el-button> </el-button>
</div> </div>
</el-dialog> </el-dialog>
@ -180,8 +196,9 @@ export default {
// cell // cell
clickCellMap: {}, clickCellMap: {},
// //
editProp: ['warehouse', 'count', 'newPrice', 'remark', 'code'], editProp: ['warehouse', 'count', 'newPrice', 'remark', 'code', 'waresCount'],
remark: null, remark: null,
tableKey: 0,
} }
}, },
mounted() { mounted() {
@ -189,7 +206,7 @@ export default {
}, },
methods:{ methods:{
// truefalse // truefalse
async handlePass(flag){ async handlePass(){
// //
if (this.type){ if (this.type){
this.formData.repairSo = { this.formData.repairSo = {
@ -201,35 +218,18 @@ export default {
soStatus: "04", soStatus: "04",
purchaseType: "01" purchaseType: "01"
} }
if (flag){ this.formData.repairSois = [...this.selections.map(item => {
this.formData.repairSois = [...this.items.map(item => { return {
return { soiType: '02',
soiType: '02', goodsId: item.waresId,
goodsId: item.waresId, goodsCount: item.waresCount,
goodsCount: item.waresCount, }
} })]
})] this.formData.items = [...this.selections.map(item => {
this.formData.items = [...this.items.map(item => { return {
return { id: item.id,
id: item.id, }
waresStatus: "04" })]
}
})]
}else {
this.formData.repairSois = [...this.selections.map(item => {
return {
soiType: '02',
goodsId: item.waresId,
goodsCount: item.waresCount,
}
})]
this.formData.items = [...this.selections.map(item => {
return {
id: item.id,
waresStatus: "04"
}
})]
}
try { try {
await pass(this.formData) await pass(this.formData)
this.$modal.msgSuccess("处理成功") this.$modal.msgSuccess("处理成功")
@ -240,21 +240,12 @@ export default {
}else { }else {
// 退 // 退
this.formData = {} this.formData = {}
if (flag){ this.formData.items = [...this.selections.map(item => {
this.formData.items = [...this.items.map(item => { return {
return { id: item.id,
id: item.id, waresStatus: "05"
waresStatus: "05" }
} })]
})]
}else {
this.formData.items = [...this.selections.map(item => {
return {
id: item.id,
waresStatus: "05"
}
})]
}
try { try {
await passBackTicketWares(this.formData) await passBackTicketWares(this.formData)
this.$modal.msgSuccess("处理成功") this.$modal.msgSuccess("处理成功")
@ -321,7 +312,9 @@ export default {
this.items = res.data this.items = res.data
// //
this.items.forEach(item => { this.items.forEach(item => {
item.isStock = item.waresCount <= item.wares.stock const count = item.waresAlreadyCount ? parseInt(item.waresCount) - parseInt(item.waresAlreadyCount) : item.waresCount
item.waresCount = count
item.isStock = count <= item.wares.stock
}) })
// //
if (this.type){ if (this.type){
@ -334,7 +327,7 @@ export default {
this.dialogLoading = false this.dialogLoading = false
} }
}, },
getClass(row){ getRowClass(row){
if (this.type && !row.row.isStock){ if (this.type && !row.row.isStock){
return 'stock' return 'stock'
} }
@ -411,6 +404,7 @@ export default {
/** 保存数据 */ /** 保存数据 */
save(row) { save(row) {
// //
row.isStock = row.waresCount <= row.wares.stock
row.totalPrice = row.count * row.newPrice row.totalPrice = row.count * row.newPrice
const id = row.id const id = row.id
// cell // cell
@ -418,6 +412,7 @@ export default {
this.cancelEditable(cell) this.cancelEditable(cell)
}) })
this.clickCellMap[id] = [] this.clickCellMap[id] = []
this.tableKey++
}, },
changeWare(row) { changeWare(row) {
if (row.ware) { if (row.ware) {

View File

@ -1,10 +1,10 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-tabs v-model="activeTab"> <el-tabs v-model="activeTab">
<el-tab-pane label="领料申请" name="get"> <el-tab-pane label="领配件管理" name="get">
<WaresItem :type="true"/> <WaresItem :type="true"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="退料申请" name="back"> <el-tab-pane label="退配件管理" name="back">
<WaresItem :type="false"/> <WaresItem :type="false"/>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>

View File

@ -0,0 +1,43 @@
<template>
<div>
<el-input v-model="localValue" @blur="handleBlur" />
</div>
</template>
<script>
export default {
name: "DiscountInput",
props: {
value: [Number, String]
},
data() {
return {
localValue: this.value
};
},
watch: {
// localValue
value(newVal) {
this.localValue = newVal;
},
// localValue
localValue(val) {
if (val < 0 || val > 1) {
this.$modal.msgWarning("折扣只能是0-1");
this.localValue = Math.max(0, Math.min(1, val)); // 01
} else {
this.$emit("input", this.localValue ? this.localValue : 1); //
}
}
},
methods: {
handleBlur(event) {
this.$emit("input-blur", event); // input-blur
}
}
};
</script>
<style scoped lang="scss">
/* 样式保持不变 */
</style>

View File

@ -50,8 +50,9 @@
</el-table-column> </el-table-column>
<el-table-column v-if="!exportColumn.includes('discount')" align="center" label="折扣" width="180" prop="discount"> <el-table-column v-if="!exportColumn.includes('discount')" align="center" label="折扣" width="180" prop="discount">
<div v-if="scope.row.id" class="item" slot-scope="scope"> <div v-if="scope.row.id" class="item" slot-scope="scope">
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.discount"/> <!-- <el-input :min="0" :max="1" @blur="save(scope.row)" class="item__input" v-model="scope.row.discount"/>-->
<span class="item__txt">{{ scope.row.discount }}</span> <DiscountInput @input-blur="save(scope.row)" class="item__input" v-model="scope.row.discount" />
<span class="item__txt">{{ scope.row.discount === 1 ? "无折扣" : scope.row.discount }}</span>
</div> </div>
</el-table-column> </el-table-column>
<el-table-column v-if="!exportColumn.includes('totalPrice')" align="center" label="金额" width="180" prop="totalPrice"> <el-table-column v-if="!exportColumn.includes('totalPrice')" align="center" label="金额" width="180" prop="totalPrice">
@ -133,10 +134,12 @@ import {getOtherByName} from "@/api/repair/other";
import {getProjectByName} from "@/api/repair/project"; import {getProjectByName} from "@/api/repair/project";
import {getWaresByName} from "@/api/repair/wares"; import {getWaresByName} from "@/api/repair/wares";
import WorkerChoose from "@/views/repair/Components/WorkerChoose.vue"; import WorkerChoose from "@/views/repair/Components/WorkerChoose.vue";
import DiscountInput from "@/views/repair/tickets/Components/DiscountInput.vue";
export default { export default {
name: "TicketItem", name: "TicketItem",
components: { components: {
DiscountInput,
WorkerChoose, WorkerChoose,
OtherForm, OtherForm,
OtherChoose, ProjectChoose, RepairProjectForm, WaresForm, ServerChoose, StaffChoose, PartChoose OtherChoose, ProjectChoose, RepairProjectForm, WaresForm, ServerChoose, StaffChoose, PartChoose
@ -289,7 +292,7 @@ export default {
// console.log(row) // console.log(row)
if (row.id) { if (row.id) {
row.itemStatus = "01" row.itemStatus = "01"
row.totalPrice = row.count * row.price * (row.discount / 10) row.totalPrice = row.count * row.price * row.discount
} }
const id = row.id const id = row.id
// cell // cell
@ -310,7 +313,7 @@ export default {
data = { data = {
...data, ...data,
count: 1, count: 1,
discount: 10, discount: 1,
remark: null, remark: null,
itemStatus: '01', itemStatus: '01',
totalPrice: data.price, totalPrice: data.price,

View File

@ -29,7 +29,11 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="单价" width="180" prop="itemPrice"/> <el-table-column align="center" label="单价" width="180" prop="itemPrice"/>
<el-table-column align="center" label="折扣" width="180" prop="itemDiscount"/> <el-table-column align="center" label="折扣" width="180" prop="itemDiscount">
<template slot-scope="scope">
{{scope.row.itemDiscount === 1 ? "无折扣" : scope.row.itemDiscount}}
</template>
</el-table-column>
<el-table-column align="center" label="金额" width="180" prop="itemMoney"/> <el-table-column align="center" label="金额" width="180" prop="itemMoney"/>
<el-table-column align="center" label="施工人员" width="180" prop="repairNames"/> <el-table-column align="center" label="施工人员" width="180" prop="repairNames"/>
<el-table-column align="center" label="销售人员" width="180" prop="saleName"/> <el-table-column align="center" label="销售人员" width="180" prop="saleName"/>

View File

@ -50,32 +50,35 @@
<el-button v-if="userRole === 'service_advisor' && scope.row.ticketsWorkStatus === '01'" size="mini" type="text" icon="el-icon-check" @click="handleNotify(scope.row)"> <el-button v-if="userRole === 'service_advisor' && scope.row.ticketsWorkStatus === '01'" size="mini" type="text" icon="el-icon-check" @click="handleNotify(scope.row)">
通知施工 通知施工
</el-button> </el-button>
<el-button size="mini" v-if="userRole === 'repair_staff' && !isFinish" type="text" icon="el-icon-monitor" @click="handleRecord(scope.row, 'sgz')"> <el-button size="mini" v-if="scope.row.ticketsWorkStatus !== '01' &&userRole === 'repair_staff' && !isFinish" type="text" icon="el-icon-monitor" @click="handleRecord(scope.row, 'kssg')">
过程记录
</el-button>
<el-button size="mini" v-if="userRole === 'repair_staff' && !isFinish" type="text" icon="el-icon-monitor" @click="handleRecord(scope.row, 'kssg')">
开始施工 开始施工
</el-button> </el-button>
<el-button size="mini" v-if="userRole === 'repair_staff' && !isFinish" type="text" icon="el-icon-monitor" @click="handleRecord(scope.row, 'sgwczj')"> <el-button size="mini" v-if=" scope.row.ticketsWorkStatus !== '01' && userRole === 'repair_staff' && !isFinish" type="text" icon="el-icon-monitor" @click="handleRecord(scope.row, 'sgz')">
过程记录
</el-button>
<el-button size="mini" v-if="scope.row.ticketsWorkStatus !== '01' && userRole === 'repair_staff' && !isFinish" type="text" icon="el-icon-monitor" @click="handleRecord(scope.row, 'sgwczj')">
施工完成 施工完成
</el-button> </el-button>
<el-button @click="handleRecord(scope.row, 'zj')" size="mini" type="text" icon="el-icon-monitor" v-if="userRole === 'general_inspection' && scope.row.ticketsWorkStatus === '05'"> <el-button @click="handleRecord(scope.row, 'zj')" size="mini" type="text" icon="el-icon-monitor" v-if="userRole === 'general_inspection' && scope.row.ticketsWorkStatus === '05'">
终检 终检
</el-button> </el-button>
<el-button @click="handleReTake(scope.row)" size="mini" type="text" icon="el-icon-refresh" v-if="(userRole === 'repair_staff' ? leader : false) && !(scope.row.ticketsWorkStatus !== '01' && userRole === 'repair_staff' && !isFinish)">
重新指派
</el-button>
<el-dropdown <el-dropdown
v-if="userRole !== 'general_inspection'" v-if="scope.row.ticketsWorkStatus !== '01'"
@command="(command) => handleCommand(command, scope.$index, scope.row)"> @command="(command) => handleCommand(command, scope.$index, scope.row)">
<el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button> <el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item v-if="!isFinish && scope.row.ticketsWorkStatus !== '01' && userRole === 'repair_staff'" command="handleGet" size="mini" type="text" icon="el-icon-document-add" <el-dropdown-item v-if="!isFinish && scope.row.ticketsWorkStatus !== '01' && userRole === 'repair_staff'" command="handleGet" size="mini" type="text" icon="el-icon-document-add"
>申请领料 >申请配件
</el-dropdown-item>
<el-dropdown-item v-if="scope.row.ticketsWorkStatus !== '01' && userRole === 'repair_staff'" command="handleBack" size="mini" type="text" icon="el-icon-document-delete"
>申请退料
</el-dropdown-item> </el-dropdown-item>
<!-- <el-dropdown-item v-if="scope.row.ticketsWorkStatus !== '01' && userRole === 'repair_staff'" command="handleBack" size="mini" type="text" icon="el-icon-document-delete"-->
<!-- >申请退料-->
<!-- </el-dropdown-item>-->
<!-- 还要判断是不是员工 --> <!-- 还要判断是不是员工 -->
<el-dropdown-item <el-dropdown-item
v-if="(userRole === 'repair_staff' ? leader : true) && !isFinish" v-if="userRole !== 'repair_staff' && !isFinish && scope.row.ticketsWorkStatus !== '01'"
command="handleReTake" size="mini" type="text" icon="el-icon-refresh" command="handleReTake" size="mini" type="text" icon="el-icon-refresh"
>重新指派 >重新指派
</el-dropdown-item> </el-dropdown-item>
@ -101,12 +104,12 @@
@selection-change="rowSelect" @selection-change="rowSelect"
> >
<el-table-column type="selection" align="center" /> <el-table-column type="selection" align="center" />
<el-table-column label="商品名称" prop="waresName" align="center"/> <el-table-column label="商品名称" prop="itemName" align="center"/>
<el-table-column label="规格" prop="wares.model" align="center"/> <el-table-column label="规格" prop="ware.model" align="center"/>
<el-table-column label="数量" prop="waresCount" align="center"> <el-table-column label="数量" prop="itemCount" align="center">
<div v-if="scope.row.id" class="item" slot-scope="scope"> <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"/> <el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.itemCount"/>
<span class="item__txt">{{ scope.row.waresCount }}</span> <span class="item__txt">{{ scope.row.itemCount }}</span>
</div> </div>
</el-table-column> </el-table-column>
<el-table-column label="备注" prop="remark" align="center"> <el-table-column label="备注" prop="remark" align="center">
@ -130,7 +133,7 @@
</template> </template>
<script> <script>
import {getPageType, updateTake} from "@/api/repair/tickets/Tickets"; import {getPageType, updateTake, getTicketsById} 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";
@ -160,7 +163,7 @@ export default {
pageSize: 10, pageSize: 10,
ticketNo: null, ticketNo: null,
searchTimeArray: [], searchTimeArray: [],
isFinish: this.isFinish ? "1" : "0" isFinish: this.isFinish ? "1" : "0",
}, },
showSearch: true, showSearch: true,
loading: false, loading: false,
@ -172,7 +175,7 @@ export default {
// cell // cell
clickCellMap: {}, clickCellMap: {},
// //
editProp: ['remark', 'waresCount'], editProp: ['remark', 'itemCount'],
selections: [], selections: [],
formData: {}, formData: {},
remark: null, remark: null,
@ -242,13 +245,8 @@ export default {
this.backVisible = true this.backVisible = true
try { try {
this.backLoading = true this.backLoading = true
const data = { const res = await getTicketsById(row.id)
twId: row.twId this.partList = res.data.wares
}
const res = await listTwItem(data)
this.partList = res.data
//
this.partList = this.partList.filter(item => item.waresStatus === '01')
}finally { }finally {
this.backLoading = false this.backLoading = false
} }
@ -326,7 +324,7 @@ export default {
/** 保存数据 */ /** 保存数据 */
save(row) { save(row) {
// //
row.totalPrice = row.count * row.newPrice console.log(row, this.clickCellMap)
const id = row.id const id = row.id
// cell // cell
this.clickCellMap[id].forEach(cell => { this.clickCellMap[id].forEach(cell => {

View File

@ -42,11 +42,12 @@
<el-button v-if="(userRole === 'service_advisor' || userRole === 'general_inspection') && scope.row.status === '01'" @click="handleAudit(scope.row)" type="text" size="mini" icon="el-icon-s-check"> <el-button v-if="(userRole === 'service_advisor' || userRole === 'general_inspection') && scope.row.status === '01'" @click="handleAudit(scope.row)" type="text" size="mini" icon="el-icon-s-check">
审核 审核
</el-button> </el-button>
<!-- todo 待完成 -->
<el-button @click="handleGet(scope.row)" v-if="userRole === 'repair_staff' && scope.row.status !== '01' && scope.row.type === '01'" type="text" size="mini" icon="el-icon-finished"> <el-button @click="handleGet(scope.row)" v-if="userRole === 'repair_staff' && scope.row.status !== '01' && scope.row.type === '01'" type="text" size="mini" icon="el-icon-finished">
领料 领料确认
</el-button> </el-button>
<el-button @click="handleGet(scope.row)" v-if="userRole === 'repair_staff' && scope.row.status !== '01' && scope.row.type === '02'" type="text" size="mini" icon="el-icon-finished"> <el-button @click="handleGet(scope.row)" v-if="userRole === 'repair_staff' && scope.row.status !== '01' && scope.row.type === '02'" type="text" size="mini" icon="el-icon-finished">
退料 退料确认
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>

View File

@ -169,11 +169,12 @@
<el-table-column label="数量" align="center" prop="waresCount" width="180"/> <el-table-column label="数量" align="center" prop="waresCount" width="180"/>
<el-table-column v-if="userRole === 'service_advisor' && type" label="折扣" align="center" prop="itemDiscount" width="180"> <el-table-column v-if="userRole === 'service_advisor' && type" label="折扣" align="center" prop="itemDiscount" width="180">
<div v-if="formData.status === '01'" class="item" slot-scope="scope"> <div v-if="formData.status === '01'" class="item" slot-scope="scope">
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.itemDiscount"/> <!-- <el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.itemDiscount"/>-->
<span class="item__txt">{{ scope.row.itemDiscount }}</span> <DiscountInput @input-blur="save(scope.row)" class="item__input" v-model="scope.row.itemDiscount" />
<span class="item__txt">{{ scope.row.itemDiscount === 1 ? "无折扣" : scope.row.itemDiscount }}</span>
</div> </div>
<div v-else class="item" slot-scope="scope"> <div v-else slot-scope="scope">
<span>{{ scope.row.itemDiscount }}</span> <span>{{ scope.row.itemDiscount === 1 ? "无折扣" : scope.row.itemDiscount }}</span>
</div> </div>
</el-table-column> </el-table-column>
<el-table-column label="状态" align="center" prop="waresStatus" width="180"> <el-table-column label="状态" align="center" prop="waresStatus" width="180">
@ -197,9 +198,11 @@
import {getTicketsById} from "@/api/repair/tickets/Tickets"; import {getTicketsById} from "@/api/repair/tickets/Tickets";
import {auditTicketWares} from "@/api/repair/tickets/TicketWares"; import {auditTicketWares} from "@/api/repair/tickets/TicketWares";
import {listTwItem, updateIsShow} from "@/api/repair/tickets/TWItem"; import {listTwItem, updateIsShow} from "@/api/repair/tickets/TWItem";
import DiscountInput from "@/views/repair/tickets/Components/DiscountInput.vue";
export default { export default {
name: "TicketWaresShow", name: "TicketWaresShow",
components: {DiscountInput},
props:{ props:{
userRole: String, userRole: String,
type: Boolean type: Boolean
@ -241,7 +244,7 @@ export default {
this.items = [...this.items.map(item => { this.items = [...this.items.map(item => {
return { return {
...item, ...item,
itemDiscount: 10, itemDiscount: 1,
} }
})] })]
}finally { }finally {

View File

@ -7,12 +7,12 @@
<el-tab-pane label="已完成工单" name="finish"> <el-tab-pane label="已完成工单" name="finish">
<TicketManagerItem :is-finish="true" :user-role="userRole"/> <TicketManagerItem :is-finish="true" :user-role="userRole"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="领料申请单" name="getApply"> <el-tab-pane :label="userRole !== 'repair_staff' ? '配件申请单' : '领退料确认'" name="getApply">
<TicketWares :type="true" :user-role="userRole"/> <TicketWares :type="true" :user-role="userRole"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="退料申请单" name="backApply"> <!-- <el-tab-pane label="退料申请单" name="backApply">-->
<TicketWares :type="false" :user-role="userRole"/> <!-- <TicketWares :type="false" :user-role="userRole"/>-->
</el-tab-pane> <!-- </el-tab-pane>-->
</el-tabs> </el-tabs>
</div> </div>
</template> </template>