服务顾问通知取车前的完成前的编辑工单

This commit is contained in:
xiaofajia 2024-10-24 20:36:23 +08:00 committed by xvv
parent e05d5e9270
commit ef139f50bb
6 changed files with 480 additions and 33 deletions

View File

@ -149,3 +149,12 @@ export function noticeCus(data){
data
})
}
// 新增工单子项
export function addItems(data){
return request({
url: preUrl + "/addItems",
method: 'post',
data
})
}

View File

@ -18,3 +18,28 @@ export function getProjectList(ticketId){
method: 'get'
})
}
// 查看单个维修子表的数据
export function getItemById(id){
return request({
url: preUrl + "/getById?id=" + id,
method: 'get'
})
}
// 修改单个工单子项的内容
export function updateById(data){
return request({
url: preUrl + "/updateById",
method: 'post',
data
})
}
// 维修工单单个子项
export function removeItemById(id){
return request({
url: preUrl + "/removeById?id=" + id,
method: 'delete'
})
}

View File

@ -1,6 +1,6 @@
<template>
<div>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true"
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" :row-class-name="getClass"
@cell-mouse-enter="handleCellEnter"
@cell-mouse-leave="handleCellLeave"
@cell-click="handleCellClick"
@ -136,7 +136,7 @@ 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 {
export default {
name: "TicketItem",
components: {
DiscountInput,
@ -169,7 +169,7 @@ export default {
type: Array,
default: () => {return []},
required: false
}
},
},
data() {
return {
@ -397,6 +397,12 @@ export default {
},
getRepairName(data) {
return data.map(item => item.userName).join(',')
},
getClass(row){
if (row.repairIds && row.saleId){
return 'error'
}
return ''
}
}
}
@ -439,4 +445,8 @@ export default {
::v-deep .noPadding {
padding: 0;
}
::v-deep .el-table .error td{
color: #ff0000 !important; /* 红色背景 */
}
</style>

View File

@ -38,13 +38,74 @@
<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="remark"/>
<el-table-column align="center" label="操作" width="180" fixed="right" v-if="isEdit && list.length > 0">
<template slot-scope="scope">
<el-button type="text" @click="$emit('remove', scope.row.id)">
删除
</el-button>
<el-button type="text" @click="editItem(scope.row)">
修改
</el-button>
</template>
</el-table-column>
</el-table>
<el-dialog title="修改" :visible.sync="dialogVisible" v-dialogDrag append-to-body ref="dialog" width="60%">
<el-form :model="item" ref="formRef" :rules="formRules" :inline="true" label-width="10rem">
<el-row :gutter="2">
<el-col :span="12">
<el-form-item label="名称" prop="itemName">
<el-input disabled v-model="item.itemName" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="施工人员" prop="repairNames">
<el-input v-model="item.repairNames" disabled />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="2">
<el-col :span="12">
<el-form-item label="销售人员" prop="saleName">
<el-input v-model="item.saleName" disabled />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="数量" prop="itemCount">
<el-input-number :step="1" :min="0" v-model="item.itemCount" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="2">
<el-col :span="12">
<el-form-item label="单价" prop="itemPrice">
<el-input-number :min="0" v-model="item.itemPrice" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="折扣" prop="itemDiscount">
<DiscountInput v-model="item.itemDiscount" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {getItemById, updateById} from "@/api/repair/tickets/TicketsItem";
import DiscountInput from "@/views/repair/tickets/Components/DiscountInput.vue";
import WorkerChoose from "@/views/repair/Components/WorkerChoose.vue";
import StaffChoose from "@/views/repair/Components/StaffChoose.vue";
export default {
name: "TicketItemShow",
components: {StaffChoose, WorkerChoose, DiscountInput},
props: {
list: {
type: Array,
@ -55,11 +116,22 @@ export default {
listType: {
type: String,
default: null
},
isEdit:{
type: Boolean,
}
},
data() {
return {
loading: !(this.list && this.list.length),
loading: !(this.list && this.list.length) && !this.isEdit,
dialogVisible: false,
item: {},
formRules:{
itemPrice: [{required: true, message: '单价不能为空', trigger: 'blur'}],
itemCount: [{required: true, message: '数量不能为空', trigger: 'blur'}],
itemDiscount: [{required: true, message: "折扣不能为空", trigger: 'blur'}]
},
formLoading: false
}
},
computed: {
@ -76,7 +148,27 @@ export default {
}
}
},
methods: {}
methods: {
async editItem(row){
this.resetForm('formRef')
try {
const res = await getItemById(row.id)
this.item = res.data
this.dialogVisible = true
this.item['repair'] = null
this.item['adviser'] = null
}catch{}
},
async submitForm(){
try {
await this.$refs.formRef.validate()
await updateById(this.item)
this.dialogVisible = false
this.$modal.msgSuccess("修改成功")
this.$emit('success', this.item.ticketId)
}catch{}
}
}
}
</script>

View File

@ -1,28 +1,350 @@
<template>
<div>
<el-dialog title="编辑工单" :visible.sync="dialogVisible" width="80%" v-dialogDrag append-to-body>
<!-- todo -->
<el-dialog title="编辑工单" :visible.sync="dialogVisible" width="80%" v-dialogDrag append-to-body ref="dialog">
<el-card class="box-card">
<!-- 卡片头 -->
<div slot="header" class="clearfix">
<i class="el-icon-plus"/>
<span>工单信息</span>
</div>
<!-- 卡片内容 -->
<div>
<el-descriptions class="margin-top" :column="4" :size="'medium'" border style="margin-bottom: 1rem">
<el-descriptions-item>
<template slot="label">
订单编号
</template>
{{ info.ticketNo }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
维修类别
</template>
<dict-tag :type="DICT_TYPE.REPAIR_TYPE" v-model="info.repairType"/>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
状态
</template>
<dict-tag :type="DICT_TYPE.REPAIR_TICKETS_WORK_STATUS" v-model="info.ticketsWorkStatus"/>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
客户名称
</template>
{{ info.userName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
车牌号
</template>
{{ info.carNo }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
车系
</template>
{{ info.carBrandName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
手机号
</template>
{{ info.userMobile }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
创建时间
</template>
{{ parseTime(info.createTime, '{y}-{m}-{d}') }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
预计完工
</template>
{{ parseTime(info.outTime, '{y}-{m}-{d}') }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
合计金额
</template>
{{ info.totalPrice }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
参考成本
</template>
{{ info.cost }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
参考毛利
</template>
{{ info.profit }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
领料状态
</template>
<dict-tag :type="DICT_TYPE.REPAIR_PART_STATUS" v-model="info.partStatus"/>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
服务顾问
</template>
{{ info.adviserName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
所属门店
</template>
{{ info.corpId }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
工单状态
</template>
<dict-tag :type="DICT_TYPE.REPAIR_TICKETS_STATUS" v-model="info.ticketsStatus"/>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
备注
</template>
{{ info.remark }}
</el-descriptions-item>
</el-descriptions>
</div>
</el-card>
<el-card class="box-card">
<!-- 卡片头 -->
<div slot="header" class="clearfix">
<i class="el-icon-plus"/>
<span>项目信息</span>
<div style="float: right; padding: 3px 0">
<el-button type="primary" size="small" @click="handleAdd('project')">
添加项目
</el-button>
</div>
</div>
<!-- 卡片内容 -->
<div>
<TicketItemShow :is-edit="true" :list="projects" list-type="project" @remove="handleRemove" @success="open"/>
</div>
</el-card>
<el-card class="box-card">
<!-- 卡片头 -->
<div slot="header" class="clearfix">
<i class="el-icon-plus"/>
<span>配件信息</span>
<div style="float: right; padding: 3px 0">
<el-switch v-if="wares.length > 0"
v-model="info.partShow"
active-text="客户可见"
inactive-text="客户不可见"
active-value="1"
inactive-value="0"
@change="changeShow"
>
</el-switch>
<el-button type="primary" size="small" style="margin-left: 1rem" @click="handleAdd('ware')">
添加配件
</el-button>
</div>
</div>
<!-- 卡片内容 -->
<div>
<TicketItemShow :is-edit="true" :list="wares" list-type="ware" @remove="handleRemove" @success="open"/>
</div>
</el-card>
<el-card class="box-card">
<!-- 卡片头 -->
<div slot="header" class="clearfix">
<i class="el-icon-plus"/>
<span>其他信息</span>
<div style="float: right; padding: 3px 0">
<el-button type="primary" size="small" @click="handleAdd('other')">
添加其他
</el-button>
</div>
</div>
<!-- 卡片内容 -->
<div>
<TicketItemShow :is-edit="true" :list="others" list-type="other" @remove="handleRemove" @success="open"/>
</div>
</el-card>
</el-dialog>
<el-dialog :title="addTitle" :visible.sync="addDialog" width="80%" v-dialogDrag append-to-body ref="addDialog">
<TicketItem :export-column="['addBtn']" :in-list-data="projectList" v-if="addType === 'project'" item-type="project" @tableData="projectData"/>
<TicketItem :export-column="['addBtn']" :in-list-data="waresList" v-if="addType === 'ware'" item-type="part" @tableData="partData"/>
<TicketItem :export-column="['addBtn']" :in-list-data="otherList" v-if="addType === 'other'" item-type="other" @tableData="otherData"/>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleConfirm"> </el-button>
<el-button @click="addDialog = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {getTicketsById, updateShow, addItems} from "@/api/repair/tickets/Tickets";
import {removeItemById} from "@/api/repair/tickets/TicketsItem";
import TicketItemShow from "@/views/repair/tickets/Components/TicketItemShow.vue";
import other from "@/views/repair/other/index.vue";
import TicketItem from "@/views/repair/tickets/Components/TicketItem.vue";
export default {
name: "EditTickets",
data(){
return{
info: {},
computed: {
other() {
return other
}
},
methods:{
async open(row){
components: {TicketItem, TicketItemShow},
data() {
return {
info: {},
dialogVisible: false,
loadingInstance: null,
projects:[],
wares:[],
others: [],
addTitle: null,
addType: null,
addDialog: false,
formData: {
id: null,
itemList: []
},
projectList: [],
waresList: [],
otherList: [],
}
},
methods: {
async open(row) {
try {
this.dialogVisible = true
this.loadingInstance = this.$loading({
target: this.$refs.dialog.$el,
})
const res = await getTicketsById(row?.id || row)
const data = res.data.items
this.projects = data.filter(item => item.project)
this.wares = data.filter(item => item.ware)
this.others = data.filter(item => item.other)
this.info = res.data
} finally {
this.loadingInstance.close()
}
},
async changeShow(){
try {
await updateShow(this.info.id, this.info.partShow)
}catch {}
},
async handleRemove(id){
try {
await this.$modal.confirm("确认删除数据吗?")
const ticketId = this.info.id
await removeItemById(id)
this.$modal.msgSuccess("删除成功")
await this.open(ticketId)
}catch{}
},
handleAdd(type){
this.formData.id = this.info.id
this.addType = type
switch (type){
case "project":
this.addTitle = "添加项目"
break
case "ware":
this.addTitle = "添加配件"
break
case "other":
this.addTitle = "添加其他"
}
this.dialogVisible = false
this.addDialog = true
},
projectData(data) {
this.projectList = [...data]
this.projectList.pop()
},
partData(data) {
this.waresList = [...data]
this.waresList.pop()
},
otherData(data) {
this.otherList = [...data]
this.otherList.pop()
},
async handleConfirm(){
try {
this.createItemInit()
await addItems(this.formData)
this.addDialog = false
this.$modal.msgSuccess("新增成功")
await this.open(this.formData.id)
}catch{}
},
// init
createItemInit() {
this.formData.itemList = []
//
this.formData.itemList = [...this.formData.itemList, ...this.formatItem("project", this.projectList)]
//
this.formData.itemList = [...this.formData.itemList, ...this.formatItem("part", this.partList)]
//
this.formData.itemList = [...this.formData.itemList, ...this.formatItem("other", this.otherList)]
},
//
formatItem(type, list) {
if (!(list && list.length > 0)) {
return []
}
return list.map(item => {
const temp = {
...item,
itemName: item.name,
itemCount: item?.count,
itemUnit: item.unit,
itemPrice: item.price,
itemDiscount: item.discount,
itemMoney: item.totalPrice,
repairIds: item?.repair.map(i => i.userId).join(','),
repairNames: item?.repair.map(i => i.userName).join(','),
saleId: item?.sale?.id,
saleName: item?.sale?.name,
itemTypeId: item?.type?.id,
remark: item.remark,
itemStatus: item.itemStatus,
id: null
}
switch (type) {
case 'project':
temp['itemType'] = "01"
break;
case 'part':
temp['itemType'] = "02"
break;
case 'other':
temp['itemType'] = "03"
break;
default:
return "";
}
temp[type + 'Id'] = item.id
return temp;
})
},
}
}
</script>
<style scoped lang="scss">
.box-card {
margin-bottom: 10px;
}
</style>

View File

@ -44,7 +44,7 @@
<el-button size="mini" type="text" icon="el-icon-view" @click="handleShow(scope.row)"
>查看
</el-button>
<el-button v-if="userRole === 'service_advisor'" size="mini" type="text" icon="el-icon-setting">
<el-button @click="handleEdit(scope.row)" v-if="userRole === 'service_advisor'" size="mini" type="text" icon="el-icon-setting">
编辑工单
</el-button>
<el-button v-if="!(userRole === 'service_advisor' && scope.row.ticketsWorkStatus === '03')" size="mini" type="text" icon="el-icon-edit-outline" @click="handleDispose(scope.row)">
@ -97,20 +97,6 @@
<el-dialog title="通知客户取车" :visible.sync="noticeDialog" width="60%" v-dialogDrag append-to-body>
<el-form :model="noticeData" ref="noticeRef" :rules="noticeRules" v-loading="noticeLoading" :inline="true" label-width="20rem">
<el-row :gutter="1">
<el-col :span="24">
<el-form-item label="取车时间" prop="time">
<el-date-picker
value-format="yyyy-MM-dd"
v-model="noticeData.time"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="1">
<el-col :span="24">
<el-form-item label="联系人" prop="name">
@ -140,6 +126,7 @@
</el-dialog>
<UpdateRepair ref="updateRepair" @success="getList"/>
<EditTickets ref="editTickets" @success="getList"/>
</div>
</template>
@ -148,10 +135,11 @@ import {getPageByRole, inspection, confirm, noticeCus} from "@/api/repair/ticket
import TicketsShow from "@/views/repair/tickets/Components/TicketsShow.vue";
import UpdateRepair from "@/views/repair/tickets/form/UpdateRepair.vue";
import {getUserProfile} from "@/api/system/user";
import EditTickets from "@/views/repair/tickets/form/EditTickets.vue";
export default {
name: "TicketFinishManager",
components: {UpdateRepair, TicketsShow},
components: {EditTickets, UpdateRepair, TicketsShow},
props:{
userRole: String
},
@ -176,14 +164,12 @@ export default {
formRules:{},
formLoading:{},
noticeData:{
time: [],
name: null,
mobile: null,
id: null,
remark: null,
},
noticeRules:{
time: [{required: true, message: '时间不能为空', trigger: 'blur'}],
mobile: [{required: true, message: '联系电话不能为空', trigger: 'blur'}]
},
noticeLoading: false,
@ -283,6 +269,9 @@ export default {
this.$modal.msgSuccess("操作成功")
await this.getList()
}catch {}
},
handleEdit(row){
this.$refs.editTickets.open(row)
}
}
}