xw_admin/src/views/order/orderPlan/index.vue
2024-10-17 19:55:08 +08:00

190 lines
6.2 KiB
Vue

<template>
<el-container class="mainBox mainHeaderNoBorderPadding">
<el-header class="header">
<div class="left-panel">
<el-button type="primary" v-auth="'repairOrderConfirm'" :size="size" icon="sc-icon-ConfirmOrder" @click="confirmOrder">确认工单</el-button>
</div>
</el-header>
<el-main class="nopadding">
<div class="flowPath">
<flow :list="flowList"/>
</div>
<div class="searchMain searchMainNoTop">
<scSearch ref="scSearch" :searchList="searchList" @fetchSelectData="getSelectData"></scSearch>
<div class="searchItem searchBtn">
<el-button :size="size" :icon="searchShow?'el-icon-ArrowUpBold':'el-icon-ArrowDownBold'" @click="searchShowClick">{{searchShow?'收起':'更多'}}</el-button>
<el-button :size="size" type="primary" icon="el-icon-search" @click="upSearch">查询</el-button>
<el-button :size="size" type="info" icon="el-icon-RefreshRight" @click="reset">重置</el-button>
</div>
</div>
<scTable ref="table" :apiObj="list.apiObj" :column="list.column" row-key="id" stripe :size="size" @selection-change="selectionChange">
<el-table-column type="selection" align="center" width="40"></el-table-column>
<sc-table-column label="序号" align="center" type="index"></sc-table-column>
<template #business_status="scope">
<span v-for="(item,ind) in statusList" :key="ind">
<span :style="{color:item.value==1?`var(--el-order-color-1)`:item.value==2?`var(--el-order-color-2)`:item.value==3?`var(--el-order-color-3)`:item.value==4?`var(--el-order-color-4)`:`var(--el-order-color-5)`}"
v-if="item.value == scope.row.business_status">{{item.label}}</span>
</span>
</template>
<template #repair_date="scope">{{scope.row.repair_order && scope.row.repair_order.repair_date?scope.row.repair_order.repair_date:''}}</template>
<template #schedule_date="scope">{{scope.row.repair_order && scope.row.repair_order.schedule_date?scope.row.repair_order.schedule_date:''}}</template>
<template #repair_status="scope">{{scope.row.repair_order && scope.row.repair_order.repair_status?scope.row.repair_order.repair_status:''}}</template>
<el-table-column label="操作" fixed="right" align="center" width="150">
<template #default="scope">
<el-dropdown>
<el-button class="noBorderBtn" icon="el-icon-more" :size="size"></el-button>
<template #dropdown>
<el-dropdown-menu>
<div v-auth="'repairOrderConfirm'">
<el-dropdown-item icon="sc-icon-ConfirmOrder" @click="confirmOrderClick(scope.row)">确认工单</el-dropdown-item>
</div>
<div v-auth="'order_plan_detail'">
<el-dropdown-item @click="table_show(scope.row, 'see')" icon="sc-icon-See">工单详情</el-dropdown-item>
</div>
</el-dropdown-menu>
</template>
</el-dropdown>
</template>
</el-table-column>
</scTable>
</el-main>
</el-container>
<confirm-dialog v-if="dialog.confirm" ref="confirmDialog" @success="handleSaveSuccess" @closed="dialog.confirm=false"></confirm-dialog>
</template>
<script>
import flow from '../orderList/components/flow'
import confirmDialog from './confirmOrder'
import {eventBus} from "@/utils/eventBus";
export default {
components: {
flow,
confirmDialog,
},
data() {
return {
size:'small',
flowList:[
{name:'确认工单',left:false,right:true},
{name:'下发维保',left:true,right:false},
],
dialog: {
confirm: false,
show: false,
},
list: {
apiObj: this.$API.orders.order.plan.list,
column: [],
},
selection: [],
exportShow:false,
searchShow:false,
searchList:[
{name:'维修单号',type:'text',code:'repair_order_no', data:[], placeholder:"请输入维修单号",show:true},
{name:'故障类型',type:'select',code:'fault_type', data:[], placeholder:"请选择故障类型",show:true},
{name:'整机型号',type:'select',code:'repair_status', data:[], placeholder:"请选择整机型号",isOpen:true,show:true},
{name:'园区名称',type:'select',code:'repair_status', data:[], placeholder:"请选择园区名称",isOpen:true,show:false},
{name:'故障描述',type:'text',code:['fault_description'],placeholder:"请输故障描述",isOpen:true,show:false},
{name:'关键字',type:'text',code:['fault_description','device_sn'],keyword:true,show:true},
],
params: {},
statusList:[],
}
},
methods: {
searchShowClick(){
this.searchShow = !this.searchShow;
this.searchList.forEach(item=>{
if(item.isOpen){
item.show = this.searchShow
}
})
},
async getSelectData(item) {
let {data, params} = item;
this.params = params;
let searchParams = this.$TOOL.objCopy(params);
searchParams.field = ""
if (typeof data.code === 'string') {
searchParams.field = data.code;
} else {
searchParams.field = data.code[0];
}
if (data.type == 'select') {
const res = await this.$API.orders.order.maintenance.field.post(searchParams);
if (res.code == 200) {
if (res.data && res.data.length > 0) {
res.data.forEach(item => {
item.label = item[data.code];
})
}
this.searchList.forEach(item => {
if (item.code == data.code) {
item.data = res.data;
}
})
}
}
},
confirmOrder(){
this.dialog.confirm = true;
this.$nextTick(() => {
this.$refs.confirmDialog.open('confirm').setData(this.selection)
})
},
// 数据确认
confirmOrderClick(row){
this.dialog.confirm = true;
this.$nextTick(() => {
this.$refs.confirmDialog.open('confirm').setData([row])
})
},
//查看
table_show(row){
eventBus.$emit('tagClose','/order/order-info',{id:row.id});
},
//表格选择后回调事件
selectionChange(selection){
this.selection = selection;
},
upSearch(){
this.$refs.table.upData(this.params);
},
reset(){
this.params = {};
this.$refs.scSearch.reload();
this.$refs.table.reload();
},
handleSaveSuccess(){
this.$refs.table.refresh();
},
}
}
</script>
<style lang="scss" scoped>
.mainBox{
padding: 0;
.header{
padding: 0 10px;
}
.searchMain{
margin-left: 10px;
margin-right: 10px;
}
.scTable{
padding: 0 10px;
}
}
.logoCell{
display: flex;
align-items: center;
height: 20px;
margin: 0 auto;
}
</style>