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

9
pages/digital-workshops/index.vue

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

8
pages/factory-operation/index.vue

@ -1,6 +1,6 @@
<template> <template>
<view class="content"> <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="form">
<view class="justify-between group"> <view class="justify-between group">
<view class="flex-row"> <view class="flex-row">
@ -140,13 +140,17 @@ export default {
data() { data() {
return { return {
id: null, id: null,
operation: 'add'
operation: 'add',
title: '新增工厂'
} }
}, },
onLoad(options) { onLoad(options) {
if (options.id) { if (options.id) {
this.id = options.id this.id = options.id
this.operation = 'edit' this.operation = 'edit'
if (this.operation == 'edit') {
this.title = '编辑工厂'
}
} }
}, },
methods: { methods: {

4
pages/production-operation/index.vue

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

4
pages/promotion/index.vue

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

Loading…
Cancel
Save