nalinv-ui/src/views/wms/false-warehoursing/index.vue
2024-11-20 10:37:52 +08:00

250 lines
8.1 KiB
Vue

<template>
<div class="execution">
<basic-container>
<el-form ref="formObj" :model="formObj" label-width="auto">
<el-row>
<el-col :span="8">
<el-form-item label="客户编码:" prop="customer">
<el-input v-model="formObj.customer"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="外仓:" prop="externalWarehouse">
<el-input v-model="formObj.externalWarehouse"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="物料:" prop="material">
<el-input v-model="formObj.material"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="类型:" prop="type">
<el-select v-model="formObj.type" style="width: 100%">
<el-option value="EXTERNAL_WAREHOUSE" label="外仓"/>
<el-option value="CONSIGN_FOR_SALE" label="寄售"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item>
<el-button type="primary" @click="doRetrieve">查询</el-button>
<el-button type="primary" @click="doExport">导出</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-table :data="list.records" border @current-change="handleSelectionChange" highlight-current-row>
<el-table-column label="序号" align="center" width="50">
<template slot-scope="scope">
{{scope.$index+1}}
</template>
</el-table-column>
<el-table-column label="类型" prop="type" align="center">
<template slot-scope="scope">
{{formatterConst[scope.column.property][scope.row[scope.column.property]]}}
</template>
</el-table-column>
<el-table-column label="客户编码" prop="customer" align="center"></el-table-column>
<el-table-column label="外仓编号" prop="externalWarehouse" align="center"></el-table-column>
<el-table-column label="物料" prop="material" align="center"></el-table-column>
<el-table-column label="数量" prop="qty" align="center"></el-table-column>
<el-table-column label="单位" prop="unit" align="center"></el-table-column>
</el-table>
<el-pagination
layout="total, sizes, prev, pager, next, jumper"
:total="list.total"
:page-size="list.size"
@size-change="handleSizeChange"
@current-change="handleCurrentChange">
</el-pagination>
<div style="margin-top: 10px;">
<el-button type="primary" @click="doTransfer">转移</el-button>
<el-button type="warning" @click="doClear">清除</el-button>
</div>
<el-dialog :visible.sync="confirmDialogVisible" center width="20%">
<el-form :model="formObj" label-width="auto">
<el-form-item label="转移数量:" class="inputRequired">
<el-input v-model="formObj.qty" type="number"></el-input>
</el-form-item>
<el-form-item label="外仓:" v-if="selection && selection.type === 'CONSIGN_FOR_SALE'">
<el-input v-model="formObj.transferNo"></el-input>
</el-form-item>
<el-form-item label="备注:">
<el-input v-model="formObj.remarks"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirm">确认</el-button>
<el-button type="primary" @click="cancel">返回</el-button>
</div>
</el-dialog>
</basic-container>
</div>
</template>
<script>
import {fetchList, transfer} from '@/api/wms/false-warehoursing';
import {isBlank} from "@/util/string";
import {getStore} from '@/util/store';
import {hideLoading, showLoading} from '@/const/loading';
import {listByActivityId} from "@/api/admin/activity-option";
import {mapGetters} from 'vuex';
export default {
data() {
return {
lableWidth: {
'width': '150px'
},
site: getStore({name: 'tenantId'}),
formObj: {},
initData: {},
list: {
records: [],
total: 0,
size: 0
},
selection: null,
confirmDialogVisible: false,
queryParam: {current: 1, size: 20},
formatterConst: {
type: {
"EXTERNAL_WAREHOUSE": "外仓",
"CONSIGN_FOR_SALE": "寄售仓",
},
}
};
},
created() {
this.doClear();
},
computed: {
...mapGetters(["permissions"]),
permissionList() {
return {};
}
},
methods: {
doRetrieve() {
let me = this;
let param = Object.assign({
type: me.formObj.type,
material: me.formObj.material,
externalWarehouse: me.formObj.externalWarehouse,
customer: me.formObj.customer,
}, me.queryParam);
showLoading();
fetchList(param).then(respData => {
hideLoading();
this.list = respData.data.data;
}).catch(() => {
hideLoading();
});
},
//清除页面信息
doClear() {
this.formObj = Object.assign({}, this.initData);
this.list = {};
this.queryParam = {current: 1, size: 20};
this.selection = null;
},
doTransfer() {
let me = this;
let selection = me.selection;
if (!selection) {
me.$message.error('请选择要转移的外仓/寄售仓');
} else {
me.$set(me.formObj, "qty", 0);
me.$set(me.formObj, "remarks", "");
me.$set(me.formObj, "transferNo", "");
me.confirmDialogVisible = true;
}
},
cancel() {
this.confirmDialogVisible = false;
},
confirm() {
let me = this;
if (!me.formObj.qty || me.formObj.qty <= 0) {
return me.$message.error("转移数量必须大于0");
} else {
let selection = me.selection;
let param = selection.type === "CONSIGN_FOR_SALE" ? {
consignForSaleNo: selection.externalWarehouse,
externalWarehouse: me.formObj.transferNo,
type: selection.type,
qty: me.formObj.qty,
remarks: me.formObj.remarks,
customer: selection.customer,
material: selection.material,
} : {
externalWarehouse: selection.externalWarehouse,
type: selection.type,
customer: selection.customer,
material: selection.material,
qty: me.formObj.qty,
remarks: me.formObj.remarks,
};
showLoading();
transfer(param).then(res => {
hideLoading();
me.confirmDialogVisible = false;
me.doRetrieve();
return me.$message.success("转移成功");
}).catch(e => hideLoading());
}
},
handleSelectionChange(row) {
this.selection = row;
},
handleSizeChange(val) {
this.queryParam.size = val;
this.doRetrieve();
},
handleCurrentChange(val) {
this.queryParam.current = val;
this.doRetrieve();
},
doExport() {
let me = this;
let param = {
type: me.formObj.type,
material: me.formObj.material,
externalWarehouse: me.formObj.externalWarehouse,
customer: me.formObj.customer,
};
this.downBlobFile("/wms/false-warehoursing/export", param, "外仓库存导出.xlsx");
},
},
};
</script>
<style scoped lang="scss">
.inputRequired ::v-deep .el-form-item__label::before {
content: "*";
width: 10px;
height: 20px;
display: inline-block;
vertical-align: middle;
text-align: center;
line-height: 26px;
font-size: large;
color: #f00;
}
::v-deep .el-table__body tr.current-row > td {
background-color: rgba(79, 169, 255, 0.81) !important; /* 改变为你想要的颜色 */
}
</style>