Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
许允枞 2024-10-25 14:13:54 +08:00
commit 849fbe4585
13 changed files with 790 additions and 57 deletions

View File

@ -56,7 +56,7 @@ export function exportOrderInfoExcel(params) {
export function toPay(params) {
return request({
url: '/admin-api/pay/toPay',
url: '/admin-api/pay/toPayCode',
method: 'get',
params
})

View File

@ -0,0 +1,18 @@
import request from '@/utils/request'
// 根据条件查询维修记录
export function queryList(params){
return request({
url: '/dl/repair-records/list',
method: 'get',
params
})
}
// 设置图片是否开放给用户
export function updateOpen(ids, isOpen){
return request({
url: '/dl/repair-records-item/updateOpen?ids=' + ids + '&isOpen=' + isOpen,
method: 'get',
})
}

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

@ -37,8 +37,9 @@ const permission = {
// 将 menus 菜单,转换为 route 路由数组
const sdata = JSON.parse(JSON.stringify(menus)) // 【重要】用于菜单中的数据
const rdata = JSON.parse(JSON.stringify(menus)) // 用于最后添加到 Router 中的数据
const sidebarRoutes = filterAsyncRouter(sdata)
const rewriteRoutes = filterAsyncRouter(rdata, false, true)
const sss = JSON.parse(JSON.stringify(menus))
const sidebarRoutes = filterAsyncRouter(sdata,sss)
const rewriteRoutes = filterAsyncRouter(rdata,sss, false, true)
rewriteRoutes.push({path: '*', redirect: '/404', hidden: true})
commit('SET_ROUTES', rewriteRoutes)
commit('SET_SIDEBAR_ROUTERS', constantRoutes.concat(sidebarRoutes))
@ -51,13 +52,12 @@ const permission = {
}
// 遍历后台传来的路由字符串,转换为组件对象
function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
function filterAsyncRouter(asyncRouterMap,sdata, lastRouter = false, type = false) {
return asyncRouterMap.filter(function(route,index) {
// 将 ruoyi 后端原有耦合前端的逻辑,迁移到此处
// 处理 meta 属性
route.meta = {
title:dealMenuText(index) +' '+ route.name,
icon: route.icon,
title:dealMenuText(index,route,sdata) +' '+ route.name,
noCache: !route.keepAlive,
}
route.hidden = !route.visible
@ -89,23 +89,56 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
route.children = filterChildren(route.children)
}
if (route.children != null && route.children && route.children.length) {
route.children = filterAsyncRouter(route.children, route, type)
route.children = filterAsyncRouter(route.children,sdata, route, type)
route.alwaysShow = route.alwaysShow !== undefined ? route.alwaysShow : true
} else {
delete route['children']
delete route['alwaysShow'] // 如果没有子菜单,就不需要考虑 alwaysShow 字段
}
console.log(route,989898)
return true
})
}
function dealMenuText(num){
let tempData =['(一)','(二)','(三)','(四)','(五)','(六)','(七)','(八)','(九)','(十)'
,'(十一)','(十二)','(十三)','(十四)','(十五)','(十六)','(十七)','(十八)','(十九)','(二十)','(二十一)','(二十二)','(二十三)']
function dealMenuText(num,data,list){
if (data.parentId==0){
let tempData =['一','二','三','四','五','六','七','八','九','十'
,'十一','十二','十三','十四','十五','十六','十七','十八','十九','二十','二十一','二十二','二十三']
if (num>tempData.length){
return "";
}
return tempData[num]
return tempData[num] +'、'
}else {
let level =1;
let parData ={};
for (const item of list) {
if ( data.parentId == item.id){
parData = item
level++
break;
}
}
for (const item of list) {
if ( parData.parentId == 0){
parData = item
level++
break;
}
}
if (level==2){
let tempData2 =['(一)','(二)','(三)','(四)','(五)','(六)','(七)','(八)','(九)','(十)'
,'(十一)','(十二)','(十三)','(十四)','(十五)','(十六)','(十七)','(十八)','(十九)','(二十)','(二十一)','(二十二)','(二十三)']
if (num>tempData2.length){
return "";
}
return tempData2[num]
}else if (level == 3){
return (num+1)+'.'
}else {
return ""
}
}
}
function filterChildren(childrenMap, lastRouter = false) {
let children = [];

View File

@ -220,6 +220,8 @@ export const DICT_TYPE = {
TICKET_WARES_STATUS: 'ticket_wares_status',
// 领料、退料配件状态
TW_ITEM_STATUS: 'tw_item_status',
// 维修记录类型
REPAIR_RECORDS_TYPE: 'repair_records_type',
// ---------会员相关---------member_coupon_typemember_coupon_out_rulemember_carmember_active
//卡券类型

View File

@ -1,14 +1,15 @@
<template>
<div class="container_">
<el-row>
<el-col v-for="item in serviceList" :span="4">
<div class="top-list">
<div class="list-box" v-for="item in serviceList" :span="4">
<div @click="goRoute(item.id)">
<image-preview :width="300" :height="300" :src="item.coverImg"></image-preview>
{{ item.name }}
<img :src=" imgUrl + item.coverImg" style="width: 300px; height: 300px;">
<!-- <image-preview :width="300" :height="300" :src="item.coverImg"></image-preview>-->
<div style="font-weight: bold;text-align: center;font-size: 25px">{{ item.name }}</div>
</div>
</el-col>
</el-row>
</div>
</div>
<div class="container-box">
<div class="flex-box">
@ -117,6 +118,7 @@ export default {
},
data() {
return {
imgUrl:'',
lineChartData: lineChartData.newVisitis,
serviceList: [],
warnList: [],
@ -137,6 +139,8 @@ export default {
this.getServiceList()
this.getNotifyMessage()
this.getWarnList()
this.imgUrl = process.env.VUE_APP_IMAGE_URL
console.log( this.imgUrl + '1111111' )
},
methods: {
handleSetLineChartData(type) {
@ -179,6 +183,20 @@ export default {
box-sizing: border-box;
padding: 15px;
}
.top-list{
width: 100%;
display: flex;
justify-content: space-between;
margin-bottom: 25px;
}
.list-box{
background: #fff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
border-radius: 4px;
box-sizing: border-box;
padding: 15px;
border-radius: 8px;
}
.container-box{
width: 100%;
display: flex;

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"
@ -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

@ -44,6 +44,9 @@
<el-button size="mini" type="text" icon="el-icon-view" @click="handleShow(scope.row)"
>查看
</el-button>
<el-button v-if="userRole === 'service_advisor' && isFinish" size="mini" type="text" icon="el-icon-refresh" @click="handleEditRecord(scope.row)">
维修记录设置
</el-button>
<el-button
v-if="(scope.row.ticketsWorkStatus === '01' && userRole === 'repair_staff') && nowUser.id === scope.row.nowRepairId"
size="mini" type="text" icon="el-icon-check" @click="handleTake(scope.row)">
@ -91,6 +94,11 @@
command="handleReTake" size="mini" type="text" icon="el-icon-refresh"
>重新指派
</el-dropdown-item>
<el-dropdown-item
v-if="userRole === 'service_advisor' && !isFinish && scope.row.ticketsWorkStatus !== '01'"
command="handleEditRecord" size="mini" type="text" icon="el-icon-refresh"
>维修记录设置
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
@ -138,6 +146,8 @@
<el-button @click="doBack(true)" type="success" :disabled="partList.length === 0">退料全部</el-button>
</div>
</el-dialog>
<RecordSetting ref="recordSet" />
</div>
</template>
@ -151,10 +161,11 @@ import {updateTicketWares} from "@/api/repair/tickets/TicketWares";
import {getIfLeader} from "@/api/repair/repairworker";
import UpdateRecord from "@/views/repair/tickets/form/UpdateRecord.vue";
import {getUserProfile} from "@/api/system/user";
import RecordSetting from "@/views/repair/tickets/form/RecordSetting.vue";
export default {
name: "TicketManagerItem",
components: {UpdateRecord, TWOperate, UpdateRepair, TicketsShow},
components: {RecordSetting, UpdateRecord, TWOperate, UpdateRepair, TicketsShow},
props: {
isFinish: {
type: Boolean,
@ -192,7 +203,7 @@ export default {
formData: {},
remark: null,
leader: false,
nowUser: null
nowUser: null,
}
},
mounted() {
@ -294,6 +305,9 @@ export default {
case 'handleBack':
this.handleBack(row)
break
case 'handleEditRecord':
this.handleEditRecord(row)
break
default:
break
}
@ -379,7 +393,11 @@ export default {
clickType: type
}
this.$refs.updateRecord.open(row)
}
},
//
handleEditRecord(row){
this.$refs.recordSet.open(row.id)
},
}
}
</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

@ -0,0 +1,188 @@
<template>
<div>
<el-dialog title="维修记录" :visible.sync="recordDialog" width="80%" v-dialogDrag append-to-body ref="recordRef">
<el-form :model="recordQuery" :inline="true" ref="recordQueryForm" label-width="10rem">
<el-form-item label="项目" prop="repairItemId">
<el-select v-model="recordQuery.repairItemId" clearable filterable>
<el-option v-for="project in projectList" :key="project.id" :label="project.itemName" :value="project.id" />
</el-select>
</el-form-item>
<el-form-item label="记录类型" prop="type">
<el-select v-model="recordQuery.type" clearable filterable>
<el-option v-for="item in this.getDictDatas(DICT_TYPE.REPAIR_RECORDS_TYPE)" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleRecordQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetRecordQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table :data="recordList" :stripe="true" :show-overflow-tooltip="true" v-loading="recordTableLoading">
<el-table-column label="序号" align="center" width="55">
<template scope="scope">
<span>{{ scope.$index + 1 }}</span>
</template>
</el-table-column>
<el-table-column label="记录类型" align="center" prop="type" width="180">
<template slot-scope="scope">
<dict-tag :type="DICT_TYPE.REPAIR_RECORDS_TYPE" :value="scope.row.type" />
</template>
</el-table-column>
<el-table-column label="项目名称" align="center" prop="repairItemId" width="200">
<template slot-scope="scope">
{{getProjectName(scope.row.repairItemId)}}
</template>
</el-table-column>
<el-table-column label="描述" align="center" prop="remark" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" width="180">
<template slot-scope="scope">
<el-button type="text" size="mini" @click="handleSetting(scope.row)">
设置客户查看权限
</el-button>
</template>
</el-table-column>
</el-table>
</el-dialog>
<el-dialog title="客户查看权限设置" :visible.sync="settingDialog" v-dialogDrag append-to-body width="60%">
<el-row :gutter="1">
<el-col :span="24">
<el-radio v-model="radio" label="-1">全部</el-radio>
<el-radio v-model="radio" label="0">客户不可见</el-radio>
<el-radio v-model="radio" label="1">客户可见</el-radio>
</el-col>
</el-row>
<el-table :data="items" :stripe="true" :show-overflow-tooltip="true" @selection-change="selectRow">
<el-table-column align="center" type="selection" width="55" />
<el-table-column align="center" label="图片" prop="image">
<template slot-scope="scope">
<el-image
style="width: 100px; height: 100px"
:src="scope.row.image"
:preview-src-list="srcList">
</el-image>
</template>
</el-table-column>
<el-table-column align="center" label="状态" prop="isOpen">
<template slot-scope="scope">
{{scope.row.isOpen === '0' ? '客户不可见' : '客户可见'}}
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="success" :disabled="!(selectRows.length > 0 && radio !== '1')" @click="doUpdate('1')">设置客户可见</el-button>
<el-button type="danger" :disabled="!(selectRows.length > 0 && radio !== '0')" @click="doUpdate('0')">设置客户不可见</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {queryList, updateOpen} from "@/api/repair/repairRecord";
import {getTicketsById} from "@/api/repair/tickets/Tickets";
export default {
name: "RecordSetting",
data(){
return {
recordDialog: false,
recordQuery:{
ticketId: null,
repairItemId: null,
dealUserId: null,
type: null
},
recordList: [],
dialogLoading: null,
projectList: [],
recordTableLoading: false,
items: [],
settingDialog: false,
srcList: [],
radio: '-1',
finalItems: [],
selectRows: []
}
},
watch:{
radio(val){
this.filterByRadio(val)
}
},
methods:{
async open(id){
this.resetForm("recordQueryForm")
this.recordQuery.ticketId = id
try {
this.recordDialog = true
this.dialogLoading = this.$loading({
target: this.$refs.recordRef.$el
})
const response = await getTicketsById(id)
this.projectList = response.data.projects
await this.getRecordList()
}finally {
this.dialogLoading.close()
}
},
async getRecordList(){
try {
this.recordTableLoading = true
const res = await queryList(this.recordQuery)
this.recordList = res.data
}finally {
this.recordTableLoading = false
}
},
handleRecordQuery(){
this.getRecordList()
},
resetRecordQuery(){
const id = this.recordQuery.ticketId
this.resetForm('recordQueryForm')
this.recordQuery.ticketId = id
this.handleRecordQuery()
},
getProjectName(id){
return this.projectList.filter(item => item.id === id)?.[0]?.itemName || "无项目"
},
handleSetting(row){
this.radio = '-1'
this.items = row.itemList
this.items = [...this.items.map(item => {
return {
...item,
image: process.env.VUE_APP_FILE_API + item.image
}
})]
this.finalItems = this.items
this.srcList = this.items.map(item => item.image)
this.settingDialog = true
},
filterByRadio(val){
if (val === '-1'){
this.items = this.finalItems
}else {
this.items = this.finalItems.filter(item => item.isOpen === val)
}
this.srcList = this.items.map(item => item.image)
},
selectRow(val){
this.selectRows = val
},
async doUpdate(isOpen){
try {
const ids = this.selectRows.map(item => item.id).join(",")
await updateOpen(ids, isOpen)
this.settingDialog = false
await this.getRecordList()
this.$modal.msgSuccess("设置成功")
}catch{}
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@ -44,9 +44,12 @@
<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'" size="mini" type="text" icon="el-icon-refresh" @click="handleEditRecord(scope.row)">
维修记录设置
</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)">
处理
</el-button>
@ -97,20 +100,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 +129,8 @@
</el-dialog>
<UpdateRepair ref="updateRepair" @success="getList"/>
<EditTickets ref="editTickets" @success="getList"/>
<RecordSetting ref="recordSet" />
</div>
</template>
@ -148,10 +139,12 @@ 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";
import RecordSetting from "@/views/repair/tickets/form/RecordSetting.vue";
export default {
name: "TicketFinishManager",
components: {UpdateRepair, TicketsShow},
components: {RecordSetting, EditTickets, UpdateRepair, TicketsShow},
props:{
userRole: String
},
@ -176,14 +169,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,7 +274,14 @@ export default {
this.$modal.msgSuccess("操作成功")
await this.getList()
}catch {}
}
},
handleEdit(row){
this.$refs.editTickets.open(row)
},
//
handleEditRecord(row){
this.$refs.recordSet.open(row.id)
},
}
}
</script>