Compare commits

...

3 Commits

Author SHA1 Message Date
xiaofajia
4df130985e 退料 2024-10-17 23:39:54 +08:00
xiaofajia
46e7b3d3bf Merge branch 'dev' of http://122.51.230.86:3000/dianliang/lanan-system-vue into dev 2024-10-17 17:30:09 +08:00
xiaofajia
7d87a13ea0 暂提 2024-10-17 17:29:58 +08:00
9 changed files with 319 additions and 79 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,6 +191,7 @@ export default {
// truefalse
async handlePass(flag){
//
if (this.type){
this.formData.repairSo = {
soType: "02",
soNo: createUniqueCodeByHead("LL"),
@ -236,6 +237,32 @@ export default {
}finally {
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
async handleCreate(flag){
@ -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="isFinish" @click="handleBack(scope.row)" 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>
@ -74,6 +77,40 @@
<TicketsShow ref="ticketsShow"/>
<UpdateRepair ref="updateRepair" @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" :disabled="partList.length === 0">退料全部</el-button>
</div>
</el-dialog>
</div>
</template>
@ -82,6 +119,10 @@ import {getPageType, updateTake} 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";
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",
@ -91,8 +132,8 @@ export default {
type: Boolean,
},
userRole: {
type: Number,
default: -1,
type: String,
default: '',
required: true
}
},
@ -108,13 +149,29 @@ export default {
showSearch: true,
loading: false,
list: [],
total: 0
total: 0,
backVisible: false,
partList: [],
backLoading: false,
// cell
clickCellMap: {},
//
editProp: ['remark', 'waresCount'],
selections: [],
formData: {},
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
@ -162,14 +219,30 @@ export default {
}
},
// 退
handleBack(row){
async handleBack(row){
this.formData = {}
this.formData = row
this.remark = null
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')
}finally {
this.backLoading = false
}
},
//
handleReTake(row){
row = {
...row,
isLeads: this.userRole === 3
//
isLeads: this.userRole === 'repair_staff'
}
this.$refs.updateRepair.open(row)
},
@ -186,14 +259,123 @@ export default {
case 'handleGet':
this.handleGet(row)
break
case 'handleBack':
this.handleBack(row)
break
default:
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>
<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>

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>
@ -52,9 +55,9 @@
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@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="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" 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,8 @@ import {listTwItem, updateIsShow} from "@/api/repair/tickets/TWItem";
export default {
name: "TicketWaresShow",
props:{
userRole: Number
userRole: String,
type: Boolean
},
data(){
return{
@ -284,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]
}
},