Commit dc9ca0fb authored by zhengyi's avatar zhengyi

Merge branch 'master' into pre-release

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