机器人涂装数据采集表

This commit is contained in:
小魔仙
2025-05-26 16:11:52 +08:00
parent 06ca29579b
commit bec75fc77f
2 changed files with 503 additions and 0 deletions

View File

@@ -0,0 +1,444 @@
<!--
* @Descripttion: (机器人涂装数据采集表/fnproduction)
* @version: (1.0)
* @Author: (admin)
* @Date: (2025-05-23)
* @LastEditors: (admin)
* @LastEditTime: (2025-05-23)
-->
<template>
<div class="app-container">
<!-- :model属性用于表单验证使用 比如下面的el-form-item prop属性用于对表单值进行验证操作 -->
<el-form :model="queryParams" size="small" label-position="right" inline ref="queryForm" :label-width="labelWidth" v-show="showSearch"
@submit.native.prevent>
<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="primary" v-hasPermi="['business:fnproduction:add']" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" :disabled="single" v-hasPermi="['business:fnproduction:edit']" plain icon="el-icon-edit" size="mini" @click="handleUpdate">修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" :disabled="multiple" v-hasPermi="['business:fnproduction:delete']" plain icon="el-icon-delete" size="mini" @click="handleDelete">删除</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 数据区域 -->
<el-table :data="dataList" v-loading="loading" ref="table" border highlight-current-row @sort-change="sortChange" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center"/>
<el-table-column prop="dateTimeSt" label="开始时间" align="center" :show-overflow-tooltip="true" />
<el-table-column prop="dateTimeEnd" label="结束时间" align="center" :show-overflow-tooltip="true" />
<el-table-column prop="plcStyle" label="车型" align="center" :show-overflow-tooltip="true" />
<el-table-column prop="plcColor" label="颜色" align="center" :show-overflow-tooltip="true" />
<el-table-column prop="plcVar" label="变种" align="center" :show-overflow-tooltip="true" />
<el-table-column prop="plcStartphoncount" label="启动开关1计数" align="center" />
<!-- <el-table-column prop="plcStartlsshiftcount" label="启动开关2计数" align="center" /> -->
<el-table-column
prop="robotNo"
label="机器人"
align="center"
:formatter="formatRobotNo"
:show-overflow-tooltip="true"
/>
<el-table-column prop="robotProNo" label="程序号" align="center" :show-overflow-tooltip="true" />
<el-table-column prop="robotCcv" label="CCV" align="center" :show-overflow-tooltip="true" />
<el-table-column prop="robotVar" label="滑橇号" align="center" :show-overflow-tooltip="true" />
<el-table-column prop="robotFlux" label="流量" align="center" />
<el-table-column prop="robotBrushNo" label="刷子" align="center" :show-overflow-tooltip="true" />
<el-table-column prop="endStatus" label="结束形式" align="center" width="120">
<template slot-scope="scope">
<el-tag
:type="scope.row.endStatus === '0' ? 'success' : 'danger'"
disable-transitions
>
{{ scope.row.endStatus === '0' ? '喷涂结束' : '异常结束' }}
</el-tag>
</template>
</el-table-column>
<!-- <el-table-column label="操作" align="center" width="140">
<template slot-scope="scope">
<el-button size="mini" v-hasPermi="['business:fnproduction:edit']" type="success" icon="el-icon-edit" title="编辑"
@click="handleUpdate(scope.row)"></el-button>
<el-button size="mini" v-hasPermi="['business:fnproduction:delete']" type="danger" icon="el-icon-delete" title="删除"
@click="handleDelete(scope.row)"></el-button>
</template>
</el-table-column> -->
</el-table>
<pagination class="mt10" background :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
<!-- 添加或修改机器人涂装数据采集表对话框 -->
<el-dialog :title="title" :lock-scroll="false" :visible.sync="open" >
<el-form ref="form" :model="form" :rules="rules" :label-width="formLabelWidth">
<el-row :gutter="20">
<el-col :lg="12">
<el-form-item label="开始时间" prop="dateTimeSt">
<el-input v-model="form.dateTimeSt" placeholder="请输入开始时间" />
</el-form-item>
</el-col>
<el-col :lg="12">
<el-form-item label="结束时间" prop="dateTimeEnd">
<el-input v-model="form.dateTimeEnd" placeholder="请输入结束时间" />
</el-form-item>
</el-col>
<el-col :lg="12">
<el-form-item label="车型" prop="plcStyle">
<el-input v-model="form.plcStyle" placeholder="请输入车型" />
</el-form-item>
</el-col>
<el-col :lg="12">
<el-form-item label="颜色" prop="plcColor">
<el-input v-model="form.plcColor" placeholder="请输入颜色" />
</el-form-item>
</el-col>
<el-col :lg="12">
<el-form-item label="变种" prop="plcVar">
<el-input v-model="form.plcVar" placeholder="请输入变种" />
</el-form-item>
</el-col>
<el-col :lg="12">
<el-form-item label="启动开关1计数" prop="plcStartphoncount">
<el-input v-model="form.plcStartphoncount" placeholder="请输入启动开关1计数" />
</el-form-item>
</el-col>
<el-col :lg="12">
<el-form-item label="启动开关2计数" prop="plcStartlsshiftcount">
<el-input v-model="form.plcStartlsshiftcount" placeholder="请输入启动开关2计数" />
</el-form-item>
</el-col>
<el-col :lg="12">
<el-form-item label="机器人" prop="robotNo">
<el-input v-model="form.robotNo" placeholder="请输入机器人" />
</el-form-item>
</el-col>
<el-col :lg="12">
<el-form-item label="程序号" prop="robotProNo">
<el-input v-model="form.robotProNo" placeholder="请输入程序号" />
</el-form-item>
</el-col>
<el-col :lg="12">
<el-form-item label="CCV" prop="robotCcv">
<el-input v-model="form.robotCcv" placeholder="请输入CCV" />
</el-form-item>
</el-col>
<el-col :lg="12">
<el-form-item label="滑橇号" prop="robotVar">
<el-input v-model="form.robotVar" placeholder="请输入滑橇号" />
</el-form-item>
</el-col>
<el-col :lg="12">
<el-form-item label="流量" prop="robotFlux">
<el-input v-model="form.robotFlux" placeholder="请输入流量" />
</el-form-item>
</el-col>
<el-col :lg="12">
<el-form-item label="刷子" prop="robotBrushNo">
<el-input v-model="form.robotBrushNo" placeholder="请输入刷子" />
</el-form-item>
</el-col>
<el-col :lg="12">
<el-form-item label="结束形式" prop="endStatus">
<el-radio-group v-model="form.endStatus">
<el-radio v-for="item in endStatusOptions" :key="item.dictValue" :label="item.dictValue">{{item.dictLabel}}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="cancel"> </el-button>
<el-button type="primary" @click="submitForm"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
listFnproduction,
addFnproduction,
delFnproduction,
updateFnproduction,
getFnproduction,
} from '@/api/dc/fnproduction.js';
export default {
name: "fnproduction",
data() {
return {
labelWidth: "100px",
formLabelWidth:"100px",
// 选中id数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 遮罩层
loading: false,
// 显示搜索条件
showSearch: true,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
sort: undefined,
sortType: undefined,
},
// 弹出层标题
title: "",
// 操作类型 1、add 2、edit
opertype: 0,
// 是否显示弹出层
open: false,
// 表单参数
form: {},
columns: [
{ index: 0, key: 'dateTimeSt', label: `开始时间`, checked: true },
{ index: 1, key: 'dateTimeEnd', label: `结束时间`, checked: true },
{ index: 2, key: 'plcStyle', label: `车型`, checked: true },
{ index: 3, key: 'plcColor', label: `颜色`, checked: true },
{ index: 4, key: 'plcVar', label: `变种`, checked: true },
{ index: 5, key: 'plcStartphoncount', label: `启动开关1计数`, checked: true },
{ index: 6, key: 'plcStartlsshiftcount', label: `启动开关2计数`, checked: true },
{ index: 7, key: 'robotNo', label: `机器人`, checked: true },
{ index: 8, key: 'robotProNo', label: `程序号`, checked: true },
{ index: 9, key: 'robotCcv', label: `CCV`, checked: false },
{ index: 10, key: 'robotVar', label: `车体编号`, checked: false },
{ index: 11, key: 'robotFlux', label: `流量`, checked: false },
{ index: 12, key: 'robotBrushNo', label: `刷子`, checked: false },
{ index: 13, key: 'endStatus', label: `结束形式`, checked: false },
],
// 结束形式选项列表 格式 eg:{ dictLabel: '标签', dictValue: '0'}
endStatusOptions: [],
// 数据列表
dataList: [],
// 总记录数
total: 0,
// 提交按钮是否显示
btnSubmitVisible: true,
// 表单校验
rules: {
},
};
},
created() {
// 列表数据查询
this.getList();
var dictParams = [
];
},
methods: {
// 确保格式化函数处理字符串类型的 robotNo
formatRobotNo(row, column) {
// const robotMap = {
// '4': 'RoBot PC1',
// '5': 'RoBot BC1',
// '6': 'RoBot BC2',
// '7': 'RoBot BC3',
// '8': 'RoBot CC1',
// '9': 'RoBot CC2',
// };
const robotMap = {
'4': '底漆R1',
'5': '色漆R2',
'6': '色漆R3',
'7': '色漆R4',
'8': '清漆R5',
'9': '清漆R6',
};
// 确保 robotNo 是字符串,并去除前后空格
const robotNo = String(row.robotNo || '').trim();
// 如果找不到映射,返回原始值
return robotMap[robotNo] || robotNo;
},
// 获取数据后处理 robotNo 字段(可选优化)
getList() {
this.loading = true;
listFnproduction(this.queryParams).then(res => {
if (res.code == 200) {
console.log('原始数据:', res.data.result); // 检查原始数据
console.log('第一个元素的robotNo类型:', typeof res.data.result[0]?.robotNo);
// 如果后端返回的 robotNo 是字符串,可以直接使用,无需转换
this.dataList = res.data.result;
this.total = res.data.totalNum;
this.loading = false;
}
})
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 重置数据表单
reset() {
this.form = {
dateTimeSt: undefined,
dateTimeEnd: undefined,
plcStyle: undefined,
plcColor: undefined,
plcVar: undefined,
plcStartphoncount: undefined,
plcStartlsshiftcount: undefined,
robotNo: undefined,
robotProNo: undefined,
robotCcv: undefined,
robotVar: undefined,
robotFlux: undefined,
robotBrushNo: undefined,
endStatus: undefined,
};
this.resetForm("form");
},
// 重置查询操作
resetQuery() {
this.timeRange = [];
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id);
this.single = selection.length != 1
this.multiple = !selection.length;
},
// 自定义排序
sortChange(column) {
if (column.prop == null || column.order == null) {
this.queryParams.sort = undefined;
this.queryParams.sortType = undefined;
} else {
this.queryParams.sort = column.prop;
this.queryParams.sortType = column.order;
}
this.handleQuery();
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加";
this.opertype = 1;
},
/** 删除按钮操作 */
handleDelete(row) {
const Ids = row.id || this.ids;
this.$confirm('是否确认删除参数编号为"' + Ids + '"的数据项?')
.then(function () {
return delFnproduction(Ids);
})
.then(() => {
this.handleQuery();
this.msgSuccess("删除成功");
})
.catch(() => {});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
getFnproduction(id).then((res) => {
const { code, data } = res;
if (code == 200) {
this.open = true;
this.title = "修改数据";
this.opertype = 2;
// 如果后端返回的 robotNo 是字符串,可以直接使用
this.form = {
...data,
};
}
});
},
// 结束形式字典翻译
endStatusFormat(row, column) {
return this.selectDictLabel(this.endStatusOptions, row.endStatus);
},
/** 提交按钮 */
submitForm: function () {
this.$refs["form"].validate((valid) => {
if (valid) {
console.log(JSON.stringify(this.form));
if (this.form.id != undefined && this.opertype === 2) {
updateFnproduction(this.form)
.then((res) => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
})
.catch((err) => {
//TODO 错误逻辑
});
} else {
addFnproduction(this.form)
.then((res) => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
})
.catch((err) => {
//TODO 错误逻辑
});
}
}
});
},
},
// 如果对话框中需要显示映射后的名称,可以添加这个计算属性
computed: {
formattedRobotNo() {
return this.formatRobotNo(this.form, {})
}
}
};
</script>