Commit f96e6df1 by lixiaomin

修改机器

parent 7b979e56
import request from "@/utils/request";
// 组件列表
export function getComponentBindList(data) {
return request({
url: "/v1/component/bind/list",
method: "post",
data: data,
});
}
// 绑定机器信息列表
export function getComBindMachineList(data) {
return request({
url: "/v1/component/bind/machine",
method: "post",
data: data,
});
}
\ No newline at end of file
......@@ -67,3 +67,12 @@ export function updateState(data) {
});
}
// 添加属性值
export function addProperty(data) {
return request({
url: "/v1/add/machine/property/value",
method: "post",
data: data,
});
}
<template>
<div class="app-container">
<el-table v-loading="loading" :data="modelList">
<el-table-column label="机器型号" align="center" prop="model_name"/>
<el-table-column label="创建时间" align="center" prop="created_at" />
<el-table-column label="组件管理" align="center">
<el-table v-loading="loading" :data="componentList">
<el-table-column label="组件类型" align="center" prop=""/>
<el-table-column label="组件名称" align="center" prop="component_name" />
<el-table-column label="适用机型" align="center" prop="" />
<el-table-column label="组件编码" align="center" prop="co_serial_no" />
<el-table-column label="绑定机器数" align="center" prop="bind_count">
<template slot-scope="scope">
<a @click="handleComponentDialog(scope.row)" style="color: blue">管理组件</a>
<a @click="handleComBindDialog(scope.row)" style="color: blue">{{scope.row.bind_count}}</a>
</template>
</el-table-column>
<el-table-column label="机器数量" align="center" prop=""/>
<el-table-column label="备注说明" align="center" prop=""/>
<el-table-column label="型号/规格" align="center" prop="" />
<el-table-column label="备注说明" align="center" prop="desc"/>
<el-table-column label="组件状态" align="center" prop="state_desc"/>
</el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.page" :limit.sync="queryParams.limit"
@pagination="getList" />
@pagination="getList" />
<el-dialog title="绑定机器信息" :visible.sync="bindDiaLog" width="900px" append-to-body>
<el-table v-loading="bindLoading" :data="bindList">
<el-table-column label="机器编码" align="center" prop="code"></el-table-column>
<el-table-column label="机器型号" align="center" prop=""></el-table-column>
<el-table-column label="状态" align="center" prop="state_desc"></el-table-column>
<el-table-column label="绑定时间" align="center" prop="bind_time"></el-table-column>
</el-table>
<pagination v-show="bindTotal > 0" :total="bindTotal" :page.sync="bindQueryParams.page" :limit.sync="bindQueryParams.limit"
@pagination="getComBindMachineList" />
<div slot="footer" class="dialog-footer" >
<el-button @click="bindDiaLogCancel">退出</el-button>
</div>
</el-dialog>
</div>
</template>
</template>
<script>
import {getModelList} from "@/api/component/component";
import {getComponentBindList,getComBindMachineList} from "@/api/component/component";
export default {
data() {
return {
......@@ -27,13 +43,23 @@ export default {
// 总条数
total: 0,
// 表格数据
modelList: [],
componentList: [],
// 查询参数
queryParams: {
page: 1,
limit: 10,
},
modelList:[]
bindDiaLog:false,
bindLoading:true,
bindTotal: 0,
// 表格数据
bindList: [],
// 查询参数
bindQueryParams: {
page: 1,
limit: 10,
name:""
},
};
},
created() {
......@@ -43,9 +69,9 @@ export default {
/** 查询列表 */
getList() {
this.loading = true;
getModelList(this.queryParams).then((response) => {
getComponentBindList(this.queryParams).then((response) => {
if(response.code==0){
this.modelList = response.data;
this.componentList = response.data;
this.total = response.data.length;
this.loading = false;
}
......@@ -59,7 +85,28 @@ export default {
/** 重置按钮操作 */
resetQuery() {
this.getList();
},
},
//弹出绑定机器页
handleComBindDialog(row){
this.bindDiaLog=true;
this.getComBindMachineList(row.component_name);
},
/** 绑定机器信息页 */
getComBindMachineList(name) {
this.bindLoading = true;
this.bindQueryParams.name=name;
getComBindMachineList(this.bindQueryParams).then((response) => {
if(response.code==0){
this.bindList = response.data;
this.bindTotal = response.data.length;
this.bindLoading = false;
}
});
},
bindDiaLogCancel(){
this.bindDiaLog=false;
}
......
......@@ -7,15 +7,22 @@
<el-row style="margin-bottom: 10px;">
<el-col :span="3"><div >组件名称:</div></el-col>
<el-col :span="10"><div >{{item.component_name}}</div></el-col>
<el-col :span="11"><div >经验值:</div></el-col>
</el-row>
<el-row style="margin-bottom: 10px;">
<el-row style="margin-bottom: 15px;">
<el-col :span="3"><div >组件属性:</div></el-col>
<el-col :span="20">
<el-col :span="15">
<el-row v-for="pro in item.property" :key="pro.property_name">
<el-col :span="4"><div >{{pro.property_name}}</div></el-col>
<el-col :span="10"><div >{{pro.value}}</div></el-col>
<el-col :span="8"><div >{{pro.property_name}}</div></el-col>
<el-col :span="8"><div >{{pro.value}}</div></el-col>
<el-col :span="8">
<el-button size="mini" round v-show="showBut(pro.experience_value)" @click="clickExperience(pro.property_id)" style="padding:2px">添加经验值</el-button>
<span style="color:blue;cursor:pointer" @click="showJYZ(pro);"> {{showJYZ_TEXT(pro.experience_value)}}</span>
</el-col>
</el-row>
</el-col>
</el-col>
</el-row>
<el-divider/>
</div>
......@@ -26,16 +33,54 @@
<el-button @click="attributeDiaLogCancel">退出</el-button>
</div>
</el-dialog>
<el-dialog title="添加经验值" :visible.sync="experienceValueDiaLog" width="500px" append-to-body>
<div>
<el-row v-for="(item,idx) in experienceList" :key="idx">
<el-col :span="5" style="display: flex; align-items: center;">
<div>
<el-input v-model="item.milli_second"/>
</div>
<div style="margin-left: 10px;">
<span></span>
</div>
</el-col>
<el-col :span="5" style="display: flex; align-items: center;margin-left: 10px;">
<div>
<el-input v-model="item.quantity"/>
</div>
<div style="margin-left: 10px;">
<span></span>
</div>
</el-col>
<el-col :span="3" style="margin-left: 10px;">
<el-button @click="addItem">+</el-button>
</el-col>
<el-col :span="3">
<el-button v-show="experienceShow" @click="subtractItem(idx)">-</el-button>
</el-col>
</el-row>
</div>
<div slot="footer" class="dialog-footer" >
<el-button type="primary" @click="experienceSubmit" >确定</el-button>
<el-button @click="experienceCancel">取消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {getAttributeList} from "@/api/machine/machineDetails";
import {getAttributeList,addProperty} from "@/api/machine/machineDetails";
export default {
data() {
return {
attributeDiaLog:false,
activeName:"first",
attributeData:[]
attributeData:[],
experienceValueDiaLog:false,
experienceList:[{quantity:null,milli_second:null}],
experienceShow:true,
machine_id:'',
property_id:'',
experienceValueShow:false
};
},
created() {
......@@ -45,7 +90,8 @@ export default {
//弹出组件属性监控
handleAttributeDialog(row){
this.attributeDiaLog=true;
this.getAttributeList(row.id);
this.machine_id=row.id;
this.getAttributeList(this.machine_id);
},
getAttributeList(id){
getAttributeList(id).then((response) => {
......@@ -54,8 +100,95 @@ export default {
}
});
},
//关闭组件属性监控
attributeDiaLogCancel(){
this.attributeDiaLog=false;
},
//弹出经验值
clickExperience(propertyId){
this.property_id=propertyId;
this.experienceList=[{quantity:null,milli_second:null}]
if(this.experienceList.length==1){
this.experienceShow=false;
}
this.experienceValueDiaLog=true;
},
//新增一行经验值
addItem(){
this.experienceList.push({quantity:null,milli_second:null});
this.experienceShow=true;
},
//删除一行经验值
subtractItem(idx){
this.experienceList.splice(idx, 1);
if(this.experienceList.length==1){
this.experienceShow=false;
}
},
//提交经验值
experienceSubmit(){
var regular=/(^[+]{0,1}([0-9]+)$)/;
let hang=0;
for(let i=0;i<this.experienceList.length;i++){
hang=i+1;
if(!regular.test(this.experienceList[i].milli_second)){
this.$message.error('第'+hang+'行,秒,请输入大于0的正数');
return;
}else{
this.experienceList[i].milli_second=parseFloat(this.experienceList[i].milli_second);
}
if(!regular.test(this.experienceList[i].quantity)){
this.$message.error('第'+hang+'行,克,请输入大于0的正数');
return;
}else{
this.experienceList[i].quantity=parseFloat(this.experienceList[i].quantity);
}
}
let obj={
"machine_id": this.machine_id,
"property_id": this.property_id,
"data":this.experienceList
}
addProperty(obj).then((response) => {
if(response.code==0){
this.$modal.msgSuccess("添加经验值成功!");
this.getAttributeList(this.machine_id);
this.experienceValueDiaLog=false;
}
});
},
//关闭经验值
experienceCancel(){
this.experienceValueDiaLog=false;
},
//经验值回显处理
showBut(val){
if(val!=""){
this.experienceValueShow=false;
return false;
}else{
this.experienceValueShow=true;
return true;
}
},
showJYZ_TEXT(exp_value){
let rval = '';
if(exp_value){
exp_value = JSON.parse(exp_value)
for(let i=0;i<exp_value.length;i++){
let exp = exp_value[i]
rval +=''+ exp.milli_second+"秒"+exp.quantity+"克" +' '
}
}
return rval
},
showJYZ(pro){
this.property_id=pro.property_id;
this.experienceList = JSON.parse(pro.experience_value);
if(this.experienceList.length==1){
this.experienceShow=false;
}
this.experienceValueDiaLog=true;
}
}
};
......
......@@ -88,7 +88,7 @@
<el-button @click="addItem">+</el-button>
</el-col>
<el-col :span="1">
<el-button @click="subtractItem(idx)">-</el-button>
<el-button v-show="comShow" @click="subtractItem(idx)">-</el-button>
</el-col>
</el-row>
</el-col>
......@@ -140,7 +140,8 @@ export default {
comTypeNameList:[],
componentList:[],
componentName:'',
com_ros_code:''
com_ros_code:'',
comShow:true
};
},
created() {
......@@ -151,8 +152,11 @@ export default {
addItem(){
this.comAry.push({pro_name:"",type:null,pro_ros_code:null,desc:""});
},
subtractItem(idx){
subtractItem(idx){
this.comAry.splice(idx, 1);
if(this.comAry.length==1){
this.comShow=false
}
},
//弹出机型组件页面
handleModelComDialog(id){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment