Commit e985c82d authored by yanghao's avatar yanghao

feature:添加重泡货配置功能

parent ed7cc8a0
import request from '@/utils/request'
// 创建重泡货配置
export function createZhongPao(data) {
return request({
url: '/ecw/zhong-pao/create',
method: 'post',
data: data
})
}
// 更新重泡货配置
export function updateZhongPao(data) {
return request({
url: '/ecw/zhong-pao/update',
method: 'put',
data: data
})
}
// 获得重泡货配置
export function getZhongPao(id) {
return request({
url: '/ecw/zhong-pao/get?id=' + id,
method: 'get'
})
}
// 获得重泡货配置分页
export function getZhongPaoPage(query) {
return request({
url: '/ecw/zhong-pao/page',
method: 'get',
params: query
})
}
// 导出重泡货配置 Excel
export function exportZhongPaoExcel(query) {
return request({
url: '/ecw/zhong-pao/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
<template>
<div class="app-container">
<!-- (添加 / 修改) -->
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="泡货配置" prop="paoLinjie">
临界值:每CBM小于<el-input v-model="form.paoLinjie" placeholder="请输入泡货临界值" />Kg属于泡货
</el-form-item>
<el-form-item label="计算公式" prop="paoGs">
泡货重量(Kg)= 实际体积(CBM)X <el-input v-model="form.paoGs" placeholder="请输入泡货公式" />
</el-form-item>
<el-form-item label="货运方式" prop="paoYsIds">
<el-input v-model="form.paoYsIds" placeholder="请输入泡货货运方式ids" />
</el-form-item>
<el-form-item label="泡货是否开启" prop="paoIsOpen">
<el-radio-group v-model="form.paoIsOpen">
<el-radio v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)"
:key="dict.value" :label="parseInt(dict.value)">{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="重货配置" prop="zhongLinjie">
临界值:每CBM大于<el-input v-model="form.zhongLinjie" placeholder="请输入重货临界值" />Kg属于重货
</el-form-item>
<el-form-item label="计算公式" prop="zhongGs">
重货体积(CBM) = 实际重量(Kg)X<el-input v-model="form.zhongGs" placeholder="请输入重货公式" />
</el-form-item>
<el-form-item label="货运方式" prop="zhongYsIds">
<el-input v-model="form.zhongYsIds" placeholder="请输入重货货运方式ids" />
</el-form-item>
<el-form-item label="重货是否开启" prop="zhongIsOpen">
<el-radio-group v-model="form.zhongIsOpen">
<el-radio v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)"
:key="dict.value" :label="parseInt(dict.value)">{{dict.label}}</el-radio>
</el-radio-group>
</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>
</div>
</template>
<script>
import { createZhongPao, updateZhongPao, deleteZhongPao, getZhongPao, getZhongPaoPage, exportZhongPaoExcel } from "@/api/ecw/zhongPao";
export default {
name: "ZhongPao",
components: {
},
data() {
return {
// 遮罩层
loading: true,
// 导出遮罩层
exportLoading: false,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 重泡货配置列表
list: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
dateRangeCreateTime: [],
// 查询参数
queryParams: {
pageNo: 1,
pageSize: 10,
paoIsOpen: null,
zhongIsOpen: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
paoIsOpen: [{ required: true, message: "泡货是否开启不能为空", trigger: "blur" }],
zhongIsOpen: [{ required: true, message: "重货是否开启不能为空", trigger: "blur" }],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
// 处理查询参数
let params = {...this.queryParams};
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
// 执行查询
getZhongPaoPage(params).then(response => {
var list = response.data.list;
this.form = list && list.length > 0 ? list[0] : {
id: undefined,
paoLinjie: undefined,
paoGs: undefined,
paoYsIds: undefined,
paoIsOpen: undefined,
zhongLinjie: undefined,
zhongGs: undefined,
zhongYsIds: undefined,
zhongIsOpen: undefined
};
console.log(this.form);
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.getList();
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
// 修改的提交
if (this.form.id != null) {
updateZhongPao(this.form).then(response => {
this.$modal.msgSuccess("保存配置成功");
this.getList();
});
return;
}
// 添加的提交
createZhongPao(this.form).then(response => {
this.$modal.msgSuccess("保存配置成功");
this.getList();
});
});
}
}
};
</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