You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

658 lines
18 KiB

<template>
<basic-container>
<avue-crud :option="option"
v-model:search="search"
v-model:page="page"
v-model="form"
:table-loading="loading"
:data="data"
:permission="permissionList"
:before-open="beforeOpen"
ref="crud"
@row-update="rowUpdate"
@row-save="rowSave"
@row-del="rowDel"
@search-change="searchChange"
@search-reset="searchReset"
@selection-change="selectionChange"
@current-change="currentChange"
@size-change="sizeChange"
@refresh-change="refreshChange"
@on-load="onLoad">
<template #menu-left>
<el-button type="danger"
icon="el-icon-delete"
plain
v-if="permission.basicdataFreight_delete"
@click="handleDelete">
</el-button>
<!-- <el-button type="warning"-->
<!-- plain-->
<!-- icon="el-icon-download"-->
<!-- @click="handleExport"> -->
<!-- </el-button>-->
</template>
</avue-crud>
</basic-container>
</template>
<script>
import {getList, getDetail, add, update, remove} from "@/api/basicdata/basicdataFreight";
// import option from "@/option/basicdata/basicdataFreight";
import {mapGetters} from "vuex";
import {exportBlob} from "@/api/common";
import {getToken} from '@/utils/auth';
import {downloadXls} from "@/utils/util";
import {dateNow} from "@/utils/date";
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
export default {
data() {
return {
form: {},
query: {},
search: {},
loading: true,
page: {
pageSize: 10,
currentPage: 1,
total: 0
},
selectionList: [],
option: {
height:'auto',
calcHeight: 30,
labelWidth:120,
tip: false,
searchShow: true,
searchMenuSpan: 7,
indexLabel: '序号',
indexWidth: '100',
align:'center',
border: true,
indexFixed: false,
index: true,
width: '100%',
viewBtn: true,
selection: true,
dialogClickModal: false,
column: [
{
label: "租户号",
prop: "tenantId",
type: "input",
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: "创建人",
prop: "createUser",
type: "input",
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: "创建时间",
prop: "createTime",
type: "input",
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: "更新人",
prop: "updateUser",
type: "input",
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: "更新时间",
prop: "updateTime",
type: "input",
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: "状态",
prop: "status",
type: "input",
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: "是否已删除",
prop: "isDeleted",
type: "input",
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: "创建部门",
prop: "createDept",
type: "input",
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: "主键",
prop: "id",
type: "input",
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: "预留1",
prop: "reserve1",
type: "input",
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: "预留2",
prop: "reserve2",
type: "input",
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: "预留3",
prop: "reserve3",
type: "input",
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: "预留4",
prop: "reserve4",
type: "input",
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: "预留5",
prop: "reserve5",
type: "input",
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: "计算方式", //;1件 2方 3公斤
prop: "formulaMode",
type: "select",
dicUrl: "/api/blade-system/dict-biz/dictionary?code=basic_freight_formulamode",
width:"100px",
span:12,
props: {
label: "dictValue",
value: "dictKey"
},
search: true,
},
{
label: "物品名称",
prop: "itemName",
type: "input",
width:"150px",
span:12,
},
{
label: "门店品牌",
prop: "storeBrandId",
type: "select",
width:"150px",
span:12,
allowCreate: true,
filterable: true,
dicUrl: "/api/logpm-basicdata/basicdataZonePrice/listName?name={{key}}",
props: {
label: 'brandName',
value: 'id'
},
change: (val) => {
// console.log(">>>>",val);
// let dic = val.dic;
if(!!val.value){
let d = [];
let a = [];
val.dic.forEach(i =>{
let dataZhi = {
label: i.brandName,
value: i.brand
}
let data = {
label: i.name,
value: i.goalGranary
}
d.push(dataZhi);
a.push(data);
})
// this.selectionChange();
// console.log(",.,.",this.option.column[26]);
this.fuzhi(d,a);
}
},
},
{
label: "运费",
prop: "freight",
type: "input",
},
{
label: "送货费用",
prop: "deliveryExpense",
type: "input",
width:"150px",
span:12,
},
{
label: "提货费用",
prop: "deliveryCharge",
type: "input",
width:"150px",
span:12,
},
{
label: "仓库管理费用",
prop: "warehouseOverhead",
type: "input",
width:"150px",
span:12,
},
{
label: "仓储费用",
prop: "storageCharge",
type: "input",
width:"150px",
span:12,
},
{
label: "装卸费用",
prop: "terminalCharges",
type: "input",
width:"150px",
span:12,
},
{
label: "其他费用",
prop: "otherCharges",
type: "input",
width:"150px",
span:12,
},
{
label: "末端仓",
prop: "singleColon",
type: "select",
width:"150px",
span:12,
search: true,
allowCreate: true,
filterable: true,
dicUrl: "/api/logpm-basicdata/warehouse/listName?code={{key}}",
props: {
label: 'name',
value: 'id',
}
},
{
label: "发货单位",
prop: "forwardingUnit",
type: "input",
width:"150px",
span:12,
search: true,
},
{
label: "门店",
prop: "shop",
type: "select",
search: true,
dicData: [],
},
{
label: "品牌",
prop: "brand",
type: "select",
search: true,
dicData: [],
},
{
label: "服务类型", //;1 干 2干仓 3干仓配 4干配
prop: "typeService",
type: "select",
width:"150px",
span:12,
dicUrl: "/api/blade-system/dict-biz/dictionary?code=basic_freight_type",
props: {
label: "dictValue",
value: "dictKey"
},
search: true,
},
{
label: "结算方", //;1 商场 2工厂
prop: "clearingForm",
type: "select",
dicUrl: "/api/blade-system/dict-biz/dictionary?code=basic_freight_clearingform",
props: {
label: "dictValue",
value: "dictKey"
},
search: true,
},
{
label: "一级品类",
prop: "firstClassCategory",
type: "input",
width:"150px",
span:12,
},
{
label: "一口价",
prop: "fixedPrice",
type: "input",
width:"150px",
span:12,
},
{
label: "干线费用",
prop: "trunkCharge",
type: "input",
width:"150px",
span:12,
},
{
label: "生效时间",
prop: "effectiveTime",
type: "datetime",
width:"150px",
span:12,
format:'YYYY-MM-DD HH:mm:ss',
valueFormat:'YYYY-MM-DD HH:mm:ss'
},
{
label: "截至时间",
prop: "expirationTime",
type: "datetime",
width:"150px",
span:12,
format:'YYYY-MM-DD HH:mm:ss',
valueFormat:'YYYY-MM-DD HH:mm:ss'
},
// {
// label: "类型",
// prop: "type",
// type: "input",
// },
// {
// label: "标识",
// prop: "identification",
// type: "input",
//
// },
{
label: "时间段", //;1 0-30天 2 0-60天 3 60天以上
prop: "warehousingTimeCharge",
type: "select",
width:"150px",
span:12,
dicUrl: "/api/blade-system/dict-biz/dictionary?code=basic_freight_timecharge",
props: {
label: "dictValue",
value: "dictKey"
},
search: true,
},
{
label: "时间段费用",
prop: "warehousingTimeStatus",
type: "input",
width:"150px",
span:12,
},
]
},
data: []
};
},
created() {
},
computed: {
...mapGetters(["permission"]),
permissionList() {
return {
addBtn: this.validData(this.permission.basicdataFreight_add, false),
viewBtn: this.validData(this.permission.basicdataFreight_view, false),
delBtn: this.validData(this.permission.basicdataFreight_delete, false),
editBtn: this.validData(this.permission.basicdataFreight_edit, false)
};
},
ids() {
let ids = [];
this.selectionList.forEach(ele => {
ids.push(ele.id);
});
return ids.join(",");
}
},
methods: {
fuzhi(led,ed){
console.log(">>>>",led);
this.option.column[26].dicData = led;
this.option.column[26].value = led[0].value;
this.option.column[27].dicData = ed;
this.option.column[27].value = ed[0].value;
this.form.shop= led[0].value;
this.form.brand= ed[0].value;
},
rowSave(row, done, loading) {
add(row).then(() => {
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
done();
}, error => {
loading();
window.console.log(error);
});
},
rowUpdate(row, index, done, loading) {
update(row).then(() => {
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
done();
}, error => {
loading();
console.log(error);
});
},
rowDel(row) {
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
return remove(row.id);
})
.then(() => {
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
});
},
handleDelete() {
if (this.selectionList.length === 0) {
this.$message.warning("请选择至少一条数据");
return;
}
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
return remove(this.ids);
})
.then(() => {
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
this.$refs.crud.toggleSelection();
});
},
handleExport() {
let downloadUrl = `/blade-basicdataFreight/basicdataFreight/export-basicdataFreight?${this.website.tokenHeader}=${getToken()}`;
const {
formulaMode,
singleColon,
forwardingUnit,
shop,
brand,
typeService,
clearingForm,
warehousingTimeCharge,
} = this.query;
let values = {
formulaMode_equal: formulaMode,
singleColon_like: singleColon,
forwardingUnit_like: forwardingUnit,
shop_like: shop,
brand_like: brand,
typeService_equal: typeService,
clearingForm_equal: clearingForm,
warehousingTimeCharge_: warehousingTimeCharge,
};
this.$confirm("是否导出数据?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
NProgress.start();
exportBlob(downloadUrl, values).then(res => {
downloadXls(res.data, `基础价格记录表${dateNow()}.xlsx`);
NProgress.done();
})
});
},
beforeOpen(done, type) {
if (["edit", "view"].includes(type)) {
getDetail(this.form.id).then(res => {
this.form = res.data.data;
});
}
done();
},
searchReset() {
this.query = {};
this.onLoad(this.page);
},
searchChange(params, done) {
console.log(">>>>>>>>",params,done);
this.query = params;
this.page.currentPage = 1;
this.onLoad(this.page, params);
done();
},
selectionChange(list) {
console.log('执行了》》》》》》',list);
this.selectionList = list;
},
selectionClear() {
this.selectionList = [];
this.$refs.crud.toggleSelection();
},
currentChange(currentPage){
this.page.currentPage = currentPage;
},
sizeChange(pageSize){
this.page.pageSize = pageSize;
},
refreshChange() {
this.onLoad(this.page, this.query);
},
onLoad(page, params = {}) {
this.loading = true;
const {
formulaMode,
singleColon,
forwardingUnit,
shop,
brand,
typeService,
clearingForm,
warehousingTimeCharge,
} = this.query;
let values = {
formulaMode_equal: formulaMode,
singleColon_like: singleColon,
forwardingUnit_like: forwardingUnit,
shop_like: shop,
brand_like: brand,
typeService_equal: typeService,
clearingForm_equal: clearingForm,
warehousingTimeCharge_: warehousingTimeCharge,
};
getList(page.currentPage, page.pageSize, values).then(res => {
const data = res.data.data;
this.page.total = data.total;
this.data = data.records;
this.loading = false;
this.selectionClear();
});
}
}
};
</script>
<style>
</style>