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-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 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="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>
<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="success" @click="handlePass(true)"
:disabled="this.items.filter(item => !item.isStock).length !== 0"
:title="this.items.filter(item => !item.isStock).length !== 0 ? '有配件库存不足':''">通过全部</el-button>
<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 type="primary" @click="handlePass" :disabled="selections.length === 0 || selections.filter(item => !item.isStock).length !== 0">
通知领取
</el-button>
<el-button type="primary" @click="handleCreate" :disabled="selections.length === 0">
采购
</el-button>
</div>
</el-dialog>
@ -180,8 +196,9 @@ export default {
// cell
clickCellMap: {},
//
editProp: ['warehouse', 'count', 'newPrice', 'remark', 'code'],
editProp: ['warehouse', 'count', 'newPrice', 'remark', 'code', 'waresCount'],
remark: null,
tableKey: 0,
}
},
mounted() {
@ -189,7 +206,7 @@ export default {
},
methods:{
// truefalse
async handlePass(flag){
async handlePass(){
//
if (this.type){
this.formData.repairSo = {
@ -201,21 +218,6 @@ export default {
soStatus: "04",
purchaseType: "01"
}
if (flag){
this.formData.repairSois = [...this.items.map(item => {
return {
soiType: '02',
goodsId: item.waresId,
goodsCount: item.waresCount,
}
})]
this.formData.items = [...this.items.map(item => {
return {
id: item.id,
waresStatus: "04"
}
})]
}else {
this.formData.repairSois = [...this.selections.map(item => {
return {
soiType: '02',
@ -226,10 +228,8 @@ export default {
this.formData.items = [...this.selections.map(item => {
return {
id: item.id,
waresStatus: "04"
}
})]
}
try {
await pass(this.formData)
this.$modal.msgSuccess("处理成功")
@ -240,21 +240,12 @@ export default {
}else {
// 退
this.formData = {}
if (flag){
this.formData.items = [...this.items.map(item => {
return {
id: item.id,
waresStatus: "05"
}
})]
}else {
this.formData.items = [...this.selections.map(item => {
return {
id: item.id,
waresStatus: "05"
}
})]
}
try {
await passBackTicketWares(this.formData)
this.$modal.msgSuccess("处理成功")
@ -321,7 +312,9 @@ export default {
this.items = res.data
//
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){
@ -334,7 +327,7 @@ export default {
this.dialogLoading = false
}
},
getClass(row){
getRowClass(row){
if (this.type && !row.row.isStock){
return 'stock'
}
@ -411,6 +404,7 @@ export default {
/** 保存数据 */
save(row) {
//
row.isStock = row.waresCount <= row.wares.stock
row.totalPrice = row.count * row.newPrice
const id = row.id
// cell
@ -418,6 +412,7 @@ export default {
this.cancelEditable(cell)
})
this.clickCellMap[id] = []
this.tableKey++
},
changeWare(row) {
if (row.ware) {

View File

@ -1,10 +1,10 @@
<template>
<div class="app-container">
<el-tabs v-model="activeTab">
<el-tab-pane label="领料申请" name="get">
<el-tab-pane label="领配件管理" name="get">
<WaresItem :type="true"/>
</el-tab-pane>
<el-tab-pane label="退料申请" name="back">
<el-tab-pane label="退配件管理" name="back">
<WaresItem :type="false"/>
</el-tab-pane>
</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 v-if="!exportColumn.includes('discount')" align="center" label="折扣" width="180" prop="discount">
<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"/>
<span class="item__txt">{{ scope.row.discount }}</span>
<!-- <el-input :min="0" :max="1" @blur="save(scope.row)" class="item__input" v-model="scope.row.discount"/>-->
<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>
</el-table-column>
<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 {getWaresByName} from "@/api/repair/wares";
import WorkerChoose from "@/views/repair/Components/WorkerChoose.vue";
import DiscountInput from "@/views/repair/tickets/Components/DiscountInput.vue";
export default {
name: "TicketItem",
components: {
DiscountInput,
WorkerChoose,
OtherForm,
OtherChoose, ProjectChoose, RepairProjectForm, WaresForm, ServerChoose, StaffChoose, PartChoose
@ -289,7 +292,7 @@ export default {
// console.log(row)
if (row.id) {
row.itemStatus = "01"
row.totalPrice = row.count * row.price * (row.discount / 10)
row.totalPrice = row.count * row.price * row.discount
}
const id = row.id
// cell
@ -310,7 +313,7 @@ export default {
data = {
...data,
count: 1,
discount: 10,
discount: 1,
remark: null,
itemStatus: '01',
totalPrice: data.price,

View File

@ -29,7 +29,11 @@
</template>
</el-table-column>
<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="repairNames"/>
<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>
<el-button size="mini" v-if="userRole === 'repair_staff' && !isFinish" type="text" icon="el-icon-monitor" @click="handleRecord(scope.row, 'sgz')">
过程记录
</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 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, '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 @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 @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
v-if="userRole !== 'general_inspection'"
v-if="scope.row.ticketsWorkStatus !== '01'"
@command="(command) => handleCommand(command, scope.$index, scope.row)">
<el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button>
<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>
<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 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
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"
>重新指派
</el-dropdown-item>
@ -101,12 +104,12 @@
@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">
<el-table-column label="商品名称" prop="itemName" align="center"/>
<el-table-column label="规格" prop="ware.model" align="center"/>
<el-table-column label="数量" prop="itemCount" 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>
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.itemCount"/>
<span class="item__txt">{{ scope.row.itemCount }}</span>
</div>
</el-table-column>
<el-table-column label="备注" prop="remark" align="center">
@ -130,7 +133,7 @@
</template>
<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 UpdateRepair from "@/views/repair/tickets/form/UpdateRepair.vue";
import TWOperate from "@/views/repair/tickets/form/TWOperate.vue";
@ -160,7 +163,7 @@ export default {
pageSize: 10,
ticketNo: null,
searchTimeArray: [],
isFinish: this.isFinish ? "1" : "0"
isFinish: this.isFinish ? "1" : "0",
},
showSearch: true,
loading: false,
@ -172,7 +175,7 @@ export default {
// cell
clickCellMap: {},
//
editProp: ['remark', 'waresCount'],
editProp: ['remark', 'itemCount'],
selections: [],
formData: {},
remark: null,
@ -242,13 +245,8 @@ export default {
this.backVisible = true
try {
this.backLoading = true
const data = {
twId: row.twId
}
const res = await listTwItem(data)
this.partList = res.data
//
this.partList = this.partList.filter(item => item.waresStatus === '01')
const res = await getTicketsById(row.id)
this.partList = res.data.wares
}finally {
this.backLoading = false
}
@ -326,7 +324,7 @@ export default {
/** 保存数据 */
save(row) {
//
row.totalPrice = row.count * row.newPrice
console.log(row, this.clickCellMap)
const id = row.id
// 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>
<!-- 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>
<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>
</template>
</el-table-column>

View File

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

View File

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