Browse Source

设备、产品添加工厂id

devlop
mo-bai 3 years ago
parent
commit
c6787e7d43
5 changed files with 21 additions and 8 deletions
  1. 4
      pages/device-operation/index.vue
  2. 9
      pages/digital-workshops/index.vue
  3. 8
      pages/factory-operation/index.vue
  4. 4
      pages/production-operation/index.vue
  5. 4
      pages/promotion/index.vue

4
pages/device-operation/index.vue

@ -160,6 +160,7 @@ export default {
return {
operation: 'add', // add:, edit:
deviceId: null,
factoryId: null,
form: {
id: null,
imgItemList: [],
@ -178,6 +179,7 @@ export default {
},
onLoad(options) {
if (options.operation) {
this.factoryId = options.factoryId
this.operation = options.operation
if (options.operation == 'edit') {
this.init(options.id)
@ -276,7 +278,7 @@ export default {
let list = this.technicsTypeList.filter((item) => this.form.technicsTypeList.includes(item.value))
let technicsTypeList = list.map((item) => ({ id: item.value, name: item.label }))
this.form.typeName = this.deviceTypeList.find((item) => item.value == this.form.type).label
changeDevice({ ...this.form, technicsTypeList }).then((res) => {
changeDevice({ ...this.form, technicsTypeList, factoryId: this.factoryId }).then((res) => {
if (res) {
uni.showToast({
title: '保存成功',

9
pages/digital-workshops/index.vue

@ -137,12 +137,13 @@ export default {
uni.stopPullDownRefresh()
},
watch: {
factoryId(val) {
factoryId(val, oldVal) {
if (val === -1) {
if (this.companyTip()) {
return
}
go2('factory-manage')
this.factoryId = oldVal
} else {
this.getCameraList()
this.getList()
@ -225,7 +226,7 @@ export default {
return
}
//
go2('device-operation', { id: this.factoryId, operation: 'add' })
go2('device-operation', { factoryId: this.factoryId, operation: 'add' })
},
//
getCameraList() {
@ -243,6 +244,10 @@ export default {
isExample: item.name == '演示样板工厂'
}
})
if (this.factoryId == this.factoryList[0].value) {
this.getCameraList()
this.getList()
}
this.factoryId = this.factoryList[0].value
this.factoryList.push({
label: '工厂管理',

8
pages/factory-operation/index.vue

@ -1,6 +1,6 @@
<template>
<view class="content">
<uni-nav-bar left-icon="back" @clickLeft="back" statusBar fixed title="授信记录"></uni-nav-bar>
<uni-nav-bar left-icon="back" @clickLeft="back" statusBar fixed :title="title"></uni-nav-bar>
<view class="form">
<view class="justify-between group">
<view class="flex-row">
@ -140,13 +140,17 @@ export default {
data() {
return {
id: null,
operation: 'add'
operation: 'add',
title: '新增工厂'
}
},
onLoad(options) {
if (options.id) {
this.id = options.id
this.operation = 'edit'
if (this.operation == 'edit') {
this.title = '编辑工厂'
}
}
},
methods: {

4
pages/production-operation/index.vue

@ -84,6 +84,7 @@ export default {
return {
operation: 'add', // add:, edit:
deviceId: null,
factoryId: null,
form: {
id: null,
imgItemList: [],
@ -96,6 +97,7 @@ export default {
onLoad(options) {
if (options.operation) {
this.operation = options.operation
this.factoryId = options.factoryId
if (options.operation == 'edit') {
this.init(options.id)
}
@ -165,7 +167,7 @@ export default {
return false
}
}
changeProduction({ ...this.form }).then((res) => {
changeProduction({ ...this.form, factoryId: this.factoryId }).then((res) => {
if (res) {
uni.showToast({
title: '保存成功',

4
pages/promotion/index.vue

@ -255,10 +255,10 @@ export default {
//
addItem() {
if (this.curTab == 'device') {
go2('device-operation', { operation: 'add' })
go2('device-operation', { factoryId: this.factoryId, operation: 'add' })
}
if (this.curTab == 'production') {
go2('production-operation', { operation: 'add' })
go2('production-operation', { factoryId: this.factoryId, operation: 'add' })
}
},
popupShow() {

Loading…
Cancel
Save