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.
576 lines
16 KiB
576 lines
16 KiB
<template> |
|
<basic-container v-loading="details.loadingObj.pageLoading"> |
|
<div class="avue-crud"> |
|
<!-- 搜索模块 --> |
|
<div v-h5uShow="search"> |
|
<!-- 查询模块 --> |
|
<el-form :inline="true" :model="details.query" class="header_search"> |
|
<el-form-item |
|
v-for="item in details.titleSearchOption" |
|
:key="item.prop" |
|
:label="item.label" |
|
> |
|
<template v-if="item.type === 'input'"> |
|
<el-input |
|
v-model.trim="details.query[item.prop]" |
|
:placeholder="`请输入${item.label}`" |
|
clearable |
|
></el-input> |
|
</template> |
|
|
|
<template v-else-if="item.type === 'select'"> |
|
<el-select |
|
v-model="details.query[item.prop]" |
|
:placeholder="`请选择${item.label}`" |
|
clearable |
|
> |
|
<el-option |
|
v-for="value in item.checkarr" |
|
:key="value.value" |
|
:label="value.label" |
|
:value="value.value" |
|
/> |
|
</el-select> |
|
</template> |
|
|
|
<template v-else-if="item.type === 'selectall'"> |
|
<el-select |
|
v-model="details.query[item.prop]" |
|
multiple |
|
filterable |
|
collapse-tags |
|
popper-class="custom-header" |
|
:max-collapse-tags="2" |
|
:placeholder="`请选择${item.label}`" |
|
style="width: 240px" |
|
clearable |
|
> |
|
<el-option |
|
v-for="value in item.checkarr" |
|
:key="value.value" |
|
:label="value.label" |
|
:value="value.value" |
|
/> |
|
</el-select> |
|
</template> |
|
|
|
<template v-else-if="item.type === 'time'"> |
|
<el-date-picker |
|
v-model="details.query[item.prop]" |
|
type="daterange" |
|
range-separator="-" |
|
start-placeholder="开始时间" |
|
end-placeholder="结束时间" |
|
value-format="YYYY-MM-DD" |
|
clearable |
|
/> |
|
|
|
<!-- <el-date-picker |
|
v-model="query.timeArr" |
|
type="daterange" |
|
range-separator="-" |
|
start-placeholder="开始时间" |
|
end-placeholder="结束时间" |
|
value-format="YYYY-MM-DD" |
|
/> --> |
|
</template> |
|
</el-form-item> |
|
|
|
<!-- 查询按钮 --> |
|
<el-form-item class="el-btn"> |
|
<el-button type="primary" icon="el-icon-search" @click="searchChange">搜 索</el-button> |
|
<el-button icon="el-icon-delete" @click="searchReset">清 空</el-button> |
|
</el-form-item> |
|
</el-form> |
|
</div> |
|
|
|
<!-- 控件模块 --> |
|
<div class="avue-crud__header flex-c-sb"> |
|
<!-- 头部左侧按钮模块 --> |
|
<div class="avue-crud__left"> |
|
<el-button type="primary" icon="Download" @click="ExportData"> 导出 </el-button> |
|
</div> |
|
<!-- 头部右侧按钮模块 --> |
|
<div class="avue-crud__right"> |
|
<el-button icon="el-icon-refresh" @click="searchChange" circle></el-button> |
|
<el-button icon="Operation" @click="showdrawer(true)" circle></el-button> |
|
<el-button icon="Search" @click="searchHide" circle></el-button> |
|
</div> |
|
</div> |
|
|
|
<!-- 表格 --> |
|
<!-- 列表模块 --> |
|
<tablecmt |
|
ref="tableNodeRef" |
|
:columnList="details.columnList" |
|
:tableData="details.data" |
|
:loading="loadingObj.list" |
|
@inputTxt="inputsc" |
|
@timeCheck="timesc" |
|
@btnCheck="btnsc" |
|
@selectCheck="selectsc" |
|
@selection="selectionChange" |
|
> |
|
<template #default="{ scope: { row, column } }"> |
|
<template v-if="column.label === '运单号'"> |
|
<el-text @click="handleGoWaybillDetails(row)"> {{ row[column.property] }} </el-text> |
|
</template> |
|
</template> |
|
</tablecmt> |
|
|
|
<!-- 分页模块 --> |
|
<div class="avue-crud__pagination flex-c-sb" style="width: 100%"> |
|
<div style="font-size: 14px">勾选数量: {{ selectionList.length }}</div> |
|
<!-- 分页模块 --> |
|
<el-pagination |
|
align="right" |
|
background |
|
@size-change="sizeChange" |
|
@current-change="currentChange" |
|
:current-page="page.pageNum" |
|
:page-sizes="[30, 50, 80, 120, 500]" |
|
:page-size="page.pageSize" |
|
layout="total, sizes, prev, pager, next, jumper" |
|
:total="page.total" |
|
> |
|
</el-pagination> |
|
</div> |
|
</div> |
|
</basic-container> |
|
|
|
<edittablehead |
|
@closce="showdrawer" |
|
:drawerShow="drawerShow" |
|
:columnList="details.columnList" |
|
v-model="details.columnList" |
|
></edittablehead> |
|
</template> |
|
|
|
<script lang="ts"> |
|
export default { |
|
name: '/reportforms/AuditTimelinessRatioReportDetails', |
|
}; |
|
</script> |
|
|
|
<script setup lang="ts"> |
|
import { ref, reactive, toRefs, computed, onMounted, nextTick, defineAsyncComponent } from 'vue'; |
|
import functions from '@/utils/functions.js'; |
|
import dayjs from 'dayjs'; |
|
import { mapGetters, useStore } from 'vuex'; |
|
/** 获取字典 */ |
|
import { getDictionaryBiz } from '@/api/system/dict'; |
|
import { postFindBrandList } from '@/api/waybill/TemporaryStorageList'; |
|
import { postFindbusinessLine } from '@/api/reportforms/SalesDepartmentIncomeReport'; |
|
import { |
|
postCheckWaybillTimeDetailPage, |
|
postCheckWaybillTimeDetailExport, |
|
} from '@/api/reportforms/AuditTimelinessRatioReport'; |
|
import { getListName } from '@/api/basicdata/basicdataVehicle'; |
|
import { |
|
setNodeHeight, |
|
getHtmls, |
|
deepClone, |
|
getObjType, |
|
handleTranslationDataSeclect, |
|
handleClearTableQuery, |
|
handleSelectQuery, |
|
handleInputQuery, |
|
downloadXls, |
|
} from '@/utils/util'; |
|
import { useRoute, useRouter } from 'vue-router'; |
|
import { ElMessage, ElMessageBox } from 'element-plus'; |
|
import { $_getMyWarehouseList } from '@/api/reportforms/index.js'; |
|
import { columnListDetails } from '@/option/reportforms/AuditTimelinessRatioReport'; |
|
|
|
// 获取路由实例 |
|
const $router = useRouter(); |
|
const $store = useStore(); |
|
const $route = useRoute(); |
|
|
|
// 组件实例 |
|
const tableNodeRef = ref(); |
|
|
|
const details = reactive<any>({ |
|
/** 是否开启搜索 */ |
|
search: true, |
|
/** 表格搜索条件 */ |
|
query: {}, |
|
/** 时间快捷选择设置 */ |
|
shortcuts: [ |
|
{ |
|
text: '最近一周', |
|
value: () => { |
|
const end = new Date(); |
|
const start = new Date(); |
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7); |
|
return [start, end]; |
|
}, |
|
}, |
|
{ |
|
text: '最近一个月', |
|
value: () => { |
|
const end = new Date(); |
|
const start = new Date(); |
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30); |
|
return [start, end]; |
|
}, |
|
}, |
|
{ |
|
text: '最近三个月', |
|
value: () => { |
|
const end = new Date(); |
|
const start = new Date(); |
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90); |
|
return [start, end]; |
|
}, |
|
}, |
|
], |
|
columnList: deepClone(columnListDetails), |
|
data: [], |
|
/** 头部搜索配置 */ |
|
titleSearchOption: [ |
|
{ type: 'input', label: '收货单位', prop: 'consignee' }, |
|
{ |
|
type: 'select', |
|
label: '审核状态', |
|
prop: 'checkStatus', |
|
checkarr: [ |
|
{ label: '全部', value: '' }, |
|
{ label: '已审核', value: 1 }, |
|
{ label: '待审核', value: 0 }, |
|
], |
|
}, |
|
{ |
|
type: 'select', |
|
label: '收款状态', |
|
prop: 'payStatus', |
|
checkarr: [ |
|
{ label: '未收款', value: '10' }, |
|
// {label: '部分收款', value: '20'}, |
|
{ label: '已收款', value: '30' }, |
|
], |
|
}, |
|
{ |
|
type: 'select', |
|
label: '结算状态', |
|
prop: 'settlementStatus', |
|
checkarr: [ |
|
{ label: '未结算', value: '10' }, |
|
// {label: '部分结算', value: '20'}, |
|
{ label: '已结算', value: '30' }, |
|
], |
|
}, |
|
{ |
|
type: 'selectall', |
|
label: '仓库', |
|
prop: 'destinationWarehouseIds', |
|
checkarr: [], |
|
}, |
|
{ type: 'time', label: '运单创建时间', prop: 'timeArr' }, |
|
{ type: 'time', label: '审核时间', prop: 'checkTimeArr' }, |
|
], |
|
/** 流转节点数据 */ |
|
flowNodeData: [], |
|
/** 页面loading */ |
|
loadingObj: { |
|
/** 列表加载loading */ |
|
list: false, |
|
packageListLoading: false, |
|
}, |
|
/** 列表复选框选中的数据 */ |
|
selectionList: [], |
|
/** 是否显示设置表格 */ |
|
drawerShow: false, |
|
/** 分页参数 */ |
|
page: { |
|
pageNum: 1, |
|
pageSize: 30, |
|
total: 0, |
|
}, |
|
/** 品牌 */ |
|
brandOptions: [], |
|
/** 事业线 */ |
|
businessLineOption: [], |
|
/** 仓库 */ |
|
warehouseOption: [], |
|
/** 弹出层显示 */ |
|
popUpShow: {}, |
|
/** 全屏 */ |
|
fullscreenObj: {}, |
|
}); |
|
|
|
const { search, query, shortcuts, loadingObj, selectionList, drawerShow, page } = toRefs(details); |
|
|
|
/** vuex */ |
|
const permission = computed(() => mapGetters(['permission', 'tagWel', 'tagList'])); |
|
console.log('permission :>> ', permission); |
|
|
|
/** 权限按钮 */ |
|
const permissionObj = reactive({}); |
|
|
|
/** 请求页面数据 */ |
|
const onLoad = async (params = {}) => { |
|
try { |
|
details.loadingObj.list = true; |
|
|
|
const submitData = { |
|
...details.page, |
|
...details.query, |
|
...params, |
|
brand: $route.query.brand, |
|
businessLine: $route.query.businessLine, |
|
departureWarehouseId: $route.query.departureWarehouseId, |
|
destinationWarehouseId: $route.query.destinationWarehouseId, |
|
checkDetailType: Number($route.query.checkDetailType), |
|
}; |
|
|
|
for (const key in submitData) { |
|
const element = submitData[key]; |
|
|
|
if (!element && element !== 0) delete submitData[key]; |
|
} |
|
|
|
// 时间周期 |
|
if (getObjType(submitData.timeArr) === 'array' && submitData.timeArr.length > 0) { |
|
submitData.startTimeStr = submitData.timeArr[0]; |
|
submitData.endTimeStr = submitData.timeArr[1]; |
|
|
|
const start = new Date(submitData.startTimeStr).getTime(); |
|
const end = new Date(submitData.endTimeStr).getTime(); |
|
|
|
if (end - start + 1000 * 60 * 60 * 24 > 1000 * 60 * 60 * 24 * 31) |
|
return ElMessage.warning('时间不能大于31天'); |
|
} |
|
|
|
if (getObjType(submitData.timeArr) !== 'array' || submitData.timeArr.length === 0) { |
|
details.data = []; |
|
return ElMessage.warning('请选择时间'); |
|
} |
|
|
|
if (getObjType(submitData.createTimeArr) === 'array' && submitData.createTimeArr.length > 0) { |
|
submitData.createTimeStartStr = submitData.createTimeArr[0]; |
|
submitData.createTimeEndStr = submitData.createTimeArr[1]; |
|
} |
|
|
|
if (getObjType(submitData.checkTimeArr) === 'array' && submitData.checkTimeArr.length > 0) { |
|
submitData.checkTimeStartStr = submitData.checkTimeArr[0]; |
|
submitData.checkTimeEndStr = submitData.checkTimeArr[1]; |
|
} |
|
|
|
delete submitData.createTimeArr; |
|
delete submitData.checkTimeArr; |
|
|
|
delete submitData.timeArr; |
|
delete submitData.total; |
|
|
|
const res = await postCheckWaybillTimeDetailPage(submitData); |
|
const { code, data } = res.data; |
|
if (code !== 200) return; |
|
details.data = getObjType(data.records) === 'array' ? data.records : []; |
|
details.page.total = data.total; |
|
|
|
handleTranslationDataSeclect(details.data, details.columnList); |
|
|
|
for (let i = 0; i < details.data.length; i++) { |
|
const value = details.data[i]; |
|
|
|
value.notCheckNum = value.totalNum - value.hasCheckNum; |
|
} |
|
} catch (error) { |
|
console.log('error :>> ', error); |
|
} finally { |
|
details.loadingObj.list = false; |
|
} |
|
}; |
|
|
|
const init = () => { |
|
const time = new Date().getTime(); |
|
|
|
details.query.timeArr = [ |
|
$route.query.startTimeStr || dayjs(time - 1000 * 60 * 60 * 24 * 7).format('YYYY-MM-DD'), |
|
$route.query.endTimeStr || dayjs(time).format('YYYY-MM-DD'), |
|
]; |
|
|
|
onLoad(); |
|
}; |
|
|
|
init(); |
|
|
|
$_getMyWarehouseList().then(res => { |
|
console.log(res, '仓库列表'); |
|
if (res.data.code === 200) { |
|
details.titleSearchOption.find(val => val.label === '仓库').checkarr = res.data.data.map( |
|
item => { |
|
return { |
|
label: item.name, |
|
value: item.id, |
|
}; |
|
} |
|
); |
|
} |
|
}); |
|
|
|
/** 搜索 */ |
|
const searchChange = () => { |
|
onLoad(); |
|
}; |
|
|
|
/** 清空表单 */ |
|
const searchReset = () => { |
|
details.query = {}; |
|
details.page.pageNum = 1; |
|
handleClearTableQuery(details.columnList); |
|
onLoad(); |
|
}; |
|
|
|
/** 展开列表控件 */ |
|
const showdrawer = (_flag?: boolean) => { |
|
details.drawerShow = _flag; |
|
}; |
|
|
|
/** 是否开启搜索区 */ |
|
const searchHide = () => { |
|
details.search = !details.search; |
|
|
|
setNodeHeight(tableNodeRef.value.$el, '', true); |
|
}; |
|
|
|
/** 表格表头输入框搜索 */ |
|
const inputsc = (index, row) => { |
|
handleInputQuery(index, row, details.query); |
|
onLoad(); |
|
}; |
|
|
|
/** 表格表头时间选择 */ |
|
const timesc = (index, row) => { |
|
console.log(index, row); |
|
if (!!index) { |
|
index = dayjs(index).format('YYYY-MM-DD'); |
|
} |
|
details.query[row.prop] = index; |
|
if (!index) { |
|
delete details.query[row.prop]; |
|
} |
|
onLoad(); |
|
}; |
|
|
|
/** 表格表头输入框搜索 */ |
|
const btnsc = () => {}; |
|
|
|
/** 表格表头下拉框选择 */ |
|
const selectsc = (index, row) => { |
|
handleSelectQuery(index, row, details.query); |
|
onLoad(); |
|
}; |
|
|
|
/** 表格表头复选框选择 */ |
|
const selectionChange = (list: any) => { |
|
details.selectionList = list; |
|
}; |
|
|
|
/** 每页数量改变执行的回调 */ |
|
const sizeChange = (pageSize: number) => { |
|
details.page.pageSize = pageSize; |
|
onLoad(); |
|
}; |
|
|
|
/** 页码改变执行的回调 */ |
|
const currentChange = pageNum => { |
|
details.page.pageNum = pageNum; |
|
onLoad(); |
|
}; |
|
|
|
/** 弹出层开启前清除数据 */ |
|
const beforeClose = done => { |
|
done(); |
|
details.form = {}; |
|
details.selectionList = []; |
|
details.view = false; |
|
}; |
|
|
|
// 导出 |
|
const ExportData = async () => { |
|
try { |
|
details.loadingObj.list = true; |
|
|
|
const submitData = { |
|
...details.page, |
|
...details.query, |
|
brand: $route.query.brand, |
|
businessLine: $route.query.businessLine, |
|
departureWarehouseId: $route.query.departureWarehouseId, |
|
destinationWarehouseId: $route.query.destinationWarehouseId, |
|
checkDetailType: Number($route.query.checkDetailType), |
|
}; |
|
|
|
for (const key in submitData) { |
|
const element = submitData[key]; |
|
|
|
if (!element && element !== 0) delete submitData[key]; |
|
} |
|
|
|
// 时间周期 |
|
if (getObjType(submitData.timeArr) === 'array' && submitData.timeArr.length > 0) { |
|
submitData.startTimeStr = submitData.timeArr[0]; |
|
submitData.endTimeStr = submitData.timeArr[1]; |
|
|
|
const start = new Date(submitData.startTimeStr).getTime(); |
|
const end = new Date(submitData.endTimeStr).getTime(); |
|
console.log('start :>> ', start); |
|
console.log('end :>> ', end); |
|
console.log('end - start :>> ', end - start); |
|
|
|
if (end - start + 1000 * 60 * 60 * 24 > 1000 * 60 * 60 * 24 * 31) |
|
return ElMessage.warning('时间不能大于31天'); |
|
} |
|
|
|
delete submitData.timeArr; |
|
delete submitData.total; |
|
|
|
const res = await postCheckWaybillTimeDetailExport(submitData); |
|
const { status, data } = res; |
|
if (status !== 200) return; |
|
const time = new Date().getTime(); |
|
downloadXls(data, '审单及时率详情 -' + time + '.xlsx'); |
|
} catch (error) { |
|
console.log('error :>> ', error); |
|
} finally { |
|
details.loadingObj.list = false; |
|
} |
|
}; |
|
|
|
/** 查看运单 */ |
|
const handleGoWaybillDetails = row => { |
|
if (row.waybillNo === '————') return ElMessage.warning('暂无运单号'); |
|
|
|
$router.push({ |
|
path: '/distribution/inventory/BookingNote', |
|
query: { |
|
name: `查看 -- 【${row.waybillNo}】`, |
|
waybillNo: row.waybillNo, |
|
id: row.waybillId, |
|
waybillType: row.waybillType, |
|
}, |
|
}); |
|
}; |
|
</script> |
|
|
|
<style scoped lang="scss"> |
|
// 日期选择器 |
|
:deep(.el-date-editor.el-input) { |
|
height: 100% !important; |
|
width: 100% !important; |
|
} |
|
|
|
:deep(.el-form-item__content) { |
|
height: fit-content; |
|
} |
|
.el_div_input { |
|
width: 100%; |
|
display: flex; |
|
align-items: center; |
|
.el_dy_icon { |
|
font-size: 1.5em; |
|
} |
|
} |
|
</style>
|
|
|