You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

379 lines
12 KiB
Vue

<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="workorderCodeSap">
<el-input
v-model="queryParams.workorderCodeSap"
placeholder="请输入订单号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料码" prop="productCode">
<el-input
v-model="queryParams.productCode"
placeholder="请输入物料码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<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="产线编码" prop="lineCode">
<el-input
v-model="queryParams.lineCode"
placeholder="请输入产线编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="产线名称" prop="equipmentName">
<el-input
v-model="queryParams.equipmentName"
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="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['unitPriceReport:report:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="unitPriceList" @selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="55" align="center" />-->
<el-table-column fixed="left" label="工单号" align="center" width="180" prop="workorderCode" />
<el-table-column fixed="left" label="SAP订单号" align="center" width="120" prop="workorderCodeSap" />
<el-table-column label="物料码" align="center" width="110">
<template slot-scope="scope">
{{ scope.row.productCode.slice(-11) }}
</template>
</el-table-column>
<el-table-column label="物料描述" align="center" width="250" prop="productName" />
<el-table-column label="产线编码" align="center" prop="lineCode" />
<el-table-column label="产线名称" align="center" width="250" prop="equipmentName" />
<el-table-column label="操作者" width="110" align="center" prop="nickName" />
<el-table-column label="子工序名称" width="110" align="center" prop="childprocessName" />
<el-table-column label="工序单价" align="center" prop="attr1" />
<el-table-column label="件数" align="center" prop="totalQuantity" />
<el-table-column label="薪酬(元)" width="110" align="center" prop="result" />
<el-table-column label="人数" align="center" prop="headCount" />
<el-table-column label="平均工资(元)" width="110" align="center" prop="avgResult" />
<el-table-column label="实际工资(元)" width="110" align="center" prop="realWages" />
<el-table-column label="备注" align="center" prop="remark">
<template slot-scope="scope">
<dict-tag :options="dict.type.unit_price" :value="scope.row.remark"/>
</template>
</el-table-column>
<!-- <el-table-column label="实际工资" align="center" prop="realWages">-->
<!-- <template slot-scope="scope">-->
<!-- <el-input type="text" size="small" v-model="scope.row.realWages" @change="handleEdit(scope.$index,scope.row)"></el-input>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="实际工资" align="center" prop="realWages" />-->
<el-table-column fixed="right" 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="['unitPriceReport:report:edit']"
>工资修改</el-button>
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- v-hasPermi="['system:unitPrice: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"
/>
<!-- 添加或修改unitPrice对话框 -->
<el-dialog :title="title" :visible.sync="open" width="680px" append-to-body>
<el-form ref="form" :model="form" label-width="100px">
<el-row>
<el-col :span="12">
<el-form-item label="实际工资" prop="attr1" >
<el-input v-model="form.attr1" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="子工序" prop="childprocessName">
<el-select
v-model="form.childprocessName"
placeholder="子工序"
clearable
@change="handleChildprocessChange"
>
<el-option
v-for="dict in MesUnitPriceInfo"
:key="dict.childprocessName"
:label="dict.childprocessName"
:value="dict.childprocessCode"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="子工序编码" prop="childprocessCode" >
<el-input v-model="form.childprocessCode" :readonly="true" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注">
<!-- <el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>-->
<el-select
v-model="form.remark"
placeholder="工单状态"
clearable
style="width: 240px"
>
<el-option
v-for="dict in dict.type.unit_price"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
// import { ElEditable } from 'element-plus';
import { getToken } from "@/utils/auth";
import { listUnitPriceReport,getReport,updateUnitPriceReport } from "@/api/mes/unitPriceReport";
export default {
name: "UnitPrice",
dicts: ['unit_price'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// unitPrice表格数据
unitPriceList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
value: '',
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
factoryId: null,
workorderCodeSap: null,
productCode: null,
productName: null,
lineCode: null,
lineName: null,
childprocessId: null,
childprocessCode: null,
childprocessName: null,
attr1: null,
attr2: null,
attr3: null,
attr4: null,
},
productQueryParams:{
productCode: null,
productName: null,
},
// 表单参数
form: {},
// 表单校验
productCodeList: [],
state: '',
timeout: null,
productCode:'',
tableData: [],
MesUnitPriceInfo: []
};
},
created() {
this.getList();
// this.fetchProcessOptions();
},
methods: {
handleEdit(index, row) {
console.log('row:',index, row);
},
/** 查询unitPrice列表 */
getList() {
this.loading = true;
listUnitPriceReport(this.queryParams).then(response => {
this.unitPriceList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
picId: null,
factoryId: null,
productCode: null,
productName: null,
lineCode: null,
lineName: null,
childprocessId: null,
childprocessCode: null,
childprocessName: null,
attr1: null,
attr2: null,
attr3: null,
attr4: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
this.tableData = [];
this.nextID=1;
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.picId)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加计件薪酬信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
console.log(row)
this.reset();
const picId = row.id || this.ids
getReport(picId).then(response => {
this.form = response.data.MesUnitpriceReport;
this.open = true;
if (response.data.attr1 === null || response.data.attr1 === undefined) {
this.form.attr1 = row.avgResult;
} else {
this.form.attr1 = response.data.attr1;
}
this.MesUnitPriceInfo=response.data.MesUnitPriceInfo;
});
},
handleChildprocessChange(value){
console.log(value)
// 当子工序选择发生变化时,更新子工序编码
const selectedChildprocess = this.MesUnitPriceInfo.find(item => item.childprocessCode === value);
if (selectedChildprocess) {
this.form.childprocessName = selectedChildprocess.childprocessName;
this.form.childprocessCode = selectedChildprocess.childprocessCode;
}
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
console.log(this.form,this.tableData)
if (this.form.id != null) {
updateUnitPriceReport(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
}
// else {
// addUnitPrice(this.form).then(response => {
// this.$modal.msgSuccess("新增成功");
// this.open = false;
// this.getList();
// });
// }
}
});
},
/** 导出按钮操作 */
handleExport() {
this.download('mes/unitPriceReport/export', {
...this.queryParams
}, `unitPrice_${new Date().getTime()}.xlsx`)
},
}
};
</script>