10 changed files with 645 additions and 10 deletions
@ -0,0 +1,593 @@
|
||||
<template> |
||||
<basic-container v-loading="loadingObj.pageLoading"> |
||||
<div class="avue-crud"> |
||||
<!-- 搜索模块 --> |
||||
<div v-h5uShow="!search"> |
||||
<!-- 查询模块 --> |
||||
<el-form :inline="true" :model="query" class="header_search"> |
||||
<el-form-item label="创建时间:" class="el-times"> |
||||
<!-- <el-input v-model="query.stockupArea" placeholder="请输入备货区"></el-input>--> |
||||
<el-date-picker |
||||
v-model="stockupDate" |
||||
type="daterange" |
||||
unlink-panels |
||||
range-separator="至" |
||||
start-placeholder="开始时间" |
||||
end-placeholder="结束时间" |
||||
:shortcuts="shortcuts" |
||||
clearable |
||||
value-format="YYYY-MM-DD" |
||||
/> |
||||
</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> |
||||
|
||||
<el-row> |
||||
<div class="avue-crud__header"> |
||||
<!-- 头部左侧按钮模块 --> |
||||
<div class="avue-crud__left"></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> |
||||
</el-row> |
||||
<!-- 表格 --> |
||||
<!-- 列表模块 --> |
||||
<tablecmt |
||||
ref="tableNodeRef" |
||||
:columnList="details.columnList" |
||||
:tableData="details.data" |
||||
:loading="loadingObj.list" |
||||
@inputTxt="inputsc" |
||||
@timeCheck="timesc" |
||||
@btnCheck="btnsc" |
||||
@selectCheck="selectsc" |
||||
@selection="selectionChange" |
||||
> |
||||
<template #default="slotProps"> |
||||
<template v-if="slotProps.scope.column.label === '操作'"> |
||||
<el-text |
||||
v-if="details.orderStatus === 'haveData'" |
||||
@click="handleShowPackageOrderList(slotProps.scope)" |
||||
> |
||||
包明细 |
||||
</el-text> |
||||
</template> |
||||
</template> |
||||
</tablecmt> |
||||
|
||||
<!-- 分页模块 --> |
||||
<el-row class="el-fy"> |
||||
<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, 100, 200, 500, 1000]" |
||||
:page-size="page.pageSize" |
||||
layout="total, sizes, prev, pager, next, jumper" |
||||
:total="page.total" |
||||
> |
||||
</el-pagination> |
||||
</div> |
||||
</el-row> |
||||
</div> |
||||
</basic-container> |
||||
|
||||
<!-- 列表配置显示 --> |
||||
<edittablehead |
||||
@setcolum="setnewcolum" |
||||
@closce="showdrawer" |
||||
:drawerShow="drawerShow" |
||||
:columnList="details.columnList" |
||||
v-model="details.columnList" |
||||
></edittablehead> |
||||
</template> |
||||
|
||||
<script setup lang="ts"> |
||||
import { |
||||
ref, |
||||
reactive, |
||||
toRefs, |
||||
computed, |
||||
onMounted, |
||||
nextTick, |
||||
onActivated, |
||||
onDeactivated, |
||||
} from 'vue'; |
||||
import functions from '@/utils/functions.js'; |
||||
import dayjs from 'dayjs'; |
||||
import { mapGetters } from 'vuex'; |
||||
/** 获取字典 */ |
||||
import { getDictionaryBiz } from '@/api/system/dict'; |
||||
import { |
||||
getopenOrderAdvancePageList, |
||||
postOpenOrderFreezeByAdvanceIds, |
||||
postOpenOrderDeletedAdvance, |
||||
postFindBrandList, |
||||
postOpenLabel, |
||||
} from '@/api/waybill/TemporaryStorageList'; |
||||
import { getLazyTreeAll } from '@/api/base/region'; |
||||
import { showOrderPackgeCode } from '@/api/distribution/distributionStockArticle'; |
||||
import { |
||||
downloadXls, |
||||
setNodeHeight, |
||||
deepClone, |
||||
downloadFileBase64, |
||||
handleClearTableQuery, |
||||
} from '@/utils/util'; |
||||
import { columnList } from '@/option/waybill/TemporaryStorageList'; |
||||
import { useRouter } from 'vue-router'; |
||||
import print from '@/utils/print'; |
||||
import { ElMessage, ElMessageBox } from 'element-plus'; |
||||
import type { FormInstance, FormRules } from 'element-plus'; |
||||
import { getToken } from '@/utils/auth'; |
||||
import { useStore } from 'vuex'; |
||||
|
||||
// 获取路由实例 |
||||
const $router = useRouter(); |
||||
|
||||
// vuex |
||||
const $store = useStore(); |
||||
|
||||
// 表单实例 |
||||
const ruleFormRef = ref<FormInstance>(); |
||||
columnList; |
||||
/** 表格实例 */ |
||||
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]; |
||||
}, |
||||
}, |
||||
], |
||||
/** 时间选择器数据 */ |
||||
stockupDate: [], |
||||
/** 列表 */ |
||||
columnList: deepClone(columnList), |
||||
/** 列表数据 */ |
||||
data: [], |
||||
/** 页面loading */ |
||||
loadingObj: { |
||||
/** 列表加载loading */ |
||||
list: false, |
||||
/** 开标签 */ |
||||
addTagLoading: false, |
||||
/** 上传 */ |
||||
UploadLoadong: false, |
||||
pageLoading: false, |
||||
}, |
||||
/** 列表复选框选中的数据 */ |
||||
selectionList: [], |
||||
/** 是否显示设置表格 */ |
||||
drawerShow: false, |
||||
/** 分页参数 */ |
||||
page: { |
||||
pageNum: 1, |
||||
pageSize: 30, |
||||
total: 0, |
||||
}, |
||||
/** 包明细分页参数 */ |
||||
packageListPage: { |
||||
currentPage: 1, |
||||
pageSize: 30, |
||||
total: 0, |
||||
}, |
||||
/** 弹出层显示 */ |
||||
popUpShow: { |
||||
/** 包件明细 */ |
||||
packageOrderListlVisited: false, |
||||
/** 修改客户信息 */ |
||||
editClientInfoVisible: false, |
||||
/** 导入 -- 家配 */ |
||||
UploadPackageDelivery: false, |
||||
/** 导入 -- 批量开标前 */ |
||||
UploadBatch: false, |
||||
/** 新增标签 */ |
||||
addTagVisited: false, |
||||
}, |
||||
/** 列表Dom节点 */ |
||||
listNode: '', |
||||
/** 打印的html */ |
||||
html: '', |
||||
/** 头部 */ |
||||
header: { |
||||
'Blade-Auth': 'bearer ' + getToken(), |
||||
}, |
||||
}); |
||||
|
||||
// 获取省市区 |
||||
getLazyTreeAll().then(res => { |
||||
if (res.data.success) { |
||||
details.addTagInfo.cargoInfo.find(val => val.label === '所属区域').checkArr = res.data.data; |
||||
} |
||||
}); |
||||
|
||||
// 获取所有品牌 |
||||
postFindBrandList({}).then(res => { |
||||
const { code, data } = res.data; |
||||
if (code !== 200) return; |
||||
details.addTagInfo.cargoInfo.find(val => val.label === '品牌').checkArr = data; |
||||
}); |
||||
|
||||
const { search, query, shortcuts, stockupDate, data, loadingObj, selectionList, drawerShow, page } = |
||||
toRefs(details); |
||||
|
||||
/** vuex */ |
||||
const permission = computed(() => mapGetters(['permission', 'tagWel', 'tagList'])); |
||||
console.log('permission :>> ', permission); |
||||
|
||||
onMounted(() => { |
||||
const timer = setTimeout(() => { |
||||
details.listNode = document.querySelector('.maboxhi'); |
||||
details.listNode.style.transition = 'all .5s ease-out'; |
||||
clearTimeout(timer); |
||||
}, 100); |
||||
}); |
||||
|
||||
/** 请求页面数据 */ |
||||
const onLoad = async (params = {} as any, isRefresh?: boolean) => { |
||||
try { |
||||
// 开启列表loading动画 |
||||
details.loadingObj.list = true; |
||||
console.log('status :>> ', status); |
||||
|
||||
details.query.freezeStatus = '0'; |
||||
|
||||
// 默认有数据 |
||||
params.hasPackage = 1; |
||||
|
||||
// 获取暂存单列表 |
||||
const res = await getopenOrderAdvancePageList(details.page, { ...details.query, ...params }); |
||||
console.log('res :>> ', res); |
||||
const { code, data } = res.data; |
||||
if (code !== 200) return; |
||||
const _arr = [...details.selectionList]; |
||||
|
||||
for (let i = 0; i < data.records.length; i++) { |
||||
const value = data.records[i]; |
||||
|
||||
value.legacyStatusName = Number(value.legacyStatus) ? '是' : '否'; |
||||
} |
||||
|
||||
details.data = data.records; |
||||
details.page.total = data.total; |
||||
|
||||
if (isRefresh) return; |
||||
|
||||
for (const item of data.records) { |
||||
for (let index = 0; index < _arr.length; index++) { |
||||
const element = _arr[index]; |
||||
|
||||
if (element.id === item.id) { |
||||
_arr.splice(index, 1, item); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
console.log('_arr :>> ', _arr); |
||||
await nextTick(); |
||||
tableNodeRef.value.handleCheckSelect(_arr); |
||||
|
||||
return res.data; |
||||
} catch (error) { |
||||
console.log('error :>> ', error); |
||||
} finally { |
||||
// 开启列表loading动画 |
||||
if (status === 'haveData') details.loadingObj.haveDataList = false; |
||||
else details.loadingObj.notHaveDataList = false; |
||||
} |
||||
}; |
||||
|
||||
const initOnLoad = async (params = {}, isRefresh = false) => { |
||||
details.page.pageNum = 1; |
||||
details.page.total = 0; |
||||
await onLoad(params, isRefresh); |
||||
}; |
||||
|
||||
initOnLoad(); |
||||
|
||||
/** 搜索 */ |
||||
const searchChange = () => { |
||||
if (details.stockupDate.length === 0) { |
||||
delete details.query.startCreateTimeStr; |
||||
delete details.query.endCreateTimeStr; |
||||
} else { |
||||
details.query.startCreateTimeStr = dayjs(details.stockupDate[0]).format('YYYY-MM-DD'); |
||||
details.query.endCreateTimeStr = dayjs(details.stockupDate[1]).format('YYYY-MM-DD'); |
||||
} |
||||
initOnLoad(); |
||||
}; |
||||
|
||||
/** 清空表单 */ |
||||
const searchReset = () => { |
||||
details.query = {}; |
||||
details.stockupDate = []; |
||||
handleClearTableQuery(details.columnList); |
||||
initOnLoad(); |
||||
}; |
||||
|
||||
/** 展开列表控件 */ |
||||
const showdrawer = (_flag?: boolean) => { |
||||
details.drawerShow = _flag; |
||||
}; |
||||
|
||||
/** 是否开启搜索区 */ |
||||
const searchHide = () => { |
||||
details.search = !details.search; |
||||
|
||||
setNodeHeight(details.listNode, '', true); |
||||
}; |
||||
|
||||
/** 表格表头输入框搜索 */ |
||||
const inputsc = (index, row) => { |
||||
index === '' ? delete details.query[row.prop] : (details.query[row.prop] = index); |
||||
initOnLoad(); |
||||
}; |
||||
|
||||
/** 表格表头时间选择 */ |
||||
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]; |
||||
} |
||||
initOnLoad(); |
||||
}; |
||||
|
||||
/** 表格表头输入框搜索 */ |
||||
const btnsc = () => {}; |
||||
|
||||
/** 表格表头下拉框选择 */ |
||||
const selectsc = (index, row) => { |
||||
index === '' |
||||
? delete details.query[row.prop.replace('Name', '')] |
||||
: (details.query[row.prop.replace('Name', '')] = index); |
||||
|
||||
initOnLoad(); |
||||
}; |
||||
|
||||
/** 表格表头复选框选择 */ |
||||
const selectionChange = (list: any) => { |
||||
details.selectionList = list; |
||||
console.log('list :>> ', list); |
||||
}; |
||||
|
||||
/** 每页数量改变执行的回调 */ |
||||
const sizeChange = (pageSize: number) => { |
||||
details.page.pageSize = pageSize; |
||||
onLoad(); |
||||
}; |
||||
|
||||
/** 页码改变执行的回调 */ |
||||
const currentChange = current => { |
||||
details.page.pageNum = current; |
||||
onLoad(); |
||||
}; |
||||
|
||||
/** |
||||
* 设置列表 -- 固定函数 |
||||
* 弹窗的勾选回调,用于更改头部数组 |
||||
* 固定搭配,只需要更换 columnList |
||||
* */ |
||||
const setnewcolum = (newarr, headarr, type) => { |
||||
if (type == 1) { |
||||
details.columnList = newarr; |
||||
functions.setStorage(window.location.pathname + 'checkList', headarr); |
||||
} else if (type == 2) { |
||||
details.columnList = newarr; |
||||
functions.setStorage(window.location.pathname + 'flexList', headarr); |
||||
} else if (type == 3) { |
||||
details.columnList = newarr; |
||||
functions.setStorage(window.location.pathname + 'sortlist', headarr); |
||||
} |
||||
}; |
||||
|
||||
/** 弹出层开启前清除数据 */ |
||||
const beforeClose = done => { |
||||
done(); |
||||
details.selectionList = []; |
||||
details.view = false; |
||||
}; |
||||
|
||||
/** 查看包明细 */ |
||||
const handleShowPackageOrderList = ({ row }) => { |
||||
$router.push({ |
||||
path: '/waybill/orderPackageListDetails?name=包明细', |
||||
query: { |
||||
id: row.id, |
||||
name: `订单 -- ${row.orderCode} 包明细`, |
||||
}, |
||||
}); |
||||
}; |
||||
|
||||
onActivated(() => { |
||||
console.log('activated'); |
||||
console.log('this.$store :>> ', $store); |
||||
if ($store.state.isRefresh.refreshObj.PreStoragePackage) { |
||||
// 重新请求数据 |
||||
details.query = {}; |
||||
details.page.pageNum = 1; |
||||
onLoad({}, true); |
||||
|
||||
$store.commit('EDIT_REFRESHITEM', { title: 'PreStoragePackage', status: false }); |
||||
} |
||||
}); |
||||
</script> |
||||
|
||||
<style scoped lang="scss"> |
||||
.fo-fl { |
||||
display: flex; |
||||
flex-wrap: wrap; |
||||
zoom: 0.9; |
||||
} |
||||
|
||||
// 日期选择器 |
||||
:deep(.el-date-editor.el-input) { |
||||
height: 100% !important; |
||||
width: 100% !important; |
||||
} |
||||
|
||||
:deep(.el-range-editor.el-input__wrapper) { |
||||
height: 100% !important; |
||||
} |
||||
|
||||
// 新增行 |
||||
.add_row { |
||||
display: flex; |
||||
justify-content: space-between; |
||||
} |
||||
|
||||
.add_row_title { |
||||
text-align: center; |
||||
margin-bottom: 10px; |
||||
font-size: 18px; |
||||
font-weight: bold; |
||||
} |
||||
|
||||
// 统计行 |
||||
.statistics_row { |
||||
margin: 10px 0; |
||||
font-size: 14px; |
||||
zoom: 0.9; |
||||
display: flex; |
||||
|
||||
> div { |
||||
margin-right: 20px; |
||||
} |
||||
} |
||||
|
||||
// 卡片容器 |
||||
.crad_container { |
||||
display: flex; |
||||
|
||||
.card_container_item { |
||||
flex: 1; |
||||
// padding: 10px; |
||||
border-radius: 5px; |
||||
box-shadow: 0 0 5px #ccc; |
||||
|
||||
&:first-child { |
||||
margin-right: 20px; |
||||
} |
||||
|
||||
.card_container_item_title { |
||||
padding: 10px; |
||||
border-bottom: 1px solid #ccc; |
||||
display: flex; |
||||
justify-content: space-between; |
||||
align-items: center; |
||||
} |
||||
|
||||
.card_container_item_box { |
||||
padding: 10px; |
||||
} |
||||
} |
||||
} |
||||
|
||||
// 标题 |
||||
:deep(.el-divider__text.is-left) { |
||||
font-size: 20px; |
||||
font-weight: bold; |
||||
color: var(--el-color-primary); |
||||
} |
||||
|
||||
// 标题 |
||||
:deep(.el-divider__text.is-center) { |
||||
font-size: 20px; |
||||
font-weight: bold; |
||||
color: var(--el-color-primary); |
||||
} |
||||
|
||||
// 添加行 |
||||
.addTagRow { |
||||
display: flex; |
||||
|
||||
& > div { |
||||
flex: 1; |
||||
} |
||||
} |
||||
|
||||
// 数字输入框 |
||||
:deep(.el-input-number) { |
||||
width: var(--el-input-width); |
||||
} |
||||
|
||||
:deep(.el-form-item__error) { |
||||
z-index: 99; |
||||
--el-color-danger: #f00; |
||||
} |
||||
|
||||
:deep(.el-form-item.is-error .el-input__wrapper) { |
||||
--el-color-danger: #f00; |
||||
} |
||||
|
||||
:deep( |
||||
.el-form-item.is-required:not(.is-no-asterisk).asterisk-left > .el-form-item__label:before, |
||||
.el-form-item.is-required:not(.is-no-asterisk).asterisk-left |
||||
> .el-form-item__label-wrap |
||||
> .el-form-item__label:before |
||||
) { |
||||
--el-color-danger: #f00; |
||||
} |
||||
|
||||
.overflow { |
||||
overflow: hidden; |
||||
} |
||||
|
||||
// tabbar激活样式 |
||||
:deep(.el-tabs__item.is-active) { |
||||
font-weight: bold; |
||||
color: #d38729; |
||||
} |
||||
|
||||
:deep(.el-tabs__active-bar) { |
||||
background: #d38729; |
||||
} |
||||
</style> |
Loading…
Reference in new issue