Browse Source

Merge remote-tracking branch 'origin/master'

gydx_2024_lyh 2 months ago
parent
commit
8c72a5f5e9

+ 77 - 20
gydxnbplus/src/components/GrainDepot.vue

@@ -85,15 +85,25 @@
       <el-table-column prop="minPrice" label="限制价格下限" />
       <el-table-column width="170px"  label="操作">
         <template v-slot="scope">
-          <el-button-group class="ml-4">
-            <el-button type="primary" @click="jumpCompetitive(scope.row)"  style="width: 60px">竞标详情</el-button>
+          <el-button-group class="ml-4" v-if="scope.row.biddingStatus==='未开始'">
+
+            <el-button @click="Biddingstart(scope.row)" type="primary"  >开始竞标</el-button>
+            <el-button type="primary" @click="jumpCompetitive(scope.row)"  style="width: 60px" text>竞标详情</el-button>
+            <el-button @click="handleDelete(scope.row)" type="danger" :icon="Delete" text >删除</el-button>
+
+          </el-button-group>
+          <el-button-group class="ml-4" v-else>
+
+            <el-button type="primary" @click="jumpCompetitive(scope.row)"  style="width: 60px" text>竞标详情</el-button>
             <el-button @click="handleDelete(scope.row)" type="danger" :icon="Delete" text >删除</el-button>
+
           </el-button-group>
 
         </template>
       </el-table-column>
     </el-table>
 
+
     <el-dialog class="overlay" v-model="showOverlay">
       <div class="modal">
         <el-row>
@@ -103,18 +113,18 @@
           </el-col>
           <el-col :span="12">
             <label>采购类型:</label>
-            <el-input style="width: 60%" type="text" v-model="biddingType" placeholder="煤炭"></el-input>
+            <el-input style="width: 60%" type="text" v-model="biddingType" placeholder="请输入采购类型"></el-input>
           </el-col>
         </el-row><br>
 
         <el-row>
           <el-col :span="12">
             <label>采购数量:</label>
-            <el-input style="width: 60%" type="number" v-model="purchaseQuantity" placeholder="5000"></el-input>
+            <el-input style="width: 60%" type="number" v-model="purchaseQuantity" placeholder="请输入采购数量"></el-input>
           </el-col>
           <el-col :span="12">
             <label>采购计量单位:</label>
-            <el-input style="width: 60%" type="text" v-model="measurementUnit" placeholder=""></el-input>
+            <el-input style="width: 60%" type="text" v-model="measurementUnit" placeholder="输入单位"></el-input>
           </el-col>
         </el-row><br>
 
@@ -124,35 +134,35 @@
             <el-date-picker
                 format="YYYY/MM/DD"
                 value-format="YYYY-MM-DD"
-                type="date" v-model="startTime" placeholder="2024-08-28"></el-date-picker>
+                type="date" v-model="startTime" placeholder="请选择招采开始时间"></el-date-picker>
           </el-col>
           <el-col :span="12">
             <label>招采结束时间:</label>
             <el-date-picker
                 format="YYYY/MM/DD"
                 value-format="YYYY-MM-DD"
-                type="date" v-model="endTime" placeholder="2024-08-21"></el-date-picker>
+                type="date" v-model="endTime" placeholder="请选择招采结束时间"></el-date-picker>
           </el-col>
         </el-row><br>
 
         <el-row>
           <el-col :span="12">
             <label>供货地点:</label>
-            <el-input style="width: 60%" type="text" v-model="supplyLocation" placeholder="工大操场"></el-input>
+            <el-input style="width: 60%" type="text" v-model="supplyLocation" placeholder="请输入供货地点"></el-input>
           </el-col>
           <el-col :span="12">
             <label>最晚到货时间:</label>
             <el-date-picker
                 format="YYYY/MM/DD"
                 value-format="YYYY-MM-DD"
-                type="date" v-model="latestArrivalTime" placeholder="2024-08-20"></el-date-picker>
+                type="date" v-model="latestArrivalTime" placeholder="请选择最晚到货时间"></el-date-picker>
           </el-col>
         </el-row><br>
 
         <el-row>
           <el-col :span="12">
             <label>发票类型:</label>
-            <el-select style="width: 60%" v-model="invoiceType" placeholder="普通发票">
+            <el-select style="width: 60%" v-model="invoiceType" placeholder="请选择发票类型">
               <el-option label="普通发票" value="普通发票"></el-option>
               <el-option label="增值税发票" value="增值税发票"></el-option>
             </el-select>
@@ -162,14 +172,17 @@
             <el-date-picker
                 format="YYYY/MM/DD"
                 value-format="YYYY-MM-DD"
-                type="date" v-model="paymentTime" placeholder="2024-08-21"></el-date-picker>
+                type="date" v-model="paymentTime" placeholder="请选择付款时间"></el-date-picker>
           </el-col>
         </el-row><br>
 
         <el-row>
           <el-col :span="12">
             <label>使用规则:</label>
-            <el-select style="width: 60%"  v-model="usageRule" placeholder="煤炭采购规则"></el-select>
+            <el-select style="width: 60%"  v-model="usageRule" placeholder="选择使用的规则">
+              <el-option v-for="rule in this.ruleOptions" :key="rule.foodRuleID" :label="rule.foodRuleName" :value="rule.foodRuleID"/>
+
+            </el-select>
           </el-col>
           <el-col :span="12">
             <label>委托方名称:</label>
@@ -261,6 +274,8 @@ import { Delete, EditPen, Paperclip, Plus, Refresh, Search } from '@element-plus
 import http from "@/utils/http";
 
 
+
+
 const showOverlay = ref(false)
 
 const title1 = ref('')
@@ -303,6 +318,7 @@ export default {
       return Delete
     },
     formattedRemainingTime() {
+
       return this.tableData.map(item => {
         if (item.clickStartTime) {
           const startTime = new Date(item.clickStartTime);
@@ -347,10 +363,28 @@ export default {
       priceUpperLimit,
       priceLowerLimit,
       sels: [], //当前选框选中的值
+      ruleOptions:[]
 
     }
   },
+  mounted() {
+    this.onSubmit()
+    this.getRule()
+  },
   methods: {
+    Biddingstart(row){
+      row.biddingStatus = '进行中'
+      const updateBiddingMes = {
+        BiddingMesID : row.biddingMesID,
+        BiddingStatus: row.biddingStatus,
+
+      }
+      http.get("/action/BiddingMes/update", updateBiddingMes).then(resp => {
+        console.log(resp)
+        this.onSubmit()
+      });
+
+    },
 
     handleSelectionChange(sels){
       this.sels = sels;
@@ -374,8 +408,9 @@ export default {
             BiddingMesID:ids[i]
           };
           http.post("/action/BiddingMes/delete",BiddingMesIDs).then(resp => {
-            console.log(ids,'这是ids2222')
-            if (resp.code === "10000") {
+            console.log(resp,'这是code2222')
+            this.onSubmit()
+            if (resp.message === "操作成功") {
               this.$message({
                 message: "删除成功",
                 type: "success",
@@ -396,11 +431,25 @@ export default {
       });
     },
     open(){
+
       showOverlay.value = true
       console.log(showOverlay.value)
     },
 
+
+    //获取竞价规则
+    getRule(){
+      http.get("/action/FoodRuleVO/queryRule", null).then(resp => {
+        console.log(resp)
+        for (let i = 0; i < resp.length; i++) {
+
+          this.ruleOptions.push(resp[i])
+          console.log('111111',resp)
+        }
+      })
+    },
     confirm() {
+
       const newData = {
         BiddingMesName: this.title1,
         biddingType: this.biddingType,
@@ -414,14 +463,16 @@ export default {
         PaymentTime: this.paymentTime,
         ClientID: this.principalName,
         MaxPrice: this.priceUpperLimit,
-        MinPrice: this.priceLowerLimit
+        MinPrice: this.priceLowerLimit,
+        foodRuleID:this.usageRule,
       };
-
+      //添加竞价信息
       http.post("/action/BiddingMes/add", newData)
           .then(response => {
             console.log("数据成功发送到后端", response);
+            console.log(newData,"这是穿的数据")
             this.showOverlay = false;
-         /*   this.onSubmit();*/
+            this.onSubmit();
           })
           .catch(error => {
             console.error("发送数据到后端时出现错误", error);
@@ -447,6 +498,12 @@ export default {
           // 从 tableData 中移除选中的行
           this.tableData = this.tableData.filter(item => item!== row);
           console.log(`删除了行数据: ${JSON.stringify(row)}`);
+          if (resp.message === "操作成功") {
+            this.$message({
+              message: "删除成功",
+              type: "success",
+            });
+          }
         });
 
       }
@@ -456,11 +513,11 @@ export default {
         BiddingMesID : row.biddingMesID
       }
       console.log(row.biddingMesID)
-    http.post("/action/BiddingMes/queryByID",BiddingMesID).then(resp => {
-      console.log(resp,"resp")
+    http.get("/action/BiddingMes/queryByID",BiddingMesID).then(resp => {
+      const serializedData = JSON.stringify(resp);
       this.$router.push({
         path:'/CompetitiveM',
-        params:{data:resp}
+        query:{data:serializedData}
       })
 
     })

+ 3 - 0
gydxnbplus/src/components/indexT.vue

@@ -95,6 +95,9 @@ import {
 
 
 export default {
+  mounted() {
+    this.jumpHomeV({name:'/HomeV',title:'首页'})
+  },
 
   methods:{
     jump(item){

+ 162 - 10
gydxnbplus/src/views/CompetitiveM.vue

@@ -17,7 +17,7 @@
             <el-table-column prop="BuyEndTime" label="招采结束时间"></el-table-column>
             <el-table-column prop="buyType" label="采购类型"></el-table-column>
             <el-table-column prop="site" label="供货地点"></el-table-column>
-            <el-table-column prop="0kFoodsTime" label="最晚到货时间"></el-table-column>
+            <el-table-column prop="okFoodsTime" label="最晚到货时间"></el-table-column>
           </el-table>
           <el-table :data="BasicDataComp_B"
             :header-cell-style="{ fontWeight: 'bold', color: 'black', backgroundColor: '#f9f9f9', height: '50px', }"
@@ -84,8 +84,8 @@
             <el-table-column prop="ResultUnit" label="中标单位"></el-table-column>
             <el-table-column prop="ResultPrice" label="中标价格"></el-table-column>
             <el-table-column prop="EntrustPerson" label="委托方"></el-table-column>
+            <el-table-column prop="PriceMin" label="价格下限"></el-table-column>
             <el-table-column prop="PriceMax" label="价格上限"></el-table-column>
-            <el-table-column prop="'PriceMin" label="价格下限"></el-table-column>
           </el-table>
         </el-row>
       </el-aside>
@@ -117,7 +117,12 @@
             </el-row>
           </el-col>
           <el-col :span="9">
-            <div class="CountDown">1:57</div>
+            <el-row class="CountDown">
+              <el-col>{{ CountdownMessage }}</el-col>
+            </el-row>
+            <el-row class="ChatMes">
+              <el-col>预留聊天信息</el-col>
+            </el-row>
             <el-row style="padding: 5px;" :gutter="15">
               <el-col :span="18"><el-input v-model="message" placeholder="请输入消息"></el-input></el-col>
               <el-col :span="6"><el-button type="primary">发送</el-button></el-col>
@@ -139,6 +144,8 @@
             <el-table-column prop="OnePrice" label="第一轮报价"></el-table-column>
             <el-table-column prop="TwoTime" label="第二轮竞价时间"></el-table-column>
             <el-table-column prop="TwoPrice" label="第二轮报价"></el-table-column>
+            <el-table-column prop="ThirdTime" label="第三轮竞价时间"></el-table-column>
+            <el-table-column prop="ThirdPrice" label="第三轮报价"></el-table-column>
           </el-table>
         </el-row>
       </el-main>
@@ -149,6 +156,88 @@
 <script>
 import { ref } from 'vue';
 export default {
+  created() {
+    const dataStr = this.$route.query.data;
+    const data = JSON.parse(dataStr);
+
+    //处理时间
+    const dateTime = data[0].clickStartTime;
+    const date = new Date(dateTime);
+    // 转换为本地时间
+    const localDate = new Date(date.getTime() - (date.getTimezoneOffset() * 60000));
+    // 提取本地时间的日期部分
+    const datePart = localDate.toISOString().split('T')[0];
+    // 提取本地时间的时间部分
+    const timePart = localDate.toISOString().split('T')[1].split('.')[0];
+    const formattedTime = datePart + " " + timePart;
+
+    let foodRule = {
+      FoodRuleID: data[0].foodRuleID,
+    }
+    //调用方法找到规则
+    const FindRule = async () => {
+      http.post('/action/FoodRuleVO/queryRuleByID', foodRule).then(res => {
+        this.RuleData = [
+          {
+            RuleName: res[0].foodRuleName,
+            Round: res[0].totalRounds,
+            RoundTime: res[0].roundsTime,
+            GapTime: res[0].roundSpacingTime
+          }
+        ]
+      })
+    }
+
+    //调用方法找到委托方
+    let ClientMes = {
+      ClientID: data[0].clientID,
+    }
+    const FindClient = async () => {
+      http.post('/action/Client/queryById', ClientMes).then(res => {
+        this.ResultData = [
+          {
+            EntrustPerson: res[0].clientName,
+            PriceMax: data[0].maxPrice,
+            PriceMin: data[0].minPrice
+          }
+        ]
+      })
+    }
+
+    FindRule()
+    FindClient()
+
+    this.BasicDataComp_T = [
+      {
+        name: data[0].biddingMesName || '默认名称',
+        buyTotal: data[0].biddingAmount || 0,
+        unit: data[0].biddingUnit || '默认单位',
+        BuyStartTime: data[0].biddingStartTime || '默认时间'
+      }
+    ];
+    this.BasicDataComp_M = [
+      {
+        BuyEndTime: data[0].biddingEndTime || '默认结束时间',
+        buyType: data[0].biddingType || '默认采购类型',
+        site: data[0].location || '默认供货地点',
+        okFoodsTime: data[0].endDeliverTime || '默认最晚到货时间'
+      }
+    ];
+    this.BasicDataComp_B = [
+      {
+        MoneyType: data[0].invoiceType,
+        paymentTime: data[0].paymentTime,
+        createTime: data[0].biddingMesCreate,
+        createPerson: 'WX'
+      }
+    ];
+    this.CompetitiveData = [
+      {
+        CDStartTime: formattedTime,
+      }
+    ];
+    console.log(data)
+  },
   setup() {
     const message = ref('')
     const QuotePrice = ref('')
@@ -159,14 +248,15 @@ export default {
   },
   data() {
     return {
+
       BasicDataComp_T: [
-        { name: 'test', buyTotal: 5000, unit: '吨', BuyStartTime: '2024-8-28' }
+        // { name: 'test', buyTotal: 5000, unit: '吨', BuyStartTime: '2024-8-28' }
       ],
       BasicDataComp_M: [
-        { BuyEndTime: '2024-8-21', buyType: '煤炭', site: '工大操场', OkFoodsTime: '2024-8-20' }
+        // { BuyEndTime: '2024-8-21', buyType: '煤炭', site: '工大操场', OkFoodsTime: '2024-8-20' }
       ],
       BasicDataComp_B: [
-        { MoneyType: '普通发票', paymentTime: '2024-8-21', createTime: '2024-8-20', createPerson: 'wx' }
+        // { MoneyType: '普通发票', paymentTime: '2024-8-21', biddingMesCreate: '2024-8-20', createPerson: 'wx' }
       ],
 
       BuyTypeData: [
@@ -185,12 +275,66 @@ export default {
         // {RuleName:'',Round:'',RoundTime:'',GapTime:''}
       ],
 
-      ProcessData:[
+      ProcessData: [
         // {Unit:'',OneTime:'',OnePrice:'',TwoTime:'',TwoPrice:'',}
-      ]
+      ],
     };
+  },
+}
+</script>
+
+<script setup>
+import http from '@/utils/http';
+import { onBeforeUnmount, onMounted } from 'vue'
+let CountdownMessage = ref('')
+
+const websocket = ref(null)
+
+onMounted(() => {
+  if ('WebSocket' in window) {
+    websocket.value = new WebSocket('ws://localhost:9999/client/BiddingDetail/B005')
+
+    websocket.value.onerror = () => {
+      setMessageInnerHTML('error')
+    }
+
+    websocket.value.onopen = () => {
+      setMessageInnerHTML('open')
+    }
+
+    websocket.value.onmessage = (event) => {
+      setMessageInnerHTML(event.data)
+    }
+
+    websocket.value.onclose = () => {
+      setMessageInnerHTML('close')
+    }
+  } else {
+    alert('Not support websocket')
   }
+})
+
+onBeforeUnmount(() => {
+  if (websocket.value) {
+    websocket.value.close()
+  }
+})
+
+function setMessageInnerHTML(param) {
+  CountdownMessage.value = param
 }
+
+// function closeWebSocket() {
+//   if (websocket.value) {
+//     console.log('关闭连接')
+//     websocket.value.close()
+//   }
+// }
+// function send() {
+//   if (websocket.value && messageInput.value) {
+//     websocket.value.send(messageInput.value)
+//   }
+// }
 </script>
 
 <style scoped>
@@ -238,9 +382,17 @@ span {
 
 .CountDown {
   padding: 10px;
-  height: 70%;
+  height: 30%;
   text-align: center;
   color: red;
-  font-size: 120px;
+  font-size: 90px;
+  max-width: 100px;
+  /* 设置最大宽度 */
+}
+
+.ChatMes {
+  margin-top: 15px;
+  padding: 10px;
+  height: 40%;
 }
 </style>

+ 1 - 1
gydxnbplus/src/views/testComp.vue

@@ -24,7 +24,7 @@
   
   onMounted(() => {
     if ('WebSocket' in window) {
-      websocket.value = new WebSocket('ws://localhost:9999/client/mio')
+      websocket.value = new WebSocket('ws://localhost:9999/client/BiddingDetail/')
   
       websocket.value.onerror = () => {
         setMessageInnerHTML('error')