You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

258 lines
7.3 KiB

3 years ago
<template>
<div>
<div ref="lxHeader">
<lx-header icon="md-apps" style="margin-bottom: 10px; border: 0px; margin-top: 15px" text="排班管理">
<div slot="content"></div>
<slot>
<div style="display: flex">
3 years ago
<el-tag effect="dark" style="margin-right: 10px;" type="warning">应排客户{{statistics.need}}</el-tag>
<el-tag effect="dark" style="margin-right: 10px;" type="success">已排客户{{statistics.use}}</el-tag>
3 years ago
<Input v-model="select.keyword" placeholder="关键字搜索" style="width: 200px; margin-right: 10px"/>
3 years ago
<Button style="margin-right: 10px" type="primary" @click="select.page = 1,getCustomerList()">查询</Button>
<xy-selectors @search="select.page = 1,getCustomerList()" @reset="reset">
<template>
<div class="select-item">
<div class="select-item__label">业务板块</div>
<el-select size="small" v-model="select.product_type_id" placeholder="选择业务板块" clearable style="width: 200px">
<el-option v-for="item in types" :value="item.id" :label="item.name" :key="item.id"></el-option>
</el-select>
</div>
3 years ago
3 years ago
<div class="select-item">
<div class="select-item__label">所属区域</div>
<el-select size="small" v-model="select.area_id" placeholder="选择区域" clearable style="width: 200px">
<el-option v-for="item in areas" :value="item.id" :label="item.value" :key="item.id"></el-option>
</el-select>
</div>
<div class="select-item">
<div class="select-item__label">所属月份</div>
<el-date-picker
3 years ago
size="small"
3 years ago
v-model="select.month"
type="month"
value-format="yyyy-MM"
placeholder="选择月"
style="width: 200px">
</el-date-picker>
</div>
<div class="select-item">
<div class="select-item__label">状态</div>
<el-radio v-model="select.schedule_status" :label="1"></el-radio>
<el-radio v-model="select.schedule_status" :label="2"></el-radio>
<el-radio v-model="select.schedule_status" label=""></el-radio>
</div>
</template>
3 years ago
</xy-selectors>
</div>
</slot>
</lx-header>
</div>
<xy-table
:default-expand-all="false"
:list="list"
:table-item="table"
3 years ago
:total="total"
@pageSizeChange="e => select.page_size = e"
@pageIndexChange="e => {select.page = e;getCustomerList()}">
3 years ago
<template v-slot:btns>
3 years ago
<el-table-column :width="130" align="center" label="操作" fixed="right" header-align="center">
3 years ago
<template v-slot:default="scope">
3 years ago
<Button size="small" type="primary" ghost @click="schedule(scope.row)" style="margin-right: 6px;">排班</Button>
3 years ago
<template v-if="scope.row.service_times === 0">
<Poptip
transfer
confirm
title="确认要删除订单?"
@on-ok="deleteOrder(scope.row)">
<Button size="small" type="primary" ghost>删除</Button>
</Poptip>
</template>
3 years ago
</template>
</el-table-column>
3 years ago
</template>
</xy-table>
<add-schedule
ref="addSchedule"
:products="products"
:customers="customers"
3 years ago
:levels="levels"
3 years ago
:orders="orders"
@refresh="getCustomerList"></add-schedule>
3 years ago
</div>
</template>
<script>
import {customerList} from '@/api/schedule'
import {getList as productIndex} from '@/api/product'
import {getList as nurseIndex} from '@/api/worker'
import {getparameter} from '@/api/system/dictionary'
3 years ago
import {getList as typeIndex} from '@/api/productType'
3 years ago
import {destroy} from '@/api/order'
3 years ago
import addSchedule from "@/views/schedule/component/addSchedule";
export default {
components: {
addSchedule
},
data() {
return {
select: {
page: 1,
page_size: 10,
3 years ago
keyword:'',
product_type_id:'',
area_id:'',
month:'',
schedule_status:'',
},
statistics:{
use:0,
need:0
3 years ago
},
customers:[],
products:[],
levels:[],
3 years ago
orders:[],
3 years ago
accounts:[],
3 years ago
types:[],
areas:[],
3 years ago
total: 0,
list: [],
table: [
3 years ago
{
width: 40,
type:'index',
fixed:'left'
},
3 years ago
{
3 years ago
prop: 'customer.name',
3 years ago
label: '客户',
width: 180,
3 years ago
fixed:'left'
},
{
label:'产品',
width: 200,
align:'left',
3 years ago
prop:'product.name'
},
{
label:'上门区域',
width: 200,
customFn:(row) => {
3 years ago
return (
3 years ago
<div>{row.customer.area_detail?.value}</div>
3 years ago
)
}
3 years ago
},
{
prop: '',
label: '上门地址',
minWidth: 320,
align: 'left',
customFn: (row) => {
3 years ago
let add = row.customer.customer_address.filter(item => {
3 years ago
return item.default === 1
3 years ago
})[0]?.address || row.customer.customer_address[0]?.address || '无地址'
3 years ago
return (
<div>{add}</div>
)
}
},
{
label: '应服务次数',
width: 120,
3 years ago
prop:'service_times'
3 years ago
},
{
label: '已排班',
3 years ago
width: 120,
prop:'schedule_count'
3 years ago
},
3 years ago
]
}
},
methods: {
3 years ago
async getAreas(){
const res = await getparameter({number : 'changzhou'},false)
this.areas = res.detail
},
async getTypes(){
const res = await typeIndex({page_size:9999,page:1},false)
this.types = res.data
},
3 years ago
async getProducts(){
const res = await productIndex({page_size:9999,page:1},false)
this.products = res.data
},
async getLevels(){
const res = await getparameter({number:'disabilityLevel'})
this.levels = res.detail
},
3 years ago
deleteOrder(row){
console.log(row)
destroy(row.id).then(res => {
this.$successMessage('destroy', '订单')
this.getCustomerList()
})
},
3 years ago
async getCustomerList() {
const res = await customerList(this.select)
3 years ago
this.total = res.list.total
this.list = res.list.data
this.statistics.need = res.need_count
this.statistics.use = res.use_count
},
reset(){
this.select = {
page: 1,
page_size: 10,
keyword:'',
product_type_id:'',
area_id:'',
month:'',
schedule_status:'',
}
3 years ago
},
schedule(row){
3 years ago
this.$refs['addSchedule'].id = row.id
this.$refs['addSchedule'].addresses = row.customer.customer_address
3 years ago
this.$refs['addSchedule'].isShow = true
3 years ago
}
},
mounted() {
3 years ago
this.getTypes()
3 years ago
this.getProducts()
this.getLevels()
this.getCustomerList()
3 years ago
this.getAreas()
3 years ago
}
}
</script>
<style lang="scss" scoped>
3 years ago
.select-item{
display: flex;
align-items: center;
&__label{
width: 100px;
padding: 10px 10px;
}
}
3 years ago
</style>