|
@@ -18,7 +18,7 @@
|
|
<el-button type="primary">查询</el-button>
|
|
<el-button type="primary">查询</el-button>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item style="float: right;">
|
|
<el-form-item style="float: right;">
|
|
- <el-button type="primary" @click="showAllocation">分配云模</el-button>
|
|
|
|
|
|
+ <el-button type="primary" @click="showAllocation">新建</el-button>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
</el-col>
|
|
</el-col>
|
|
@@ -32,15 +32,17 @@
|
|
style="width: 100%;"
|
|
style="width: 100%;"
|
|
>
|
|
>
|
|
<el-table-column type="index" width="60"></el-table-column>
|
|
<el-table-column type="index" width="60"></el-table-column>
|
|
- <el-table-column prop="id" label="云模盒编号" width="120" sortable></el-table-column>
|
|
|
|
- <el-table-column prop="power" label="电量" width="80" sortable></el-table-column>
|
|
|
|
- <el-table-column prop="useLife" label="倒计时" width="100" sortable></el-table-column>
|
|
|
|
- <el-table-column prop="equipmentName" label="模具名称" width="100" sortable></el-table-column>
|
|
|
|
- <el-table-column prop="equipmentNo" label="模具编号" width="120" sortable></el-table-column>
|
|
|
|
- <el-table-column prop="belongCompanyId" label="资产方" width="120" sortable></el-table-column>
|
|
|
|
- <el-table-column prop="state" label="模具状态" width="100" sortable>
|
|
|
|
|
|
+ <el-table-column prop="equipmentNo" label="云模盒编号" width="130" sortable></el-table-column>
|
|
|
|
+ <el-table-column label="电量" width="80" sortable></el-table-column>
|
|
|
|
+ <el-table-column prop="useLife" label="倒计时" width="100" sortable>
|
|
|
|
+ <template slot-scope="scope">{{scope.row.useLife}}天</template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column prop="equipmentName" label="模具名称" sortable></el-table-column>
|
|
|
|
+ <el-table-column label="模具编号" sortable></el-table-column>
|
|
|
|
+ <el-table-column prop="companyName" label="资产方" sortable></el-table-column>
|
|
|
|
+ <el-table-column label="模具状态" width="100" sortable>
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <span v-if="scope.row.state == false">未启用</span>
|
|
|
|
|
|
+ <span v-if="scope.row.isUse == 0">未启用</span>
|
|
<span v-else>已启用</span>
|
|
<span v-else>已启用</span>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
@@ -50,9 +52,9 @@
|
|
size="small"
|
|
size="small"
|
|
type="primary"
|
|
type="primary"
|
|
@click="enable(scope.$index)"
|
|
@click="enable(scope.$index)"
|
|
- :disabled="scope.row.state == true"
|
|
|
|
|
|
+ :disabled="scope.row.isUse == 1"
|
|
>启用</el-button>
|
|
>启用</el-button>
|
|
- <el-button size="small" @click="showEdit(5)">修改</el-button>
|
|
|
|
|
|
+ <el-button size="small" @click="showEdit(scope.row.id)">修改</el-button>
|
|
<el-button type="danger" size="small">删除</el-button>
|
|
<el-button type="danger" size="small">删除</el-button>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
@@ -87,11 +89,32 @@
|
|
:inline="true"
|
|
:inline="true"
|
|
class="demo-form-inline"
|
|
class="demo-form-inline"
|
|
>
|
|
>
|
|
- <el-form-item label="设备号">
|
|
|
|
|
|
+ <el-form-item label="云模盒编号" prop="equipmentNo">
|
|
<el-input v-model="newAllocation.equipmentNo" autocomplete="off" placeholder="请填写"></el-input>
|
|
<el-input v-model="newAllocation.equipmentNo" autocomplete="off" placeholder="请填写"></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="所属公司">
|
|
|
|
- <el-input v-model="newAllocation.belongCompanyId" autocomplete="off" placeholder="请填写"></el-input>
|
|
|
|
|
|
+ <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>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="使用年限" prop="useLife">
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="newAllocation.useLife"
|
|
|
|
+ type="number"
|
|
|
|
+ autocomplete="off"
|
|
|
|
+ placeholder="请填写"
|
|
|
|
+ ></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
|
<div slot="footer" class="dialog-footer">
|
|
@@ -116,22 +139,40 @@
|
|
:inline="true"
|
|
:inline="true"
|
|
class="demo-form-inline"
|
|
class="demo-form-inline"
|
|
>
|
|
>
|
|
- <el-form-item label="设备号">
|
|
|
|
|
|
+ <el-form-item label="云模盒编号" prop="equipmentNo">
|
|
<el-input v-model="newAllocation.equipmentNo" autocomplete="off" placeholder="请填写"></el-input>
|
|
<el-input v-model="newAllocation.equipmentNo" autocomplete="off" placeholder="请填写"></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="所属公司">
|
|
|
|
- <el-input v-model="newAllocation.belongCompanyId" autocomplete="off" placeholder="请填写"></el-input>
|
|
|
|
|
|
+ <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>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="设备名称">
|
|
|
|
|
|
+ <el-form-item label="设备名称" prop="equipmentName">
|
|
<el-input v-model="newAllocation.equipmentName" autocomplete="off" placeholder="请填写"></el-input>
|
|
<el-input v-model="newAllocation.equipmentName" autocomplete="off" placeholder="请填写"></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="使用年限">
|
|
|
|
- <el-input v-model="newAllocation.useLife" autocomplete="off" placeholder="请填写"></el-input>
|
|
|
|
|
|
+ <el-form-item label="使用年限" prop="useLife">
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="newAllocation.useLife"
|
|
|
|
+ type="number"
|
|
|
|
+ autocomplete="off"
|
|
|
|
+ placeholder="请填写"
|
|
|
|
+ ></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button @click.native="editFormVisible = false">取消</el-button>
|
|
<el-button @click.native="editFormVisible = false">取消</el-button>
|
|
- <el-button type="primary" @click="editMould">提交</el-button>
|
|
|
|
|
|
+ <el-button type="primary" @click="editMould(newAllocation.id)">提交</el-button>
|
|
</div>
|
|
</div>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
</section>
|
|
</section>
|
|
@@ -142,36 +183,10 @@ import util from "../../common/js/util";
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
- allocations: [
|
|
|
|
- //临时数据
|
|
|
|
- {
|
|
|
|
- id: "1234567",
|
|
|
|
- power: "N/A",
|
|
|
|
- useLife: "400天",
|
|
|
|
- equipmentName: "墨盒",
|
|
|
|
- equipmentNo: "MUJU123456",
|
|
|
|
- belongCompanyId: "南京火石闪信",
|
|
|
|
- state: true
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- id: "7891011",
|
|
|
|
- power: "N/A",
|
|
|
|
- useLife: "100天",
|
|
|
|
- equipmentName: "墨盒2",
|
|
|
|
- equipmentNo: "MUJU654321",
|
|
|
|
- belongCompanyId: "南京火石闪信",
|
|
|
|
- state: false
|
|
|
|
- }
|
|
|
|
- ],
|
|
|
|
- /**
|
|
|
|
- * 添加/修改模具设备
|
|
|
|
- * 添加参数:equipmentName 设备名称,useLife 使用年限, equipmentNo 设备编号 ,
|
|
|
|
- * belongCompanyId 所属公司id ,equipmentName 设备名称
|
|
|
|
- * 修改时需多传的参数 id 设备id
|
|
|
|
- */
|
|
|
|
|
|
+ allocations: [],
|
|
|
|
+ companies: {},
|
|
newAllocation: {
|
|
newAllocation: {
|
|
equipmentNo: "", //设备编号
|
|
equipmentNo: "", //设备编号
|
|
- // power: "",
|
|
|
|
useLife: "", //使用年限
|
|
useLife: "", //使用年限
|
|
equipmentName: "", //设备名称
|
|
equipmentName: "", //设备名称
|
|
id: "", //设备id
|
|
id: "", //设备id
|
|
@@ -181,9 +196,34 @@ export default {
|
|
name: "",
|
|
name: "",
|
|
value: ""
|
|
value: ""
|
|
},
|
|
},
|
|
- formRules: {},
|
|
|
|
|
|
+ formRules: {
|
|
|
|
+ equipmentNo: [
|
|
|
|
+ { required: true, message: "请输入云模盒编号", trigger: "blur" }
|
|
|
|
+ ],
|
|
|
|
+ useLife: [
|
|
|
|
+ {
|
|
|
|
+ required: true,
|
|
|
|
+ message: "请输入使用年限",
|
|
|
|
+ trigger: "blur"
|
|
|
|
+ }
|
|
|
|
+ ],
|
|
|
|
+ equipmentName: [
|
|
|
|
+ { required: true, message: "请输入设备名称", trigger: "blur" }
|
|
|
|
+ ],
|
|
|
|
+ belongCompanyId: [
|
|
|
|
+ {
|
|
|
|
+ required: true,
|
|
|
|
+ message: "请选择所属公司",
|
|
|
|
+ trigger: ["blur", "change"]
|
|
|
|
+ }
|
|
|
|
+ ]
|
|
|
|
+ },
|
|
listLoading: false,
|
|
listLoading: false,
|
|
|
|
+ addLoading: false,
|
|
|
|
+ editLoading: false,
|
|
total: 0,
|
|
total: 0,
|
|
|
|
+ page: 1,
|
|
|
|
+ size: 20,
|
|
tableHeight: 0,
|
|
tableHeight: 0,
|
|
addFormVisible: false,
|
|
addFormVisible: false,
|
|
editFormVisible: false
|
|
editFormVisible: false
|
|
@@ -193,11 +233,38 @@ export default {
|
|
//分页
|
|
//分页
|
|
handleCurrentChange(val) {
|
|
handleCurrentChange(val) {
|
|
this.page = val;
|
|
this.page = val;
|
|
- // this.getMoulds();
|
|
|
|
|
|
+ this.getMoulds();
|
|
},
|
|
},
|
|
handleSizeChange(val) {
|
|
handleSizeChange(val) {
|
|
this.size = val;
|
|
this.size = val;
|
|
- // this.getMoulds();
|
|
|
|
|
|
+ this.getMoulds();
|
|
|
|
+ },
|
|
|
|
+ //读取云模盒信息
|
|
|
|
+ getMoulds() {
|
|
|
|
+ this.listLoading = true;
|
|
|
|
+ this.http.post(
|
|
|
|
+ this.port.base.mouldeList,
|
|
|
|
+ {},
|
|
|
|
+ res => {
|
|
|
|
+ this.listLoading = false;
|
|
|
|
+ if (res.code == "ok") {
|
|
|
|
+ this.allocations = res.data.list;
|
|
|
|
+ this.total = res.data.total;
|
|
|
|
+ } else {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: res.msg,
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ error => {
|
|
|
|
+ this.listLoading = false;
|
|
|
|
+ this.$message({
|
|
|
|
+ message: error,
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ );
|
|
},
|
|
},
|
|
//添加界面
|
|
//添加界面
|
|
showAllocation() {
|
|
showAllocation() {
|
|
@@ -225,21 +292,23 @@ export default {
|
|
addMould() {
|
|
addMould() {
|
|
this.$refs.newAllocation.validate(valid => {
|
|
this.$refs.newAllocation.validate(valid => {
|
|
if (valid) {
|
|
if (valid) {
|
|
- this.editLoading = true;
|
|
|
|
|
|
+ this.addLoading = true;
|
|
this.http.post(
|
|
this.http.post(
|
|
this.port.base.editMould,
|
|
this.port.base.editMould,
|
|
{
|
|
{
|
|
equipmentNo: this.newAllocation.equipmentNo,
|
|
equipmentNo: this.newAllocation.equipmentNo,
|
|
- belongCompanyId: this.newAllocation.belongCompanyId
|
|
|
|
|
|
+ belongCompanyId: this.newAllocation.belongCompanyId,
|
|
|
|
+ useLife: this.newAllocation.useLife
|
|
},
|
|
},
|
|
res => {
|
|
res => {
|
|
- this.editLoading = false;
|
|
|
|
- this.editFormVisible = false;
|
|
|
|
|
|
+ this.addLoading = false;
|
|
|
|
+ this.addFormVisible = false;
|
|
if (res.code == "ok") {
|
|
if (res.code == "ok") {
|
|
this.$message({
|
|
this.$message({
|
|
message: "添加成功",
|
|
message: "添加成功",
|
|
type: "success"
|
|
type: "success"
|
|
});
|
|
});
|
|
|
|
+ this.getMoulds();
|
|
} else {
|
|
} else {
|
|
this.$message({
|
|
this.$message({
|
|
message: res.msg,
|
|
message: res.msg,
|
|
@@ -248,8 +317,8 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
error => {
|
|
error => {
|
|
- this.editLoading = false;
|
|
|
|
- this.editFormVisible = false;
|
|
|
|
|
|
+ this.addLoading = false;
|
|
|
|
+ this.addFormVisible = false;
|
|
this.$message({
|
|
this.$message({
|
|
message: error,
|
|
message: error,
|
|
type: "error"
|
|
type: "error"
|
|
@@ -267,13 +336,13 @@ export default {
|
|
this.http.post(
|
|
this.http.post(
|
|
this.port.base.editMould,
|
|
this.port.base.editMould,
|
|
{
|
|
{
|
|
|
|
+ id: this.newAllocation.id,
|
|
equipmentNo: this.newAllocation.equipmentNo,
|
|
equipmentNo: this.newAllocation.equipmentNo,
|
|
equipmentName: this.newAllocation.equipmentName,
|
|
equipmentName: this.newAllocation.equipmentName,
|
|
belongCompanyId: this.newAllocation.belongCompanyId,
|
|
belongCompanyId: this.newAllocation.belongCompanyId,
|
|
useLife: this.newAllocation.useLife
|
|
useLife: this.newAllocation.useLife
|
|
},
|
|
},
|
|
res => {
|
|
res => {
|
|
- console.log(res);
|
|
|
|
this.editLoading = false;
|
|
this.editLoading = false;
|
|
this.editFormVisible = false;
|
|
this.editFormVisible = false;
|
|
if (res.code == "ok") {
|
|
if (res.code == "ok") {
|
|
@@ -281,6 +350,7 @@ export default {
|
|
message: "添加成功",
|
|
message: "添加成功",
|
|
type: "success"
|
|
type: "success"
|
|
});
|
|
});
|
|
|
|
+ this.getMoulds();
|
|
} else {
|
|
} else {
|
|
this.$message({
|
|
this.$message({
|
|
message: res.msg,
|
|
message: res.msg,
|
|
@@ -302,13 +372,11 @@ export default {
|
|
},
|
|
},
|
|
//启用设备
|
|
//启用设备
|
|
enable(index) {
|
|
enable(index) {
|
|
- this.allocations[index].state = true;
|
|
|
|
- //启用设备调用
|
|
|
|
|
|
+ this.allocations[index].isUse = 1;
|
|
this.http.post(
|
|
this.http.post(
|
|
this.port.base.enableMould,
|
|
this.port.base.enableMould,
|
|
{
|
|
{
|
|
- //数是瞎写的
|
|
|
|
- id: 1,
|
|
|
|
|
|
+ id: this.allocations[index].id,
|
|
isUse: 1
|
|
isUse: 1
|
|
},
|
|
},
|
|
res => {
|
|
res => {
|
|
@@ -317,7 +385,7 @@ export default {
|
|
message: "修改成功",
|
|
message: "修改成功",
|
|
type: "success"
|
|
type: "success"
|
|
});
|
|
});
|
|
- this.getRoles();
|
|
|
|
|
|
+ this.getMoulds();
|
|
} else {
|
|
} else {
|
|
this.$message({
|
|
this.$message({
|
|
message: res.msg,
|
|
message: res.msg,
|
|
@@ -338,7 +406,31 @@ export default {
|
|
let height = window.innerHeight;
|
|
let height = window.innerHeight;
|
|
this.tableHeight = height - 210;
|
|
this.tableHeight = height - 210;
|
|
},
|
|
},
|
|
- mounted() {}
|
|
|
|
|
|
+ mounted() {
|
|
|
|
+ //获取模具列表
|
|
|
|
+ this.getMoulds();
|
|
|
|
+ //获取公司下拉列表
|
|
|
|
+ this.http.post(
|
|
|
|
+ this.port.base.comps,
|
|
|
|
+ {},
|
|
|
|
+ res => {
|
|
|
|
+ if (res.code == "ok") {
|
|
|
|
+ this.companies = res.data;
|
|
|
|
+ } else {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: res.msg,
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ error => {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: error,
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ }
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
|
|
|