|
@@ -9,8 +9,8 @@
|
|
|
<i class="el-icon-arrow-down el-icon--right"></i>
|
|
|
</span>
|
|
|
<el-dropdown-menu slot="dropdown">
|
|
|
- <el-dropdown-item>开箱</el-dropdown-item>
|
|
|
- <el-dropdown-item>停用</el-dropdown-item>
|
|
|
+ <el-dropdown-item>启用柜子</el-dropdown-item>
|
|
|
+ <el-dropdown-item>停用柜子</el-dropdown-item>
|
|
|
</el-dropdown-menu>
|
|
|
</el-dropdown>
|
|
|
</div>
|
|
@@ -21,201 +21,68 @@
|
|
|
v-model="tabActive"
|
|
|
style="margin-top:10px;"
|
|
|
:before-leave="onBeforeChangeTab"
|
|
|
+ @tab-click="onTabClick"
|
|
|
>
|
|
|
- <el-tab-pane label="1号柜" name="first">
|
|
|
- <div>
|
|
|
- <el-row justify="space-around" :gutter="10">
|
|
|
- <el-col :span="6">
|
|
|
- <el-card class="box-card">
|
|
|
- <div slot="header" class="clearfix">
|
|
|
- <span>1号柜</span>
|
|
|
- <el-button style="float: right; padding: 3px 0" type="text">开箱</el-button>
|
|
|
- </div>
|
|
|
- <div style="height:72px;">
|
|
|
- <el-row type="flex" align="middle" style="height:100%;">
|
|
|
- <el-button>空闲</el-button>
|
|
|
- </el-row>
|
|
|
- </div>
|
|
|
- </el-card>
|
|
|
- </el-col>
|
|
|
- <el-col :span="6">
|
|
|
- <el-card class="box-card">
|
|
|
- <div slot="header" class="clearfix">
|
|
|
- <span>2号柜</span>
|
|
|
- <el-button style="float: right; padding: 3px 0" type="text">开箱</el-button>
|
|
|
- </div>
|
|
|
- <el-row type="flex" justify="space-between">
|
|
|
- <el-row type="flex" align="middle">
|
|
|
- <el-button type="danger">使用中</el-button>
|
|
|
- </el-row>
|
|
|
- <div>
|
|
|
- <h4>
|
|
|
- 黄先生
|
|
|
- <el-button style="margin-left:10px;" size="mini" type="primary">通知</el-button>
|
|
|
- </h4>
|
|
|
- <h4>130xxxxxxxx</h4>
|
|
|
- <h4>8小时</h4>
|
|
|
- </div>
|
|
|
- </el-row>
|
|
|
- </el-card>
|
|
|
- </el-col>
|
|
|
- <el-col :span="6">
|
|
|
- <el-card class="box-card">
|
|
|
- <div slot="header" class="clearfix">
|
|
|
- <span>3号柜</span>
|
|
|
- <el-button style="float: right; padding: 3px 0" type="text">开箱</el-button>
|
|
|
- </div>
|
|
|
- <el-row type="flex" justify="space-between">
|
|
|
- <el-row type="flex" align="middle">
|
|
|
- <el-button type="danger">使用中</el-button>
|
|
|
- </el-row>
|
|
|
- <div>
|
|
|
- <h4>
|
|
|
- 黄先生
|
|
|
- <el-button style="margin-left:10px;" size="mini" type="primary">通知</el-button>
|
|
|
- </h4>
|
|
|
- <h4>130xxxxxxxx</h4>
|
|
|
- <h4>8小时</h4>
|
|
|
- </div>
|
|
|
- </el-row>
|
|
|
- </el-card>
|
|
|
- </el-col>
|
|
|
- <el-col :span="6">
|
|
|
- <el-card class="box-card">
|
|
|
- <div slot="header" class="clearfix">
|
|
|
- <span>4号柜</span>
|
|
|
- <el-button style="float: right; padding: 3px 0" type="text">开箱</el-button>
|
|
|
- </div>
|
|
|
- <el-row type="flex" justify="space-between">
|
|
|
- <el-row type="flex" align="middle">
|
|
|
- <el-button type="danger">使用中</el-button>
|
|
|
- </el-row>
|
|
|
- <div>
|
|
|
- <h4>
|
|
|
- 黄先生
|
|
|
- <el-button style="margin-left:10px;" size="mini" type="primary">通知</el-button>
|
|
|
- </h4>
|
|
|
- <h4>130xxxxxxxx</h4>
|
|
|
- <h4>8小时</h4>
|
|
|
- </div>
|
|
|
- </el-row>
|
|
|
- </el-card>
|
|
|
- </el-col>
|
|
|
- <el-col :span="6">
|
|
|
- <el-card class="box-card">
|
|
|
- <div slot="header" class="clearfix">
|
|
|
- <span>5号柜</span>
|
|
|
- <el-button style="float: right; padding: 3px 0" type="text">开箱</el-button>
|
|
|
- </div>
|
|
|
- <el-row type="flex" justify="space-between">
|
|
|
- <el-row type="flex" align="middle">
|
|
|
- <el-button type="danger">使用中</el-button>
|
|
|
- </el-row>
|
|
|
- <div>
|
|
|
- <h4>
|
|
|
- 黄先生
|
|
|
- <el-button style="margin-left:10px;" size="mini" type="primary">通知</el-button>
|
|
|
- </h4>
|
|
|
- <h4>130xxxxxxxx</h4>
|
|
|
- <h4>8小时</h4>
|
|
|
- </div>
|
|
|
- </el-row>
|
|
|
- </el-card>
|
|
|
- </el-col>
|
|
|
- <el-col :span="6">
|
|
|
- <el-card class="box-card">
|
|
|
- <div slot="header" class="clearfix">
|
|
|
- <span>6号柜</span>
|
|
|
- <el-button style="float: right; padding: 3px 0" type="text">开箱</el-button>
|
|
|
- </div>
|
|
|
- <el-row type="flex" justify="space-between">
|
|
|
- <el-row type="flex" align="middle">
|
|
|
- <el-button type="danger">使用中</el-button>
|
|
|
- </el-row>
|
|
|
- <div>
|
|
|
- <h4>
|
|
|
- 黄先生
|
|
|
- <el-button style="margin-left:10px;" size="mini" type="primary">通知</el-button>
|
|
|
- </h4>
|
|
|
- <h4>130xxxxxxxx</h4>
|
|
|
- <h4>8小时</h4>
|
|
|
+ <template v-for="(item,index) in cabinetList">
|
|
|
+ <el-tab-pane :label="item.alias" :key="index" :name="item.id">
|
|
|
+ <div>
|
|
|
+ <el-row justify="space-around" :gutter="10">
|
|
|
+ <template v-for="(v,k) in boxList[index]">
|
|
|
+ <el-col :span="6" :key="k">
|
|
|
+ <el-card class="box-card">
|
|
|
+ <div slot="header" class="clearfix">
|
|
|
+ <span>{{v.box_number}}号柜</span>
|
|
|
+ <el-button style="float: right; padding: 3px 0" type="text">开箱</el-button>
|
|
|
+ </div>
|
|
|
+ <div style="height:72px;" v-if="v.box_status == 1">
|
|
|
+ <el-row type="flex" align="middle" style="height:100%;">
|
|
|
+ <el-button>{{v.status_text}}</el-button>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <el-row type="flex" justify="space-between" v-if="v.box_status == 2">
|
|
|
+ <el-row type="flex" align="middle">
|
|
|
+ <el-button type="danger">{{v.status_text}}</el-button>
|
|
|
+ </el-row>
|
|
|
+ <div style="height:72px;">
|
|
|
+ <h4>
|
|
|
+ 订单号:{{v.order_sn}}
|
|
|
+ <!-- <el-button style="margin-left:10px;" size="mini" type="primary">通知</el-button> -->
|
|
|
+ </h4>
|
|
|
+ <h4>入柜日期:{{v.enter_time}}</h4>
|
|
|
+ <h4>已使用:{{diffTime(v.enter_time)}}</h4>
|
|
|
+ </div>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <div style="height:72px;" v-if="v.box_status == 3">
|
|
|
+ <el-row type="flex" align="middle" style="height:100%;">
|
|
|
+ <el-button type="info">{{v.status_text}}</el-button>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+ </el-card>
|
|
|
+ </el-col>
|
|
|
+ </template>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-card class="box-card">
|
|
|
+ <div slot="header" class="clearfix">
|
|
|
+ <span>新增箱子</span>
|
|
|
</div>
|
|
|
- </el-row>
|
|
|
- </el-card>
|
|
|
- </el-col>
|
|
|
- <el-col :span="6">
|
|
|
- <el-card class="box-card">
|
|
|
- <div slot="header" class="clearfix">
|
|
|
- <span>7号柜</span>
|
|
|
- <el-button style="float: right; padding: 3px 0" type="text">开箱</el-button>
|
|
|
- </div>
|
|
|
- <el-row type="flex" justify="space-between">
|
|
|
- <el-row type="flex" align="middle">
|
|
|
- <el-button type="danger">使用中</el-button>
|
|
|
- </el-row>
|
|
|
- <div>
|
|
|
- <h4>
|
|
|
- 黄先生
|
|
|
- <el-button style="margin-left:10px;" size="mini" type="primary">通知</el-button>
|
|
|
- </h4>
|
|
|
- <h4>130xxxxxxxx</h4>
|
|
|
- <h4>8小时</h4>
|
|
|
+ <div style="height:72px;">
|
|
|
+ <el-row type="flex" align="middle" style="height:100%;">
|
|
|
+ <el-button type="primary">新增</el-button>
|
|
|
+ </el-row>
|
|
|
</div>
|
|
|
- </el-row>
|
|
|
- </el-card>
|
|
|
- </el-col>
|
|
|
- <el-col :span="6">
|
|
|
- <el-card class="box-card">
|
|
|
- <div slot="header" class="clearfix">
|
|
|
- <span>8号柜</span>
|
|
|
- <el-button style="float: right; padding: 3px 0" type="text" disabled>开箱</el-button>
|
|
|
- </div>
|
|
|
- <div style="height:72px;">
|
|
|
- <el-row type="flex" align="middle" style="height:100%;">
|
|
|
- <el-button type="info">故障</el-button>
|
|
|
- </el-row>
|
|
|
- </div>
|
|
|
- </el-card>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
+ </el-card>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
|
|
|
- <el-row style="margin-top:10px;" type="flex" justify="end">
|
|
|
- <el-pagination background layout="prev, pager, next" :total="30"></el-pagination>
|
|
|
- </el-row>
|
|
|
- </div>
|
|
|
- </el-tab-pane>
|
|
|
- <el-tab-pane label="2号柜" name="second">
|
|
|
- <el-row>
|
|
|
- <el-col :span="6">
|
|
|
- <el-card class="box-card">
|
|
|
- <div slot="header" class="clearfix">
|
|
|
- <span>添加箱子</span>
|
|
|
- </div>
|
|
|
- <div style="height:72px;">
|
|
|
- <el-row type="flex" align="middle" style="height:100%;">
|
|
|
- <el-button type="primary">添加</el-button>
|
|
|
- </el-row>
|
|
|
- </div>
|
|
|
- </el-card>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-tab-pane>
|
|
|
- <el-tab-pane label="3号柜" name="third">
|
|
|
- <el-row>
|
|
|
- <el-col :span="6">
|
|
|
- <el-card class="box-card">
|
|
|
- <div slot="header" class="clearfix">
|
|
|
- <span>添加箱子</span>
|
|
|
- </div>
|
|
|
- <div style="height:72px;">
|
|
|
- <el-row type="flex" align="middle" style="height:100%;">
|
|
|
- <el-button type="primary">添加</el-button>
|
|
|
- </el-row>
|
|
|
- </div>
|
|
|
- </el-card>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-tab-pane>
|
|
|
+ <!-- <el-row style="margin-top:10px;" type="flex" justify="end">
|
|
|
+ <el-pagination background layout="prev, pager, next" :total="30"></el-pagination>
|
|
|
+ </el-row>
|
|
|
+ -->
|
|
|
+ </div>
|
|
|
+ </el-tab-pane>
|
|
|
+ </template>
|
|
|
<el-tab-pane name="add">
|
|
|
<span slot="label">
|
|
|
<i class="el-icon-plus">新增</i>
|
|
@@ -223,22 +90,28 @@
|
|
|
</el-tab-pane>
|
|
|
</el-tabs>
|
|
|
|
|
|
- <el-dialog title="新增" :visible.sync="addVisible" width="50%" @closed="onCloseAddDialog">
|
|
|
+ <el-dialog title="新增柜体" :visible.sync="addVisible" width="50%" @closed="onCloseAddDialog">
|
|
|
<el-form
|
|
|
:model="ruleForm"
|
|
|
:rules="rules"
|
|
|
ref="ruleForm"
|
|
|
- label-width="100px"
|
|
|
+ label-width="120px"
|
|
|
class="demo-ruleForm"
|
|
|
>
|
|
|
- <el-form-item label="柜子名称" prop="name">
|
|
|
- <el-input v-model="ruleForm.name"></el-input>
|
|
|
- </el-form-item>
|
|
|
<el-form-item label="请求地址" prop="requrl">
|
|
|
<el-input v-model="ruleForm.requrl"></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="箱子个数" prop="box">
|
|
|
- <el-input v-model="ruleForm.boxcount"></el-input>
|
|
|
+ <el-form-item label="柜子名称" prop="alias">
|
|
|
+ <el-input v-model="ruleForm.alias"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="柜子编号" prop="number">
|
|
|
+ <el-input v-model="ruleForm.number"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="柜子登录key" prop="login_key">
|
|
|
+ <el-input v-model="ruleForm.login_key"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="箱子个数" prop="count">
|
|
|
+ <el-input v-model="ruleForm.count"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
@@ -250,25 +123,82 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import {AddCabinet} from '@/api';
|
|
|
+import { cabinetList, boxList, addCabinet } from "@/api";
|
|
|
+import moment from 'moment';
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- tabActive: "first",
|
|
|
+ tabActive: "",
|
|
|
addVisible: false,
|
|
|
ruleForm: {
|
|
|
- name: "",
|
|
|
requrl: "",
|
|
|
- boxcount: "",
|
|
|
+ alias: "",
|
|
|
+ number: "",
|
|
|
+ login_key: "",
|
|
|
+ count: "",
|
|
|
},
|
|
|
rules: {
|
|
|
- name: [{ required: true, message: "请输入柜子名称", trigger: "blur" }],
|
|
|
- requrl: [{ required: true, message: "请输入请求地址", trigger: "blur" }],
|
|
|
- boxcount: [{ required: true, message: "请输入箱子个数", trigger: "blur" }],
|
|
|
+ requrl: [
|
|
|
+ { required: true, message: "请输入请求地址", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ alias: [{ required: true, message: "请输入柜子名称", trigger: "blur" }],
|
|
|
+ number: [
|
|
|
+ { required: true, message: "请输入柜子编号", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ login_key: [
|
|
|
+ { required: true, message: "请输入柜子登录key", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ count: [{ required: true, message: "请输入箱子个数", trigger: "blur" }],
|
|
|
},
|
|
|
+ cabinetList: [],
|
|
|
+ boxList: [],
|
|
|
};
|
|
|
},
|
|
|
+ computed:{
|
|
|
+ diffTime(){
|
|
|
+ return date=>{
|
|
|
+ const currentTime = moment();
|
|
|
+ const startDate = moment(date);
|
|
|
+ const date3=currentTime.diff(startDate,'minute');//计算相差的分钟数
|
|
|
+ const h=Math.floor(date3/60);//相差的小时数
|
|
|
+ const mm=date3%60;//计算相差小时后余下的分钟数
|
|
|
+ return `${h}小时${mm}分钟`;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getCabinetList();
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ getCabinetList() {
|
|
|
+ cabinetList().then((res) => {
|
|
|
+ console.log(res);
|
|
|
+ if (res && res.msg == "ok") {
|
|
|
+ this.cabinetList = res.data.rows.map((item) => {
|
|
|
+ item.id = item.id + "";
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+
|
|
|
+ this.boxList = res.data.rows.map(() => {
|
|
|
+ return [];
|
|
|
+ });
|
|
|
+ this.getBoxList(res.data.rows[0].id, 0);
|
|
|
+ this.tabActive = res.data.rows[0].id + "";
|
|
|
+ console.log(this.tabActive);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getBoxList(id, cabinetIndex) {
|
|
|
+ const _self = this;
|
|
|
+ boxList({ cabinet_number: id }).then((res) => {
|
|
|
+ console.log(res);
|
|
|
+ if (res && res.data.rows) {
|
|
|
+ let boxList = [..._self.boxList];
|
|
|
+ boxList[cabinetIndex] = res.data.rows;
|
|
|
+ _self.boxList = boxList;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
onCloseAddDialog() {
|
|
|
this.ruleForm = {};
|
|
|
this.addVisible = false;
|
|
@@ -283,22 +213,31 @@ export default {
|
|
|
onAddSubmit(formName) {
|
|
|
this.$refs[formName].validate((valid) => {
|
|
|
if (valid) {
|
|
|
- this.addCabinet();
|
|
|
- } else {
|
|
|
+ this.addCabinet();
|
|
|
+ } else {
|
|
|
console.log("error submit!!");
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- addCabinet() {
|
|
|
- let alias = this.ruleForm.name;
|
|
|
- let url = this.ruleForm.requrl;
|
|
|
- let count = this.ruleForm.boxcount;
|
|
|
-
|
|
|
- AddCabinet(alias,url,count).then(res => {
|
|
|
- console.log(res);
|
|
|
- });
|
|
|
- }
|
|
|
+ addCabinet() {
|
|
|
+ let requrl = "";
|
|
|
+ let alias = "";
|
|
|
+ let number = "";
|
|
|
+ let login_key = "";
|
|
|
+ let count = "";
|
|
|
+ addCabinet(requrl,alias,number,login_key,count).then((res) => {
|
|
|
+ console.log(res);
|
|
|
+ if(res && res.msg == 'ok') {
|
|
|
+ this.getCabinetList();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ onTabClick(e) {
|
|
|
+ if (e.name != "add") {
|
|
|
+ this.getBoxList(e.name, e.index);
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|