companyInfoList.vue 2.78 KB
<template>
	<view class="page">
		<!-- 搜索 -->
		<view class="search-head">
			<view class="search">
				<image src="../../static/fdj1.png"></image>
				<text></text>
				<input type="text" placeholder="搜索关键词" v-model="selectName" @input="getMoHuList()"/>
			</view>
			<view class="btn">
				<text>搜索</text>
			</view>
			<mo-hu-search :show="selectShow" :list="comList" @select="select" label-name="name"
				value-name="id" style="margin-top: 100rpx;"></mo-hu-search>
		</view>
		<view class="" style="margin-top: 110rpx;">
			<view class="item" v-for="(it,index) in companyList" :key="index" @click="toAddComInfo(it.id)">
				<view class="comName">
					{{it.enterpriseName}}
				</view>
				
				<view class="more-content">
					<view class="comTime">
						{{it.creatorTime}}
					</view>
					<view class="more-content-img">
						<image src="../../static/right2.png"></image>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import request from '@/utils/request.js'
	import utils from '../../service/utils'
	import moHuSearch from '../../components/qj-fuzzy-search/index.vue'
	export default {
		components:{
			moHuSearch
		},
		data() {
			return {
				companyList:[],
				comList:[],
				selectShow:false,
				selectName:'',
				selectId:'',
			}
		},
		onLoad(){
			this.getCompanylist()
		},
		methods: {
			// 首页模糊查询
			getMoHuList(){
				this.selectShow = true
				if(this.selectName === ''){
					this.selectShow = false
				}else{
					request({
						url:'/api/SubDev/baseenterprisemanager',
						method:'get',
						data:{
							enterpriseName:this.selectName
						}
					}).then(res=>{
						console.log('模糊查询',res.data)
						if(res.code === 200){
							let arr = res.data.list
							this.comList = arr.map(it=>{
								return {
									...it,
									name:it.enterpriseName
								}
							})
							this.comList = 	JSON.parse(JSON.stringify(this.comList))
							console.log('mohu',this.comList)
						}
					})
				}
				
			},
			select(item) {
				this.selectName = item.name;
				this.selectId = item.id
				this.toAddComInfo(this.selectId)
				// if()
				this.selectShow = false;
			},
			// 跳转到企业采集表单数据详情页面
			toAddComInfo(id){
				uni.navigateTo({
					url:'/pages/companyInfoList/addComInfo/addComInfo?data=' + `${JSON.stringify(id)}`
				})
			},
			// 获取企业采集列表
			getCompanylist(){
				request({
					url:'/api/SubDev/baseenterprisemanager',
					method:'get',
					data:{}
				}).then(res=>{
					if(res.code == 200){
						console.log(res)
						this.companyList = res.data.list.map(it=>{
							return {
								...it,
								creatorTime:utils.formatTime(it.creatorTime)
							}
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
@import 'datain.scss';
</style>