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.

196 lines
4.8 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="select.page = 1,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"
3 years ago
:orders="orders"
:skus="skus" :accounts="accounts"></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'
3 years ago
import {getList as skuIndex} from '@/api/sku'
3 years ago
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
skus:[],
accounts:[],
3 years ago
total: 0,
list: [],
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: {
3 years ago
async getAccounts(){
const res = await getparameter({number:'account'})
this.accounts = res.detail
},
async getSkus(){
const res = await skuIndex({page_size:9999,page:1})
this.skus = res.data
},
3 years ago
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()
3 years ago
this.getSkus()
this.getAccounts()
3 years ago
}
}
</script>
<style lang="scss" scoped>
</style>