This commit is contained in:
xiaofajia 2024-10-17 23:39:54 +08:00
parent 46e7b3d3bf
commit 4df130985e
9 changed files with 149 additions and 78 deletions

View File

@ -67,3 +67,11 @@ export function listByLeads(){
method: 'get' method: 'get'
}) })
} }
// 查当前登录用户是否维修班组长
export function getIfLeader(){
return request({
url: "/repair/worker/getIfLeader",
method: "get"
})
}

View File

@ -54,3 +54,12 @@ export function repairPassTicketWares(data){
data data
}) })
} }
// 仓库确认退料
export function passBackTicketWares(data){
return request({
url: preUrl + '/passBack',
method: 'post',
data
})
}

View File

@ -55,8 +55,8 @@
<el-button type="success" @click="handlePass(true)" <el-button type="success" @click="handlePass(true)"
:disabled="this.items.filter(item => !item.isStock).length !== 0" :disabled="this.items.filter(item => !item.isStock).length !== 0"
:title="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(false)" :disabled="selections.length === 0">选择生成采购单</el-button> <el-button v-if="type" type="primary" @click="handleCreate(false)" :disabled="selections.length === 0">选择生成采购单</el-button>
<el-button type="primary" @click="handleCreate(true)">全部生成采购单</el-button> <el-button v-if="type" type="primary" @click="handleCreate(true)">全部生成采购单</el-button>
</div> </div>
</el-dialog> </el-dialog>
@ -142,7 +142,7 @@
</template> </template>
<script> <script>
import {getPage, pass} from "@/api/repair/tickets/TicketWares"; import {getPage, pass, passBackTicketWares} from "@/api/repair/tickets/TicketWares";
import {listTwItem} from "@/api/repair/tickets/TWItem"; import {listTwItem} from "@/api/repair/tickets/TWItem";
import {createUniqueCodeByHead} from "@/utils/createUniqueCode"; import {createUniqueCodeByHead} from "@/utils/createUniqueCode";
import {parseTime} from "@/utils/ruoyi"; import {parseTime} from "@/utils/ruoyi";
@ -191,6 +191,7 @@ export default {
// truefalse // truefalse
async handlePass(flag){ async handlePass(flag){
// //
if (this.type){
this.formData.repairSo = { this.formData.repairSo = {
soType: "02", soType: "02",
soNo: createUniqueCodeByHead("LL"), soNo: createUniqueCodeByHead("LL"),
@ -236,6 +237,32 @@ export default {
}finally { }finally {
this.dialogVisible = false this.dialogVisible = false
} }
}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("处理成功")
await this.getList()
}finally {
this.dialogVisible = false
}
}
}, },
// truefalse // truefalse
async handleCreate(flag){ async handleCreate(flag){
@ -289,7 +316,8 @@ export default {
this.dialogVisible = true this.dialogVisible = true
try { try {
this.dialogLoading = true this.dialogLoading = true
const res = await listTwItem({twId: row.twId}) const data = {twId: row.id}
const res = await listTwItem(data)
this.items = res.data this.items = res.data
// //
this.items.forEach(item => { this.items.forEach(item => {

View File

@ -153,7 +153,7 @@ export default {
this.info = row this.info = row
const id = row.id const id = row.id
const res = await getSt(id) const res = await getSt(id)
console.log(res.data) // console.log(res.data)
this.info.items = res.data.items this.info.items = res.data.items
const response = await getBaseWarehouseList() const response = await getBaseWarehouseList()
this.warehouseList = response.data this.warehouseList = response.data

View File

@ -338,7 +338,7 @@ export default {
this.list.splice(index, 1) this.list.splice(index, 1)
} }
}, },
// TODO //
handleCreateItem() { handleCreateItem() {
switch (this.itemType) { switch (this.itemType) {
case "project": case "project":

View File

@ -44,22 +44,25 @@
<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 v-if="scope.row.ticketsWorkStatus === '01' && (userRole === 3 || userRole === 4)" size="mini" type="text" icon="el-icon-check" @click="handleTake(scope.row)"> <el-button v-if="scope.row.ticketsWorkStatus === '01' && userRole === 'repair_staff'" size="mini" type="text" icon="el-icon-check" @click="handleTake(scope.row)">
接单 接单
</el-button> </el-button>
<el-button v-if="userRole === 2 && 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-dropdown @command="(command) => handleCommand(command, scope.$index, scope.row)"> <el-dropdown @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 === '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 === 'repair_staff'" command="handleGet" size="mini" type="text" icon="el-icon-document-add"
>申请领料 >申请领料
</el-dropdown-item> </el-dropdown-item>
<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 v-if="scope.row.ticketsWorkStatus === '02' && 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 !== 4" command="handleReTake" size="mini" type="text" icon="el-icon-refresh" <!-- 还要判断是不是员工 -->
<el-dropdown-item
v-if="userRole === 'repair_staff' ? leader : true"
command="handleReTake" size="mini" type="text" icon="el-icon-refresh"
>重新指派 >重新指派
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
@ -105,7 +108,7 @@
</el-row> </el-row>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="doBack(false)" type="primary" :disabled="selections.length === 0">退料选择</el-button> <el-button @click="doBack(false)" type="primary" :disabled="selections.length === 0">退料选择</el-button>
<el-button @click="doBack(true)" type="success">退料全部</el-button> <el-button @click="doBack(true)" type="success" :disabled="partList.length === 0">退料全部</el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
@ -119,6 +122,7 @@ import TWOperate from "@/views/repair/tickets/form/TWOperate.vue";
import {listTwItem} from "@/api/repair/tickets/TWItem"; import {listTwItem} from "@/api/repair/tickets/TWItem";
import {createUniqueCodeByHead} from "@/utils/createUniqueCode"; import {createUniqueCodeByHead} from "@/utils/createUniqueCode";
import {updateTicketWares} from "@/api/repair/tickets/TicketWares"; import {updateTicketWares} from "@/api/repair/tickets/TicketWares";
import {getIfLeader} from "@/api/repair/repairworker";
export default { export default {
name: "TicketManagerItem", name: "TicketManagerItem",
@ -128,8 +132,8 @@ export default {
type: Boolean, type: Boolean,
}, },
userRole: { userRole: {
type: Number, type: String,
default: -1, default: '',
required: true required: true
} }
}, },
@ -155,13 +159,19 @@ export default {
editProp: ['remark', 'waresCount'], editProp: ['remark', 'waresCount'],
selections: [], selections: [],
formData: {}, formData: {},
remark: null remark: null,
leader: false,
} }
}, },
mounted() { mounted() {
this.listTickets() this.listTickets()
this.isLeader()
}, },
methods: { methods: {
async isLeader(){
const res = await getIfLeader()
this.leader = res.data
},
async listTickets() { async listTickets() {
try { try {
this.loading = true this.loading = true
@ -216,7 +226,10 @@ export default {
this.backVisible = true this.backVisible = true
try { try {
this.backLoading = true this.backLoading = true
const res = await listTwItem({twId: row.twId}) const data = {
twId: row.twId
}
const res = await listTwItem(data)
this.partList = res.data this.partList = res.data
// //
this.partList = this.partList.filter(item => item.waresStatus === '01') this.partList = this.partList.filter(item => item.waresStatus === '01')
@ -228,7 +241,8 @@ export default {
handleReTake(row){ handleReTake(row){
row = { row = {
...row, ...row,
isLeads: this.userRole === 3 //
isLeads: this.userRole === 'repair_staff'
} }
this.$refs.updateRepair.open(row) this.$refs.updateRepair.open(row)
}, },

View File

@ -36,15 +36,18 @@
<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 v-if="scope.row.status !== '01' || userRole === 3 || userRole === 4" type="text" size="mini" icon="el-icon-view" @click="handleShow(scope.row)"> <el-button v-if="scope.row.status !== '01' || userRole !== 'service_advisor'" type="text" size="mini" icon="el-icon-view" @click="handleShow(scope.row)">
查看 查看
</el-button> </el-button>
<el-button v-if="userRole === 1 || userRole === 2 && 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>
<el-button @click="handleGet(scope.row)" v-if="userRole === 3 || userRole === 4 && scope.row.status !== '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>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -54,7 +57,7 @@
/> />
<TicketWaresShow ref="ticketWaresShow" :user-role="userRole" @success="getList" :type="type"/> <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="dialogTitle" :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">
<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"/>
@ -62,8 +65,12 @@
<el-table-column label="数量" align="center" prop="waresCount" width="180"/> <el-table-column label="数量" align="center" prop="waresCount" width="180"/>
</el-table> </el-table>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleDoGet(false)" :disabled="selections.length === 0">领料选择</el-button> <el-button type="primary" @click="handleDoGet(false)" :disabled="selections.length === 0">
<el-button type="primary" @click="handleDoGet(true)">领料全部</el-button> {{this.type ? '领料选择' : '退料选择'}}
</el-button>
<el-button type="primary" :disabled="items.length === 0" @click="handleDoGet(true)">
{{this.type ? '领料全部' : '退料全部'}}
</el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
@ -79,7 +86,7 @@ export default {
components: {TicketWaresShow}, components: {TicketWaresShow},
props:{ props:{
type: Boolean, type: Boolean,
userRole: Number, userRole: String,
}, },
data(){ data(){
return{ return{
@ -99,6 +106,7 @@ export default {
items: [], items: [],
selections: [], selections: [],
formData:{}, formData:{},
dialogTitle: ""
} }
}, },
mounted() { mounted() {
@ -136,16 +144,18 @@ export default {
id: row.id, id: row.id,
} }
this.dialogVisible = true this.dialogVisible = true
this.dialogTitle = this.type ? "领料确认" : "退料确认"
try { try {
this.dialogLoading = true this.dialogLoading = true
const res = await listTwItem({twId: row.twId}) const data = {twId: row.id}
const res = await listTwItem(data)
this.items = res.data this.items = res.data
// //
if (this.type){ if (this.type){
this.items = this.items.filter(item => item.waresStatus === '04') this.items = this.items.filter(item => item.waresStatus === '04')
}else { }else {
// // 退
this.items = this.items.filter(item => item.waresStatus === '01') this.items = this.items.filter(item => item.waresStatus === '05')
} }
}finally { }finally {
this.dialogLoading = false this.dialogLoading = false
@ -155,25 +165,26 @@ export default {
this.selections = val this.selections = val
}, },
async handleDoGet(flag){ async handleDoGet(flag){
this.formData.type = this.type ? "01" : "02"
if (flag){ if (flag){
this.formData.items = [...this.items.map(item => { this.formData.items = [...this.items.map(item => {
return { return {
id: item.id, id: item.id,
waresStatus: "01" waresStatus: this.type ? "01" : "03"
} }
})] })]
}else { }else {
this.formData.items = [...this.selections.map(item => { this.formData.items = [...this.selections.map(item => {
return { return {
id: item.id, id: item.id,
waresStatus: "01" waresStatus: this.type ? "01" : "03"
} }
})] })]
} }
try { try {
await repairPassTicketWares(this.formData) await repairPassTicketWares(this.formData)
this.dialogVisible = false this.dialogVisible = false
this.$modal.msgSuccess("领料成功") this.$modal.msgSuccess(this.type ? "领料成功" : "退料成功")
await this.getList() await this.getList()
}catch{} }catch{}
} }

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 && type" width="180"> <el-table-column align="center" label="客户可见" prop="isShow" v-if="userRole === 'service_advisor' && 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"
@ -167,7 +167,7 @@
<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"/>
<el-table-column v-if="userRole === 2" 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> <span class="item__txt">{{ scope.row.itemDiscount }}</span>
@ -185,7 +185,7 @@
</el-table> </el-table>
</div> </div>
</el-card> </el-card>
<div slot="footer" class="dialog-footer" v-if="info.status === '01' && (userRole === 1 || userRole === 2)"> <div slot="footer" class="dialog-footer" v-if="info.status === '01' && (userRole === 'service_advisor' || userRole === 'general_inspection')">
<el-button type="primary" @click="handleAudit(true)"> </el-button> <el-button type="primary" @click="handleAudit(true)"> </el-button>
<el-button @click="handleAudit(false)"> </el-button> <el-button @click="handleAudit(false)"> </el-button>
</div> </div>
@ -201,7 +201,7 @@ import {listTwItem, updateIsShow} from "@/api/repair/tickets/TWItem";
export default { export default {
name: "TicketWaresShow", name: "TicketWaresShow",
props:{ props:{
userRole: Number, userRole: String,
type: Boolean type: Boolean
}, },
data(){ data(){
@ -285,6 +285,7 @@ export default {
remark: item.remark remark: item.remark
} }
})] })]
console.log(this.formData)
await auditTicketWares(this.formData) await auditTicketWares(this.formData)
this.dialogVisible = false this.dialogVisible = false
this.$modal.msgSuccess("审核成功") this.$modal.msgSuccess("审核成功")

View File

@ -28,7 +28,7 @@ export default {
data() { data() {
return { return {
activeTab: 'unFinish', activeTab: 'unFinish',
userRole: -1, userRole: "",
exportRole:[3, 4] exportRole:[3, 4]
} }
}, },