完成解绑与绑定

This commit is contained in:
liumingxiy 2024-11-15 17:28:46 +08:00
parent 095f1ed15e
commit 0509ffee59
2 changed files with 167 additions and 31 deletions

View File

@ -42,3 +42,19 @@ export function delCtBase(ctBaseId) {
method: 'delete'
})
}
// 装箱
export function bindCtBase(boxCode, itemCode) {
return request({
url: `/wm/ctBase/bind/${boxCode}/${itemCode}`,
method: 'put'
})
}
// 拆箱
export function unbindCtBase(boxCode, itemCode) {
return request({
url: `/wm/ctBase/unbind/${boxCode}/${itemCode}`,
method: 'put'
})
}

View File

@ -26,7 +26,8 @@
size="mini"
@click="handleAdd"
v-hasPermi="['wm:ctBase:add']"
>新增</el-button>
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@ -37,7 +38,8 @@
:disabled="single"
@click="handleUpdate"
v-hasPermi="['wm:ctBase:edit']"
>修改</el-button>
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@ -48,37 +50,60 @@
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['wm:ctBase:remove']"
>删除</el-button>
>删除
</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="warning"-->
<!-- plain-->
<!-- icon="el-icon-download"-->
<!-- size="mini"-->
<!-- @click="handleExport"-->
<!-- v-hasPermi="['wm:ctBase:export']"-->
<!-- >导出</el-button>-->
<!-- </el-col>-->
<el-col :span="1.5">
<el-button
v-hasPermi="['wm:ctBase:edit']"
icon="el-icon-download"
plain
size="mini"
type="info"
@click="handleBind"
>绑定
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
v-hasPermi="['wm:ctBase:edit']"
icon="el-icon-copy-document"
plain
size="mini"
type="info"
@click="handleUnbind"
>解绑
</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="warning"-->
<!-- plain-->
<!-- icon="el-icon-download"-->
<!-- size="mini"-->
<!-- @click="handleExport"-->
<!-- v-hasPermi="['wm:ctBase:export']"-->
<!-- >导出</el-button>-->
<!-- </el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="ctBaseList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="料箱编码" align="center" prop="code" >
<el-table-column align="center" type="selection" width="55"/>
<el-table-column align="center" label="料箱编码" prop="code">
<template slot-scope="scope">
<span>{{ scope.row.code }}</span>
<span>{{ scope.row.code }}</span>
</template>
</el-table-column>
<el-table-column label="料箱状态" align="center" prop="type" >
<el-table-column align="center" label="料箱状态" prop="type">
<template slot-scope="scope">
<dict-tag :options="dict.type.ct_base_status" :value="scope.row.type"/>
</template>
</el-table-column>
<el-table-column label="创建者" align="center" prop="createBy" />
<el-table-column label="创建时间" align="center" prop="createTime" />
<el-table-column label="更新者" align="center" prop="updateBy" />
<el-table-column label="更新时间" align="center" prop="updateTime" />
<el-table-column align="center" label="创建者" prop="createBy"/>
<el-table-column align="center" label="创建时间" prop="createTime"/>
<el-table-column align="center" label="更新者" prop="updateBy"/>
<el-table-column align="center" label="更新时间" prop="updateTime"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
@ -87,14 +112,16 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['wm:ctBase:edit']"
>修改</el-button>
>修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['wm:ctBase:remove']"
>删除</el-button>
>删除
</el-button>
</template>
</el-table-column>
</el-table>
@ -113,7 +140,7 @@
<el-row>
<el-col :span="24">
<el-form-item label="料箱编码" prop="code">
<el-input v-model="form.code" placeholder="请输入料箱编码" />
<el-input v-model="form.code" placeholder="请输入料箱编码"/>
</el-form-item>
</el-col>
</el-row>
@ -175,11 +202,57 @@
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<el-dialog :close-on-click-modal="false" :visible.sync="openBind" append-to-body title="物料装箱" width="40%">
<el-form ref="bindForm" :model="bindForm" :rules="rules" label-width="80px">
<el-row>
<el-col :span="24">
<el-form-item label="料箱编码" prop="boxCode">
<el-input v-model="bindForm.boxCode" placeholder="请输入料箱编码"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="物料编码" prop="itemCode">
<el-input v-model="bindForm.itemCode" placeholder="请输入物料编码"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitBindForm"> </el-button>
<el-button @click="openBind=false"> </el-button>
</div>
</el-dialog>
<el-dialog :close-on-click-modal="false" :visible.sync="openUnbind" append-to-body title="物料拆箱" width="40%">
<el-form ref="unbindForm" :model="unbindForm" :rules="rules" label-width="80px">
<el-row>
<el-col :span="24">
<el-form-item label="料箱编码" prop="boxCode">
<el-input v-model="unbindForm.boxCode" placeholder="请输入料箱编码"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="物料编码" prop="itemCode">
<el-input v-model="unbindForm.itemCode" placeholder="请输入物料编码"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitUnbindForm"> </el-button>
<el-button @click="openUnbind=false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listCtBase, getCtBase, delCtBase, addCtBase, updateCtBase } from "@/api/mes/wm/ctBase";
import {addCtBase, bindCtBase, delCtBase, getCtBase, listCtBase, unbindCtBase, updateCtBase} from "@/api/mes/wm/ctBase";
import ItemSelect from "@/components/itemSelect/singleBase.vue";
export default {
@ -188,6 +261,8 @@ export default {
dicts: ['ct_base_status'],
data() {
return {
openBind: false,
openUnbind: false,
//
loading: true,
//
@ -218,14 +293,28 @@ export default {
//
rules: {
code: [
{ required: true, message: "料箱编码不能为空", trigger: "blur" }
{required: true, message: "料箱编码不能为空", trigger: "blur"}
],
type: [
{ required: true, message: "请选择料箱状态", trigger: "blur" }
{required: true, message: "请选择料箱状态", trigger: "blur"}
],
boxCode: [
{required: true, message: "请输入料箱编码", trigger: "blur"}
],
itemCode: [
{required: true, message: "请输入物料编码", trigger: "blur"}
]
},
baseKnifeList: [],
checkedBaseKnife: [],
bindForm: {
boxCode: '',
itemCode: ''
},
unbindForm: {
boxCode: '',
itemCode: ''
}
};
},
created() {
@ -266,7 +355,7 @@ export default {
flag = false
}
})
if (flag){
if (flag) {
this.baseKnifeList[this.nowChildItemIndex].baseKnifeId = obj.baseKnifeId;
this.baseKnifeList[this.nowChildItemIndex].knifeCode = obj.knifeCode;
this.baseKnifeList[this.nowChildItemIndex].knifeName = obj.knifeName;
@ -317,7 +406,7 @@ export default {
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.ctBaseId)
this.single = selection.length!==1
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
@ -338,6 +427,36 @@ export default {
});
},
/** 绑定按钮操作 */
handleBind() {
this.openBind = true;
},
/** 解绑按钮操作 */
handleUnbind() {
this.openUnbind = true;
},
/** 物料绑定 */
submitBindForm() {
this.$refs["bindForm"].validate(valid => {
if (valid) {
bindCtBase(this.bindForm.boxCode, this.bindForm.itemCode).then(response => {
this.$modal.msgSuccess("装箱成功");
this.bindForm.itemCode = '';
});
}
});
},
/** 物料解绑 */
submitUnbindForm() {
this.$refs["unbindForm"].validate(valid => {
if (valid) {
unbindCtBase(this.unbindForm.boxCode, this.unbindForm.itemCode).then(response => {
this.$modal.msgSuccess("拆箱成功");
this.unbindForm.itemCode = '';
});
}
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
@ -371,12 +490,13 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const ctBaseIds = row.ctBaseId || this.ids;
this.$modal.confirm('是否确认删除料箱编码为"' + row.code + '"的数据项?').then(function() {
this.$modal.confirm('是否确认删除料箱编码为"' + row.code + '"的数据项?').then(function () {
return delCtBase(ctBaseIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {