钢材磅前端逻辑初步调整

This commit is contained in:
ptt 2025-06-30 15:42:54 +08:00
parent 8ccbc78c94
commit 6c0631e31d
1 changed files with 321 additions and 107 deletions

View File

@ -1,14 +1,22 @@
<!--钢材-->
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-row style="display: inline-block;width: 260px">
<el-col :span="24">
<el-form-item label="磅点" prop="poundid" label-width="40">
<el-select v-model="queryParams.poundid" placeholder="请选择磅点" clearable>
<search-select v-model="queryParams.poundid"
params = "t_data_truepound;id;concat(name,' ',usrcode)"
where="poundtype = '3'"
orderby="usrcode asc"
></search-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="类型" prop="poundname" label-width="40">
<el-select v-model="queryParams.poundclass" placeholder="类型">
<el-option
v-for="dict in dict.type.pound"
v-for="dict in dict.type.weighttype"
:key="dict.value"
:label="dict.label"
:value="dict.value"
@ -16,16 +24,6 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="类型" prop="poundname" label-width="40">
<el-input
v-model="queryParams.poundname"
placeholder="请输入类型"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
</el-col>
</el-row>
<el-form-item style="width: 70px;color: #606266;margin: 0 0 0 0;">
<label style="margin-left: 10px;">过磅方式</label>
@ -46,49 +44,44 @@
/>
</el-form-item>
<el-form-item>
<el-button type="primary" size="mini" @click="handleQuery">自动过磅</el-button>
<el-button type="primary" size="mini" @click="handleQuery">手动过磅</el-button>
<el-button type="primary" size="mini" @click="handleQuery">完成</el-button>
<el-button type="primary" size="mini" @click="handleQuery">查询</el-button>
<el-button type="primary" size="mini" @click="handleQuery">打印</el-button>
<el-button type="primary" size="mini" @click="handleSearchMstBillFirst">自动过磅</el-button>
<el-button type="primary" size="mini" @click="handleSearchMstBillFirst">手动过磅</el-button>
<el-button type="primary" size="mini" @click="handleSearchMstBillFirst">完成</el-button>
<el-button type="primary" size="mini" @click="handleSearchMstBillFirst">查询</el-button>
<el-button type="primary" size="mini" @click="handleSearchMstBillFirst">打印</el-button>
</el-form-item>
</el-form>
<!-- 主磅单信息 -->
<el-card>
<el-row>
<el-col :span="18">
<el-button class="transition-all duration-200" type="primary" size="mini">主磅单信息</el-button>
<el-table v-loading="loading"
:data="operationpoundList"
<el-button class="transition-all duration-200" size="mini" @click = "getMstBillData">新增</el-button>
<el-button class="transition-all duration-200" size="mini" @click = "getMstBillDataById">修改</el-button>
<el-button class="transition-all duration-200" size="mini" @click="handleSearchMstBillFirst">查询</el-button>
<el-table v-loading="mstBillLoading"
:data="mstBillList"
border
stripe
@selection-change="handleSelectionChange">
@selection-change="handleMstSelectionChange"
ref = "mstBillTable"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="按钮1" align="center" prop="id" />
<el-table-column label="状态" align="center" prop="billstate">
<el-table-column label="单号" align="center" prop="usrcode" />
<el-table-column label="榜单日期" align="center" prop="bsndt" width="180">
<template slot-scope="scope">
<dict-tag :options="dict.type.pound_status" :value="scope.row.billstate"/>
<span>{{ parseTime(scope.row.bsndt, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
</el-table>
</el-col>
<el-col :span="6">
<el-button class="transition-all duration-200" type="primary" size="mini">主磅单打印</el-button>
<el-table v-loading="loading"
:data="operationpoundList"
border
stripe
@selection-change="handleSelectionChange">
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="按钮1" align="center" prop="id" />
<el-table-column label="状态" align="center" prop="billstate">
@ -97,11 +90,8 @@
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
</el-card>
<!-- 底部列表区域 -->
@ -110,14 +100,13 @@
<el-col :span="20">
<el-button v-for="tab in tabs" :key="tab.name" :type="activeTab === tab.name ? 'primary' : 'default'"
@click="activeTab = tab.name" size="mini" > {{ tab.label }}</el-button>
<el-table
v-loading="loading"
:data="operationpoundList"
v-if="activeTab === 'weighingRequest'"
border
stripe
@selection-change="handleSelectionChange">
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="按钮1" align="center" prop="id" />
<el-table-column label="状态" align="center" prop="billstate">
@ -128,11 +117,7 @@
</el-table>
</el-col>
<el-col :span="4">
<el-button type="primary" size="mini" @click="handleQuery">操作</el-button>
<el-button type="primary" size="mini" @click="handleSearchMstBillFirst">操作</el-button>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-row>
<el-col :span="6">
@ -169,7 +154,7 @@
<el-input
v-model="queryParams.poundname" style="width: 200px"
clearable
@keyup.enter.native="handleQuery"
@keyup.enter.native="handleSearchMstBillFirst"
/>
</el-form-item>
</el-col>
@ -226,19 +211,130 @@
</el-col>
</el-row>
</el-card>
<!-- 添加或修改主榜单信息对话框 -->
<el-dialog :title="mstBillFormData.mstBillTitle" :visible.sync="mstBillFormData.mstBillOpen" width="1500px" append-to-body>
<el-form ref="mstBillFormData.mstBillForm" :model="mstBillFormData.mstBillForm" :rules="mstBillFormData.mstBillRules" label-width="80px">
<el-row>
<el-col :span="8">
<el-form-item label="主榜单编号" prop="usrcode" readonly>
<el-input v-model="mstBillFormData.mstBillForm.usrcode" placeholder="请输入主榜单编号" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="业务日期" prop="bsndt">
<el-date-picker clearable
v-model="mstBillFormData.mstBillForm.bsndt"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择业务日期">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="业务磅点" prop="poundid">
<search-select
v-model="mstBillFormData.mstBillForm.poundid"
params="t_data_buspound;id;concat(name,' ',usrcode)"
where = ""
orderby="usrcode asc"
:clearable = "true"
:disabled = "true"
></search-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="16">
<el-form-item label="发货单位" prop="sendunitid">
<search-select v-model="mstBillFormData.mstBillForm.sendunitid"
params = "t_data_pounddata;usrcode;concat(name,' ',usrcode)"
where="type = 'shippingCompany'"
orderby="usrcode asc"
clearable
></search-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="品名" prop="itmcode">
<search-select v-model="mstBillFormData.mstBillForm.itmcode"
params = "t_data_pounddata;usrcode;concat(name,' ',usrcode)"
where="type = 'productName'"
orderby="usrcode asc"
clearable
></search-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="16">
<el-form-item label="收货单位" prop="recunitid">
<search-select v-model="mstBillFormData.mstBillForm.recunitid"
params = "t_data_pounddata;usrcode;concat(name,' ',usrcode)"
where="type = 'receivingCompany'"
orderby="usrcode asc"
clearable
></search-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="炉次" prop="boilerno">
<el-input v-model="mstBillFormData.mstBillForm.boilerno" placeholder="请输入炉次" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="16">
<el-form-item label="承运单位" prop="trnunitid">
<search-select v-model="mstBillFormData.mstBillForm.trnunitid"
params = "t_data_pounddata;usrcode;concat(name,' ',usrcode)"
where="type = 'teamOrCarrier'"
orderby="usrcode asc"
clearable
></search-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="计量单位" prop="msrunit">
<el-input v-model="mstBillFormData.mstBillForm.msrunit" placeholder="请输入计量单位" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注" prop="usrcode">
<el-input v-model="mstBillFormData.mstBillForm.remark" placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="mstBillFormSubmit"> </el-button>
<el-button @click="mstBillFormCancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listSteelpound, getSteelpound, delSteelpound, addSteelpound, updateSteelpound } from "@/api/measurement/operation/steelpound"
import {getTruepound} from "@/api/measurement/basedata/truepound";
import SearchSelect from "@/components/SearchSelect";
import {addPoundmst, getNumber, getPoundmst, listPoundmst, updatePoundmst} from "@/api/measurement/bill/poundmst";
import {listPoundbill} from "@/api/measurement/bill/poundbill";
export default {
name: "Steelpound",
components: {SearchSelect},
dicts: ['pound_status', 'pound', 'sys_yes_no','weighttype'],
data() {
return {
//
loading: false,
//
mstBillLoading:false,
//
ids: [],
//
@ -259,10 +355,11 @@ export default {
queryParams: {
pageNum: 1,
pageSize: 10,
billstate: null,
usrcode: null,
carno: null,
weighttype: "2"//
poundid:"",
weighttype: "2",//
poundtype: "",//,
poundclass:"",//
timeoutId:null,//2
},
//
form: {},
@ -272,12 +369,79 @@ export default {
activeTab: 'weighingRequest',
//
rules: {
}
},
truepoundData:{},
queryPageParams:{
mstBill: {
total: 0,
pageNum: 1,
pageSize: 10,
isinuse:"Y",
recunitid:"",//
itmcode:"",//
trnunitid:"",//
sendunitid:"",//
poundid:"",//,java
},
poundBillDetail: {
total: 0,
pageNum: 1,
pageSize: 10
},
poundBillFull: {
total: 0,
pageNum: 1,
pageSize: 10,
poundid: "",
queryStart: "",
queryEnd: "",
carno: "",
usrcode: "",
},
historyPound:{
total:0,
pageNum:1,
pageSize:10,
},
},
//
mstBillList:[],
//
mstBillFormData:{
selectedIds:[],
mstBillForm:{},
mstBillRules:{},
mstBillTitle:"主榜单信息",
mstBillOpen:false,
thisSelectedRow:{},
},
}
},
created() {
// this.getList()
},
watch: {
//
'queryParams.poundid': function(newVal, oldVal) {
if(newVal!= null && newVal!== ""){
//idpoundtype
getTruepound(newVal).then(response => {
this.queryParams.poundtype = response.data.poundtype;
this.queryParams.poundclass = response.data.poundclass;
//
this.truepoundData = response.data;
//
this.handleSearchMstBillFirst();
});
}else {
this.queryParams.poundtype = "";
this.queryParams.poundclass = "";
this.truepoundData = {};
}
},
},
methods: {
/** 查询钢材磅列表 */
getList() {
@ -303,74 +467,124 @@ export default {
}
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
//
resetMstBillForm() {
this.mstBillFormData.mstBillForm = {
id: null,
bsndt: null,
poundid: null,
sendunitid: null,
itmcode: null,
recunitid: null,
boilerno: null,
trnunitid: null,
msrunit: null,
usrcode: null,
}
this.resetForm("mstBillFormData.mstBillForm");
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm")
this.handleQuery()
//
handleMstSelectionChange(selection) {
if (selection.length > 0){
this.mstBillFormData.selectedIds = selection.map(item => item.id)
var mstId = this.mstBillFormData.selectedIds[0];
this.queryPoundBillDetail(mstId);
}
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = "添加钢材磅"
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const id = row.id || this.ids
getSteelpound(id).then(response => {
this.form = response.data
this.open = true
this.title = "修改钢材磅"
//ID
queryPoundBillDetail(id){
var thisQueryParams = {
billstate:"1",
isinuse:"Y"
}
thisQueryParams.appliid = id;
listPoundbill(thisQueryParams).then(response => {
this.queryPageParams.poundBillDetail.total = response.total;
this.poundBillDetailList = response.rows;
})
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
//
checkPoundSelected() {
if (this.queryParams.poundid == null || this.queryParams.poundid === "") {
this.$message.error("请选择磅点!");
return false;
}
return true;
},
//,1
handleSearchMstBillFirst(){
this.queryPageParams.mstBill.pageNum = 1;
this.handleSearchMstBill();
},
//
handleSearchMstBill(){
this.mstBillLoading = true
this.queryPageParams.mstBill.poundid = this.truepoundData.buspoundid;
listPoundmst(this.queryPageParams.mstBill).then(response => {
this.queryPageParams.mstBill.total = response.total;
this.mstBillList = response.rows;
this.mstBillLoading = false;
})
},
//
getMstBillData(){
//
if (!this.checkPoundSelected())return;
this.resetMstBillForm();
getNumber().then(response => {
this.mstBillFormData.mstBillForm.usrcode = response.data.number;
this.mstBillFormData.mstBillForm.bsndt = response.data.date;
//
this.mstBillFormData.mstBillForm.poundid = this.truepoundData.buspoundid;
this.mstBillFormData.mstBillForm.mstBillTitle = '新增主榜单';
//
this.mstBillFormData.mstBillOpen = true;
});
},
//
getMstBillDataById(){
debugger
if(this.mstBillFormData.selectedIds.length==0){
this.$message.error("请选择磅单!");
return;
}
const id = this.mstBillFormData.selectedIds[0];
this.resetMstBillForm();
getPoundmst(id).then(response => {
this.mstBillFormData.mstBillForm = response.data;
this.mstBillFormData.mstBillTitle = '修改主榜单';
this.mstBillFormData.mstBillOpen = true;
})
},
//
mstBillFormSubmit(){
this.$refs["mstBillFormData.mstBillForm"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateSteelpound(this.form).then(response => {
this.$modal.msgSuccess("修改成功")
this.open = false
this.getList()
//ID
this.mstBillFormData.mstBillForm.poundid = this.truepoundData.buspoundid;
if (this.mstBillFormData.mstBillForm.id == null){
addPoundmst(this.mstBillFormData.mstBillForm).then(response => {
this.$message.success("新增主榜单成功!");
this.mstBillFormData.mstBillOpen = false;
//
this.handleSearchMstBillFirst();
})
} else {
addSteelpound(this.form).then(response => {
this.$modal.msgSuccess("新增成功")
this.open = false
this.getList()
}else{
updatePoundmst(this.mstBillFormData.mstBillForm).then(response => {
this.$message.success("修改主榜单成功!");
this.mstBillFormData.mstBillOpen = false;
//
this.handleSearchMstBillFirst();
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids
this.$modal.confirm('是否确认删除钢材磅编号为"' + ids + '"的数据项?').then(function() {
return delSteelpound(ids)
}).then(() => {
this.getList()
this.$modal.msgSuccess("删除成功")
}).catch(() => {})
//
mstBillFormCancel(){
this.mstBillFormData.mstBillOpen = false;
},
/** 导出按钮操作 */
handleExport() {
this.download('measurement/operation/steelpound/export', {
...this.queryParams
}, `steelpound_${new Date().getTime()}.xlsx`)
}
}
}
</script>