分切上轴2加功能
This commit is contained in:
@@ -20,12 +20,47 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="zd-row submitbar">
|
||||
<button class="zd-col-6 btn-submit btn-default" @tap="clearUp">清空</button>
|
||||
<button class="zd-col-15 btn-submit btn-success" :class="{'btn-info': !index}" @tap="toSure">确认</button>
|
||||
<button class="zd-col-5 btn-submit btn-default" @tap="clearUp">清空</button>
|
||||
<button class="zd-col-8 btn-submit btn-success" :class="{'btn-info': !index}" @tap="toSure">确认</button>
|
||||
<button class="zd-col-8 btn-submit btn-success" :class="{'btn-info': !index}" @tap="bindPlanDeviceConfirm">绑定</button>
|
||||
</view>
|
||||
<uni-popup ref="alertDialog" type="dialog">
|
||||
<uni-popup-dialog type="info" cancelText="关闭" confirmText="确定" title="提示" content="确认是否创建上轴桁架任务?" @confirm="dialogConfirm"></uni-popup-dialog>
|
||||
</uni-popup>
|
||||
<view class="msg_wrapper_2" :class="modalShow1 ? 'popshow' : 'pophide2'">
|
||||
<view class="zd-row pop-title_wraper_2">
|
||||
<text class="pop-title_2">绑定轴信息</text>
|
||||
<text class="iconfont icon_close" @tap="modalShow1 = false"></text>
|
||||
</view>
|
||||
<view class="msg_content_2">
|
||||
<view class="msg_filter">
|
||||
<view class="relative msg_tip_2 msg_tip_2_blue">上轴信息</view>
|
||||
<view class="filter_label filter_label_2">缓存架编码</view>
|
||||
<view class="filter_input_wraper_2">
|
||||
<input type="text" class="filter_input" placeholder="请输入缓存架编码" v-model="upShelf">
|
||||
</view>
|
||||
<view class="filter_label filter_label_2">绑定计划</view>
|
||||
<view class="filter_input_wraper_2">
|
||||
<uni-data-select v-model="upPlanCode" :searchInput="true" :localdata="PlanOptions1" @handleChange="handleChange1" @showSelector="showSelector1"></uni-data-select>
|
||||
</view>
|
||||
<view class="msg_fgx"></view>
|
||||
<view class="relative msg_tip_2 msg_tip_2_yellow">下轴信息</view>
|
||||
<view class="filter_label filter_label_2">缓存架编码</view>
|
||||
<view class="filter_input_wraper_2">
|
||||
<input type="text" class="filter_input" placeholder="请输入缓存架编码" v-model="downShelf">
|
||||
</view>
|
||||
<view class="filter_label filter_label_2">绑定计划</view>
|
||||
<view class="filter_input_wraper_2 filter_input_wraper_2-bottom">
|
||||
<uni-data-select v-model="downPlanCode" :searchInput="true" :localdata="PlanOptions2" @handleChange="handleChange2" @showSelector="showSelector2"></uni-data-select>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="zd-row submitbar">
|
||||
<button class="zd-col-11 btn-submit btn-success" :class="{'btn-info': !((upShelf && upPlanCode) || (downShelf && downPlanCode))}" :disabled="disabled" @tap="bindSure(0)">确认绑定</button>
|
||||
<button class="zd-col-11 btn-submit btn-success" :class="{'btn-info': !((upShelf && upPlanCode) || (downShelf && downPlanCode))}" :disabled="disabled" @tap="bindSure(1)">强制绑定</button>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="modalShow1" class="msg_mask"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -34,7 +69,7 @@
|
||||
import SearchBox from '@/components/SearchBox.vue'
|
||||
// import {queryProductArea} from '@/utils/mork2.js'
|
||||
import {queryProductArea} from '@/utils/getData2.js'
|
||||
import {slitterDevices, doUpShaftToSlitterByDeviceTip, doUpShaftToSlitterByDevice} from '@/utils/getData3.js'
|
||||
import {slitterDevices, doUpShaftToSlitterByDeviceTip, doUpShaftToSlitterByDevice, getUnbindPlan, dBindPlanDevice} from '@/utils/getData3.js'
|
||||
export default {
|
||||
components: {
|
||||
NavBar,
|
||||
@@ -47,7 +82,16 @@
|
||||
index: '',
|
||||
options2: [],
|
||||
index2: '',
|
||||
obj: {tip: '-'}
|
||||
obj: {tip: '-'},
|
||||
disabled: false,
|
||||
modalShow1: false,
|
||||
upShelf: '',
|
||||
upPlanCode: '',
|
||||
downShelf: '',
|
||||
downPlanCode: '',
|
||||
PlanOptions: [],
|
||||
PlanOptions1: [],
|
||||
PlanOptions2: []
|
||||
};
|
||||
},
|
||||
onLoad (options) {
|
||||
@@ -74,12 +118,30 @@
|
||||
let res = await slitterDevices(e)
|
||||
this.options = [...res]
|
||||
},
|
||||
async _getUnbindPlan (e) {
|
||||
try {
|
||||
let res = await getUnbindPlan(e)
|
||||
if (res) {
|
||||
const list = res.map(el => {
|
||||
return {
|
||||
text: el.label,
|
||||
value: el.value
|
||||
}
|
||||
})
|
||||
this.PlanOptions = list
|
||||
}
|
||||
} catch (e) {
|
||||
this.PlanOptions = []
|
||||
}
|
||||
},
|
||||
selectChange (e) {
|
||||
this.index = e
|
||||
if (e) {
|
||||
this._doUpShaftToSlitterByDeviceTip()
|
||||
this._getUnbindPlan(e)
|
||||
} else {
|
||||
this.obj = {tip: '-'}
|
||||
this.PlanOptions = []
|
||||
}
|
||||
},
|
||||
toSure () {
|
||||
@@ -116,6 +178,79 @@
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
/** 模糊匹配 */
|
||||
selectMatchItem (lists, keyWord) {
|
||||
let resArr = []
|
||||
lists.filter((item) => {
|
||||
if (item.text.indexOf(keyWord) > -1) {
|
||||
resArr.push(item)
|
||||
}
|
||||
})
|
||||
return resArr
|
||||
},
|
||||
handleChange1 (e) {
|
||||
if (e){
|
||||
this.upPlanCode = ''
|
||||
this.PlanOptions1 = this.selectMatchItem(this.PlanOptions, e)
|
||||
} else {
|
||||
this.PlanOptions1 = this.PlanOptions
|
||||
}
|
||||
},
|
||||
showSelector1 () {
|
||||
this.PlanOptions1 = this.PlanOptions
|
||||
},
|
||||
handleChange2 (e) {
|
||||
if (e){
|
||||
this.downPlanCode = ''
|
||||
this.PlanOptions2 = this.selectMatchItem(this.PlanOptions, e)
|
||||
} else {
|
||||
this.PlanOptions2 = this.PlanOptions
|
||||
}
|
||||
},
|
||||
showSelector2 () {
|
||||
this.PlanOptions2 = this.PlanOptions
|
||||
},
|
||||
bindPlanDeviceConfirm () {
|
||||
if (!this.index) {
|
||||
uni.showToast({
|
||||
title: '请先选择设备',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
this.modalShow1 = true
|
||||
this.upShelf = ''
|
||||
this.upPlanCode = ''
|
||||
this.downShelf = ''
|
||||
this.downPlanCode = ''
|
||||
},
|
||||
async bindSure (type) {
|
||||
this.disabled = true
|
||||
const upValid = this.upShelf && this.upPlanCode
|
||||
const downValid = this.downShelf && this.downPlanCode
|
||||
if (!upValid && !downValid) {
|
||||
uni.showToast({
|
||||
title: '请至少完整填写上轴或下轴一组信息',
|
||||
icon: 'none'
|
||||
})
|
||||
this.disabled = false
|
||||
return
|
||||
}
|
||||
try {
|
||||
let res = await dBindPlanDevice(this.upShelf, this.upPlanCode, this.downShelf, this.downPlanCode, type, this.index)
|
||||
if (res) {
|
||||
uni.showToast({
|
||||
title: res.message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
this.disabled = false
|
||||
this.modalShow1 = false
|
||||
} catch (e) {
|
||||
this.disabled = false
|
||||
this.modalShow1 = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user