395 lines
13 KiB
Vue
395 lines
13 KiB
Vue
<template>
|
|
<view class="zd_container">
|
|
<!-- <nav-bar title="分切下料2"></nav-bar> -->
|
|
<nav-bar :title="title"></nav-bar>
|
|
<view class="zd_content">
|
|
<view class="zd_wrapper">
|
|
<view class="filter_item">
|
|
<view class="filter_label">区域</view>
|
|
<view class="filter_input_wraper">
|
|
<uni-data-select v-model="index2" :localdata="options2" @change="selectChange2"></uni-data-select>
|
|
</view>
|
|
</view>
|
|
<view class="filter_item">
|
|
<view class="filter_label">设备</view>
|
|
<view class="filter_input_wraper">
|
|
<uni-data-select v-model="index" :localdata="options" @change="selectChange"></uni-data-select>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="zd_wrapper">
|
|
<view class="filter_item">
|
|
<view class="filter_label_wraper">
|
|
<span class="filter_label">子卷号</span>
|
|
</view>
|
|
<view class="filter_input_wraper">
|
|
<search-box
|
|
v-model="val1"
|
|
/>
|
|
</view>
|
|
</view>
|
|
<view class="zd-row">
|
|
<view class="zd-col-19">
|
|
<view class="filter_item">
|
|
<view class="filter_label">轴位置</view>
|
|
<view class="filter_input_wraper">
|
|
<radio-group @change="radioChange">
|
|
<label class="mgr20" v-for="(item, index) in options1" :key="item.value">
|
|
<radio :value="item.value" :checked="index === current" style="transform:scale(0.8)" />
|
|
<text class="filter_unit">{{item.text}}</text>
|
|
</label>
|
|
</radio-group>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="zd-col-4">
|
|
<button class="mini-btn" size="mini" style="display: block;" type="primary" :disabled="disabled1" @tap="_getTubeLength">添加</button>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="zd_wrapper grid-wraper">
|
|
<view class="slide_new">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>子卷号</th>
|
|
<th>壁厚</th>
|
|
<th>管芯长度</th>
|
|
<th>轴位置</th>
|
|
<th>操作</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr v-for="(e, i) in dataList" :key="i">
|
|
<td>{{e.container_name}}</td>
|
|
<td>{{e.bh}}</td>
|
|
<td>{{e.length}}</td>
|
|
<td>{{ options1 | findByValue(e.site)}}</td>
|
|
<td><button class="mini-btn" style="display: block;" size="mini" type="primary" @tap="handleDelete(i)">删除</button></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="zd-row submitbar">
|
|
<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 || !dataList.length}" @tap="downRolls2Confirm">确认</button>
|
|
<button class="zd-col-8 btn-submit btn-success" :class="{'btn-info': !index}" @tap="bindPlanDeviceConfirm">绑定</button>
|
|
</view>
|
|
<view class="msg_modal" :class="modalShow ? 'popshow1' : 'pophide1'">
|
|
<view class="msg_tip">提示</view>
|
|
<view class="zd_content pdt26">
|
|
<view class="msg_p1" v-for="(e, i) in htmlContent1" :key="'content_1' + i">{{i+1}}.{{e}}</view>
|
|
<view class="msg_p2"v-for="(e, i) in htmlContent2" :key="'content_2' + i">{{e}}</view>
|
|
</view>
|
|
<view class="zd-row submitbar">
|
|
<button class="zd-col-6 btn-submit btn-success letter-30" @tap.stop="modalShow = false">取消</button>
|
|
<button class="zd-col-15 btn-submit btn-success letter-30" :disabled="disabled" @tap="modalSure">确定</button>
|
|
</view>
|
|
</view>
|
|
<view v-if="modalShow" class="msg_mask msg_mask_1"></view>
|
|
<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>
|
|
|
|
<script>
|
|
import NavBar from '@/components/NavBar.vue'
|
|
import SearchBox from '@/components/SearchBox.vue'
|
|
import {queryProductArea} from '@/utils/getData2.js'
|
|
import {getTubeLength, slitterDevices, downRolls2, getUnbindPlan, dBindPlanDevice} from '@/utils/getData3.js'
|
|
// import {getTubeLength, slitterDevices, queryProductArea, getUnbindPlan} from '@/utils/mork2.js'
|
|
// import {downRolls2, dBindPlanDevice} from '@/utils/getData3.js'
|
|
export default {
|
|
components: {
|
|
NavBar,
|
|
SearchBox
|
|
},
|
|
data() {
|
|
return {
|
|
title: '',
|
|
options: [],
|
|
index: '',
|
|
options2: [],
|
|
index2: '',
|
|
options1: [{value: '1', text: '上轴'}, {value: '2', text: '下轴'}],
|
|
index1: '1',
|
|
current: 0,
|
|
val1: '',
|
|
dataList: [],
|
|
disabled: false,
|
|
disabled1: false,
|
|
modalShow: false,
|
|
htmlContent1: [],
|
|
htmlContent2: [],
|
|
modalShow1: false,
|
|
upShelf: '',
|
|
upPlanCode: '',
|
|
downShelf: '',
|
|
downPlanCode: '',
|
|
PlanOptions: [],
|
|
PlanOptions1: [],
|
|
PlanOptions2: []
|
|
};
|
|
},
|
|
onLoad (options) {
|
|
this.title = options.title
|
|
},
|
|
created () {
|
|
this._queryProductArea()
|
|
},
|
|
methods: {
|
|
selectChange2(e) {
|
|
this.index2 = e
|
|
if (e) {
|
|
this._slitterDevices(e)
|
|
} else {
|
|
this.index = ''
|
|
}
|
|
},
|
|
/** 生产区域下拉框查询 */
|
|
async _queryProductArea () {
|
|
let res = await queryProductArea()
|
|
this.options2 = [...res.data]
|
|
},
|
|
async _slitterDevices (e) {
|
|
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._getUnbindPlan(e)
|
|
} else {
|
|
this.PlanOptions = []
|
|
}
|
|
},
|
|
radioChange (e) {
|
|
this.index1 = e.detail.value
|
|
},
|
|
async _getTubeLength () {
|
|
this.disabled1 = true
|
|
if (!this.val1.trim()) {
|
|
this.disabled1 = false
|
|
return
|
|
}
|
|
try {
|
|
let res = await getTubeLength(this.val1)
|
|
if (res.status === 200) {
|
|
const index = this.dataList.findIndex(item => item.container_name === this.val1)
|
|
if (index !== -1) {
|
|
this.dataList.splice(index, 1)
|
|
}
|
|
this.dataList.push({container_name: this.val1, site: this.index1, bh: res.data.bh, length: res.data.length})
|
|
this.val1 = ''
|
|
} else {
|
|
uni.showToast({
|
|
title: res.message,
|
|
icon: 'none'
|
|
})
|
|
}
|
|
this.disabled1 = false
|
|
} catch (e) {
|
|
this.disabled1 = false
|
|
}
|
|
},
|
|
handleDelete (index) {
|
|
this.dataList.splice(index, 1)
|
|
},
|
|
downRolls2Confirm () {
|
|
this.htmlContent1 = []
|
|
this.htmlContent2 = []
|
|
if (!this.index || !this.dataList.length) {
|
|
return
|
|
}
|
|
if (this.dataList.length === 1) {
|
|
if (Number(this.dataList[0].length) >= 350 && Number(this.dataList[0].length) < 1600) {
|
|
this.htmlContent1 = ['两个轴承端面到管芯端面到轴断面≥160mm', '三个轴承端面到管芯端面距离≥140mm', '管芯端面到缠绕膜边缘距离≥25mm']
|
|
this.htmlContent2 = [`${this.dataList[0].container_name}:${this.dataList[0].bh}#${this.dataList[0].length}`]
|
|
} else if (Number(this.dataList[0].length) >= 1600 && Number(this.dataList[0].length) <= 1700) {
|
|
this.htmlContent1 = ['85mm≤两个轴承端面到管芯端面距离≤120mm', '管芯端面到缠绕膜边缘距离≥25mm']
|
|
this.htmlContent2 = [`${this.dataList[0].container_name}:${this.dataList[0].bh}#${this.dataList[0].length}`]
|
|
}
|
|
} else if (this.dataList.length === 2) {
|
|
if (this.dataList[0].site === this.dataList[1].site) {
|
|
this.htmlContent1 = ['两个轴承端面到管芯端面到轴断面≥160mm', '三个轴承端面到管芯端面距离≥140mm', '管芯端面到缠绕膜边缘距离≥25mm', '管芯到管芯的间距≥50mm']
|
|
this.dataList.map(e => {
|
|
this.htmlContent2.push(`${e.container_name}:${e.bh}#${e.length}`)
|
|
})
|
|
} else {
|
|
if (Number(this.dataList[0].length) >= 350 && Number(this.dataList[0].length) < 1600) {
|
|
this.htmlContent1 = ['两个轴承端面到管芯端面到轴断面≥160mm', '三个轴承端面到管芯端面距离≥140mm', '管芯端面到缠绕膜边缘距离≥25mm']
|
|
this.dataList.map(e => {
|
|
this.htmlContent2.push(`${e.container_name}:${e.bh}#${e.length}`)
|
|
})
|
|
} else if (Number(this.dataList[0].length) >= 1600 && Number(this.dataList[0].length) <= 1700) {
|
|
this.htmlContent1 = ['85mm≤两个轴承端面到管芯端面距离≤120mm', '管芯端面到缠绕膜边缘距离≥25mm']
|
|
this.dataList.map(e => {
|
|
this.htmlContent2.push(`${e.container_name}:${e.bh}#${e.length}`)
|
|
})
|
|
}
|
|
}
|
|
|
|
} else if (this.dataList.length > 2) {
|
|
this.htmlContent1 = ['两个轴承端面到管芯端面到轴断面≥160mm', '三个轴承端面到管芯端面距离≥140mm', '管芯端面到缠绕膜边缘距离≥25mm', '管芯到管芯的间距≥50mm']
|
|
this.dataList.map(e => {
|
|
this.htmlContent2.push(`${e.container_name}:${e.bh}#${e.length}`)
|
|
})
|
|
}
|
|
this.modalShow = true
|
|
},
|
|
modalSure () {
|
|
this._downRolls2()
|
|
},
|
|
async _downRolls2 () {
|
|
this.disabled = true
|
|
try {
|
|
let res = await downRolls2(this.index, this.dataList)
|
|
if (res) {
|
|
uni.showToast({
|
|
title: res.message,
|
|
icon: 'none'
|
|
})
|
|
this.dataList = []
|
|
}
|
|
this.disabled = false
|
|
this.modalShow = false
|
|
} catch (e) {
|
|
this.disabled = false
|
|
this.modalShow = false
|
|
}
|
|
},
|
|
clearUp () {
|
|
this.index = ''
|
|
this.index2 = ''
|
|
this.options = []
|
|
this.val1 = ''
|
|
this.dataList = []
|
|
this.disabled = false
|
|
this.disabled1 = false
|
|
},
|
|
/** 模糊匹配 */
|
|
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
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script> |