mo-bai 3 years ago
parent
commit
6525831eb6
3 changed files with 54 additions and 25 deletions
  1. 15
      pages/device-operation/index.vue
  2. 1
      pages/digital-workshops/DeviceItem.vue
  3. 63
      pages/digital-workshops/index.vue

15
pages/device-operation/index.vue

@ -68,6 +68,20 @@
</view>
</view>
<view class="divider"></view>
<view class="justify-between group">
<view class="flex-row">
<text class="text_2">所属车间</text>
</view>
<qn-easyinput
:maxlength="10"
v-model="form.belongWorkshop"
:inputBorder="false"
text="right"
placeholderStyle="fontSize: 28rpx"
placeholder="请输入设备名称"
></qn-easyinput>
</view>
<view class="divider"></view>
<view class="group">
<view class="flex-row">
<text class="text_1">*</text>
@ -170,6 +184,7 @@ export default {
cloudBoxId: '',
name: '',
type: '',
belongWorkshop: '',
technicsTypeList: []
},
deviceTypeList: [],

1
pages/digital-workshops/DeviceItem.vue

@ -148,6 +148,7 @@ export default {
font-weight: 500;
line-height: 42rpx;
white-space: nowrap;
align-items: center;
.name {
max-width: 360rpx;
}

63
pages/digital-workshops/index.vue

@ -7,7 +7,7 @@
<view class="select-area">
<qn-select options-align="left" :contentStyle="contentStyle" :options="factoryList" v-model="factoryId" placeholder="请选择工厂"></qn-select>
</view>
<text class="text_1" @click="go2('promotion', { id: factoryId, operation: isExample ? 'info' : 'edit' })">推广</text>
<text v-show="!isExample" class="text_1" @click="go2('promotion', { id: factoryId, operation: isExample ? 'info' : 'edit' })">推广</text>
</view>
</view>
<view class="flex-col">
@ -178,29 +178,43 @@ export default {
let data = { 所有设备: { name: '所有设备', type: {}, list: [] } }
for (let i = 0; i < list.length; i++) {
let belongWorkshop = list[i].belongWorkshop
if (!data[belongWorkshop]) {
data[belongWorkshop] = {
name: belongWorkshop,
list: [],
type: {}
if (belongWorkshop) {
if (!data[belongWorkshop]) {
data[belongWorkshop] = {
name: belongWorkshop,
list: [],
type: {}
}
}
data[belongWorkshop].list.push(list[i])
data['所有设备'].list.push(list[i])
// 0 1
if (!data[belongWorkshop].type[list[i].typeName]) {
data[belongWorkshop].type[list[i].typeName] = [0, 0]
}
if (!data['所有设备'].type[list[i].typeName]) {
data['所有设备'].type[list[i].typeName] = [0, 0]
}
if (list[i].workingStatus === deviceStatus.WORKING) {
data[belongWorkshop].type[list[i].typeName][0]++
data['所有设备'].type[list[i].typeName][0]++
}
if (list[i].workingStatus === deviceStatus.FREE) {
data[belongWorkshop].type[list[i].typeName][1]++
data['所有设备'].type[list[i].typeName][1]++
}
} else {
data['所有设备'].list.push(list[i])
// 0 1
if (!data['所有设备'].type[list[i].typeName]) {
data['所有设备'].type[list[i].typeName] = [0, 0]
}
if (list[i].workingStatus === deviceStatus.WORKING) {
data['所有设备'].type[list[i].typeName][0]++
}
if (list[i].workingStatus === deviceStatus.FREE) {
data['所有设备'].type[list[i].typeName][1]++
}
}
data[belongWorkshop].list.push(list[i])
data['所有设备'].list.push(list[i])
// 0 1
if (!data[belongWorkshop].type[list[i].typeName]) {
data[belongWorkshop].type[list[i].typeName] = [0, 0]
}
if (!data['所有设备'].type[list[i].typeName]) {
data['所有设备'].type[list[i].typeName] = [0, 0]
}
if (list[i].workingStatus === deviceStatus.WORKING) {
data[belongWorkshop].type[list[i].typeName][0]++
data['所有设备'].type[list[i].typeName][0]++
}
if (list[i].workingStatus === deviceStatus.FREE) {
data[belongWorkshop].type[list[i].typeName][1]++
data['所有设备'].type[list[i].typeName][1]++
}
}
this.listObj = data
@ -343,8 +357,7 @@ export default {
.group_3 {
flex: 0 0 auto;
align-items: flex-start;
width: 24%;
margin-right: 6rpx;
margin-right: 8rpx;
margin-bottom: 16rpx;
.group_4 {
white-space: nowrap;

Loading…
Cancel
Save