Browse Source

重构承运商管理页面

dev-xx
qb 8 months ago
parent
commit
2c0969ee0b
  1. 17
      src/api/basicdata/basicdataCarrier.js
  2. 10
      src/option/basicdata/basicdataCarrier2.js
  3. 24
      src/option/basicdata/basicdataVehicle2.js
  4. 1047
      src/views/basicdata/carrier/basicdataCarrier.vue
  5. 707
      src/views/basicdata/carrier/basicdataCarrier2.vue
  6. 45
      src/views/basicdata/vehicle/basicdataVehicle2.vue

17
src/api/basicdata/basicdataCarrier.js

@ -1,14 +1,10 @@
import request from '@/axios';
export const getList = (current, size, params) => {
export const getList = params => {
return request({
url: '/api/logpm-basicdata/carrier/list',
method: 'get',
params: {
...params,
current,
size,
},
params,
});
};
@ -32,6 +28,15 @@ export const remove = ids => {
});
};
/** 提交承运商 */
export const postCarrierSubmit = data => {
return request({
url: '/api/logpm-basicdata/carrier/submit',
method: 'post',
data,
});
};
export const add = row => {
return request({
url: '/api/logpm-basicdata/carrier/submit',

10
src/option/basicdata/basicdataCarrier2.js

@ -23,6 +23,7 @@ export const columnList = [
checkarr: [],
fixed: false,
sortable: true,
isTitleSearch: true,
},
{
label: '承运商编号',
@ -43,6 +44,7 @@ export const columnList = [
checkarr: [],
fixed: false,
sortable: true,
isTitleSearch: true,
},
{
label: '承运商名称',
@ -63,6 +65,7 @@ export const columnList = [
checkarr: [],
fixed: false,
sortable: true,
isTitleSearch: true,
},
{
label: '手机号',
@ -258,21 +261,20 @@ export const columnList = [
{
prop: 'notes',
label: '操作',
width: '200',
type: 6,
values: '',
width: '200',
checkarr: [],
fixed: 'right',
sortable: true,
sortable: false,
},
];
export const formOptions = [
{
label: '类型',
prop: 'typeName',
type: 1,
prop: 'type',
type: 3,
checkarr: [],
rules: [],
},

24
src/option/basicdata/basicdataVehicle2.js

@ -23,16 +23,18 @@ export default [
checkarr: [],
fixed: true,
sortable: true,
isTitleSearch: true,
},
{
label: '车辆来源',
prop: 'vehicleSource',
type: 1,
prop: 'vehicleSourceName',
type: 3,
values: '',
width: '150',
checkarr: [],
fixed: false,
sortable: true,
isTitleSearch: true,
},
{
label: '是否车头',
@ -55,23 +57,25 @@ export default [
},
{
label: '挂车类型',
prop: 'trailerType',
type: 1,
prop: 'trailerTypeName',
type: 3,
values: '',
width: '150',
checkarr: [],
fixed: false,
sortable: true,
isTitleSearch: true,
},
{
label: '车辆类型',
prop: 'vehicleModel',
type: 1,
prop: 'vehicleModelName',
type: 3,
values: '',
width: '150',
checkarr: [],
fixed: false,
sortable: true,
isTitleSearch: true,
},
{
label: '车厢类型',
@ -105,13 +109,14 @@ export default [
},
{
label: '付款方式',
prop: 'paymentMethod',
type: 1,
prop: 'paymentMethodName',
type: 3,
values: '',
width: '150',
checkarr: [],
fixed: false,
sortable: true,
isTitleSearch: true,
},
{
label: '核定体积',
@ -315,13 +320,14 @@ export default [
},
{
label: '承运商',
prop: 'carrierId',
prop: 'carrierIdName',
type: 3,
values: '',
width: '150',
checkarr: [],
fixed: false,
sortable: true,
isTitleSearch: true,
},
{
label: '车辆年审时间',

1047
src/views/basicdata/carrier/basicdataCarrier.vue

File diff suppressed because it is too large Load Diff

707
src/views/basicdata/carrier/basicdataCarrier2.vue

@ -1,707 +0,0 @@
<template>
<basic-container v-loading="details.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" clearable placeholder="请输入车牌号"></el-input>
</el-form-item>
<el-form-item label="有效状态">
<el-select class="w100" v-model="query.value" clearable placeholder="有效状态">
<el-option label="有效" value="item.value" />
<el-option label="作废" value="item.value" />
</el-select>
</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">
<!-- 头部左侧按钮模块 -->
<div class="avue-crud__left">
<!-- 新增 -->
<el-button type="primary" icon="Plus" @click="handleAdd"> </el-button>
<!-- 删除 -->
<el-button type="primary" icon="Delete" @click="() => handleDelete(true)">
</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
:columnList="details.columnList"
:tableData="data"
:loading="loadingObj.list"
@inputTxt="inputsc"
@timeCheck="timesc"
@selectCheck="selectsc"
@selection="selectionChange"
>
<template #default="slotProps">
<template v-if="slotProps.scope.column.label === '操作'">
<el-text @click="handleDelete(false, slotProps.scope.row)"> 删除 </el-text>
<el-text @click="handleAnException(slotProps.scope)"> 编辑 </el-text>
<el-text @click="handleAnException(slotProps.scope)"> 查看 </el-text>
</template>
</template>
</tablecmt>
<!-- 分页模块 -->
<div class="flex-c-sb mt20">
<div style="font-size: 14px">勾选数量: {{ selectionList.length }}</div>
<!-- 分页模块 -->
<el-pagination
align="right"
background
@size-change="sizeChange"
@current-change="currentChange"
:current-page="page.currentPage"
:page-sizes="[30, 50, 80, 120]"
:page-size="page.size"
layout="total, sizes, prev, pager, next, jumper"
:total="page.total"
>
</el-pagination>
</div>
<!-- 新增/编辑 -->
<div>
<el-dialog
destroy-on-close
:modal-append-to-body="false"
:append-to-body="false"
class="el-dialog-addTagVisited"
width="80%"
v-model="details.popUpShow.dialogVisible"
:fullscreen="details.fullscreenObj.dialogVisible"
:show-close="false"
draggable
overflow
>
<!-- 标题 -- 头部控件区 -->
<template #header="{ close, titleId, titleClass }">
<div class="my-header flex-c-sb" draggable>
<div class="fwb" :id="titleId" :class="titleClass">新增</div>
<div class="flex-c-c">
<div @click="() => handleFullScrean('dialogVisible')" class="mr20">
<!-- 全屏显示按钮 -->
<el-button type="text" v-if="!details.fullscreenObj.dialogVisible">
<el-icon size="18px" class=""><FullScreen /></el-icon>
</el-button>
<el-button type="text" v-else>
<el-icon size="18px" class=""><CopyDocument /></el-icon>
</el-button>
</div>
<!-- 弹窗关闭按钮 -->
<el-button type="text">
<el-icon size="18px" class="" @click="close"><Close /></el-icon>
</el-button>
</div>
</div>
</template>
<div v-loading="details.loadingObj.addTagLoading">
<el-form inline class="mt20 pl20" ref="formRef" :model="details.form">
<el-form-item
v-for="item in details.formOptions"
:label="item.label"
label-width="160px"
:class="item.type !== 5 ? 'w30' : 'w100'"
:rules="item.rules"
:prop="item.prop"
>
<!-- 普通输入框 -->
<template v-if="item.type === 1">
<el-input
class="w100"
:placeholder="`请输入${item.label}`"
v-model="details.form[item.prop]"
clearable
></el-input>
</template>
<!-- 数字输入框 -->
<template v-else-if="item.type === 2">
<el-input-number
:controls="false"
v-model="details.form[item.prop]"
:placeholder="`请输入${item.label}`"
:min="item.min || 0"
:value-on-clear="0"
:precision="item.precision || 0"
class="w100"
:disabled="item.disabled || false"
></el-input-number>
</template>
<!-- 下拉框 -->
<template v-else-if="item.type === 3">
<el-select
v-model="details.form[item.prop]"
:placeholder="`请选择${item.label}`"
class="w100"
clearable
filterable
@change="value => item.change && item.change(value)"
:multiple="item.multiple || false"
>
<el-option
v-for="val in item.checkarr"
:key="val.value"
:label="val.label"
:value="val.value"
/>
</el-select>
</template>
<!-- 时间选择 -->
<template v-else-if="item.type === 4">
<el-date-picker
v-model="details.form[item.prop]"
type="date"
:placeholder="`请选择${item.label}`"
class="w100"
:default-value="new Date()"
:value-format="item.valueFormat || 'YYYY-MM-DD'"
clearable
/>
</template>
<!-- 备注 -->
<template v-else-if="item.type === 5">
<el-input
type="textarea"
v-model="details.form[item.prop]"
clearable
:placeholder="`请选择${item.label}`"
class="w100"
/>
</template>
</el-form-item>
<el-form-item label="道路运输许可证图片" class="w100">
<div class="w100">
<el-upload
v-model:file-list="details.imgList"
list-type="picture"
:action="doubledCount"
:before-upload="beforeAvatarUpload"
:on-success="res => handleAvatarSuccess(res)"
:headers="headers"
multiple
:show-file-list="false"
>
<template #default>
<div class="pageTitle title mb20">
<el-button type="primary" icon="CirclePlus"> </el-button>
<!-- <el-button icon="Delete" @click.stop="() => handleEmpty(item)"> </el-button> -->
</div>
</template>
</el-upload>
<div class="imgRow">
<div v-for="(value, index) in details.imgList" :key="value.url">
<el-image
class="img"
:src="value.url"
v-loading="!value.imgUrl"
:zoom-rate="1.2"
:max-scale="7"
:min-scale="0.2"
:preview-src-list="details.imgList.map(val => val.imgUrl)"
:initial-index="index"
fit="cover"
/>
</div>
</div>
</div>
</el-form-item>
<el-form-item label="合同附件"></el-form-item>
</el-form>
</div>
<div class="flex-c-c dialog-footer">
<el-button icon="Close" @click="details.popUpShow.addTagVisited = false">
</el-button>
<!-- 重置 -->
<el-button
icon="Refresh"
type="primary"
:loading="details.loadingObj.addTagLoading"
@click="() => handleRefreshAddTag(ruleFormRef)"
>
</el-button>
<!-- 提交 -->
<el-button
icon="Position"
type="primary"
:loading="details.loadingObj.addTagLoading"
@click="() => handleSubmitAddTag(ruleFormRef)"
>
</el-button>
</div>
</el-dialog>
</div>
</div>
</basic-container>
<!-- 列表配置显示 -->
<edittablehead
@closce="showdrawer"
:drawerShow="drawerShow"
v-model="details.columnList"
></edittablehead>
</template>
<script setup lang="ts">
import { ref, reactive, toRefs, computed, onMounted, nextTick } from 'vue';
import functions from '@/utils/functions.js';
import dayjs from 'dayjs';
import { mapGetters } from 'vuex';
import { getToken } from '@/utils/auth';
import { compressImageBlob } from '@/components/IMGcompressor/imgcompressor.js';
/** 获取字典 */
import { getDictionaryBiz } from '@/api/system/dict';
import {
downloadXls,
setNodeHeight,
getHtmls,
deepClone,
handleClearTableQuery,
debounce,
handleSelectQuery,
handleInputQuery,
handleTranslationDataSeclect,
getObjType,
} from '@/utils/util';
import { columnList, formOptions } from '@/option/basicdata/basicdataCarrier2.js';
import { useRouter } from 'vue-router';
import { ElMessage, ElMessageBox } from 'element-plus';
import { getList, getDetail, add, update, remove } from '@/api/basicdata/basicdataCarrier';
//
const $router = useRouter();
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(columnList),
/** 列表数据 */
data: [],
/** 页面loading */
loadingObj: {
/** 列表加载loading */
list: false,
/** 页面loading */
pageLoading: false,
},
/** 列表复选框选中的数据 */
selectionList: [],
/** 是否显示设置表格 */
drawerShow: false,
/** 分页参数 */
page: {
current: 1,
size: 30,
total: 0,
},
/** 弹出层显示 */
popUpShow: {
/** 新增 | 编辑 | 查看 */
dialogVisible: false,
},
/** 列表Dom节点 */
listNode: '',
form: {},
/** 全屏 */
fullscreenObj: {
/** 查看 */
dialogVisible: false,
},
formOptions: deepClone(formOptions),
imgList: [],
});
const { search, query, shortcuts, stockupDate, data, loadingObj, selectionList, drawerShow, page } =
toRefs(details);
/** vuex */
const permission = computed(() => mapGetters(['permission', 'tagWel', 'tagList']));
onMounted(() => {
const timer = setTimeout(() => {
details.listNode = document.querySelector('.maboxhi');
details.listNode.style.transition = 'all .5s ease-out';
clearTimeout(timer);
}, 100);
});
/** 请求页面数据 */
const onLoad = debounce(async (params = {}) => {
try {
details.loadingObj.list = true;
let _page = details.page;
const _submitData = { ..._page, ...details.query, ...params };
delete _submitData.total;
//
const res = await getList(_submitData);
console.log('res :>> ', res);
const { code, data } = res.data;
if (code !== 200) return;
details.data = data.records;
handleTranslationDataSeclect(details.data, details.columnList);
details.page.total = data.total;
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.list = false;
}
}, 10);
const handleData = (key, res) => {
const { code, data } = res.data;
if (code !== 200) return;
for (let i = 0; i < details.columnList.length; i++) {
const value = details.columnList[i];
if (value.label === key)
return (value.checkarr =
getObjType(data) === 'array'
? data.map(val => {
val.label = val.dictValue;
val.value = val.dictKey;
return val;
})
: []);
}
};
//
const initData = async () => {
await Promise.all([
//
getDictionaryBiz('basic_carrier_type').then(res => handleData('类型', res)),
onLoad(),
]);
await nextTick();
handleTranslationDataSeclect(details.data, details.columnList);
console.log('details.columnList :>> ', details.columnList);
};
initData();
/** 搜索 */
const searchChange = () => {
onLoad();
};
/** 清空表单 */
const searchReset = () => {
details.query = {};
details.stockupDate = [];
details.page.currentPage = 1;
handleClearTableQuery(details.columnList);
onLoad();
};
/** 展开列表控件 */
const showdrawer = (_flag?: boolean) => {
details.drawerShow = _flag;
};
/** 是否开启搜索区 */
const searchHide = () => {
details.search = !details.search;
setNodeHeight(details.listNode, '', 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 selectsc = (index, row) => {
handleSelectQuery(index, row, details.query);
onLoad();
};
/** 表格表头复选框选择 */
const selectionChange = (list: any) => {
details.selectionList = list;
};
/** 每页数量改变执行的回调 */
const sizeChange = (size: number) => {
details.page.size = size;
onLoad();
};
/** 页码改变执行的回调 */
const currentChange = current => {
details.page.current = current;
onLoad();
};
/**
* 是否开启全屏
* @params(_type) 开启或关闭
*/
const handleFullScrean = (_name: string, _type: 'open' | 'close' = 'open') => {
let _node: any = '';
if (_name) _node = document.querySelector(`.${_name} .maboxhi`);
switch (_name) {
case 'packageOrderListlVisited':
details.fullscreenObj.packageOrderListlVisited =
!details.fullscreenObj.packageOrderListlVisited;
if (_type === 'close') {
if (_node) setNodeHeight(_node, '500px');
} else {
if (_node) setNodeHeight(_node, '800px');
}
break;
default:
details.fullscreenObj[_name] = !details.fullscreenObj[_name];
break;
}
};
/** 新增 */
const handleAdd = () => {
details.popUpShow.dialogVisible = true;
};
/**
* isBatch 是否批量删除
* row 单个删除时当前行的数据
*/
const handleDelete = (isBatch, row: any = {}) => {
let ids = '';
if (isBatch) {
if (!details.selectionList.length) {
ElMessage.warning('请选择要删除的数据');
return;
}
ids = details.selectionList.map(v => v.id).join(',');
} else {
ids = row.id;
}
ElMessageBox.confirm('确定删除该数据吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(async () => {
try {
details.loadingObj.pageLoading = true;
const res = await remove(ids);
const { code, msg } = res.data;
if (code !== 200) return ElMessage.error(msg);
ElMessage.success('删除成功');
onLoad();
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
})
.catch(() => {});
};
//
const doubledCount = computed(() => {
return '/api/blade-resource/oss/endpoint/put-file';
});
//
const beforeAvatarUpload = async rawFile => {
console.log(rawFile);
if (rawFile.type !== 'image/png' && rawFile.type !== 'image/jpeg') {
ElMessage.error('图片格式只能为 png/jpg!');
return false;
} else if (rawFile.size / 1024 / 1024 > 10) {
ElMessage.error('图片大小不能大于10MB!');
return false;
}
const res = await compressImageBlob(rawFile);
return res;
};
// TOKEN
const headers = computed(() => {
return { 'Blade-Auth': 'Bearer ' + getToken() };
});
//
const handleAvatarSuccess = response => {
for (let i = 0; i < details.imgList.length; i++) {
const value = details.imgList[i];
console.log('value :>> ', value);
value.imgUrl =
value.response && value.response.code === 200 ? value.response.data.link : value.imgUrl || '';
}
ElMessage.success('上传成功');
};
/** 确认清空 */
const handleEmpty = item => {
if (item.imgList.length === 0) return ElMessage.warning('没有图片可以清空');
ElMessageBox.confirm('确定要清空吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
item.imgList = [];
})
.catch(() => {});
};
</script>
<style scoped lang="scss">
//
:deep(.el-date-editor.el-input) {
height: 100% !important;
width: 100% !important;
}
:deep(.el-range-editor.el-input__wrapper) {
height: 100% !important;
}
.mt20 {
margin-top: 20px;
}
.mr20 {
margin-right: 20px;
}
.fwb {
font-weight: bold;
}
//
:deep(.el-overlay) {
position: absolute;
}
:deep(.el-overlay-dialog) {
position: absolute;
}
:deep(.el-form) {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
}
.w30 {
width: 30%;
}
.w100 {
width: 100% !important;
}
:deep(.el-input__inner) {
text-align: left;
}
.imgRow {
display: flex;
flex-wrap: wrap;
.img {
margin: 10px;
border-radius: 5px;
width: 100px;
height: 100px;
}
}
</style>

45
src/views/basicdata/vehicle/basicdataVehicle2.vue

@ -5,16 +5,43 @@
<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" clearable placeholder="请输入车牌号"></el-input>
</el-form-item>
<template v-for="item in details.columnList" :key="item.prop">
<el-form-item v-if="item.isTitleSearch" :label="item.label">
<!-- 普通输入框 -->
<template v-if="item.type === 2">
<el-input
class="w100"
:placeholder="`请输入${item.label}`"
v-model="details.query[item.prop]"
clearable
></el-input>
</template>
<el-form-item label="有效状态">
<el-select class="w100" v-model="query.value" clearable placeholder="有效状态">
<el-option label="有效" value="item.value" />
<el-option label="作废" value="item.value" />
<!-- 下拉框 -->
<template v-else-if="item.type === 3">
<el-select
v-model="details.query[item.prop.replace('Name', '')]"
:placeholder="`请选择${item.label}`"
class="w100"
clearable
filterable
:multiple="item.multiple || false"
@change="
val => {
!val && delete details.query[item.prop.replace('Name', '')];
}
"
>
<el-option
v-for="val in item.checkarr"
:key="val.value"
:label="val.label"
:value="val.value"
/>
</el-select>
</template>
</el-form-item>
</template>
<!-- 查询按钮 -->
<el-form-item class="el-btn">
@ -85,7 +112,7 @@
background
@size-change="sizeChange"
@current-change="currentChange"
:current-page="page.currentPage"
:current-page="page.current"
:page-sizes="[30, 50, 80, 120]"
:page-size="page.size"
layout="total, sizes, prev, pager, next, jumper"
@ -355,7 +382,7 @@ const searchChange = () => {
const searchReset = () => {
details.query = {};
details.stockupDate = [];
details.page.currentPage = 1;
details.page.current = 1;
handleClearTableQuery(details.columnList);
onLoad(details.page);
};

Loading…
Cancel
Save