feat(oa): add arrival detail management module
实现到货明细的增删改查、列表查询、状态管理以及发货流程,包含搜索筛选、弹窗表单、批量操作和数据导出功能
This commit is contained in:
44
ruoyi-ui/src/api/oa/arrivalDetail.js
Normal file
44
ruoyi-ui/src/api/oa/arrivalDetail.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询到货明细列表
|
||||
export function listArrivalDetail(query) {
|
||||
return request({
|
||||
url: '/oa/arrivalDetail/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询到货明细详细
|
||||
export function getArrivalDetail(detailId) {
|
||||
return request({
|
||||
url: '/oa/arrivalDetail/' + detailId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增到货明细
|
||||
export function addArrivalDetail(data) {
|
||||
return request({
|
||||
url: '/oa/arrivalDetail',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改到货明细
|
||||
export function updateArrivalDetail(data) {
|
||||
return request({
|
||||
url: '/oa/arrivalDetail',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除到货明细
|
||||
export function delArrivalDetail(detailId) {
|
||||
return request({
|
||||
url: '/oa/arrivalDetail/' + detailId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
464
ruoyi-ui/src/views/oa/arrivalDetail/index.vue
Normal file
464
ruoyi-ui/src/views/oa/arrivalDetail/index.vue
Normal file
@@ -0,0 +1,464 @@
|
||||
<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="requirementId">
|
||||
<el-select v-model="queryParams.requirementId" placeholder="请选择采购需求, 输入关键字搜索" filterable remote
|
||||
:remote-method="loadRequirementOptions" :loading="requirementLoading" clearable style="width: 200px">
|
||||
<el-option v-for="r in requirementOptions" :key="r.requirementId" :label="r.title" :value="r.requirementId">
|
||||
<span style="float: left">{{ r.title }}</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 12px">{{ r.projectName || '无项目' }}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="关联项目" prop="projectId">
|
||||
<project-select v-model="queryParams.projectId" style="width: 200px" @change="onQueryProjectChange" />
|
||||
</el-form-item>
|
||||
<el-form-item label="合同编号" prop="contractNo">
|
||||
<el-input v-model="queryParams.contractNo" placeholder="请输入合同编号" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="物料名称" prop="goodsName">
|
||||
<el-input v-model="queryParams.goodsName" placeholder="请输入物料名称" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="queryParams.description" placeholder="请输入描述" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="内贸/外贸" prop="tradeType">
|
||||
<el-select v-model="queryParams.tradeType" placeholder="请选择" clearable style="width: 100px">
|
||||
<el-option label="内贸" :value="0" />
|
||||
<el-option label="外贸" :value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="发货地点" prop="sourceAddress">
|
||||
<el-input v-model="queryParams.sourceAddress" placeholder="请输入发货地点" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="规划目的地" prop="targetAddress">
|
||||
<el-input v-model="queryParams.targetAddress" placeholder="请输入规划目的地" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
</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-table v-loading="loading" :data="arrivalDetailList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="采购需求" align="center" min-width="160" show-overflow-tooltip>
|
||||
<template slot-scope="{ row }">
|
||||
<span>{{ (row.requirement && row.requirement.title) || row.requirementId }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="关联项目" align="center" min-width="160" show-overflow-tooltip>
|
||||
<template slot-scope="{ row }">
|
||||
<span>{{ (row.project && row.project.projectName) || row.projectId }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="项目类型" align="center" width="80">
|
||||
<template slot-scope="{ row }">
|
||||
<el-tag :type="row.tradeType === 0 ? '' : 'warning'" size="small">{{ row.tradeType === 0 ? '内贸' : '外贸'
|
||||
}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="合同编号" align="center" prop="contractNo" />
|
||||
<el-table-column label="物料名称" align="center" prop="goodsName" />
|
||||
<el-table-column label="数量" align="center" prop="quantity" />
|
||||
<el-table-column label="单价" align="center" prop="unitPrice" />
|
||||
<el-table-column label="描述" align="center" prop="description" />
|
||||
<el-table-column label="到货类型" align="center" prop="arrivalType" width="80">
|
||||
<template slot-scope="{ row }">
|
||||
<el-tag :type="row.arrivalType === 0 ? 'success' : 'warning'" size="small">{{ row.arrivalType === 0 ? '收' :
|
||||
'发' }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="到货截止日期" align="center" prop="deadline" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.deadline, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="发货地点" align="center" prop="sourceAddress" />
|
||||
<el-table-column label="规划目的地" align="center" prop="targetAddress" />
|
||||
<el-table-column label="状态" align="center" prop="detailStatus" width="140">
|
||||
<template slot-scope="{ row }">
|
||||
<el-select v-model="row.detailStatus" size="mini" placeholder="选择状态"
|
||||
@change="val => onDetailStatusChange(row, val)">
|
||||
<el-option v-for="opt in statusOptions" :key="opt.value" :label="opt.label" :value="opt.value" />
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-truck" style="color:#409eff"
|
||||
v-if="scope.row.arrivalType === 0" @click="handleShip(scope.row)">发货</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<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="requirementId">
|
||||
<el-select v-model="form.requirementId" placeholder="请选择采购需求, 输入关键字搜索" filterable remote
|
||||
:remote-method="loadRequirementOptions" :loading="requirementLoading" clearable style="width: 100%"
|
||||
@change="onRequirementChange">
|
||||
<el-option v-for="r in requirementOptions" :key="r.requirementId" :label="r.title" :value="r.requirementId">
|
||||
<span style="float: left">{{ r.title }}</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 12px">{{ r.projectName || '无项目' }}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="关联项目" prop="projectId">
|
||||
<project-select v-model="form.projectId" style="width: 100%" @change="onFormProjectChange" />
|
||||
</el-form-item>
|
||||
<el-form-item label="内贸/外贸" prop="tradeType">
|
||||
<el-select v-model="form.tradeType" placeholder="请选择" style="width: 100%">
|
||||
<el-option label="内贸" :value="0" />
|
||||
<el-option label="外贸" :value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="合同编号" prop="contractNo">
|
||||
<el-input v-model="form.contractNo" placeholder="请输入合同编号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="物料名称" prop="goodsName">
|
||||
<el-input v-model="form.goodsName" placeholder="请输入物料名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="数量" prop="quantity">
|
||||
<el-input v-model="form.quantity" placeholder="请输入数量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单价" prop="unitPrice">
|
||||
<el-input v-model="form.unitPrice" placeholder="请输入单价" />
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="form.description" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="到货截止日期" prop="deadline">
|
||||
<el-date-picker clearable v-model="form.deadline" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="请选择到货截止日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="发货地点" prop="sourceAddress">
|
||||
<el-input v-model="form.sourceAddress" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="规划目的地" prop="targetAddress" v-if="form.detailId">
|
||||
<el-input v-model="form.targetAddress" 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>
|
||||
|
||||
<!-- 发货对话框 -->
|
||||
<el-dialog :title="'发货 - ' + shipRow.goodsName" :visible.sync="shipOpen" width="400px" append-to-body>
|
||||
<el-form ref="shipForm" :model="shipForm" :rules="shipRules" label-width="100px">
|
||||
<el-form-item label="规划目的地" prop="targetAddress">
|
||||
<el-input v-model="shipForm.targetAddress" type="textarea" placeholder="请输入规划目的地" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitShip">确 定</el-button>
|
||||
<el-button @click="shipOpen = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listArrivalDetail, getArrivalDetail, delArrivalDetail, addArrivalDetail, updateArrivalDetail } from "@/api/oa/arrivalDetail";
|
||||
import { listRequirements } from "@/api/oa/requirement";
|
||||
import ProjectSelect from "@/components/fad-service/ProjectSelect";
|
||||
|
||||
export default {
|
||||
name: "ArrivalDetail",
|
||||
components: { ProjectSelect },
|
||||
data() {
|
||||
return {
|
||||
// 按钮loading
|
||||
buttonLoading: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 到货明细表格数据
|
||||
arrivalDetailList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 发货弹窗
|
||||
shipOpen: false,
|
||||
shipRow: {},
|
||||
shipForm: {},
|
||||
shipRules: {
|
||||
targetAddress: [
|
||||
{ required: true, message: "规划目的地不能为空", trigger: "blur" }
|
||||
]
|
||||
},
|
||||
// 需求下拉选项
|
||||
requirementOptions: [],
|
||||
requirementLoading: false,
|
||||
// 状态选项
|
||||
statusOptions: [
|
||||
{ value: 0, label: '待发货' },
|
||||
{ value: 1, label: '运输中' },
|
||||
{ value: 2, label: '已到货' },
|
||||
{ value: 3, label: '异常/拒收' },
|
||||
{ value: 4, label: '取消' },
|
||||
],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
requirementId: undefined,
|
||||
projectId: undefined,
|
||||
tradeType: undefined,
|
||||
contractNo: undefined,
|
||||
goodsName: undefined,
|
||||
quantity: undefined,
|
||||
unitPrice: undefined,
|
||||
arrivalType: undefined,
|
||||
deadline: undefined,
|
||||
sourceAddress: undefined,
|
||||
targetAddress: undefined,
|
||||
detailStatus: undefined,
|
||||
description: undefined,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.loadRequirementOptions();
|
||||
},
|
||||
methods: {
|
||||
/** 查询到货明细列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listArrivalDetail(this.queryParams).then(response => {
|
||||
this.arrivalDetailList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 远程搜索采购需求 */
|
||||
loadRequirementOptions(keyword) {
|
||||
this.requirementLoading = true;
|
||||
listRequirements({ pageNum: 1, pageSize: 20, title: keyword || undefined }).then(res => {
|
||||
this.requirementOptions = res.rows || [];
|
||||
}).finally(() => {
|
||||
this.requirementLoading = false;
|
||||
});
|
||||
},
|
||||
/** 选中需求后自动填充关联项目 */
|
||||
onRequirementChange(requirementId) {
|
||||
if (!requirementId) return;
|
||||
const r = this.requirementOptions.find(x => x.requirementId === requirementId);
|
||||
if (r && r.projectId && !this.form.projectId) {
|
||||
this.form.projectId = r.projectId;
|
||||
}
|
||||
},
|
||||
/** 搜索表单选择项目后自动填充内外贸类型 */
|
||||
onQueryProjectChange(val, selectedProject) {
|
||||
if (selectedProject) {
|
||||
this.queryParams.tradeType = selectedProject.tradeType;
|
||||
} else {
|
||||
this.queryParams.tradeType = undefined;
|
||||
}
|
||||
},
|
||||
/** 弹窗表单选择项目后自动填充内外贸类型 */
|
||||
onFormProjectChange(val, selectedProject) {
|
||||
if (selectedProject) {
|
||||
this.form.tradeType = selectedProject.tradeType;
|
||||
} else {
|
||||
this.form.tradeType = undefined;
|
||||
}
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
detailId: undefined,
|
||||
requirementId: undefined,
|
||||
projectId: undefined,
|
||||
tradeType: undefined,
|
||||
contractNo: undefined,
|
||||
goodsName: undefined,
|
||||
quantity: undefined,
|
||||
unitPrice: undefined,
|
||||
arrivalType: undefined,
|
||||
deadline: undefined,
|
||||
sourceAddress: undefined,
|
||||
targetAddress: undefined,
|
||||
detailStatus: undefined,
|
||||
description: undefined,
|
||||
remark: undefined,
|
||||
createBy: undefined,
|
||||
createTime: undefined,
|
||||
updateBy: undefined,
|
||||
updateTime: undefined,
|
||||
delFlag: undefined
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.detailId)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.form.arrivalType = 0;
|
||||
this.form.detailStatus = 0;
|
||||
this.open = true;
|
||||
this.title = "添加到货明细";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.loading = true;
|
||||
this.reset();
|
||||
const detailId = row.detailId || this.ids
|
||||
getArrivalDetail(detailId).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.detailId != null) {
|
||||
updateArrivalDetail(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addArrivalDetail(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const detailIds = row.detailId || this.ids;
|
||||
this.$modal.confirm('是否确认删除到货明细编号为"' + detailIds + '"的数据项?').then(() => {
|
||||
this.loading = true;
|
||||
return delArrivalDetail(detailIds);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 表格内状态快捷修改 */
|
||||
onDetailStatusChange(row, newVal) {
|
||||
row.detailStatus = Number(newVal);
|
||||
updateArrivalDetail(row).then(() => {
|
||||
this.$message.success(`状态已更新为「${this.statusLabel(newVal)}」`);
|
||||
});
|
||||
},
|
||||
statusLabel(val) {
|
||||
const m = { 0: '待发货', 1: '运输中', 2: '已到货', 3: '异常/拒收', 4: '取消' };
|
||||
return m[val] ?? String(val);
|
||||
},
|
||||
/** 发货按钮操作 */
|
||||
handleShip(row) {
|
||||
this.shipRow = row;
|
||||
this.shipForm = { targetAddress: row.targetAddress || '' };
|
||||
this.shipOpen = true;
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.shipForm) this.$refs.shipForm.clearValidate();
|
||||
});
|
||||
},
|
||||
/** 提交发货 */
|
||||
submitShip() {
|
||||
this.$refs["shipForm"].validate(valid => {
|
||||
if (valid) {
|
||||
const row = this.shipRow;
|
||||
row.arrivalType = 1;
|
||||
row.targetAddress = this.shipForm.targetAddress;
|
||||
updateArrivalDetail(row).then(() => {
|
||||
this.$modal.msgSuccess("发货成功");
|
||||
this.shipOpen = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('oa/arrivalDetail/export', {
|
||||
...this.queryParams
|
||||
}, `arrivalDetail_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user