| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553 |
- <template>
- <div class="detail">
- <mt-header class="detail_head" fixed title="资产详情">
- <router-link to="/assets" slot="left">
- <mt-button icon="back"></mt-button>
- </router-link>
- </mt-header>
- <div class="detail_body">
- <div class="detailBox userInfo">
- <div class="frame_title">
- <span>{{detail.name}}</span>
- <span>
- <mt-button v-if="detail.doorStatus==0" size="small" type="primary" v-on:click.native.stop="openDoor(1)">开门</mt-button>
- <span v-else style="color:red">已开门</span>
- </span>
- </div>
- <div class="frame_number">{{detail.modelNumber}}</div>
- <div class="frame_label">
- <span><span>机架ID:</span>{{detail.rackIp}}</span>
- <span><span>温度:</span>{{detail.temp}}</span>
- <span><span>湿度:</span>{{detail.hum}}</span>
- </div>
- </div>
- <div class="detailBox">
- <div class="assDel assDel_Head">
- 机柜设备列表
- <!-- <img v-if="power.indexOf('update_assets')>-1" v-on:click="addNo()" src="../../assets/image/add.png"> -->
- </div>
- <div class="assDel_List">
- <div class="one_assDel isFrame" v-for="item in delList">
- <mt-cell-swipe title="" :right="[
- { content: '下架', style: { background: 'red', color: '#fff' }, handler: () => handle(item.id) },
- ]">
- <div>
- <div class="new_title">
- <span>{{item.deviceName}}</span>
- <span>{{item.modelNo}}</span>
- <span>{{item.currentState==0?'禁止':'运行'}}</span>
- </div>
- <div class="new_label">
- <span><span>标签ID:</span>{{item.labelId}}</span>
- <span><span>模块ID:</span>{{item.modelId}}</span>
- <span><span>U位号:</span>{{item.ubitNum}}</span>
- </div>
- </div>
- </mt-cell-swipe>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import { MessageBox } from 'mint-ui';
- export default {
- data() {
- return {
- id: this.$route.params.id,
- power: sessionStorage.getItem("power"),
- detail: "",
- delList: [],
- }
- },
- methods: {
- getDetail() {
- this.$indicator.open();
- this.http.post(this.port.assets.detail, {
- 'id': this.id
- } ,
- res => {
- this.$indicator.close();
- if (res.code == "ok") {
- this.detail = res.data;
- this.delList = res.data.goodsNosVO;
- } else {
- this.$toast({
- message: res.msg,
- duration: 2000
- });
- }
- }, error => {
- this.$indicator.close();
- this.$toast({
- message: error,
- duration: 2000
- });
- })
- },
- // 添加资产编号
- addNo() {
- MessageBox({
- $type:'prompt',
- title:'',
- message:'添加资产数量',
- closeOnClickModal:false,
- showCancelButton:true,
- inputValidator:function(v){
- if (v === null) {
- return true;
- }
- var str = /^[0-9]*[1-9][0-9]*$/;
- if(str.test(v) && v != "") {
- return true
- } else {
- return false
- }
- },
- inputErrorMessage:'请输入资产编号数量',
- showInput:true
- }).then(({ value, action }) => {
- if(value == null) {
- this.$toast({
- message: '创建失败',
- duration: 2000
- });
- return false;
- } else {
- this.$indicator.open();
- this.http.post(this.port.assets.addNo, {
- 'goodsId': this.id,
- 'count': value
- } ,
- res => {
- this.$indicator.close();
- if (res.code == "ok") {
- this.$toast({
- message: '创建成功',
- duration: 2000
- });
- this.getDetail();
- } else {
- this.$toast({
- message: res.msg,
- duration: 2000
- });
- }
- }, error => {
- this.$indicator.close();
- this.$toast({
- message: error,
- duration: 2000
- });
- })
- }
- }).catch(() => {
- });
- },
- // 删除资产编号
- deleteNos(id) {
- MessageBox.confirm('', {
- message: '是否删除该资产?',
- title: '',
- confirmButtonText: '确定',
- cancelButtonText: '取消'
- }).then(action => {
- if (action == 'confirm') { //确认的回调
- this.http.post(this.port.assets.delNo, {
- 'id': id
- } ,
- res => {
- if (res.code == "ok") {
- this.$toast({
- message: "删除成功",
- duration: 2000
- });
- for(var i in this.delList) {
- if(this.delList[i].id == id) {
- this.delList.splice(i, 1);
- }
- }
- var list = this.delList,
- useList = [],
- serList = [],
- scrList = [],
- unuList = [];
- for(var i in list) {
- if(list[i].state == 0) {
- unuList.push(list[i])
- } else if(list[i].state == 1) {
- useList.push(list[i])
- serList.push(list[i])
- } else if(list[i].state == 3) {
- scrList.push(list[i])
- }
- }
- this.useList = useList;
- this.serList = serList;
- this.scrList = scrList;
- this.unuList = unuList;
- } else {
- this.$toast({
- message: res.msg,
- duration: 2000
- });
- }
- }, error => {
- this.$toast({
- message: error,
- duration: 2000
- });
- })
- }
- }).catch(err => {
- });
- },
- // 跳转
- jumpBack() {
- this.$router.push("/assets");
- },
- // 开门
- openDoor() {
- MessageBox.confirm('', {
- message: '是否打开机柜?',
- title: '',
- confirmButtonText: '确定',
- cancelButtonText: '取消'
- }).then(action => {
- if (action == 'confirm') { //确认的回调
- this.http.post(this.port.assets.openDoor, {
- 'goodsId': this.id,
- 'doorStatus': 1
- } ,
- res => {
- if (res.code == "ok") {
- this.$toast({
- message: "开门成功",
- duration: 2000
- });
- this.getDetail();
- } else {
- this.$toast({
- message: res.msg,
- duration: 2000
- });
- }
- }, error => {
- this.$toast({
- message: error,
- duration: 2000
- });
- })
- }
- }).catch(err => {
- });
- },
- // 下架设备
- handle(id) {
- MessageBox.confirm('', {
- message: '是否下架该设备?',
- title: '',
- confirmButtonText: '确定',
- cancelButtonText: '取消'
- }).then(action => {
- if (action == 'confirm') { //确认的回调
- this.http.post(this.port.assets.upMold, {
- 'id': id
- } ,
- res => {
- if (res.code == "ok") {
- this.$toast({
- message: "下架成功",
- duration: 2000
- });
- this.getDetail();
- } else {
- this.$toast({
- message: res.msg,
- duration: 2000
- });
- }
- }, error => {
- this.$toast({
- message: error,
- duration: 2000
- });
- })
- }
- }).catch(err => {
- });
- }
- },
- created() {
- this.getDetail();
- },
- mounted() {
-
- }
- }
- </script>
- <style scoped>
- .detail_head {
- background: #fff;
- color: #333;
- height: 0.4rem;
- }
- .detail_body {
- margin-top: 0.4rem;
- }
- .detail {
- background: #EFEFEF;
- }
- .detailBox {
- background: #fff;
- margin-bottom: 0.11rem;
- }
- .userInfo {
- padding: 0 0.1rem 0.12rem;
- }
- .frame_title > span {
- padding: 0.12rem 0 0 0;
- display: inline-block;
- vertical-align: bottom;
- }
- .frame_title > span:nth-child(1) {
- display: inline-block;
- width: 70%;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- color: #333;
- font-size: 0.15rem;
- }
- .frame_title > span:nth-child(2) {
- float: right;
- color: #2680EB;
- padding: 0.1rem 0 0 0;
- }
- .frame_number {
- padding: 0.05rem 0;
- color: #999;
- }
- .frame_label {
- padding: 0 0 0.05rem 0;
- }
- .frame_label > span {
- display: inline-block;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- color: #888;
- }
- .frame_label > span:nth-child(1) {
- width: 40%;
- float: left;
- }
- .frame_label > span:nth-child(2) {
- width: 30%;
- float: left;
- text-align: right;
- }
- .frame_label > span:nth-child(3) {
- width: 30%;
- text-align: right;
- }
-
- .frame_label > span > span {
- color: #555;
- font-size: 0.13rem;
- }
- .frame_detail {
- text-align: right;
- padding: 0 0.01rem 0.05rem;
- color: #2680EB;
- font-size: 0.13rem;
- }
- .assDel {
- padding: 0.12rem 0.1rem;
- }
- .assDel_List {
- padding-top: 0;
- }
- .assDel_Status span {
- display: inline-block;
- text-align: center;
- width: 24%;
- color: #aaa;
- font-size: 0.15rem;
- }
- .assDel_Status span.active {
- color: #26a2ff;
- }
- .assDel_Head img {
- float: right;
- width: 0.2rem;
- height: 0.2rem;
- }
- .one_assDel {
- /* padding: 0 0.1rem; */
- margin: 0 0 0.15rem 0;
- }
- .mint-cell-wrapper {
- padding: 0;
- }
- .one_assDel_head {
- width: 100%;
- }
- .one_assDel_body {
- width: 100%;
- }
- .one_assDel_head > span {
- display:inline-block;
- vertical-align: middle;
- color: #666;
- line-height: 0.4rem;
- }
- .one_assDel_head > span:nth-child(1){
- width: 85%;
- font-size: 0.15rem;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- .one_assDel_head > span:nth-child(2){
- float: right;
- }
- .one_assDel_body span {
- /* display:inline-block; */
- color: #aaa;
- vertical-align: middle;
- }
- .one_assDel_body img {
- float: right;
- width: 0.25rem;
- height: 0.25rem;
- vertical-align: middle;
- }
-
- .new_title {
- width: 100%;
- }
- .new_label {
- width: 100%;
- }
- .new_title > span {
- padding: 0.12rem 0;
- display: inline-block;
- vertical-align: bottom;
- }
- .new_title > span:nth-child(1) {
- max-width: 40%;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- color: #333;
- font-size: 0.15rem;
- }
- .new_title > span:nth-child(2) {
- max-width: 40%;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- .new_title > span:nth-child(3) {
- float: right;
- color: #2680EB;
- }
- .new_label > span {
- display: inline-block;
- padding: 0 0 0.05rem 0;
- width: 49%;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- .new_label > span > span {
- color: #555;
- font-size: 0.13rem;
- }
- </style>
- <style>
- .detail_head .mint-header-title {
- font-weight: 600;
- font-size: 0.15rem;
- }
- .detail_head .mint-button-text {
- color: #26a2ff;
- }
- .detailBox .mint-cell {
- padding: 0 0 0 0.02rem;
- }
- .one_assDel .mint-cell-value {
- display: block;
- width: 100%;
- }
- .one_assDel .mint-cell:last-child {
- background-image: none;
- }
- .one_assDel .mint-cell-wrapper {
- background-image: none;
- }
- .one_assDel .mint-cell-swipe-button {
- line-height: 0.55rem;
- }
- .one_assDel .noName .mint-cell-swipe-button {
- line-height: 48px;
- }
- .isFrame .mint-cell-swipe-button {
- line-height: 0.83rem;
- }
- </style>
|