<template>
	<view>
		<uni-indexed-list :options="list" :showSelect="false" @click="bindClick"></uni-indexed-list>
		<!-- <uni-collapse>
			<uni-collapse-item title="默认开启" :open="true">
				<text>折叠内容</text>
			</uni-collapse-item>
			<uni-collapse-item title="折叠内容">
				<text>折叠内容</text>
			</uni-collapse-item>
			<uni-collapse-item title="禁用状态" disabled>
				<text>折叠内容</text>
			</uni-collapse-item>
			<uni-collapse-item title="折叠内容使用 uni-list 组件">
				<uni-list>
					<uni-list-item title="列表文字"></uni-list-item>
					<uni-list-item :disabled="true" title="列表文字" note="列表禁用状态"></uni-list-item>
					<uni-list-item title="列表右侧显示 switch" :show-switch="true"></uni-list-item>
					<uni-list-item :show-extra-icon="true" :extra-icon="extraIcon" title="列表左侧带扩展图标"></uni-list-item>
					<uni-list-item title="列表左侧带略缩图" note="列表描述信息"
						thumb="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png" thumb-size="lg"
						rightText="右侧文字" showArrow></uni-list-item>
					<uni-list-item title="开启点击反馈" clickable showArrow @click="onClick"></uni-list-item>
				</uni-list>
			</uni-collapse-item>
			<uni-collapse-item title="折叠内容使用 uni-list 组件">
				<uni-list>
					<uni-list-item title="列表文字"></uni-list-item>
					<uni-list-item :disabled="true" title="列表文字" note="列表禁用状态"></uni-list-item>
					<uni-list-item title="列表右侧显示 switch" :show-switch="true"></uni-list-item>
					<uni-list-item :show-extra-icon="true" :extra-icon="extraIcon" title="列表左侧带扩展图标"></uni-list-item>
					<uni-list-item title="列表左侧带略缩图" note="列表描述信息"
						thumb="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png" thumb-size="lg"
						rightText="右侧文字" showArrow></uni-list-item>
					<uni-list-item title="开启点击反馈" clickable showArrow @click="onClick"></uni-list-item>
				</uni-list>
			</uni-collapse-item>
		</uni-collapse> -->

	</view>
</template>

<script>
	import {
		clearData
	} from '@/api/workshop.js';
	export default {
		data() {
			return {
				noticeText: '',
				list: [{
					"letter": "其他功能集",
					"data": [
						"入库盘点",
						"出库盘点",
						"仓位盘点",
						"直接调拨（生成）",
					]
				}, {
					"letter": "入库功能集",
					"data": [
						"其他入库单",
						"采购入库单",
						"受托加工入库单",
					]
				}, {
					"letter": "退库功能集",
					"data": [
						"生产退料料管作业平台",
						"简单生产退料单",
						"其他出库（退货）",
					]
				}, {
					"letter": "出库功能集",
					"data": [
						"其他出库",
						"生产补料料管作业平台",
						"生产领料料管作业平台",
						"简单生产领料",
						"采购退料单",
						"受托加工材料退料单",
						"销售出库",
						"简单生产领料（智能）",
					]
				}]


			}
		},
		mounted() {},
		methods: {
			bindClick(e) {
				console.log('点击item，返回数据' + JSON.stringify(e))
				console.log(e)
				let item = e.item
				console.log(item)
				if (item.name == "生产补料料管作业平台") {
					this.$tab.navigateTo('/pages/production-replenishment/index');
				}
				if (item.name == "生产领料料管作业平台") {
					const formId = 'LT_PRD_PMCWorkBench';
					const fbillType = 'd43d7e5b9def82fc11e3e582178e4360';
					uni.setStorageSync('formId', formId)
					uni.setStorageSync('fbillType', fbillType)
					uni.setStorageSync('moudleName', item.name)
					uni.navigateTo({
						// url: `/pages/stock-dispatch/index?FormId=${encodeURIComponent(formId)}&FBillType=${encodeURIComponent(fbillType)}`
						url: '/pages/stock-dispatch/index'
					});
				}
				if (item.name == "其他出库") {
					const formId = 'STK_MisDelivery';
					// const fbillType = 'd43d7e5b9def82fc11e3e582178e4360';
					uni.setStorageSync('formId', formId)
					uni.setStorageSync('fbillType', null)
					uni.setStorageSync('moudleName', item.name)
					uni.navigateTo({
						// url: `/pages/stock-dispatch/index?FormId=${encodeURIComponent(formId)}&FBillType=${encodeURIComponent(fbillType)}`
						url: '/pages/stock-dispatch/index'
					});
				}
				if (item.name == "简单生产领料") {
					const formId = 'SP_PickMtrl';
					// const fbillType = 'd43d7e5b9def82fc11e3e582178e4360';
					uni.setStorageSync('formId', formId)
					uni.setStorageSync('fbillType', null)
					uni.setStorageSync('moudleName', item.name)
					uni.navigateTo({
						// url: `/pages/stock-dispatch/index?FormId=${encodeURIComponent(formId)}&FBillType=${encodeURIComponent(fbillType)}`
						url: '/pages/stock-dispatch/index'
					});
				}
				if (item.name == "采购退料单") {
					const formId = 'PUR_MRB';
					// const fbillType = 'd43d7e5b9def82fc11e3e582178e4360';
					uni.setStorageSync('formId', formId)
					uni.setStorageSync('fbillType', null)
					uni.setStorageSync('moudleName', item.name)
					uni.navigateTo({
						// url: `/pages/stock-dispatch/index?FormId=${encodeURIComponent(formId)}&FBillType=${encodeURIComponent(fbillType)}`
						url: '/pages/stock-dispatch/index'
					});
				}
				if (item.name == "受托加工材料退料单") {
					const formId = 'STK_OEMInStockRETURN';
					uni.setStorageSync('formId', formId)
					uni.setStorageSync('fbillType', null)
					uni.setStorageSync('moudleName', item.name)
					uni.navigateTo({
						url: '/pages/stock-dispatch/index'
					});
				}

				if (item.name == "销售出库") {
					const formId = 'SAL_OUTSTOCK';
					uni.setStorageSync('formId', formId)
					uni.setStorageSync('fbillType', null)
					uni.setStorageSync('moudleName', item.name)
					uni.navigateTo({
						// url: `/pages/stock-dispatch/index?FormId=${encodeURIComponent(formId)}&FBillType=${encodeURIComponent(fbillType)}`
						url: '/pages/stock-dispatch/index',
					});
				}
				if (item.name == "简单生产领料（智能）") {
					const formId = 'SP_PickMtrl';
					// const fbillType = 'd43d7e5b9def82fc11e3e582178e4360';
					uni.setStorageSync('formId', formId)
					uni.setStorageSync('fbillType', 'B')
					uni.setStorageSync('moudleName', item.name)
					uni.navigateTo({
						// url: `/pages/stock-dispatch/index?FormId=${encodeURIComponent(formId)}&FBillType=${encodeURIComponent(fbillType)}`
						url: '/pages/stock-dispatch/index'
					});
				}
				if (item.name == "其他入库单") {
					const formId = 'STK_MISCELLANEOUS';
					// const fbillType = 'd43d7e5b9def82fc11e3e582178e4360';
					uni.setStorageSync('formId', formId)
					uni.setStorageSync('fbillType', null)
					uni.setStorageSync('moudleName', item.name)
					uni.navigateTo({
						// url: `/pages/stock-dispatch/index?FormId=${encodeURIComponent(formId)}&FBillType=${encodeURIComponent(fbillType)}`
						url: '/pages/storage/index'
					});
				}
				if (item.name == "采购入库单") {
					const formId = 'STK_InStock';
					// const fbillType = 'd43d7e5b9def82fc11e3e582178e4360';
					uni.setStorageSync('formId', formId)
					// uni.setStorageSync('fbillType', null)
					uni.setStorageSync('moudleName', item.name)
					uni.navigateTo({
						// url: `/pages/stock-dispatch/index?FormId=${encodeURIComponent(formId)}&FBillType=${encodeURIComponent(fbillType)}`
						url: '/pages/storage/index'
					});
				}
				if (item.name == "受托加工入库单") {
					const formId = 'STK_OEMInStock';
					// const fbillType = 'd43d7e5b9def82fc11e3e582178e4360';
					uni.setStorageSync('formId', formId)
					// uni.setStorageSync('fbillType', null)
					uni.setStorageSync('moudleName', item.name)
					uni.navigateTo({
						// url: `/pages/stock-dispatch/index?FormId=${encodeURIComponent(formId)}&FBillType=${encodeURIComponent(fbillType)}`
						url: '/pages/storage/index'
					});
				}
				if (item.name == "生产退料料管作业平台") {
					const formId = 'LT_PRD_PMCWorkBench';
					uni.setStorageSync('formId', formId)
					uni.setStorageSync('fbillType', 'd43d7e5b9def82fd11e3e603ca986cd9')
					uni.setStorageSync('moudleName', item.name)
					uni.navigateTo({
						url: '/pages/storage/index'
					});
				}
				if (item.name == "简单生产退料单") {
					const formId = 'SP_ReturnMtrl';
					uni.setStorageSync('formId', formId)
					// uni.setStorageSync('fbillType', 'd43d7e5b9def82fd11e3e603ca986cd9')
					uni.setStorageSync('moudleName', item.name)
					uni.navigateTo({
						url: '/pages/storage/index'
					});
				}
				if (item.name == "其他出库（退货）") {
					const formId = 'STK_MisDelivery';
					uni.setStorageSync('formId', formId)
					uni.setStorageSync('fbillType', 'RETURN')
					uni.setStorageSync('moudleName', item.name)
					uni.navigateTo({
						url: '/pages/storage/index'
					});
				}
				if (item.name == "仓位盘点") {
					const formId = 'LT_STK_StockCount';
					uni.setStorageSync('formId', formId)
					uni.setStorageSync('fbillType', '6764c6f5bb0056') //单据类型id
					uni.setStorageSync('moudleName', item.name)
					uni.navigateTo({
						url: '/pages/check/index'
					});
				}
				if (item.name == "入库盘点") {
					const formId = 'LT_STK_StockCount';
					uni.setStorageSync('formId', formId)
					uni.setStorageSync('fbillType', '6764c7a4bb007d') //单据类型id
					uni.setStorageSync('moudleName', item.name)
					uni.navigateTo({
						url: '/pages/check/index'
					});
				}if (item.name == "出库盘点") {
					const formId = 'LT_STK_StockCount';
					uni.setStorageSync('formId', formId)
					uni.setStorageSync('fbillType', '6764c7bbbb009f') //单据类型id
					uni.setStorageSync('moudleName', item.name)
					uni.navigateTo({
						url: '/pages/check/index'
					});
				}
			},
			goScan() {
				uni.navigateTo({
					url: "/pages/index/show"
				})
			},
			goClean() {
				let Yycbm = {
					'Yycbm': uni.getStorageSync('HBFacadeName')
				};
				console.log(Yycbm)
				clearData(Yycbm).then(res => {
					console.log(res)
					if (res.Code == '0000') {
						this.$modal.msgSuccess('清理数据成功！');
					} else {
						this.$modal.msgError('数据已为空！');
					}

				})
				// let invl = uni.getStorageSync('invoiceList')
				// if (invl) {
				// 	uni.removeStorageSync('invoiceList')
				// 	this.$modal.msgSuccess('清理数据成功！');
				// } else {

				// }
			},
			goBack() {
				uni.reLaunch({
					url: "/pages/login/index"
				})
			},
			// 退出应用
			quitApp() {
				plus.runtime.quit();
			},
		}
	}
</script>


<style scoped>
	page {
		background-image: linear-gradient(to bottom, #b9c4de, #ffffff);
	}

	.menu {
		display: flex;
		flex-wrap: wrap;
		padding-top: 20%;
		flex-direction: column;
	}

	.btn {
		margin: 5%;
	}
</style>