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.

245 lines
6.9 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">
<el-tag effect="dark" style="margin-right: 10px;" type="warning">应排客户</el-tag>
<el-tag effect="dark" style="margin-right: 10px;" type="success">已排客户</el-tag>
<Input placeholder="关键字搜索" style="width: 200px; margin-right: 10px"/>
3 years ago
<Button style="margin-right: 10px" type="primary" @click="getCustomers"></Button>
3 years ago
<xy-selectors>
</xy-selectors>
</div>
</slot>
</lx-header>
</div>
<xy-table
:default-expand-all="false"
:list="list"
:table-item="table"
:total="total">
<template v-slot:btns>
3 years ago
<el-table-column :width="70" align="center" label="操作" fixed="right" header-align="center">
<template v-slot:default="scope">
<Button size="small" type="primary" ghost @click="schedule(scope.row)"></Button>
</template>
</el-table-column>
3 years ago
</template>
</xy-table>
<add-schedule
ref="addSchedule"
:products="products"
:customers="customers"
:nurses="nurses"
3 years ago
:levels="levels"
:orders="orders"></add-schedule>
3 years ago
</div>
</template>
<script>
import {customerList} from '@/api/schedule'
import {getList as customerIndex} from '@/api/customer'
import {getList as productIndex} from '@/api/product'
import {getList as nurseIndex} from '@/api/worker'
import {getparameter} from '@/api/system/dictionary'
import addSchedule from "@/views/schedule/component/addSchedule";
export default {
components: {
addSchedule
},
data() {
return {
select: {
page: 1,
page_size: 10,
},
customers:[],
products:[],
nurses:[],
levels:[],
3 years ago
orders:[],
3 years ago
total: 0,
list: [],
table: [
3 years ago
// {
// type: 'expand',
// expandFn: (props) => {
// let {$refs} = this
// return (
// <xy-table
// style={{'margin':'0 20px','filter':'drop-shadow(0 2px 16px rgba(200,200,200,0.8))'}}
// is-page={false}
// height={240}
// list={props.row.orders}
// table-item={
// [
// {
// prop: 'no',
// label: '订单编号',
// width: 210,
// sortable: false
// },
// {
// prop: 'product.name',
// label: '产品',
// minWidth: 200,
// sortable: false
// },
// {
// label: '排班状态',
// width: 160,
// sortable: false
// }
// ]
// }
// scopedSlots={{
// btns() {
// return (
// <el-table-column
// width={70}
// header-align="center"
// align="center"
// label="操作"
// scopedSlots={{
// default(scope) {
// return (
// <Button
// type="primary"
// size="small"
// on={{
// ['click']: () => {
// $refs['addSchedule'].form.product_id = scope.row.product_id
// $refs['addSchedule'].form.customer_id = scope.row.customer_id
// $refs['addSchedule'].form.order_id = scope.row.id
// $refs['addSchedule'].isShow = true
// }
// }}>排班</Button>
// )
// }
// }}>
// </el-table-column>
// )
// }
// }}>
//
// </xy-table>
// )
// }
// },
3 years ago
{
width: 40,
type:'index',
fixed:'left'
},
3 years ago
{
prop: 'name',
label: '客户',
width: 180,
3 years ago
fixed:'left'
},
{
label:'产品',
width: 200,
align:'left',
customFn:(row)=>{
return (
<div>{row.orders[0]?.product.name}</div>
)
}
3 years ago
},
{
prop: '',
label: '上门地址',
minWidth: 320,
align: 'left',
customFn: (row) => {
let add = row.customer_address.filter(item => {
return item.default === 1
})[0]?.address || row.customer_address[0]?.address || '无地址'
return (
<div>{add}</div>
)
}
},
{
label: '应服务次数',
width: 120,
customFn: (row) => {
3 years ago
let total = 0;
row.orders.map(item => {
total += item.service_times
})
3 years ago
return (
3 years ago
<div>
{
total
}
</div>
3 years ago
)
}
},
{
label: '已排班',
width: 120
3 years ago
},
{
label:'排班状态',
width: 140,
3 years ago
}
]
}
},
methods: {
async getCustomers(){
const res = await customerIndex({page_size:9999,page:1},false)
this.customers = res.data.data
},
async getProducts(){
const res = await productIndex({page_size:9999,page:1},false)
this.products = res.data
},
async getNurses(){
const res = await nurseIndex({page_size:9999,page:1},false)
this.nurses = res.data
},
async getLevels(){
const res = await getparameter({number:'disabilityLevel'})
this.levels = res.detail
},
async getCustomerList() {
const res = await customerList(this.select)
this.total = res.total
this.list = res.data
3 years ago
},
schedule(row){
this.$refs['addSchedule'].detail = row
this.$refs['addSchedule'].form.customer_id = row.id
this.orders = row.orders
this.$refs['addSchedule'].isShow = true
3 years ago
}
},
mounted() {
this.getCustomers()
this.getProducts()
this.getNurses()
this.getLevels()
this.getCustomerList()
}
}
</script>
<style lang="scss" scoped>
</style>