生产下料、点位更新

This commit is contained in:
2024-03-12 15:23:12 +08:00
parent 6aafccdf0c
commit 6fdce408c4
31 changed files with 373 additions and 463 deletions

View File

@@ -0,0 +1,107 @@
<template>
<view class="zd_container">
<nav-bar title="入库"></nav-bar>
<view class="zd_content">
<view class="flow_wrapper" v-for="e in dataList" :key="e.point_code">
<view class="zd-row">
<view class="zd-col-24">
<view class="zd-row">
<view class="zd-col-2">
<view class="zd-row flow_icon_item_1">
<view class="iconfont icon_start_point">&#xe820;</view>
</view>
</view>
<view class="zd-col-22">
<view class="zd-row flow_start_item" @tap="checkcode(e)" :class="{'flow_start_item_checked': pkId === e.point_code}">
<view class="zd-col-12 pdl20 pdr20 font-size-1">{{e.point_code}}</view>
<view class="zd-col-12 pdr20 font-size-2">{{e.point_name}}</view>
<view v-show="pkId === e.point_code" class="iconfont icon_choosed">&#xe66b;</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="submit-bar_new">
<button class="zd-col-11 submit-button_new" :class="{'btn-disabled': !pkId}" :disabled="disabled1" @tap="_callEmptyVehicle">呼叫空托</button>
<button class="zd-col-11 submit-button_new" :class="{'btn-disabled': !pkId}" :disabled="disabled2" @tap="_fullVehicleIn">满托入库</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {queryPoints, callEmptyVehicle, fullVehicleIn} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
dataList: [],
disabled1: false,
disabled2: false,
pkId: ''
};
},
created () {
this._queryPoints()
},
methods: {
/** 初始化查询 */
async _queryPoints () {
let res = await queryPoints('1')
this.dataList = [...res]
},
checkcode (e) {
this.pkId = this.pkId === e.point_code ? '' : e.point_code
},
/** 呼叫空托 */
async _callEmptyVehicle () {
this.disabled1 = true
if (!this.pkId) {
this.disabled1 = false
return
}
try {
let res = await callEmptyVehicle(this.pkId)
this.disabled1 = false
this.pkId = ''
this._queryPoints()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled1 = false
}
},
/** 满托入库 */
async _fullVehicleIn () {
this.disabled2 = true
if (!this.pkId) {
this.disabled2 = false
return
}
try {
let res = await fullVehicleIn(this.pkId)
this.disabled2 = false
this.pkId = ''
this._queryPoints()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled2 = false
}
}
}
}
</script>
<style lang="stylus">
</style>

View File

@@ -0,0 +1,289 @@
<template>
<view class="zd_container">
<nav-bar 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="index1" :localdata="options1" @change="selectChange1"></uni-data-select>
</view>
</view>
<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="filter_item">
<view class="filter_label_wraper">
<span class="filter_label">物料</span>
</view>
<view class="filter_input_wraper">
<input type="text" class="filter_input filter_input_disabled pointer" v-model="val2" @tap="getMater">
</view>
</view>
<view class="filter_item">
<view class="filter_label_wraper">
<span class="filter_label">物料数量</span>
</view>
<view class="filter_input_wraper">
<input type="number" class="filter_input" v-model="val3">
</view>
</view>
<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>
<view class="zd_wrapper grid-wraper">
<view class="slide_new">
<table>
<thead>
<tr>
<th>载具编码</th>
<th>载具类型</th>
<th>物料编码</th>
<th>物料名称</th>
<th>点位</th>
<th>物料数量</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i" @click="toCheck(e)" :class="{'checked': e.checked}">
<td>{{e.vehicle_code}}</td>
<td>{{e.vehicle_type}}</td>
<td>{{e.material_code}}</td>
<td>{{e.material_name}}</td>
<td>{{e.point_code}}</td>
<td>{{e.material_qty}}</td>
</tr>
</tbody>
</table>
</view>
</view>
</view>
<view class="submit-bar_new">
<view class="zd-col-4">
<view class="zd-row flexcol">
<view class="iconfont icon_unchecked mgb10" :class="{'icon_checked': isV}" @tap="isVirtual">&#xe66b;</view>
<view class="filter_input_wraper_inn_text">是否配盘</view>
</view>
</view>
<button class="zd-col-4 submit-button_new" @tap="clearUp">清空</button>
<button class="zd-col-5 submit-button_new" :class="{'btn-disabled': !index1 || !val1 || !val3 || !index2 || !$store.getters.publicObj}" :disabled="disabled1" @tap="_groupManual">开始组盘</button>
<button class="zd-col-5 submit-button_new" :class="{'btn-disabled': checkArr.length === 0}" :disabled="disabled2" @tap="_groupLink">开始配盘</button>
<button class="zd-col-4 submit-button_new" :class="{'btn-disabled': !val1 || (isV === true && printActive === false)}" :disabled="disabled3" @tap="_pdaPrintf">打印</button>
</view>
</view>
</template>
<script>
import {getCLodop} from "@/utils/CLodopfuncs.js"
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {queryPoints, getVehicleType, queryVehicleGroup, groupManual, groupLink, pdaPrintf} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
options1: [],
index1: '',
val1: '',
val2: '',
val3: '',
val4: '',
val5: '',
options2: [],
index2: '',
dataList: [],
isV: false,
disabled1: false,
disabled2: false,
disabled3: false,
checkArr: [],
printActive: false
};
},
created () {
this._getVehicleType()
this._queryPoints()
this._queryVehicleGroup()
},
destroyed () {
this.$store.dispatch('setPublicObj', '')
},
onShow() {
if (this.$store.getters.publicObj) {
this.val2 = this.$store.getters.publicObj.material_name
this.val4 = this.$store.getters.publicObj.material_id
this.val5 = this.$store.getters.publicObj.material_code
}
},
methods: {
/** 选择器 */
selectChange1(e) {
this.index1 = e
},
selectChange2(e) {
this.index2 = e
},
/** 载具类型下拉框 */
async _getVehicleType () {
let res = await getVehicleType()
this.options1 = [...res]
},
/** 点位下拉框 */
async _queryPoints () {
let res = await queryPoints('1')
res.map(el => {
this.$set(el, 'value', el.point_code)
this.$set(el, 'text', el.point_name)
})
this.options2 = [...res]
},
/** grid */
async _queryVehicleGroup () {
let res = await queryVehicleGroup()
res.map(el => {
this.$set(el, 'checked', false)
})
this.dataList = [...res]
},
getMater () {
uni.navigateTo({
url: '/pages/manage/search-mater-1'
})
},
toCheck (e) {
e.checked = !e.checked
this.checkArr = this.dataList.filter(i => { return i.checked === true })
},
isVirtual () {
this.isV = !this.isV
},
/** 开始组盘 */
async _groupManual () {
this.disabled1 = true
if (!this.index1 || !this.val1 || !this.val3 || !this.index2 || !this.$store.getters.publicObj) {
this.disabled1 = false
return
}
try {
let res = await groupManual(this.index1, this.val1, this.index2, this.val4, this.val5, this.val3, this.isV)
this.disabled1 = false
this.checkArr = []
this._queryVehicleGroup()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled1 = false
}
},
/** 开始配盘 */
async _groupLink () {
this.disabled2 = true
if (this.checkArr.length === 0) {
this.disabled2 = false
return
}
try {
let arr = []
this.checkArr.map(el => {
if (el.checked) {
arr.push({group_id: el.group_id, vehicle_code: this.val1})
}
})
let res = await groupLink(arr)
this.disabled2 = false
this.checkArr = []
this.printActive = true
this._queryVehicleGroup()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled2 = false
}
},
clearUp () {
this.index1 = ''
this.index2 = ''
this.val1 = ''
this.val2 = ''
this.val3 = ''
this.printActive = false
this.$store.dispatch('setPublicObj', '')
},
/** 打印 */
async _pdaPrintf () {
this.disabled3 = true
if (!this.val1 || (this.isV === true && this.printActive === false)) {
this.disabled3 = false
return
}
try {
let res = await pdaPrintf(this.val1)
this.disabled3 = false
if (JSON.stringify(res) !== '{}') {
setTimeout(this.toPrint(res), 800)
}
} catch (e) {
this.disabled3 = false
}
},
toPrint (data) {
let iparr = this.$store.getters.printUrl.split(":")
let printUrl = iparr[1].slice(2)
let LODOP = getCLodop();
if (!(LODOP.webskt && LODOP.webskt.readyState === 1)) {
uni.showToast({
title: '当前配置ip' + printUrl + '网络不通,请检查',
icon: 'none',
duration: 5000
})
return
}
LODOP.SET_SHOW_MODE('HIDE_DISBUTTIN_SETUP', 1)// 隐藏那些无效按钮
LODOP.SET_LICENSES('浙江省烟草专卖局(公司)', 'C0C4A46A3A0D1F526D426018D9F11921', '', '')
// 更换为打印服务器ip 不需要加前缀
LODOP.PRINT_INIT(null, printUrl);
// 打印机序号 规则为打印服务器打印机列表倒数从0开始 -1为默认打印机
LODOP.SET_PRINTER_INDEX(-1);
// 设置打印纸大小
LODOP.SET_PRINT_PAGESIZE(1, '80mm', '60mm', '');
LODOP.ADD_PRINT_RECT('1mm', '3mm', '74mm', '54mm', 0, 1);
LODOP.SET_PRINT_STYLE('FontSize', 12);
LODOP.SET_PRINT_STYLE('Bold', 1);
LODOP.ADD_PRINT_BARCODE('2mm', '4mm', '32mm', '32mm', 'QRCode', data.vehicle_code + '##' + data.material_code + '##' + data.material_qty + '##' + data.pcsn + '##' + data.print_time);
LODOP.ADD_PRINT_TEXT('5mm', '35mm', '50mm', '15mm', '载具编码:' + data.vehicle_code);
LODOP.ADD_PRINT_TEXT('15mm', '35mm', '50mm', '15mm', '物料编码:' + data.material_code);
LODOP.ADD_PRINT_TEXT('25mm', '35mm', '50mm', '15mm', '物料名称:' + data.material_name);
LODOP.ADD_PRINT_TEXT('34mm', '5mm', '80mm', '15mm', '物料数量:' + data.material_qty);
LODOP.ADD_PRINT_TEXT('41mm', '5mm', '80mm', '15mm', '配盘批次:' + data.pcsn);
LODOP.ADD_PRINT_TEXT('48mm', '5mm', '80mm', '15mm', '打印时间:' + data.print_time);
LODOP.PRINT(); // 打印
// LODOP.PREVIEW()
uni.showToast({
title: '打印成功',
icon: 'none'
})
}
}
}
</script>
<style lang="stylus">
</style>

View File

@@ -0,0 +1,262 @@
<template>
<view class="zd_container">
<nav-bar title="出库"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="filter_item">
<view class="filter_label_wraper">
<span class="filter_label">物料</span>
</view>
<view class="filter_input_wraper">
<input type="text" class="filter_input filter_input_disabled pointer" v-model="val1" @tap="getMater">
</view>
</view>
<view class="filter_item">
<view class="filter_label_wraper">
<span class="filter_label">起点点位</span>
</view>
<view class="filter_input_wraper">
<input type="text" class="filter_input" v-model="val2">
</view>
</view>
<view class="filter_item">
<view class="filter_label_wraper">
<span class="filter_label">终点点位</span>
</view>
<view class="filter_input_wraper">
<uni-data-select v-model="index1" :localdata="options1" @change="selectChange1"></uni-data-select>
</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>
<th>配盘批次</th>
<th>物料数量</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i" @click="toCheck(e)" :class="{'checked': e.group_id === pkId}">
<td>{{e.point_code}}</td>
<td>{{e.point_name}}</td>
<td>{{e.vehicle_code}}</td>
<td>{{e.material_code}}</td>
<td>{{e.material_name}}</td>
<td>{{e.pcsn}}</td>
<td>{{e.material_qty}}</td>
</tr>
</tbody>
</table>
</view>
</view>
</view>
<view class="submit-bar_new">
<button class="zd-col-4 submit-button_new" @tap="clearUp">清空</button>
<button class="zd-col-6 submit-button_new" :class="{'btn-disabled': !val2 || !index1}" :disabled="disabled1" @tap="_fullVehicleOut">满托出库</button>
<button class="zd-col-6 submit-button_new" @tap="popUp(1)">余料回库</button>
<button class="zd-col-7 submit-button_new" @tap="popUp(2)">满托出库确认</button>
</view>
<view class="msg_wrapper" :class="show ? 'popshow' : 'pophide'">
<view class="msg_box">
<view class="filter_item">
<view class="filter_label">当前点位</view>
<view class="filter_input_wraper">
<uni-data-select v-model="index2" :localdata="options1" @change="selectChange2"></uni-data-select>
</view>
</view>
<view class="filter_item">
<view class="filter_label">载具编码</view>
<view class="filter_input_wraper">
<search-box
v-model="val3"
/>
</view>
</view>
<view class="filter_item">
<view class="filter_label">物料数量</view>
<view class="filter_input_wraper">
<input type="number" class="filter_input" v-model="val4">
</view>
</view>
</view>
<view class="zd-row msg_btns">
<button class="zd-col-9 msg_btn_cancle" @tap="toClear">清空</button>
<button class="zd-col-13 msg_btn" :class="{'btn-disabled': !index2 || !val3 || !val4}" :disabled="disabled2" @tap="toConfirm">确认</button>
</view>
</view>
<view v-if="show" class="msg_mask" @click.stop="show = false"></view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {queryLinkMaterial, queryPoints, fullVehicleOut, vehicleGoBack, fullVehicleOutConfirm} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
val1: '',
val2: '',
options1: [],
index1: '',
index2: '',
val3: '',
val4: '',
dataList: [],
disabled1: false,
disabled2: false,
disabled3: false,
pkId: '',
show: false,
type: ''
};
},
created () {
this._queryPoints()
},
destroyed () {
this.$store.dispatch('setPublicObj', '')
},
onShow() {
if (this.$store.getters.publicObj) {
this.val1 = this.$store.getters.publicObj.material_name
this._queryLinkMaterial(this.$store.getters.publicObj.material_id)
}
},
methods: {
getMater () {
uni.navigateTo({
url: '/pages/manage/search-mater-1'
})
},
/** grid查询 */
async _queryLinkMaterial (e) {
let res = await queryLinkMaterial(e)
this.dataList = [...res]
},
/** 选择器 */
selectChange1(e) {
this.index1 = e
},
selectChange2(e) {
this.index2 = e
},
/** 点位下拉框 */
async _queryPoints () {
let res = await queryPoints('2')
res.map(el => {
this.$set(el, 'value', el.point_code)
this.$set(el, 'text', el.point_name)
})
this.options1 = [...res]
},
toCheck (e) {
this.pkId = this.pkId === e.group_id ? '' : e.group_id
this.val2 = this.pkId === e.group_id ? e.point_code : ''
},
/** 满托出库 */
async _fullVehicleOut () {
this.disabled1 = true
if (!this.val2 || !this.index1) {
this.disabled1 = false
return
}
try {
let res = await fullVehicleOut(this.val2, this.index1)
this.disabled1 = false
this._queryLinkMaterial(this.$store.getters.publicObj.material_id)
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled1 = false
}
},
popUp (type) {
this.show = true
this.type = type
},
toClear () {
this.index2 = ''
this.val3 =''
this.val4 =''
},
toConfirm () {
if (this.type === 1) {
this._vehicleGoBack()
}
if (this.type === 2) {
this._fullVehicleOutConfirm()
}
},
/** 余料回库 */
async _vehicleGoBack () {
this.disabled2 = true
if (!this.index2 || !this.val3 || !this.val4) {
this.disabled2 = false
return
}
try {
let res = await vehicleGoBack(this.index2, this.val3, this.val4)
this.disabled2 = false
this.toClear()
this.show = false
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled2 = false
this.toClear()
this.show = false
}
},
/** 满托出库确认 */
async _fullVehicleOutConfirm () {
this.disabled2 = true
if (!this.index2 || !this.val3 || !this.val4) {
this.disabled2 = false
return
}
try {
let res = await fullVehicleOutConfirm(this.index2, this.val3, this.val4)
this.disabled2 = false
this.toClear()
this.show = false
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled2 = false
this.toClear()
this.show = false
}
},
clearUp () {
this.index1 = ''
this.val1 = ''
this.val2 = ''
this.dataList = []
this.pkId = ''
this.$store.dispatch('setPublicObj', '')
}
}
}
</script>
<style lang="stylus">
</style>

View File

@@ -0,0 +1,77 @@
<template>
<view class="zd_container">
<nav-bar :inner2="true" @goIn="goIn" title="物料查询"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper grid-wraper">
<view class="slide_new">
<table>
<thead>
<tr>
<th>物料编码</th>
<th>物料名称</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i" @click="toCheck(e)" :class="{'checked': e.material_id === pkId}">
<td>{{e.material_code}}</td>
<td>{{e.material_name}}</td>
</tr>
</tbody>
</table>
</view>
</view>
</view>
<view class="submit-bar_new">
<button class="zd-col-24 submit-button_new" :class="{'btn-disabled': !pkId}" @tap="toSure">确认</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {queryMaterial} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
dataList: [],
pkId: '',
pkObj: {}
};
},
created () {
this._getMaterial()
},
methods: {
handleChange (e) {
this._getMaterial(e)
},
async _getMaterial (e) {
let res = await queryMaterial(e)
this.dataList = [...res]
},
toCheck (e) {
this.pkId = this.pkId === e.material_id ? '' : e.material_id
this.pkObj = this.pkId === e.material_id ? e : {}
},
toSure () {
if (!this.pkId) {
return
}
this.$store.dispatch('setPublicObj', this.pkObj)
this.goIn()
},
goIn () {
uni.navigateBack()
}
}
}
</script>
<style lang="stylus">
</style>

View File

@@ -0,0 +1,103 @@
<template>
<view class="zd_container">
<nav-bar :inner2="true" @goIn="goIn" title="物料查询"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="filter_item">
<view class="filter_label_wraper">
<span class="filter_label">物料Id</span>
</view>
<view class="filter_input_wraper">
<search-box
v-model="val1"
@handleChange="handleChange"
/>
</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>
<th>配盘批次</th>
<th>物料数量</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i" @click="toCheck(e)" :class="{'checked': e.material_id === pkId}">
<td>{{e.point_code}}</td>
<td>{{e.point_name}}</td>
<td>{{e.vehicle_code}}</td>
<td>{{e.material_code}}</td>
<td>{{e.material_name}}</td>
<td>{{e.pcsn}}</td>
<td>{{e.material_qty}}</td>
</tr>
</tbody>
</table>
</view>
</view>
</view>
<view class="submit-bar_new">
<button class="zd-col-11 submit-button_new" :class="{'btn-disabled': !pkId}" @tap="toSure">确认</button>
<button class="zd-col-11 submit-button_new" @tap="searchList">查询</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {queryLinkMaterial} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
val1: '',
dataList: [],
pkId: '',
pkObj: {}
};
},
methods: {
handleChange (e) {
this._getMaterial(e)
},
searchList () {
this._getMaterial(this.val1)
},
/** grid查询 */
async _getMaterial (e) {
let res = await queryLinkMaterial(e)
this.dataList = [...res]
},
toCheck (e) {
this.pkId = this.pkId === e.material_id ? '' : e.material_id
this.pkObj = this.pkId === e.material_id ? e : {}
},
toSure () {
if (!this.pkId) {
return
}
this.$store.dispatch('setPublicObj', this.pkObj)
this.goIn()
},
goIn () {
uni.navigateBack()
}
}
}
</script>
<style lang="stylus">
</style>

View File

@@ -0,0 +1,132 @@
<template>
<view class="zd_container">
<nav-bar title="任务流转"></nav-bar>
<view class="zd_content">
<view class="flow_wrapper" v-for="e in dataList" :key="e.point_code">
<view class="zd-row">
<view class="zd-col-24">
<view class="zd-row">
<view class="zd-col-2">
<view class="zd-row flow_icon_item_1">
<view class="iconfont icon_start_point">&#xe820;</view>
</view>
</view>
<view class="zd-col-22">
<view class="zd-row flow_start_item" @tap="checkcode1(e)" :class="{'flow_start_item_checked': pkId1 === e.point_id}">
<view class="zd-col-8 pdl20 pdr20 font-size-1">{{e.point_code}}</view>
<view class="zd-col-16 pdr20 font-size-2">{{e.point_name}}</view>
<view v-show="pkId1 === e.point_code" class="iconfont icon_choosed">&#xe66b;</view>
</view>
</view>
</view>
</view>
</view>
<view class="zd-row">
<view class="zd-col-24">
<view class="zd-row flow_icon_item_2">
<view class="iconfont icon_vdash_line">&#xe603;</view>
</view>
</view>
</view>
<view class="zd-row">
<view class="zd-col-24">
<view class="zd-row flexstart">
<view class="zd-col-2">
<view class="zd-row flow_icon_item_1">
<view class="iconfont icon_start_point">&#xe61f;</view>
</view>
</view>
<view class="zd-col-22">
<view class="zd-row mgb10 flow_start_item" v-for="el in e.end_points" :key="el.point_code" @tap="checkcode2(el, e)" :class="{'flow_start_item_checked': pkId2 === el.point_id}">
<view class="zd-col-8 pdl20 pdr20 font-size-1">{{el.point_code}}</view>
<view class="zd-col-16 pdr20 font-size-2">{{el.point_name}}</view>
<view v-show="pkId2 === el.point_code" class="iconfont icon_choosed">&#xe66b;</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="submit-bar_new">
<button class="zd-col-24 submit-button_new" :class="{'btn-disabled': !pkId1}" :disabled="disabled" @tap="toSure">生成任务</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {queryAllPoints, createP2pTask} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
dataList: [],
disabled: false,
pkId1: '',
pkId2: '',
pid1: '',
pid2: '',
pd2: ''
};
},
created () {
this._queryAllPoints()
},
methods: {
/** 初始化查询 */
async _queryAllPoints () {
let res = await queryAllPoints()
this.dataList = [...res]
},
checkcode1 (e) {
if (this.pid2 !== '' && e.point_id !== this.pid2) {
this.pkId2 = ''
this.pid2 = ''
this.pd2 = ''
}
this.pkId1 = this.pkId1 === e.point_id ? '' : e.point_id
this.pid1 = this.pkId1 === e.point_id ? e.point_code : ''
},
checkcode2 (el, e) {
if (this.pkId1 !== '' && this.pkId1 !== e.point_id) {
return
}
this.pkId2 = this.pkId2 === el.point_id ? '' : el.point_id
this.pid2 = this.pkId2 === el.point_id ? e.point_id : ''
this.pd2 = this.pkId2 === el.point_id ? el.point_code : ''
},
/** 重新下发 */
async toSure () {
this.disabled = true
if (!this.pkId1) {
this.disabled = false
return
}
try {
let res = await createP2pTask(this.pid1, this.pd2)
this.disabled = false
this.pkId1 = ''
this.pkId2 = ''
this.pid1 = ''
this.pid2 = ''
this.pd2 = ''
this._queryAllPoints()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
}
}
}
</script>
<style lang="stylus">
</style>