Browse Source

新增三方基础维护

dev
qb 1 month ago
parent
commit
7c3babd85a
  1. 45
      src/api/basicdata/TripartiteMaterial.js
  2. 28
      src/api/basicdata/defaultShipper.js
  3. 68
      src/option/basicdata/TripartiteMaterial.js
  4. 49
      src/option/basicdata/defaultShipper.js
  5. 12
      src/router/views/index.js
  6. 699
      src/views/basicdata/TripartiteMaterial/detail.vue
  7. 10
      src/views/basicdata/TripartiteMaterial/list.vue
  8. 616
      src/views/basicdata/warehouse/defaultShipper.vue
  9. 53
      src/views/distribution/inventory/CreateOrder.vue

45
src/api/basicdata/TripartiteMaterial.js

@ -50,7 +50,6 @@ export const postRemove = (data = {}) => {
});
};
/**
* 获取上传模板
*/
@ -60,4 +59,46 @@ export const getDownTemplate = () => {
method: 'get',
responseType: 'blob',
});
};
};
/**
* 获取详情列表
*/
export const postBasicdataMainCategoryPageList = data => {
return request({
url: '/api/logpm-basicdata/basicdataMainCategory/pageList',
method: 'post',
data,
});
};
/**
* 编辑
*/
export const postEditMainCategory = data => {
return request({
url: '/api/logpm-basicdata/basicdataMainCategory/editMainCategory',
method: 'post',
data,
});
};
/**
* 移除
*/
export const postRemoveMainCategory = data => {
return request({
url: '/api/logpm-basicdata/basicdataMainCategory/removeMainCategory',
method: 'post',
data,
});
};
/**
* 获取主体
*/
export const postMainList = data => {
return request({
url: '/api/logpm-basicdata/basicdataMain/mainList',
method: 'post',
data,
});
};

28
src/api/basicdata/defaultShipper.js

@ -0,0 +1,28 @@
import request from '@/axios';
/** 获取页面数据 */
export const postPageList = (data = {}) => {
return request({
url: '/api/logpm-basicdata/forwardingUnit/pageList',
method: 'post',
data,
});
};
/** 新增编辑默认发货单位 */
export const postEditUnit = (data = {}) => {
return request({
url: '/api/logpm-basicdata/forwardingUnit/editUnit',
method: 'post',
data,
});
};
/** 删除默认发货单位 */
export const postRemoveUnit = (data = {}) => {
return request({
url: '/api/logpm-basicdata/forwardingUnit/removeUnit',
method: 'post',
data,
});
};

68
src/option/basicdata/TripartiteMaterial.js

@ -44,14 +44,14 @@ export const columnList = [
width: '150',
checkarr: [
{
label: '收入',
value:'1'
},
{
label: '成本',
value:'2'
},
],
label: '收入',
value: '1',
},
{
label: '成本',
value: '2',
},
],
fixed: false,
sortable: true,
head: false,
@ -111,3 +111,55 @@ export const columnList = [
sortable: false,
},
];
export const columnListDetail = [
{
prop: '',
label: '复选框',
type: 0,
width: 55,
fixed: true,
},
{
prop: '',
label: '序号',
type: 12,
values: '',
width: 55,
fixed: true,
},
{
prop: 'category',
label: '品类名称',
type: 2,
values: '',
width: '300',
checkarr: [],
fixed: false,
sortable: true,
head: false,
isTitleSearch: true,
},
{
prop: 'mainName',
label: '主体名称',
type: 2,
values: '',
width: '300',
checkarr: [],
fixed: false,
sortable: true,
head: false,
isTitleSearch: true,
},
{
prop: 'createUserName',
label: '操作',
type: 6,
values: '',
width: '200',
checkarr: [],
fixed: 'right',
sortable: false,
},
];

49
src/option/basicdata/defaultShipper.js

@ -0,0 +1,49 @@
export const columnList = [
{
prop: '',
label: '复选框',
type: 0,
width: 55,
fixed: true,
},
{
prop: '',
label: '序号',
type: 12,
values: '',
width: 55,
fixed: true,
},
{
label: '仓库名称',
prop: 'warehouseName',
type: 2,
values: '',
width: '150',
checkarr: [],
fixed: false,
sortable: true,
isTitleSearch: false,
},
{
label: '客户名称',
prop: 'clientName',
type: 2,
values: '',
width: '150',
checkarr: [],
fixed: false,
sortable: true,
isTitleSearch: false,
},
{
label: '操作',
prop: '',
type: 6,
values: '',
width: '150',
checkarr: [],
fixed: false,
sortable: true,
},
];

12
src/router/views/index.js

@ -1109,6 +1109,18 @@ export default [
}),
component: () => import('@/views/basicdata/TripartiteMaterial/list.vue'),
},
{
path: '/basicdata/TripartiteMaterial/detail',
name: '三方物料主体品类详情',
meta: {
i18n: 'dict',
},
props: route => ({
name: route.query.name,
id: route.query.id,
}),
component: () => import('@/views/basicdata/TripartiteMaterial/detail.vue'),
},
{
path: '/basicdata/ConfigureBillingAndWarehousing/list',
name: '配置开单及入库',

699
src/views/basicdata/TripartiteMaterial/detail.vue

@ -0,0 +1,699 @@
<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">
<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>
<!-- 下拉框 -->
<template v-else-if="item.type === 3">
<el-select
v-model="details.query[item.prop.replace('Name', '')]"
:placeholder="`请选择${item.label}`"
class="w100"
clearable
filterable
@change="
val => {
!val && delete details.query[item.prop.replace('Name', '')];
}
"
:multiple="item.multiple || false"
>
<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">
<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="handleBatchDelete">批量删除</el-button>
</div>
<!-- 头部右侧按钮模块 -->
<div class="avue-crud__right">
<el-button icon="Download" @click="handleExportData" circle></el-button>
<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="details.loadingObj.list"
@inputTxt="inputsc"
@timeCheck="timesc"
@selectCheck="selectsc"
@selection="selectionChange"
>
<template #default="slotProps">
<template v-if="slotProps.scope.column.label === '操作'">
<!-- 车次详情 -->
<el-text @click="() => handleEdit(slotProps.scope)"> </el-text>
<el-text @click="() => handleDelete(slotProps.scope)"> </el-text>
</template>
</template>
</tablecmt>
<!-- 分页模块 -->
<div class="avue-crud__pagination flex-c-sb mt10" 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, 5000]"
:page-size="page.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="page.total"
>
</el-pagination>
</div>
<!-- 新增 -->
<el-dialog
destroy-on-close
:modal-append-to-body="false"
:append-to-body="false"
:title="details.title"
width="50%"
v-model="details.popUpShow.addVisited"
draggable
align-center
>
<div v-loading="details.loadingObj.addTagLoading">
<el-form ref="ruleFormRef" :model="details.form" inline label-width="100px">
<el-form-item
label="品类"
style="width: 350px"
:rules="[
{
required: true,
message: '请选择品类',
trigger: ['blur', 'change'],
},
]"
prop="categoryId"
>
<!-- 下拉框 -->
<el-select
v-model="details.form.categoryId"
placeholder="请选择"
class="w100"
clearable
filterable
remote
reserve-keyword
default-first-option
:remote-method="value => debounce(getMaterialTree(value), 500)"
@change="() => handleChange(details.materialArr, 'categoryId', 'category')"
>
<el-option
v-for="val in details.materialArr"
:key="val.id"
:label="val.name"
:value="val.id"
/>
</el-select>
</el-form-item>
<el-form-item
label="主体"
style="width: 350px"
:rules="[
{
required: true,
message: '请选择主体',
trigger: ['blur', 'change'],
},
]"
prop="mainId"
>
<!-- 下拉框 -->
<el-select
v-model="details.form.mainId"
placeholder="请选择"
class="w100"
clearable
filterable
remote
reserve-keyword
default-first-option
:remote-method="value => debounce(getMainList(value), 500)"
@change="() => handleChange(details.mainList, 'mainId', 'mainName')"
>
<el-option
v-for="val in details.mainList"
:key="val.id"
:label="val.name"
:value="val.id"
/>
</el-select>
</el-form-item>
</el-form>
</div>
<div class="flex-c-c dialog-footer">
<el-button icon="Close" @click="details.popUpShow.addVisited = false"> </el-button>
<!-- 提交 -->
<el-button
icon="Position"
type="primary"
:loading="details.loadingObj.addTagLoading"
@click="handleSubmit"
>
</el-button>
</div>
</el-dialog>
</div>
</basic-container>
<MyPrint
width="780px"
:html="details.html"
v-model="details.popUpShow.dialogVisible"
:isShowExport="false"
/>
<!-- 列表配置显示 -->
<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 { getDictionaryBiz } from '@/api/system/dict';
import {
setNodeHeight,
handleClearTableQuery,
handleInputQuery,
handleSelectQuery,
handleTranslationDataSeclect,
getObjType,
debounce,
} from '@/utils/util';
import { columnListDetail } from '@/option/basicdata/TripartiteMaterial';
import { useRoute, useRouter } from 'vue-router';
import { deepClone } from '@/utils/util';
import {
postBasicdataMainCategoryPageList,
postEditMainCategory,
postRemoveMainCategory,
postMainList,
postLazyTree,
} from '@/api/basicdata/TripartiteMaterial';
import { ElMessage, ElMessageBox } from 'element-plus';
import { exportExcel } from '@/utils/exportData';
import { detail } from '@/api/flow/flow';
//
const $router = useRouter();
const $route = useRoute();
//
const ruleFormRef = ref();
const myUpload = 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(columnListDetail),
/** 列表数据 */
data: [],
/** 页面loading */
loadingObj: {
/** 列表加载loading */
list: false,
pageLoading: false,
},
/** 列表复选框选中的数据 */
selectionList: [],
/** 是否显示设置表格 */
drawerShow: false,
/** 分页参数 */
page: {
pageNum: 1,
pageSize: 30,
total: 0,
},
/** 列表Dom节点 */
listNode: '',
form: {},
popUpShow: {
/** 查看二维码 */
addVisited: false,
/** 上传 */
UploadPackageDelivery: false,
},
fullscreenObj: {
addVisited: false,
},
title: '新增' as '新增' | '编辑',
materialArr: [],
mainList: [],
});
const tableNodeRef = ref();
const { search, query, shortcuts, 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 = {}) => {
try {
// loading
details.loadingObj.list = true;
const submitData = {
...details.page,
...details.query,
...params,
factoryCategoryId: $route.query.factoryCategoryId,
};
delete submitData.total;
//
const res = await postBasicdataMainCategoryPageList(submitData);
console.log('res :>> ', res);
const { code, data } = res.data;
if (code !== 200) return;
details.data = data.records;
details.page.total = data.total;
handleTranslationDataSeclect(details.data, details.columnList);
return res.data;
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.list = false;
}
};
const initOnLoad = (params = {}) => {
details.page.pageNum = 1;
details.page.total = 0;
onLoad(params);
};
initOnLoad();
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 () => {
try {
details.page.pageNum = 1;
details.loadingObj.pageLoading = true;
await Promise.all([
//
getDictionaryBiz('category').then(res => handleData('类型', res)),
onLoad(false),
]);
await nextTick();
handleTranslationDataSeclect(details.data, details.columnList);
console.log('details.columnList :>> ', details.columnList);
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
};
initData();
/** 搜索 */
const searchChange = () => {
const { time } = details.query;
if (time?.length) {
[details.query.taskTimeStart, details.query.taskTimeEnd] = time;
} else {
delete details.query.taskTimeStart;
delete details.query.taskTimeEnd;
}
initOnLoad();
};
/** 清空表单 */
const searchReset = () => {
details.query = {};
details.page.pageNum = 1;
handleClearTableQuery(details.columnList);
initOnLoad();
};
/** 展开列表控件 */
const showdrawer = (_flag?: boolean) => {
details.drawerShow = _flag;
};
/** 是否开启搜索区 */
const searchHide = () => {
details.search = !details.search;
setNodeHeight(tableNodeRef.value.$el, '', true);
};
/** 表格表头输入框搜索 */
const inputsc = (index, col) => {
handleInputQuery(index, col, details.query);
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 selectsc = (index, colors) => {
handleSelectQuery(index, colors, details.query);
initOnLoad();
};
/** 表格表头复选框选择 */
const selectionChange = (list: any) => {
details.selectionList = list;
};
/** 每页数量改变执行的回调 */
const sizeChange = (size: number) => {
details.page.pageSize = size;
initOnLoad();
};
/** 页码改变执行的回调 */
const currentChange = pageNum => {
details.page.pageNum = pageNum;
onLoad();
};
/** 搜索物料 */
const getMaterialTree = async value => {
// if(value)
const res = await postLazyTree({ name: value });
const { code, data } = res.data;
if (code !== 200) return;
details.materialArr = data;
console.log('data :>> ', data);
};
getMaterialTree('');
const getMainList = async value => {
// if(value)
const res = await postMainList({ name: value });
const { code, data } = res.data;
if (code !== 200) return;
details.mainList = data;
console.log('data :>> ', data);
};
getMainList('');
/**
* 赋值
* @param list 循环数组
* @param key 对比key
* @param key2 赋值key
*/
const handleChange = (list, key, key2) => {
const _list = [...list];
let _value = '';
for (let i = 0; i < _list.length; i++) {
const val = _list[i];
if (val.id !== details.form[key]) continue;
_value = val.name;
}
details.form[key2] = _value;
};
/** 查看详情 */
const viewDetails = ({ row }) => {
$router.push({
path: '/warehouse/prewarehousing/PreStoragePackage',
query: {
waybillNumber: row.waybillNumber,
distrCarNumber: row.distrCarNumber,
orderCode: row.orderCode,
},
});
};
/** 导出表格数据 */
const handleExportData = () => {
exportExcel(details.columnList, details.data, '产品 - ' + new Date().getTime());
};
/**
* 是否开启全屏
* @params(_type) 开启或关闭
*/
const handleFullScrean = (_type: 'open' | 'close', _name: string) => {
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.form = {};
details.title = '新增';
details.popUpShow.addVisited = true;
};
/** 编辑 */
const handleEdit = ({ row }) => {
details.title = '编辑';
for (let i = 0; i < details.columnList.length; i++) {
const value = details.columnList[i];
if (!value.isTitleSearch) continue;
const _key = value.prop.replace('Name', '');
details.form[_key] = row[_key];
}
details.form.id = row.id;
details.popUpShow.addVisited = true;
};
/** 提交 */
const handleSubmit = () => {
ruleFormRef.value.validate(async valid => {
if (!valid) return;
try {
details.popUpShow.addVisited = false;
details.loadingObj.pageLoading = true;
const submitData = { ...details.form, factoryCategoryId: $route.query.factoryCategoryId };
const res = await postEditMainCategory(submitData);
const { code, data } = res.data;
if (code !== 200) return;
ElMessage.success('操作成功');
onLoad();
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
});
};
/** 删除 */
const handleDelete = ({ row }) => {
ElMessageBox.confirm('确认删除', '提示', {
type: 'warning',
}).then(async () => {
try {
details.loadingObj.pageLoading = true;
const res = await postRemoveMainCategory({ ids: [row.id] });
const { code, msg } = res.data;
if (code !== 200) return;
ElMessage.success(msg);
onLoad();
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
});
};
/** 批量删除 */
const handleBatchDelete = () => {
if (details.selectionList.length === 0) return ElMessage.warning('请选择需要删除的数据');
ElMessageBox.confirm('确认删除', '提示', {
type: 'warning',
}).then(async () => {
try {
details.loadingObj.pageLoading = true;
const res = await postRemoveMainCategory({
ids: details.selectionList.map(val => val.id),
});
const { code, msg } = res.data;
if (code !== 200) return;
ElMessage.success(msg);
onLoad();
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
});
};
</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;
}
</style>

10
src/views/basicdata/TripartiteMaterial/list.vue

@ -58,7 +58,7 @@
>
<template #default="slotProps">
<template v-if="slotProps.scope.column.label === '操作'">
<!-- <el-text @click="handleEdit(slotProps.scope)"> 编辑 </el-text> -->
<el-text @click="handleJumpDetail(slotProps.scope)"> 详情 </el-text>
<el-text @click="handleRemove(slotProps.scope)"> 删除 </el-text>
</template>
</template>
@ -589,6 +589,14 @@ const handleSubmit = () => {
});
};
/** 跳转详情 */
const handleJumpDetail = ({ row }) => {
$router.push({
path: '/basicdata/TripartiteMaterial/detail',
query: { name: '主体品类详情', factoryCategoryId: row.id },
});
};
/** 删除 */
const handleRemove = ({ row }) => {
ElMessageBox.confirm('确认删除吗?', '', {

616
src/views/basicdata/warehouse/defaultShipper.vue

@ -0,0 +1,616 @@
<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">
<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>
<!-- 下拉框 -->
<template v-else-if="item.type === 3">
<el-select
v-model="details.query[item.prop.replace('Name', '')]"
:placeholder="`请选择${item.label}`"
class="w100"
clearable
filterable
@change="
val => {
!val && delete details.query[item.prop.replace('Name', '')];
}
"
:multiple="item.multiple || false"
>
<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">
<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="handleBatchDelete">批量删除</el-button>
</div>
<!-- 头部右侧按钮模块 -->
<div class="avue-crud__right">
<el-button icon="Download" @click="handleExportData" circle></el-button>
<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="details.loadingObj.list"
@inputTxt="inputsc"
@timeCheck="timesc"
@selectCheck="selectsc"
@selection="selectionChange"
>
<template #default="slotProps">
<template v-if="slotProps.scope.column.label === '操作'">
<!-- 车次详情 -->
<el-text @click="() => handleEdit(slotProps.scope)"> </el-text>
<el-text @click="() => handleDelete(slotProps.scope)"> </el-text>
</template>
</template>
</tablecmt>
<!-- 分页模块 -->
<div class="avue-crud__pagination flex-c-sb mt10" 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.current"
:page-sizes="[30, 50, 80, 120, 5000]"
:page-size="page.size"
layout="total, sizes, prev, pager, next, jumper"
:total="page.total"
>
</el-pagination>
</div>
<!-- 开标签 -->
<el-dialog
destroy-on-close
:modal-append-to-body="false"
:append-to-body="false"
:title="details.title"
width="50%"
v-model="details.popUpShow.addVisited"
draggable
align-center
>
<div v-loading="details.loadingObj.addTagLoading">
<el-form ref="ruleFormRef" :model="details.form" inline label-width="100px">
<template v-for="item in details.columnList" :key="item.prop">
<el-form-item
v-if="item.isTitleSearch"
:label="item.label"
style="width: 350px"
:rules="[
{
required: true,
message: `${{ 2: '请输入', 3: '请选择' }[item.type] + item.label}`,
trigger: ['blur', 'change'],
},
]"
:prop="item.prop.replace('Name', '')"
>
<!-- 普通输入框 -->
<template v-if="item.type === 2">
<el-input
class="w100"
:placeholder="`请输入${item.label}`"
v-model="details.form[item.prop]"
clearable
></el-input>
</template>
<!-- 下拉框 -->
<template v-else-if="item.type === 3">
<el-select
v-model="details.form[item.prop.replace('Name', '')]"
:placeholder="`请选择${item.label}`"
class="w100"
clearable
filterable
:multiple="item.multiple || false"
>
<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>
</div>
<div class="flex-c-c dialog-footer">
<el-button icon="Close" @click="details.popUpShow.addVisited = false"> </el-button>
<!-- 提交 -->
<el-button
icon="Position"
type="primary"
:loading="details.loadingObj.addTagLoading"
@click="handleSubmit"
>
</el-button>
</div>
</el-dialog>
</div>
</basic-container>
<MyPrint
width="780px"
:html="details.html"
v-model="details.popUpShow.dialogVisible"
:isShowExport="false"
/>
<!-- 列表配置显示 -->
<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 { getDictionaryBiz } from '@/api/system/dict';
import {
downloadXls,
setNodeHeight,
handleClearTableQuery,
handleInputQuery,
handleSelectQuery,
handleTranslationDataSeclect,
getObjType,
} from '@/utils/util';
import { columnList } from '@/option/basicdata/defaultShipper';
import { useRouter } from 'vue-router';
import { deepClone } from '@/utils/util';
import { postEditUnit, postPageList, postRemoveUnit } from '@/api/basicdata/defaultShipper';
import { ElMessage, ElMessageBox } from 'element-plus';
import { exportExcel } from '@/utils/exportData';
//
const $router = useRouter();
//
const ruleFormRef = ref();
const myUpload = 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(columnList),
/** 列表数据 */
data: [],
/** 页面loading */
loadingObj: {
/** 列表加载loading */
list: false,
pageLoading: false,
},
/** 列表复选框选中的数据 */
selectionList: [],
/** 是否显示设置表格 */
drawerShow: false,
/** 分页参数 */
page: {
current: 1,
size: 30,
total: 0,
},
/** 列表Dom节点 */
listNode: '',
form: {},
popUpShow: {
/** 查看二维码 */
addVisited: false,
/** 上传 */
UploadPackageDelivery: false,
},
fullscreenObj: {
addVisited: false,
},
title: '新增' as '新增' | '编辑',
});
const tableNodeRef = ref();
const { search, query, shortcuts, 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 = {}) => {
try {
// loading
details.loadingObj.list = true;
const submitData = { ...details.page, ...details.query, ...params };
delete submitData.total;
//
const res = await postPageList(submitData);
console.log('res :>> ', res);
const { code, data } = res.data;
if (code !== 200) return;
details.data = data.records;
details.page.total = data.total;
handleTranslationDataSeclect(details.data, details.columnList);
return res.data;
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.list = false;
}
};
const initOnLoad = (params = {}) => {
details.page.current = 1;
details.page.total = 0;
onLoad(params);
};
initOnLoad();
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 () => {
try {
details.page.current = 1;
details.loadingObj.pageLoading = true;
await Promise.all([
//
getDictionaryBiz('category').then(res => handleData('类型', res)),
onLoad(false),
]);
await nextTick();
handleTranslationDataSeclect(details.data, details.columnList);
console.log('details.columnList :>> ', details.columnList);
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
};
initData();
/** 搜索 */
const searchChange = () => {
const { time } = details.query;
if (time?.length) {
[details.query.taskTimeStart, details.query.taskTimeEnd] = time;
} else {
delete details.query.taskTimeStart;
delete details.query.taskTimeEnd;
}
initOnLoad();
};
/** 清空表单 */
const searchReset = () => {
details.query = {};
details.page.current = 1;
handleClearTableQuery(details.columnList);
initOnLoad();
};
/** 展开列表控件 */
const showdrawer = (_flag?: boolean) => {
details.drawerShow = _flag;
};
/** 是否开启搜索区 */
const searchHide = () => {
details.search = !details.search;
setNodeHeight(tableNodeRef.value.$el, '', true);
};
/** 表格表头输入框搜索 */
const inputsc = (index, col) => {
handleInputQuery(index, col, details.query);
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 selectsc = (index, colors) => {
handleSelectQuery(index, colors, details.query);
initOnLoad();
};
/** 表格表头复选框选择 */
const selectionChange = (list: any) => {
details.selectionList = list;
};
/** 每页数量改变执行的回调 */
const sizeChange = (size: number) => {
details.page.size = size;
initOnLoad();
};
/** 页码改变执行的回调 */
const currentChange = current => {
details.page.current = current;
onLoad();
};
/** 查看详情 */
const viewDetails = ({ row }) => {
$router.push({
path: '/warehouse/prewarehousing/PreStoragePackage',
query: {
waybillNumber: row.waybillNumber,
distrCarNumber: row.distrCarNumber,
orderCode: row.orderCode,
},
});
};
/** 导出表格数据 */
const handleExportData = () => {
exportExcel(details.columnList, details.data, '产品 - ' + new Date().getTime());
};
/**
* 是否开启全屏
* @params(_type) 开启或关闭
*/
const handleFullScrean = (_type: 'open' | 'close', _name: string) => {
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.form = {};
details.title = '新增';
details.popUpShow.addVisited = true;
};
/** 编辑 */
const handleEdit = ({ row }) => {
details.title = '编辑';
for (let i = 0; i < details.columnList.length; i++) {
const value = details.columnList[i];
if (!value.isTitleSearch) continue;
const _key = value.prop.replace('Name', '');
details.form[_key] = row[_key];
}
details.form.id = row.id;
details.popUpShow.addVisited = true;
};
/** 提交 */
const handleSubmit = () => {
ruleFormRef.value.validate(async valid => {
if (!valid) return;
try {
details.popUpShow.addVisited = false;
details.loadingObj.pageLoading = true;
const submitData = { ...details.form };
const res = await postEditUnit(submitData);
const { code, data } = res.data;
if (code !== 200) return;
ElMessage.success('操作成功');
onLoad();
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
});
};
/** 删除 */
const handleDelete = ({ row }) => {
ElMessageBox.confirm('确认删除', '提示', {
type: 'warning',
}).then(async () => {
try {
details.loadingObj.pageLoading = true;
const res = await postRemoveUnit({ ids: row.id });
const { code, msg } = res.data;
if (code !== 200) return;
ElMessage.success(msg);
onLoad();
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
});
};
/** 批量删除 */
const handleBatchDelete = () => {
if (details.selectionList.length === 0) return ElMessage.warning('请选择需要删除的数据');
ElMessageBox.confirm('确认删除', '提示', {
type: 'warning',
}).then(async () => {
try {
details.loadingObj.pageLoading = true;
const res = await postRemoveUnit({ ids: details.selectionList.map(val => val.id).join(',') });
const { code, msg } = res.data;
if (code !== 200) return;
ElMessage.success(msg);
onLoad();
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
});
};
</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;
}
</style>

53
src/views/distribution/inventory/CreateOrder.vue

@ -2017,6 +2017,8 @@ const details = reactive<any>({
/** 批量设置品类 -- 名称 */
incomeCategoryName: '',
},
/** 被选中的暂存单id数组 */
ids: [],
});
details.deepQuery = deepClone(details.query);
@ -2739,6 +2741,8 @@ const handleChoose = () => {
}
const ids = details.selectionList.map(val => val.id);
details.ids = ids;
//
initPageInfo(ids);
details.submitType = details.orderStatus;
@ -2933,6 +2937,54 @@ const handleComputed = (row: any, onlyComputedTrunline = false, chargeType = nul
handlePrice(!onlyComputedTrunline, 'trunkline');
};
/** 重新获取包件数据 */
const initPackageList = async () => {
if (details.submitType === 'notHaveData') return;
const res = await (details.pageInfo.type === 'edit'
? //
postFindAdvanceDetailListByWaybillId({
waybillId: details.pageInfo.id,
clientId: details.query.consigneeId,
})
: //
postFindAdvanceDetailListByAdvanceIds({
advanceIds: details.ids.length > 0 ? details.ids : JSON.parse(details.pageInfo.ids),
clientId: details.query.consigneeId,
}));
const { code, data } = res.data;
if (code !== 200) return;
details.package.data = data || [];
let _flag = false;
for (let i = 0; i < details.package.data.length; i++) {
const element = details.package.data[i];
initPackage(element);
//
element.cloneIncomeCategoryId = element.incomeCategoryId || ''; // , confirmIncomeCategoryId
//
element.cloneCostCategoryId = element.costCategoryId || ''; // , confirmCostCategoryId
!element.incomeCategoryId && (_flag = true);
}
details.package.renderData = handleFilterData(details.package.data, [], details.package.query);
if (!_flag) return;
ElMessage.warning('存在数据未维护结算品类,请维护品类信息');
handleSubmitPackage();
// await nextTick();
// handleShow();
console.log('res :>> ', res);
};
/** 查询客户信息 */
const handleFindClientInfo = async (type, isClearId = 0) => {
try {
@ -3019,6 +3071,7 @@ const handleChooseConsigner = (column, prop, order) => {
handleFindClientInfo('consigneeName');
handleFindClientInfo('consigneeMobile');
handleCloseSelcet();
initPackageList();
};
/** 切换tabBar */

Loading…
Cancel
Save