Commit 6ce0f1fe by lixiaomin

提交

parent 10bb6221
import request from "@/utils/request";
// 机器详情列表
export function getMachineList(data) {
return request({
url: "/v1/machine/list",
method: "post",
data: data,
});
}
// 机器出产日志
export function getMachineLog(id) {
return request({
url: "/v1/machine/log?machine_id=" + id,
method: "get",
});
}
// 机器硬件日志
export function getMachineComLog(id) {
return request({
url: "/v1/machine/component/log?machine_id=" + id,
method: "get",
});
}
// 机器组件
export function getComponentList(id) {
return request({
url: "/v1/machine/component?machine_id=" + id,
method: "get",
});
}
// 咖啡菜单
export function getCoffeeList(id) {
return request({
url: "/v1/coffee/product/list?machine_id=" + id,
method: "get",
});
}
// 提交原料
export function addMaterial(data) {
return request({
url: "v1/add/machine/component/material",
method: "post",
data: data,
});
}
<template>
<div class="app-container">
<!-- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="100px">
<el-form-item label="优惠券类别" >
<el-input v-model="queryParams.name" clearable @keyup.enter.native="handleQuery"></el-input>
</el-form-item>
<el-form-item label="状态">
<el-select v-model="queryParams.state" placeholder="请选择状态" clearable @keyup.enter.native="handleQuery">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery" v-hasPermi="['coupon:category:query']">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form> -->
<el-table v-loading="loading" :data="machineList">
<el-table-column label="机器编码" align="center">
<template slot-scope="scope">
<a @click="handleLogDialog(scope.row)" style="color: blue">{{ scope.row.code }}</a>
</template>
</el-table-column>
<el-table-column label="机器型号" align="center" prop="model" />
<el-table-column label="状态" align="center" prop="state" />
<el-table-column label="绑定时间" align="center" prop="desc" />
<el-table-column label="组件管理" align="center">
<template slot-scope="scope">
<a @click="handleComponentDialog(scope.row)" style="color: blue">管理组件</a>
</template>
</el-table-column>
<el-table-column label="组件属性监控" align="center" />
<el-table-column label="其他设置" align="center">
<template slot-scope="scope">
<a @click="handleOtherDialog(scope.row)" style="color: blue">查看</a>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList" />
<!-- 机器日志对话框 -->
<MachineDetailsLog ref="machineDetailsLog" ></MachineDetailsLog>
<!-- 组件对话框 -->
<MachineDetailsCom ref="machineDetailsCom" ></MachineDetailsCom>
<!-- 其他组件对话框 -->
<MachineDetailsOther ref="machineDetailsOther" ></MachineDetailsOther>
</div>
</template>
<script>
import {getMachineList
} from "@/api/machine/machineDetails";
import MachineDetailsLog from './machineDetailsLog.vue';
import MachineDetailsCom from './machineDetailsCom.vue';
import MachineDetailsOther from './machineDetailsOther.vue';
export default {
components: { MachineDetailsLog,MachineDetailsCom,MachineDetailsOther},
data() {
return {
// 遮罩层
loading: true,
// 总条数
total: 0,
// 表格数据
machineList: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
}
};
},
created() {
this.getList();
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
getMachineList(this.queryParams).then((response) => {
if(response.code==0){
this.machineList = response.data;
this.total = response.data.length;
this.loading = false;
}
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams.name=null;
this.queryParams.state=null;
this.handleQuery();
},
//日志
handleLogDialog(row){
this.$refs.machineDetailsLog.handleLogDialog(row.id);
},
//组件
handleComponentDialog(row){
this.$refs.machineDetailsCom.handleComDiaLog(row);
},
//其他设置
handleOtherDialog(row){
this.$refs.machineDetailsOther.handleOthDiaLog(row);
}
}
};
</script>
<template>
<div>
<el-dialog title="组建管理" :visible.sync="comDiaLog" width="700px" append-to-body >
<el-tabs v-model="activeName" >
<el-tab-pane label="组件信息" name="first" >
<el-table v-loading="loading" :data="componentList">
<el-table-column label="组件类型" align="center" prop="type_desc" />
<el-table-column label="组件名称" align="center" prop="component_name" />
<el-table-column label="组件编码" align="center" prop="ros_code" />
<el-table-column label="备注说明" align="center" prop=""/>
<el-table-column label="组件状态" align="center" prop="state"/>
<el-table-column label="原料" align="center">
<template slot-scope="scope">
<a @click="handleMaterialDialog(scope.row)" style="color: blue">添加原料</a>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
<div slot="footer" class="dialog-footer" >
<el-button type="primary" @click="comDiaLogCancel" >确定</el-button>
<el-button @click="comDiaLogCancel">退出</el-button>
</div>
</el-dialog>
<el-dialog title="添加原料" :visible.sync="materialDiaLog" width="600px" append-to-body>
<el-radio-group v-model="materialId" class="radioClass">
<el-radio v-for="item in materialList" :key="item.id" :label="item.id">{{item.name}}</el-radio>
</el-radio-group>
<div slot="footer" class="dialog-footer" >
<el-button type="primary" @click="submitMaterial" >确定</el-button>
<el-button @click="cancelMaterial">取消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {getComponentList,addMaterial} from "@/api/machine/machineDetails";
import {listMaterial} from "@/api/system/material";
export default {
data() {
return {
// 遮罩层
loading: true,
comDiaLog:false,
activeName:"first",
machineId:null,
componentList:[],
materialDiaLog:false,
materialList:[],
ros_code:"",
component_name:"",
materialId:""
};
},
created() {
},
watch: {
},
methods: {
//弹出机器页面
handleComDiaLog(row){
this.comDiaLog=true;
this.machineId=row.id;
this.activeName="first";
this.getComponentList();
},
getComponentList(){
this.loading = true;
getComponentList(this.machineId).then((response) => {
if(response.code==0){
this.componentList = response.data;
this.loading = false;
}
});
},
comDiaLogCancel(){
this.comDiaLog=false
},
//弹出添加原料页面
handleMaterialDialog(row){
this.materialId="";
this.ros_code=row.ros_code;
this.component_name=row.component_name;
this.materialDiaLog=true;
this.getMaterialList();
},
/** 原料列表 */
getMaterialList() {
listMaterial({pageNum:1,pageSize:100000,state:1}).then(response => {
this.materialList = response.rows;
});
},
//提交原料
submitMaterial(){
let materialName="";
for(let i=0;i<this.materialList.length;i++){
if(this.materialId==this.materialList[i].id){
materialName=this.materialList[i].name;
}
}
let obj={
"machine_id":this.machineId ,
"ros_code": this.ros_code,
"component_name": this.component_name,
"material_id": this.materialId,
"material": materialName
}
addMaterial(obj).then(response => {
if(response.code==0){
this.$modal.msgSuccess("添加原料成功!");
this.getComponentList();
this.materialDiaLog=false;
}
});
},
//关闭原料页面
cancelMaterial(){
this.materialDiaLog=false
},
}
};
</script>
<style lang="scss">
.radioClass .el-radio{
width: 200px;
}
</style>
\ No newline at end of file
<template>
<div>
<el-dialog title="机器日志" :visible.sync="logDiaLog" width="700px" append-to-body >
<el-tabs v-model="activeName" >
<el-tab-pane label="出厂日志" name="first" >
<div v-for="item in machineLogData" :key="item.id">
<b><span>{{item.created_at}} {{item.message}}</span></b>
</div>
</el-tab-pane>
<el-tab-pane label="硬件日志" name="second">
<div v-for="item in machineComLogData" :key="item.id">
<b><span>{{item.created_at}} {{item.message}}</span></b>
</div>
</el-tab-pane>
</el-tabs>
<div slot="footer" class="dialog-footer" >
<el-button v-show="contentTag" type="primary" @click="onClickContent" >主动上报内容</el-button>
<el-button @click="logDialogCancel">退出</el-button>
</div>
</el-dialog>
<el-dialog title="主动上报日志" :visible.sync="logContentDiaLog" width="500px" append-to-body >
<el-input type="textarea" :rows="10" placeholder="请输入上报日志内容" v-model="textarea1"/>
<div slot="footer" class="dialog-footer" >
<el-button type="primary" @click="submitLogContent" >确定</el-button>
<el-button @click="contentDialogCancel">取消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {getMachineLog,getMachineComLog} from "@/api/machine/machineDetails";
export default {
data() {
return {
logDiaLog:false,
activeName:"first",
machineLogData:[],
machineComLogData:[],
machineId:null,
contentTag:true,
logContentDiaLog:false,
textarea1:'',
};
},
created() {
},
watch: {
activeName(value) {
if(value=="first"){
this.contentTag=true;
this.getMachineLog();
}else if(value=="second"){
this.contentTag=false;
this.getMachineComLog();
}
}
},
methods: {
//弹出机器页面
handleLogDialog(val){
this.activeName="first";
this.machineId=val;
this.logDiaLog=true;
this.getMachineLog();
},
onClickContent(){
this.logContentDiaLog=true;
},
logDialogCancel(){
this.logDiaLog=false;
},
//提交主动上报日志
submitLogContent(){
},
contentDialogCancel(){
this.logContentDiaLog=false;
},
//出厂日志
getMachineLog(){
getMachineLog(this.machineId).then((response) => {
if(response.code==0){
this.machineLogData = response.data;
}
});
},
//硬件日志
getMachineComLog(){
getMachineComLog(this.machineId).then((response) => {
if(response.code==0){
this.machineComLogData = response.data;
}
});
}
}
};
</script>
\ No newline at end of file
<template>
<div>
<el-dialog title="其他设置" :visible.sync="coffeeDiaLog" width="700px" append-to-body >
<el-tabs v-model="activeName" >
<el-tab-pane label="咖啡机" name="first" >
<div>
<el-row>
<el-col :span="5">
<el-input />
</el-col>
<el-col :span="5">
<el-input />
</el-col>
<el-col :span="5">
<el-input />
</el-col>
<el-col :span="5">
<el-input />
</el-col>
<el-col :span="4">
<el-input />
</el-col>
</el-row>
<el-pagination layout="prev, pager, next" :total="total" @current-change="handleCurrentChange"> </el-pagination>
</div>
</el-tab-pane>
</el-tabs>
<div slot="footer" class="dialog-footer" >
<el-button type="primary" @click="otherDialogCancel" >确定</el-button>
<el-button @click="otherDialogCancel">取消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {getCoffeeList} from "@/api/machine/machineDetails";
export default {
data() {
return {
// 遮罩层
loading: true,
coffeeDiaLog:false,
coffeeList:[],
activeName:"first",
total:0,
};
},
created() {
},
methods: {
//弹出机器页面
handleOthDiaLog(row){
this.machineId=row.id;
this.coffeeDiaLog=true;
this.getCoffeeList();
},
getCoffeeList(){
this.loading = true;
getCoffeeList(this.machineId).then((response) => {
if(response.code==0){
for(let i=0;i<response.data.length;i++){
if(response.data[i].page==1){
this.coffeeList=response.data[i].data;
break;
}
}
this.total=response.data.length;
this.loading = false;
}
});
},
otherDialogCancel(){
this.coffeeDiaLog=false;
},
handleCurrentChange(val){
console.log("val",val)
}
}
};
</script>
\ No newline at end of file
<template>
<div>
机型
</div>
</template>
\ No newline at end of file
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