parent
3a17c47217
commit
a9dc72aab4
@ -0,0 +1,352 @@
|
||||
<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 class="select">
|
||||
<div>
|
||||
<span>被护理人</span>
|
||||
<el-select
|
||||
v-load-more="getCustomers"
|
||||
:loading="customerLoading"
|
||||
remote
|
||||
:remote-method="customerRemote"
|
||||
filterable
|
||||
size="small"
|
||||
v-model="select.customer_id"
|
||||
placeholder="选择被护理人"
|
||||
clearable
|
||||
style="width: 160px;"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in customers"
|
||||
:value="item.id"
|
||||
:label="item.name"
|
||||
:key="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div>
|
||||
<span>关键词</span>
|
||||
<el-input size="small" style="width: 160px;" v-model="select.keyword" clearable placeholder="请输入关键词"></el-input>
|
||||
</div>
|
||||
<div>
|
||||
<Button type="primary" @click="total = 0,select.page = 1,getList()">查询</Button>
|
||||
</div>
|
||||
<div>
|
||||
<Button type="primary" @click="exportExcel">导出</Button>
|
||||
</div>
|
||||
</div>
|
||||
</slot>
|
||||
</lx-header>
|
||||
</div>
|
||||
|
||||
<xy-table
|
||||
:total="total"
|
||||
:list="list"
|
||||
:table-item="table"
|
||||
@editor="editor"
|
||||
@delete="destroy"
|
||||
@pageSizeChange="e => select.page_size = e"
|
||||
@pageIndexChange="e => {select.page = e;getList()}">
|
||||
<template v-slot:btns>
|
||||
<el-table-column label="操作" fixed="right" header-align="center" align="left" width="200">
|
||||
<template v-slot:default="scope">
|
||||
<Button
|
||||
size="small"
|
||||
type="primary"
|
||||
style="margin-right: 6px"
|
||||
@click="_ => {
|
||||
$refs['longInsuranceDetail'].setId(scope.row.id)
|
||||
$refs['longInsuranceDetail'].show()
|
||||
}"
|
||||
>查看</Button>
|
||||
<Poptip
|
||||
transfer
|
||||
confirm
|
||||
title="确认要删除?"
|
||||
@on-ok="destroy(scope.row)"
|
||||
>
|
||||
<Button size="small" type="error" ghost style="margin-right: 6px"
|
||||
>删除</Button
|
||||
>
|
||||
</Poptip>
|
||||
<Button size="small"
|
||||
ghost
|
||||
type="primary"
|
||||
@click="editor(scope.row)">编辑</Button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
</xy-table>
|
||||
|
||||
<add ref="add" :customer_ids="customers" :satisfys="satisfy" :nurse_investigates="nurse_investigate" @refresh="getList"></add>
|
||||
<longInsuranceDetail ref="longInsuranceDetail"></longInsuranceDetail>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getList,destroy} from '@/api/longInsurance'
|
||||
import {getList as customerIndex} from "@/api/customer";
|
||||
import {getList as nurseList} from "@/api/worker";
|
||||
import * as XLSX from "xlsx";
|
||||
import { saveAs } from "file-saver";
|
||||
import longInsuranceDetail from "@/views/customer/component/longInsuranceDetail.vue"
|
||||
import add from "./component/addLongInsurance.vue"
|
||||
export default {
|
||||
components:{
|
||||
add,
|
||||
longInsuranceDetail
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
satisfy: [
|
||||
{
|
||||
label: "90分以上",
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
label: "80-90分",
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
label: "80分以下",
|
||||
value: 3
|
||||
},
|
||||
],
|
||||
nurse_investigate: [
|
||||
{
|
||||
label: "护理中回访",
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
label: "日常回访",
|
||||
value: 2
|
||||
},
|
||||
],
|
||||
|
||||
customers:[],
|
||||
customerLoading: false,
|
||||
customerTotal: 0,
|
||||
customerSelect: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
keyword: ""
|
||||
},
|
||||
|
||||
|
||||
select:{
|
||||
page:1,
|
||||
page_size:10,
|
||||
customer_id: "",
|
||||
keyword: "",
|
||||
},
|
||||
|
||||
total:0,
|
||||
list:[],
|
||||
table:[
|
||||
{
|
||||
type: 'index',
|
||||
width: 50
|
||||
},
|
||||
{
|
||||
prop: "customer.name",
|
||||
label: "服务对象",
|
||||
width: 140
|
||||
},
|
||||
{
|
||||
prop: 'created_at',
|
||||
label: '回访日期',
|
||||
align: 'center',
|
||||
width: 160
|
||||
},
|
||||
{
|
||||
prop: 'satisfy',
|
||||
label: '服务满意度',
|
||||
width: 180,
|
||||
align: 'center',
|
||||
formatter: (data,row,val) => {
|
||||
return this.satisfy.find(i => i.value === val)?.label
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'nurse_investigate',
|
||||
label: '护理员护理情况调查',
|
||||
width: 180,
|
||||
formatter: (data,row,val) => {
|
||||
return this.nurse_investigate.find(i => i.value === val)?.label
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'is_work',
|
||||
label: '是否在岗',
|
||||
width: 120,
|
||||
align: 'center',
|
||||
formatter: (data, row, val) => {
|
||||
return val ? '是' : '否'
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'is_on_time',
|
||||
label: '按照排班时间上门服务',
|
||||
width: 154,
|
||||
align: 'center',
|
||||
formatter: (data, row, val) => {
|
||||
return val ? '是' : '否'
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'accessory',
|
||||
label: '是否有工作证、工作服',
|
||||
width: 160,
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'tools',
|
||||
label: '护理工具携带',
|
||||
width: 180,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
prop: 'serve',
|
||||
label: '服务内容',
|
||||
width: 180,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
prop: 'other',
|
||||
label: '其他需求',
|
||||
align: 'left',
|
||||
width: 180
|
||||
},
|
||||
{
|
||||
prop: 'tip',
|
||||
label: '建议',
|
||||
align: 'left',
|
||||
minWidth: 180
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async getCustomers(){
|
||||
|
||||
if ((this.customers.length >= this.customerTotal) && this.customers.length !== 0) return;
|
||||
this.customerLoading = true;
|
||||
try {
|
||||
const res = await customerIndex(this.customerSelect,false)
|
||||
this.customers.push(...res.data.data);
|
||||
this.customerTotal = res.data.total;
|
||||
this.customerSelect.page++;
|
||||
this.customerLoading = false;
|
||||
} catch (err) {
|
||||
this.customerLoading = false;
|
||||
}
|
||||
},
|
||||
customerRemote (query) {
|
||||
let keyword = query ? query.trim() : "";
|
||||
this.customers = [];
|
||||
this.customerTotal = 0;
|
||||
this.customerSelect.page = 1;
|
||||
this.customerSelect.keyword = keyword;
|
||||
|
||||
this.getCustomers();
|
||||
},
|
||||
|
||||
async getList(){
|
||||
const res = await getList(this.select)
|
||||
this.total = res.total
|
||||
this.list = res.data
|
||||
console.log(this.list)
|
||||
},
|
||||
|
||||
editor(row){
|
||||
this.$refs['add'].setId(row.id)
|
||||
this.$refs['add'].setType('editor')
|
||||
this.$refs['add'].show()
|
||||
},
|
||||
destroy(row){
|
||||
destroy(row.id).then(res => {
|
||||
this.$successMessage('destroy','')
|
||||
this.getList()
|
||||
})
|
||||
},
|
||||
|
||||
async exportExcel () {
|
||||
const res = await getList({
|
||||
...this.select,
|
||||
page: 1,
|
||||
page_size: 9999
|
||||
})
|
||||
const handlerValue = (key, obj) => {
|
||||
try {
|
||||
if (key.includes(".")) {
|
||||
let splitKey = key.split(".")
|
||||
let temp = obj;
|
||||
for (let i of splitKey) {
|
||||
if (i && typeof i === 'string' && typeof temp === 'object') {
|
||||
temp = temp[i]
|
||||
}
|
||||
}
|
||||
return temp
|
||||
} else {
|
||||
return obj[key]
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
if (res.data) {
|
||||
let header = this.table.slice(1).map(i => i.label)
|
||||
let data = res.data.map(i => {
|
||||
let temp = [];
|
||||
this.table.slice(1).forEach(row => {
|
||||
if (row.hasOwnProperty("formatter")) {
|
||||
temp.push(row.formatter(false, false, handlerValue(row.prop, i)))
|
||||
} else {
|
||||
temp.push(handlerValue(row.prop, i))
|
||||
}
|
||||
})
|
||||
return temp;
|
||||
})
|
||||
data.unshift(header)
|
||||
|
||||
const wb = XLSX.utils.book_new();
|
||||
const ws = XLSX.utils.aoa_to_sheet(data);
|
||||
XLSX.utils.book_append_sheet(wb, ws, "长护险回访明细");
|
||||
const wbout = XLSX.write(wb, {
|
||||
bookType: "xlsx",
|
||||
bookSST: true,
|
||||
type: "array",
|
||||
});
|
||||
saveAs(
|
||||
new Blob([wbout], { type: "application/octet-stream" }),
|
||||
`回访明细${this.$moment().format('YYYY-MM-DD')}.xlsx`
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getCustomers()
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.select {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
|
||||
& > div {
|
||||
margin: 2px 6px;
|
||||
|
||||
& > span {
|
||||
padding-right: 12px;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in new issue