<template>
	<view class="zd_container">
		<nav-bar title="呼叫满料"></nav-bar>
		<view class="zd_content">
			<view class="zd_wrapper grid-wraper">
				<view class="slide_new">
					<table>
						<thead>
							<tr>
								<th>起点</th>
								<th>终点</th>
								<th>任务状态</th>
								<th>备注</th>
							</tr>
						</thead>
						<tbody>
							<tr v-for="(e, i) in dataList" :key="i">
								<td>{{e.point_name1}}</td>
								<td>{{e.point_name2}}</td>
								<td>{{e.task_status}}</td>
								<td>{{e.remark}}</td>
							</tr>
						</tbody>
					</table>
				</view>
			</view>
		</view>
		<view class="submit-bar">
			<button class="submit-button" @tap="_callingMaterialTaskShow">刷新</button>
			<button class="submit-button" :disabled="disabled" @tap="toSure">呼叫满料</button>
		</view>
	</view>
</template>

<script>
	import NavBar from '@/components/NavBar.vue'
	import {callingMaterialTaskShow, callingMaterialTask} from '@/utils/getData1.js'
	export default {
		components: {
			NavBar
		},
		data() {
			return {
				dataList: [],
				disabled: false
			};
		},
		created () {
			this._callingMaterialTaskShow()
		},
		methods: {
			/** grid查询 */
			async _callingMaterialTaskShow () {
				let res = await callingMaterialTaskShow()
				this.dataList = [...res]
			},
			/** 呼叫满料 */
			async toSure () {
				this.disabled = true
				try {
					let res = await callingMaterialTask()
					this.disabled = false
					this._callingMaterialTaskShow()
					uni.showToast({
						title: res.message,
						icon: 'none'
					})
				} catch (e) {
					this.disabled = false
				}
			}
		}
	}
</script>

<style lang="stylus">
</style>
