项目初始化
This commit is contained in:
401
ruoyi-ui/src/views/bas/containerDetails/index.vue
Normal file
401
ruoyi-ui/src/views/bas/containerDetails/index.vue
Normal file
@@ -0,0 +1,401 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<!-- Container ID -->
|
||||
<el-form-item label="容器编号" prop="containerId">
|
||||
<el-input
|
||||
v-model="queryParams.containerId"
|
||||
placeholder="请输入容器编号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- Product ID -->
|
||||
<el-form-item label="物料编号" prop="productId">
|
||||
<el-input
|
||||
v-model="queryParams.productId"
|
||||
placeholder="请输入物料编号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- Product Name -->
|
||||
<el-form-item label="物料名称" prop="productName">
|
||||
<el-input
|
||||
v-model="queryParams.productName"
|
||||
placeholder="请输入物料名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- 数量 -->
|
||||
<!-- <el-form-item :label="$t('bas_ContainerManagement.quantity')" prop="quantity">
|
||||
<el-input
|
||||
v-model="queryParams.quantity"
|
||||
:placeholder="$t('bas_ContainerManagement.placeholderQuantity')"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item> -->
|
||||
<!-- 单位 -->
|
||||
<!-- <el-form-item :label="$t('bas_ContainerManagement.unit')" prop="unit">
|
||||
<el-input
|
||||
v-model="queryParams.unit"
|
||||
:placeholder="$t('bas_ContainerManagement.placeholderUnit')"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="备用" prop="spare1">
|
||||
<el-input
|
||||
v-model="queryParams.spare1"
|
||||
:placeholder="请输入备用"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="备用" prop="spare2">
|
||||
<el-input
|
||||
v-model="queryParams.spare2"
|
||||
:placeholder="请输入备用"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="备用" prop="spare3">
|
||||
<el-input
|
||||
v-model="queryParams.spare3"
|
||||
:placeholder="请输入备用"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item> -->
|
||||
<el-form-item>
|
||||
<!-- Search button -->
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<!-- Reset 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">
|
||||
<!-- Add button -->
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['bas:containerDetails:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<!-- Edit button -->
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['bas:containerDetails:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<!-- Delete button -->
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['bas:containerDetails:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<!-- Export button -->
|
||||
<!-- <el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['bas:containerDetails:export']"
|
||||
>{{ $t('bas_ContainerManagement.btnExport') }}</el-button> -->
|
||||
<!-- Close button -->
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-close"
|
||||
size="mini"
|
||||
@click="handleClose"
|
||||
>关闭</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="containerDetailsList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<!-- ID -->
|
||||
<el-table-column width="120" label="ID" align="left" prop="id" />
|
||||
<!-- Container ID -->
|
||||
<el-table-column width="120" label="容器编号" align="left" prop="containerId" />
|
||||
<!-- Product ID -->
|
||||
<el-table-column width="120" label="物料编号" align="left" prop="productId" />
|
||||
<!-- Product Name -->
|
||||
<el-table-column width="120" label="物料名称" align="left" prop="productName" />
|
||||
<!-- Quantity -->
|
||||
<el-table-column width="120" label="数量" align="right" prop="quantity" />
|
||||
<!-- Unit -->
|
||||
<el-table-column width="120" label="单位" align="left" prop="unit" />
|
||||
<!-- Operations -->
|
||||
<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="['bas:containerDetails:edit']"
|
||||
>修改</el-button>
|
||||
<!-- Delete button -->
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['bas:containerDetails:remove']"
|
||||
>删除</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"
|
||||
/>
|
||||
|
||||
<!-- Add or Edit Container Details Dialog -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||
<!-- Container ID -->
|
||||
<el-form-item label="容器编号" prop="containerId">
|
||||
<el-input v-model="form.containerId" placeholder="请输入容器编号" disabled/>
|
||||
</el-form-item>
|
||||
<!-- Product ID -->
|
||||
<el-form-item label="物料编号" prop="productId">
|
||||
<el-input v-model="form.productId" placeholder="请输入物料编号" />
|
||||
</el-form-item>
|
||||
<!-- Product Name -->
|
||||
<el-form-item label="物料名称" prop="productName">
|
||||
<el-input v-model="form.productName" placeholder="请输入物料名称" />
|
||||
</el-form-item>
|
||||
<!-- Quantity -->
|
||||
<el-form-item label="数量" prop="quantity">
|
||||
<el-input v-model="form.quantity" placeholder="请输入数量" />
|
||||
</el-form-item>
|
||||
<!-- Unit -->
|
||||
<el-form-item label="单位" prop="unit">
|
||||
<el-input v-model="form.unit" placeholder="请输入单位" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item :label="备用" prop="spare1">
|
||||
<el-input v-model="form.spare1" :placeholder="请输入备用" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="备用" prop="spare2">
|
||||
<el-input v-model="form.spare2" :placeholder="请输入备用" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="备用" prop="spare3">
|
||||
<el-input v-model="form.spare3" :placeholder="请输入备用" />
|
||||
</el-form-item> -->
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<!-- OK button -->
|
||||
<el-button type="primary" @click="submitForm">确定</el-button>
|
||||
<!-- Cancel button -->
|
||||
<el-button @click="cancel">取消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listContainerDetails, getContainerDetails, delContainerDetails, addContainerDetails, updateContainerDetails } from "@/api/bas/containerDetails"
|
||||
|
||||
export default {
|
||||
name: "ContainerDetails",
|
||||
data() {
|
||||
return {
|
||||
// Loading overlay
|
||||
loading: true,
|
||||
// Selected IDs
|
||||
ids: [],
|
||||
// Single selection disabled
|
||||
single: true,
|
||||
// Multiple selection disabled
|
||||
multiple: true,
|
||||
// Show search conditions
|
||||
showSearch: true,
|
||||
// Total count
|
||||
total: 0,
|
||||
// Container details table data
|
||||
containerDetailsList: [],
|
||||
// Dialog title
|
||||
title: "",
|
||||
// Show dialog
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
containerId: null,
|
||||
productId: null,
|
||||
productName: null,
|
||||
quantity: null,
|
||||
unit: null,
|
||||
spare1: null,
|
||||
spare2: null,
|
||||
spare3: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
},
|
||||
// 容器明细中的容器编号是否可更改
|
||||
containerIdIsEnabled: true
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
/** 查询容器物料明细列表 */
|
||||
// getList() {
|
||||
// this.loading = true
|
||||
// listContainerDetails(this.queryParams).then(response => {
|
||||
// this.containerDetailsList = response.rows
|
||||
// this.total = response.total
|
||||
// this.loading = false
|
||||
// })
|
||||
// },
|
||||
/** @@@ 查询某个容器物料明细列表 */
|
||||
getList() {
|
||||
const containerId = this.$route.params.containerId
|
||||
this.loading = true
|
||||
listContainerDetails(this.queryParams).then(response => {
|
||||
// console.log('1111111111111111111111')
|
||||
// console.log(response)
|
||||
this.containerDetailsList = response.rows.filter(item => item.containerId === containerId)
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false
|
||||
this.reset()
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
containerId: null,
|
||||
productId: null,
|
||||
productName: null,
|
||||
quantity: null,
|
||||
unit: null,
|
||||
spare1: null,
|
||||
spare2: null,
|
||||
spare3: null
|
||||
}
|
||||
this.resetForm("form")
|
||||
},
|
||||
// 返回按钮
|
||||
handleClose() {
|
||||
const obj = { path: "/bas/container" }
|
||||
this.$tab.closeOpenPage(obj)
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm")
|
||||
this.handleQuery()
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset()
|
||||
this.form.containerId = this.$route.params.containerId
|
||||
this.open = true
|
||||
// Title: Add Container Details
|
||||
this.title = "新增容器明细"
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset()
|
||||
const id = row.id || this.ids
|
||||
getContainerDetails(id).then(response => {
|
||||
this.form = response.data
|
||||
this.open = true
|
||||
// Title: Edit Container Details
|
||||
this.title = "修改容器明细"
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateContainerDetails(this.form).then(response => {
|
||||
// Success message: Modified successfully
|
||||
this.$modal.msgSuccess("修改成功")
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
} else {
|
||||
addContainerDetails(this.form).then(response => {
|
||||
// Success message: Added successfully
|
||||
this.$modal.msgSuccess("添加成功")
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids
|
||||
// Confirmation message: Are you sure you want to delete the container details with ID "ids"?
|
||||
this.$modal.confirm('是否确认删除容器明细编号为"' + ids + '"的数据?').then(function() {
|
||||
return delContainerDetails(ids)
|
||||
}).then(() => {
|
||||
this.getList()
|
||||
// Success message: Deleted successfully
|
||||
this.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => {})
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('bas/containerDetails/export', {
|
||||
...this.queryParams
|
||||
}, `containerDetails_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user