Browse Source

add contect

zhuzhen 11 months ago
parent
commit
5914d28618

+ 8 - 0
src/renderer/src/api/SupdemApi.ts

@@ -49,6 +49,14 @@ class DeptApi {
   	  }
   	  }
     return FetchRequest.put('/api/sys/supply/addSupply',JSON.stringify(data),true);
     return FetchRequest.put('/api/sys/supply/addSupply',JSON.stringify(data),true);
   }
   }
+	
+	/**
+	 * 获取所有个人所有发布信息
+	 * @param Id 部门ID
+	 */
+	static getDtailList(Id: string): Promise<any> {
+	  return FetchRequest.get("/api/sys/supply/getDetailList?id="+Id, true);
+	}
   /**
   /**
    * 获取部门
    * 获取部门
    * @param id 部门ID
    * @param id 部门ID

+ 5 - 0
src/renderer/src/router/index.ts

@@ -49,6 +49,11 @@ const routes : Array<RouteRecordRaw> = [
 						path: ':id',
 						path: ':id',
 						name: 'supdem',
 						name: 'supdem',
 						component: () => import('../views/supdem/List.vue')
 						component: () => import('../views/supdem/List.vue')
+					},
+					{
+						path: 'detail:id',
+						name: 'detail',
+						component: () => import('../views/supdem/ListDetail.vue')
 					}
 					}
 				]
 				]
 			},
 			},

+ 2 - 2
src/renderer/src/views/Login.vue

@@ -21,9 +21,9 @@
       </el-form-item>
       </el-form-item>
 
 
       <div class="el-row">
       <div class="el-row">
-        <div class="el-col-12">
+        <!-- <div class="el-col-12">
           <el-button type="info" @click="router.push('/register')">注册</el-button>
           <el-button type="info" @click="router.push('/register')">注册</el-button>
-        </div>
+        </div> -->
         <div class="el-col-12">
         <div class="el-col-12">
           <div class="text-right">
           <div class="text-right">
             <el-button type="primary" @click="submit">登录</el-button>
             <el-button type="primary" @click="submit">登录</el-button>

+ 42 - 18
src/renderer/src/views/supdem/List.vue

@@ -10,23 +10,38 @@
         />
         />
       </div> -->
       </div> -->
 			<div style="display: flex;justify-content: end;padding: 2% 5%;">
 			<div style="display: flex;justify-content: end;padding: 2% 5%;">
-				<button v-if="supplyFlag == 1"  @click="poupForm" style="background: #303133;color: white;padding: 10px;border-radius: 5px;">发布需求</button>
+				<el-button :type="rangType=='0'?'success':''" @click="changeTy('0')">供</el-button>
+				<el-button :type="rangType=='1'?'success':''" @click="changeTy('1')">求</el-button>
+				<el-button type="primary"  v-if="supplyFlag == 1"  @click="poupForm">发布需求</el-button>
 			</div>
 			</div>
 			<view class="messageBox">
 			<view class="messageBox">
-				<view class="leftBox">
-					<view class="">
+				<view class="leftBox" v-if="rangType=='0'">
+					<!-- <view class="">
-					</view>
-					<view class="item" v-for="(item,index) in bupplyList">
-						{{item.content}} 创建时间 {{item.createTime}}
+					</view> -->
+					<view class="item" v-for="(item,_index) in bupplyList">
+						<view class="" style="display: block;">
+							{{item.content}}
+						</view>
+						<view class="" style="margin-top: 20px; display: flex; justify-content: end;">
+							<el-button class="" type="success" style="width: 20%;" @click="lookDetail(item.id)">查看详情</el-button>
+							<el-button class="" type="primary" style="width: 20%;"  @click="showUser(item.user.userId, true)">联系</el-button>
+						</view>
+						
 					</view>
 					</view>
 				</view>
 				</view>
-				<view class="rightBox">
-					<view class="">
+				<view class="leftBox" v-if="rangType=='1'">
+					<!-- <view class="">
-					</view>
-					<view class="item" v-for="(item,index) in buyList">
-						{{item.content}} 创建时间 {{item.createTime}}
+					</view> -->
+					<view class="item" v-for="(item,_index) in buyList">
+						<view class="" style="display: block;">
+							{{item.content}}
+						</view>
+						<view class="" style="margin-top: 20px; display: flex; justify-content: end;">
+							<el-button class="" type="success" style="width: 20%;" @click="lookDetail(item.id)">查看详情</el-button>
+							<el-button class="" type="primary" style="width: 20%;"  @click="showUser(item.user.userId, true)">联系</el-button>
+						</view>
 					</view>
 					</view>
 				</view>
 				</view>
 			</view>
 			</view>
@@ -55,10 +70,12 @@
 
 
 <script setup lang="ts">
 <script setup lang="ts">
 	import { ref } from 'vue'
 	import { ref } from 'vue'
-	import { useRoute } from 'vue-router'
+	import { useRoute,useRouter } from 'vue-router'
 	import SupdemApi from '@renderer/api/SupdemApi'
 	import SupdemApi from '@renderer/api/SupdemApi'
 	import { ElMessage } from 'element-plus'
 	import { ElMessage } from 'element-plus'
+	import showUser from '@renderer/components/user-modal'
 	const route = useRoute()
 	const route = useRoute()
+	const router = useRouter()
 	const keyword = ref('')
 	const keyword = ref('')
 	const loading = ref(true)
 	const loading = ref(true)
 	const bupplyList : any = ref([]);
 	const bupplyList : any = ref([]);
@@ -70,7 +87,7 @@
 	const buyContent = ref('');
 	const buyContent = ref('');
 	const supplyContentapl = ref('供 内容  举例:消息内容:包裹速取 联系人&联系公司:张三 联系方式:18888889999');
 	const supplyContentapl = ref('供 内容  举例:消息内容:包裹速取 联系人&联系公司:张三 联系方式:18888889999');
 	const buyContentapl = ref('求 内容  举例:消息内容:包裹速取 联系人&联系公司:张三 联系方式:18888889999');
 	const buyContentapl = ref('求 内容  举例:消息内容:包裹速取 联系人&联系公司:张三 联系方式:18888889999');
-	
+	const rangType = ref('0')
 	
 	
 	if (typeof deptId === 'string') {
 	if (typeof deptId === 'string') {
 		loading.value = true
 		loading.value = true
@@ -87,6 +104,9 @@
 	const poupForm=()=>{
 	const poupForm=()=>{
 		supply.value = true;
 		supply.value = true;
 	}
 	}
+	const changeTy=(s:string)=>{
+		rangType.value = s
+	}
 	const save = () => {
 	const save = () => {
 		console.log("supplyContent", supplyContent.value)
 		console.log("supplyContent", supplyContent.value)
 		SupdemApi.addSupply(deptId,supplyContent.value, buyContent.value).then((res) => {
 		SupdemApi.addSupply(deptId,supplyContent.value, buyContent.value).then((res) => {
@@ -107,6 +127,9 @@
 		supplyContent.value = '';
 		supplyContent.value = '';
 		buyContent.value = '';
 		buyContent.value = '';
 	}
 	}
+	const lookDetail =(id)=>{
+		router.push('/index/supdem/detail' + id)
+	}
 </script>
 </script>
 
 
 <style scoped lang="less">
 <style scoped lang="less">
@@ -160,17 +183,18 @@
 		background: white;
 		background: white;
 	}
 	}
 	.messageBox {
 	.messageBox {
-		display: flex;
-		justify-content: space-around;
+		display: block;
+		padding: 5%;
+		// display: flex;
+		// justify-content: space-around;
 		height: 100%;
 		height: 100%;
 		width: 100%;
 		width: 100%;
 		.leftBox {
 		.leftBox {
-			width: 45%;
-
+			// width: 45%;
 			.item {
 			.item {
 				border: 1px solid black;
 				border: 1px solid black;
 				border-radius: 5px;
 				border-radius: 5px;
-				padding: 5%;
+				padding:2% 5%;
 				margin-top: 15px;
 				margin-top: 15px;
 				font-size: 14px;
 				font-size: 14px;
 				display: block;
 				display: block;

+ 209 - 0
src/renderer/src/views/supdem/ListDetail.vue

@@ -0,0 +1,209 @@
+<template>
+
+	<div v-loading="loading" class="dept-box">
+		<el-scrollbar height="100%">
+			<!-- <div class="search-box">
+        <el-input
+            v-model="keyword"
+            placeholder="请输入搜索内容(支持拼音搜索)"
+            :suffix-icon="Search"
+        />
+      </div> -->
+			<div style="display: flex;justify-content: end;padding: 2% 5%;">
+				<el-button :type="rangType=='0'?'success':''" @click="changeTy('0')">供</el-button>
+				<el-button :type="rangType=='1'?'success':''" @click="changeTy('1')">求</el-button>
+			</div>
+			<view class="messageBox">
+				<view class="leftBox" v-if="rangType=='0'">
+					<!-- <view class="">
+						供
+					</view> -->
+					<view class="item" v-for="(item,_index) in bupplyList">
+						<view class="" style="display: block;">
+							{{item.content}}
+						</view>
+						<view class="" style="margin-top: 20px; display: flex; justify-content: end;">
+							<el-button class="" type="primary" style="width: 20%;"  @click="showUser(item.user.userId, true)">联系</el-button>
+						</view>
+						
+					</view>
+				</view>
+				<view class="leftBox" v-if="rangType=='1'">
+					<!-- <view class="">
+						求
+					</view> -->
+					<view class="item" v-for="(item,_index) in buyList">
+						<view class="" style="display: block;">
+							{{item.content}}
+						</view>
+						<view class="" style="margin-top: 20px; display: flex; justify-content: end;">
+							<el-button class="" type="primary" style="width: 20%;"  @click="showUser(item.user.userId, true)">联系</el-button>
+						</view>
+					</view>
+				</view>
+			</view>
+			<el-result v-if="bupplyList.length === 0 && !loading" icon="info">
+				<template #sub-title>
+					<p>此类型暂无数据!</p>
+				</template>
+			</el-result>
+			<view class="formBox" v-if="supply">
+				<el-forms ref="userForm" >
+					<el-section title="供应内容" subTitle="请输入供应内容 需注意换行格式" type="line" padding>
+						<el-input type="textarea" :rows="8" style="min-height: 140px;margin-bottom: 5%;"   v-model="supplyContent" :placeholder="supplyContentapl"></el-input>
+					</el-section>
+					<el-section title="需求内容" subTitle="请输入需求内容 需注意换行格式" type="line" padding>
+						<el-input :rows="8" style="min-height: 140px;margin-bottom: 5%;"   type="textarea" v-model="buyContent" :placeholder="buyContentapl"></el-input>
+					</el-section>
+					<view class="" style="margin-top: 5%;display: flex;justify-content: space-evenly;">
+						<el-button class="" type="success" style="width: 20%;" @click="save">提交</el-button>
+						<el-button class="" type="info" style="width: 20%;" @click="saveCancle">取消</el-button>
+					</view>
+				</el-forms>
+			</view>
+		</el-scrollbar>
+	</div>
+</template>
+
+<script setup lang="ts">
+	import { ref } from 'vue'
+	import { useRoute } from 'vue-router'
+	import SupdemApi from '@renderer/api/SupdemApi'
+	import { ElMessage } from 'element-plus'
+	import showUser from '@renderer/components/user-modal'
+	const route = useRoute()
+	const keyword = ref('')
+	const loading = ref(true)
+	const bupplyList : any = ref([]);
+	const buyList : any = ref([]);
+	const supplyFlag = ref('0');
+	const deptId  =  route.params.id.toString()
+	const supply = ref(false);
+	const supplyContent = ref('');
+	const buyContent = ref('');
+	const supplyContentapl = ref('供 内容  举例:消息内容:包裹速取 联系人&联系公司:张三 联系方式:18888889999');
+	const buyContentapl = ref('求 内容  举例:消息内容:包裹速取 联系人&联系公司:张三 联系方式:18888889999');
+	const rangType = ref('0')
+	
+	if (typeof deptId === 'string') {
+		loading.value = true
+		SupdemApi.getDtailList(deptId)
+			.then((res) => {
+				bupplyList.value = res.data.bupplyList;
+				buyList.value = res.data.buyList;
+			})
+			.finally(() => {
+				loading.value = false
+			})
+	}
+	const poupForm=()=>{
+		supply.value = true;
+	}
+	const changeTy=(s:string)=>{
+		rangType.value = s
+	}
+	const save = () => {
+		console.log("supplyContent", supplyContent.value)
+		SupdemApi.addSupply(deptId,supplyContent.value, buyContent.value).then((res) => {
+			// map.value = Tools.listToMap(res.data);
+			console.log("发布结果",res)
+			if(res.code == 200){
+				ElMessage.success('发布成功')
+				saveCancle()
+			}
+			
+		}).finally(() => {
+			
+		})
+	}
+	const saveCancle=()=>{
+		console.log("supply",supply)
+		supply.value = false;
+		supplyContent.value = '';
+		buyContent.value = '';
+	}
+</script>
+
+<style scoped lang="less">
+	.dept-box {
+		background-color: #ffffff;
+		height: 100%;
+		padding: 0 !important;
+		box-sizing: border-box;
+	}
+
+	.users {
+		padding: 18px;
+		height: 100%;
+		width: 100%;
+		overflow-x: hidden;
+		overflow-y: scroll;
+
+		.users-grid {
+			display: grid;
+			grid-template-columns: repeat(auto-fit, 95px);
+			grid-template-rows: repeat(auto-fit, 80px);
+			grid-row-gap: 12px;
+			grid-column-gap: 12px;
+		}
+
+		.user {
+			text-align: center;
+			cursor: pointer;
+			padding: 10px;
+			border: 1px solid #cccccc;
+
+			.username {
+				width: 100%;
+				text-overflow: ellipsis;
+				white-space: nowrap;
+				overflow: hidden;
+			}
+		}
+	}
+
+	.search-box {
+		padding: 15px 20px;
+	}
+	.formBox {
+		width: 100%;
+		height: 100%;
+		padding: 5%;
+		// background: #c3acac;
+		position: absolute;
+		top: 0;
+		background: white;
+	}
+	.messageBox {
+		display: block;
+		padding: 5%;
+		// display: flex;
+		// justify-content: space-around;
+		height: 100%;
+		width: 100%;
+		.leftBox {
+			// width: 45%;
+			.item {
+				border: 1px solid black;
+				border-radius: 5px;
+				padding:2% 5%;
+				margin-top: 15px;
+				font-size: 14px;
+				display: block;
+			}
+		}
+
+		.rightBox {
+			width: 45%;
+
+			.item {
+				border: 1px solid black;
+				border-radius: 5px;
+				padding: 5%;
+				margin-top: 15px;
+				font-size: 14px;
+				display: block;
+			}
+		}
+	}
+</style>