Commit 6cd3037c authored by lanbaoming's avatar lanbaoming

Merge branch 'dev'

parents b0072e23 ac6219d7
import request from '@/utils/request'
// 创建跟进
export function createCustomerFollow(data) {
return request({
url: '/ecw/customer-follow/create',
method: 'post',
data: data
})
}
// 更新跟进
export function updateCustomerFollow(data) {
return request({
url: '/ecw/customer-follow/update',
method: 'put',
data: data
})
}
// 删除跟进
export function deleteCustomerFollow(id) {
return request({
url: '/ecw/customer-follow/delete?id=' + id,
method: 'delete'
})
}
// 获得跟进
export function getCustomerFollow(id) {
return request({
url: '/ecw/customer-follow/get?id=' + id,
method: 'get'
})
}
// 获得跟进分页
export function getCustomerFollowPage(query) {
return request({
url: '/ecw/customer-follow/page',
method: 'get',
params: query
})
}
// 导出跟进 Excel
export function exportCustomerFollowExcel(query) {
return request({
url: '/ecw/customer-follow/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
//
export function getFollowPage(query) {
return request({
url: '/ecw/customer-follow/followPage',
method: 'get',
params: query
})
}
\ No newline at end of file
<template>
<div class="app-container">
<doc-alert :title="$t('工作流')" url="https://doc.iocoder.cn/bpm" />
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item :label="$t('组名')" prop="name">
......
<template>
<div class="app-container">
<doc-alert :title="$t('工作流')" url="https://doc.iocoder.cn/bpm" />
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item :label="$t('流程标识')" prop="key">
......
......@@ -29,7 +29,6 @@
<el-form-item :label="$t('客户等级')" prop="level">
<el-select
multiple
clearable
v-model="queryParams.level"
:placeholder="$t('请选择客户等级')"
clearable
......@@ -66,7 +65,6 @@
clearable
v-model="queryParams.customerService"
:placeholder="$t('请选择客户经理')"
clearable
size="small"
@change="handleQuery"
>
......@@ -113,11 +111,10 @@
</el-form-item>
<el-form-item :label="$t('客户状态')" prop="status">
<el-select
multiple
multiple
clearable
v-model="queryParams.status"
:placeholder="$t('请选择客户状态')"
clearable
size="small"
@change="handleQuery"
>
......
<template>
<div class="app-container">
<el-card>
<div slot="header" class="card-title">{{$t('报表跟进')}}</div>
<el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="left">
<el-form-item :label="$t('编号')" prop="followNo">
<el-input type="text" v-model="form.followNo" :placeholder="$t('请输入编号')" />
</el-form-item>
<el-form-item :label="$t('类型')" prop="type" style="width: 46%;display: inline-block;margin-left:8%">
<!-- <el-radio v-model="form.type" label="2">{{$t('商务洽谈')}}</el-radio> -->
<dict-selector ref='dictMethod' v-model="form.followMethod" :type="DICT_TYPE.CUSTOMER_FOLLOW_METHOD"></dict-selector>
</el-form-item>
<el-form-item :label="$t('客户编号')" prop="followNo">
<el-input type="text" v-model="form.followNo" />
</el-form-item>
<el-form-item :label="$t('报价单号')" prop="number" style="width: 46%;display: inline-block;">
<label>{{form.number}}</label>
</el-form-item>
<el-form-item :label="$t('跟进时间')" prop="followUpTime" style="width: 46%;display: inline-block">
<el-date-picker clearable v-model="form.followUpTime" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss" type="datetime" :placeholder="$t('选择跟进时间')" />
</el-form-item>
<el-form-item :label="$t('客户经理')" prop="followUpSalesmanId" style="width: 46%;display: inline-block;;margin-left:8%">
<el-select v-model="form.followUpSalesmanId" :placeholder="$t('请选择跟进业务员')" clearable>
<el-option v-for="item in creatorData"
:key="item.id" :label="item.nickname" :value="item.id"/>
</el-select>
</el-form-item>
<el-form-item :label="$t('联系人')" prop="contacts" style="width: 46%;display: inline-block">
<el-select v-model="form.contacts" :placeholder="$t('请选择联系人')" clearable>
<el-option v-for="item in contactsData" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
</el-form-item>
<el-form-item :label="$t('跟进方式')" prop="followUpMethod" style="width: 46%;display: inline-block;margin-left:8%">
<dict-selector
:type="DICT_TYPE.CUSTOMER_FOLLOW_METHOD"
:placeholder="$t('请选择跟进方式')"
v-model="form.followUpMethod"
form-type="select"
:clearable="true"
/>
</el-form-item>
<el-form-item :label="$t('目的')" prop="customerFeedback">
<el-input type="textarea" :rows="3" v-model="form.customerFeedback" maxlength="500" :placeholder="$t('请输入客户反馈')" />
</el-form-item>
<el-form-item :label="$t('情况')" prop="processingResults">
<el-input type="textarea" :rows="3" v-model="form.processingResults" maxlength="500" :placeholder="$t('请输入处理结果')" />
</el-form-item>
</el-form>
</el-card>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">{{$t('确定')}}</el-button>
</div>
</div>
</template>
<script>
import { createOfferLog } from "@/api/ecw/offerLog"
import { userList } from "@/api/system/user"
import { getCustomerContactsListByCustomer } from "@/api/ecw/customerContacts"
import {DICT_TYPE} from '@/utils/dict'
import {getOffer} from '@/api/ecw/offer'
import {getCustomerContactsSelect} from '@/api/ecw/customerContacts'
export default {
name: "OfferLog",
components: {
},
data() {
return {
// 遮罩层
loading: true,
open: false,
contactsData:[],
creatorData:[],
// 表单参数
form: {
type:'2',
offerId:0,
number:0,
},
relationId:0,
// 表单校验
rules: {
type: [{ required: true, message: this.$t("请选择跟进类型"), trigger: "change" }],
followUpTime: [{ required: true, message: this.$t("跟进时间不能为空"), trigger: "blur" }],
followUpSalesmanId: [{ required: true, message: this.$t("客户经理不能为空"), trigger: "change" }],
contacts: [{ required: true, message: this.$t("联系人不能为空"), trigger: "blur" }],
followUpMethod: [{ required: true, message: this.$t("请选择跟进方式"), trigger: "change" }],
customerFeedback: [{ required: true, message: this.$t("客户反馈不能为空"), trigger: "blur" }],
processingResults: [{ required: true, message: this.$t("处理结果不能为空"), trigger: "blur" }],
},
list:[]
};
},
created() {
if(this.$route.query.offerId){
this.form.offerId = this.$route.query.offerId
this.getList();
}
if(this.$route.query.number){
this.form.number = this.$route.query.number
}
userList('customer service').then(res =>this.creatorData = res.data)
},
methods: {
getList() {
let that = this
// 执行查询
getOffer(that.form.offerId).then(response => {
that.list = response.data;
that.getContactsData()
})
},
getContactsData(){
getCustomerContactsSelect({ids: [this.list.consigneeId, this.list.consignorId].join(',')}).then((res) => {
if(res.data.list.length>0){
this.contactsData.push({name:res.data.list[0].contactsName+'('+this.$t('发货人')+')',id:res.data.list[0].customerContactsId})
this.contactsData.push({name:res.data.list[1].contactsName+'('+this.$t('收货人')+')',id:res.data.list[1].customerContactsId})
}
})
// getCustomerContactsListByCustomer({customerId:this.relationId}).then(response => {
// this.contactsData = response.data
// })
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
// 添加的提交
this.form.type = parseInt(this.form.type)
this.form.followUpMethod = parseInt(this.form.followUpMethod)
createOfferLog(this.form).then(response => {
this.$modal.msgSuccess(this.$t("新增成功"));
this.$store.dispatch('tagsView/delCurrentView')
});
});
},
}
};
</script>
<style scoped>
.dialog-footer{
padding: 40px;
}
</style>
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="编号" prop="followNo">
<el-input
v-model="queryParams.followNo"
placeholder="请输入编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="跟进类型" prop="followType">
<!-- <el-select v-model="queryParams.followType" :type="DICT_TYPE.CUSTOMER_FOLLOW_TYPE" placeholder="请选择跟进类型" clearable size="small">
<el-option label="请选择字典生成" value="" />
</el-select> -->
<dict-selector
clearable
:type="DICT_TYPE.CUSTOMER_FOLLOW_TYPE"
v-model="queryParams.followType"
@change="handleQuery"
></dict-selector>
</el-form-item>
<el-form-item label="跟进时间">
<el-date-picker
v-model="dateRangeFollowTime"
style="width: 240px"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
/>
</el-form-item>
<el-form-item label="联系人" prop="contactName">
<el-input
v-model="queryParams.contactName"
placeholder="请输入联系人"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="跟进方式" prop="followMethod">
<!-- <el-input v-model="queryParams.followMethod" placeholder="请输入跟进方式" clearable @keyup.enter.native="handleQuery"/> -->
<dict-selector
clearable
:type="DICT_TYPE.CUSTOMER_FOLLOW_METHOD"
v-model="queryParams.followMethod"
@change="handleQuery"
></dict-selector>
</el-form-item>
<el-form-item label="客户经理" prop="followUserId">
<!-- <el-input v-model="queryParams.followUserId" placeholder="请输入跟进业务员" clearable @keyup.enter.native="handleQuery"/> -->
<el-select
v-model="queryParams.followUserId"
:placeholder="$t('请选择客户经理')"
clearable
size="small"
@change="handleQuery"
>
<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="客户反馈" prop="feedback">
<el-input v-model="queryParams.feedback" placeholder="请输入客户反馈" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="处理结果" prop="result">
<el-input v-model="queryParams.result" placeholder="请输入处理结果" clearable @keyup.enter.native="handleQuery"/>
</el-form-item> -->
<!-- <el-form-item label="管理员id" prop="adminId">
<el-input v-model="queryParams.adminId" placeholder="请输入管理员id" clearable @keyup.enter.native="handleQuery"/>
</el-form-item> -->
<el-form-item label="创建时间">
<el-date-picker
v-model="dateRangeCreateTime"
style="width: 240px"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<!-- 操作工具栏 -->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['ecw:customer-follow:create']"
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="updateStatus"
v-hasPermi="['ecw:customer-follow:updateStatus']"
>修改状态</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
:loading="exportLoading"
v-hasPermi="['ecw:customer-follow:export']"
>导出</el-button
>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<!-- <el-table-column label="" align="center" prop="id" /> -->
<el-table-column label="编号" align="center" prop="followNo" />
<el-table-column
prop="followType"
:label="$t('跟进类型')"
:formatter="
(row, column, cellValue) =>
getDictDataLabel(DICT_TYPE.CUSTOMER_FOLLOW_TYPE, cellValue)
"
>
</el-table-column>
<el-table-column label="报价单" align="center" prop="bizNo" />
<el-table-column
label="时间"
align="center"
prop="followTime"
width="180"
>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.followTime) }}</span>
</template>
</el-table-column>
<el-table-column label="客户编号" align="center" prop="number" />
<el-table-column label="联系人" align="center" prop="contactName" />
<el-table-column label="联系方式" align="center" prop="phone" />
<el-table-column label="客户经理" align="center" prop="followUserName" />
<el-table-column
prop="followMethod"
:label="$t('方式')"
:formatter="
(row, column, cellValue) =>
getDictDataLabel(DICT_TYPE.CUSTOMER_FOLLOW_METHOD, cellValue)
"
>
</el-table-column>
<el-table-column label="目的" align="center" prop="customerFeedback" />
<el-table-column label="结果" align="center" prop="followResult" />
<el-table-column label="跟进情况" align="center" prop="result" />
<el-table-column
label="下次跟进时间"
align="center"
prop="nextFollowTime"
>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.nextFollowTime) }}</span>
</template>
</el-table-column>
<el-table-column label="跟进计划" align="center" prop="nextPlan" />
<el-table-column label="创建人" align="center" prop="creatorName" />
<el-table-column
label="创建时间"
align="center"
prop="createTime"
width="180"
>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="最后更新人" align="center" prop="updaterName" />
<el-table-column
label="最后更新时间"
align="center"
prop="updateTime"
width="180"
>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime) }}</span>
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['ecw:customer-follow:update']"
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['ecw:customer-follow:delete']"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="业务ID" prop="bizId">
<el-input v-model="form.bizId" placeholder="请输入业务ID" />
</el-form-item>
<el-form-item label="跟进类型" prop="followType">
<!-- <el-select v-model="form.followType" placeholder="请选择跟进类型">
<el-option label="请选择字典生成" value="" />
</el-select> -->
<dict-selector
ref="dictMethod"
v-model="form.followMethod"
:type="DICT_TYPE.CUSTOMER_FOLLOW_METHOD"
></dict-selector>
</el-form-item>
<el-form-item label="跟进时间" prop="followTime">
<el-date-picker
clearable
v-model="form.followTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择跟进时间"
/>
</el-form-item>
<el-form-item label="联系人" prop="contactName">
<el-input v-model="form.contactName" placeholder="请输入联系人" />
</el-form-item>
<el-form-item label="跟进方式" prop="followMethod">
<el-input v-model="form.followMethod" placeholder="请输入跟进方式" />
</el-form-item>
<el-form-item label="跟进业务员" prop="followUserId">
<el-input
v-model="form.followUserId"
placeholder="请输入跟进业务员"
/>
</el-form-item>
<el-form-item label="客户反馈" prop="feedback">
<el-input v-model="form.feedback" placeholder="请输入客户反馈" />
</el-form-item>
<el-form-item label="处理结果" prop="result">
<el-input v-model="form.result" placeholder="请输入处理结果" />
</el-form-item>
<el-form-item label="管理员id" prop="adminId">
<el-input v-model="form.adminId" placeholder="请输入管理员id" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
createCustomerFollow,
updateCustomerFollow,
deleteCustomerFollow,
getCustomerFollow,
getCustomerFollowPage,
exportCustomerFollowExcel,
getFollowPage,
} from "@/api/ecw/follow";
import { listServiceUser } from "@/api/system/user";
export default {
name: "CustomerFollow",
components: {},
data() {
return {
// 遮罩层
loading: true,
// 导出遮罩层
exportLoading: false,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 跟进列表
list: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
dateRangeFollowTime: [],
dateRangeCreateTime: [],
customerServiceList: [],
// 查询参数
queryParams: {
pageNo: 1,
pageSize: 10,
bizId: null,
followType: null,
contactName: null,
followMethod: null,
followUserId: null,
feedback: null,
result: null,
adminId: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
bizId: [{ required: true, message: "业务ID不能为空", trigger: "blur" }],
},
};
},
created() {
this.getList();
listServiceUser().then((r) => {
this.customerServiceList = r.data;
});
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
// 处理查询参数
let params = { ...this.queryParams };
this.addBeginAndEndTime(params, this.dateRangeFollowTime, "followTime");
this.addBeginAndEndTime(params, this.dateRangeCreateTime, "createTime");
// 执行查询
getFollowPage(params).then((response) => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
bizId: undefined,
followType: undefined,
followTime: undefined,
contactName: undefined,
followMethod: undefined,
followUserId: undefined,
feedback: undefined,
result: undefined,
adminId: undefined,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRangeFollowTime = [];
this.dateRangeCreateTime = [];
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加跟进";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getCustomerFollow(id).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改跟进";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (!valid) {
return;
}
// 修改的提交
if (this.form.id != null) {
updateCustomerFollow(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
// 添加的提交
createCustomerFollow(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal
.confirm('是否确认删除跟进编号为"' + id + '"的数据项?')
.then(function () {
return deleteCustomerFollow(id);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
// 处理查询参数
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
this.addBeginAndEndTime(params, this.dateRangeFollowTime, "followTime");
this.addBeginAndEndTime(params, this.dateRangeCreateTime, "createTime");
// 执行导出
this.$modal
.confirm("是否确认导出所有跟进数据项?")
.then(() => {
this.exportLoading = true;
return exportCustomerFollowExcel(params);
})
.then((response) => {
this.$download.excel(response, "${table.classComment}.xls");
this.exportLoading = false;
})
.catch(() => {});
},
},
};
</script>
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -5,169 +5,209 @@
append-to-body
width="90vw"
>
<el-table ref="multipleTable" :data="flatList" @selection-change="handleSelectionChange" :span-method="objectSpanMethod" class="table">
<el-table
ref="multipleTable"
:data="flatList"
@selection-change="handleSelectionChange"
:span-method="objectSpanMethod"
class="table"
>
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column :label="$t('品名')" prop="name">
<template #default="{row}">{{$l(row, "prodName")}}</template>
<template #default="{ row }">{{ $l(row, "prodName") }}</template>
</el-table-column>
<el-table-column :label="$t('品牌')" prop="brand">
<template #default="{row}">{{$l(row, "brandName")}}</template>
<template #default="{ row }">{{ $l(row, "brandName") }}</template>
</el-table-column>
<el-table-column :label="$t('材质')" prop="material">
<template #default="{row}">{{$l(row, "materialLabel")}}</template>
<template #default="{ row }">{{ $l(row, "materialLabel") }}</template>
</el-table-column>
<el-table-column :label="$t('商品特性')" prop="attr">
<template #default="{row}">{{$l(row, "prodAttrNames")}}</template>
<template #default="{ row }">{{ $l(row, "prodAttrNames") }}</template>
</el-table-column>
<el-table-column :label="$t('用途')" prop="unit">
<template #default="{row}">{{$l(row, "usageNames")}}</template>
<template #default="{ row }">{{ $l(row, "usageNames") }}</template>
</el-table-column>
<el-table-column :label="$t('总数量')" prop="quantityAll"></el-table-column>
<el-table-column :label="$t('总箱数')" prop="cartonsNum"></el-table-column>
<el-table-column
:label="$t('总数量')"
prop="quantityAll"
></el-table-column>
<el-table-column
:label="$t('总箱数')"
prop="cartonsNum"
></el-table-column>
<el-table-column :label="$t('包装类型')" prop="specificationType">
<template #default="{row}">
<dict-tag :type="DICT_TYPE.WAREHOUSING_SPECIFICATION_TYPE" :value="row.specificationType"></dict-tag>
<template #default="{ row }">
<dict-tag
:type="DICT_TYPE.WAREHOUSING_SPECIFICATION_TYPE"
:value="row.specificationType"
></dict-tag>
</template>
</el-table-column>
<el-table-column :label="$t('规格')" prop="boxGauge"></el-table-column>
<el-table-column :label="$t('总重量')" prop="weight"></el-table-column>
<el-table-column :label="$t('快递单号')" prop="expressNo"></el-table-column>
<el-table-column
:label="$t('快递单号')"
prop="expressNo"
></el-table-column>
<el-table-column :label="$t('影像')" prop="quantityAll">
<template #default="{row}">
<el-button type="text" @click="curPictrues = row.pictureUrls">{{$t('查看影像')}}</el-button>
<template #default="{ row }">
<el-button type="text" @click="curPictrues = row.pictureUrls">{{
$t("查看影像")
}}</el-button>
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleSubmit">{{$t('确定')}}</el-button>
<el-button @click="handleClose">{{$t('取消')}}</el-button>
<el-button type="primary" @click="handleSubmit">{{
$t("确定")
}}</el-button>
<el-button @click="handleClose">{{ $t("取消") }}</el-button>
</div>
<media-dialog v-if="curPictrues" :value="curPictrues" @close="curPictrues=null"></media-dialog>
<media-dialog
v-if="curPictrues"
:value="curPictrues"
@close="curPictrues = null"
></media-dialog>
</el-dialog>
</template>
<script>
import {getOrderItemCommonAttr} from "@/api/ecw/order"
import { getOrderItemCommonAttr } from "@/api/ecw/order";
import MediaDialog from "@/views/ecw/order/stocking/components/MediaDialog.vue";
export default {
components: {MediaDialog},
components: { MediaDialog },
props: {
orderId: {
type: Number,
default: undefined
default: undefined,
},
warehouseInId:Number
warehouseInId: Number,
},
data(){
data() {
return {
visible: true,
// 备选的商品明细
orderItemDetails: [],
multipleSelection:[],
curPictrues: null
}
multipleSelection: [],
curPictrues: null,
};
},
watch:{
visible(val){
watch: {
visible(val) {
if (!val) {
this.$emit('close')
this.$emit("close");
}
},
},
computed:{
flatList(){
let arr = []
this.orderItemDetails.forEach(item => {
computed: {
flatList() {
let arr = [];
this.orderItemDetails.forEach((item) => {
item.orderWarehouseInCommonAttrVOList?.forEach((vo, index) => {
arr.push({
...item,
...vo,
index,
span: index === 0 ? item.orderWarehouseInCommonAttrVOList?.length : 0,
warehouseInId: item.id
})
})
})
return arr
}
span:
index === 0 ? item.orderWarehouseInCommonAttrVOList?.length : 0,
warehouseInId: item.id,
});
});
});
return arr;
},
},
async created() {
getOrderItemCommonAttr(this.orderId, this.warehouseInId || 0).then(res => {
this.orderItemDetails = res.data
})
getOrderItemCommonAttr(this.orderId, this.warehouseInId || 0).then(
(res) => {
this.orderItemDetails = res.data;
}
);
},
methods: {
handleSelectionChange(e){
console.log("handleSelectionChange", e)
this.multipleSelection = e
handleSelectionChange(e) {
console.log("handleSelectionChange", e);
this.multipleSelection = e;
},
handleSubmit(){
handleSubmit() {
// 品名+品牌+材质+商品特性+用途一致的会合并,数量累加
// https://zentao.test.jdshangmen.com/task-view-3423.html
let arr = []
this.multipleSelection.forEach(item => {
let index = arr.findIndex(i => {
return i.prodId == item.prodId && i.brand == item.brand && i.material == item.material && i.prodAttrIds == item.prodAttrIds && i.usageIds == item.usageIds
})
let arr = [];
this.multipleSelection.forEach((item) => {
let index = arr.findIndex((i) => {
return (
i.prodId == item.prodId &&
i.brand == item.brand &&
i.material == item.material &&
i.prodAttrIds == item.prodAttrIds &&
i.usageIds == item.usageIds
);
});
if (index == -1) {
arr.push({...item})
arr.push({ ...item });
} else {
arr[index].quantityAll += item.quantityAll
arr[index].quantityAll += item.quantityAll;
}
})
});
// 如果某条入仓记录下的箱明细被全部选中了,则需要将他的快递单号和影像带过去
const expressNos = []
const pictureUrls = []
const expressNos = [];
const pictureUrls = [];
this.orderItemDetails.forEach((warehouseIn, index) => {
// 本条入仓记录被选中的明细数
const selectedCount = this.multipleSelection.filter(item => item.warehouseInId == warehouseIn.id).length
if(selectedCount == warehouseIn.orderWarehouseInCommonAttrVOList?.length){
if(warehouseIn.expressNo){
expressNos.push(warehouseIn.expressNo)
const selectedCount = this.multipleSelection.filter(
(item) => item.warehouseInId == warehouseIn.id
).length;
if (
selectedCount == warehouseIn.orderWarehouseInCommonAttrVOList?.length
) {
if (warehouseIn.expressNo) {
expressNos.push(warehouseIn.expressNo);
}
if(warehouseIn.pictureUrls?.length){
pictureUrls.push(...warehouseIn.pictureUrls)
if (warehouseIn.pictureUrls?.length) {
pictureUrls.push(...warehouseIn.pictureUrls);
}
}
})
});
// 根据warehouseInId 给对应的入仓记录追加快递单号和影像
// 存到全局变量,在调用对应finishPack接口的时候判断追加
window.ChooseOrderProductsExpressNos = expressNos
window.ChooseOrderProductsPictureUrls = pictureUrls
window.ChooseOrderProductsExpressNos = expressNos;
window.ChooseOrderProductsPictureUrls = pictureUrls;
this.$emit("success", arr)
this.$emit("success", arr);
},
handleClose() {
this.visible = false
this.visible = false;
},
objectSpanMethod({ row, column, rowIndex, columnIndex }){
if(columnIndex > 6){
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
if (columnIndex > 6) {
return {
rowspan: row.span,
colspan: 1
}
colspan: 1,
};
}
return {
rowspan: 1,
colspan: 1
}
}
}
}
colspan: 1,
};
},
},
};
</script>
<style scoped lang="scss">
.table{
::v-deep{
th.el-table__cell.is-leaf, td.el-table__cell{
border-bottom: 1px solid #9b9b9b;
}
.el-checkbox__inner{
border:2px solid #9b9b9b;
}
.table {
::v-deep {
th.el-table__cell.is-leaf,
td.el-table__cell {
border-bottom: 1px solid #9b9b9b;
}
.el-checkbox__inner {
border: 2px solid #9b9b9b;
}
}
}
</style>
......@@ -2,81 +2,145 @@
<template>
<div class="app-container">
<h2>{{ title }}-{{ order.orderNo }}</h2>
<order-base-info :order="order" stocking></order-base-info>
<div class="flex items-center">
<div class="flex-1 page-title">{{$t('货物信息')}}</div>
<el-button type="primary" @click="showNewProductDialog=true">{{$t('添加新品名')}}</el-button>
<div class="flex-1 page-title">{{ $t("货物信息") }}</div>
<el-button type="primary" @click="showNewProductDialog = true">{{
$t("添加新品名")
}}</el-button>
</div>
<!--
未入仓的不显示 https://zentao.test.jdshangmen.com/bug-view-5292.html
-->
<el-table
v-if="order.orderItemVOList && order.orderItemVOList.length > 0 && orderItemList && orderItemList.length > 0"
v-if="
order.orderItemVOList &&
order.orderItemVOList.length > 0 &&
orderItemList &&
orderItemList.length > 0
"
:data="order.orderItemVOList || []"
default-expand-all
style="width: 100%">
style="width: 100%"
>
<!--入仓记录-->
<el-table-column type="expand">
<template slot-scope="props">
<div style="padding-left: 80px" v-if="orderWarehouseInList(props.row.orderItemId).length">
<div
style="padding-left: 80px"
v-if="orderWarehouseInList(props.row.orderItemId).length"
>
<el-table :data="orderWarehouseInList(props.row.orderItemId)">
<el-table-column :label="$t('序号')" width="80px">
<template slot-scope="{row, column, $index}">
{{$index + 1}}
<template slot-scope="{ row, column, $index }">
{{ $index + 1 }}
</template>
</el-table-column>
<el-table-column prop="cartonsNum" :label="$t('箱数')" width="60px"></el-table-column>
<el-table-column
prop="cartonsNum"
:label="$t('箱数')"
width="60px"
></el-table-column>
<el-table-column prop="areaName" :label="$t('入仓类型')">
<template v-slot="{row}">
<dict-tag :type="DICT_TYPE.WAREHOUSING_SPECIFICATION_TYPE" :value="row.specificationType"></dict-tag>
<template v-slot="{ row }">
<dict-tag
:type="DICT_TYPE.WAREHOUSING_SPECIFICATION_TYPE"
:value="row.specificationType"
></dict-tag>
</template>
</el-table-column>
<el-table-column prop="areaName" :label="$t('包装类型')">
<template v-slot="{row}">
<dict-tag :type="DICT_TYPE.ECW_PACKAGING_TYPE" :value="row.unit"></dict-tag>
<template v-slot="{ row }">
<dict-tag
:type="DICT_TYPE.ECW_PACKAGING_TYPE"
:value="row.unit"
></dict-tag>
</template>
</el-table-column>
<el-table-column prop="areaName" :label="$t('长') + '(cm)'" width="70px">
<template v-slot="{row}">{{row.boxGauge.split('*')[0]}}</template>
<el-table-column
prop="areaName"
:label="$t('长') + '(cm)'"
width="70px"
>
<template v-slot="{ row }">{{
row.boxGauge.split("*")[0]
}}</template>
</el-table-column>
<el-table-column prop="areaName" :label="$t('宽') + '(cm)'" width="70px">
<template v-slot="{row}">{{row.boxGauge.split('*')[1]}}</template>
<el-table-column
prop="areaName"
:label="$t('宽') + '(cm)'"
width="70px"
>
<template v-slot="{ row }">{{
row.boxGauge.split("*")[1]
}}</template>
</el-table-column>
<el-table-column prop="areaName" :label="$t('高') + '(cm)'" width="70px">
<template v-slot="{row}">{{row.boxGauge.split('*')[2]}}</template>
<el-table-column
prop="areaName"
:label="$t('高') + '(cm)'"
width="70px"
>
<template v-slot="{ row }">{{
row.boxGauge.split("*")[2]
}}</template>
</el-table-column>
<el-table-column prop="volume" :label="$t('体积')+'(m³)'"></el-table-column>
<el-table-column prop="weight" :label="$t('重量')+'(kg)'"></el-table-column>
<el-table-column prop="quantityAll" :label="$t('数量') + '(个)'"></el-table-column>
<el-table-column prop="expressNo" :label="$t('快递单号')"></el-table-column>
<el-table-column
prop="volume"
:label="$t('体积') + '(m³)'"
></el-table-column>
<el-table-column
prop="weight"
:label="$t('重量') + '(kg)'"
></el-table-column>
<el-table-column
prop="quantityAll"
:label="$t('数量') + '(个)'"
></el-table-column>
<el-table-column
prop="expressNo"
:label="$t('快递单号')"
></el-table-column>
<el-table-column prop="createTime" :label="$t('首次入仓时间')">
<template v-slot="{row}">{{parseTime(row.inTime)}}</template>
<template v-slot="{ row }">{{
parseTime(row.inTime)
}}</template>
</el-table-column>
<el-table-column prop="areaName" :label="$t('储位')">
<template v-slot="{row}">
{{row.orderLocationStr4Merge}}
<template v-slot="{ row }">
{{ row.orderLocationStr4Merge }}
</template>
</el-table-column>
<el-table-column prop="areaName" :label="$t('影像')">
<template v-slot="{row}">
<el-button type="text" @click="showMedia(props.row)">{{$t('查看')}}</el-button>
<template v-slot="{ row }">
<el-button type="text" @click="showMedia(props.row)">{{
$t("查看")
}}</el-button>
</template>
</el-table-column>
<el-table-column prop="areaName" width="220px">
<template v-slot="{row}">
<template v-slot="{ row }">
<WarehouseRecordDetail
v-model="row.orderWarehouseInDetailsVOList"
@input="saveDetail(props.row, row.id)"
show-choose-order-item
:order-id="orderId"
:warehouse-in-id="row.id"
@close="clearAppendExpressNoAndPictures"
v-model="row.orderWarehouseInDetailsVOList"
@input="saveDetail(props.row, row.id)"
show-choose-order-item
:order-id="orderId"
:warehouse-in-id="row.id"
@close="clearAppendExpressNoAndPictures"
/>
<el-button class="pl-5 pr-5" size="mini" type="primary" @click="package(props.row, $t('修改打包'))">{{$t('修改')}}</el-button>
<el-button class="pl-5 pr-5" size="mini" type="danger" @click="package(props.row, $t('修改打包'))">{{$t('删除')}}</el-button>
<el-button
class="pl-5 pr-5"
size="mini"
type="primary"
@click="package(props.row, $t('修改打包'))"
>{{ $t("修改") }}</el-button
>
<el-button
class="pl-5 pr-5"
size="mini"
type="danger"
@click="package(props.row, $t('修改打包'))"
>{{ $t("删除") }}</el-button
>
</template>
</el-table-column>
</el-table>
......@@ -84,101 +148,128 @@
</template>
</el-table-column>
<el-table-column
type="index"
width="50"
:label="$t('序号')">
<el-table-column type="index" width="50" :label="$t('序号')">
</el-table-column>
<el-table-column
prop="prodTitleZh"
:label="$t('品名')">
<template v-slot="{row}">
{{ row.prodTitleZh }}<br>
<el-table-column prop="prodTitleZh" :label="$t('品名')">
<template v-slot="{ row }">
{{ row.prodTitleZh }}<br />
{{ row.prodTitleEn }}
</template>
</el-table-column>
<el-table-column
:label="$t('填单货物属性')">
<template v-slot="{row}">
<span v-if="row.isWarehouseInAdd">{{$t('非填单货物信息')}}</span>
<el-table-column :label="$t('填单货物属性')">
<template v-slot="{ row }">
<span v-if="row.isWarehouseInAdd">{{ $t("非填单货物信息") }}</span>
<template v-else>
{{$t('品牌')}}{{ [$t('无牌'), $t('有牌'), $t('中性')][row.brandType] }}<br>
{{$t('箱数')}}{{ row.num }}<br>
{{$t('体积')}}{{ row.volume }}<br>
{{$t('重量')}}{{ row.weight }}Kg
{{ $t("品牌") }}{{
[$t("无牌"), $t("有牌"), $t("中性")][row.brandType]
}}<br />
{{ $t("箱数") }}{{ row.num }}<br />
{{ $t("体积") }}{{ row.volume }}<br />
{{ $t("重量") }}{{ row.weight }}Kg
</template>
</template>
</el-table-column>
<el-table-column
:label="$t('入库货物属性')">
<template v-slot="{row}">
<el-table-column :label="$t('入库货物属性')">
<template v-slot="{ row }">
<template v-if="row.warehouseInInfoVO">
{{$t('品牌')}}{{ row.brandName }}<br>
{{$t('箱数')}}{{ row.warehouseInInfoVO.cartonsNum }}<br>
{{$t('体积')}}{{ row.warehouseInInfoVO.volume }}<br>
{{$t('重量')}}{{ row.warehouseInInfoVO.weight }}Kg
{{ $t("品牌") }}{{ row.brandName }}<br />
{{ $t("箱数") }}{{ row.warehouseInInfoVO.cartonsNum }}<br />
{{ $t("体积") }}{{ row.warehouseInInfoVO.volume }}<br />
{{ $t("重量") }}{{ row.warehouseInInfoVO.weight }}Kg
</template>
<span v-else>{{$t('暂无入仓信息')}}</span>
<span v-else>{{ $t("暂无入仓信息") }}</span>
</template>
</el-table-column>
<el-table-column
prop="expressNo"
v-slot="{row}"
:label="$t('快递单号')">
{{ row.expressNo || (row.warehouseInInfoVO ? row.warehouseInInfoVO.expressNo : '') }}
v-slot="{ row }"
:label="$t('快递单号')"
>
{{
row.expressNo ||
(row.warehouseInInfoVO ? row.warehouseInInfoVO.expressNo : "")
}}
</el-table-column>
<el-table-column
v-slot="{row}"
:label="$t('商品特性')">
<el-table-column v-slot="{ row }" :label="$t('商品特性')">
<template v-if="row.prodAttrIds">
{{showAttr(row.prodAttrIds)}}
{{ showAttr(row.prodAttrIds) }}
</template>
</el-table-column>
<el-table-column
prop="createTime"
:label="$t('最后操作时间')">
<template v-slot="{row}">
<el-table-column prop="createTime" :label="$t('最后操作时间')">
<template v-slot="{ row }">
{{ parseTime(row.updateTime) }}
</template>
</el-table-column>
<el-table-column
prop="diffType"
v-slot="{row}"
:label="$t('状态')">
<el-table-column prop="diffType" v-slot="{ row }" :label="$t('状态')">
<dict-tag
v-if="row.warehouseInInfoVO && row.warehouseInInfoVO.diffType"
:type="DICT_TYPE.ORDER_WAREHOUSE_IN_STATUS"
:value="row.warehouseInInfoVO.diffType"
class="red"
:class="{green: row.warehouseInInfoVO.diffType === 4}"
:class="{ green: row.warehouseInInfoVO.diffType === 4 }"
/>
<span :class="{red: row.itemStatus === 3}" v-else>{{ row.itemStatus === 3 ? ($t('少了') + row.num + $t('箱')) : $t('待入仓') }}</span>
<span class="red" v-if="row.warehouseInInfoVO && row.warehouseInInfoVO.cartonsNumDiff">{{ row.warehouseInInfoVO.cartonsNumDiff }}{{$t('箱')}}</span>
<span :class="{ red: row.itemStatus === 3 }" v-else>{{
row.itemStatus === 3 ? $t("少了") + row.num + $t("箱") : $t("待入仓")
}}</span>
<span
class="red"
v-if="row.warehouseInInfoVO && row.warehouseInInfoVO.cartonsNumDiff"
>{{ row.warehouseInInfoVO.cartonsNumDiff }}{{ $t("箱") }}</span
>
</el-table-column>
<el-table-column
prop="createTime"
:label="$t('打包状态')" width="100">
<template v-slot="{row}">
<dict-tag :type="DICT_TYPE.ORDER_ITEM_PACK_STATUS" :value="wareItemPackStatus(row.orderItemId)" />
<el-table-column prop="createTime" :label="$t('打包状态')" width="100">
<template v-slot="{ row }">
<dict-tag
:type="DICT_TYPE.ORDER_ITEM_PACK_STATUS"
:value="wareItemPackStatus(row.orderItemId)"
/>
</template>
</el-table-column>
<el-table-column
prop="address"
:label="$t('操作')" width="250">
<el-table-column prop="address" :label="$t('操作')" width="250">
<template v-slot="{ row, column, $index }">
<!--没有入仓记录的不显示打包按钮 https://zentao.test.jdshangmen.com/bug-view-5389.html-->
<el-button-group v-if="orderWarehouseInList(row.orderItemId).length">
<template v-if="wareItemPackStatus(row.orderItemId) == 1">
<el-button class="pl-5 pr-5" size="mini" type="warning" @click="noNeedPack(row)">{{$t('无需打包')}}</el-button>
<el-button size="mini" type="primary" @click="package(row, $t('打包'))">{{$t('打包')}}</el-button>
<el-button
class="pl-5 pr-5"
size="mini"
type="warning"
@click="noNeedPack(row)"
>{{ $t("无需打包") }}</el-button
>
<el-button
size="mini"
type="primary"
@click="package(row, $t('打包'))"
>{{ $t("打包") }}</el-button
>
</template>
<el-button class="pl-5 pr-5" v-else size="mini" type="primary" @click="package(row, $t('修改打包'))">{{$t('修改打包')}}</el-button>
<el-tooltip :content="$t('请确认货物打包完成再并箱')" :value="true" manual>
<el-button size="mini" type="danger" @click="rollback(row)">{{$t('并箱')}}</el-button>
<el-button
class="pl-5 pr-5"
v-else
size="mini"
type="primary"
@click="package(row, $t('修改打包'))"
>{{ $t("修改打包") }}</el-button
>
<el-tooltip
:content="$t('请确认货物打包完成再并箱')"
:value="true"
manual
>
<el-button size="mini" type="danger" @click="rollback(row)">{{
$t("并箱")
}}</el-button>
</el-tooltip>
<el-button class="pl-5 pr-5" size="mini" type="info" @click="printTag">{{$t('打印标签')}}</el-button>
<el-button
class="pl-5 pr-5"
size="mini"
type="info"
@click="printTag"
>{{ $t("打印标签") }}</el-button
>
</el-button-group>
</template>
</el-table-column>
......@@ -199,76 +290,119 @@
</el-input>
</el-form-item>-->
<h2>{{$t('订单数据')}}</h2>
<h2>{{ $t("订单数据") }}</h2>
<el-form-item :label="$t('下单统计')" class="mb-0">
{{ $t(`{num}箱 {weight}Kg {volume}m³ {quantity}个`, {
num: statistics.sumNumInput,
weight: statistics.sumWeightInput,
volume: statistics.sumVolumeInput,
quantity: statistics.sumQuantityInput
}) }}
{{
$t(`{num}箱 {weight}Kg {volume}m³ {quantity}个`, {
num: statistics.sumNumInput,
weight: statistics.sumWeightInput,
volume: statistics.sumVolumeInput,
quantity: statistics.sumQuantityInput,
})
}}
</el-form-item>
<el-form-item :label="$t('入仓统计')" class="mb-0">
{{ $t(`{num}箱 {weight}Kg {volume}m³ {quantity}个`, {
num: statistics.sumCartonsNumFinishedWarehouseIn,
weight: statistics.sumWeightFinishedWarehouseIn,
volume: statistics.sumVolumeFinishedWarehouseIn,
quantity: statistics.sumQuantityAllFinishedWarehouseIn
}) }}
{{
$t(`{num}箱 {weight}Kg {volume}m³ {quantity}个`, {
num: statistics.sumCartonsNumFinishedWarehouseIn,
weight: statistics.sumWeightFinishedWarehouseIn,
volume: statistics.sumVolumeFinishedWarehouseIn,
quantity: statistics.sumQuantityAllFinishedWarehouseIn,
})
}}
</el-form-item>
<el-form-item :label="$t('打包前统计')" class="mb-0">
{{ $t(`{num}箱 {weight}Kg {volume}m³ {quantity}个`, {
num: statistics.sumCartonsNumPrevPacked,
weight: statistics.sumWeightPrevPacked,
volume: statistics.sumVolumePrevPacked,
quantity: statistics.sumQuantityAllPrevPacked
}) }}
{{
$t(`{num}箱 {weight}Kg {volume}m³ {quantity}个`, {
num: statistics.sumCartonsNumPrevPacked,
weight: statistics.sumWeightPrevPacked,
volume: statistics.sumVolumePrevPacked,
quantity: statistics.sumQuantityAllPrevPacked,
})
}}
</el-form-item>
<el-form-item :label="$t('打包后统计')" class="mb-0">
{{ $t(`{num}箱 {weight}Kg {volume}m³ {quantity}个`, {
num: statistics.sumNum,
weight: statistics.sumWeight,
volume: statistics.sumVolume,
quantity: statistics.sumQuantity
}) }}
{{
$t(`{num}箱 {weight}Kg {volume}m³ {quantity}个`, {
num: statistics.sumNum,
weight: statistics.sumWeight,
volume: statistics.sumVolume,
quantity: statistics.sumQuantity,
})
}}
</el-form-item>
<el-card style="margin-top: 15px;">
<el-card style="margin-top: 15px">
<div slot="header" class="clearfix">
<span style="font-size: 18px">{{$t('入仓影像')}}</span>
<span style="font-size: 18px">{{ $t("入仓影像") }}</span>
</div>
<div>
<image-and-video-upload :fileSize="50" :isShowTip="true" v-model="pictureUrls" readonly ></image-and-video-upload>
<image-and-video-upload
:fileSize="50"
:isShowTip="true"
v-model="pictureUrls"
readonly
></image-and-video-upload>
</div>
</el-card>
<div style="text-align: center;margin-top: 15px">
<el-button @click="escapeBol = true;" type="primary">{{$t('转异')}}</el-button>
<el-button type="primary" @click="handleSubmit">{{$t('完成备货')}}</el-button>
<el-button type="info" @click="printTag">{{$t('打印标签')}}</el-button>
<div style="text-align: center; margin-top: 15px">
<el-button @click="escapeBol = true" type="primary">{{
$t("转异")
}}</el-button>
<el-button type="primary" @click="handleSubmit">{{
$t("完成备货")
}}</el-button>
<el-button type="info" @click="printTag">{{
$t("打印标签")
}}</el-button>
</div>
</el-form>
<el-dialog :title="order.orderNo + $t('订单转异')" center :visible.sync="escapeBol">
<el-form label-position="top" label-width="200" ref="exceptionForm" :model="form" :rules="exceptionRules">
<el-dialog
:title="order.orderNo + $t('订单转异')"
center
:visible.sync="escapeBol"
>
<el-form
label-position="top"
label-width="200"
ref="exceptionForm"
:model="form"
:rules="exceptionRules"
>
<el-form-item :label="$t('异常类型')" prop="manualExceptionType">
<dict-selector v-model="form.manualExceptionType" form-type="checkbox" :type="DICT_TYPE.STOCK_UP_EXCEPTION_TYPE" multiple ></dict-selector>
<dict-selector
v-model="form.manualExceptionType"
form-type="checkbox"
:type="DICT_TYPE.STOCK_UP_EXCEPTION_TYPE"
multiple
></dict-selector>
</el-form-item>
<el-form-item :label="$t('附件')">
<!--<image-upload v-model="form.exceptionUrls"></image-upload>-->
<image-and-video-upload :fileSize="50" :isShowTip="true" v-model="form.exceptionUrls" ></image-and-video-upload>
<image-and-video-upload
:fileSize="50"
:isShowTip="true"
v-model="form.exceptionUrls"
></image-and-video-upload>
</el-form-item>
<el-form-item :label="$t('详细信息')">
<el-input v-model="form.descZh" type="textarea"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleException">{{$t('确认并完成打包')}}</el-button>
<el-button @click="escapeBol = false">{{$t('取消')}}</el-button>
<el-button type="primary" @click="handleException">{{
$t("确认并完成打包")
}}</el-button>
<el-button @click="escapeBol = false">{{ $t("取消") }}</el-button>
</span>
</el-dialog>
<print-tag v-if="isShowPrintTag" :order-id="orderId" @close="isShowPrintTag = false"></print-tag>
<print-tag
v-if="isShowPrintTag"
:order-id="orderId"
@close="isShowPrintTag = false"
></print-tag>
<package
:order="order"
:order-item-a="packageOrderItem"
......@@ -277,46 +411,56 @@
v-if="!!packageOrderItem"
@close="onPackageClose"
></package>
<new-product
:order="order"
v-if="showNewProductDialog"
@close="onPackageClose"
></new-product>
<media-dialog v-if="curPictrues" :value="curPictrues" @close="curPictrues=null"></media-dialog>
<print-tag v-if="showPrintTagDialog" :order-id="orderId" @close="showPrintTagDialog=false" :warehouse-in-num="order.sumNum" />
<new-product
:order="order"
v-if="showNewProductDialog"
@close="onPackageClose"
></new-product>
<media-dialog
v-if="curPictrues"
:value="curPictrues"
@close="curPictrues = null"
></media-dialog>
<print-tag
v-if="showPrintTagDialog"
:order-id="orderId"
@close="showPrintTagDialog = false"
:warehouse-in-num="order.sumNum"
/>
</div>
</template>
<script>
import {getCurrencyList} from "@/api/ecw/currency"
import { getCurrencyList } from "@/api/ecw/currency";
import {
finishPacked,
finishStock,
getOrder,
getOrderWarehouseIn,
getSpecialListByOrderId,
noNeedPack, rollbackDelete,
noNeedPack,
rollbackDelete,
warehousePictureList,
getPackStatistics
} from '@/api/ecw/order'
import orderBaseInfo from "@/components/OrderBaseInfo"
import WarehouseAreaDialog from '@/components/WarehouseAreaDialog'
import {DICT_TYPE} from "@/utils/dict"
import PrintTag from "@/views/ecw/order/components/PrintTag"
import PrintWarehouseReceipt from "@/views/ecw/order/components/PrintWarehouseReceipt"
getPackStatistics,
} from "@/api/ecw/order";
import orderBaseInfo from "@/components/OrderBaseInfo";
import WarehouseAreaDialog from "@/components/WarehouseAreaDialog";
import { DICT_TYPE } from "@/utils/dict";
import PrintTag from "@/views/ecw/order/components/PrintTag";
import PrintWarehouseReceipt from "@/views/ecw/order/components/PrintWarehouseReceipt";
import imageUpload from "@/components/ImageUpload";
import {parseTime} from "@/utils/ruoyi"
import ImageAndVideoUpload from '@/components/ImageAndVideoUpload'
import Package from './components/Package'
import { parseTime } from "@/utils/ruoyi";
import ImageAndVideoUpload from "@/components/ImageAndVideoUpload";
import Package from "./components/Package";
import Template from "@/views/cms/template/index.vue";
import {getProductAttrList} from "@/api/ecw/productAttr";
import { getProductAttrList } from "@/api/ecw/productAttr";
import MediaDialog from "@/views/ecw/order/stocking/components/MediaDialog.vue";
import WarehouseRecordDetail from "@/views/ecw/order/warehousing/components/WarehouseRecordDetail.vue";
import {formatTime} from "../../../../utils";
import { formatTime } from "../../../../utils";
export default {
name: "Stocking",
components: {
WarehouseRecordDetail,
MediaDialog,
......@@ -328,18 +472,21 @@ export default {
imageUpload,
ImageAndVideoUpload,
Package,
NewProduct: () => import('@/views/ecw/order/stocking/components/NewProduct.vue')
NewProduct: () =>
import("@/views/ecw/order/stocking/components/NewProduct.vue"),
},
mounted() {
if(this.$route.query.id){
this.orderId = parseInt(this.$route.query.id || undefined)
if (this.$route.query.id) {
this.orderId = parseInt(this.$route.query.id || undefined);
getSpecialListByOrderId(this.orderId).then(r => this.specialList = r.data)
this.getList()
getSpecialListByOrderId(this.orderId).then(
(r) => (this.specialList = r.data)
);
this.getList();
}
getCurrencyList().then(res => this.currencyList = res.data)
getProductAttrList().then(res => this.productAttrList = res.data)
getCurrencyList().then((res) => (this.currencyList = res.data));
getProductAttrList().then((res) => (this.productAttrList = res.data));
},
data() {
......@@ -350,13 +497,13 @@ export default {
finishVisible: false,
warehousingVisible: false,
form: {
exceptionUrls:[],
descZh:'',
manualExceptionType:[],
sumVolume: '',
sumWeight: '',
exceptionUrls: [],
descZh: "",
manualExceptionType: [],
sumVolume: "",
sumWeight: "",
},
currencyList:[],
currencyList: [],
order: {},
orderId: undefined,
orderItemList: [],
......@@ -364,29 +511,30 @@ export default {
warehousing: undefined,
isShowPrintTag: false,
isShowPrint: false,
escapeBol:false,
escapeBol: false,
label: {
"orderId": 0,
"orderLabelDtoList": [
orderId: 0,
orderLabelDtoList: [
{
"end": 0,
"start": 0
}
]
end: 0,
start: 0,
},
],
},
exceptionRules: {
manualExceptionType: [
{ required: true, message: '请勾选原因类型', trigger: 'change' },
{ required: true, message: "请勾选原因类型", trigger: "change" },
{
validator: (rule, value, callback) => {
if (value.length <= 0) {
callback(new Error('请勾选原因类型'))
callback(new Error("请勾选原因类型"));
}
callback()
}, trigger: 'change'
}
]
callback();
},
trigger: "change",
},
],
},
// 打包弹层的标题
packageTitle: null,
......@@ -402,176 +550,204 @@ export default {
// 是否显示打印标签弹层
showPrintTagDialog: false,
// 统计数据
statistics:{}
}
statistics: {},
};
},
methods: {
formatTime,
getStatistics() {
console.log('获取统计数据')
getPackStatistics(this.orderId).then(res => {
this.statistics = res.data
})
console.log("获取统计数据");
getPackStatistics(this.orderId).then((res) => {
this.statistics = res.data;
});
},
getOrderItemList(){
this.orderItemList = []
return getOrderWarehouseIn(this.orderId).then(r => this.orderItemList = r.data)
getOrderItemList() {
this.orderItemList = [];
return getOrderWarehouseIn(this.orderId).then(
(r) => (this.orderItemList = r.data)
);
},
getList(){
this.getOrder()
this.getOrderItemList()
this.getStatistics()
getList() {
this.getOrder();
this.getOrderItemList();
this.getStatistics();
},
getWarehousePictureList(){
getWarehousePictureList() {
return warehousePictureList({
bizId: this.order.orderId,
type: 1
}).then(r =>{
this.form.urls = r.data.map(i =>i.url)
})
type: 1,
}).then((r) => {
this.form.urls = r.data.map((i) => i.url);
});
},
include(){
include() {
return (state, arr) => {
return arr.indexOf(state) > -1
}
return arr.indexOf(state) > -1;
};
},
exclude(){
exclude() {
return (state, arr) => {
return arr.indexOf(state) == -1
}
return arr.indexOf(state) == -1;
};
},
getOrder(){
return getOrder(this.orderId).then(r => {
// 获取渠道可出特性文案用户订单基础信息显示
r.data.channelAttrName = this.showAttr(r.data.channelAttrId)
this.order = r.data
this.form.sumVolume = this.order.sumVolume
this.form.sumWeight = this.order.sumWeight
}).then(() => {
// this.getLabelByOrder()
this.getWarehousePictureList()
})
getOrder() {
return getOrder(this.orderId)
.then((r) => {
// 获取渠道可出特性文案用户订单基础信息显示
r.data.channelAttrName = this.showAttr(r.data.channelAttrId);
this.order = r.data;
this.form.sumVolume = this.order.sumVolume;
this.form.sumWeight = this.order.sumWeight;
})
.then(() => {
// this.getLabelByOrder()
this.getWarehousePictureList();
});
},
// 提交转异
handleException() {
this.$refs.exceptionForm.validate((valid) => {
if (valid) {
this.handleSubmit()
this.handleSubmit();
} else {
this.$message.warning('请勾选原因类型')
this.$message.warning("请勾选原因类型");
}
})
});
},
// 完成备货
async handleSubmit() {
let unpackProds = []
this.orderItemList.forEach(item => {
let unpackProds = [];
this.orderItemList.forEach((item) => {
// 有入仓记录且未打包
if(item.orderWarehouseInBackItemDoList.length && item.packStatus == 1){
unpackProds.push(this.$l(item, 'prodTitle'))
if (
item.orderWarehouseInBackItemDoList.length &&
item.packStatus == 1
) {
unpackProds.push(this.$l(item, "prodTitle"));
}
})
if(unpackProds.length){
return this.$alert(`商品${unpackProds.join(',')}未完成打包,无法完成备货`, this.$t('提示'))
});
if (unpackProds.length) {
return this.$alert(
`商品${unpackProds.join(",")}未完成打包,无法完成备货`,
this.$t("提示")
);
}
let form = {...this.form}
form.orderId = this.orderId
form.manualExceptionType = form.manualExceptionType.join(',')
finishStock(form).then(res => {
return this.$confirm("备货成功,是否需要打印标签").catch(() => {
this.$tab.closePage()
let form = { ...this.form };
form.orderId = this.orderId;
form.manualExceptionType = form.manualExceptionType.join(",");
finishStock(form)
.then((res) => {
return this.$confirm("备货成功,是否需要打印标签").catch(() => {
this.$tab.closePage();
});
})
}).then(() => {
this.printTag()
})
.then(() => {
this.printTag();
});
},
// 显示打包弹层
package(row, title = null){
this.packageOrderItem = row
this.packageWarehouseItem = this.orderItemList.find(item => item.orderItemId === row.orderItemId)
this.packageTitle = title || this.$t('打包')
package(row, title = null) {
this.packageOrderItem = row;
this.packageWarehouseItem = this.orderItemList.find(
(item) => item.orderItemId === row.orderItemId
);
this.packageTitle = title || this.$t("打包");
},
// 无需打包
noNeedPack(row){
noNeedPack(row.orderItemId).then(res => {
this.$message.success(this.$t('操作成功'))
this.getList()
})
noNeedPack(row) {
noNeedPack(row.orderItemId).then((res) => {
this.$message.success(this.$t("操作成功"));
this.getList();
});
},
onPackageClose(){
this.packageOrderItem=null;
this.packageOrderItem=null;
this.showNewProductDialog = false
this.getList()
onPackageClose() {
this.packageOrderItem = null;
this.packageOrderItem = null;
this.showNewProductDialog = false;
this.getList();
},
showMedia(orderItem){
console.log('查看影像', orderItem)
const wareItem = this.wareItem(orderItem.orderItemId)
if(!wareItem.pictureUrls){
return this.$message.info(this.$t('暂无影像'))
showMedia(orderItem) {
console.log("查看影像", orderItem);
const wareItem = this.wareItem(orderItem.orderItemId);
if (!wareItem.pictureUrls) {
return this.$message.info(this.$t("暂无影像"));
}
this.curPictrues = wareItem.pictureUrls || []
this.curPictrues = wareItem.pictureUrls || [];
},
// 保存箱明细
saveDetail(row, warehouseInId){
const wareItem = this.wareItem(row.orderItemId)
const orderWarehouseInItemDtoList = wareItem.orderWarehouseInBackItemDoList
orderWarehouseInItemDtoList.map(item =>{
item.orderLocationCreateReqVOList = item.orderLocationBackVOList || []
return item
})
let pictures = wareItem.pictureUrls || []
if(window.ChooseOrderProductsPictureUrls?.length){
pictures.push(...window.ChooseOrderProductsPictureUrls)
saveDetail(row, warehouseInId) {
//lanbm 2024-06-15 添加注释
//alert(warehouseInId);
const wareItem = this.wareItem(row.orderItemId);
const orderWarehouseInItemDtoList =
wareItem.orderWarehouseInBackItemDoList;
orderWarehouseInItemDtoList.map((item) => {
item.orderLocationCreateReqVOList = item.orderLocationBackVOList || [];
return item;
});
let pictures = wareItem.pictureUrls || [];
if (window.ChooseOrderProductsPictureUrls?.length) {
pictures.push(...window.ChooseOrderProductsPictureUrls);
// 去重
pictures = Array.from(new Set(pictures))
pictures = Array.from(new Set(pictures));
}
if(window.ChooseOrderProductsExpressNos?.length){
const warehouseInItem = orderWarehouseInItemDtoList.find(item => item.id === warehouseInId)
if(!warehouseInItem.expressNo)warehouseInItem.expressNo = ""
window.ChooseOrderProductsExpressNos?.forEach(item => {
if(warehouseInItem.expressNo.indexOf(item) === -1){
if(warehouseInItem.expressNo?.length) warehouseInItem.expressNo += ","
warehouseInItem.expressNo += item
if (window.ChooseOrderProductsExpressNos?.length) {
const warehouseInItem = orderWarehouseInItemDtoList.find(
(item) => item.id === warehouseInId
);
if (!warehouseInItem.expressNo) warehouseInItem.expressNo = "";
window.ChooseOrderProductsExpressNos?.forEach((item) => {
if (warehouseInItem.expressNo.indexOf(item) === -1) {
if (warehouseInItem.expressNo?.length)
warehouseInItem.expressNo += ",";
warehouseInItem.expressNo += item;
}
})
});
}
const data = {
orderId: row.orderId,
orderItemId: row.orderItemId,
orderWarehouseInItemDtoList: orderWarehouseInItemDtoList,
pictureUrls: pictures
}
finishPacked(data).then(res => {
this.$message.success(this.$t('操作成功'))
})
pictureUrls: pictures,
};
finishPacked(data).then((res) => {
//lanbm 2024-06-15 调用列表加载函数
this.getList();
this.$message.success(this.$t("操作成功"));
});
},
// 并箱
async rollback(orderItem){
this.$confirm(this.$l(orderItem, 'prodTitle') + this.$t("并箱后不可恢复,是否确认并箱?"), this.$t('提示')).then(() => {
return rollbackDelete({
orderId: this.orderId,
orderItemId: orderItem.orderItemId,
isPackagingRollback: true
async rollback(orderItem) {
this.$confirm(
this.$l(orderItem, "prodTitle") +
this.$t("并箱后不可恢复,是否确认并箱?"),
this.$t("提示")
)
.then(() => {
return rollbackDelete({
orderId: this.orderId,
orderItemId: orderItem.orderItemId,
isPackagingRollback: true,
});
})
}).then(res =>{
this.$message.success(this.$t('操作成功'))
this.getList()
})
.then((res) => {
this.$message.success(this.$t("操作成功"));
this.getList();
});
},
printTag(){
this.showPrintTagDialog = true
printTag() {
this.showPrintTagDialog = true;
},
// 箱明细关闭后清理快递单号和影像临时数据
clearAppendExpressNoAndPictures(){
clearAppendExpressNoAndPictures() {
setTimeout(() => {
window.ChooseOrderProductsExpressNos = null
window.ChooseOrderProductsPictureUrls = null
}, 100)
}
window.ChooseOrderProductsExpressNos = null;
window.ChooseOrderProductsPictureUrls = null;
}, 100);
},
},
watch: {
/*orderSpecialNeeds(val){
......@@ -587,73 +763,80 @@ export default {
computed: {
// 根据orderItemId获取入仓item
wareItem(){
return orderItemId => {
return this.orderItemList.find(item => item.orderItemId == orderItemId)
}
wareItem() {
return (orderItemId) => {
return this.orderItemList.find(
(item) => item.orderItemId == orderItemId
);
};
},
// 根据orderItemId获取入仓记录
orderWarehouseInList(){
orderWarehouseInList() {
return (orderItemId) => {
return this.wareItem(orderItemId)?.orderWarehouseInBackItemDoList || []
}
return this.wareItem(orderItemId)?.orderWarehouseInBackItemDoList || [];
};
},
// 获取打包状态
wareItemPackStatus(){
return orderItemId => {
return this.wareItem(orderItemId)?.packStatus
}
wareItemPackStatus() {
return (orderItemId) => {
return this.wareItem(orderItemId)?.packStatus;
};
},
title() {
return this.$i18n.locale === 'en_US' ? this.$route.meta.titleEn : this.$route.name
return this.$i18n.locale === "en_US"
? this.$route.meta.titleEn
: this.$route.name;
},
orderSpecialNeedsDict() {
return this.$store.state.dict.dictDatas.order_special_needs
return this.$store.state.dict.dictDatas.order_special_needs;
},
orderSpecialNeeds(){
const result = []
this.specialList.forEach(e => {
const t = this.orderSpecialNeedsDict.find(f => f.value === e.advanceType)
if(t) {
result.push({...e, label: t.label, labelEn: t.labelEn})
orderSpecialNeeds() {
const result = [];
this.specialList.forEach((e) => {
const t = this.orderSpecialNeedsDict.find(
(f) => f.value === e.advanceType
);
if (t) {
result.push({ ...e, label: t.label, labelEn: t.labelEn });
}
})
return result
});
return result;
},
warehouseId(){
return this.order?.logisticsInfoDto?.startWarehouseId
warehouseId() {
return this.order?.logisticsInfoDto?.startWarehouseId;
},
// 显示特性
showAttr(){
return attrIds => {
if(!attrIds) return ''
let attrArr = attrIds.split(",").map(item => +item)
let arr = []
this.productAttrList.forEach(item => {
if(attrArr.indexOf(item.id) > -1) arr.push(this.$l(item, 'attrName'))
})
return arr.join(",")
}
showAttr() {
return (attrIds) => {
if (!attrIds) return "";
let attrArr = attrIds.split(",").map((item) => +item);
let arr = [];
this.productAttrList.forEach((item) => {
if (attrArr.indexOf(item.id) > -1)
arr.push(this.$l(item, "attrName"));
});
return arr.join(",");
};
},
// 全部入仓记录的入仓影像
pictureUrls(){
let urls = []
this.orderItemList.forEach(item => {
console.log('pictureUrls', item.pictureUrls)
urls = urls.concat(item.pictureUrls || [])
})
return urls
}
}
}
pictureUrls() {
let urls = [];
this.orderItemList.forEach((item) => {
console.log("pictureUrls", item.pictureUrls);
urls = urls.concat(item.pictureUrls || []);
});
return urls;
},
},
};
</script>
<style scoped lang="scss">
@import "src/assets/styles/element-variables";
.red{
.red {
color: $--color-danger;
}
.green{
.green {
color: $--color-success;
}
</style>
<!--空运备货列表-->
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
<el-form-item :label="$t('编号')" prop="orderNo">
<el-input v-model="queryParams.numberKey" :placeholder="$t('请输入订单号、唛头、提单号')" clearable @keyup.enter.native="handleQuery" />
<el-input
v-model="queryParams.numberKey"
:placeholder="$t('请输入订单号、唛头、提单号')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item :label="$t('发货人')" prop="consignorKey">
<el-input v-model="queryParams.consignorKey" :placeholder="$t('发货人')" clearable @keyup.enter.native="handleQuery" />
<el-input
v-model="queryParams.consignorKey"
:placeholder="$t('发货人')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item :label="$t('收货人')" prop="consigneeKey">
<el-input v-model="queryParams.consigneeKey" :placeholder="$t('收货人')" clearable @keyup.enter.native="handleQuery" />
<el-input
v-model="queryParams.consigneeKey"
:placeholder="$t('收货人')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="">
<dict-selector :type="DICT_TYPE.ECW_BEGINTIME_TYPE_ENDTIME" :filter="(item) => item.value != 'PickTime'" v-model="dateFilterType" defaultable style="width: 150px; margin-right: 5px" />
<el-date-picker v-model="dateFilter" type="datetimerange" range-separator="-"
<dict-selector
:type="DICT_TYPE.ECW_BEGINTIME_TYPE_ENDTIME"
:filter="(item) => item.value != 'PickTime'"
v-model="dateFilterType"
defaultable
style="width: 150px; margin-right: 5px"
/>
<el-date-picker
v-model="dateFilter"
type="datetimerange"
range-separator="-"
:start-placeholder="$t('开始日期')"
:end-placeholder="$t('结束日期')"
value-format="yyyy-MM-dd HH:mm:ss"
@change="handleQuery"
>
</el-date-picker>
>
</el-date-picker>
</el-form-item>
<el-form-item :label="$t('始发仓')" prop="startWarehouseId">
<el-select v-model="queryParams.startWarehouseId" :placeholder="$t('请选择始发仓')" clearable @change="handleQuery">
<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
@change="handleQuery"
>
<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="destWarehouseId">
<el-select v-model="queryParams.destWarehouseId" :placeholder="$t('请选择目的仓')" clearable @change="handleQuery">
<el-option v-for="item in importWarehouseList" :label="$l(item, 'title')" :value="item.id" :key="item.id"></el-option>
<el-select
v-model="queryParams.destWarehouseId"
:placeholder="$t('请选择目的仓')"
clearable
@change="handleQuery"
>
<el-option
v-for="item in importWarehouseList"
:label="$l(item, 'title')"
:value="item.id"
:key="item.id"
></el-option>
</el-select>
</el-form-item>
......@@ -40,188 +83,378 @@
</el-form-item>-->
<el-form-item :label="$t('商品')" prop="tidanNo">
<el-input v-model="queryParams.prodKey" :placeholder="$t('请输入商品类型、品名或品牌')" clearable @keyup.enter.native="handleQuery" />
<el-input
v-model="queryParams.prodKey"
:placeholder="$t('请输入商品类型、品名或品牌')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item :label="$t('控货')" prop="isCargoControl">
<dict-selector v-model="queryParams.isCargoControl" :type="DICT_TYPE.INFRA_BOOLEAN_STRING" fomatter="bool" clearable />
<dict-selector
v-model="queryParams.isCargoControl"
:type="DICT_TYPE.INFRA_BOOLEAN_STRING"
fomatter="bool"
clearable
/>
</el-form-item>
<el-form-item :label="$t('入仓类型')" prop="warehouseType">
<dict-selector :type="DICT_TYPE.ECW_WAREHOUSING_TYPE" v-model="queryParams.warehouseType" clearable/>
<dict-selector
:type="DICT_TYPE.ECW_WAREHOUSING_TYPE"
v-model="queryParams.warehouseType"
clearable
/>
</el-form-item>
<el-form-item :label="$t('客户经理')" >
<user-selector manage v-model="queryParams.salesmanId" clearable @change="handleQuery"
:prepend="{ id: 0, nickname: $t('未分配客户经理')}"/>
<el-form-item :label="$t('客户经理')">
<user-selector
manage
v-model="queryParams.salesmanId"
clearable
@change="handleQuery"
:prepend="{ id: 0, nickname: $t('未分配客户经理') }"
/>
</el-form-item>
<el-form-item :label="$t('订单状态')" prop="status">
<dict-selector :type="DICT_TYPE.ORDER_STATUS" v-model="queryParams.status"
@keyup.enter.native="handleQuery" clearable />
<dict-selector
:type="DICT_TYPE.ORDER_STATUS"
v-model="queryParams.status"
@keyup.enter.native="handleQuery"
clearable
/>
</el-form-item>
<el-form-item :label="$t('报关方式')" prop="customsType">
<dict-selector :type="DICT_TYPE.ECW_CUSTOMS_TYPE" v-model="queryParams.customsType" clearable @change="handleQuery" />
<dict-selector
:type="DICT_TYPE.ECW_CUSTOMS_TYPE"
v-model="queryParams.customsType"
clearable
@change="handleQuery"
/>
</el-form-item>
<el-form-item :label="$t('是否齐货')" >
<el-form-item :label="$t('是否齐货')">
<!--// 字段存疑-->
<dict-selector v-model="queryParams.isNeat" :type="DICT_TYPE.INFRA_BOOLEAN_STRING" fomatter="bool" clearable @change="handleQuery"/>
<dict-selector
v-model="queryParams.isNeat"
:type="DICT_TYPE.INFRA_BOOLEAN_STRING"
fomatter="bool"
clearable
@change="handleQuery"
/>
</el-form-item>
<el-form-item :label="$t('备案属性')" prop="productRecord">
<dict-selector :type="DICT_TYPE.PRODUCT_RECORD_ATTRIBUTE" v-model="queryParams.productRecord" clearable @change="handleQuery" />
<dict-selector
:type="DICT_TYPE.PRODUCT_RECORD_ATTRIBUTE"
v-model="queryParams.productRecord"
clearable
@change="handleQuery"
/>
</el-form-item>
<el-form-item :label="$t('快递单号')" prop="number">
<el-input v-model="queryParams.number" :placeholder="$t('快递单号')" clearable @keyup.enter.native="handleQuery" />
<el-input
v-model="queryParams.number"
:placeholder="$t('快递单号')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item :label="$t('外部仓')" prop="number">
<el-select v-model="queryParams.isExternalWarehouse" :placeholder="$t('请选择')" clearable @change="handleQuery">
<el-select
v-model="queryParams.isExternalWarehouse"
:placeholder="$t('请选择')"
clearable
@change="handleQuery"
>
<el-option :label="$t('外部仓')" :value="1"></el-option>
<el-option :label="$t('自有仓')" :value="0"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('异常状态')" prop="status">
<dict-selector :type="DICT_TYPE.ORDER_ABNORMAL_STATE" v-model="queryParams.abnormalState"
@keyup.enter.native="handleQuery" clearable />
<dict-selector
:type="DICT_TYPE.ORDER_ABNORMAL_STATE"
v-model="queryParams.abnormalState"
@keyup.enter.native="handleQuery"
clearable
/>
</el-form-item>
<el-form-item :label="$t('审核状态')" prop="status">
<dict-selector :type="DICT_TYPE.ECW_ORDER_APPROVAL_TYPE" v-model="queryParams.auditType"
@keyup.enter.native="handleQuery" clearable />
<dict-selector
:type="DICT_TYPE.ECW_ORDER_APPROVAL_TYPE"
v-model="queryParams.auditType"
@keyup.enter.native="handleQuery"
clearable
/>
</el-form-item>
<el-form-item :label="$t('订单类型')" prop="number">
<el-select v-model="queryParams.type" :placeholder="$t('请选择')" clearable >
<el-select
v-model="queryParams.type"
:placeholder="$t('请选择')"
clearable
>
<el-option :label="$t('普通订单')" :value="0"></el-option>
<el-option :label="$t('集运服务')" :value="1"></el-option>
<el-option :label="$t('海外仓')" :value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('出货渠道')" prop="number">
<selector :options="channelList" :label-field="$l('name')" value-field="channelId" v-model="queryParams.channelId"></selector>
<selector
:options="channelList"
:label-field="$l('name')"
value-field="channelId"
v-model="queryParams.channelId"
></selector>
</el-form-item>
<el-form-item :label="$t('特需')" prop="packageType">
<el-select v-model="queryParams.packageTypeArr" multiple :placeholder="$t('请选择')" clearable >
<el-select
v-model="queryParams.packageTypeArr"
multiple
:placeholder="$t('请选择')"
clearable
>
<template v-for="item in getDictDatas(DICT_TYPE.ORDER_SPECIAL_NEEDS)">
<el-option :label="$l(item, 'label')" :value="item.value"></el-option>
<el-option
:label="$l(item, 'label')"
:value="item.value"
></el-option>
</template>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">{{$t('搜索')}}</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">{{$t('重置')}}</el-button>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">{{
$t("搜索")
}}</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">{{
$t("重置")
}}</el-button>
</el-form-item>
</el-form>
<!-- 操作工具栏 -->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button :disabled="!multipleSelection.length" type="primary" :loading="exporting" plain size="mini" @click="exportXls(ids)" v-hasPermi="['ecw:order:stockingList:export_selected']">{{$t('导出所选')}}</el-button>
<el-button type="primary" :loading="exporting" plain size="mini" @click="exportXls(queryParams)" v-hasPermi="['ecw:order:stockingList:export_search']">{{$t('导出搜索')}}</el-button>
<el-button
:disabled="!multipleSelection.length"
type="primary"
:loading="exporting"
plain
size="mini"
@click="exportXls(ids)"
v-hasPermi="['ecw:order:stockingList:export_selected']"
>{{ $t("导出所选") }}</el-button
>
<el-button
type="primary"
:loading="exporting"
plain
size="mini"
@click="exportXls(queryParams)"
v-hasPermi="['ecw:order:stockingList:export_search']"
>{{ $t("导出搜索") }}</el-button
>
</el-col>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
<el-table
v-loading="loading"
:data="list"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column :label="$t('订单编号')" width="120px" align="center" prop="orderNo" >
<el-table-column
:label="$t('订单编号')"
width="120px"
align="center"
prop="orderNo"
>
<template slot-scope="scope">
<router-link :to="{path: '/order/detail',query: {orderId: scope.row.orderId}}" class="link-type">
<router-link
:to="{
path: '/order/detail',
query: { orderId: scope.row.orderId },
}"
class="link-type"
>
<span>{{ scope.row.orderNo }}</span>
</router-link>
<div style="display: flex;flex-wrap: wrap;" v-if="scope.row.advanceType">
<el-button @click="deleteSpecial(item.value,scope.row.orderId)" size="mini" style="margin-left: 20px" type="danger" circle v-for="(item,index) in specialRendering(scope.row.advanceType)" :key="index">{{item.label[0]}}</el-button>
<div
style="display: flex; flex-wrap: wrap"
v-if="scope.row.advanceType"
>
<el-button
@click="deleteSpecial(item.value, scope.row.orderId)"
size="mini"
style="margin-left: 20px"
type="danger"
circle
v-for="(item, index) in specialRendering(scope.row.advanceType)"
:key="index"
>{{ item.label[0] }}</el-button
>
</div>
</template>
</el-table-column>
<el-table-column :label="$t('唛头')" align="center" prop="marks" />
<el-table-column :label="$t('总箱数/入仓箱数')" align="center" prop="sumNum">
<template slot-scope="{row}">
<div :style="{color:row.customsType != 1 ? 'red' : null}">{{row.totalNum}}{{$t('')}}/{{row.sumNum}}{{$t('')}}</div>
<dict-tag v-if="row.customsType != 1" style="color:red" :type="DICT_TYPE.ECW_CUSTOMS_TYPE" :value="row.customsType"></dict-tag>
<el-table-column
:label="$t('总箱数/入仓箱数')"
align="center"
prop="sumNum"
>
<template slot-scope="{ row }">
<div :style="{ color: row.customsType != 1 ? 'red' : null }">
{{ row.totalNum }}{{ $t("") }}/{{ row.sumNum }}{{ $t("") }}
</div>
<dict-tag
v-if="row.customsType != 1"
style="color: red"
:type="DICT_TYPE.ECW_CUSTOMS_TYPE"
:value="row.customsType"
></dict-tag>
</template>
</el-table-column>
<el-table-column :label="$t('体积/重量')" align="center" prop="sumWeight">
<template slot-scope="{row}">
<template slot-scope="{ row }">
<!--入仓前是填单数据,入仓后是入仓数据,装柜审核通过等状态inwarehouseState会变成0,所以只能通过sumNum来判断-->
<component
:is="row.orderType > 1 ? 'el-tooltip' : 'div'"
class="item"
:style="{
color: row.orderType > 1 ? 'red' : null
}"
color: row.orderType > 1 ? 'red' : null,
}"
effect="dark"
:content="row.orderType===2 ? (row.wvolume||0)+'m³' : (row.vweight || 0) + 'kg'"
placement="bottom">
<div v-if="row.sumNum > 0">{{row.sumVolume}}m³ /{{row.sumWeight}}Kg</div>
<div v-else>{{row.costVO.totalVolume}}m³ /{{row.costVO.totalWeight}}Kg</div>
:content="
row.orderType === 2
? (row.wvolume || 0) + 'm³'
: (row.vweight || 0) + 'kg'
"
placement="bottom"
>
<div v-if="row.sumNum > 0">
{{ row.sumVolume }}m³ /{{ row.sumWeight }}Kg
</div>
<div v-else>
{{ row.costVO.totalVolume }}m³ /{{ row.costVO.totalWeight }}Kg
</div>
</component>
</template>
</el-table-column>
<el-table-column :label="$t('始发仓')" align="center" prop="startWarehouseName">
<template slot-scope="{row}">
{{row.startWarehouseName}}
<span style="color:red" v-if="row.isExternalWarehouse">({{$t('外部仓')}})</span>
<el-table-column
:label="$t('始发仓')"
align="center"
prop="startWarehouseName"
>
<template slot-scope="{ row }">
{{ row.startWarehouseName }}
<span style="color: red" v-if="row.isExternalWarehouse"
>({{ $t("外部仓") }})</span
>
</template>
</el-table-column>
<el-table-column :label="$t('运输方式/目的地')" align="center" prop="transportId">
<template slot-scope="{row}">
<dict-tag :type="DICT_TYPE.ECW_TRANSPORT_TYPE" :value="row.transportId" /> / {{row.dstWarehouseName}}
<el-table-column
:label="$t('运输方式/目的地')"
align="center"
prop="transportId"
>
<template slot-scope="{ row }">
<dict-tag
:type="DICT_TYPE.ECW_TRANSPORT_TYPE"
:value="row.transportId"
/>
/ {{ row.dstWarehouseName }}
</template>
</el-table-column>
<el-table-column :label="$t('控货')" align="center" prop="isCargoControl">
<template slot-scope="{row}">
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="row.isCargoControl" />
<template slot-scope="{ row }">
<dict-tag
:type="DICT_TYPE.INFRA_BOOLEAN_STRING"
:value="row.isCargoControl"
/>
</template>
</el-table-column>
<el-table-column :label="$t('订单状态')" align="center" prop="status">
<template slot-scope="scope">
<!-- <dict-tag :type="DICT_TYPE.ORDER_STATUS" :value="scope.row.status" /> -->
{{scope.row.statusMsg}}
{{ scope.row.statusMsg }}
</template>
</el-table-column>
<el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width actions" width="150px">
<el-table-column
:label="$t('操作')"
align="center"
class-name="small-padding fixed-width actions"
width="150px"
>
<template slot-scope="scope">
<el-button type="text" @click="setCanNotShipment(scope.row)" v-hasPermi="['ecw:order:setCanNotShipment']">{{$t('不可出')}}</el-button>
<el-button type="text" @click="$router.push('stocking?id=' + scope.row.orderId)" v-hasPermi="['ecw:order:stockingList:stocking']">{{$t('备货')}}</el-button>
<el-button type="text" @click="printTagOrderId=scope.row.orderId" v-hasPermi="['ecw:order:stockingList:print_tag']">{{$t('打印标签')}}</el-button>
<el-button
type="text"
@click="setCanNotShipment(scope.row)"
v-hasPermi="['ecw:order:setCanNotShipment']"
>{{ $t("不可出") }}</el-button
>
<el-button
type="text"
@click="$router.push('stocking?id=' + scope.row.orderId)"
v-hasPermi="['ecw:order:stockingList:stocking']"
>{{ $t("备货") }}</el-button
>
<el-button
type="text"
@click="printTagOrderId = scope.row.orderId"
v-hasPermi="['ecw:order:stockingList:print_tag']"
>{{ $t("打印标签") }}</el-button
>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.page" :limit.sync="queryParams.rows"
@pagination="getList" />
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.rows"
@pagination="getList"
/>
<print-tag v-if="printTagOrderId !== null" :order-id="printTagOrderId" @close="printTagOrderId=null" />
<print-tag
v-if="printTagOrderId !== null"
:order-id="printTagOrderId"
@close="printTagOrderId = null"
/>
</div>
</template>
<script>
import Selector from '@/components/Selector'
import ProductSelector from '@/components/ProductSelector'
import { getProductAttrList } from '@/api/ecw/productAttr'
import CustomerSelector from '@/components/CustomerSelector'
import specialNeeds from '@/views/ecw/order/components/specialNeeds';
import Selector from "@/components/Selector";
import ProductSelector from "@/components/ProductSelector";
import { getProductAttrList } from "@/api/ecw/productAttr";
import CustomerSelector from "@/components/CustomerSelector";
import specialNeeds from "@/views/ecw/order/components/specialNeeds";
import {
canReadyStockShipmentPage,
exportReadyStock,
canShipmentPage,
orderSpecialNeed,
exportCanShipment, setNotCanShipment, setCanNotShipment
exportCanShipment,
setNotCanShipment,
setCanNotShipment,
} from "@/api/ecw/order";
import PrintTag from './components/PrintTag'
import PrintWarehouseReceipt from './components/PrintWarehouseReceipt'
import PrintLadingBill from './components/PrintLadingBill'
import BatchPickup from './components/BatchPickup'
import PrintTag from "./components/PrintTag";
import PrintWarehouseReceipt from "./components/PrintWarehouseReceipt";
import PrintLadingBill from "./components/PrintLadingBill";
import BatchPickup from "./components/BatchPickup";
import withdrawal from "@/views/ecw/order/withdrawal";
import UserSelector from '@/components/UserSelector'
import UserSelector from "@/components/UserSelector";
import BatchSingleApplication from "@/views/ecw/order/batchSingleApplication";
import FeeApplication from "@/views/ecw/order/feeApplication";
import MergeLog from '@/views/ecw/order/components/MergeLog'
import PickupLog from './components/PickupLog'
import {getWarehouseList} from '@/api/ecw/warehouse'
import MergeLog from "@/views/ecw/order/components/MergeLog";
import PickupLog from "./components/PickupLog";
import { getWarehouseList } from "@/api/ecw/warehouse";
import { getCurrencyPage } from "@/api/ecw/currency";
import SplitRevoke from "@/views/ecw/order/components/SplitRevoke";
import {getChannelList} from "@/api/ecw/channel";
import { getChannelList } from "@/api/ecw/channel";
import Template from "@/views/cms/template/index.vue";
export default {
name: "EcwOrderStockinglist",
......@@ -233,7 +466,15 @@ export default {
MergeLog,
PickupLog,
SplitRevoke,
CustomerSelector, ProductSelector, Selector,specialNeeds,PrintTag, PrintWarehouseReceipt, PrintLadingBill, BatchPickup,withdrawal
CustomerSelector,
ProductSelector,
Selector,
specialNeeds,
PrintTag,
PrintWarehouseReceipt,
PrintLadingBill,
BatchPickup,
withdrawal,
},
data() {
return {
......@@ -255,78 +496,84 @@ export default {
// 查询参数
queryParams: {
page: 1,
rows: 10
rows: 10,
},
warehouseList:[],
productAttrList: [], // 商品属性
molecule: '', //重货比分子
denominator: '', //重货比分母
dateFilterType: '', //日期筛选类别
warehouseList: [],
productAttrList: [], // 商品属性
molecule: "", //重货比分子
denominator: "", //重货比分母
dateFilterType: "", //日期筛选类别
dateFilter: [], //筛选日期
printTagOrderId: null, // 显示打印标签的订单ID
isShow:false,//特殊显示
multipleSelection:[],
isShow: false, //特殊显示
multipleSelection: [],
params: {
page: 1,
rows: 20,
},
currencyList:[],
channelList:[]
currencyList: [],
channelList: [],
};
},
watch:{
isChinese(){
this.getList()
}
watch: {
isChinese() {
this.getList();
},
},
computed: {
isChinese(){
return this.$i18n.locale === 'zh_CN'
isChinese() {
return this.$i18n.locale === "zh_CN";
},
exportWarehouseList(){
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)
importWarehouseList() {
return this.warehouseList.filter(
(item) => item.tradeType == 1 || item.tradeType == 3
);
},
combinedQueryParams(){
let timeParams = {}
if(this.dateFilterType && this.dateFilter){
timeParams['begin' + this.dateFilterType] = this.dateFilter[0]
timeParams['end' + this.dateFilterType] = this.dateFilter[1]
}
let queryParams = Object.assign({}, this.queryParams, timeParams)
return queryParams
combinedQueryParams() {
let timeParams = {};
if (this.dateFilterType && this.dateFilter) {
timeParams["begin" + this.dateFilterType] = this.dateFilter[0];
timeParams["end" + this.dateFilterType] = this.dateFilter[1];
}
let queryParams = Object.assign({}, this.queryParams, timeParams);
return queryParams;
},
},
activated(){
this.getList()
activated() {
this.getList();
},
created() {
this.getList();
getProductAttrList().then(res => this.productAttrList = res.data)
getWarehouseList().then(res => this.warehouseList = res.data)
getProductAttrList().then((res) => (this.productAttrList = res.data));
getWarehouseList().then((res) => (this.warehouseList = res.data));
getCurrencyPage(this.params).then(res => this.currencyList = res.data.list)
getChannelList().then(res => this.channelList = res.data)
getCurrencyPage(this.params).then(
(res) => (this.currencyList = res.data.list)
);
getChannelList().then((res) => (this.channelList = res.data));
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
const query = {...this.combinedQueryParams}
if(query.packageTypeArr && query.packageTypeArr.length){
query.packageType = query.packageTypeArr.join(',')
const query = { ...this.combinedQueryParams };
if (query.packageTypeArr && query.packageTypeArr.length) {
query.packageType = query.packageTypeArr.join(",");
}
// 执行查询
canShipmentPage(query).then(response => {
canShipmentPage(query).then((response) => {
// 部分情况下,订单后面的操作下拉菜单会显示按钮,但是下来没有选项,在elTable组件更新的时候会导致渲染错误,所以要在更新渲染前清空一次list让table彻底重新渲染,避免部分更新导致异常
this.list = []
this.list = [];
this.$nextTick(() => {
this.list = response.data.list
})
this.list = response.data.list;
});
this.total = response.data.total;
this.loading = false;
});
......@@ -334,83 +581,98 @@ export default {
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.page = 1;
this.$nextTick(this.getList)
this.$nextTick(this.getList);
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams = {
page: 1,
rows: 10
}
this.dateFilter = []
rows: 10,
};
this.dateFilter = [];
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.$router.push('create')
this.$router.push("create");
},
/** 修改按钮操作 */
handleUpdate(row) {
this.$router.push('edit?id=' + row.orderId)
this.$router.push("edit?id=" + row.orderId);
},
// 表格多选
handleSelectionChange(selection) {
this.multipleSelection = selection
this.ids = selection.map(item => item.orderId)
this.single = selection.length !== 1
this.multiple = !selection.length
this.multipleSelection = selection;
this.ids = selection.map((item) => item.orderId);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
// 导出
exportXls(params){
this.exporting = true
const exportParams = Array.isArray(params) ? {orderIdList: params} : {...params}
exportCanShipment(exportParams).then(res => {
// this.$download.excel(res, this.$t('备货订单') + '.xls');
this.$message.success(this.$t('已加入导出队列,请稍后在下载日志中下载'))
}).finally(() => {
this.exporting = false
})
exportXls(params) {
this.exporting = true;
const exportParams = Array.isArray(params)
? { orderIdList: params }
: { ...params };
exportCanShipment(exportParams)
.then((res) => {
// this.$download.excel(res, this.$t('备货订单') + '.xls');
this.$message.success(
this.$t("已加入导出队列,请稍后在下载日志中下载")
);
})
.finally(() => {
this.exporting = false;
});
},
// 特需标识处理
specialRendering(val){
console.log('val', val)
if(val !== undefined){
let i = val.split(',')
return this.getDictDatas(this.DICT_TYPE.ORDER_SPECIAL_NEEDS).filter(e => {
return i.indexOf(e.value) > -1
}).map(item => {
// 打字开头的用最后一个字,否则取第一个字
item.symbol = item.label[0] == '' ? item.label[item.label.length-1]: item.label[0]
return item
})
specialRendering(val) {
console.log("val", val);
if (val !== undefined) {
let i = val.split(",");
return this.getDictDatas(this.DICT_TYPE.ORDER_SPECIAL_NEEDS)
.filter((e) => {
return i.indexOf(e.value) > -1;
})
.map((item) => {
// 打字开头的用最后一个字,否则取第一个字
item.symbol =
item.label[0] == ""
? item.label[item.label.length - 1]
: item.label[0];
return item;
});
}
},
// 删除特需
deleteSpecial(id,orderId){
this.$confirm(this.$t('确定删除此特需么?')).then(() => {
return orderSpecialNeed({orderId:orderId,advanceType:id})
}).then(() => {
this.getList()
})
deleteSpecial(id, orderId) {
this.$confirm(this.$t("确定删除此特需么?"))
.then(() => {
return orderSpecialNeed({ orderId: orderId, advanceType: id });
})
.then(() => {
this.getList();
});
},
// 设置空运订单不可出
async setCanNotShipment(order){
await this.$confirm(this.$t("确定设置订单{orderNo}不可出么?", {orderNo: order.orderNo}))
setCanNotShipment(order.orderId).then(res => {
this.$message(this.$t('操作成功'))
this.getList()
})
}
}
async setCanNotShipment(order) {
await this.$confirm(
this.$t("确定设置订单{orderNo}不可出么?", { orderNo: order.orderNo })
);
setCanNotShipment(order.orderId).then((res) => {
this.$message(this.$t("操作成功"));
this.getList();
});
},
},
};
</script>
<style lang="scss" scoped>
::v-deep .actions{
.el-dropdown{
margin-right: 10px;
&:last-child {
margin-right: 0;
}
::v-deep .actions {
.el-dropdown {
margin-right: 10px;
&:last-child {
margin-right: 0;
}
}
}
</style>
......@@ -293,6 +293,7 @@
}}</el-button>
</div>
</el-dialog>
<!--转异对话框 lanbm 2024-06-19 添加注释-->
<el-dialog
:title="order.orderNo + $t('订单转异')"
center
......
<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="productCode">
<el-input v-model.trim="queryParams.productCode" :placeholder="$t('请输入商品编码')" clearable @keyup.enter.native="handleQuery" onkeyup="this.value=this.value.replace(/(^\s*)|(\s*$)/g,'')" />
<el-input
v-model.trim="queryParams.productCode"
:placeholder="$t('请输入商品编码')"
clearable
@keyup.enter.native="handleQuery"
onkeyup="this.value=this.value.replace(/(^\s*)|(\s*$)/g,'')"
/>
</el-form-item>
<el-form-item :label="$t('海关编码')" prop="customsCode">
<el-input v-model.trim="queryParams.customsCode" :placeholder="$t('请输入海关编码')" clearable @keyup.enter.native="handleQuery" onkeyup="this.value=this.value.replace(/(^\s*)|(\s*$)/g,'')"/>
<el-input
v-model.trim="queryParams.customsCode"
:placeholder="$t('请输入海关编码')"
clearable
@keyup.enter.native="handleQuery"
onkeyup="this.value=this.value.replace(/(^\s*)|(\s*$)/g,'')"
/>
</el-form-item>
<el-form-item :label="$t('商品名称')" prop="titleZh">
<el-input v-model="queryParams.titleZh" :placeholder="$t('请输入商品名称')" clearable @keyup.enter.native="handleQuery" />
<el-input
v-model="queryParams.titleZh"
:placeholder="$t('请输入商品名称')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item :label="$t('商品类型')" prop="attrId">
<el-select v-model="queryParams.typeId" multiple :placeholder="$t('选择商品类型')" clearable @change="handleQuery">
<el-option v-for="types in typeList" :key="types.id" :label="$l(types, 'title')" :value="types.id" />
<el-select
v-model="queryParams.typeId"
multiple
:placeholder="$t('选择商品类型')"
clearable
@change="handleQuery"
>
<el-option
v-for="types in typeList"
:key="types.id"
:label="$l(types, 'title')"
:value="types.id"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('商品特性')" prop="attrId">
<el-select v-model="queryParams.attrId" multiple :placeholder="$t('选择商品特性')" clearable @change="handleQuery">
<el-option v-for="attr in attrList" :key="attr.id" :label="attr.attrName" :value="attr.id" />
<el-select
v-model="queryParams.attrId"
multiple
:placeholder="$t('选择商品特性')"
clearable
@change="handleQuery"
>
<el-option
v-for="attr in attrList"
:key="attr.id"
:label="attr.attrName"
:value="attr.id"
/>
</el-select>
</el-form-item>
......@@ -39,29 +85,65 @@
</el-form-item> -->
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">{{$t('搜索')}}</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">{{$t('重置')}}</el-button>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">{{
$t("搜索")
}}</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">{{
$t("重置")
}}</el-button>
</el-form-item>
</el-form>
<!-- 操作工具栏 -->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['ecw:product:create']">{{$t('新增')}}</el-button>
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['ecw:product:create']"
>{{ $t("新增") }}</el-button
>
</el-col>
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-setting" size="mini" @click="handleEdit" v-hasPermi="['ecw:product:attr']">{{$t('批量设置商品属性')}}</el-button>
<el-button
type="primary"
plain
icon="el-icon-setting"
size="mini"
@click="handleEdit"
v-hasPermi="['ecw:product:attr']"
>{{ $t("批量设置商品属性") }}</el-button
>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['ecw:product-price:export']" :loading="exportLoading" >{{$t('导出')}}</el-button>
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['ecw:product-price:export']"
:loading="exportLoading"
>{{ $t("导出") }}</el-button
>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
<el-table
v-loading="loading"
:data="list"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center">
</el-table-column>
<el-table-column :label="$t('商品编号')" align="center" prop="id" />
......@@ -70,7 +152,11 @@
<span>{{ getTypeName(scope.row.typeId) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('海关编码')" align="center" prop="customsCode" />
<el-table-column
:label="$t('海关编码')"
align="center"
prop="customsCode"
/>
<el-table-column :label="$t('中文标题')" align="center" prop="titleZh" />
<el-table-column :label="$t('英文标题')" align="center" prop="titleEn" />
<el-table-column :label="$t('商品属性')" align="center" prop="attrId">
......@@ -81,31 +167,56 @@
<!--商品特性-->
<el-table-column :label="$t('商品图片')" align="center" prop="attrId">
<template slot-scope="scope">
<el-image :src="firstImg(scope.row.imgs)" style="width:50px; height:50px">{{ $t('') }}</el-image>
<el-image
:src="firstImg(scope.row.imgs)"
style="width: 50px; height: 50px"
>{{ $t("") }}</el-image
>
</template>
</el-table-column>
<el-table-column prop="auditStatus" align="center" :label="$t('是否审核')" width="120">
<el-table-column
prop="auditStatus"
align="center"
:label="$t('是否审核')"
width="120"
>
<template slot-scope="scope">
<el-select v-model="scope.row.auditStatus" @change="handleStatusChange(scope.row, 'auditStatus')">
<el-option v-for="auditStatusItem in auditStatusDictDatas" :key="auditStatusItem.id" :label="$l(auditStatusItem, 'label')" :value="parseInt(auditStatusItem.value)" />
<el-select
v-model="scope.row.auditStatus"
@change="handleStatusChange(scope.row, 'auditStatus')"
>
<el-option
v-for="auditStatusItem in auditStatusDictDatas"
:key="auditStatusItem.id"
:label="$l(auditStatusItem, 'label')"
:value="parseInt(auditStatusItem.value)"
/>
</el-select>
</template>
</el-table-column>
<el-table-column :label="$t('添加人')" align="center" prop="creatorName" />
<el-table-column
:label="$t('添加人')"
align="center"
prop="creatorName"
/>
<el-table-column :label="$t('添加时间')" align="center">
<template slot-scope="scope">
<span>{{parseTime(scope.row.createTime)}}</span>
</template>
</el-table-column>
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('修改人')" align="center" prop="updaterName" />
<el-table-column
:label="$t('修改人')"
align="center"
prop="updaterName"
/>
<el-table-column :label="$t('修改时间')" align="center">
<template slot-scope="scope">
<span>{{parseTime(scope.row.updateTime)}}</span>
<span>{{ parseTime(scope.row.updateTime) }}</span>
</template>
</el-table-column>
......@@ -115,25 +226,54 @@
</template>
</el-table-column> -->
<el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" @click="toPriceManager(scope.row)" v-hasPermi="['ecw:product-price:query']">{{$t('路线价格')}}</el-button>
<el-table-column
:label="$t('操作')"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="toPriceManager(scope.row)"
v-hasPermi="['ecw:product-price:query']"
>{{ $t("路线价格") }}</el-button
>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['ecw:product:update']">{{$t('修改')}}</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['ecw:product:delete']">{{$t('删除')}}</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['ecw:product:update']"
>{{ $t("修改") }}</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['ecw:product:delete']"
>{{ $t("删除") }}</el-button
>
<!--要有价格复制权限 lanbm 2024-06-19 添加注释-->
<el-button
v-if="scope.row.auditStatus === 2"
size="mini"
type="text"
icon="el-icon-edit"
@click="copyPrice(scope.row)"
v-hasPermi="['ecw:product:copyPrice']"
>{{ $t("复制价格") }}</el-button
>
<el-button v-if="scope.row.auditStatus===2" size="mini" type="text" icon="el-icon-edit" @click="copyPrice(scope.row)" v-hasPermi="['ecw:product:copyPrice']">{{$t('复制价格')}}</el-button>
<!-- <div v-else>
<!-- <div v-else>
<el-button size="mini" type="text" @click="toPriceManager(scope.row)" v-hasPermi="['ecw:product-price:query']">{{$t('路线价格')}}</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['ecw:product:update']">{{$t('修改')}}</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['ecw:product:delete']">{{$t('删除')}}</el-button>
</div> -->
<!-- <el-button v-else size="mini" type="text" icon="el-icon-edit" @click="copyPrice(scope.row)" v-hasPermi="['ecw:product:copyPrice']">{{$t('复制价格')}}</el-button> -->
</template>
<!-- <template v-else>
<el-button size="mini" type="text" @click="toPriceManager(scope.row)" v-hasPermi="['ecw:product-price:query']">{{$t('路线价格')}}</el-button>
......@@ -146,23 +286,56 @@
</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"
/>
<!-- 对话框(添加 / 修改) -->
<el-dialog :modal="false" :modal-append-to-body="true" :title="title" :visible.sync="open" width="850px" >
<el-form v-if="open" ref="form" :model="form" :rules="rules" label-width="110px">
<el-dialog
:modal="false"
:modal-append-to-body="true"
:title="title"
:visible.sync="open"
width="850px"
>
<el-form
v-if="open"
ref="form"
:model="form"
:rules="rules"
label-width="110px"
>
<el-form-item :label="$t('商品类型')" prop="typeId">
<el-select v-model="form.typeId" :placeholder="$t('选择商品类型')" clearable>
<el-option v-for="types in typeList" :key="types.id" :label="types.titleZh" :value="types.id" />
<el-select
v-model="form.typeId"
:placeholder="$t('选择商品类型')"
clearable
>
<el-option
v-for="types in typeList"
:key="types.id"
:label="types.titleZh"
:value="types.id"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('中文标题')" prop="titleZh">
<el-input v-model="form.titleZh" :placeholder="$t('请输入中文标题')" />
<el-input
v-model="form.titleZh"
:placeholder="$t('请输入中文标题')"
/>
</el-form-item>
<el-form-item :label="$t('英文标题')" prop="titleEn">
<el-input v-model="form.titleEn" :placeholder="$t('请输入英文标题')" />
<el-input
v-model="form.titleEn"
:placeholder="$t('请输入英文标题')"
/>
</el-form-item>
<el-form-item :label="$t('商品图片')" prop="img">
......@@ -172,43 +345,97 @@
<el-form-item prop="auditStatus" :label="$t('是否审核')">
<template slot-scope="scope">
<el-select v-model="form.auditStatus">
<el-option v-for="auditStatusItem in auditStatusDictDatas" :key="auditStatusItem.id" :label="$l(auditStatusItem, 'label')" :value="parseInt(auditStatusItem.value)" />
<el-option
v-for="auditStatusItem in auditStatusDictDatas"
:key="auditStatusItem.id"
:label="$l(auditStatusItem, 'label')"
:value="parseInt(auditStatusItem.value)"
/>
</el-select>
</template>
</el-form-item>
<el-form-item :label="$t('商品编码')" prop="productCode">
<el-input v-model="form.productCode" :placeholder="$t('请输入商品编码')" />
<el-input
v-model="form.productCode"
:placeholder="$t('请输入商品编码')"
/>
</el-form-item>
<el-form-item :label="$t('海关编码')" prop="customsCode">
<el-input v-model="form.customsCode" :placeholder="$t('请输入海关编码')" />
<el-input
v-model="form.customsCode"
:placeholder="$t('请输入海关编码')"
/>
</el-form-item>
<el-form-item :label="$t('商品特性')" prop="attrArray">
<el-select v-model="form.attrArray" :placeholder="$t('选择商品特性')" clearable multiple>
<el-option v-for="attr in attrList" :key="attr.id" :label="attr.attrName" :value="attr.id" />
<el-select
v-model="form.attrArray"
:placeholder="$t('选择商品特性')"
clearable
multiple
>
<el-option
v-for="attr in attrList"
:key="attr.id"
:label="attr.attrName"
:value="attr.id"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('商品材质')" prop="materialType">
<el-select v-model="form.materialType" :placeholder="$t('选择商品材质')" clearable>
<el-option v-for="materialItem in materialList" :key="materialItem.value" :label="materialItem.label" :value="materialItem.value" />
<el-select
v-model="form.materialType"
:placeholder="$t('选择商品材质')"
clearable
>
<el-option
v-for="materialItem in materialList"
:key="materialItem.value"
:label="materialItem.label"
:value="materialItem.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('出运要求')" prop="requirements">
<el-checkbox v-model="form.requirements" :checked="form.requirements===1? true:false" :true-label="1" :false-label="0">{{$t('证书要求')}}({{$t('支持多证书')}})</el-checkbox>
<el-checkbox
v-model="form.requirements"
:checked="form.requirements === 1 ? true : false"
:true-label="1"
:false-label="0"
>{{ $t("证书要求") }}({{ $t("支持多证书") }})</el-checkbox
>
</el-form-item>
<el-form-item :label="$t('包装要求')" prop="packaging">
<el-select v-model="form.packaging" :placeholder="$t('选择包装要求')" clearable>
<el-option v-for="packageItem in packagingList" :key="packageItem.value" :label="packageItem.label" :value="packageItem.value" />
<el-select
v-model="form.packaging"
:placeholder="$t('选择包装要求')"
clearable
>
<el-option
v-for="packageItem in packagingList"
:key="packageItem.value"
:label="packageItem.label"
:value="packageItem.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('默认货柜位置')" prop="containerLocation">
<el-select v-model="form.containerLocation" :placeholder="$t('选择货柜位置')" clearable>
<el-option v-for="locationItem in locationList" :key="locationItem.value" :label="locationItem.label" :value="locationItem.value" />
<el-select
v-model="form.containerLocation"
:placeholder="$t('选择货柜位置')"
clearable
>
<el-option
v-for="locationItem in locationList"
:key="locationItem.value"
:label="locationItem.label"
:value="locationItem.value"
/>
</el-select>
</el-form-item>
......@@ -218,54 +445,92 @@
</el-input>
</el-form-item>
<el-form-item :label="$t('是否预约入仓')" prop="needBook">
<el-radio v-model.number="form.needBook" :label="1">{{$t('是')}}</el-radio>
<el-radio v-model.number="form.needBook" :label="0">{{$t('否')}}</el-radio>
<el-radio v-model.number="form.needBook" :label="1">{{
$t("是")
}}</el-radio>
<el-radio v-model.number="form.needBook" :label="0">{{
$t("否")
}}</el-radio>
</el-form-item>
<!-- <el-form-item :label="$t('可参与优惠活动')" prop="you">
<el-select v-model="form.you" :placeholder="$t('可参与优惠活动')" clearable>
<el-option v-for="packageItem in packagingList" :key="packageItem.value" :label="packageItem.label" :value="packageItem.value" />
</el-select>
</el-form-item> -->
<el-form-item :label="$t('每日入仓上限')" prop="dayLimit" v-if="form.needBook==1">
<el-form-item
:label="$t('每日入仓上限')"
prop="dayLimit"
v-if="form.needBook == 1"
>
<el-input v-model.number="form.dayLimit" type="number">
<template slot="append">{{$t('立方米')}}</template>
<template slot="append">{{ $t("立方米") }}</template>
</el-input>
</el-form-item>
<el-form-item :label="$t('可参与优惠')">
<div style="width: 300px;height: 400px;border: 1px solid;overflow-y: auto">
<div @click="selectMoveAbout(item)" style="display: flex;justify-content: space-between; align-items: center;" :style="{'cursor':item.mandatory ? 'no-drop' : 'pointer' }" v-for="item in preferentialList" :key="item.couponId" >
<el-form-item :label="$t('可参与优惠')">
<div
style="
width: 300px;
height: 400px;
border: 1px solid;
overflow-y: auto;
"
>
<div
@click="selectMoveAbout(item)"
style="
display: flex;
justify-content: space-between;
align-items: center;
"
:style="{ cursor: item.mandatory ? 'no-drop' : 'pointer' }"
v-for="item in preferentialList"
:key="item.couponId"
>
<div>
{{$l(item, 'title')}}
{{ $l(item, "title") }}
</div>
<i v-if="form.couponIds.includes(item.couponId)" style="margin-right: 20px;" class="el-icon-check"></i>
<i
v-if="form.couponIds.includes(item.couponId)"
style="margin-right: 20px"
class="el-icon-check"
></i>
</div>
</div>
</el-form-item>
<!-- <el-form-item label-width="150px" label="空运订单重量上限kg">-->
<!-- <el-input-number v-model="form.airWeightLimit" controls-position="right" ></el-input-number>-->
<!-- </el-form-item>-->
<!-- <packaging-type key-arr="priceStepClearanceList" v-model="form">-->
<!-- <el-button @click="visible = true; open = false;" type="text">选择空运模板</el-button>-->
<!-- </packaging-type>-->
<!-- <p v-if="lineNum">-->
<!-- <span>-->
<!-- 复制模板线路价格:{{lineNum}}个-->
<!-- </span>-->
<!-- <span @click="toPriceManager(formCopy, true)" style="color: #0a84ff;cursor: pointer;">-->
<!-- 查看《#{{$l(formCopy,'title')}}#》路线价格-->
<!-- </span>-->
<!-- <el-button style="font-size: 12px;margin-left: 15px;color: red;" type="text" @click="form.priceStepClearanceList = [];lineNum = 0" >清除路线</el-button>-->
<!-- </p>-->
<!-- <el-form-item label-width="150px" label="空运订单重量上限kg">-->
<!-- <el-input-number v-model="form.airWeightLimit" controls-position="right" ></el-input-number>-->
<!-- </el-form-item>-->
<!-- <packaging-type key-arr="priceStepClearanceList" v-model="form">-->
<!-- <el-button @click="visible = true; open = false;" type="text">选择空运模板</el-button>-->
<!-- </packaging-type>-->
<!-- <p v-if="lineNum">-->
<!-- <span>-->
<!-- 复制模板线路价格:{{lineNum}}个-->
<!-- </span>-->
<!-- <span @click="toPriceManager(formCopy, true)" style="color: #0a84ff;cursor: pointer;">-->
<!-- 查看《#{{$l(formCopy,'title')}}#》路线价格-->
<!-- </span>-->
<!-- <el-button style="font-size: 12px;margin-left: 15px;color: red;" type="text" @click="form.priceStepClearanceList = [];lineNum = 0" >清除路线</el-button>-->
<!-- </p>-->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">{{$t('确定')}}</el-button>
<el-button @click="cancel">{{$t('取消')}}</el-button>
<el-button type="primary" @click="submitForm">{{
$t("确定")
}}</el-button>
<el-button @click="cancel">{{ $t("取消") }}</el-button>
</div>
</el-dialog>
<el-dialog width="60%" :visible.sync="visible" @close="()=>{open = true}" >
<el-dialog
width="60%"
:visible.sync="visible"
@close="
() => {
open = true;
}
"
>
<product-dialog @copyLine="copyLine"></product-dialog>
</el-dialog>
</div>
......@@ -279,14 +544,14 @@ import {
getProduct,
getProductPage,
product_coupon_newProd,
updateProduct
updateProduct,
} from "@/api/ecw/product";
import {getProductAttrList} from "@/api/ecw/productAttr";
import {getProductTypeList} from "@/api/ecw/productType";
import {DICT_TYPE, getDictDatas} from '@/utils/dict';
import {AuditStatusEnum, CommonStatusEnum} from '@/utils/constants';
import {uploadFile} from "@/api/infra/file";
import ImageUpload from '@/components/ImageUpload'
import { getProductAttrList } from "@/api/ecw/productAttr";
import { getProductTypeList } from "@/api/ecw/productType";
import { DICT_TYPE, getDictDatas } from "@/utils/dict";
import { AuditStatusEnum, CommonStatusEnum } from "@/utils/constants";
import { uploadFile } from "@/api/infra/file";
import ImageUpload from "@/components/ImageUpload";
import PackagingType from "@/views/ecw/channel/componrnts/packaging-type.vue";
import ProductDialog from "@/views/ecw/product/product-dialog.vue";
......@@ -295,11 +560,11 @@ export default {
components: {
ProductDialog,
PackagingType,
ImageUpload
ImageUpload,
},
data() {
return {
visible:false,
visible: false,
// 选中数组
ids: [],
// 非单个禁用
......@@ -344,16 +609,38 @@ export default {
status: null,
},
// 表单参数
form: {
},
formCopy:{},
form: {},
formCopy: {},
// 表单校验
rules: {
typeId: [{ required: true, message: this.$t("商品类型不能为空"), trigger: "change" }],
attrArray: [{ required: true, message: this.$t("商品特性不能为空"), trigger: "change" }],
titleZh: [{ required: true, message: this.$t("中文标题不能为空"), trigger: "blur" }],
titleEn: [{ required: true, message: this.$t("英文标题不能为空"), trigger: "blur" }],
typeId: [
{
required: true,
message: this.$t("商品类型不能为空"),
trigger: "change",
},
],
attrArray: [
{
required: true,
message: this.$t("商品特性不能为空"),
trigger: "change",
},
],
titleZh: [
{
required: true,
message: this.$t("中文标题不能为空"),
trigger: "blur",
},
],
titleEn: [
{
required: true,
message: this.$t("英文标题不能为空"),
trigger: "blur",
},
],
// materialType: [{ required: true, message: this.$t("商品材质不能为空"), trigger: "blur" }],
// packaging: [{ required: true, message: this.$t("包装要求不能为空"), trigger: "blur" }],
// containerLocation: [{ required: true, message: this.$t("默认货柜位置不能为空"), trigger: "blur" }],
......@@ -368,65 +655,65 @@ export default {
materialList: getDictDatas(DICT_TYPE.ECW_PRODUCT_MATERIAL),
packagingList: getDictDatas(DICT_TYPE.ECW_PACKAGING_TYPE),
locationList: getDictDatas(DICT_TYPE.ECW_CONTAINER_LOCATION),
preferentialList:[],
exceptionProductId:0,//新增商品异常传的id
lineNum:0
preferentialList: [],
exceptionProductId: 0, //新增商品异常传的id
lineNum: 0,
};
},
computed: {
getTypeName() {
return typeId => {
return (typeId) => {
for (let index in this.typeList) {
let typeItem = this.typeList[index];
if (typeItem.id == typeId) {
return this.$l(typeItem, 'title');
return this.$l(typeItem, "title");
}
}
}
};
},
getAttrName() {
return attrIds => {
return (attrIds) => {
let productAttrArray = [];
let attrArray = attrIds.split(',');
let attrArray = attrIds.split(",");
for (let attrIndex in attrArray) {
let attrId = attrArray[attrIndex];
for (let index in this.attrList) {
let attrItem = this.attrList[index];
if (attrItem.id == attrId) {
productAttrArray.push(this.$l(attrItem, 'attrName'));
productAttrArray.push(this.$l(attrItem, "attrName"));
}
}
}
return productAttrArray.join(',');
}
return productAttrArray.join(",");
};
},
firstImg() {
return (imgString) => {
if (!imgString || imgString == "") return imgString;
let imgs = imgString.split(",");
return imgs.length ? imgs[0] : null;
};
},
firstImg(){
return imgString => {
if(!imgString || imgString == '') return imgString
let imgs = imgString.split(',')
return imgs.length ? imgs[0] : null
}
}
},
activated(){
if(this.$route.query.typeId != this.queryParams.typeId){
this.queryParams.typeId = +this.$route.query.typeId || null
activated() {
if (this.$route.query.typeId != this.queryParams.typeId) {
this.queryParams.typeId = +this.$route.query.typeId || null;
}
//新增商品异常跳转商品修改
if(this.$route.query.prodId){
this.exceptionProductId = this.$route.query.prodId
this.handleUpdate({id:this.$route.query.prodId})
if (this.$route.query.prodId) {
this.exceptionProductId = this.$route.query.prodId;
this.handleUpdate({ id: this.$route.query.prodId });
}
this.getList()
this.getList();
},
created() {
//新增商品异常跳转商品修改
if(this.$route.query.prodId){
this.exceptionProductId = this.$route.query.prodId
this.handleUpdate({id:this.$route.query.prodId})
if (this.$route.query.prodId) {
this.exceptionProductId = this.$route.query.prodId;
this.handleUpdate({ id: this.$route.query.prodId });
}
let typeId = this.$route.query.typeId;
if (typeId) {
......@@ -435,7 +722,6 @@ export default {
this.getAttrList();
this.getTypeList();
this.getList();
},
methods: {
// copyLine(val , bol){
......@@ -493,56 +779,66 @@ export default {
// },
/** 获取产品属性列表 */
getAttrList() {
getProductAttrList().then(response => {
getProductAttrList().then((response) => {
this.attrList = response.data;
})
});
},
/** 获取产品类型列表 */
getTypeList() {
getProductTypeList().then(response => {
getProductTypeList().then((response) => {
this.typeList = response.data;
})
});
},
/**跳转价格管理 */
toPriceManager(row, flag = false) {
/* localStorage.setItem('product', JSON.stringify(row));
localStorage.setItem('typeList', JSON.stringify(this.typeList)); */
let p
if (flag){
let p;
if (flag) {
p = {
product_id: row.id,
product_type: row.typeId,
transportType:3,
}
}else {
transportType: 3,
};
} else {
p = {
product_id: row.id,
product_type: row.typeId,
}
};
}
this.$router.push({
name: 'ProductPrice',
query: p
})
name: "ProductPrice",
query: p,
});
},
handleStatusChange(row, statusType) {
updateProduct(row).then(() => {
this.$modal.msgSuccess(this.$t("修改成功"));
}).catch(function () {
if (statusType == 'status') {
row.status = row.status === CommonStatusEnum.ENABLE ? CommonStatusEnum.DISABLE : CommonStatusEnum.ENABLE;
} else {
row.auditStatus = row.auditStatus === AuditStatusEnum.PASS ? AuditStatusEnum.NOT_PASS : AuditStatusEnum.PASS;
}
});
updateProduct(row)
.then(() => {
this.$modal.msgSuccess(this.$t("修改成功"));
})
.catch(function () {
if (statusType == "status") {
row.status =
row.status === CommonStatusEnum.ENABLE
? CommonStatusEnum.DISABLE
: CommonStatusEnum.ENABLE;
} else {
row.auditStatus =
row.auditStatus === AuditStatusEnum.PASS
? AuditStatusEnum.NOT_PASS
: AuditStatusEnum.PASS;
}
});
},
//复制价格
copyPrice(row){
this.$router.push({path:'/product/copyPrice',query:{titleZh:row.titleZh,id:row.id}})
copyPrice(row) {
this.$router.push({
path: "/product/copyPrice",
query: { titleZh: row.titleZh, id: row.id },
});
},
/** 查询列表 */
......@@ -550,11 +846,11 @@ export default {
this.loading = true;
// 处理查询参数
let params = { ...this.queryParams };
params.filter=false;
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
params.filter = false;
this.addBeginAndEndTime(params, this.dateRangeCreateTime, "createTime");
// 执行查询
params.status = 0;
getProductPage(params).then(response => {
params.status = 0;
getProductPage(params).then((response) => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
......@@ -578,14 +874,13 @@ export default {
status: undefined,
requirements: 0,
needBook: 0,
couponIds:[],
airWeightLimit:undefined,
priceStepClearanceList:[],
isCopyProductPriceTemplate:false,
productTemplateId:undefined,
couponIds: [],
airWeightLimit: undefined,
priceStepClearanceList: [],
isCopyProductPriceTemplate: false,
productTemplateId: undefined,
};
this.lineNum = 0
this.lineNum = 0;
this.resetForm("form");
},
/** 搜索按钮操作 */
......@@ -604,10 +899,12 @@ export default {
this.reset();
this.open = true;
this.title = this.$t("添加商品");
product_coupon_newProd().then(r => {
this.preferentialList = r.data
this.form.couponIds = this.preferentialList.filter(i => i.isDefault).map(i => i.couponId)
})
product_coupon_newProd().then((r) => {
this.preferentialList = r.data;
this.form.couponIds = this.preferentialList
.filter((i) => i.isDefault)
.map((i) => i.couponId);
});
if (this.queryParams.typeId) {
this.form.typeId = this.queryParams.typeId;
}
......@@ -617,33 +914,41 @@ export default {
// this.reset();
console.log(row);
const id = row.id;
getProduct(id).then(response => {
this.form = {...response.data,couponIds:[]};
this.form.channelPriceStepClearanceList = this.form.priceStepClearanceList;
let attrArray = this.form.attrId?this.form.attrId.split(','):[];
getProduct(id).then((response) => {
this.form = { ...response.data, couponIds: [] };
this.form.channelPriceStepClearanceList =
this.form.priceStepClearanceList;
let attrArray = this.form.attrId ? this.form.attrId.split(",") : [];
for (let index in attrArray) {
let value = attrArray[index];
attrArray[index] = parseInt(value);
}
this.$nextTick(() =>{
this.$set(this.form, 'attrArray', attrArray)
})
this.$nextTick(() => {
this.$set(this.form, "attrArray", attrArray);
});
this.open = true;
this.title = this.$t("修改商品");
product_coupon_newProd({prodId:id}).then(r => {
this.preferentialList = r.data
this.form.couponIds = this.preferentialList.filter(i => i.isDefault).map(i => i.couponId)
product_coupon_newProd({ prodId: id }).then((r) => {
this.preferentialList = r.data;
this.form.couponIds = this.preferentialList
.filter((i) => i.isDefault)
.map((i) => i.couponId);
// this.reset()
})
});
});
},
verify(row){
return (row.startNum !== '' && row.endNum !== '' && row.clearancePrice !== '' && row.clearancePriceUnit !== '' && row.clearanceVolumeUnit !== '')
},
verify(row) {
return (
row.startNum !== "" &&
row.endNum !== "" &&
row.clearancePrice !== "" &&
row.clearancePriceUnit !== "" &&
row.clearanceVolumeUnit !== ""
);
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
this.$refs["form"].validate((valid) => {
if (!valid) {
return;
}
......@@ -660,48 +965,52 @@ export default {
//
// }
//商品特性转字符串
this.form.attrId = this.form.attrArray.join(',');
this.form.attrId = this.form.attrArray.join(",");
// 修改的提交
if (this.form.id != null) {
this.form.priceStepClearanceList.forEach(i =>{
i.productId = this.form.id
})
if(this.exceptionProductId){
this.form.productId = this.exceptionProductId
this.form.status = 0
}else {
this.form.productId = this.form.id
this.form.priceStepClearanceList.forEach((i) => {
i.productId = this.form.id;
});
if (this.exceptionProductId) {
this.form.productId = this.exceptionProductId;
this.form.status = 0;
} else {
this.form.productId = this.form.id;
}
updateProduct(this.form).then(response => {
updateProduct(this.form).then((response) => {
this.$modal.msgSuccess(this.$t("修改成功"));
this.open = false;
if(this.exceptionProductId){
this.exceptionProductId = null
this.$router.replace({ path: '/product/product-list'})
}
if (this.exceptionProductId) {
this.exceptionProductId = null;
this.$router.replace({ path: "/product/product-list" });
}
this.getList();
this.lineNum = 0
this.lineNum = 0;
});
return;
}
// 添加的提交
createProduct(this.form).then(response => {
createProduct(this.form).then((response) => {
this.$modal.msgSuccess(this.$t("新增成功"));
this.open = false;
this.getList();
this.lineNum = 0
this.lineNum = 0;
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm(this.$t('是否确认删除商品编号为{id}的数据项?', {id})).then(function () {
return deleteProduct(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess(this.$t("删除成功"));
}).catch(() => { });
this.$modal
.confirm(this.$t("是否确认删除商品编号为{id}的数据项?", { id }))
.then(function () {
return deleteProduct(id);
})
.then(() => {
this.getList();
this.$modal.msgSuccess(this.$t("删除成功"));
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
......@@ -709,30 +1018,38 @@ export default {
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
this.addBeginAndEndTime(params, this.dateRangeCreateTime, "createTime");
// 执行导出
this.$modal.confirm(this.$t('是否确认导出所有商品数据项?')).then(() => {
this.exportLoading = true;
return exportProductExcel(params);
}).then(response => {
// this.$download.excel(response, '商品.xlsx');
this.$message.success(this.$t('已加入导出队列,请稍后在下载日志中下载'))
this.exportLoading = false;
}).catch(() => { });
this.$modal
.confirm(this.$t("是否确认导出所有商品数据项?"))
.then(() => {
this.exportLoading = true;
return exportProductExcel(params);
})
.then((response) => {
// this.$download.excel(response, '商品.xlsx');
this.$message.success(
this.$t("已加入导出队列,请稍后在下载日志中下载")
);
this.exportLoading = false;
})
.catch(() => {});
},
// 上传预处理
beforeUpload(file) {
if (file.type.indexOf("image/") == -1) {
this.$modal.msgError(this.$t("文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。"));
this.$modal.msgError(
this.$t("文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。")
);
} else {
//上传
let formData = new FormData();
formData.append("file", file);
// formData.append("path", this.uuid());
uploadFile(formData).then(response => {
this.$set(this.form, 'imgs', response.data);
uploadFile(formData).then((response) => {
this.$set(this.form, "imgs", response.data);
// this.form.img = response.data;
})
});
}
},
......@@ -751,51 +1068,62 @@ export default {
},
// 表格多选
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
this.ids = selection.map((item) => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
// 批量设置商品属性
handleEdit() {
this.$router.push({
path: "product-attr/edit",
query: {
ids: this.ids
}
ids: this.ids,
},
});
},
selectMoveAbout(val){
if(!val.mandatory){
let index = this.form.couponIds.findIndex(i => val.couponId == i)
if(index >= 0){
this.$confirm(this.$t(`您确定要将商品从优惠活动${this.$l(val,'title')}中移出吗?`), this.$t('提示'), {
confirmButtonText: this.$t('确定'),
cancelButtonText:this.$t('取消') ,
type: 'warning'
}).then(() => {
this.form.couponIds.splice(index,1)
this.$forceUpdate()
}).catch(() => {
});
}else {
this.$confirm(this.$t(`您确定要将商品加入到优惠活动${this.$l(val,'title')}中吗?`), this.$t('提示'), {
confirmButtonText: this.$t('确定'),
cancelButtonText:this.$t('取消') ,
type: 'warning'
}).then(() => {
this.form.couponIds.push(val.couponId)
this.$forceUpdate()
}).catch(() => {
});
selectMoveAbout(val) {
if (!val.mandatory) {
let index = this.form.couponIds.findIndex((i) => val.couponId == i);
if (index >= 0) {
this.$confirm(
this.$t(
`您确定要将商品从优惠活动${this.$l(val, "title")}中移出吗?`
),
this.$t("提示"),
{
confirmButtonText: this.$t("确定"),
cancelButtonText: this.$t("取消"),
type: "warning",
}
)
.then(() => {
this.form.couponIds.splice(index, 1);
this.$forceUpdate();
})
.catch(() => {});
} else {
this.$confirm(
this.$t(
`您确定要将商品加入到优惠活动${this.$l(val, "title")}中吗?`
),
this.$t("提示"),
{
confirmButtonText: this.$t("确定"),
cancelButtonText: this.$t("取消"),
type: "warning",
}
)
.then(() => {
this.form.couponIds.push(val.couponId);
this.$forceUpdate();
})
.catch(() => {});
}
}
}
},
},
};
</script>
<style lang="scss" scoped>
</style>
......@@ -353,6 +353,7 @@
</el-form-item>
</template>
<!--是否单询价,lanbm 2024-06-17 添加海运选中单询价不用设置价格信息逻辑 -->
<el-form-item :label="$t('是否单询')" prop="inquiry">
<dict-selector
:type="DICT_TYPE.NEED_ORDER_INQUIRY"
......@@ -361,6 +362,7 @@
formatter="number"
></dict-selector>
</el-form-item>
<!--end 是否单询价,lanbm 2024-06-17 添加海运选中单询价不用设置价格信息逻辑 -->
</el-card>
</el-form>
......@@ -931,12 +933,12 @@ export default {
if (!valid) {
return;
}
// 只有修改单条路线的时候,不需要选择路线
/* if (this.$route.query.action !== 'update' && (!this.selectedRoutes || !this.selectedRoutes.length)) {
this.$message.error('请选择线路');
return;
} */
if (
!this.lineList.length &&
(!this.selectedRoutes || !this.selectedRoutes.length)
......@@ -949,91 +951,96 @@ export default {
// specialList: this.specialProducts,
isAllProduct: 0,
});
// 阶梯价
if (this.form.stepPrice) {
let isValid = true;
for (let stepPrice of this.$refs.stepPrice) {
if (!stepPrice.validate()) {
isValid = false;
break;
}
}
if (!isValid) return;
// 全包价
if (this.form.priceType == 1) {
data.fullPriceStepList = this.getPriceList(
this.form.fullPriceStepList
);
delete data.clearancePriceStepList;
delete data.freightPriceStepList;
} else {
data.clearancePriceStepList = this.getPriceList(
this.form.clearancePriceStepList
);
data.freightPriceStepList = this.getPriceList(
this.form.freightPriceStepList
);
delete data.fullPriceStepList;
}
}
//海运非阶梯价校验
else {
// 有多个组件则表示清关费 + 运费
if (this.$refs.seaPrice?.length) {
if (this.form.needOrderInquiry == 0) {
//不是单询价才校验价格参数 lanbm 2024-06-17
// 阶梯价
if (this.form.stepPrice) {
let isValid = true;
for (let seaPrice of this.$refs.seaPrice) {
if (!seaPrice.validate()) {
for (let stepPrice of this.$refs.stepPrice) {
if (!stepPrice.validate()) {
isValid = false;
break;
}
}
if (!isValid) return;
}
// 只有一个海运费组件,全包价
else if (this.$refs.seaPrice && !this.$refs.seaPrice.validate()) {
return;
}
// 格式化
if (this.form.priceType === 1) {
data.fullPricePackagingList = this.getPackingPrice(
data.fullPricePackagingList
);
delete data.freightPricePackagingList;
delete data.clearancePricePackagingList;
} else {
data.freightPricePackagingList = this.getPackingPrice(
data.freightPricePackagingList
);
data.clearancePricePackagingList = this.getPackingPrice(
data.clearancePricePackagingList
);
delete data.fullPricePackagingList;
// 全包价
if (this.form.priceType == 1) {
data.fullPriceStepList = this.getPriceList(
this.form.fullPriceStepList
);
delete data.clearancePriceStepList;
delete data.freightPriceStepList;
} else {
data.clearancePriceStepList = this.getPriceList(
this.form.clearancePriceStepList
);
data.freightPriceStepList = this.getPriceList(
this.form.freightPriceStepList
);
delete data.fullPriceStepList;
}
}
//海运非阶梯价校验
else {
// 有多个组件则表示清关费 + 运费
if (this.$refs.seaPrice?.length) {
let isValid = true;
for (let seaPrice of this.$refs.seaPrice) {
if (!seaPrice.validate()) {
isValid = false;
break;
}
}
if (!isValid) return;
}
// 只有一个海运费组件,全包价
else if (this.$refs.seaPrice && !this.$refs.seaPrice.validate()) {
return;
}
// 删除阶梯价字段
delete data.freightPriceStepList;
delete data.fullPriceStepList;
delete data.clearancePriceStepList;
}
// 格式化
if (this.form.priceType === 1) {
data.fullPricePackagingList = this.getPackingPrice(
data.fullPricePackagingList
);
delete data.freightPricePackagingList;
delete data.clearancePricePackagingList;
} else {
data.freightPricePackagingList = this.getPackingPrice(
data.freightPricePackagingList
);
data.clearancePricePackagingList = this.getPackingPrice(
data.clearancePricePackagingList
);
delete data.fullPricePackagingList;
}
// 设置了有效期,且已过期则给提示
if (this.form.validateEndDate && force !== true) {
let validateEndDate = new Date(this.form.validateEndDate);
if (validateEndDate.getTime() < Date.now()) {
return this.$confirm(
"您设置的线路价格已过期,确定提交吗?",
"提示",
{
confirmButtonText: "确认提交",
cancelButtonText: "取消提交",
type: "warning",
}
).then((res) => {
this.submitForm(true);
});
// 删除阶梯价字段
delete data.freightPriceStepList;
delete data.fullPriceStepList;
delete data.clearancePriceStepList;
}
// 设置了有效期,且已过期则给提示
if (this.form.validateEndDate && force !== true) {
let validateEndDate = new Date(this.form.validateEndDate);
if (validateEndDate.getTime() < Date.now()) {
return this.$confirm(
"您设置的线路价格已过期,确定提交吗?",
"提示",
{
confirmButtonText: "确认提交",
cancelButtonText: "取消提交",
type: "warning",
}
).then((res) => {
this.submitForm(true);
});
}
}
}
// 修改单条路线
......
<template>
<div class="app-container">
<div class="page-title">{{$route.query.product_id ? productTitle + '-' + $t('路线价格列表') : routeName}}</div>
<div class="page-title">
{{
$route.query.product_id
? productTitle + "-" + $t("路线价格列表")
: routeName
}}
</div>
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item :label="$t('商品名称')" prop="titleZh" v-if="!$route.query.product_id">
<el-input v-model="queryParams.titleZh" :placeholder="$t('请输入中英文名称、商品编码、海关编码')" clearable @keyup.enter.native="handleQuery">
<template #prepend>
<el-select v-model="queryParams.searchType" style="width: 100px">
<el-option :value="1" :label="$t('包含')"></el-option>
<el-option :value="2" :label="$t('不包含')"></el-option>
<el-option :value="3" :label="$t('等于')"></el-option>
</el-select>
</template>
</el-input>
</el-form-item>
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item
:label="$t('商品名称')"
prop="titleZh"
v-if="!$route.query.product_id"
>
<el-input
v-model="queryParams.titleZh"
:placeholder="$t('请输入中英文名称、商品编码、海关编码')"
clearable
@keyup.enter.native="handleQuery"
>
<template #prepend>
<el-select v-model="queryParams.searchType" style="width: 100px">
<el-option :value="1" :label="$t('包含')"></el-option>
<el-option :value="2" :label="$t('不包含')"></el-option>
<el-option :value="3" :label="$t('等于')"></el-option>
</el-select>
</template>
</el-input>
</el-form-item>
<el-form-item :label="$t('商品类型')" prop="typeId" v-if="!$route.query.product_id">
<el-select v-model="queryParams.typeId" :placeholder="$t('选择商品类型')" clearable @change="handleQuery">
<el-option v-for="type in typeList" :key="type.id" :label="$l(type, 'titleZh')" :value="type.id"/>
</el-select>
</el-form-item>
<el-form-item :label="$t('商品属性')" prop="typeId" v-if="!$route.query.product_id">
<el-select v-model="queryParams.attrId" :placeholder="$t('选择商品类型')" clearable @change="handleQuery">
<el-option v-for="attr in attrList" :key="attr.id" :label="$l(attr, 'attrName')" :value="attr.id"/>
</el-select>
</el-form-item>
<el-form-item :label="$t('运输方式')" prop="transportType" v-if="!transportType">
<dict-selector :type="DICT_TYPE.ECW_TRANSPORT_TYPE" v-model="queryParams.transportType" formatter="number" clearable @change="handleQuery"/>
</el-form-item>
<!--海运不显示渠道-->
<el-form-item :label="$t('出货渠道')" prop="shippingChannelId" v-if="type !== 'sea'">
<el-select v-model="queryParams.shippingChannelId" clearable @change="handleQuery">
<el-option v-for="item in channelList" :key="item.id" :label="$l(item, 'name')" :value="item.channelId" />
</el-select>
</el-form-item>
<el-form-item :label="$t('始发地')" prop="startCityId">
<el-select v-model="queryParams.startCityId" clearable @change="handleQuery">
<el-option v-for="city in startCityList" :key="city.id" :label="$l(city, 'title')" :value="city.id" />
</el-select>
</el-form-item>
<el-form-item
:label="$t('商品类型')"
prop="typeId"
v-if="!$route.query.product_id"
>
<el-select
v-model="queryParams.typeId"
:placeholder="$t('选择商品类型')"
clearable
@change="handleQuery"
>
<el-option
v-for="type in typeList"
:key="type.id"
:label="$l(type, 'titleZh')"
:value="type.id"
/>
</el-select>
</el-form-item>
<el-form-item
:label="$t('商品属性')"
prop="typeId"
v-if="!$route.query.product_id"
>
<el-select
v-model="queryParams.attrId"
:placeholder="$t('选择商品类型')"
clearable
@change="handleQuery"
>
<el-option
v-for="attr in attrList"
:key="attr.id"
:label="$l(attr, 'attrName')"
:value="attr.id"
/>
</el-select>
</el-form-item>
<el-form-item
:label="$t('运输方式')"
prop="transportType"
v-if="!transportType"
>
<dict-selector
:type="DICT_TYPE.ECW_TRANSPORT_TYPE"
v-model="queryParams.transportType"
formatter="number"
clearable
@change="handleQuery"
/>
</el-form-item>
<!--海运不显示渠道-->
<el-form-item
:label="$t('出货渠道')"
prop="shippingChannelId"
v-if="type !== 'sea'"
>
<el-select
v-model="queryParams.shippingChannelId"
clearable
@change="handleQuery"
>
<el-option
v-for="item in channelList"
:key="item.id"
:label="$l(item, 'name')"
:value="item.channelId"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('始发地')" prop="startCityId">
<el-select
v-model="queryParams.startCityId"
clearable
@change="handleQuery"
>
<el-option
v-for="city in startCityList"
:key="city.id"
:label="$l(city, 'title')"
:value="city.id"
/>
</el-select>
</el-form-item>
<!--lanbm 2024-06-15 add -->
<el-form-item :label="$t('目的国')" prop="countryId">
<el-select
v-model="queryParams.countryId"
clearable
@change="handleQuery"
>
<el-option
v-for="item in countryList"
:key="item.id"
:label="$l(item, 'title')"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('目的地')" prop="destCityId">
<el-select v-model="queryParams.destCityId" clearable @change="handleQuery">
<el-option v-for="city in destCityList" :key="city.id" :label="$l(city, 'title')" :value="city.id" />
<el-select
v-model="queryParams.destCityId"
clearable
@change="handleQuery"
>
<el-option
v-for="city in destCityList"
:key="city.id"
:label="$l(city, 'title')"
:value="city.id"
/>
</el-select>
</el-form-item>
<!--lanbm 2024-06-15 add-->
<el-form-item :label="$t('目的仓')" prop="destCityId">
<el-select
v-model="queryParams.destCityId"
clearable
@change="handleQuery"
>
<el-option
v-for="city in destCityList"
:key="city.id"
:label="$l(city, 'title')"
:value="city.id"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('是否预付')" prop="needPay">
<el-select v-model="queryParams.needPay" :placeholder="$t('请选择')" clearable @change="handleQuery">
<el-select
v-model="queryParams.needPay"
:placeholder="$t('请选择')"
clearable
@change="handleQuery"
>
<el-option :label="$t('是')" value="1"></el-option>
<el-option :label="$t('否')" value="0"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('上架状态')" prop="auditStatus">
<dict-selector :type="DICT_TYPE.ECW_PRICE_AUDIT_STATUS" v-model="queryParams.auditStatus" clearable @change="handleQuery"/>
<dict-selector
:type="DICT_TYPE.ECW_PRICE_AUDIT_STATUS"
v-model="queryParams.auditStatus"
clearable
@change="handleQuery"
/>
</el-form-item>
<el-form-item :label="$t('状态')" prop="combStatus">
<el-select v-model="queryParams.combStatus" :placeholder="$t('请选择状态')" clearable @change="handleQuery">
<el-select
v-model="queryParams.combStatus"
:placeholder="$t('请选择状态')"
clearable
@change="handleQuery"
>
<el-option :label="$t('未设置价格')" value="setPrice_1"></el-option>
<el-option :label="$t('未过期')" value="setPrice_2"></el-option>
<el-option :label="$t('未过期')" value="setPrice_2"></el-option>
<el-option :label="$t('黑名单')" value="blacklist_1"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('是否单询')" prop="needOrderInquiry">
<el-select v-model="queryParams.needOrderInquiry" :placeholder="$t('请选择')" clearable @change="handleQuery">
<el-select
v-model="queryParams.needOrderInquiry"
:placeholder="$t('请选择')"
clearable
@change="handleQuery"
>
<el-option :label="$t('是')" value="1"></el-option>
<el-option :label="$t('否')" value="0"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('单价模式')" prop="priceType">
<el-select v-model="queryParams.priceType" :placeholder="$t('请选择')" clearable @change="handleQuery">
<el-option :label="$t('运费+清关费')" value="0"></el-option>
<el-option :label="$t('全包价')" value="1"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('单价模式')" prop="priceType">
<el-select
v-model="queryParams.priceType"
:placeholder="$t('请选择')"
clearable
@change="handleQuery"
>
<el-option :label="$t('运费+清关费')" value="0"></el-option>
<el-option :label="$t('全包价')" value="1"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">{{$t('搜索')}}</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">{{$t('重置')}}</el-button>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">{{
$t("搜索")
}}</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">{{
$t("重置")
}}</el-button>
</el-form-item>
</el-form>
......@@ -83,146 +234,329 @@
<el-row :gutter="10" class="mb8">
<!--全部路线吗没有新增入口,指定商品的路线价格才有添加路线-->
<el-col :span="1.5" v-if="$route.query.product_id">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd('air')" v-hasPermi="['ecw:product-price:create']">{{$t('新建空运价格')}}</el-button>
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd('sea')" v-hasPermi="['ecw:product-price:create']">{{$t('新建海运价格')}}</el-button>
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd('air')"
v-hasPermi="['ecw:product-price:create']"
>{{ $t("新建空运价格") }}</el-button
>
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd('sea')"
v-hasPermi="['ecw:product-price:create']"
>{{ $t("新建海运价格") }}</el-button
>
</el-col>
<el-col :span="1.5">
<!--未指定商品-->
<template v-if="!$route.query.product_id">
<!--<el-button type="primary" v-hasPermi="['ecw:product-price:batch_update']" size="mini" @click="handleBatchEdit">{{$t('批量设置价格')}}</el-button>-->
<el-button type="primary" v-hasPermi="['ecw:product-price:bartch_black']" size="mini" @click="batchBlock" :disabled="multiple">{{$t('批量加入黑名单')}}</el-button>
<el-button type="primary" v-hasPermi="['ecw:product-price:batch_down']" size="mini" @click="batchOff" :disabled="multiple">{{$t('批量下架')}}</el-button>
<el-button type="warning" v-hasPermi="['ecw:product-price:export']" size="mini" @click="handleExport" :loading="exportLoading" >{{$t('导出')}}</el-button>
<el-button type="primary" v-if="type != 'air'" v-hasPermi="['ecw:product-price:batch_update']" size="mini" @click="handleBatchEdit('sea')">{{$t('批量设置海运价格')}}</el-button>
<el-button type="primary" v-if="type != 'sea'" v-hasPermi="['ecw:product-price:batch_update']" size="mini" @click="handleBatchEdit('air')">{{$t('批量设置空运价格')}}</el-button>
<el-button
type="primary"
v-hasPermi="['ecw:product-price:bartch_black']"
size="mini"
@click="batchBlock"
:disabled="multiple"
>{{ $t("批量加入黑名单") }}</el-button
>
<el-button
type="primary"
v-hasPermi="['ecw:product-price:batch_down']"
size="mini"
@click="batchOff"
:disabled="multiple"
>{{ $t("批量下架") }}</el-button
>
<el-button
type="warning"
v-hasPermi="['ecw:product-price:export']"
size="mini"
@click="handleExport"
:loading="exportLoading"
>{{ $t("导出") }}</el-button
>
<el-button
type="primary"
v-if="type != 'air'"
v-hasPermi="['ecw:product-price:batch_update']"
size="mini"
@click="handleBatchEdit('sea')"
>{{ $t("批量设置海运价格") }}</el-button
>
<el-button
type="primary"
v-if="type != 'sea'"
v-hasPermi="['ecw:product-price:batch_update']"
size="mini"
@click="handleBatchEdit('air')"
>{{ $t("批量设置空运价格") }}</el-button
>
</template>
<!--指定商品-->
<template v-else>
<el-button type="primary" size="mini" v-hasPermi="['ecw:product-price:single_product']" @click="batchSetSingleProductPrice('sea')">{{$t('批量设置商品海运路线')}}</el-button>
<el-button type="primary" size="mini" v-hasPermi="['ecw:product-price:single_product']" @click="batchSetSingleProductPrice('air')">{{$t('批量设置商品空运路线')}}</el-button>
<el-button
type="primary"
size="mini"
v-hasPermi="['ecw:product-price:single_product']"
@click="batchSetSingleProductPrice('sea')"
>{{ $t("批量设置商品海运路线") }}</el-button
>
<el-button
type="primary"
size="mini"
v-hasPermi="['ecw:product-price:single_product']"
@click="batchSetSingleProductPrice('air')"
>{{ $t("批量设置商品空运路线") }}</el-button
>
</template>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"></el-table-column>
<el-table
v-loading="loading"
:data="list"
@selection-change="handleSelectionChange"
>
<el-table-column
type="selection"
width="55"
align="center"
></el-table-column>
<el-table-column :label="$t('序号')" prop="id" width="50" />
<el-table-column :label="$t('商品编码')" align="center" prop="productCode" >
<template slot-scope="{row}">
<el-link type="primary" @click.native="handleUpdate(row)">
{{ row.productDO ? row.productDO.productCode : $t('无productDO字段') }}
</el-link>
<el-table-column
:label="$t('商品编码')"
align="center"
prop="productCode"
>
<template slot-scope="{ row }">
<el-link type="primary" @click.native="handleUpdate(row)">
{{
row.productDO ? row.productDO.productCode : $t("无productDO字段")
}}
</el-link>
</template>
</el-table-column>
<el-table-column :label="$t('海关编码')" align="center" prop="customsCode">
<template slot-scope="{row}">
<div>
{{ row.productDO ? row.productDO.customsCode : $t('无productDO字段') }}
</div>
<el-table-column
:label="$t('海关编码')"
align="center"
prop="customsCode"
>
<template slot-scope="{ row }">
<div>
{{
row.productDO ? row.productDO.customsCode : $t("无productDO字段")
}}
</div>
</template>
</el-table-column>
<el-table-column :label="$t('商品类型')" align="center" prop="typeId">
<template slot-scope="{row}">
<span>{{ row.productDO ? getTypeName(row.productDO.typeId) : $t('无productDO字段') }}</span>
<template slot-scope="{ row }">
<span>{{
row.productDO
? getTypeName(row.productDO.typeId)
: $t("无productDO字段")
}}</span>
</template>
</el-table-column>
<el-table-column :label="$t('商品名称')" align="center" prop="productName">
<template slot-scope="{row}">
<el-link type="primary" @click.native="handleUpdate(row)">
{{ row.productDO ? row.productDO.titleZh + '/' + row.productDO.titleEn : $t('无productDO字段') }}
</el-link>
<el-table-column
:label="$t('商品名称')"
align="center"
prop="productName"
>
<template slot-scope="{ row }">
<el-link type="primary" @click.native="handleUpdate(row)">
{{
row.productDO
? row.productDO.titleZh + "/" + row.productDO.titleEn
: $t("无productDO字段")
}}
</el-link>
</template>
</el-table-column>
<el-table-column prop="tansportType" :label="$t('运输方式')" align="center" width="100">
<template slot-scope="scope">
<div>
{{ transportName(scope.row.warehouseLineDO.transportType) }}
</div>
</template>
<el-table-column
prop="tansportType"
:label="$t('运输方式')"
align="center"
width="100"
>
<template slot-scope="scope">
<div>
{{ transportName(scope.row.warehouseLineDO.transportType) }}
</div>
</template>
</el-table-column>
<el-table-column prop="tansportType" :label="$t('出货渠道')" align="center" width="100">
<template slot-scope="{row}">
<div>
{{ channelName(row.shippingChannelId) }}
</div>
</template>
<el-table-column
prop="tansportType"
:label="$t('出货渠道')"
align="center"
width="100"
>
<template slot-scope="{ row }">
<div>
{{ channelName(row.shippingChannelId) }}
</div>
</template>
</el-table-column>
<el-table-column prop="startDestTitle" :label="$t('始发地') + '/' + $t('目的地')" align="center">
<template slot-scope="scope">
<div>
{{ scope.row.warehouseLineDO.startTitleZh }}
<br />
{{ scope.row.warehouseLineDO.destTitleZh }}
</div>
</template>
<el-table-column
prop="startDestTitle"
:label="$t('始发地') + '/' + $t('目的地')"
align="center"
>
<template slot-scope="scope">
<div>
{{ scope.row.warehouseLineDO.startTitleZh }}
<br />
{{ scope.row.warehouseLineDO.destTitleZh }}
</div>
</template>
</el-table-column>
<el-table-column prop="price" :label="$t('价格')" align="center">
<template slot-scope="scope">
<template v-if="scope.row.needOrderInquiry==1">
<div v-if="scope.row.needOrderInquiry==1">{{$t('单询无价格,请联系市场部')}}</div>
</template>
<template v-else>
<template v-if="scope.row.stepPrice == 1">
<!--全包价-->
<div v-if="scope.row.priceType">
<div v-if="!scope.row.fullPriceStepList || !scope.row.fullPriceStepList.length">{{$t('未设置全包价阶梯价')}}</div>
<div v-else>
{{$t("第{no}阶梯({start}~{end}{weightUnit}", {
<template slot-scope="scope">
<template v-if="scope.row.needOrderInquiry == 1">
<div v-if="scope.row.needOrderInquiry == 1">
{{ $t("单询无价格,请联系市场部") }}
</div>
</template>
<template v-else>
<template v-if="scope.row.stepPrice == 1">
<!--全包价-->
<div v-if="scope.row.priceType">
<div
v-if="
!scope.row.fullPriceStepList ||
!scope.row.fullPriceStepList.length
"
>
{{ $t("未设置全包价阶梯价") }}
</div>
<div v-else>
{{
$t("第{no}阶梯({start}~{end}{weightUnit}", {
no: 1,
start: scope.row.fullPriceStepList[0].startNum,
end: scope.row.fullPriceStepList[0].endNum,
weightUnit: getUnitTitle(scope.row.fullPriceStepList[0].weightUnit),
})}}<br/>
{{$t('全包价')}}:{{ getCurrencySymbol(scope.row.fullPriceStepList[0].allPriceUnit) + scope.row.fullPriceStepList[0].allPrice}}&nbsp;
{{ getCurrencyTitle(scope.row.fullPriceStepList[0].allPriceUnit) + '/' + getUnitTitle(scope.row.fullPriceStepList[0].allVolumeUnit)}}
</div>
weightUnit: getUnitTitle(
scope.row.fullPriceStepList[0].weightUnit
),
})
}}<br />
{{ $t("全包价") }}:{{
getCurrencySymbol(
scope.row.fullPriceStepList[0].allPriceUnit
) + scope.row.fullPriceStepList[0].allPrice
}}&nbsp;
{{
getCurrencyTitle(
scope.row.fullPriceStepList[0].allPriceUnit
) +
"/" +
getUnitTitle(scope.row.fullPriceStepList[0].allVolumeUnit)
}}
</div>
<template v-else>
<div v-if="!scope.row.freightPriceStepList || !scope.row.freightPriceStepList.length">{{$t('未设置运费阶梯价')}}</div>
<div v-else>
{{$t("第{no}阶梯({start}~{end}{weightUnit}", {
</div>
<template v-else>
<div
v-if="
!scope.row.freightPriceStepList ||
!scope.row.freightPriceStepList.length
"
>
{{ $t("未设置运费阶梯价") }}
</div>
<div v-else>
{{
$t("第{no}阶梯({start}~{end}{weightUnit}", {
no: 1,
start: scope.row.freightPriceStepList[0].startNum,
end: scope.row.freightPriceStepList[0].endNum,
weightUnit: getUnitTitle(scope.row.freightPriceStepList[0].weightUnit),
})}}<br/>
<div>
{{$t('运费')}}:{{ getCurrencySymbol(scope.row.freightPriceStepList[0].transportPriceUnit) + scope.row.freightPriceStepList[0].transportPrice}}&nbsp;
{{ getCurrencyTitle(scope.row.freightPriceStepList[0].transportPriceUnit) + '/' + getUnitTitle(scope.row.freightPriceStepList[0].transportVolumeUnit)}}
</div>
weightUnit: getUnitTitle(
scope.row.freightPriceStepList[0].weightUnit
),
})
}}<br />
<div>
{{ $t("运费") }}:{{
getCurrencySymbol(
scope.row.freightPriceStepList[0].transportPriceUnit
) + scope.row.freightPriceStepList[0].transportPrice
}}&nbsp;
{{
getCurrencyTitle(
scope.row.freightPriceStepList[0].transportPriceUnit
) +
"/" +
getUnitTitle(
scope.row.freightPriceStepList[0].transportVolumeUnit
)
}}
</div>
</template>
<el-button type="text" @click="showMoreStepPriceItem=scope.row">{{$t('查看更多')}}</el-button>
</template>
<template v-else>
<div v-if="scope.row.priceType == 0">
{{$t('运费')}}:{{ getCurrencySymbol(scope.row.transportPriceUnit) + scope.row.transportPrice}}&nbsp;
{{ getCurrencyTitle(scope.row.transportPriceUnit) + '/' + getUnitTitle(scope.row.transportVolumeUnit)}}
<br />
{{$t('清关费')}}:{{ getCurrencySymbol(scope.row.clearancePriceUnit) + scope.row.clearancePrice}}&nbsp;
{{ getCurrencyTitle(scope.row.clearancePriceUnit) + '/' + getUnitTitle(scope.row.clearanceVolumeUnit)}}
</div>
<div v-if="scope.row.priceType == 1">
{{$t('全包价')}}:{{ getCurrencySymbol(scope.row.allPriceUnit) + scope.row.allPrice}}&nbsp;
{{ getCurrencyTitle(scope.row.allPriceUnit) + '/' + getUnitTitle(scope.row.allVolumeUnit)}}
</div>
</template>
<el-button
type="text"
@click="showMoreStepPriceItem = scope.row"
>{{ $t("查看更多") }}</el-button
>
</template>
<!-- <template v-if="scope.row.stepPrice == 1">
<template v-else>
<div v-if="scope.row.priceType == 0">
{{ $t("运费") }}:{{
getCurrencySymbol(scope.row.transportPriceUnit) +
scope.row.transportPrice
}}&nbsp;
{{
getCurrencyTitle(scope.row.transportPriceUnit) +
"/" +
getUnitTitle(scope.row.transportVolumeUnit)
}}
<br />
{{ $t("清关费") }}:{{
getCurrencySymbol(scope.row.clearancePriceUnit) +
scope.row.clearancePrice
}}&nbsp;
{{
getCurrencyTitle(scope.row.clearancePriceUnit) +
"/" +
getUnitTitle(scope.row.clearanceVolumeUnit)
}}
</div>
<div v-if="scope.row.priceType == 1">
{{ $t("全包价") }}:{{
getCurrencySymbol(scope.row.allPriceUnit) +
scope.row.allPrice
}}&nbsp;
{{
getCurrencyTitle(scope.row.allPriceUnit) +
"/" +
getUnitTitle(scope.row.allVolumeUnit)
}}
</div>
</template>
</template>
<!-- <template v-if="scope.row.stepPrice == 1">
<!--全包价-->
<!-- <div v-if="scope.row.priceType">
<!-- <div v-if="scope.row.priceType">
<div v-if="!scope.row.fullPriceStepList || !scope.row.fullPriceStepList.length">{{$t('未设置全包价阶梯价')}}</div>
<div v-else>
{{$t("第{no}阶梯({start}~{end}{weightUnit}", {
......@@ -267,98 +601,203 @@
{{ getCurrencyTitle(scope.row.allPriceUnit) + '/' + getUnitTitle(scope.row.allVolumeUnit)}}
</div>
</template> -->
</template>
</template>
</el-table-column>
<el-table-column prop="auditStatus" align="center" :label="$t('状态')" width="120">
<el-table-column
prop="auditStatus"
align="center"
:label="$t('状态')"
width="120"
>
<template slot-scope="scope">
<div>
{{ statusName(scope.row) }}
<span style="color:red" v-if="(scope.row.validateStartDate && scope.row.validateStartDate > Date.now()) || (scope.row.validateEndDate && scope.row.validateEndDate < Date.now())">(已过期)</span>
{{ statusName(scope.row) }}
<span
style="color: red"
v-if="
(scope.row.validateStartDate &&
scope.row.validateStartDate > Date.now()) ||
(scope.row.validateEndDate &&
scope.row.validateEndDate < Date.now())
"
>(已过期)</span
>
</div>
</template>
</el-table-column>
<el-table-column prop="advanceStatus" :label="$t('单询')" align="center" width="80">
<el-table-column
prop="advanceStatus"
:label="$t('单询')"
align="center"
width="80"
>
<template slot-scope="scope">
<dict-tag :type="DICT_TYPE.NEED_ORDER_INQUIRY" :value="scope.row.needOrderInquiry"></dict-tag>
<dict-tag
:type="DICT_TYPE.NEED_ORDER_INQUIRY"
:value="scope.row.needOrderInquiry"
></dict-tag>
</template>
</el-table-column>
<el-table-column prop="advanceStatus" :label="$t('预付')" align="center" width="80">
<template slot-scope="scope">
<div>
<!-- {{ getAdvanceStatuTitle(scope.row.advanceStatus) }} -->
<dict-tag :type="DICT_TYPE.ECW_PAY_ADVANCE" :value="scope.row.needPay"></dict-tag>
</div>
</template>
<el-table-column
prop="advanceStatus"
:label="$t('预付')"
align="center"
width="80"
>
<template slot-scope="scope">
<div>
<!-- {{ getAdvanceStatuTitle(scope.row.advanceStatus) }} -->
<dict-tag
:type="DICT_TYPE.ECW_PAY_ADVANCE"
:value="scope.row.needPay"
></dict-tag>
</div>
</template>
</el-table-column>
<el-table-column :label="$t('最后修改时间')">
<template slot-scope="{row}">
<template slot-scope="{ row }">
<div>
{{ row.updateTime|parseTime }}
{{ row.updateTime | parseTime }}
</div>
</template>
</el-table-column>
<el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width" width="140">
<el-table-column
:label="$t('操作')"
align="center"
class-name="small-padding fixed-width"
width="140"
>
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row, true)"
v-hasPermi="['ecw:product-price:show']">{{$t('查看')}}</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['ecw:product-price:update']">{{$t('编辑')}}</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row, true)"
v-hasPermi="['ecw:product-price:show']"
>{{ $t("查看") }}</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['ecw:product-price:update']"
>{{ $t("编辑") }}</el-button
>
<el-button size="mini" type="text" icon="el-icon-edit" @click="updateStatus(scope.row, 'blacklist')"
v-hasPermi="['ecw:product-price:black']">{{ scope.row.blacklist == 0 ? $t('加入黑名单') : $t('移除黑名单') }}</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="updateStatus(scope.row, 'auditStatus')"
v-hasPermi="['ecw:product-price:down']">{{scope.row.auditStatus == AuditStatusEnum.PASS ? $t('下架') : $t('上架')}}</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['ecw:product-price:delete']">{{$t('删除')}}</el-button>
<el-button @click="copyTemplate(scope.row)" size="mini" type="text">{{$t('复制模板')}}</el-button>
<el-button @click="setOrderInquiry(scope.row, 0)" v-if="scope.row.needOrderInquiry" size="mini" type="text">{{$t('取消单询')}}</el-button>
<el-button @click="setOrderInquiry(scope.row, 1)" v-else size="mini" type="text">{{$t('单询异常')}}</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="updateStatus(scope.row, 'blacklist')"
v-hasPermi="['ecw:product-price:black']"
>{{
scope.row.blacklist == 0 ? $t("加入黑名单") : $t("移除黑名单")
}}</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="updateStatus(scope.row, 'auditStatus')"
v-hasPermi="['ecw:product-price:down']"
>{{
scope.row.auditStatus == AuditStatusEnum.PASS
? $t("下架")
: $t("上架")
}}</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['ecw:product-price:delete']"
>{{ $t("删除") }}</el-button
>
<el-button @click="copyTemplate(scope.row)" size="mini" type="text">{{
$t("复制模板")
}}</el-button>
<el-button
@click="setOrderInquiry(scope.row, 0)"
v-if="scope.row.needOrderInquiry"
size="mini"
type="text"
>{{ $t("取消单询") }}</el-button
>
<el-button
@click="setOrderInquiry(scope.row, 1)"
v-else
size="mini"
type="text"
>{{ $t("单询异常") }}</el-button
>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<el-dialog :visible="!!showMoreStepPriceItem" :before-close="closeMoreStepPrice" :title="$t('查看阶梯价')">
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<el-dialog
:visible="!!showMoreStepPriceItem"
:before-close="closeMoreStepPrice"
:title="$t('查看阶梯价')"
>
<el-row :gutter="20" v-if="showMoreStepPriceItem">
<el-col :span="12">
<!--全包价-->
<template v-if="showMoreStepPriceItem.priceType">
<div v-for="(item, index) in showMoreStepPriceItem.fullPriceStepList">
<div
v-for="(item, index) in showMoreStepPriceItem.fullPriceStepList"
>
<show-step-price-item
:value="item"
:unit-map="unitMap"
:currency-map="currencyMap"
:index="index"
field-prefix="all"
:price-name="$t('全包价')"></show-step-price-item>
:price-name="$t('全包价')"
></show-step-price-item>
</div>
</template>
<template v-else>
<template v-if="showMoreStepPriceItem.freightPriceStepList">
<div v-for="(item, index) in showMoreStepPriceItem.freightPriceStepList">
<div
v-for="(
item, index
) in showMoreStepPriceItem.freightPriceStepList"
>
<show-step-price-item
:value="item"
:unit-map="unitMap"
:currency-map="currencyMap"
:index="index"
field-prefix="transport"
:price-name="$t('运费')"></show-step-price-item>
:price-name="$t('运费')"
></show-step-price-item>
</div>
</template>
<template v-if="showMoreStepPriceItem.clearancePriceStepList">
<div v-for="(item, index) in showMoreStepPriceItem.clearancePriceStepList">
<div
v-for="(
item, index
) in showMoreStepPriceItem.clearancePriceStepList"
>
<show-step-price-item
:value="item"
:unit-map="unitMap"
:currency-map="currencyMap"
:index="index"
field-prefix="clearance"
:price-name="$t('清关费')"></show-step-price-item>
:price-name="$t('清关费')"
></show-step-price-item>
</div>
</template>
</template>
......@@ -367,7 +806,7 @@
<!--
甲方要求不显示清关费 https://zentao.test.jdshangmen.com/bug-view-5298.html
-->
<!-- <el-col :span="12" v-if="[3,4].indexOf(+showMoreStepPriceItem.warehouseLineDO.transportType) > -1">
<!-- <el-col :span="12" v-if="[3,4].indexOf(+showMoreStepPriceItem.warehouseLineDO.transportType) > -1">
<template v-if="showMoreStepPriceItem.clearPriceStepList.length">
<div v-for="(item, index) in showMoreStepPriceItem.clearPriceStepList">
<div class="page-title">
......@@ -386,7 +825,6 @@
</el-col>-->
</el-row>
</el-dialog>
</div>
</template>
......@@ -400,31 +838,31 @@ import {
exportProductPriceExcel,
batchBlock,
batchOff,
updateOrderInquiry
updateOrderInquiry,
} from "@/api/ecw/productPrice";
import { openedRouterList } from "@/api/ecw/warehouse";
import { getTradeCityList } from "@/api/ecw/region";
import { getTradeCityList, getListTree } from "@/api/ecw/region";
import { getProductTypeList } from "@/api/ecw/productType";
import { getProductAttrList } from "@/api/ecw/productAttr";
import { getDictDatas, DICT_TYPE } from '@/utils/dict'
import { getCurrencyList } from '@/api/ecw/currency';
import { getUnitList } from '@/api/ecw/unit';
import { AuditStatusEnum} from '@/utils/constants'
import { getAllChannelList, getChannelList } from '@/api/ecw/channel'
import DictTag from '@/components/DictTag'
import {arrryToKeyedObjectBy} from '@/utils/index'
import { getProduct } from '@/api/ecw/product';
import {parseTime} from '@/utils/ruoyi'
import { getDictDatas, DICT_TYPE } from "@/utils/dict";
import { getCurrencyList } from "@/api/ecw/currency";
import { getUnitList } from "@/api/ecw/unit";
import { AuditStatusEnum } from "@/utils/constants";
import { getAllChannelList, getChannelList } from "@/api/ecw/channel";
import DictTag from "@/components/DictTag";
import { arrryToKeyedObjectBy } from "@/utils/index";
import { getProduct } from "@/api/ecw/product";
import { parseTime } from "@/utils/ruoyi";
import Template from "@/views/cms/template";
import {getStatusName} from "./util";
import { getStatusName } from "./util";
import ShowStepPriceItem from "@/views/ecw/productPrice/components/ShowStepPriceItem.vue";
export default {
name: "EcwProductpriceIndex",
filters: {parseTime},
filters: { parseTime },
components: {
ShowStepPriceItem,
Template,
DictTag
DictTag,
},
data() {
return {
......@@ -435,19 +873,20 @@ export default {
// 非多个禁用
multiple: true,
//特性列表
attrList:[],
attrList: [],
typeList: [],
product: null,
countryList: [], //目的国
warehouseList: [], //目前仓
cityList: [],
/* startCityList: [], //始发地城市
destCityList: [], //目的地城市 */
routedList: [], //已开头路线列表
currencyList: [], //货币列表
unitList: [], //单位列表
channelList:[] , // 渠道
routeParams:{}, //路线搜索条件
isUpdate: false, //更新操作
routedList: [], //已开头路线列表
currencyList: [], //货币列表
unitList: [], //单位列表
channelList: [], // 渠道
routeParams: {}, //路线搜索条件
isUpdate: false, //更新操作
// 遮罩层
loading: true,
// 导出遮罩层
......@@ -479,23 +918,74 @@ export default {
clearanceVolumeUnit: null,
shippingChannelId: null,
status: null,
countryId:null,//国家
},
// 表单参数
form: {
typeId: null,
titleZh: null
titleZh: null,
},
// 表单校验
rules: {
typeId: [{ required: true, message: this.$t("产品类型不能为空"), trigger: "blur" }],
titleZh: [{ required: true, message: this.$t("产品名称不能为空"), trigger: "blur" }],
titleEn: [{ required: true, message: this.$t("英文名称不能为空"), trigger: "blur" }],
transportPrice: [{ required: true, message: this.$t("海运费不能为空"), trigger: "blur" }],
clearancePrice: [{ required: true, message: this.$t("清关费不能为空"), trigger: "blur" }],
advanceStatus: [{ required: true, message: this.$t("是否预付不能为空"), trigger: "blur" }],
containerLocation:[{ required: true, message: this.$t("货柜位置不能为空"), trigger: "blur" }],
square:[{ required: true, message: this.$t("方数不能为空"), trigger: "blur" }],
needBook:[{ required: true, message: this.$t("预约入仓不能为空"), trigger: "blur" }],
typeId: [
{
required: true,
message: this.$t("产品类型不能为空"),
trigger: "blur",
},
],
titleZh: [
{
required: true,
message: this.$t("产品名称不能为空"),
trigger: "blur",
},
],
titleEn: [
{
required: true,
message: this.$t("英文名称不能为空"),
trigger: "blur",
},
],
transportPrice: [
{
required: true,
message: this.$t("海运费不能为空"),
trigger: "blur",
},
],
clearancePrice: [
{
required: true,
message: this.$t("清关费不能为空"),
trigger: "blur",
},
],
advanceStatus: [
{
required: true,
message: this.$t("是否预付不能为空"),
trigger: "blur",
},
],
containerLocation: [
{
required: true,
message: this.$t("货柜位置不能为空"),
trigger: "blur",
},
],
square: [
{ required: true, message: this.$t("方数不能为空"), trigger: "blur" },
],
needBook: [
{
required: true,
message: this.$t("预约入仓不能为空"),
trigger: "blur",
},
],
},
lineList: [],
......@@ -505,7 +995,7 @@ export default {
locationList: getDictDatas(DICT_TYPE.ECW_CONTAINER_LOCATION),
// 查看更多阶梯价
showMoreStepPriceItem: null,
entryPath: null
entryPath: null,
};
},
......@@ -513,112 +1003,117 @@ export default {
// 路径中的运输方式参数
transportType() {
// product-price-1_2的格式,如果没有三段则最后一段不是运输方式
return this.$route.path.split('-')[2] || '';
return this.$route.path.split("-")[2] || "";
},
// 路由中的标题
routeName(){
return this.$route.name
routeName() {
return this.$route.name;
},
// 类型,transportType是1和2(1_2用一个表示)表示海运,3和4表示空运
type(){
type() {
// 如果没有则表示商品路线价格
if(!this.transportType){
return null
if (!this.transportType) {
return null;
}
return ['3','4'].indexOf(this.transportType) > -1 ? 'air' : 'sea'
return ["3", "4"].indexOf(this.transportType) > -1 ? "air" : "sea";
},
// 商品名称
productTitle(){
if(!this.product){
return ''
productTitle() {
if (!this.product) {
return "";
}
return this.product.titleZh
return this.product.titleZh;
},
// 渠道用id做键值
keyedChannel(){
return arrryToKeyedObjectBy(this.channelList, 'channelId')
keyedChannel() {
return arrryToKeyedObjectBy(this.channelList, "channelId");
},
// 根据渠道id获取渠道名
channelName(){
return id => {
return this.keyedChannel[id] ? this.keyedChannel[id].nameZh : null
}
channelName() {
return (id) => {
return this.keyedChannel[id] ? this.keyedChannel[id].nameZh : null;
};
},
// 根据类型获取类型名称
getTypeName() {
return typeId => {
for(let index in this.typeList) {
return (typeId) => {
for (let index in this.typeList) {
let typeItem = this.typeList[index];
if(typeItem.id == typeId) {
return this.$l(typeItem, 'title');
if (typeItem.id == typeId) {
return this.$l(typeItem, "title");
}
}
}
};
},
// 根据状态获取状态名称 ,这个应该可以改成字典,目前接口缺少相关数据,待定
statusName() {
return getStatusName
return getStatusName;
},
// 根据运输方式获取名称
transportName() {
return transportType => {
return this.getDictDataLabel(this.DICT_TYPE.ECW_TRANSPORT_TYPE, transportType)
}
return (transportType) => {
return this.getDictDataLabel(
this.DICT_TYPE.ECW_TRANSPORT_TYPE,
transportType
);
};
},
// 显示币种符号
getCurrencySymbol() {
return currencyId => {
for(let index in this.currencyList) {
return (currencyId) => {
for (let index in this.currencyList) {
let currecyItem = this.currencyList[index];
if(currecyItem.id == currencyId) {
if (currecyItem.id == currencyId) {
return currecyItem.fuhao;
}
}
}
};
},
// 显示币种名称
getCurrencyTitle() {
return currencyId => {
for(let index in this.currencyList) {
return (currencyId) => {
for (let index in this.currencyList) {
let currecyItem = this.currencyList[index];
if(currecyItem.id == currencyId) {
return this.$l(currecyItem, 'title');
if (currecyItem.id == currencyId) {
return this.$l(currecyItem, "title");
}
}
}
};
},
getUnitTitle() {
return unitId => {
for(let index in this.unitList) {
return (unitId) => {
for (let index in this.unitList) {
let unitItem = this.unitList[index];
if(unitItem.id == unitId) {
return this.$l(unitItem, 'title');
if (unitItem.id == unitId) {
return this.$l(unitItem, "title");
}
}
}
};
},
startCityList(){
return this.cityList.filter(item => item.type == 2 || item.type == 3)
startCityList() {
//字典:贸易类型字典region_trade_type,0非进出口,1进口,2出口,3进出口
return this.cityList.filter((item) => item.type == 2 || item.type == 3);
},
destCityList(){
return this.cityList.filter(item => item.type == 1 || item.type == 3)
destCityList() {
//字典:贸易类型字典region_trade_type,0非进出口,1进口,2出口,3进出口
return this.cityList.filter((item) => item.type == 1 || item.type == 3);
},
currencyMap(){
let map = {}
this.currencyList.forEach(item => {
map[item.id] = this.$l(item, 'title')
})
return map
currencyMap() {
let map = {};
this.currencyList.forEach((item) => {
map[item.id] = this.$l(item, "title");
});
return map;
},
unitMap(){
let map = {}
this.unitList.forEach(item => {
map[item.id] = this.$l(item, 'title')
})
return map
unitMap() {
let map = {};
this.unitList.forEach((item) => {
map[item.id] = this.$l(item, "title");
});
return map;
},
},
activated() {
......@@ -635,84 +1130,91 @@ export default {
}
this.handleQuery()
*/
if(this.$route.query.product_type){
this.$set(this.queryParams, 'typeId', +this.$route.query.product_type);
if (this.$route.query.product_type) {
this.$set(this.queryParams, "typeId", +this.$route.query.product_type);
}
if(this.$route.query.transportType){
this.$set(this.queryParams, 'transportType', +this.$route.query.transportType);
if (this.$route.query.transportType) {
this.$set(
this.queryParams,
"transportType",
+this.$route.query.transportType
);
}
// 指定产品获取产品信息
if(this.$route.query.product_id){
this.$set(this.queryParams, 'productId', +this.$route.query.product_id);
getProduct(this.$route.query.product_id).then(res => {
this.product = res.data
})
}else {
if (this.$route.query.product_id) {
this.$set(this.queryParams, "productId", +this.$route.query.product_id);
getProduct(this.$route.query.product_id).then((res) => {
this.product = res.data;
});
} else {
if (this.transportType) {
// 如果指定了单个的运输方式则赋值
if (this.transportType.split('_').length == 1) {
this.$set(this.queryParams, 'transportType', +this.transportType)
if (this.transportType.split("_").length == 1) {
this.$set(this.queryParams, "transportType", +this.transportType);
}
}
}
},
watch:{
'$route.query.product_id'(){
watch: {
"$route.query.product_id"() {
// if(!this.$route.query.product_id){
// return this.product = null
// }
// 价格列表 跟 商品的价格列表,有时候商品价格列表的路由变动会导致价格列表也执行此处代码,所以做一个判断排除
// https://zentao.test.jdshangmen.com/bug-view-4928.html
if(this.$route.path != this.entryPath) return
if (this.$route.path != this.entryPath) return;
let productId = this.product?.id
if(this.$route.name === 'ProductPrice'){
if(this.$route.query.product_id != productId){
let productId = this.product?.id;
if (this.$route.name === "ProductPrice") {
if (this.$route.query.product_id != productId) {
this.queryParams = {
pageNo: 1,
pageSize: 10,
productId: this.$route.query.product_id,
typeId: this.$route.query.product_type,
transportType:this.$route.query.transportType
}
transportType: this.$route.query.transportType,
};
}
getProduct(this.$route.query.product_id).then(res => {
this.product = res.data
})
getProduct(this.$route.query.product_id).then((res) => {
this.product = res.data;
});
this.getList();
}
}
},
},
created() {
this.entryPath = this.$route.path
if(this.$route.query.product_type){
this.$set(this.queryParams, 'typeId', +this.$route.query.product_type);
this.entryPath = this.$route.path;
if (this.$route.query.product_type) {
this.$set(this.queryParams, "typeId", +this.$route.query.product_type);
}
if(this.$route.query.transportType){
this.$set(this.queryParams, 'transportType', +this.$route.query.transportType);
if (this.$route.query.transportType) {
this.$set(
this.queryParams,
"transportType",
+this.$route.query.transportType
);
}
// 指定产品获取产品信息
if(this.$route.query.product_id){
this.$set(this.queryParams, 'productId', +this.$route.query.product_id);
getProduct(this.$route.query.product_id).then(res => {
this.product = res.data
})
}else{
if(this.transportType) {
if (this.$route.query.product_id) {
this.$set(this.queryParams, "productId", +this.$route.query.product_id);
getProduct(this.$route.query.product_id).then((res) => {
this.product = res.data;
});
} else {
if (this.transportType) {
// 如果指定了单个的运输方式则赋值
if (this.transportType.split('_').length == 1) {
this.$set(this.queryParams, 'transportType', +this.transportType)
if (this.transportType.split("_").length == 1) {
this.$set(this.queryParams, "transportType", +this.transportType);
}
}
this.getAttrList();
}
//获取城市列表
this.getAllCityList()
this.getChannelList()
this.getTypeList()
this.getCountryList();
this.getAllCityList();
this.getChannelList();
this.getTypeList();
this.getAttrList();
......@@ -723,56 +1225,60 @@ export default {
this.$nextTick(() => {
this.getList();
})
});
},
methods: {
getChannelList(){
getAllChannelList().then(res => this.channelList = res.data)
/* 国家 */
getCountryList() {
getListTree({ treeType: 1 }).then((response) => {
this.countryList = response.data;
});
},
//渠道
getChannelList() {
getAllChannelList().then((res) => (this.channelList = res.data));
},
/** 获取产品属性列表 */
getAttrList() {
getProductAttrList().then(response => {
this.attrList = response.data;
})
getProductAttrList().then((response) => {
this.attrList = response.data;
});
},
/** 获取产品类型列表 */
/** 获取产品类型列表 */
getTypeList() {
getProductTypeList().then(response => {
getProductTypeList().then((response) => {
this.typeList = response.data;
})
});
},
/**获取所有城市列表 */
getAllCityList() {
getTradeCityList({}).then(response => {
this.cityList = response.data;
})
getTradeCityList({}).then((response) => {
this.cityList = response.data;
});
},
/**获取已开通路线列表 */
getOpenedRouterList() {
openedRouterList(this.routeParams).then(response => {
this.routedList = response.data;
this.setDefaultSelect();
})
openedRouterList(this.routeParams).then((response) => {
this.routedList = response.data;
this.setDefaultSelect();
});
},
/**获取所有货币列表 */
requestCurrencyList() {
getCurrencyList().then(response => {
getCurrencyList().then((response) => {
this.currencyList = response.data;
})
});
},
/**获取所有单位列表 */
requestUnitList() {
getUnitList().then(response => {
getUnitList().then((response) => {
this.unitList = response.data;
})
});
},
/*handleSelectionChange(val) {
......@@ -797,30 +1303,35 @@ export default {
this.getOpenedRouterList();
},
handleStatusChange(row) {
updateProductPrice(row).then(() => {
this.$modal.msgSuccess(this.$t("修改成功"));
}).catch(function() {
row.auditStatus = row.auditStatus === AuditStatusEnum.PASS ? AuditStatusEnum.NOT_PASS : AuditStatusEnum.PASS;
});
handleStatusChange(row) {
updateProductPrice(row)
.then(() => {
this.$modal.msgSuccess(this.$t("修改成功"));
})
.catch(function () {
row.auditStatus =
row.auditStatus === AuditStatusEnum.PASS
? AuditStatusEnum.NOT_PASS
: AuditStatusEnum.PASS;
});
},
/** 查询列表 */
getList() {
this.loading = true;
console.log(this.queryParams,'this.queryParams')
console.log(this.queryParams, "this.queryParams");
// 处理查询参数
let params = {...this.queryParams};
if(this.type == 'sea'){
params.transportType = 1
let params = { ...this.queryParams };
if (this.type == "sea") {
params.transportType = 1;
}
if(this.type == 'air'){
params.transportType = 3
if (this.type == "air") {
params.transportType = 3;
}
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
this.addBeginAndEndTime(params, this.dateRangeCreateTime, "createTime");
// 执行查询
console.log(params,'params')
getProductPricePage(params).then(response => {
console.log(params, "params");
getProductPricePage(params).then((response) => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
......@@ -850,11 +1361,11 @@ export default {
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.queryParams.setPrice = undefined
this.queryParams.blacklist = undefined
if(this.queryParams.combStatus){
let tmp = this.queryParams.combStatus.split('_')
this.queryParams[tmp[0]] = tmp[1]
this.queryParams.setPrice = undefined;
this.queryParams.blacklist = undefined;
if (this.queryParams.combStatus) {
let tmp = this.queryParams.combStatus.split("_");
this.queryParams[tmp[0]] = tmp[1];
}
this.getList();
},
......@@ -866,56 +1377,65 @@ export default {
},
/** 新增按钮操作 */
handleAdd(type) {
return this.$router.push(`../../lineProject/product-price/edit-${type}?` + (new URLSearchParams(this.$route.query)).toString())
return this.$router.push(
`../../lineProject/product-price/edit-${type}?` +
new URLSearchParams(this.$route.query).toString()
);
},
// 批量修改单个商品的价格(一条或者多条,后者全部路线)
batchSetSingleProductPrice(type){
this.$router.push(`../../lineProject/product-price/edit-${type}?action=batchUpdate&type=${type}&product_id=${this.$route.query.product_id}&ids=${this.ids}`)
batchSetSingleProductPrice(type) {
this.$router.push(
`../../lineProject/product-price/edit-${type}?action=batchUpdate&type=${type}&product_id=${this.$route.query.product_id}&ids=${this.ids}`
);
},
// 批量设置路线
handleBatchEdit(type) {
this.$router.push('../../lineProject/batch-edit-' + type)
this.$router.push("../../lineProject/batch-edit-" + type);
},
/** 修改按钮操作 */
handleUpdate(row, readonly) {
let transportType = row.warehouseLineDO.transportType
let type = transportType == 3 || transportType == 4 ? 'air' : 'sea'
let url = `../../lineProject/product-price/edit-${type}?action=update&id=${row.id}`
if(readonly)url += '&readonly=1'
return this.$router.push(url)
let transportType = row.warehouseLineDO.transportType;
let type = transportType == 3 || transportType == 4 ? "air" : "sea";
let url = `../../lineProject/product-price/edit-${type}?action=update&id=${row.id}`;
if (readonly) url += "&readonly=1";
return this.$router.push(url);
},
updateStatus(row, type) {
if(type == 'blacklist') {
row.blacklist=row.blacklist == 0 ? 1 : 0;
} else if(type == 'auditStatus') {
row.auditStatus=row.auditStatus === AuditStatusEnum.PASS ? AuditStatusEnum.NOT_PASS : AuditStatusEnum.PASS;
if (type == "blacklist") {
row.blacklist = row.blacklist == 0 ? 1 : 0;
} else if (type == "auditStatus") {
row.auditStatus =
row.auditStatus === AuditStatusEnum.PASS
? AuditStatusEnum.NOT_PASS
: AuditStatusEnum.PASS;
}
updateProductPrice(row).then(() => {
this.$modal.msgSuccess(this.$t("修改成功"));
}).catch(function() {
if(statusType == 'blacklist') {
row.blacklist = row.blacklist === 1 ? 0 : 1;
} else {
row.auditStatus = row.auditStatus === AuditStatusEnum.PASS ? AuditStatusEnum.NOT_PASS : AuditStatusEnum.PASS;
}
});
updateProductPrice(row)
.then(() => {
this.$modal.msgSuccess(this.$t("修改成功"));
})
.catch(function () {
if (statusType == "blacklist") {
row.blacklist = row.blacklist === 1 ? 0 : 1;
} else {
row.auditStatus =
row.auditStatus === AuditStatusEnum.PASS
? AuditStatusEnum.NOT_PASS
: AuditStatusEnum.PASS;
}
});
},
checkSelectable() {
return !this.isUpdate;
},
setDefaultSelect() {
let vm = this;
setTimeout(() => {
// 修改线路价格,选中已经选择的
if(vm.isUpdate && vm.routedList && vm.routedList.length) {
vm.$refs.routeTable.toggleRowSelection(vm.routedList[0]);
// 修改线路价格,选中已经选择的
if (vm.isUpdate && vm.routedList && vm.routedList.length) {
vm.$refs.routeTable.toggleRowSelection(vm.routedList[0]);
}
}, 300);
},
......@@ -960,77 +1480,90 @@ 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 deleteProductPrice(id);
}).then(() => {
})
.then(() => {
this.getList();
this.$modal.msgSuccess(this.$t("删除成功"));
}).catch(() => {});
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
// 处理查询参数
let params = {...this.queryParams};
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
if(this.type == 'sea'){
params.transportType = 1
if (this.type == "sea") {
params.transportType = 1;
}
if(this.type == 'air'){
params.transportType = 3
if (this.type == "air") {
params.transportType = 3;
}
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
this.$modal.confirm(this.$t('是否确认导出所有数据项?')).then(() => {
this.addBeginAndEndTime(params, this.dateRangeCreateTime, "createTime");
this.$modal
.confirm(this.$t("是否确认导出所有数据项?"))
.then(() => {
this.exportLoading = true;
return exportProductPriceExcel(params);
}).then(response => {
})
.then((response) => {
// this.$download.excel(response, '路线价格.xlsx');
this.exportLoading = false;
this.$message.success(this.$t('已加入导出队列,请稍后在下载日志中下载'))
}).catch(() => {
this.$message.success(
this.$t("已加入导出队列,请稍后在下载日志中下载")
);
})
.catch(() => {
this.exportLoading = false;
});
},
// 表格多选
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
this.ids = selection.map((item) => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
batchBlock(){
batchBlock({ids: this.ids.join(',')}).then(res => {
this.$message.success(res.msg || this.$t('操作成功'))
this.getList()
})
batchBlock() {
batchBlock({ ids: this.ids.join(",") }).then((res) => {
this.$message.success(res.msg || this.$t("操作成功"));
this.getList();
});
},
batchOff(){
batchOff({ids: this.ids.join(',')}).then(res => {
this.$message.success(res.msg || this.$t('操作成功'))
this.getList()
})
batchOff() {
batchOff({ ids: this.ids.join(",") }).then((res) => {
this.$message.success(res.msg || this.$t("操作成功"));
this.getList();
});
},
// 设置,取消単询
setOrderInquiry(row, needOrderInquiry){
row.needOrderInquiry = needOrderInquiry
updateOrderInquiry(row).then(res => {
this.$message.success(res.msg || this.$t('操作成功'))
this.getList()
})
setOrderInquiry(row, needOrderInquiry) {
row.needOrderInquiry = needOrderInquiry;
updateOrderInquiry(row).then((res) => {
this.$message.success(res.msg || this.$t("操作成功"));
this.getList();
});
},
// 复制模板
copyTemplate(row){
copyTemplate(row) {
// 跳转到批量设置页面,并填充数据
let transportType = row.warehouseLineDO.transportType
this.$router.push(`../../lineProject/batch-edit-${transportType == 3 || transportType == 4 ? 'air' : 'sea'}?templateId=${row.id}`)
let transportType = row.warehouseLineDO.transportType;
this.$router.push(
`../../lineProject/batch-edit-${
transportType == 3 || transportType == 4 ? "air" : "sea"
}?templateId=${row.id}`
);
},
// 关闭更多阶梯价格窗口
closeMoreStepPrice(){
this.showMoreStepPriceItem=null
}
}
closeMoreStepPrice() {
this.showMoreStepPriceItem = null;
},
},
};
</script>
<template>
<div class="app-container">
<doc-alert :title="$t('代码生成')" url="https://doc.iocoder.cn/new-feature/" />
<!-- 操作工作栏 -->
<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="tableName">
<el-input v-model="queryParams.tableName" :placeholder="$t('请输入表名称')" clearable
@keyup.enter.native="handleQuery"/>
<el-input
v-model="queryParams.tableName"
:placeholder="$t('请输入表名称')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item :label="$t('表描述')" prop="tableComment">
<el-input v-model="queryParams.tableComment" :placeholder="$t('请输入表描述')" clearable
@keyup.enter.native="handleQuery"/>
<el-input
v-model="queryParams.tableComment"
:placeholder="$t('请输入表描述')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item :label="$t('创建时间')">
<el-date-picker v-model="dateRange" style="width: 240px" value-format="yyyy-MM-dd" type="daterange"
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"/>
<el-date-picker
v-model="dateRange"
style="width: 240px"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">{{ $t('搜索') }}</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">{{ $t('重置') }}</el-button>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">{{
$t("搜索")
}}</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">{{
$t("重置")
}}</el-button>
</el-form-item>
</el-form>
<!-- 操作工作栏 -->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="info" plain icon="el-icon-upload" size="mini" @click="openImportTable"
v-hasPermi="['infra:codegen:create']">基于 DB 导入</el-button>
<el-button type="info" plain icon="el-icon-upload" size="mini" @click="openImportSQL"
v-hasPermi="['infra:codegen:create']">基于 SQL 导入</el-button>
<el-button
type="info"
plain
icon="el-icon-upload"
size="mini"
@click="openImportTable"
v-hasPermi="['infra:codegen:create']"
>基于 DB 导入</el-button
>
<el-button
type="info"
plain
icon="el-icon-upload"
size="mini"
@click="openImportSQL"
v-hasPermi="['infra:codegen:create']"
>基于 SQL 导入</el-button
>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="tableList">
<el-table-column :label="$t('表名称')" align="center" prop="tableName" :show-overflow-tooltip="true" width="200"/>
<el-table-column :label="$t('表描述')" align="center" prop="tableComment" :show-overflow-tooltip="true" width="120"/>
<el-table-column :label="$t('实体')" align="center" prop="className" :show-overflow-tooltip="true" width="200"/>
<el-table-column :label="$t('创建时间')" align="center" prop="createTime" width="160">
<el-table-column
:label="$t('表名称')"
align="center"
prop="tableName"
:show-overflow-tooltip="true"
width="200"
/>
<el-table-column
:label="$t('表描述')"
align="center"
prop="tableComment"
:show-overflow-tooltip="true"
width="120"
/>
<el-table-column
:label="$t('实体')"
align="center"
prop="className"
:show-overflow-tooltip="true"
width="200"
/>
<el-table-column
:label="$t('创建时间')"
align="center"
prop="createTime"
width="160"
>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('更新时间')" align="center" prop="createTime" width="160">
<el-table-column
:label="$t('更新时间')"
align="center"
prop="createTime"
width="160"
>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
<el-table-column
:label="$t('操作')"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button type="text" size="small" icon="el-icon-view" @click="handlePreview(scope.row)" v-hasPermi="['infra:codegen:preview']">{{ $t('预览') }}</el-button>
<el-button type="text" size="small" icon="el-icon-edit" @click="handleEditTable(scope.row)" v-hasPermi="['infra:codegen:update']">{{ $t('编辑') }}</el-button>
<el-button type="text" size="small" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['infra:codegen:delete']">{{ $t('删除') }}</el-button>
<el-button type="text" size="small" icon="el-icon-refresh" @click="handleSynchDb(scope.row)" v-hasPermi="['infra:codegen:update']">{{ $t('同步') }}</el-button>
<el-button type="text" size="small" icon="el-icon-download" @click="handleGenTable(scope.row)" v-hasPermi="['infra:codegen:download']">{{ $t('生成代码') }}</el-button>
<el-button type="text" size="small" icon="el-icon-download" @click="generateValidateCode(scope.row)">{{ $t('生成验证配置') }}</el-button>
<el-button
type="text"
size="small"
icon="el-icon-view"
@click="handlePreview(scope.row)"
v-hasPermi="['infra:codegen:preview']"
>{{ $t("预览") }}</el-button
>
<el-button
type="text"
size="small"
icon="el-icon-edit"
@click="handleEditTable(scope.row)"
v-hasPermi="['infra:codegen:update']"
>{{ $t("编辑") }}</el-button
>
<el-button
type="text"
size="small"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['infra:codegen:delete']"
>{{ $t("删除") }}</el-button
>
<el-button
type="text"
size="small"
icon="el-icon-refresh"
@click="handleSynchDb(scope.row)"
v-hasPermi="['infra:codegen:update']"
>{{ $t("同步") }}</el-button
>
<el-button
type="text"
size="small"
icon="el-icon-download"
@click="handleGenTable(scope.row)"
v-hasPermi="['infra:codegen:download']"
>{{ $t("生成代码") }}</el-button
>
<el-button
type="text"
size="small"
icon="el-icon-download"
@click="generateValidateCode(scope.row)"
>{{ $t("生成验证配置") }}</el-button
>
</template>
</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"
/>
<!-- 预览界面 -->
<el-dialog :title="preview.title" :visible.sync="preview.open" width="90%" top="5vh" append-to-body class="scrollbar">
<el-dialog
:title="preview.title"
:visible.sync="preview.open"
width="90%"
top="5vh"
append-to-body
class="scrollbar"
>
<el-row>
<el-col :span="7">
<el-tree :data="preview.fileTree" :expand-on-click-node="false" default-expand-all highlight-current
@node-click="handleNodeClick"/>
<el-tree
:data="preview.fileTree"
:expand-on-click-node="false"
default-expand-all
highlight-current
@node-click="handleNodeClick"
/>
</el-col>
<el-col :span="17">
<el-tabs v-model="preview.activeName">
<el-tab-pane v-for="item in preview.data" :label="item.filePath.substring(item.filePath.lastIndexOf('/') + 1)"
:name="item.filePath" :key="item.filePath">
<el-link :underline="false" icon="el-icon-document-copy" v-clipboard:copy="item.code" v-clipboard:success="clipboardSuccess" style="float:right">{{ $t('复制') }}</el-link>
<el-tab-pane
v-for="item in preview.data"
:label="
item.filePath.substring(item.filePath.lastIndexOf('/') + 1)
"
:name="item.filePath"
:key="item.filePath"
>
<el-link
:underline="false"
icon="el-icon-document-copy"
v-clipboard:copy="item.code"
v-clipboard:success="clipboardSuccess"
style="float: right"
>{{ $t("复制") }}</el-link
>
<pre><code class="hljs" v-html="highlightedCode(item)"></code></pre>
</el-tab-pane>
</el-tabs>
......@@ -83,27 +229,53 @@
<import-table ref="import" @ok="handleQuery" />
<!-- 基于 SQL 导入 -->
<el-dialog :title="importSQL.title" :visible.sync="importSQL.open" width="800px" append-to-body>
<el-form ref="importSQLForm" :model="importSQL.form" :rules="importSQL.rules" label-width="120px">
<el-dialog
:title="importSQL.title"
:visible.sync="importSQL.open"
width="800px"
append-to-body
>
<el-form
ref="importSQLForm"
:model="importSQL.form"
:rules="importSQL.rules"
label-width="120px"
>
<el-row>
<el-col :span="12">
<el-form-item label="建表 SQL 语句" prop="sql">
<el-input v-model="importSQL.form.sql" type="textarea" rows="30" style="width: 650px;" placeholder="请输入建 SQL 语句" />
<el-input
v-model="importSQL.form.sql"
type="textarea"
rows="30"
style="width: 650px"
placeholder="请输入建 SQL 语句"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitImportSQLForm">{{ $t('确 定') }}</el-button>
<el-button @click="cancel">{{ $t('取 消') }}</el-button>
<el-button type="primary" @click="submitImportSQLForm">{{
$t("确 定")
}}</el-button>
<el-button @click="cancel">{{ $t("取 消") }}</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {getCodegenDetail, getCodegenTablePage, previewCodegen, downloadCodegen, deleteCodegen,
syncCodegenFromDB, syncCodegenFromSQL, createCodegenListFromSQL } from "@/api/infra/codegen";
import {
getCodegenDetail,
getCodegenTablePage,
previewCodegen,
downloadCodegen,
deleteCodegen,
syncCodegenFromDB,
syncCodegenFromSQL,
createCodegenListFromSQL,
} from "@/api/infra/codegen";
import importTable from "./importTable";
// 代码高亮插件
......@@ -113,7 +285,10 @@ hljs.registerLanguage("java", require("highlight.js/lib/languages/java"));
hljs.registerLanguage("xml", require("highlight.js/lib/languages/xml"));
hljs.registerLanguage("html", require("highlight.js/lib/languages/xml"));
hljs.registerLanguage("vue", require("highlight.js/lib/languages/xml"));
hljs.registerLanguage("javascript", require("highlight.js/lib/languages/javascript"));
hljs.registerLanguage(
"javascript",
require("highlight.js/lib/languages/javascript")
);
hljs.registerLanguage("sql", require("highlight.js/lib/languages/sql"));
export default {
......@@ -140,7 +315,7 @@ export default {
pageNo: 1,
pageSize: 10,
tableName: undefined,
tableComment: undefined
tableComment: undefined,
},
// 预览参数
preview: {
......@@ -154,13 +329,11 @@ export default {
importSQL: {
open: false,
title: "",
form: {
},
form: {},
rules: {
sql: [{ required: true, message: "SQL 不能为空", trigger: "blur" }]
}
}
sql: [{ required: true, message: "SQL 不能为空", trigger: "blur" }],
},
},
};
},
created() {
......@@ -177,15 +350,20 @@ export default {
/** 查询表集合 */
getList() {
this.loading = true;
getCodegenTablePage(this.addDateRange(this.queryParams, [
this.dateRange[0] ? this.dateRange[0] + ' 00:00:00' : undefined,
this.dateRange[1] ? this.dateRange[1] + ' 23:59:59' : undefined,
], 'CreateTime')).then(response => {
this.tableList = response.data.list;
this.total = response.data.total;
this.loading = false;
}
);
getCodegenTablePage(
this.addDateRange(
this.queryParams,
[
this.dateRange[0] ? this.dateRange[0] + " 00:00:00" : undefined,
this.dateRange[1] ? this.dateRange[1] + " 23:59:59" : undefined,
],
"CreateTime"
)
).then((response) => {
this.tableList = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 搜索按钮操作 */
handleQuery() {
......@@ -194,9 +372,9 @@ export default {
},
/** 生成代码操作 */
handleGenTable(row) {
downloadCodegen(row.id).then(response => {
this.$download.zip(response, 'codegen-' + row.tableName + '.zip');
})
downloadCodegen(row.id).then((response) => {
this.$download.zip(response, "codegen-" + row.tableName + ".zip");
});
},
/** 同步数据库操作 */
handleSynchDb(row) {
......@@ -208,11 +386,15 @@ export default {
}
// 基于 DB 同步
const tableName = row.tableName;
this.$modal.confirm('确认要强制同步"' + tableName + '"表结构吗?').then(function() {
this.$modal
.confirm('确认要强制同步"' + tableName + '"表结构吗?')
.then(function () {
return syncCodegenFromDB(row.id);
}).then(() => {
})
.then(() => {
this.$modal.msgSuccess("同步成功");
}).catch(() => {});
})
.catch(() => {});
},
/** 打开导入表弹窗 */
openImportTable() {
......@@ -230,11 +412,16 @@ export default {
},
/** 预览按钮 */
handlePreview(row) {
previewCodegen(row.id).then(response => {
previewCodegen(row.id).then((response) => {
this.preview.data = response.data;
let files = this.handleFiles(response.data);
this.preview.fileTree = this.handleTree(files, "id", "parentId", "children",
"/"); // "/" 为根节点
this.preview.fileTree = this.handleTree(
files,
"id",
"parentId",
"children",
"/"
); // "/" 为根节点
// console.log(this.preview.fileTree)
this.preview.activeName = response.data[0].filePath;
this.preview.open = true;
......@@ -244,12 +431,14 @@ export default {
highlightedCode(item) {
// const vmName = key.substring(key.lastIndexOf("/") + 1, key.indexOf(".vm"));
// var language = vmName.substring(vmName.indexOf(".") + 1, vmName.length);
var language = item.filePath.substring(item.filePath.lastIndexOf(".") + 1);
var language = item.filePath.substring(
item.filePath.lastIndexOf(".") + 1
);
const result = hljs.highlight(language, item.code || "", true);
return result.value || '&nbsp;';
return result.value || "&nbsp;";
},
/** 复制代码成功 */
clipboardSuccess(){
clipboardSuccess() {
this.$modal.msgSuccess("复制成功");
},
/** 生成 files 目录 **/
......@@ -258,14 +447,14 @@ export default {
let files = [];
// 遍历每个元素
for (const data of datas) {
let paths = data.filePath.split('/');
let fullPath = ''; // 从头开始的路径,用于生成 id
let paths = data.filePath.split("/");
let fullPath = ""; // 从头开始的路径,用于生成 id
// 特殊处理 java 文件
if (paths[paths.length - 1].indexOf('.java') >= 0) {
if (paths[paths.length - 1].indexOf(".java") >= 0) {
let newPaths = [];
for (let i = 0; i < paths.length; i++) {
let path = paths[i];
if (path !== 'java') {
if (path !== "java") {
newPaths.push(path);
continue;
}
......@@ -274,17 +463,19 @@ export default {
let tmp = undefined;
while (i < paths.length) {
path = paths[i + 1];
if (path === 'controller'
|| path === 'convert'
|| path === 'dal'
|| path === 'enums'
|| path === 'service'
|| path === 'vo' // 下面三个,主要是兜底。可能考虑到有人改了包结构
|| path === 'mysql'
|| path === 'dataobject') {
if (
path === "controller" ||
path === "convert" ||
path === "dal" ||
path === "enums" ||
path === "service" ||
path === "vo" || // 下面三个,主要是兜底。可能考虑到有人改了包结构
path === "mysql" ||
path === "dataobject"
) {
break;
}
tmp = tmp ? tmp + '.' + path : path;
tmp = tmp ? tmp + "." + path : path;
i++;
}
if (tmp) {
......@@ -298,7 +489,10 @@ export default {
// 已经添加到 files 中,则跳过
let oldFullPath = fullPath;
// 下面的 replaceAll 的原因,是因为上面包处理了,导致和 tabs 不匹配,所以 replaceAll 下
fullPath = fullPath.length === 0 ? paths[i] : fullPath.replaceAll('.', '/') + '/' + paths[i];
fullPath =
fullPath.length === 0
? paths[i]
: fullPath.replaceAll(".", "/") + "/" + paths[i];
if (exists[fullPath]) {
continue;
}
......@@ -307,7 +501,7 @@ export default {
files.push({
id: fullPath,
label: paths[i],
parentId: oldFullPath || '/' // "/" 为根节点
parentId: oldFullPath || "/", // "/" 为根节点
});
}
}
......@@ -329,12 +523,16 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const tableIds = row.id;
this.$modal.confirm('是否确认删除表名称为"' + row.tableName + '"的数据项?').then(function() {
this.$modal
.confirm('是否确认删除表名称为"' + row.tableName + '"的数据项?')
.then(function () {
return deleteCodegen(tableIds);
}).then(() => {
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
})
.catch(() => {});
},
// 取消按钮
cancel() {
......@@ -351,14 +549,14 @@ export default {
},
// 提交 import SQL 表单
submitImportSQLForm() {
this.$refs["importSQLForm"].validate(valid => {
this.$refs["importSQLForm"].validate((valid) => {
if (!valid) {
return;
}
// 修改的提交
let form = this.importSQL.form;
if (form.tableId != null) {
syncCodegenFromSQL(form.tableId, form.sql).then(response => {
syncCodegenFromSQL(form.tableId, form.sql).then((response) => {
this.$modal.msgSuccess("同步成功");
this.importSQL.open = false;
this.getList();
......@@ -366,41 +564,45 @@ export default {
return;
}
// 添加的提交
createCodegenListFromSQL(form).then(response => {
createCodegenListFromSQL(form).then((response) => {
this.$modal.msgSuccess("导入成功");
this.importSQL.open = false;
this.getList();
});
});
},
generateValidateCode(row){
let l = this.$loading()
getCodegenDetail(row.id).then(res => {
let rules = {}
res.data.columns.forEach(item => {
let rule = {trigger: 'blur'}
if(!item.nullable){
rule.required = true
rule.message = this.$t('不能为空')
}
if(['int', 'tinyint', 'bigint'].indexOf(item.columnType)){
rule.type = 'integer'
}
if(item.columnType.indexOf('decimal') === 0){
rule.type = 'decimal'
}
if(item.columnType == 'datetime'){
rule.type = 'date'
}
rules[item.javaField] = [rule]
generateValidateCode(row) {
let l = this.$loading();
getCodegenDetail(row.id)
.then((res) => {
let rules = {};
res.data.columns.forEach((item) => {
let rule = { trigger: "blur" };
if (!item.nullable) {
rule.required = true;
rule.message = this.$t("不能为空");
}
if (["int", "tinyint", "bigint"].indexOf(item.columnType)) {
rule.type = "integer";
}
if (item.columnType.indexOf("decimal") === 0) {
rule.type = "decimal";
}
if (item.columnType == "datetime") {
rule.type = "date";
}
rules[item.javaField] = [rule];
});
console.log(
row.tableComment + this.$t("校验规则"),
JSON.stringify(rules)
);
this.$message("规则已生成,打开控制台查看");
})
console.log(row.tableComment + this.$t('校验规则'), JSON.stringify(rules))
this.$message('规则已生成,打开控制台查看')
})
.finally(res => {
l.close()
})
.finally((res) => {
l.close();
});
},
}
},
};
</script>
<template>
<div class="app-container">
<doc-alert :title="$t('上传下载')" url="https://doc.iocoder.cn/file/" />
<!-- 搜索工作栏 -->
<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="path">
<el-input v-model="queryParams.path" :placeholder="$t('请输入文件路径')" clearable @keyup.enter.native="handleQuery"/>
<el-input
v-model="queryParams.path"
:placeholder="$t('请输入文件路径')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item :label="$t('创建时间')">
<el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd"
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" />
<el-date-picker
v-model="dateRangeCreateTime"
style="width: 240px"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">{{ $t('搜索') }}</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">{{ $t('重置') }}</el-button>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">{{
$t("搜索")
}}</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">{{
$t("重置")
}}</el-button>
</el-form-item>
</el-form>
<!-- 操作工具栏 -->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">{{ $t('上传文件') }}</el-button>
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>{{ $t("上传文件") }}</el-button
>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column :label="$t('文件名')" align="center" prop="path" />
<el-table-column label="URL" align="center" prop="url" />
<el-table-column :label="$t('文件大小')" align="center" prop="size" width="120" :formatter="sizeFormat" />
<el-table-column :label="$t('文件类型')" align="center" prop="type" width="80" />
<!-- <el-table-column :label="$t('文件内容')" align="center" prop="content">-->
<!-- <template slot-scope="scope">-->
<!-- <img v-if="scope.row.type === 'jpg' || scope.row.type === 'png' || scope.row.type === 'gif'"-->
<!-- width="200px" :src="getFileUrl + scope.row.id">-->
<!-- <i v-else>{{ $t('非图片,无法预览') }}</i>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column :label="$t('上传时间')" align="center" prop="createTime" width="180">
<el-table-column
:label="$t('文件大小')"
align="center"
prop="size"
width="120"
:formatter="sizeFormat"
/>
<el-table-column
:label="$t('文件类型')"
align="center"
prop="type"
width="80"
/>
<!-- <el-table-column :label="$t('文件内容')" align="center" prop="content">-->
<!-- <template slot-scope="scope">-->
<!-- <img v-if="scope.row.type === 'jpg' || scope.row.type === 'png' || scope.row.type === 'gif'"-->
<!-- width="200px" :src="getFileUrl + scope.row.id">-->
<!-- <i v-else>{{ $t('非图片,无法预览') }}</i>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column
:label="$t('上传时间')"
align="center"
prop="createTime"
width="180"
>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width" width="100">
<el-table-column
:label="$t('操作')"
align="center"
class-name="small-padding fixed-width"
width="100"
>
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['infra:file:delete']">{{ $t('删除') }}</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['infra:file:delete']"
>{{ $t("删除") }}</el-button
>
</template>
</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"
/>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload ref="upload" :limit="1" accept=".jpg, .png, .gif,.apk" :auto-upload="false" drag
:headers="upload.headers" :action="upload.url" :data="upload.data" :disabled="upload.isUploading"
:on-change="handleFileChange"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess">
<el-dialog
:title="upload.title"
:visible.sync="upload.open"
width="400px"
append-to-body
>
<el-upload
ref="upload"
:limit="1"
accept=".jpg, .png, .gif,.apk"
:auto-upload="false"
drag
:headers="upload.headers"
:action="upload.url"
:data="upload.data"
:disabled="upload.isUploading"
:on-change="handleFileChange"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">{{ $t('将文件拖到此处,或') }}<em>{{ $t('点击上传') }}</em>
<div class="el-upload__text">
{{ $t("将文件拖到此处,或") }}<em>{{ $t("点击上传") }}</em>
</div>
<div class="el-upload__tip" style="color: red" slot="tip">
提示:仅允许导入 jpg、png、gif 格式文件!
</div>
<div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入 jpg、png、gif 格式文件!</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>
<el-button @click="upload.open = false">{{ $t('取 消') }}</el-button>
<el-button type="primary" @click="submitFileForm">{{
$t("确 定")
}}</el-button>
<el-button @click="upload.open = false">{{ $t("取 消") }}</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { deleteFile, getFilePage } from "@/api/infra/file";
import {getToken} from "@/utils/auth";
import { getToken } from "@/utils/auth";
export default {
name: "File",
data() {
return {
getFileUrl: process.env.VUE_APP_BASE_API + '/admin-api/infra/file/get/',
getFileUrl: process.env.VUE_APP_BASE_API + "/admin-api/infra/file/get/",
// 遮罩层
loading: true,
// 显示搜索条件
......@@ -108,7 +190,7 @@ export default {
isUploading: false, // 是否禁用上传
url: process.env.VUE_APP_BASE_API + "/admin-api/infra/file/upload", // 请求地址
headers: { Authorization: "Bearer " + getToken() }, // 设置上传的请求头部
data: {} // 上传的额外数据,用于文件名
data: {}, // 上传的额外数据,用于文件名
},
};
},
......@@ -120,10 +202,10 @@ export default {
getList() {
this.loading = true;
// 处理查询参数
let params = {...this.queryParams};
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
let params = { ...this.queryParams };
this.addBeginAndEndTime(params, this.dateRangeCreateTime, "createTime");
// 执行查询
getFilePage(params).then(response => {
getFilePage(params).then((response) => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
......@@ -182,22 +264,26 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm('是否确认删除文件编号为"' + id + '"的数据项?').then(function() {
return deleteFile(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
this.$modal
.confirm('是否确认删除文件编号为"' + id + '"的数据项?')
.then(function () {
return deleteFile(id);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
// 用户昵称展示
sizeFormat(row, column) {
const unitArr = ["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"];
const unitArr = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
const srcSize = parseFloat(row.size);
const index = Math.floor(Math.log(srcSize) / Math.log(1024));
let size =srcSize/Math.pow(1024,index);
size = size.toFixed(2);//保留的小数位数
return size + ' ' + unitArr[index];
let size = srcSize / Math.pow(1024, index);
size = size.toFixed(2); //保留的小数位数
return size + " " + unitArr[index];
},
}
},
};
</script>
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