Browse Source

晚上报表配置

dev
qb 3 months ago
parent
commit
e6819b2d13
  1. 7
      src/views/finance/WaybillAudit.vue
  2. 184
      src/views/reportformsOption/AllTrunklineConfig.vue
  3. 179
      src/views/reportformsOption/OrderAllConfig.vue

7
src/views/finance/WaybillAudit.vue

@ -442,6 +442,13 @@ const onLoad = async () => {
!value.payStatus && (value.payStatus = '10');
!value.settlementStatus && (value.settlementStatus = '10');
for (let j = 0; j < details.columnList.length; j++) {
const item = details.columnList[j];
if (!item.isshowSummary) continue;
value[item.prop] = Number(value[item.prop]);
}
}
details.page.total = data.total;

184
src/views/reportformsOption/AllTrunklineConfig.vue

@ -63,13 +63,15 @@
</div>
<!-- 新增配置 -->
<el-dialog title="新增配置" width="780px" v-model="details.popUpShow.add">
<el-dialog title="新增配置" width="780px" destroy-on-close v-model="details.popUpShow.add">
<div class="el-dialog-add">
<el-form :inline="true" :model="details.form" label-width="100px">
<el-form :inline="true" ref="formRef" :model="details.form" label-width="100px">
<el-form-item
v-for="item in details.addFormOption"
:key="item.prop"
:label="item.label"
:prop="item.prop"
:rules="item.rules || []"
>
<template v-if="item.type === 'number'">
<el-input-number
@ -87,8 +89,10 @@
v-model="details.form[item.prop]"
filterable
:multiple="item.multiple || false"
:placeholder="`请输入${item.label}`"
placeholder="全部"
:disabled="item.disabled"
clearable
@change="() => handleChange(item.prop, item.checkarr)"
>
<el-option
v-for="value in item.checkarr"
@ -165,6 +169,7 @@ const $store = useStore();
//
const tableNodeRef = ref();
const formRef = ref();
const details = reactive<any>({
/** 是否开启搜索 */
@ -242,14 +247,17 @@ const details = reactive<any>({
type: 'select',
checkarr: [],
disabled: false,
rules: [],
},
{
label: '目的仓',
prop: 'destinationWarehouseId',
prop: 'destinationWarehouseDTOList',
type: 'select',
checkarr: [],
disabled: false,
multiple: true,
rules: [],
},
{
@ -276,9 +284,9 @@ const details = reactive<any>({
/** 目的仓 */
destinationWarehouseName: '',
/** 目的仓id */
destinationWarehouseId: '全部',
destinationWarehouseDTOList: [],
/** 时效(小时) */
hoursTime: 0,
dayTime: 0,
},
form: {} as any,
});
@ -329,12 +337,36 @@ const onLoad = async (params = {}) => {
};
const init = () => {
// const time = new Date().getTime();
details.addFormOption[0].rules = [
{
required: computed(
() =>
(details.form.destinationWarehouseDTOList &&
details.form.destinationWarehouseDTOList.length > 0) ||
Boolean(details.form.departureWarehouseName)
),
message: '请选择始发仓',
trigger: 'change',
},
];
// details.query.timeArr = [
// dayjs(time - 1000 * 60 * 60 * 24 * 7).format('YYYY-MM-DD'),
// dayjs(time).format('YYYY-MM-DD'),
// ];
details.addFormOption[1].rules = [
{
required: computed(() => {
console.log(
'details.form.departureWarehouseName :>> ',
details.form.departureWarehouseName
);
return (
(details.form.destinationWarehouseDTOList &&
details.form.destinationWarehouseDTOList.length > 0) ||
Boolean(details.form.departureWarehouseName)
);
}),
message: '请选择目的仓',
trigger: 'change',
},
];
onLoad();
};
@ -448,6 +480,38 @@ const currentChange = pageNum => {
onLoad();
};
const departureWarehouseChange = (prop, checkarr) => {
details.form.departureWarehouseName = '';
for (let i = 0; i < checkarr.length; i++) {
const value = checkarr[i];
if (value.dictKey !== details.form[prop]) continue;
details.form.departureWarehouseName = value.dictValue;
break;
}
};
/** 下拉框值变化时 */
const handleChange = (prop, checkarr) => {
switch (prop) {
case 'departureWarehouseId':
departureWarehouseChange(prop, checkarr);
break;
default:
break;
}
if (
(details.form.destinationWarehouseDTOList &&
details.form.destinationWarehouseDTOList.length === 0) ||
!Boolean(details.form.departureWarehouseName)
) {
formRef.value.validate();
}
};
/** 新增 */
const handleAdd = () => {
details.form = deepClone(details.initForm);
@ -457,46 +521,68 @@ const handleAdd = () => {
/** 新增提交 */
const handleSubmitAdd = async () => {
try {
details.loadingObj.pageLoading = true;
const submitData = deepClone(details.form);
for (let i = 0; i < details.warehouseOption.length; i++) {
const value = details.warehouseOption[i];
if (submitData.departureWarehouseId === value.dictKey) {
submitData.departureWarehouseName = value.dictValue;
}
if (submitData.destinationWarehouseId === value.dictKey) {
submitData.destinationWarehouseName = value.dictValue;
formRef.value.validate(async (valid, fields) => {
if (valid) {
try {
details.loadingObj.pageLoading = true;
const submitData = deepClone(details.form);
for (let i = 0; i < details.warehouseOption.length; i++) {
const value = details.warehouseOption[i];
if (submitData.departureWarehouseId === value.dictKey) {
submitData.departureWarehouseName = value.dictValue;
}
if (submitData.destinationWarehouseId === value.dictKey) {
submitData.destinationWarehouseName = value.dictValue;
}
}
for (let i = 0; i < submitData.destinationWarehouseDTOList.length; i++) {
const val = submitData.destinationWarehouseDTOList[i];
for (let j = 0; j < details.warehouseOption.length; j++) {
const item = details.warehouseOption[j];
if (val !== item.dictKey) continue;
// submitData.destinationWarehouseName = item.dictValue;
submitData.destinationWarehouseDTOList[i] = {
warehouseName: item.dictValue,
warehouseId: item.dictKey,
};
break;
}
}
if (submitData.departureWarehouseId === '全部') {
submitData.departureWarehouseId = '';
submitData.departureWarehouseName = '全部';
}
if (submitData.destinationWarehouseDTOList.length === 0) {
submitData.destinationWarehouseDTOList = [{ warehouseName: '全部', warehouseId: '' }];
submitData.destinationWarehouseName = '全部';
}
details.popUpShow.add = false;
const res = await postAddAllTrunklineConfig(submitData);
const { code, data, msg } = res.data;
if (code !== 200) return;
ElMessage.success(msg);
onLoad();
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
} else {
console.log('error submit!', fields);
}
if (submitData.departureWarehouseId === '全部') {
submitData.departureWarehouseId = '';
submitData.departureWarehouseName = '全部';
}
if (submitData.destinationWarehouseId === '全部') {
submitData.destinationWarehouseId = '';
submitData.destinationWarehouseName = '全部';
}
details.popUpShow.add = false;
const res = await postAddAllTrunklineConfig(submitData);
const { code, data, msg } = res.data;
if (code !== 200) return;
ElMessage.success(msg);
onLoad();
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
});
};
/** 删除提交 */

179
src/views/reportformsOption/OrderAllConfig.vue

@ -63,13 +63,15 @@
</div>
<!-- 新增配置 -->
<el-dialog title="新增配置" width="780px" v-model="details.popUpShow.add">
<el-dialog title="新增配置" width="780px" destroy-on-close v-model="details.popUpShow.add">
<div class="el-dialog-add">
<el-form :inline="true" :model="details.form" label-width="100px">
<el-form :inline="true" ref="formRef" :model="details.form" label-width="100px">
<el-form-item
v-for="item in details.addFormOption"
:key="item.prop"
:label="item.label"
:prop="item.prop"
:rules="item.rules || []"
>
<template v-if="item.type === 'number'">
<el-input-number
@ -87,8 +89,10 @@
v-model="details.form[item.prop]"
filterable
:multiple="item.multiple || false"
:placeholder="`请输入${item.label}`"
placeholder="全部"
:disabled="item.disabled"
clearable
@change="() => handleChange(item.prop, item.checkarr)"
>
<el-option
v-for="value in item.checkarr"
@ -165,6 +169,7 @@ const $store = useStore();
//
const tableNodeRef = ref();
const formRef = ref();
const details = reactive<any>({
/** 是否开启搜索 */
@ -242,6 +247,7 @@ const details = reactive<any>({
type: 'select',
checkarr: [],
disabled: false,
rules: [],
},
{
@ -251,6 +257,7 @@ const details = reactive<any>({
checkarr: [],
disabled: false,
multiple: true,
rules: [],
},
{
@ -277,9 +284,9 @@ const details = reactive<any>({
/** 目的仓 */
destinationWarehouseName: '',
/** 目的仓id */
destinationWarehouseDTOList: '全部',
destinationWarehouseDTOList: [],
/** 时效(小时) */
hoursTime: 0,
dayTime: 0,
},
form: {} as any,
});
@ -330,6 +337,38 @@ const onLoad = async (params = {}) => {
};
const init = () => {
details.addFormOption[0].rules = [
{
required: computed(
() =>
(details.form.destinationWarehouseDTOList &&
details.form.destinationWarehouseDTOList.length > 0) ||
Boolean(details.form.departureWarehouseName)
),
message: '请选择始发仓',
trigger: 'change',
},
];
details.addFormOption[1].rules = [
{
required: computed(() => {
console.log(
'details.form.departureWarehouseName :>> ',
details.form.departureWarehouseName
);
return (
(details.form.destinationWarehouseDTOList &&
details.form.destinationWarehouseDTOList.length > 0) ||
Boolean(details.form.departureWarehouseName)
);
}),
message: '请选择目的仓',
trigger: 'change',
},
];
console.log('details.addFormOption :>> ', details.addFormOption);
// const time = new Date().getTime();
// details.query.timeArr = [
@ -449,6 +488,38 @@ const currentChange = pageNum => {
onLoad();
};
const departureWarehouseChange = (prop, checkarr) => {
details.form.departureWarehouseName = '';
for (let i = 0; i < checkarr.length; i++) {
const value = checkarr[i];
if (value.dictKey !== details.form[prop]) continue;
details.form.departureWarehouseName = value.dictValue;
break;
}
};
/** 下拉框值变化时 */
const handleChange = (prop, checkarr) => {
switch (prop) {
case 'departureWarehouseId':
departureWarehouseChange(prop, checkarr);
break;
default:
break;
}
if (
(details.form.destinationWarehouseDTOList &&
details.form.destinationWarehouseDTOList.length === 0) ||
!Boolean(details.form.departureWarehouseName)
) {
formRef.value.validate();
}
};
/** 新增 */
const handleAdd = () => {
details.form = deepClone(details.initForm);
@ -458,46 +529,68 @@ const handleAdd = () => {
/** 新增提交 */
const handleSubmitAdd = async () => {
try {
details.loadingObj.pageLoading = true;
const submitData = deepClone(details.form);
for (let i = 0; i < details.warehouseOption.length; i++) {
const value = details.warehouseOption[i];
if (submitData.departureWarehouseId === value.dictKey) {
submitData.departureWarehouseName = value.dictValue;
}
if (submitData.destinationWarehouseId === value.dictKey) {
submitData.destinationWarehouseName = value.dictValue;
formRef.value.validate(async (valid, fields) => {
if (valid) {
try {
details.loadingObj.pageLoading = true;
const submitData = deepClone(details.form);
for (let i = 0; i < details.warehouseOption.length; i++) {
const value = details.warehouseOption[i];
if (submitData.departureWarehouseId === value.dictKey) {
submitData.departureWarehouseName = value.dictValue;
}
if (submitData.destinationWarehouseId === value.dictKey) {
submitData.destinationWarehouseName = value.dictValue;
}
}
for (let i = 0; i < submitData.destinationWarehouseDTOList.length; i++) {
const val = submitData.destinationWarehouseDTOList[i];
for (let j = 0; j < details.warehouseOption.length; j++) {
const item = details.warehouseOption[j];
if (val !== item.dictKey) continue;
// submitData.destinationWarehouseName = item.dictValue;
submitData.destinationWarehouseDTOList[i] = {
warehouseName: item.dictValue,
warehouseId: item.dictKey,
};
break;
}
}
if (submitData.departureWarehouseId === '全部') {
submitData.departureWarehouseId = '';
submitData.departureWarehouseName = '全部';
}
if (submitData.destinationWarehouseDTOList.length === 0) {
submitData.destinationWarehouseDTOList = [{ warehouseName: '全部', warehouseId: '' }];
submitData.destinationWarehouseName = '全部';
}
details.popUpShow.add = false;
const res = await postAddOrderAllConfig(submitData);
const { code, data, msg } = res.data;
if (code !== 200) return;
ElMessage.success(msg);
onLoad();
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
} else {
console.log('error submit!', fields);
}
if (submitData.departureWarehouseId === '全部') {
submitData.departureWarehouseId = '';
submitData.departureWarehouseName = '全部';
}
if (submitData.destinationWarehouseId === '全部') {
submitData.destinationWarehouseDTOList = [];
submitData.destinationWarehouseName = '全部';
}
details.popUpShow.add = false;
const res = await postAddOrderAllConfig(submitData);
const { code, data, msg } = res.data;
if (code !== 200) return;
ElMessage.success(msg);
onLoad();
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
});
};
/** 删除提交 */

Loading…
Cancel
Save