master
xy 3 years ago
parent d8b46147bd
commit bb0dd27ffc

@ -32,3 +32,11 @@ export function destroy(id,data){
data
})
}
export function scheduleListSkus(params){
return request({
method:'get',
url:'/api/admin/customer/schedule_list_skus',
params
})
}

@ -0,0 +1,92 @@
import axios from 'axios'
import { getToken } from '@/utils/auth'
import { Loading, Message } from 'element-ui'
/*
* @params {string} url 请求拼接地址
* @params {object} info 请求参数params或data
*/
let loading;
export async function download(url,method='get',info,filename){
loading = Loading.service({
lock:true,
background:"rgba(0,0,0,0.4)",
text:"文件正在生成中..."
})
let options = {
baseURL:process.env.VUE_APP_BASE_API,
url,
method,
responseType: 'blob',
timeout:10000,
headers: {
Accept: 'application/json','Content-Type':'application/json; charset=utf-8',
withCredentials: true,
Authorization:"Bearer " + getToken()
},
}
if(method === 'get'){
Object.defineProperty(options,'params',{
value:info,
enumerable:true,
writable:false
})
}
if(method === 'post'){
Object.defineProperty(options,'data',{
value:info,
enumerable:true,
writable:false
})
}
try {
const response = await axios.request(options)
loading.close()
// 提取文件名
if(!filename){
filename = response.headers['content-disposition']?.match(
/filename=(.*)/
)[1] || ''
}
// 将二进制流转为blob
const blob = new Blob([response.data], { type: 'application/octet-stream' })
if (typeof window.navigator.msSaveBlob !== 'undefined') {
// 兼容IEwindow.navigator.msSaveBlob以本地方式保存文件
window.navigator.msSaveBlob(blob, decodeURI(filename))
} else {
// 创建新的URL并指向File对象或者Blob对象的地址
const blobURL = window.URL.createObjectURL(blob)
// 创建a标签用于跳转至下载链接
const tempLink = document.createElement('a')
tempLink.style.display = 'none'
tempLink.href = blobURL
tempLink.setAttribute('download', decodeURI(filename))
// 兼容某些浏览器不支持HTML5的download属性
if (typeof tempLink.download === 'undefined') {
tempLink.setAttribute('target', '_blank')
}
// 挂载a标签
document.body.appendChild(tempLink)
tempLink.click()
document.body.removeChild(tempLink)
// 释放blob URL地址
window.URL.revokeObjectURL(blobURL)
}
}catch (err){
console.error(err)
loading.close()
Message({
type:'error',
message:err
})
}
}

@ -32,6 +32,24 @@
</div>
</template>
<template v-slot:product_type_customer_links>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>关联业务板块
</div>
<div class="xy-table-item-content">
<el-select
multiple
:value="form.product_type_customer_links.map(item => item.product_type_id)"
placeholder="请选择业务板块"
style="width: 300px"
@change="productTypePick">
<el-option v-for="item in types" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:phone>
<div class="xy-table-item">
<div class="xy-table-item-label">
@ -209,11 +227,10 @@
</div>
<div class="xy-table-item-content">
<el-select
:disabled="flag !== 1"
:value="flag ===1 ? form.product_type_id : form1.product_type_id"
disabled
v-model="form1.product_type_id"
placeholder="请选择业务板块"
style="width: 300px"
@change="e => flag === 1 ? form.product_type_id = e : form1.product_type_id = e">
style="width: 300px">
<el-option v-for="item in types" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</div>
@ -317,6 +334,13 @@ export default {
callback(new Error('联系电话格式错误'))
}
}
const validateProductType = (rule,value,callback) => {
if(this.form.product_type_customer_links.length <= 0 ){
callback(new Error('请选择关联板块'))
}else{
callback()
}
}
return {
flag:1,//step
id: '',
@ -417,7 +441,7 @@ export default {
form: {
name: '',
product_type_id:'',
product_type_customer_links:[],
phone: '',
idcard: '',
contact_name: '',
@ -459,6 +483,9 @@ export default {
],
level_id: [
{required: true, message: '请选择失能等级'},
],
product_type_customer_links:[
{validator: validateProductType}
]
},
map: [],
@ -570,7 +597,7 @@ export default {
init(){
this.form = {
name: '',
product_type_id:'',
product_type_customer_links:[],
phone: '',
idcard: '',
contact_name: '',
@ -600,6 +627,14 @@ export default {
areaPick(e){
console.log(e)
},
productTypePick(e){
this.form.product_type_customer_links = e.map(item => {
return {
product_type_id:item
}
})
console.log(this.form.product_type_customer_links)
},
deleteAddress({$index,row}){
this.form.customer_address_list.splice($index,1)

@ -8,7 +8,7 @@
<slot>
<div>
<el-select v-model="select.product_type_id" size="small" style="margin-right: 10px;">
<el-select placeholder="关联板块" multiple v-model="select.product_type_id" size="small" style="width:300px;margin-right: 10px;">
<el-option v-for="(item,index) in types" :key="item.id" :value="item.id" :label="item.name" ></el-option>
</el-select>

@ -33,6 +33,7 @@
</template>
<Input v-model="select.keyword" placeholder="关键字搜索" style="width: 200px; margin-right: 10px"/>
<Button style="margin-left: 10px" type="primary" @click="select.page = 1,getList()">查询</Button>
<Button style="margin-left: 10px" type="primary" @click="exportServe"></Button>
</div>
</slot>
</lx-header>
@ -60,6 +61,7 @@
<script>
import {serveList} from '@/api/serveDetail'
import {parseTime,getAgeByIdcard} from "@/utils"
import { download } from '@/utils/downloadRequest'
import serveDraw from "@/views/finance/component/serveDraw";
export default {
@ -131,6 +133,17 @@ export default {
}
},
methods: {
exportServe(){
download('/api/admin/customer/schedule_list_skus','get',{
start_date:this.$moment(this.select.month).startOf('month').format('YYYY-MM-DD'),
end_date:this.$moment(this.select.month).endOf('month').format('YYYY-MM-DD'),
page:1,
page_size:9999,
is_export:1
},'服务统计表.xls')
},
datePick(){
if(this.datePickMode){
this.select.year = ''

Loading…
Cancel
Save