365 lines
10 KiB
Vue
365 lines
10 KiB
Vue
|
|
<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="planName">
|
|||
|
|
<el-input
|
|||
|
|
v-model="queryParams.planName"
|
|||
|
|
placeholder="请输入收货计划名称"
|
|||
|
|
clearable
|
|||
|
|
@keyup.enter.native="handleQuery"
|
|||
|
|
/>
|
|||
|
|
</el-form-item>
|
|||
|
|
<el-form-item label="计划日期" prop="planDate">
|
|||
|
|
<el-date-picker clearable
|
|||
|
|
v-model="queryParams.planDate"
|
|||
|
|
type="date"
|
|||
|
|
value-format="yyyy-MM-dd HH:mm:ss"
|
|||
|
|
placeholder="请选择计划日期">
|
|||
|
|
</el-date-picker>
|
|||
|
|
</el-form-item>
|
|||
|
|
<el-form-item>
|
|||
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|||
|
|
<el-button icon="el-icon-refresh" size="mini" @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"
|
|||
|
|
>新增</el-button>
|
|||
|
|
</el-col>
|
|||
|
|
<el-col :span="1.5">
|
|||
|
|
<el-button
|
|||
|
|
type="success"
|
|||
|
|
plain
|
|||
|
|
icon="el-icon-edit"
|
|||
|
|
size="mini"
|
|||
|
|
:disabled="single"
|
|||
|
|
@click="handleUpdate"
|
|||
|
|
>修改</el-button>
|
|||
|
|
</el-col>
|
|||
|
|
<el-col :span="1.5">
|
|||
|
|
<el-button
|
|||
|
|
type="danger"
|
|||
|
|
plain
|
|||
|
|
icon="el-icon-delete"
|
|||
|
|
size="mini"
|
|||
|
|
:disabled="multiple"
|
|||
|
|
@click="handleDelete"
|
|||
|
|
>删除</el-button>
|
|||
|
|
</el-col>
|
|||
|
|
<el-col :span="1.5">
|
|||
|
|
<el-button
|
|||
|
|
type="warning"
|
|||
|
|
plain
|
|||
|
|
icon="el-icon-download"
|
|||
|
|
size="mini"
|
|||
|
|
@click="handleExport"
|
|||
|
|
>导出</el-button>
|
|||
|
|
</el-col>
|
|||
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|||
|
|
</el-row>
|
|||
|
|
|
|||
|
|
<el-row :gutter="20" v-loading="loading">
|
|||
|
|
<el-col :span="6" v-for="(row, index) in deliveryPlanList" :key="row.planId">
|
|||
|
|
<el-card shadow="hover" class="delivery-plan-card">
|
|||
|
|
<div class="card-header">
|
|||
|
|
<el-checkbox v-model="row.selected" @change="handleCardSelectionChange(row)"></el-checkbox>
|
|||
|
|
<div class="card-title">{{ row.planName }}</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="card-content">
|
|||
|
|
<div class="content-item">
|
|||
|
|
<span class="label">计划日期:</span>
|
|||
|
|
<span>{{ parseTime(row.planDate, '{y}-{m}-{d}') }}</span>
|
|||
|
|
</div>
|
|||
|
|
<div class="content-item">
|
|||
|
|
<span class="label">备注:</span>
|
|||
|
|
<span>{{ row.remark || '-' }}</span>
|
|||
|
|
</div>
|
|||
|
|
<div class="content-item">
|
|||
|
|
<span class="label">创建人:</span>
|
|||
|
|
<span>{{ row.createBy }}</span>
|
|||
|
|
</div>
|
|||
|
|
<div class="content-item">
|
|||
|
|
<span class="label">更新时间:</span>
|
|||
|
|
<span>{{ parseTime(row.updateTime, '{y}-{m}-{d}') }}</span>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="card-actions">
|
|||
|
|
<el-button
|
|||
|
|
size="mini"
|
|||
|
|
type="text"
|
|||
|
|
icon="el-icon-edit"
|
|||
|
|
@click="handleUpdate(row)"
|
|||
|
|
>修改</el-button>
|
|||
|
|
<el-button
|
|||
|
|
size="mini"
|
|||
|
|
type="text"
|
|||
|
|
icon="el-icon-delete"
|
|||
|
|
@click="handleDelete(row)"
|
|||
|
|
>删除</el-button>
|
|||
|
|
</div>
|
|||
|
|
</el-card>
|
|||
|
|
</el-col>
|
|||
|
|
</el-row>
|
|||
|
|
|
|||
|
|
<pagination
|
|||
|
|
v-show="total>0"
|
|||
|
|
:total="total"
|
|||
|
|
:page.sync="queryParams.pageNum"
|
|||
|
|
: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="收货计划名称" prop="planName">
|
|||
|
|
<el-input v-model="form.planName" placeholder="请输入收货计划名称" />
|
|||
|
|
</el-form-item>
|
|||
|
|
<el-form-item label="计划日期" prop="planDate">
|
|||
|
|
<el-date-picker clearable
|
|||
|
|
v-model="form.planDate"
|
|||
|
|
type="datetime"
|
|||
|
|
value-format="yyyy-MM-dd HH:mm:ss"
|
|||
|
|
placeholder="请选择计划日期">
|
|||
|
|
</el-date-picker>
|
|||
|
|
</el-form-item>
|
|||
|
|
<el-form-item label="备注" prop="remark">
|
|||
|
|
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
|||
|
|
</el-form-item>
|
|||
|
|
</el-form>
|
|||
|
|
<div slot="footer" class="dialog-footer">
|
|||
|
|
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
|||
|
|
<el-button @click="cancel">取 消</el-button>
|
|||
|
|
</div>
|
|||
|
|
</el-dialog>
|
|||
|
|
</div>
|
|||
|
|
</template>
|
|||
|
|
|
|||
|
|
<script>
|
|||
|
|
import { listDeliveryPlan, getDeliveryPlan, delDeliveryPlan, addDeliveryPlan, updateDeliveryPlan } from "@/api/wms/deliveryPlan";
|
|||
|
|
|
|||
|
|
export default {
|
|||
|
|
name: "DeliveryPlan",
|
|||
|
|
data() {
|
|||
|
|
return {
|
|||
|
|
// 按钮loading
|
|||
|
|
buttonLoading: false,
|
|||
|
|
// 遮罩层
|
|||
|
|
loading: true,
|
|||
|
|
// 选中数组
|
|||
|
|
ids: [],
|
|||
|
|
// 非单个禁用
|
|||
|
|
single: true,
|
|||
|
|
// 非多个禁用
|
|||
|
|
multiple: true,
|
|||
|
|
// 显示搜索条件
|
|||
|
|
showSearch: true,
|
|||
|
|
// 总条数
|
|||
|
|
total: 0,
|
|||
|
|
// 收货计划表格数据
|
|||
|
|
deliveryPlanList: [],
|
|||
|
|
// 弹出层标题
|
|||
|
|
title: "",
|
|||
|
|
// 是否显示弹出层
|
|||
|
|
open: false,
|
|||
|
|
// 查询参数
|
|||
|
|
queryParams: {
|
|||
|
|
pageNum: 1,
|
|||
|
|
pageSize: 10,
|
|||
|
|
planName: undefined,
|
|||
|
|
planDate: undefined,
|
|||
|
|
planType: 1
|
|||
|
|
},
|
|||
|
|
// 表单参数
|
|||
|
|
form: {},
|
|||
|
|
// 表单校验
|
|||
|
|
rules: {
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
},
|
|||
|
|
created() {
|
|||
|
|
this.getList();
|
|||
|
|
},
|
|||
|
|
methods: {
|
|||
|
|
/** 查询收货计划列表 */
|
|||
|
|
getList() {
|
|||
|
|
this.loading = true;
|
|||
|
|
listDeliveryPlan(this.queryParams).then(response => {
|
|||
|
|
this.deliveryPlanList = response.rows.map(item => ({
|
|||
|
|
...item,
|
|||
|
|
selected: false
|
|||
|
|
}));
|
|||
|
|
this.total = response.total;
|
|||
|
|
this.loading = false;
|
|||
|
|
// 重置选择状态
|
|||
|
|
this.ids = [];
|
|||
|
|
this.single = true;
|
|||
|
|
this.multiple = true;
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
// 取消按钮
|
|||
|
|
cancel() {
|
|||
|
|
this.open = false;
|
|||
|
|
this.reset();
|
|||
|
|
},
|
|||
|
|
// 表单重置
|
|||
|
|
reset() {
|
|||
|
|
this.form = {
|
|||
|
|
planId: undefined,
|
|||
|
|
planName: undefined,
|
|||
|
|
planDate: undefined,
|
|||
|
|
planType: 1,
|
|||
|
|
remark: undefined,
|
|||
|
|
delFlag: undefined,
|
|||
|
|
createTime: undefined,
|
|||
|
|
createBy: undefined,
|
|||
|
|
updateTime: undefined,
|
|||
|
|
updateBy: undefined
|
|||
|
|
};
|
|||
|
|
this.resetForm("form");
|
|||
|
|
},
|
|||
|
|
/** 搜索按钮操作 */
|
|||
|
|
handleQuery() {
|
|||
|
|
this.queryParams.pageNum = 1;
|
|||
|
|
this.getList();
|
|||
|
|
},
|
|||
|
|
/** 重置按钮操作 */
|
|||
|
|
resetQuery() {
|
|||
|
|
this.resetForm("queryForm");
|
|||
|
|
this.handleQuery();
|
|||
|
|
},
|
|||
|
|
// 卡片选择处理
|
|||
|
|
handleCardSelectionChange(row) {
|
|||
|
|
// 重新计算选中的ID数组
|
|||
|
|
this.ids = this.deliveryPlanList.filter(item => item.selected).map(item => item.planId);
|
|||
|
|
this.single = this.ids.length !== 1;
|
|||
|
|
this.multiple = !this.ids.length;
|
|||
|
|
},
|
|||
|
|
/** 新增按钮操作 */
|
|||
|
|
handleAdd() {
|
|||
|
|
// this.reset();
|
|||
|
|
// 默认选中今天的日期和时间, 格式化未yyyy-MM-dd HH:mm:ss
|
|||
|
|
this.form.planDate = new Date().toLocaleString().replace('T', ' ').replace().replace(/\//g, '-')
|
|||
|
|
// 收货计划名称格式为年-月-日命名
|
|||
|
|
this.form.planName = new Date().toLocaleDateString().replace(/\//g, '-') + '收货计划'
|
|||
|
|
// 计划类型为收货计划
|
|||
|
|
this.form.planType = 1
|
|||
|
|
this.open = true;
|
|||
|
|
this.title = "添加收货计划";
|
|||
|
|
},
|
|||
|
|
/** 修改按钮操作 */
|
|||
|
|
handleUpdate(row) {
|
|||
|
|
this.loading = true;
|
|||
|
|
this.reset();
|
|||
|
|
const planId = row.planId || this.ids
|
|||
|
|
getDeliveryPlan(planId).then(response => {
|
|||
|
|
this.loading = false;
|
|||
|
|
this.form = response.data;
|
|||
|
|
this.open = true;
|
|||
|
|
this.title = "修改收货计划";
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
/** 提交按钮 */
|
|||
|
|
submitForm() {
|
|||
|
|
this.$refs["form"].validate(valid => {
|
|||
|
|
if (valid) {
|
|||
|
|
this.buttonLoading = true;
|
|||
|
|
if (this.form.planId != null) {
|
|||
|
|
updateDeliveryPlan(this.form).then(response => {
|
|||
|
|
this.$modal.msgSuccess("修改成功");
|
|||
|
|
this.open = false;
|
|||
|
|
this.getList();
|
|||
|
|
}).finally(() => {
|
|||
|
|
this.buttonLoading = false;
|
|||
|
|
});
|
|||
|
|
} else {
|
|||
|
|
addDeliveryPlan(this.form).then(response => {
|
|||
|
|
this.$modal.msgSuccess("新增成功");
|
|||
|
|
this.open = false;
|
|||
|
|
this.getList();
|
|||
|
|
}).finally(() => {
|
|||
|
|
this.buttonLoading = false;
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
/** 删除按钮操作 */
|
|||
|
|
handleDelete(row) {
|
|||
|
|
const planIds = row.planId || this.ids;
|
|||
|
|
this.$modal.confirm('是否确认删除收货计划编号为"' + planIds + '"的数据项?').then(() => {
|
|||
|
|
this.loading = true;
|
|||
|
|
return delDeliveryPlan(planIds);
|
|||
|
|
}).then(() => {
|
|||
|
|
this.loading = false;
|
|||
|
|
this.getList();
|
|||
|
|
this.$modal.msgSuccess("删除成功");
|
|||
|
|
}).catch(() => {
|
|||
|
|
}).finally(() => {
|
|||
|
|
this.loading = false;
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
/** 导出按钮操作 */
|
|||
|
|
handleExport() {
|
|||
|
|
this.download('wms/deliveryPlan/export', {
|
|||
|
|
...this.queryParams
|
|||
|
|
}, `deliveryPlan_${new Date().getTime()}.xlsx`)
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
</script>
|
|||
|
|
|
|||
|
|
<style scoped>
|
|||
|
|
.delivery-plan-card {
|
|||
|
|
margin-bottom: 20px;
|
|||
|
|
height: 100%;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.card-header {
|
|||
|
|
display: flex;
|
|||
|
|
justify-content: space-between;
|
|||
|
|
align-items: center;
|
|||
|
|
margin-bottom: 15px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.card-title {
|
|||
|
|
font-size: 16px;
|
|||
|
|
font-weight: bold;
|
|||
|
|
color: #333;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.card-content {
|
|||
|
|
margin-bottom: 20px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.content-item {
|
|||
|
|
margin-bottom: 10px;
|
|||
|
|
display: flex;
|
|||
|
|
align-items: flex-start;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.content-item:last-child {
|
|||
|
|
margin-bottom: 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.label {
|
|||
|
|
width: 80px;
|
|||
|
|
font-weight: 500;
|
|||
|
|
color: #606266;
|
|||
|
|
margin-right: 10px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.card-actions {
|
|||
|
|
display: flex;
|
|||
|
|
justify-content: flex-end;
|
|||
|
|
gap: 10px;
|
|||
|
|
}
|
|||
|
|
</style>
|