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'
})
}
// 查当前登录用户是否维修班组长
export function getIfLeader(){
return request({
url: "/repair/worker/getIfLeader",
method: "get"
})
}

View File

@ -54,3 +54,12 @@ export function repairPassTicketWares(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)"
:disabled="this.items.filter(item => !item.isStock).length !== 0"
: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 type="primary" @click="handleCreate(true)">全部生成采购单</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>
</div>
</el-dialog>
@ -142,7 +142,7 @@
</template>
<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 {createUniqueCodeByHead} from "@/utils/createUniqueCode";
import {parseTime} from "@/utils/ruoyi";
@ -191,50 +191,77 @@ export default {
// truefalse
async handlePass(flag){
//
this.formData.repairSo = {
soType: "02",
soNo: createUniqueCodeByHead("LL"),
userId: this.formData.repairId,
userName: this.formData.repairName,
soTime: parseTime(Date.now(), '{y}-{m}-{d}'),
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"
}
})]
if (this.type){
this.formData.repairSo = {
soType: "02",
soNo: createUniqueCodeByHead("LL"),
userId: this.formData.repairId,
userName: this.formData.repairName,
soTime: parseTime(Date.now(), '{y}-{m}-{d}'),
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',
goodsId: item.waresId,
goodsCount: item.waresCount,
}
})]
this.formData.items = [...this.selections.map(item => {
return {
id: item.id,
waresStatus: "04"
}
})]
}
try {
await pass(this.formData)
this.$modal.msgSuccess("处理成功")
await this.getList()
}finally {
this.dialogVisible = false
}
}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 {
await pass(this.formData)
this.$modal.msgSuccess("处理成功")
await this.getList()
}finally {
this.dialogVisible = false
// 退
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
@ -289,7 +316,8 @@ export default {
this.dialogVisible = true
try {
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.forEach(item => {

View File

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

View File

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

View File

@ -44,22 +44,25 @@
<el-button size="mini" type="text" icon="el-icon-view" @click="handleShow(scope.row)"
>查看
</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 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-dropdown @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 === '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 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 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-menu>
@ -105,7 +108,7 @@
</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>
<el-button @click="doBack(true)" type="success" :disabled="partList.length === 0">退料全部</el-button>
</div>
</el-dialog>
</div>
@ -119,6 +122,7 @@ 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";
import {getIfLeader} from "@/api/repair/repairworker";
export default {
name: "TicketManagerItem",
@ -128,8 +132,8 @@ export default {
type: Boolean,
},
userRole: {
type: Number,
default: -1,
type: String,
default: '',
required: true
}
},
@ -155,13 +159,19 @@ export default {
editProp: ['remark', 'waresCount'],
selections: [],
formData: {},
remark: null
remark: null,
leader: false,
}
},
mounted() {
this.listTickets()
this.isLeader()
},
methods: {
async isLeader(){
const res = await getIfLeader()
this.leader = res.data
},
async listTickets() {
try {
this.loading = true
@ -216,7 +226,10 @@ export default {
this.backVisible = true
try {
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 = this.partList.filter(item => item.waresStatus === '01')
@ -228,7 +241,8 @@ export default {
handleReTake(row){
row = {
...row,
isLeads: this.userRole === 3
//
isLeads: this.userRole === 'repair_staff'
}
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">
<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 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 @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 @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>
</el-table>
@ -54,7 +57,7 @@
/>
<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-column type="selection" width="80" align="center" />
<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>
<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(true)">领料全部</el-button>
<el-button type="primary" @click="handleDoGet(false)" :disabled="selections.length === 0">
{{this.type ? '领料选择' : '退料选择'}}
</el-button>
<el-button type="primary" :disabled="items.length === 0" @click="handleDoGet(true)">
{{this.type ? '领料全部' : '退料全部'}}
</el-button>
</div>
</el-dialog>
</div>
@ -79,7 +86,7 @@ export default {
components: {TicketWaresShow},
props:{
type: Boolean,
userRole: Number,
userRole: String,
},
data(){
return{
@ -99,6 +106,7 @@ export default {
items: [],
selections: [],
formData:{},
dialogTitle: ""
}
},
mounted() {
@ -136,16 +144,18 @@ export default {
id: row.id,
}
this.dialogVisible = true
this.dialogTitle = this.type ? "领料确认" : "退料确认"
try {
this.dialogLoading = true
const res = await listTwItem({twId: row.twId})
const data = {twId: row.id}
const res = await listTwItem(data)
this.items = res.data
//
if (this.type){
this.items = this.items.filter(item => item.waresStatus === '04')
}else {
//
this.items = this.items.filter(item => item.waresStatus === '01')
// 退
this.items = this.items.filter(item => item.waresStatus === '05')
}
}finally {
this.dialogLoading = false
@ -155,25 +165,26 @@ export default {
this.selections = val
},
async handleDoGet(flag){
this.formData.type = this.type ? "01" : "02"
if (flag){
this.formData.items = [...this.items.map(item => {
return {
id: item.id,
waresStatus: "01"
waresStatus: this.type ? "01" : "03"
}
})]
}else {
this.formData.items = [...this.selections.map(item => {
return {
id: item.id,
waresStatus: "01"
waresStatus: this.type ? "01" : "03"
}
})]
}
try {
await repairPassTicketWares(this.formData)
this.dialogVisible = false
this.$modal.msgSuccess("领料成功")
this.$modal.msgSuccess(this.type ? "领料成功" : "退料成功")
await this.getList()
}catch{}
}

View File

@ -151,7 +151,7 @@
<span>{{ scope.$index + 1 }}</span>
</template>
</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">
<el-switch
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="wares.model" 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">
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.itemDiscount"/>
<span class="item__txt">{{ scope.row.itemDiscount }}</span>
@ -185,7 +185,7 @@
</el-table>
</div>
</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 @click="handleAudit(false)"> </el-button>
</div>
@ -201,7 +201,7 @@ import {listTwItem, updateIsShow} from "@/api/repair/tickets/TWItem";
export default {
name: "TicketWaresShow",
props:{
userRole: Number,
userRole: String,
type: Boolean
},
data(){
@ -285,6 +285,7 @@ export default {
remark: item.remark
}
})]
console.log(this.formData)
await auditTicketWares(this.formData)
this.dialogVisible = false
this.$modal.msgSuccess("审核成功")

View File

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