Commit 8b3b7086 authored by 1483922988@qq.com's avatar 1483922988@qq.com

6

parent aa924e3b
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item :label="$t('关键字')" prop="key">
<el-input v-model="queryParams.key" :placeholder="$t('请输入关键字查找')" clearable/>
<el-input
v-model="queryParams.key"
:placeholder="$t('请输入关键字查找')"
clearable
/>
</el-form-item>
<el-form-item :label="$t('运输方式')" prop="transportType">
<dict-selector :type="DICT_TYPE.ECW_TRANSPORT_TYPE" v-model="queryParams.transportType" formatter="number"
clearable/>
<dict-selector
:type="DICT_TYPE.ECW_TRANSPORT_TYPE"
v-model="queryParams.transportType"
formatter="number"
clearable
/>
</el-form-item>
<el-form-item :label="$t('唛头')" prop="marks">
<el-input v-model="queryParams.marks" :placeholder="$t('请输入关键字查找')" clearable/>
<el-input
v-model="queryParams.marks"
:placeholder="$t('请输入关键字查找')"
clearable
/>
</el-form-item>
<el-form-item :label="$t('资源类型')" prop="customerType">
<!-- <el-select clearable v-model="queryParams.customerType" :placeholder="$t('请选择资源类型')" clearable size="small">
<el-option v-for="dict in getDictDatas(DICT_TYPE.CUSTOMER_ESOURCE_TYPE)"
:key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select> -->
<dict-selector :type="DICT_TYPE.CUSTOMER_ESOURCE_TYPE" v-model="queryParams.customerType"
:placeholder="$t('请选择资源类型')" clearable></dict-selector>
<dict-selector
:type="DICT_TYPE.CUSTOMER_ESOURCE_TYPE"
v-model="queryParams.customerType"
:placeholder="$t('请选择资源类型')"
clearable
></dict-selector>
</el-form-item>
<!-- <el-form-item :label="$t('客户经理')" prop="customerService">
<el-select clearable v-model="queryParams.customerService" :placeholder="$t('请选择客户经理')" clearable size="small">
......@@ -34,9 +56,14 @@
</el-select>
</el-form-item> -->
<el-form-item prop="dateFilter">
<el-date-picker v-model="dateFilter" type="datetimerange" range-separator="-"
:start-placeholder="$t('开始日期')" :end-placeholder="$t('结束日期')"
value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
<el-date-picker
v-model="dateFilter"
type="datetimerange"
range-separator="-"
:start-placeholder="$t('开始日期')"
:end-placeholder="$t('结束日期')"
value-format="yyyy-MM-dd HH:mm:ss"
></el-date-picker>
<!-- <el-date-picker v-model="queryParams.beginStartTime" :placeholder="$t('请选择开始时间')" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>-->
</el-form-item>
<!-- <el-form-item :label="$t('结束时间')" prop="endStartTime">-->
......@@ -44,31 +71,70 @@
<!-- </el-form-item>-->
<el-form-item>
<el-form-item :label="$t('报价单号')" prop="key">
<el-input v-model="queryParams.number" :placeholder="$t('请输入报价单号')" clearable/>
<el-input
v-model="queryParams.number"
:placeholder="$t('请输入报价单号')"
clearable
/>
</el-form-item>
<el-form-item :label="$t('客户名称')" prop="key">
<el-input v-model="queryParams.name" :placeholder="$t('请输入客户名称')" clearable/>
<el-input
v-model="queryParams.name"
:placeholder="$t('请输入客户名称')"
clearable
/>
</el-form-item>
<el-form-item :label="$t('联系方式')" prop="key">
<el-input v-model="queryParams.phoneNew" :placeholder="$t('请输入联系方式')" clearable/>
<el-input
v-model="queryParams.phoneNew"
:placeholder="$t('请输入联系方式')"
clearable
/>
</el-form-item>
<el-form-item :label="$t('客户经理')" prop="userId">
<el-select clearable v-model="queryParams.userId" :placeholder="$t('请选择客户经理')" clearable size="small">
<el-option v-for="dict in customerServiceList"
:key="dict.id" :label="dict.nickname" :value="dict.id"/>
<el-select
clearable
v-model="queryParams.userId"
:placeholder="$t('请选择客户经理')"
clearable
size="small"
>
<el-option
v-for="dict in customerServiceList"
:key="dict.id"
:label="dict.nickname"
:value="dict.id"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('始发仓')" prop="startWarehouseId">
<el-select v-model="queryParams.startWarehouseId" :placeholder="$t('请选择始发仓')" clearable>
<el-option v-for="item in exportWarehouseList" :label="$l(item, 'title')" :value="item.id"
:key="item.id"></el-option>
<el-select
v-model="queryParams.startWarehouseId"
:placeholder="$t('请选择始发仓')"
clearable
>
<el-option
v-for="item in exportWarehouseList"
:label="$l(item, 'title')"
:value="item.id"
:key="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('目的仓')" prop="destWarehouseIdArr">
<el-select :multiple="true" v-model="queryParams.destWarehouseIdArr" multiple
:placeholder="$t('请选择目的仓')" clearable>
<el-option v-for="item in importWarehouseList" :label="$l(item, 'title')" :value="item.id"
:key="item.id"></el-option>
<el-select
:multiple="true"
v-model="queryParams.destWarehouseIdArr"
multiple
:placeholder="$t('请选择目的仓')"
clearable
>
<el-option
v-for="item in importWarehouseList"
:label="$l(item, 'title')"
:value="item.id"
:key="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="业绩类型">
......@@ -77,26 +143,38 @@
<el-option :value="0" label="旧客户"></el-option>
</el-select>
</el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">{{ $t('搜索') }}</el-button>
<el-button type="primary" icon="el-icon-search" @click="resetQuery">{{ $t('重置') }}</el-button>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">{{
$t("搜索")
}}</el-button>
<el-button type="primary" icon="el-icon-search" @click="resetQuery">{{
$t("重置")
}}</el-button>
<!-- <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
>{{$t('导出')}}</el-button> -->
</el-form-item>
</el-form>
<total_num :total-data="totalData"></total_num>
<!-- 列表 -->
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
<el-table
v-loading="loading"
:data="list"
@selection-change="handleSelectionChange"
>
<!-- <el-table-column :label="$t('序号')" align="center" type="index"></el-table-column> -->
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column type="selection" width="55"> </el-table-column>
<el-table-column :label="$t('资源类型')" align="center">
<template slot-scope="scope">
<dict-tag :type="DICT_TYPE.CUSTOMER_ESOURCE_TYPE" :value="scope.row.customerType"/>
<dict-tag
:type="DICT_TYPE.CUSTOMER_ESOURCE_TYPE"
:value="scope.row.customerType"
/>
</template>
</el-table-column>
<el-table-column :label="$t('业绩类型')" align="center" prop="achieveType"/>
<el-table-column
:label="$t('业绩类型')"
align="center"
prop="achieveType"
/>
<el-table-column :label="$t('报价单号')" align="center" width="180">
<template slot-scope="scope">
<span>{{ scope.row.number }}</span>
......@@ -107,26 +185,60 @@
<dict-tag :type="DICT_TYPE.ECW_OFFER_STATUS" :value="scope.row.offerStatus"/>
</template>
</el-table-column> -->
<el-table-column :label="$t('订单号')" align="center" prop="orderNo"/>
<el-table-column :label="$t('客户名称')" align="center" prop="name"/>
<el-table-column :label="$t('联系方式')" align="center" prop="phoneNew"/>
<el-table-column :label="$t('唛头')" align="center" prop="marks"/>
<el-table-column :label="$t('订单状态')" align="center" prop="statusMsg"/>
<el-table-column :label="$t('是否控货')" align="center" prop="isCargoControl">
<el-table-column :label="$t('订单号')" align="center" prop="orderNo" />
<el-table-column :label="$t('客户名称')" align="center" prop="name" />
<el-table-column :label="$t('联系方式')" align="center" prop="phoneNew" />
<el-table-column :label="$t('唛头')" align="center" prop="marks" />
<el-table-column
:label="$t('订单状态')"
align="center"
prop="statusMsg"
/>
<el-table-column
:label="$t('是否控货')"
align="center"
prop="isCargoControl"
>
<template slot-scope="scope">
{{ scope.row.isCargoControl ? $t('') : $t('') }}
{{ scope.row.isCargoControl ? $t("") : $t("") }}
</template>
</el-table-column>
<el-table-column :label="$t('重量')" align="center" prop="completeWeight"/>
<el-table-column :label="$t('方数')" align="center" prop="completeVolume"/>
<el-table-column :label="$t('下单时间')" align="center" prop="createTime"/>
<el-table-column :label="$t('业绩创建时间')" align="center" prop="ldBoxTime"/>
<el-table-column :label="$t('客户经理')" align="center" prop="userId" :formatter="customerServiceFn">
<el-table-column
:label="$t('重量')"
align="center"
prop="completeWeight"
/>
<el-table-column
:label="$t('方数')"
align="center"
prop="completeVolume"
/>
<el-table-column
:label="$t('下单时间')"
align="center"
prop="createTime"
/>
<el-table-column
:label="$t('业绩创建时间')"
align="center"
prop="ldBoxTime"
/>
<el-table-column
:label="$t('客户经理')"
align="center"
prop="userId"
:formatter="customerServiceFn"
>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
......@@ -140,18 +252,18 @@ import {
exportDeptTargetExcel,
getCreateInitData,
getPersonTargetPage,
myAchievementByPage
myAchievementByPage,
} from "@/api/ecw/deptTarget";
import {listSimpleDepts} from "@/api/system/dept";
import {getChannelList} from '@/api/ecw/channel';
import { listSimpleDepts } from "@/api/system/dept";
import { getChannelList } from "@/api/ecw/channel";
import dayjs from "dayjs";
import {listServiceUser} from "@/api/system/user";
import {getWarehouseList} from '@/api/ecw/warehouse'
import { listServiceUser } from "@/api/system/user";
import { getWarehouseList } from "@/api/ecw/warehouse";
import Total_num from "@/views/ecw/deptTarget/total_num.vue";
export default {
name: "EcwDepttargetMyachievement",
components: {Total_num},
components: { Total_num },
data() {
return {
// 遮罩层
......@@ -208,9 +320,27 @@ export default {
customerServiceList: [],
// 表单校验
rules: {
deptId: [{required: true, message: this.$t("部门ID不能为空"), trigger: "blur"}],
targetType: [{required: true, message: this.$t("目标类型不能为空"), trigger: "change"}],
cubeNum: [{required: true, message: this.$t("立方数不能为空"), trigger: "blur"}],
deptId: [
{
required: true,
message: this.$t("部门ID不能为空"),
trigger: "blur",
},
],
targetType: [
{
required: true,
message: this.$t("目标类型不能为空"),
trigger: "change",
},
],
cubeNum: [
{
required: true,
message: this.$t("立方数不能为空"),
trigger: "blur",
},
],
},
totalData: {
companyWeight: 0,
......@@ -224,27 +354,31 @@ export default {
sumNum: 0,
},
myAchievementData: {},
warehouseList: []
warehouseList: [],
};
},
computed: {
getShipChannelName() {
return shippingChannelId => {
return (shippingChannelId) => {
for (let index in this.channelList) {
let channelItem = this.channelList[index];
if (channelItem.channelId == shippingChannelId) {
return this.$l(channelItem, 'name');
}
return this.$l(channelItem, "name");
}
return '/'
}
return "/";
};
},
exportWarehouseList() {
/* tradeType 1 进口,2出口,3进出口 */
return this.warehouseList.filter(item => item.tradeType == 2 || item.tradeType == 3)
return this.warehouseList.filter(
(item) => item.tradeType == 2 || item.tradeType == 3
);
},
importWarehouseList() {
return this.warehouseList.filter(item => item.tradeType == 1 || item.tradeType == 3)
return this.warehouseList.filter(
(item) => item.tradeType == 1 || item.tradeType == 3
);
},
},
activated() {
......@@ -254,16 +388,16 @@ export default {
created() {
this.getChannelList();
this.getList();
listServiceUser().then(r => {
listServiceUser().then((r) => {
this.customerServiceList = r.data;
})
getWarehouseList().then(res => {
this.warehouseList = res.data
})
});
getWarehouseList().then((res) => {
this.warehouseList = res.data;
});
},
methods: {
getChannelList() {
getChannelList().then(res => this.channelList = res.data)
getChannelList().then((res) => (this.channelList = res.data));
},
dateFormat(val) {
return dayjs(val).format("YYYY-MM-DD");
......@@ -286,43 +420,71 @@ export default {
this.form.startTime = i.startDate;
this.form.endTime = i.endDate;
}
})
});
},
customerServiceFn(val) {
if (this.customerServiceList.length > 0) {
let index = this.customerServiceList.findIndex(item => item.id === val.userId);
return index !== -1 ? this.customerServiceList[index]?.nickname : ''
let index = this.customerServiceList.findIndex(
(item) => item.id === val.userId
);
return index !== -1 ? this.customerServiceList[index]?.nickname : "";
} else {
return ''
return "";
}
},
/** 查询列表 */
getList() {
this.loading = true;
const params = {...this.queryParams}
const params = { ...this.queryParams };
if (params.destWarehouseIdArr?.length) {
params.destWarehouseIds = params.destWarehouseIdArr.join(',')
params.destWarehouseIds = params.destWarehouseIdArr.join(",");
}
// 执行查询
myAchievementByPage(params).then(response => {
myAchievementByPage(params).then((response) => {
this.list = response.data.myAchievementDtos.list;
this.total = response.data.myAchievementDtos.total;
this.myAchievementData = response.data
this.totalData.sumWeight = this.myAchievementData.totalWeight
this.totalData.sumVolume = this.myAchievementData.totalVolume
this.totalData.sumNum = this.myAchievementData.totalNum
this.totalData.companyWeight = this.myAchievementData.companyTotalWeight
this.totalData.companyVolume = this.myAchievementData.companyTotalVolume
this.totalData.companyNum = this.myAchievementData.companyTotalNum
this.totalData.developWeight = this.myAchievementData.devTotalWeight
this.totalData.developVolume = this.myAchievementData.devTotalVolume
this.totalData.developNum = this.myAchievementData.devTotalNum
this.$set(this.totalData, 'newTotalNum', this.myAchievementData.newTotalNum)
this.$set(this.totalData, 'newTotalVolume', this.myAchievementData.newTotalVolume)
this.$set(this.totalData, 'newTotalWeight', this.myAchievementData.newTotalWeight)
this.$set(this.totalData, 'oldTotalNum', this.myAchievementData.oldTotalNum)
this.$set(this.totalData, 'oldTotalVolume', this.myAchievementData.oldTotalVolume)
this.$set(this.totalData, 'oldTotalWeight', this.myAchievementData.oldTotalWeight)
this.myAchievementData = response.data;
this.totalData.sumWeight = this.myAchievementData.totalWeight;
this.totalData.sumVolume = this.myAchievementData.totalVolume;
this.totalData.sumNum = this.myAchievementData.totalNum;
this.totalData.companyWeight =
this.myAchievementData.companyTotalWeight;
this.totalData.companyVolume =
this.myAchievementData.companyTotalVolume;
this.totalData.companyNum = this.myAchievementData.companyTotalNum;
this.totalData.developWeight = this.myAchievementData.devTotalWeight;
this.totalData.developVolume = this.myAchievementData.devTotalVolume;
this.totalData.developNum = this.myAchievementData.devTotalNum;
this.$set(
this.totalData,
"newTotalNum",
this.myAchievementData.newTotalNum
);
this.$set(
this.totalData,
"newTotalVolume",
this.myAchievementData.newTotalVolume
);
this.$set(
this.totalData,
"newTotalWeight",
this.myAchievementData.newTotalWeight
);
this.$set(
this.totalData,
"oldTotalNum",
this.myAchievementData.oldTotalNum
);
this.$set(
this.totalData,
"oldTotalVolume",
this.myAchievementData.oldTotalVolume
);
this.$set(
this.totalData,
"oldTotalWeight",
this.myAchievementData.oldTotalWeight
);
this.loading = false;
});
},
......@@ -356,14 +518,14 @@ export default {
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams = {page: 1,pageSize:10}
this.queryParams = { page: 1, pageSize: 10 };
// this.dateFilter = []
// this.dateRangeCreateTime = [];
// this.dateRangeStartTime = [];
// this.dateRangeEndTime = [];
// this.resetForm("queryForm");
// this.handleQuery();
this.getList()
this.getList();
},
/** 新增按钮操作 */
handleAdd() {
......@@ -380,7 +542,7 @@ export default {
this.tableOpen = true;
},
getTableList() {
getPersonTargetPage(this.tableQueryParams).then(res => {
getPersonTargetPage(this.tableQueryParams).then((res) => {
this.tableList = res.data.list;
this.tableTotal = res.data.total;
});
......@@ -389,7 +551,7 @@ export default {
handleUpdate(row) {
this.reset();
const id = row.id;
getDeptTarget(id).then(response => {
getDeptTarget(id).then((response) => {
this.form = response.data;
if (response.data.targetType === 1) {
this.targetPeriod = this.monthList;
......@@ -404,13 +566,13 @@ export default {
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
this.$refs["form"].validate((valid) => {
if (!valid) {
return;
}
// 修改的提交
if (this.form.id != null) {
updateDeptTarget(this.form).then(response => {
updateDeptTarget(this.form).then((response) => {
this.$modal.msgSuccess(this.$t("修改成功"));
this.open = false;
this.getList();
......@@ -418,7 +580,7 @@ export default {
return;
}
// 添加的提交
createDeptTarget(this.form).then(response => {
createDeptTarget(this.form).then((response) => {
this.$modal.msgSuccess(this.$t("新增成功"));
this.open = false;
this.getList();
......@@ -428,13 +590,18 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm(this.$t('是否确认删除部门业绩目标设置编号为{id}的数据项?', {id})).then(function () {
this.$modal
.confirm(
this.$t("是否确认删除部门业绩目标设置编号为{id}的数据项?", { id })
)
.then(function () {
return deleteDeptTarget(id);
}).then(() => {
})
.then(() => {
this.getList();
this.$modal.msgSuccess(this.$t("删除成功"));
}).catch(() => {
});
})
.catch(() => {});
},
handleSelectionChange(val) {
if (val && val.length > 0) {
......@@ -448,62 +615,66 @@ export default {
sumWeight: 0,
sumVolume: 0,
sumNum: 0,
}
val.forEach(item => {
};
val.forEach((item) => {
if (item.customerType == 1) {
data.developWeight += item.completeWeight
data.developVolume += item.completeVolume
data.developNum += item.sumNum
data.developWeight += item.completeWeight;
data.developVolume += item.completeVolume;
data.developNum += item.sumNum;
} else {
data.companyWeight += item.completeWeight
data.companyVolume += item.completeVolume
data.companyNum += item.sumNum
data.companyWeight += item.completeWeight;
data.companyVolume += item.completeVolume;
data.companyNum += item.sumNum;
}
data.sumWeight += item.completeWeight
data.sumVolume += item.completeVolume
data.sumNum += item.sumNum
})
data.sumWeight += item.completeWeight;
data.sumVolume += item.completeVolume;
data.sumNum += item.sumNum;
});
data.developVolume = data.developVolume.toFixed(2);
data.companyVolume = data.companyVolume.toFixed(2);
data.sumVolume = data.sumVolume.toFixed(2);
this.$set(this, 'totalData', data)
this.$set(this, "totalData", data);
} else {
this.totalData.sumWeight = this.myAchievementData.totalWeight
this.totalData.sumVolume = this.myAchievementData.totalVolume
this.totalData.sumNum = this.myAchievementData.totalNum
this.totalData.companyWeight = this.myAchievementData.companyTotalWeight
this.totalData.companyVolume = this.myAchievementData.companyTotalVolume
this.totalData.companyNum = this.myAchievementData.companyTotalNum
this.totalData.developWeight = this.myAchievementData.devTotalWeight
this.totalData.developVolume = this.myAchievementData.devTotalVolume
this.totalData.developNum = this.myAchievementData.devTotalNum
this.totalData.sumWeight = this.myAchievementData.totalWeight;
this.totalData.sumVolume = this.myAchievementData.totalVolume;
this.totalData.sumNum = this.myAchievementData.totalNum;
this.totalData.companyWeight =
this.myAchievementData.companyTotalWeight;
this.totalData.companyVolume =
this.myAchievementData.companyTotalVolume;
this.totalData.companyNum = this.myAchievementData.companyTotalNum;
this.totalData.developWeight = this.myAchievementData.devTotalWeight;
this.totalData.developVolume = this.myAchievementData.devTotalVolume;
this.totalData.developNum = this.myAchievementData.devTotalNum;
}
},
/** 导出按钮操作 */
handleExport() {
// 处理查询参数
let params = {...this.queryParams};
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
this.addBeginAndEndTime(params, this.dateRangeStartTime, 'startTime');
this.addBeginAndEndTime(params, this.dateRangeEndTime, 'endTime');
this.addBeginAndEndTime(params, this.dateRangeCreateTime, "createTime");
this.addBeginAndEndTime(params, this.dateRangeStartTime, "startTime");
this.addBeginAndEndTime(params, this.dateRangeEndTime, "endTime");
// 执行导出
this.$modal.confirm(this.$t('是否确认导出所有部门业绩目标设置数据项?')).then(() => {
this.$modal
.confirm(this.$t("是否确认导出所有部门业绩目标设置数据项?"))
.then(() => {
this.exportLoading = true;
return exportDeptTargetExcel(params);
}).then(response => {
this.$download.excel(response, `${this.$t('我的业绩')}.xls`);
})
.then((response) => {
this.$download.excel(response, `${this.$t("我的业绩")}.xls`);
this.exportLoading = false;
}).catch(() => {
});
}
}
})
.catch(() => {});
},
},
};
</script>
<style scoped>
.total_num {
display: flex;
......
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item :label="$t('关键字')" prop="key">
<el-input v-model="queryParams.key" :placeholder="$t('请输入关键字查找')"/>
<el-input
v-model="queryParams.key"
:placeholder="$t('请输入关键字查找')"
/>
</el-form-item>
<el-form-item :label="$t('运输方式')" prop="transportType">
<dict-selector :type="DICT_TYPE.ECW_TRANSPORT_TYPE" v-model="queryParams.transportType" formatter="number"/>
<dict-selector
:type="DICT_TYPE.ECW_TRANSPORT_TYPE"
v-model="queryParams.transportType"
formatter="number"
/>
</el-form-item>
<el-form-item :label="$t('唛头')" prop="marks">
<el-input v-model="queryParams.marks" :placeholder="$t('请输入关键字查找')"/>
<el-input
v-model="queryParams.marks"
:placeholder="$t('请输入关键字查找')"
/>
</el-form-item>
<el-form-item :label="$t('资源类型')" prop="customerType">
<!-- <el-select clearable v-model="queryParams.customerType" :placeholder="$t('请选择资源类型')" clearable size="small">
<el-option v-for="dict in getDictDatas(DICT_TYPE.CUSTOMER_ESOURCE_TYPE)"
:key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select> -->
<dict-selector :type="DICT_TYPE.CUSTOMER_ESOURCE_TYPE" v-model="queryParams.customerType"
:placeholder="$t('请选择资源类型')" clearable></dict-selector>
<dict-selector
:type="DICT_TYPE.CUSTOMER_ESOURCE_TYPE"
v-model="queryParams.customerType"
:placeholder="$t('请选择资源类型')"
clearable
></dict-selector>
</el-form-item>
<!-- <el-form-item :label="$t('客户经理')" prop="customerService">
<el-select clearable v-model="queryParams.customerService" :placeholder="$t('请选择客户经理')" clearable size="small">
......@@ -33,8 +53,14 @@
</el-select>
</el-form-item> -->
<el-form-item>
<el-date-picker v-model="dateFilter" type="daterange" range-separator="-" :start-placeholder="$t('开始日期')"
:end-placeholder="$t('结束日期')" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
<el-date-picker
v-model="dateFilter"
type="datetimerange"
range-separator="-"
:start-placeholder="$t('开始日期')"
:end-placeholder="$t('结束日期')"
value-format="yyyy-MM-dd HH:mm:ss"
></el-date-picker>
<!-- <el-date-picker v-model="queryParams.beginStartTime" :placeholder="$t('请选择开始时间')" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>-->
</el-form-item>
<!-- <el-form-item :label="$t('结束时间')" prop="endStartTime">-->
......@@ -42,31 +68,70 @@
<!-- </el-form-item>-->
<el-form-item>
<el-form-item :label="$t('报价单号')" prop="key">
<el-input v-model="queryParams.number" :placeholder="$t('请输入报价单号')" clearable/>
<el-input
v-model="queryParams.number"
:placeholder="$t('请输入报价单号')"
clearable
/>
</el-form-item>
<el-form-item :label="$t('客户名称')" prop="key">
<el-input v-model="queryParams.name" :placeholder="$t('请输入客户名称')" clearable/>
<el-input
v-model="queryParams.name"
:placeholder="$t('请输入客户名称')"
clearable
/>
</el-form-item>
<el-form-item :label="$t('联系方式')" prop="key">
<el-input v-model="queryParams.phoneNew" :placeholder="$t('请输入联系方式')" clearable/>
<el-input
v-model="queryParams.phoneNew"
:placeholder="$t('请输入联系方式')"
clearable
/>
</el-form-item>
<el-form-item :label="$t('客户经理')" prop="userId">
<el-select clearable v-model="queryParams.userId" :placeholder="$t('请选择客户经理')" clearable size="small">
<el-option v-for="dict in customerServiceList"
:key="dict.id" :label="dict.nickname" :value="dict.id"/>
<el-select
clearable
v-model="queryParams.userId"
:placeholder="$t('请选择客户经理')"
clearable
size="small"
>
<el-option
v-for="dict in customerServiceList"
:key="dict.id"
:label="dict.nickname"
:value="dict.id"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('始发仓')" prop="startWarehouseId">
<el-select v-model="queryParams.startWarehouseId" :placeholder="$t('请选择始发仓')" clearable>
<el-option v-for="item in exportWarehouseList" :label="$l(item, 'title')" :value="item.id"
:key="item.id"></el-option>
<el-select
v-model="queryParams.startWarehouseId"
:placeholder="$t('请选择始发仓')"
clearable
>
<el-option
v-for="item in exportWarehouseList"
:label="$l(item, 'title')"
:value="item.id"
:key="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('目的仓')" prop="destWarehouseIdArr">
<el-select :multiple="true" v-model="queryParams.destWarehouseIdArr" multiple
:placeholder="$t('请选择目的仓')" clearable>
<el-option v-for="item in importWarehouseList" :label="$l(item, 'title')" :value="item.id"
:key="item.id"></el-option>
<el-select
:multiple="true"
v-model="queryParams.destWarehouseIdArr"
multiple
:placeholder="$t('请选择目的仓')"
clearable
>
<el-option
v-for="item in importWarehouseList"
:label="$l(item, 'title')"
:value="item.id"
:key="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="业绩类型">
......@@ -75,26 +140,38 @@
<el-option :value="0" label="旧客户"></el-option>
</el-select>
</el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">{{ $t('搜索') }}</el-button>
<el-button type="primary" icon="el-icon-search" @click="resetQuery">{{ $t('重置') }}</el-button>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">{{
$t("搜索")
}}</el-button>
<el-button type="primary" icon="el-icon-search" @click="resetQuery">{{
$t("重置")
}}</el-button>
<!-- <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
>{{$t('导出')}}</el-button> -->
</el-form-item>
</el-form>
<total_num :total-data="totalData"></total_num>
<!-- 列表 -->
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
<el-table
v-loading="loading"
:data="list"
@selection-change="handleSelectionChange"
>
<!-- <el-table-column :label="$t('序号')" align="center" type="index"></el-table-column> -->
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column type="selection" width="55"> </el-table-column>
<el-table-column :label="$t('资源类型')" align="center">
<template slot-scope="scope">
<dict-tag :type="DICT_TYPE.CUSTOMER_ESOURCE_TYPE" :value="scope.row.customerType"/>
<dict-tag
:type="DICT_TYPE.CUSTOMER_ESOURCE_TYPE"
:value="scope.row.customerType"
/>
</template>
</el-table-column>
<el-table-column :label="$t('业绩类型')" align="center" prop="achieveType"/>
<el-table-column
:label="$t('业绩类型')"
align="center"
prop="achieveType"
/>
<el-table-column :label="$t('报价单号')" align="center" width="180">
<template slot-scope="scope">
<span>{{ scope.row.number }}</span>
......@@ -105,26 +182,60 @@
<dict-tag :type="DICT_TYPE.ECW_OFFER_STATUS" :value="scope.row.offerStatus"/>
</template>
</el-table-column> -->
<el-table-column :label="$t('订单号')" align="center" prop="orderNo"/>
<el-table-column :label="$t('客户名称')" align="center" prop="name"/>
<el-table-column :label="$t('联系方式')" align="center" prop="phoneNew"/>
<el-table-column :label="$t('唛头')" align="center" prop="marks"/>
<el-table-column :label="$t('订单状态')" align="center" prop="statusMsg"/>
<el-table-column :label="$t('是否控货')" align="center" prop="isCargoControl">
<el-table-column :label="$t('订单号')" align="center" prop="orderNo" />
<el-table-column :label="$t('客户名称')" align="center" prop="name" />
<el-table-column :label="$t('联系方式')" align="center" prop="phoneNew" />
<el-table-column :label="$t('唛头')" align="center" prop="marks" />
<el-table-column
:label="$t('订单状态')"
align="center"
prop="statusMsg"
/>
<el-table-column
:label="$t('是否控货')"
align="center"
prop="isCargoControl"
>
<template slot-scope="scope">
{{ scope.row.isCargoControl ? $t('') : $t('') }}
{{ scope.row.isCargoControl ? $t("") : $t("") }}
</template>
</el-table-column>
<el-table-column :label="$t('重量')" align="center" prop="completeWeight"/>
<el-table-column :label="$t('方数')" align="center" prop="completeVolume"/>
<el-table-column :label="$t('下单时间')" align="center" prop="createTime"/>
<el-table-column :label="$t('业绩创建时间')" align="center" prop="ldBoxTime"/>
<el-table-column :label="$t('客户经理')" align="center" prop="userId" :formatter="customerServiceFn">
<el-table-column
:label="$t('重量')"
align="center"
prop="completeWeight"
/>
<el-table-column
:label="$t('方数')"
align="center"
prop="completeVolume"
/>
<el-table-column
:label="$t('下单时间')"
align="center"
prop="createTime"
/>
<el-table-column
:label="$t('业绩创建时间')"
align="center"
prop="ldBoxTime"
/>
<el-table-column
:label="$t('客户经理')"
align="center"
prop="userId"
:formatter="customerServiceFn"
>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
......@@ -139,18 +250,18 @@ import {
getCreateInitData,
getPersonTargetPage,
myAchievementByPage,
myDeptAchievementByPage
myDeptAchievementByPage,
} from "@/api/ecw/deptTarget";
import {listSimpleDepts} from "@/api/system/dept";
import {getChannelList} from '@/api/ecw/channel';
import { listSimpleDepts } from "@/api/system/dept";
import { getChannelList } from "@/api/ecw/channel";
import dayjs from "dayjs";
import {listServiceUser} from "@/api/system/user";
import {getWarehouseList} from '@/api/ecw/warehouse'
import { listServiceUser } from "@/api/system/user";
import { getWarehouseList } from "@/api/ecw/warehouse";
import Total_num from "@/views/ecw/deptTarget/total_num.vue";
export default {
name: "EcwDepttargetMydeptachievement",
components: {Total_num},
components: { Total_num },
data() {
return {
// 遮罩层
......@@ -196,7 +307,7 @@ export default {
transportType: null,
shippingChannel: null,
endStartTime: null,
destWarehouseIdArr: []
destWarehouseIdArr: [],
},
tableQueryParams: {
pageNo: 1,
......@@ -208,9 +319,27 @@ export default {
customerServiceList: [],
// 表单校验
rules: {
deptId: [{required: true, message: this.$t("部门ID不能为空"), trigger: "blur"}],
targetType: [{required: true, message: this.$t("目标类型不能为空"), trigger: "change"}],
cubeNum: [{required: true, message: this.$t("立方数不能为空"), trigger: "blur"}],
deptId: [
{
required: true,
message: this.$t("部门ID不能为空"),
trigger: "blur",
},
],
targetType: [
{
required: true,
message: this.$t("目标类型不能为空"),
trigger: "change",
},
],
cubeNum: [
{
required: true,
message: this.$t("立方数不能为空"),
trigger: "blur",
},
],
},
totalData: {
companyWeight: 0,
......@@ -224,42 +353,46 @@ export default {
sumNum: 0,
},
myAchievementData: {},
warehouseList: []
warehouseList: [],
};
},
computed: {
getShipChannelName() {
return shippingChannelId => {
return (shippingChannelId) => {
for (let index in this.channelList) {
let channelItem = this.channelList[index];
if (channelItem.channelId == shippingChannelId) {
return this.$l(channelItem, 'name');
return this.$l(channelItem, "name");
}
}
return '/'
}
return "/";
};
},
exportWarehouseList() {
/* tradeType 1 进口,2出口,3进出口 */
return this.warehouseList.filter(item => item.tradeType == 2 || item.tradeType == 3)
return this.warehouseList.filter(
(item) => item.tradeType == 2 || item.tradeType == 3
);
},
importWarehouseList() {
return this.warehouseList.filter(item => item.tradeType == 1 || item.tradeType == 3)
return this.warehouseList.filter(
(item) => item.tradeType == 1 || item.tradeType == 3
);
},
},
created() {
this.getChannelList();
this.getList();
listServiceUser().then(r => {
listServiceUser().then((r) => {
this.customerServiceList = r.data;
})
getWarehouseList().then(res => {
this.warehouseList = res.data
})
});
getWarehouseList().then((res) => {
this.warehouseList = res.data;
});
},
methods: {
getChannelList() {
getChannelList().then(res => this.channelList = res.data)
getChannelList().then((res) => (this.channelList = res.data));
},
dateFormat(val) {
return dayjs(val).format("YYYY-MM-DD");
......@@ -282,43 +415,71 @@ export default {
this.form.startTime = i.startDate;
this.form.endTime = i.endDate;
}
})
});
},
customerServiceFn(val) {
if (this.customerServiceList.length > 0) {
let index = this.customerServiceList.findIndex(item => item.id === val.userId);
return index !== -1 ? this.customerServiceList[index]?.nickname : ''
let index = this.customerServiceList.findIndex(
(item) => item.id === val.userId
);
return index !== -1 ? this.customerServiceList[index]?.nickname : "";
} else {
return ''
return "";
}
},
/** 查询列表 */
getList() {
this.loading = true;
const params = {...this.queryParams}
const params = { ...this.queryParams };
if (params.destWarehouseIdArr?.length) {
params.destWarehouseIds = params.destWarehouseIdArr.join(',')
params.destWarehouseIds = params.destWarehouseIdArr.join(",");
}
// 执行查询
myDeptAchievementByPage(params).then(response => {
myDeptAchievementByPage(params).then((response) => {
this.list = response.data.myAchievementDtos.list;
this.total = response.data.myAchievementDtos.total;
this.myAchievementData = response.data
this.totalData.sumWeight = this.myAchievementData.totalWeight
this.totalData.sumVolume = this.myAchievementData.totalVolume
this.totalData.sumNum = this.myAchievementData.totalNum
this.totalData.companyWeight = this.myAchievementData.companyTotalWeight
this.totalData.companyVolume = this.myAchievementData.companyTotalVolume
this.totalData.companyNum = this.myAchievementData.companyTotalNum
this.totalData.developWeight = this.myAchievementData.devTotalWeight
this.totalData.developVolume = this.myAchievementData.devTotalVolume
this.totalData.developNum = this.myAchievementData.devTotalNum
this.$set(this.totalData, 'newTotalNum', this.myAchievementData.newTotalNum)
this.$set(this.totalData, 'newTotalVolume', this.myAchievementData.newTotalVolume)
this.$set(this.totalData, 'newTotalWeight', this.myAchievementData.newTotalWeight)
this.$set(this.totalData, 'oldTotalNum', this.myAchievementData.oldTotalNum)
this.$set(this.totalData, 'oldTotalVolume', this.myAchievementData.oldTotalVolume)
this.$set(this.totalData, 'oldTotalWeight', this.myAchievementData.oldTotalWeight)
this.myAchievementData = response.data;
this.totalData.sumWeight = this.myAchievementData.totalWeight;
this.totalData.sumVolume = this.myAchievementData.totalVolume;
this.totalData.sumNum = this.myAchievementData.totalNum;
this.totalData.companyWeight =
this.myAchievementData.companyTotalWeight;
this.totalData.companyVolume =
this.myAchievementData.companyTotalVolume;
this.totalData.companyNum = this.myAchievementData.companyTotalNum;
this.totalData.developWeight = this.myAchievementData.devTotalWeight;
this.totalData.developVolume = this.myAchievementData.devTotalVolume;
this.totalData.developNum = this.myAchievementData.devTotalNum;
this.$set(
this.totalData,
"newTotalNum",
this.myAchievementData.newTotalNum
);
this.$set(
this.totalData,
"newTotalVolume",
this.myAchievementData.newTotalVolume
);
this.$set(
this.totalData,
"newTotalWeight",
this.myAchievementData.newTotalWeight
);
this.$set(
this.totalData,
"oldTotalNum",
this.myAchievementData.oldTotalNum
);
this.$set(
this.totalData,
"oldTotalVolume",
this.myAchievementData.oldTotalVolume
);
this.$set(
this.totalData,
"oldTotalWeight",
this.myAchievementData.oldTotalWeight
);
this.loading = false;
});
},
......@@ -339,7 +500,7 @@ export default {
transportType: undefined,
shippingChannel: undefined,
cubeNum: undefined,
achieveType: undefined
achieveType: undefined,
};
this.resetForm("form");
},
......@@ -352,8 +513,8 @@ export default {
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams = {pageNo: 1, pageSize: 10,}
this.getList()
this.queryParams = { pageNo: 1, pageSize: 10 };
this.getList();
},
/** 新增按钮操作 */
handleAdd() {
......@@ -370,7 +531,7 @@ export default {
this.tableOpen = true;
},
getTableList() {
getPersonTargetPage(this.tableQueryParams).then(res => {
getPersonTargetPage(this.tableQueryParams).then((res) => {
this.tableList = res.data.list;
this.tableTotal = res.data.total;
});
......@@ -379,7 +540,7 @@ export default {
handleUpdate(row) {
this.reset();
const id = row.id;
getDeptTarget(id).then(response => {
getDeptTarget(id).then((response) => {
this.form = response.data;
if (response.data.targetType === 1) {
this.targetPeriod = this.monthList;
......@@ -394,13 +555,13 @@ export default {
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
this.$refs["form"].validate((valid) => {
if (!valid) {
return;
}
// 修改的提交
if (this.form.id != null) {
updateDeptTarget(this.form).then(response => {
updateDeptTarget(this.form).then((response) => {
this.$modal.msgSuccess(this.$t("修改成功"));
this.open = false;
this.getList();
......@@ -408,7 +569,7 @@ export default {
return;
}
// 添加的提交
createDeptTarget(this.form).then(response => {
createDeptTarget(this.form).then((response) => {
this.$modal.msgSuccess(this.$t("新增成功"));
this.open = false;
this.getList();
......@@ -418,13 +579,18 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm(this.$t('是否确认删除部门业绩目标设置编号为{id}的数据项?', {id})).then(function () {
this.$modal
.confirm(
this.$t("是否确认删除部门业绩目标设置编号为{id}的数据项?", { id })
)
.then(function () {
return deleteDeptTarget(id);
}).then(() => {
})
.then(() => {
this.getList();
this.$modal.msgSuccess(this.$t("删除成功"));
}).catch(() => {
});
})
.catch(() => {});
},
handleSelectionChange(val) {
if (val && val.length > 0) {
......@@ -438,62 +604,64 @@ export default {
sumWeight: 0,
sumVolume: 0,
sumNum: 0,
}
val.forEach(item => {
};
val.forEach((item) => {
if (item.customerType == 1) {
data.developWeight += item.completeWeight
data.developVolume += item.completeVolume
data.developNum += item.sumNum
data.developWeight += item.completeWeight;
data.developVolume += item.completeVolume;
data.developNum += item.sumNum;
} else {
data.companyWeight += item.completeWeight
data.companyVolume += item.completeVolume
data.companyNum += item.sumNum
data.companyWeight += item.completeWeight;
data.companyVolume += item.completeVolume;
data.companyNum += item.sumNum;
}
data.sumWeight += item.completeWeight
data.sumVolume += item.completeVolume
data.sumNum += item.sumNum
})
data.sumWeight += item.completeWeight;
data.sumVolume += item.completeVolume;
data.sumNum += item.sumNum;
});
data.developVolume = data.developVolume.toFixed(2);
data.companyVolume = data.companyVolume.toFixed(2);
data.sumVolume = data.sumVolume.toFixed(2);
this.$set(this, 'totalData', data)
this.$set(this, "totalData", data);
} else {
this.totalData.sumWeight = this.myAchievementData.totalWeight
this.totalData.sumVolume = this.myAchievementData.totalVolume
this.totalData.sumNum = this.myAchievementData.totalNum
this.totalData.companyWeight = this.myAchievementData.companyTotalWeight
this.totalData.companyVolume = this.myAchievementData.companyTotalVolume
this.totalData.companyNum = this.myAchievementData.companyTotalNum
this.totalData.developWeight = this.myAchievementData.devTotalWeight
this.totalData.developVolume = this.myAchievementData.devTotalVolume
this.totalData.developNum = this.myAchievementData.devTotalNum
this.totalData.sumWeight = this.myAchievementData.totalWeight;
this.totalData.sumVolume = this.myAchievementData.totalVolume;
this.totalData.sumNum = this.myAchievementData.totalNum;
this.totalData.companyWeight =
this.myAchievementData.companyTotalWeight;
this.totalData.companyVolume =
this.myAchievementData.companyTotalVolume;
this.totalData.companyNum = this.myAchievementData.companyTotalNum;
this.totalData.developWeight = this.myAchievementData.devTotalWeight;
this.totalData.developVolume = this.myAchievementData.devTotalVolume;
this.totalData.developNum = this.myAchievementData.devTotalNum;
}
},
/** 导出按钮操作 */
handleExport() {
// 处理查询参数
let params = {...this.queryParams};
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
this.addBeginAndEndTime(params, this.dateRangeStartTime, 'startTime');
this.addBeginAndEndTime(params, this.dateRangeEndTime, 'endTime');
this.addBeginAndEndTime(params, this.dateRangeCreateTime, "createTime");
this.addBeginAndEndTime(params, this.dateRangeStartTime, "startTime");
this.addBeginAndEndTime(params, this.dateRangeEndTime, "endTime");
// 执行导出
this.$modal.confirm(this.$t('是否确认导出所有部门业绩目标设置数据项?')).then(() => {
this.$modal
.confirm(this.$t("是否确认导出所有部门业绩目标设置数据项?"))
.then(() => {
this.exportLoading = true;
return exportDeptTargetExcel(params);
}).then(response => {
this.$download.excel(response, `${this.$t('我的业绩')}.xls`);
})
.then((response) => {
this.$download.excel(response, `${this.$t("我的业绩")}.xls`);
this.exportLoading = false;
}).catch(() => {
});
}
}
})
.catch(() => {});
},
},
};
</script>
<style scoped>
</style>
<style scoped></style>
......@@ -2,172 +2,206 @@
import Selector from "@/components/Selector/index.vue";
import Inputor from "@/components/Inputor/index.vue";
import Template from "@/views/cms/template/index.vue";
import {DICT_TYPE, getDictDatas} from "@/utils/dict";
import { DICT_TYPE, getDictDatas } from "@/utils/dict";
export default {
name: "PriceStep",
components: {Template, Inputor, Selector},
props:{
components: { Template, Inputor, Selector },
props: {
index: Number,
type: String,
priceName: String,
fieldPrefix: String,
unitList:{
unitList: {
type: Array,
default: []
default: [],
},
currencyList:{
currencyList: {
type: Array,
default: []
default: [],
},
showAdd: Boolean,
readonly: Boolean,
stepTips: String,
value:{
value: {
type: Object,
default: () => {
return {
}
}
}
return {};
},
},
},
created() {
if(!this.value.packagingList){
this.addPackage()
if (!this.value.packagingList) {
this.addPackage();
}
// 格式化包装
if(this.value.packagingList?.length){
this.value.packagingList.forEach(item => {
if(item.packagingTypes && typeof item.packagingTypes == 'string'){
item.packagingTypes = item.packagingTypes.split(',')
if (this.value.packagingList?.length) {
this.value.packagingList.forEach((item) => {
if (item.packagingTypes && typeof item.packagingTypes == "string") {
item.packagingTypes = item.packagingTypes.split(",");
}
})
});
}
this.initSpecialPrice()
this.initSpecialPrice();
},
data(){
return {
}
data() {
return {};
},
computed:{
packagingList(){
const dicts = JSON.parse(JSON.stringify(getDictDatas(DICT_TYPE.ECW_PACKAGING_TYPE)))
return dicts.map(dict => {
dict.enable = true
this.value.packagingList.forEach(item => {
if(item.packagingTypes?.length && item.packagingTypes.indexOf(dict.value) > -1){
dict.enable = false
}
})
return dict
})
computed: {
packagingList() {
const dicts = JSON.parse(
JSON.stringify(getDictDatas(DICT_TYPE.ECW_PACKAGING_TYPE))
);
return dicts.map((dict) => {
dict.enable = true;
this.value.packagingList.forEach((item) => {
if (
item.packagingTypes?.length &&
item.packagingTypes.indexOf(dict.value) > -1
) {
dict.enable = false;
}
});
return dict;
});
},
},
methods:{
methods: {
getDictDatas,
// 初始化特需加价
initSpecialPrice(){
if(!this.value.specialList){
this.$set(this.value, 'specialList', [])
initSpecialPrice() {
if (!this.value.specialList) {
this.$set(this.value, "specialList", []);
}
this.getDictDatas(this.DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS).forEach(item => {
if(!this.value.specialList.find(special => special.specialDictType == item.value)){
this.getDictDatas(
this.DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS
).forEach((item) => {
if (
!this.value.specialList.find(
(special) => special.specialDictType == item.value
)
) {
this.value.specialList.push({
[`${this.fieldPrefix}Price`]: undefined, // 新建默认给0,否则默认是null
[`${this.fieldPrefix}PriceUnit`]: this.value[`${this.fieldPrefix}PriceUnit`],
[`${this.fieldPrefix}VolumeUnit`]: this.value[`${this.fieldPrefix}VolumeUnit`],
"specialDictType": item.value
})
[`${this.fieldPrefix}PriceUnit`]:
this.value[`${this.fieldPrefix}PriceUnit`],
[`${this.fieldPrefix}VolumeUnit`]:
this.value[`${this.fieldPrefix}VolumeUnit`],
specialDictType: item.value,
});
}
})
});
},
// 添加包装类型运费
addPackage(){
if(!this.value.packagingList){
this.$set(this.value, 'packagingList', [])
addPackage() {
if (!this.value.packagingList) {
this.$set(this.value, "packagingList", []);
}
this.value.packagingList.push({
packagingPrice: undefined,
packagingPriceUnit : this.value[`${this.fieldPrefix}PriceUnit`],
packagingVolumeUnit : this.value[`${this.fieldPrefix}VolumeUnit`],
})
packagingPriceUnit: this.value[`${this.fieldPrefix}PriceUnit`],
packagingVolumeUnit: this.value[`${this.fieldPrefix}VolumeUnit`],
});
},
// 删除包装类型运费
deletePackage(index){
this.value.packagingList.splice(index, 1)
deletePackage(index) {
this.value.packagingList.splice(index, 1);
},
// 校验
validate(){
const index = this.index
const errors = []
validate() {
const index = this.index;
const errors = [];
// 区间设置检查
if(typeof this.value.startNum != "number"){
errors.push(this.$t("请设置{priceName}第{index}阶段的起始值", {
if (typeof this.value.startNum != "number") {
errors.push(
this.$t("请设置{priceName}第{index}阶段的起始值", {
index: index + 1,
priceName: this.priceName
}))
priceName: this.priceName,
})
);
}
if(!this.value.endNum){
errors.push(this.$t("请设置{priceName}第{index}阶段的结束值", {
if (!this.value.endNum) {
errors.push(
this.$t("请设置{priceName}第{index}阶段的结束值", {
index: index + 1,
priceName: this.priceName
}))
priceName: this.priceName,
})
);
}
// 价格检查
if(!this.validatePrice(this.value[`${this.fieldPrefix}Price`])){
errors.push(this.$t("请设置第{index}阶段的{priceName}", {
index: index+1,
priceName: this.priceName
}))
if (!this.validatePrice(this.value[`${this.fieldPrefix}Price`])) {
errors.push(
this.$t("请设置第{index}阶段的{priceName}", {
index: index + 1,
priceName: this.priceName,
})
);
}
// 包装价格检查
if(this.value.packagingList?.length){
if (this.value.packagingList?.length) {
this.value.packagingList.forEach((item, i) => {
if(item.packagingTypes?.length && !this.validatePrice(item.packagingPrice)){
errors.push(this.$t("请设置第{index}阶段的包装类型{i}的{priceName}", {
index: index+1,
i: i+1,
priceName: this.priceName
}))
}
if (
item.packagingTypes?.length &&
!this.validatePrice(item.packagingPrice)
) {
errors.push(
this.$t("请设置第{index}阶段的包装类型{i}的{priceName}", {
index: index + 1,
i: i + 1,
priceName: this.priceName,
})
);
}
if(errors.length){
});
}
if (errors.length) {
this.$notify.error({
title: this.$t("表单错误"),
message: errors.join(';\n')
message: errors.join(";\n"),
});
}
return !errors.length
return !errors.length;
},
// 校验价格是否为空,可以是0
validatePrice(value){
if(value === undefined || value === null || value === ''){
return false
validatePrice(value) {
if (value === undefined || value === null || value === "") {
return false;
}
return true
return true;
},
}
}
},
};
</script>
<template>
<div>
<div class="bold text-lg">{{$t('{type}{priceName}价格设置', {type, priceName})}}</div>
<div style="font-size:14px; margin:10px 0">
{{$t('第{index}阶梯定价方案', {index: index+1})}}
<div>
<div class="bold text-lg">
{{ $t("{type}{priceName}价格设置", { type, priceName }) }}
</div>
<div style="font-size: 14px; margin: 10px 0">
{{ $t("第{index}阶梯定价方案", { index: index + 1 }) }}
<template v-if="showAdd">
<el-link type="primary" @click.native="$emit('add', fieldPrefix)">{{$t('添加区间')}}</el-link>
<el-link type="primary" @click.native="$emit('add', fieldPrefix)">{{
$t("添加区间")
}}</el-link>
<el-divider direction="vertical"></el-divider>
<el-link type="danger" @click.native="$emit( 'delete', index)">{{$t('删除')}}</el-link>
<el-link type="danger" @click.native="$emit('delete', index)">{{
$t("删除")
}}</el-link>
</template>
</div>
<el-form-item :label="$t('第{index}阶梯', {index: index+1})">
<el-input-number v-model="value.startNum" :controls="false" class="w-100"></el-input-number>
<el-form-item :label="$t('第{index}阶梯', { index: index + 1 })">
<el-input-number
v-model="value.startNum"
:controls="false"
class="w-100"
></el-input-number>
-
<el-input-number v-model="value.endNum" :controls="false" class="w-100"></el-input-number>
<el-input-number
v-model="value.endNum"
:controls="false"
class="w-100"
></el-input-number>
/
<!--需求为以默认价格单位为准,不能修改阶梯单位 https://zentao.test.jdshangmen.com/bug-view-5982.html-->
<selector
......@@ -175,63 +209,123 @@ export default {
v-model="value.weightUnit"
:options="unitList"
:label-field="$l(null, 'title')"
@input="$emit('changeUnit', {
@input="
$emit('changeUnit', {
value: $event,
field: 'weightUnit',
type: fieldPrefix
})"
type: fieldPrefix,
})
"
value-field="id"
class="w-100" />
<div class="tips" v-if="stepTips">{{stepTips}}</div>
class="w-100"
/>
<div class="tips" v-if="stepTips">{{ stepTips }}</div>
</el-form-item>
<el-form-item :label="$t('默认') + priceName">
<el-input-number v-model="value[`${fieldPrefix}Price`]" :placeholder="$t('整数或者两位小数')" :precision="2" :controls="false" class="w-100 mr-10"/>
<el-input-number
v-model="value[`${fieldPrefix}Price`]"
:placeholder="$t('整数或者两位小数')"
:precision="2"
:controls="false"
class="w-100 mr-10"
/>
<selector
:disabled="index>0"
:disabled="index > 0"
v-model="value[`${fieldPrefix}PriceUnit`]"
:options="currencyList"
:label-field="$l(null, 'title')"
@input="$emit('changeUnit', {
@input="
$emit('changeUnit', {
value: $event,
field: `${fieldPrefix}PriceUnit`
})"
field: `${fieldPrefix}PriceUnit`,
})
"
value-field="id"
class="w-100" />
class="w-100"
/>
/
<selector
:disabled="index>0"
:disabled="index > 0"
v-model="value[`${fieldPrefix}VolumeUnit`]"
:options="unitList"
:label-field="$l(null, 'title')"
@input="$emit('changeUnit', {
@input="
$emit('changeUnit', {
value: $event,
field: `${fieldPrefix}VolumeUnit`
})"
field: `${fieldPrefix}VolumeUnit`,
})
"
value-field="id"
class="w-100" />
class="w-100"
/>
</el-form-item>
<!--特性加价-->
<template v-for="(special, specialIndex) in value.specialList">
<el-form-item
:label="getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + priceName + $t('加价')"
:label="
getDictDataLabel(
DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS,
special.specialDictType
) +
priceName +
$t('加价')
"
:key="specialIndex + 'transport'"
>
<el-input-number v-model.number="special[`${fieldPrefix}Price`]" :controls="false" :min="0" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" />
<selector disabled v-model="special[`${fieldPrefix}PriceUnit`]" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100 mr-10" />
<el-input-number
v-model.number="special[`${fieldPrefix}Price`]"
:controls="false"
:placeholder="$t('整数或者两位小数')"
class="w-100 mr-10"
/>
<selector
disabled
v-model="special[`${fieldPrefix}PriceUnit`]"
:options="currencyList"
:label-field="$l(null, 'title')"
value-field="id"
defaultable2
class="w-100 mr-10"
/>
<span class="mr-10">/</span>
<selector disabled v-model="special[`${fieldPrefix}VolumeUnit`]" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
<selector
disabled
v-model="special[`${fieldPrefix}VolumeUnit`]"
:options="unitList"
:label-field="$l(null, 'title')"
value-field="id"
defaultable2
class="w-100"
/>
</el-form-item>
</template>
<!--包装类型价格-->
<template v-for="(item, i) in value.packagingList">
<el-form-item :label="$t('包装类型加价') + (i+1)" :key="i">
<el-form-item :label="$t('包装类型加价') + (i + 1)" :key="i">
<template #label>
<div class="el-form-item__label" style="width: 150px;">{{$t('包装类型{name}加价', {name: priceName}) + (i+1)}}</div>
<div v-if="!item.packagingTypes || !item.packagingTypes.length" class="tips">{{$t('未选择包装类型将被忽略')}}</div>
<div class="el-form-item__label" style="width: 150px">
{{ $t("包装类型{name}加价", { name: priceName }) + (i + 1) }}
</div>
<div
v-if="!item.packagingTypes || !item.packagingTypes.length"
class="tips"
>
{{ $t("未选择包装类型将被忽略") }}
</div>
</template>
<el-select v-model="item.packagingTypes" multiple placeholder="请选择" style="width: 100%; max-width: 450px; margin-bottom: 5px; display: block">
<el-select
v-model="item.packagingTypes"
multiple
placeholder="请选择"
style="
width: 100%;
max-width: 450px;
margin-bottom: 5px;
display: block;
"
>
<el-option
v-for="item in packagingList"
:key="item.value"
......@@ -241,29 +335,54 @@ export default {
>
</el-option>
</el-select>
<el-input-number v-model="item.packagingPrice" :controls="false" :min="0" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" />
<selector disabled v-model="item.packagingPriceUnit" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100 mr-10" />
<el-input-number
v-model="item.packagingPrice"
:controls="false"
:placeholder="$t('整数或者两位小数')"
class="w-100 mr-10"
/>
<selector
disabled
v-model="item.packagingPriceUnit"
:options="currencyList"
:label-field="$l(null, 'title')"
value-field="id"
defaultable2
class="w-100 mr-10"
/>
<span class="mr-10">/</span>
<selector disabled v-model="item.packagingVolumeUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
<template v-if="i == value.packagingList.length -1 && !readonly">
<el-link type="primary" @click.native="addPackage" class="ml-5">{{$t('添加')}}</el-link>
<selector
disabled
v-model="item.packagingVolumeUnit"
:options="unitList"
:label-field="$l(null, 'title')"
value-field="id"
defaultable2
class="w-100"
/>
<template v-if="i == value.packagingList.length - 1 && !readonly">
<el-link type="primary" @click.native="addPackage" class="ml-5">{{
$t("添加")
}}</el-link>
<el-divider direction="vertical"></el-divider>
<el-link type="danger" @click.native="deletePackage(i)">{{$t('删除')}}</el-link>
<el-link type="danger" @click.native="deletePackage(i)">{{
$t("删除")
}}</el-link>
</template>
</el-form-item>
</template>
</div>
</div>
</template>
<style scoped lang="scss">
.bold {
font-weight: bold;
}
.text-lg{
.text-lg {
font-size: 1.3rem;
}
.tips{
font-size: 1rem; color: red;
.tips {
font-size: 1rem;
color: red;
}
</style>
......@@ -275,7 +275,6 @@ export default {
<el-input-number
v-model="item.packagingPrice"
:controls="false"
:min="0"
:placeholder="$t('整数或者两位小数')"
class="w-100 mr-10"
/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment