|
@@ -32,13 +32,19 @@
|
|
|
<el-form-item style="float: right;">
|
|
|
<el-button type="primary" @click="showAllocation">新建</el-button>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item style="float: right;">
|
|
|
+ <el-button type="primary" @click="issued">下发</el-button>
|
|
|
+ </el-form-item>
|
|
|
</el-form>
|
|
|
</el-col>
|
|
|
|
|
|
<!--列表-->
|
|
|
- <el-table :data="allocations" :height="tableHeight" highlight-current-row v-loading="listLoading" style="width: 100%;">
|
|
|
+ <el-table :data="allocations" :height="tableHeight" highlight-current-row v-loading="listLoading" @selection-change="handleSelectionChange" style="width: 100%;">
|
|
|
+ <el-table-column type="selection" width="50"></el-table-column>
|
|
|
<el-table-column type="index" width="60"></el-table-column>
|
|
|
- <el-table-column prop="equipmentNo" label="云模盒编号" width="130" sortable></el-table-column>
|
|
|
+ <el-table-column prop="equipmentNo" label="云模盒编号" width="180" sortable>
|
|
|
+ <template slot-scope="scope">12345678998765432132</template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column prop="hillNumber" label="电量" width="80" align="center" sortable></el-table-column>
|
|
|
<el-table-column prop="useLife" label="使用年限" width="100" align="center" sortable>
|
|
|
<template slot-scope="scope">{{scope.row.useLife}}年</template>
|
|
@@ -58,9 +64,10 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="操作" align="center" width="160">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button size="small" v-if="scope.row.modelNo != null" type="primary" @click="openEnable(scope.$index)">启用</el-button>
|
|
|
+ <el-button size="small" v-if="scope.row.modelNo != null && scope.row.isUse == 0" type="primary" @click="openEnable(scope.$index)">启用</el-button>
|
|
|
+ <el-button size="small" v-if="scope.row.modelNo != null && scope.row.isUse == 1" type="danger" @click="disableEquipment(scope.$index)">停用</el-button>
|
|
|
<!-- :disabled="scope.row.isUse == 1" -->
|
|
|
- <el-button size="small" :style="scope.row.modelNo!=null?'':'float:right;margin-right:6px'" @click="showEdit(scope.$index, scope.row, scope.row.isUse == 1)">修改</el-button>
|
|
|
+ <el-button size="small" :style="scope.row.modelNo != null?'':'float:right;margin-right:6px'" @click="showEdit(scope.$index, scope.row, scope.row.isUse == 1)">修改</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -80,48 +87,20 @@
|
|
|
|
|
|
<!--新增界面-->
|
|
|
<el-dialog title="新建云模盒" v-if="addFormVisible" :visible.sync="addFormVisible" :close-on-click-modal="false" customClass="customWidth">
|
|
|
- <el-form
|
|
|
- :model="newAllocation"
|
|
|
- label-width="100px"
|
|
|
- :rules="formRules"
|
|
|
- ref="newAllocation"
|
|
|
- :inline="true"
|
|
|
- class="demo-form-inline"
|
|
|
- >
|
|
|
+ <el-form :model="newAllocation" label-width="100px" :rules="formRules" ref="newAllocation" :inline="true" class="demo-form-inline">
|
|
|
<el-form-item label="云模盒编号" prop="equipmentNo">
|
|
|
<el-input v-model="newAllocation.equipmentNo" autocomplete="off" placeholder="请输入云模盒编号"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="所属公司" prop="belongCompanyId">
|
|
|
- <el-select
|
|
|
- v-model="newAllocation.belongCompanyId"
|
|
|
- filterable
|
|
|
- clearable
|
|
|
- placeholder="请选择所属公司"
|
|
|
- style="width: 202px"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in companies"
|
|
|
- :key="item.id"
|
|
|
- :label="item.companyName"
|
|
|
- :value="item.id"
|
|
|
- ></el-option>
|
|
|
+ <el-select v-model="newAllocation.belongCompanyId" filterable clearable placeholder="请选择所属公司" style="width: 202px">
|
|
|
+ <el-option v-for="item in companies" :key="item.id" :label="item.companyName" :value="item.id"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="使用年限" prop="useLife">
|
|
|
- <el-input
|
|
|
- v-model.number="newAllocation.useLife"
|
|
|
- type="age"
|
|
|
- autocomplete="off"
|
|
|
- placeholder="请输入使用年限"
|
|
|
- ></el-input>
|
|
|
+ <el-input v-model.number="newAllocation.useLife" type="age" autocomplete="off" placeholder="请输入使用年限"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="代理商" prop="agent">
|
|
|
- <el-input
|
|
|
- v-model="newAllocation.agent"
|
|
|
- autocomplete="off"
|
|
|
- placeholder="请输入代理商"
|
|
|
- style="width: 202px"
|
|
|
- ></el-input>
|
|
|
+ <el-input v-model="newAllocation.agent" autocomplete="off" placeholder="请输入代理商" style="width: 202px"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
@@ -131,56 +110,21 @@
|
|
|
</el-dialog>
|
|
|
|
|
|
<!--修改界面-->
|
|
|
- <el-dialog
|
|
|
- title="修改云模盒"
|
|
|
- v-if="editFormVisible"
|
|
|
- :visible.sync="editFormVisible"
|
|
|
- :close-on-click-modal="false"
|
|
|
- customClass="customWidth"
|
|
|
- >
|
|
|
- <el-form
|
|
|
- :model="newAllocation"
|
|
|
- label-width="100px"
|
|
|
- :rules="formRules"
|
|
|
- ref="newAllocation"
|
|
|
- :inline="true"
|
|
|
- class="demo-form-inline"
|
|
|
- >
|
|
|
+ <el-dialog title="修改云模盒" v-if="editFormVisible" :visible.sync="editFormVisible" :close-on-click-modal="false" customClass="customWidth">
|
|
|
+ <el-form :model="newAllocation" label-width="100px" :rules="formRules" ref="newAllocation" :inline="true" class="demo-form-inline">
|
|
|
<el-form-item label="云模盒编号" prop="equipmentNo">
|
|
|
<el-input v-model="newAllocation.equipmentNo" autocomplete="off" placeholder="请输入云模盒编号"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="所属公司" prop="belongCompanyId">
|
|
|
- <el-select
|
|
|
- v-model="newAllocation.belongCompanyId"
|
|
|
- filterable
|
|
|
- clearable
|
|
|
- placeholder="请选择所属公司"
|
|
|
- style="width: 202px"
|
|
|
- :disabled="newAllocation.usage"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in companies"
|
|
|
- :key="item.id"
|
|
|
- :label="item.companyName"
|
|
|
- :value="item.id"
|
|
|
- ></el-option>
|
|
|
+ <el-select v-model="newAllocation.belongCompanyId" filterable clearable placeholder="请选择所属公司" style="width: 202px" :disabled="newAllocation.usage">
|
|
|
+ <el-option v-for="item in companies" :key="item.id" :label="item.companyName" :value="item.id"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="使用年限" prop="useLife">
|
|
|
- <el-input
|
|
|
- v-model.number="newAllocation.useLife"
|
|
|
- type="age"
|
|
|
- autocomplete="off"
|
|
|
- placeholder="请输入使用年限"
|
|
|
- ></el-input>
|
|
|
+ <el-input v-model.number="newAllocation.useLife" type="age" autocomplete="off" placeholder="请输入使用年限"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="代理商" prop="agent">
|
|
|
- <el-input
|
|
|
- v-model="newAllocation.agent"
|
|
|
- autocomplete="off"
|
|
|
- placeholder="请输入代理商"
|
|
|
- style="width: 202px"
|
|
|
- ></el-input>
|
|
|
+ <el-input v-model="newAllocation.agent" autocomplete="off" placeholder="请输入代理商" style="width: 202px"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
@@ -191,21 +135,34 @@
|
|
|
|
|
|
<!-- 启用弹窗 -->
|
|
|
<el-dialog title="启用" :visible.sync="operateDialogVisible" width="400px">
|
|
|
- <el-form
|
|
|
- label-width="100px"
|
|
|
- :rules="formRules"
|
|
|
- :inline="true"
|
|
|
- class="demo-form-inline"
|
|
|
- >
|
|
|
- <el-form-item label="某个参数">
|
|
|
+ <el-form label-width="100px" :rules="formRules" :inline="true" class="demo-form-inline">
|
|
|
+ <!-- <el-form-item label="某个参数">
|
|
|
<el-input autocomplete="off" placeholder="填了也不会发生什么"></el-input>
|
|
|
- </el-form-item>
|
|
|
+ </el-form-item> -->
|
|
|
</el-form>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button @click="operateDialogVisible = false">取消</el-button>
|
|
|
<el-button type="primary" @click="enable">启用</el-button>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <!-- 下发弹窗 -->
|
|
|
+ <el-dialog title="下发" :visible.sync="issuedVisible" width="450px">
|
|
|
+ <el-form :model="issuedVal" label-width="130px" :rules="formRules" ref="issuedVal" :inline="true" class="demo-form-inline">
|
|
|
+ <el-form-item label="报警电池电量" prop="alarmBattery">
|
|
|
+ <el-input v-model.number="issuedVal.alarmBattery" type="age" autocomplete="off" placeholder="请输入报警电池电量" style="width:250px;"></el-input>
|
|
|
+ %
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="热报警度数" prop="alarmDegree">
|
|
|
+ <el-input v-model.number="issuedVal.alarmDegree" type="age" autocomplete="off" placeholder="请输入热报警度数" style="width:250px;"></el-input>
|
|
|
+ ℃
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="issuedVisible = false">取消</el-button>
|
|
|
+ <el-button type="primary" @click="saveIssued">下发</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
</section>
|
|
|
</template>
|
|
|
|
|
@@ -242,7 +199,15 @@
|
|
|
],
|
|
|
agent: [
|
|
|
{ required: true, message: "请输入代理商", trigger: "blur" }
|
|
|
- ]
|
|
|
+ ],
|
|
|
+ alarmBattery: [
|
|
|
+ { required: true, message: '请输入报警电池电量'},
|
|
|
+ { type: 'number', message: '报警电池电量必须为数字值'}
|
|
|
+ ],
|
|
|
+ alarmDegree: [
|
|
|
+ { required: true, message: '请输入热报警度数'},
|
|
|
+ { type: 'number', message: '热报警度数必须为数字值'}
|
|
|
+ ],
|
|
|
},
|
|
|
|
|
|
listLoading: false,
|
|
@@ -258,7 +223,14 @@
|
|
|
addFormVisible: false,
|
|
|
editFormVisible: false,
|
|
|
operateDialogVisible: false,
|
|
|
- activeIndex: 0
|
|
|
+ activeIndex: 0,
|
|
|
+
|
|
|
+ issuedVal: {
|
|
|
+ alarmBattery: 30,
|
|
|
+ alarmDegree: 80,
|
|
|
+ },
|
|
|
+ issuedVisible: false,
|
|
|
+ multipleSelection: [],
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
@@ -487,6 +459,43 @@
|
|
|
}
|
|
|
},
|
|
|
|
|
|
+ //停用云模盒
|
|
|
+ disableEquipment(index) {
|
|
|
+ if(this.allocations[index].belongCompanyId == null){
|
|
|
+ this.$message({
|
|
|
+ message: "输入所属公司后才能启用模具",
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ this.operateDialogVisible = false;
|
|
|
+ this.allocations[index].isUse = 0;
|
|
|
+ this.http.post( this.port.base.enableMould, {
|
|
|
+ id: this.allocations[index].id,
|
|
|
+ isUse: 0
|
|
|
+ },
|
|
|
+ res => {
|
|
|
+ if (res.code == "ok") {
|
|
|
+ this.$message({
|
|
|
+ message: "设备已停用",
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
+ this.getMoulds();
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: res.msg,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error => {
|
|
|
+ this.$message({
|
|
|
+ message: error,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
//导入云模盒
|
|
|
uploadFile(params) {
|
|
|
var fileObj = params.file;
|
|
@@ -518,7 +527,62 @@
|
|
|
type: "error"
|
|
|
});
|
|
|
});
|
|
|
+ },
|
|
|
+
|
|
|
+ //列表选择
|
|
|
+ handleSelectionChange(val) {
|
|
|
+ this.multipleSelection = val;
|
|
|
+ },
|
|
|
+
|
|
|
+ //下发云模盒
|
|
|
+ issued() {
|
|
|
+ this.issuedVisible = true;
|
|
|
+ },
|
|
|
+
|
|
|
+ saveIssued() {
|
|
|
+ console.log(this.multipleSelection)
|
|
|
+ console.log(this.issuedVal)
|
|
|
+ console.log(this.issuedVal.alarmBattery.toString(16))
|
|
|
+ console.log(this.issuedVal.alarmDegree.toString(16))
|
|
|
+ if(this.multipleSelection.length == 0) {
|
|
|
+ this.$message({
|
|
|
+ message: "请选择要下发的云模盒",
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ var str = '';
|
|
|
+ for(var i in this.multipleSelection) {
|
|
|
+ str += this.multipleSelection[i].equipmentNo + ',';
|
|
|
+ }
|
|
|
+ str = str.substring(0,str.length-1)
|
|
|
+ this.http.post( this.port.base.setPacket, {
|
|
|
+ lowPowerLimit: this.issuedVal.alarmBattery.toString(16),
|
|
|
+ hotAlarmLimit: this.issuedVal.alarmDegree.toString(16),
|
|
|
+ equipmentNo: str
|
|
|
+ },
|
|
|
+ res => {
|
|
|
+ if (res.code == "ok") {
|
|
|
+ this.$message({
|
|
|
+ message: "下发成功",
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
+ this.getMoulds();
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: res.msg,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error => {
|
|
|
+ this.$message({
|
|
|
+ message: error,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
},
|
|
|
created() {
|
|
|
let height = window.innerHeight;
|