添加常用网站

main 2
hshansha 1 week ago
parent db5160de63
commit c0a589e111

@ -16,7 +16,7 @@ ruoyi:
# 开发环境配置 # 开发环境配置
server: server:
# 服务器的HTTP端口默认为8080 # 服务器的HTTP端口默认为8080
port: 8080 port: 8090
servlet: servlet:
# 应用的访问路径 # 应用的访问路径
context-path: / context-path: /

@ -34,17 +34,6 @@ public class BidInfoController extends BaseController
@Autowired @Autowired
private IBidInfoService bidInfoService; private IBidInfoService bidInfoService;
/* *//**
*
*//*
@PreAuthorize("@ss.hasPermi('bid:info:list')")
@GetMapping("/select")
public TableDataInfo select()
{
startPage();
List<BidInfo> list = bidInfoService.selectBidInfoList();
return getDataTable(list);
}*/
/** /**
* *
*/ */

@ -0,0 +1,104 @@
package com.ruoyi.bid.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.bid.domain.BidSite;
import com.ruoyi.bid.service.IBidSiteService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2025-12-09
*/
@RestController
@RequestMapping("/bid/site")
public class BidSiteController extends BaseController
{
@Autowired
private IBidSiteService bidSiteService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('bid:site:list')")
@GetMapping("/list")
public TableDataInfo list(BidSite bidSite)
{
startPage();
List<BidSite> list = bidSiteService.selectBidSiteList(bidSite);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('bid:site:export')")
@Log(title = "常用网站", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BidSite bidSite)
{
List<BidSite> list = bidSiteService.selectBidSiteList(bidSite);
ExcelUtil<BidSite> util = new ExcelUtil<BidSite>(BidSite.class);
util.exportExcel(response, list, "常用网站数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('bid:site:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(bidSiteService.selectBidSiteById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('bid:site:add')")
@Log(title = "常用网站", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BidSite bidSite)
{
return toAjax(bidSiteService.insertBidSite(bidSite));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('bid:site:edit')")
@Log(title = "常用网站", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BidSite bidSite)
{
return toAjax(bidSiteService.updateBidSite(bidSite));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('bid:site:remove')")
@Log(title = "常用网站", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(bidSiteService.deleteBidSiteByIds(ids));
}
}

@ -0,0 +1,83 @@
package com.ruoyi.bid.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* bid_site
*
* @author ruoyi
* @date 2025-12-09
*/
public class BidSite extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** ID */
private Long id;
/** 网站名称 */
@Excel(name = "网站名称")
private String siteName;
/** url */
@Excel(name = "url")
private String site;
/** 收藏(0否1是) */
@Excel(name = "收藏(0否1是)")
private String favorite;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setSiteName(String siteName)
{
this.siteName = siteName;
}
public String getSiteName()
{
return siteName;
}
public void setSite(String site)
{
this.site = site;
}
public String getSite()
{
return site;
}
public void setFavorite(String favorite)
{
this.favorite = favorite;
}
public String getFavorite()
{
return favorite;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("siteName", getSiteName())
.append("site", getSite())
.append("favorite", getFavorite())
.append("remark", getRemark())
.toString();
}
}

@ -0,0 +1,61 @@
package com.ruoyi.bid.mapper;
import java.util.List;
import com.ruoyi.bid.domain.BidSite;
/**
* Mapper
*
* @author ruoyi
* @date 2025-12-09
*/
public interface BidSiteMapper
{
/**
*
*
* @param id
* @return
*/
public BidSite selectBidSiteById(Long id);
/**
*
*
* @param bidSite
* @return
*/
public List<BidSite> selectBidSiteList(BidSite bidSite);
/**
*
*
* @param bidSite
* @return
*/
public int insertBidSite(BidSite bidSite);
/**
*
*
* @param bidSite
* @return
*/
public int updateBidSite(BidSite bidSite);
/**
*
*
* @param id
* @return
*/
public int deleteBidSiteById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteBidSiteByIds(Long[] ids);
}

@ -0,0 +1,61 @@
package com.ruoyi.bid.service;
import java.util.List;
import com.ruoyi.bid.domain.BidSite;
/**
* Service
*
* @author ruoyi
* @date 2025-12-09
*/
public interface IBidSiteService
{
/**
*
*
* @param id
* @return
*/
public BidSite selectBidSiteById(Long id);
/**
*
*
* @param bidSite
* @return
*/
public List<BidSite> selectBidSiteList(BidSite bidSite);
/**
*
*
* @param bidSite
* @return
*/
public int insertBidSite(BidSite bidSite);
/**
*
*
* @param bidSite
* @return
*/
public int updateBidSite(BidSite bidSite);
/**
*
*
* @param ids
* @return
*/
public int deleteBidSiteByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteBidSiteById(Long id);
}

@ -0,0 +1,93 @@
package com.ruoyi.bid.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.bid.mapper.BidSiteMapper;
import com.ruoyi.bid.domain.BidSite;
import com.ruoyi.bid.service.IBidSiteService;
/**
* Service
*
* @author ruoyi
* @date 2025-12-09
*/
@Service
public class BidSiteServiceImpl implements IBidSiteService
{
@Autowired
private BidSiteMapper bidSiteMapper;
/**
*
*
* @param id
* @return
*/
@Override
public BidSite selectBidSiteById(Long id)
{
return bidSiteMapper.selectBidSiteById(id);
}
/**
*
*
* @param bidSite
* @return
*/
@Override
public List<BidSite> selectBidSiteList(BidSite bidSite)
{
return bidSiteMapper.selectBidSiteList(bidSite);
}
/**
*
*
* @param bidSite
* @return
*/
@Override
public int insertBidSite(BidSite bidSite)
{
return bidSiteMapper.insertBidSite(bidSite);
}
/**
*
*
* @param bidSite
* @return
*/
@Override
public int updateBidSite(BidSite bidSite)
{
return bidSiteMapper.updateBidSite(bidSite);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteBidSiteByIds(Long[] ids)
{
return bidSiteMapper.deleteBidSiteByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteBidSiteById(Long id)
{
return bidSiteMapper.deleteBidSiteById(id);
}
}

@ -17,6 +17,7 @@ import java.util.List;
public class BidSystemMVP { public class BidSystemMVP {
// ================= 配置区域 ================= // ================= 配置区域 =================
// 1. 正向关键词(只要包含这些,就是商机) // 1. 正向关键词(只要包含这些,就是商机)
private static final List<String> POSITIVE_KEYWORDS = Arrays.asList("系统", "平台", "软件", "信息化", "大数据"); private static final List<String> POSITIVE_KEYWORDS = Arrays.asList("系统", "平台", "软件", "信息化", "大数据");

@ -13,11 +13,11 @@ import java.util.regex.Pattern;
* - 仿 * - 仿
* -> -> -> * -> -> ->
*/ */
public final class BidSystemMVP3 { public class BidSystemMVP3 {
// ================= 配置区域 ================= // ================= 配置区域 =================
// 目标日期:实际使用时改成 LocalDate.now().format(...) // 目标日期:实际使用时改成 LocalDate.now().format(...)
// 这里写死 20251208 是为了配合您刚才看到的真实数据 // 这里写死 20251208 是为了配合您刚才看到的真实数据
private static final String TARGET_DATE_STR = "20251208"; private static final String TARGET_DATE_STR = "20251209";
// 基础 URL 模板 (注意 %s 占位符) // 基础 URL 模板 (注意 %s 占位符)
private static final String BASE_URL = "http://www.ccgp.gov.cn/cggg/zygg/index%s.htm"; private static final String BASE_URL = "http://www.ccgp.gov.cn/cggg/zygg/index%s.htm";
@ -25,7 +25,7 @@ public final class BidSystemMVP3 {
// 正则表达式:用于从 URL 中提取日期 (匹配 t20251208 这种格式) // 正则表达式:用于从 URL 中提取日期 (匹配 t20251208 这种格式)
private static final Pattern DATE_PATTERN = Pattern.compile("t(\\d{8})_"); private static final Pattern DATE_PATTERN = Pattern.compile("t(\\d{8})_");
public List<BidInfo> getBidInfos(String url, Date nowDate){ public static List<BidInfo> getBidInfos(String url, Date nowDate){
List<BidInfo> bidInfos = new ArrayList<>(); List<BidInfo> bidInfos = new ArrayList<>();
System.out.println("========== 系统启动:智能时间翻页模式 =========="); System.out.println("========== 系统启动:智能时间翻页模式 ==========");
@ -103,6 +103,7 @@ public final class BidSystemMVP3 {
info.setLink(href); info.setLink(href);
info.setTitle(title); info.setTitle(title);
info.setSourceSite(currentUrl); info.setSourceSite(currentUrl);
bidInfos.add(info);
} }
} else if (urlDate.compareTo(TARGET_DATE_STR) < 0) { } else if (urlDate.compareTo(TARGET_DATE_STR) < 0) {
// B. 比今天小 (是以前的) -> 触发熔断 // B. 比今天小 (是以前的) -> 触发熔断
@ -140,117 +141,10 @@ public final class BidSystemMVP3 {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
return null; return bidInfos;
} }
public static void main(String[] args) {
System.out.println("========== 系统启动:智能时间翻页模式 ==========");
System.out.println("目标日期:" + TARGET_DATE_STR);
try (Playwright playwright = Playwright.create()) {
// 启动浏览器
Browser browser = playwright.chromium().launch(new BrowserType.LaunchOptions()
.setChannel("chrome") // 如果报错改成 "msedge"
.setHeadless(false)
.setSlowMo(500));
Page page = browser.newPage();
int pageNum = 0; // 0 代表第一页(index.htm), 1 代表第二页(index_1.htm)
boolean keepRunning = true;
int totalCount = 0;
while (keepRunning) {
// 1. 构造当前页 URL
String currentUrl;
if (pageNum == 0) {
currentUrl = String.format(BASE_URL, ""); // 第一页
} else {
currentUrl = String.format(BASE_URL, "_" + pageNum); // index_1.htm
}
System.out.println("\n>> [第 " + (pageNum + 1) + " 页] 正在访问: " + currentUrl);
try {
page.navigate(currentUrl);
// 智能等待,不再死等 5 秒,而是等内容加载
page.waitForLoadState();
// 稍微缓冲一下,防止反爬
page.waitForTimeout(2000);
} catch (Exception e) {
System.err.println(" 页面访问失败,停止翻页。");
break;
}
// 2. 扫描本页所有链接
Locator links = page.locator("a");
int count = links.count();
int todayCountInThisPage = 0; // 统计这一页有多少今天的
for (int i = 0; i < count; i++) {
Locator item = links.nth(i);
if (!item.isVisible()) continue;
String href = item.getAttribute("href");
String title = item.innerText().trim();
// 过滤无效链接
if (href == null || title.length() < 5) continue;
// --- 核心:从 URL 提取日期 ---
// 链接长这样:./zbgg/202512/t20251208_25880773.htm
Matcher matcher = DATE_PATTERN.matcher(href);
if (matcher.find()) {
String urlDate = matcher.group(1); // 提取出 20251208
// 逻辑判定
if (urlDate.equals(TARGET_DATE_STR)) {
// A. 是今天的 -> 进一步关键词筛选
if (shouldSave(title)) {
System.out.println("[★ 收录] " + title);
System.out.println(" 日期: " + urlDate + " | 链接: " + fixLink(href));
totalCount++;
todayCountInThisPage++;
}
} else if (urlDate.compareTo(TARGET_DATE_STR) < 0) {
// B. 比今天小 (是以前的) -> 触发熔断
// 注意:有时候置顶公告可能是旧的,所以我们不能遇到一个旧的就立刻停
// 策略:如果这一页大部分都是旧的,或者连续遇到旧的,才停。
// 这里为了简单,我们打印出来观察一下
// System.out.println(" [旧闻] " + urlDate + " - " + title);
}
}
}
// 3. 翻页决策
if (todayCountInThisPage == 0 && pageNum > 0) {
// 如果这一页一条今天的数据都没有(且不是第一页),说明已经翻到旧数据区了
System.out.println(">> 本页无今日数据,触发【时间熔断】,停止抓取!");
keepRunning = false;
} else {
System.out.println(">> 本页分析完毕,准备翻下一页...");
pageNum++;
// 安全锁:防止无限翻页 (最多翻20页)
if (pageNum > 20) {
System.out.println(">> 达到最大页数限制,停止。");
keepRunning = false;
}
}
}
System.out.println("\n========== 采集结束 ==========");
System.out.println("共捕获今日 (" + TARGET_DATE_STR + ") 商机: " + totalCount + " 条");
// 停留 5 秒后关闭
page.waitForTimeout(5000);
} catch (Exception e) {
e.printStackTrace();
}
}
// 关键词筛选 // 关键词筛选
private static boolean shouldSave(String title) { private static boolean shouldSave(String title) {

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.bid.mapper.BidSiteMapper">
<resultMap type="BidSite" id="BidSiteResult">
<result property="id" column="id" />
<result property="siteName" column="site_name" />
<result property="site" column="site" />
<result property="favorite" column="favorite" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectBidSiteVo">
select id, site_name, site, favorite, remark from bid_site
</sql>
<select id="selectBidSiteList" parameterType="BidSite" resultMap="BidSiteResult">
<include refid="selectBidSiteVo"/>
<where>
<if test="siteName != null and siteName != ''"> and site_name like concat('%', #{siteName}, '%')</if>
<if test="site != null and site != ''"> and site = #{site}</if>
<if test="favorite != null and favorite != ''"> and favorite = #{favorite}</if>
</where>
</select>
<select id="selectBidSiteById" parameterType="Long" resultMap="BidSiteResult">
<include refid="selectBidSiteVo"/>
where id = #{id}
</select>
<insert id="insertBidSite" parameterType="BidSite" useGeneratedKeys="true" keyProperty="id">
insert into bid_site
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="siteName != null">site_name,</if>
<if test="site != null">site,</if>
<if test="favorite != null">favorite,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="siteName != null">#{siteName},</if>
<if test="site != null">#{site},</if>
<if test="favorite != null">#{favorite},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateBidSite" parameterType="BidSite">
update bid_site
<trim prefix="SET" suffixOverrides=",">
<if test="siteName != null">site_name = #{siteName},</if>
<if test="site != null">site = #{site},</if>
<if test="favorite != null">favorite = #{favorite},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteBidSiteById" parameterType="Long">
delete from bid_site where id = #{id}
</delete>
<delete id="deleteBidSiteByIds" parameterType="String">
delete from bid_site where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询常用网站列表
export function listSite(query) {
return request({
url: '/bid/site/list',
method: 'get',
params: query
})
}
// 查询常用网站详细
export function getSite(id) {
return request({
url: '/bid/site/' + id,
method: 'get'
})
}
// 新增常用网站
export function addSite(data) {
return request({
url: '/bid/site',
method: 'post',
data: data
})
}
// 修改常用网站
export function updateSite(data) {
return request({
url: '/bid/site',
method: 'put',
data: data
})
}
// 删除常用网站
export function delSite(id) {
return request({
url: '/bid/site/' + id,
method: 'delete'
})
}

@ -0,0 +1,278 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="网站名称" prop="siteName">
<el-input
v-model="queryParams.siteName"
placeholder="请输入网站名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="url" prop="site">
<el-input
v-model="queryParams.site"
placeholder="请输入url"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="收藏(0否1是)" prop="favorite">
<el-input
v-model="queryParams.favorite"
placeholder="请输入收藏(0否1是)"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['bid:site:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['bid:site:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['bid:site:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['bid:site:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="siteList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="ID" align="center" prop="id" />
<el-table-column label="网站名称" align="center" prop="siteName" />
<el-table-column label="url" align="center" prop="site" />
<el-table-column label="收藏(0否1是)" align="center" prop="favorite" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['bid:site:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['bid:site:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改常用网站对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="网站名称" prop="siteName">
<el-input v-model="form.siteName" placeholder="请输入网站名称" />
</el-form-item>
<el-form-item label="url" prop="site">
<el-input v-model="form.site" placeholder="请输入url" />
</el-form-item>
<el-form-item label="收藏(0否1是)" prop="favorite">
<el-input v-model="form.favorite" placeholder="请输入收藏(0否1是)" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listSite, getSite, delSite, addSite, updateSite } from "@/api/bid/site"
export default {
name: "Site",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
siteList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
siteName: null,
site: null,
favorite: null,
},
//
form: {},
//
rules: {
}
}
},
created() {
this.getList()
},
methods: {
/** 查询常用网站列表 */
getList() {
this.loading = true
listSite(this.queryParams).then(response => {
this.siteList = response.rows
this.total = response.total
this.loading = false
})
},
//
cancel() {
this.open = false
this.reset()
},
//
reset() {
this.form = {
id: null,
siteName: null,
site: null,
favorite: null,
remark: null
}
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm")
this.handleQuery()
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = "添加常用网站"
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const id = row.id || this.ids
getSite(id).then(response => {
this.form = response.data
this.open = true
this.title = "修改常用网站"
})
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateSite(this.form).then(response => {
this.$modal.msgSuccess("修改成功")
this.open = false
this.getList()
})
} else {
addSite(this.form).then(response => {
this.$modal.msgSuccess("新增成功")
this.open = false
this.getList()
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids
this.$modal.confirm('是否确认删除常用网站编号为"' + ids + '"的数据项?').then(function() {
return delSite(ids)
}).then(() => {
this.getList()
this.$modal.msgSuccess("删除成功")
}).catch(() => {})
},
/** 导出按钮操作 */
handleExport() {
this.download('bid/site/export', {
...this.queryParams
}, `site_${new Date().getTime()}.xlsx`)
}
}
}
</script>

@ -0,0 +1,336 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="标题" prop="title">
<el-input
v-model="queryParams.title"
placeholder="请输入标题"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="链接" prop="link">
<el-input
v-model="queryParams.link"
placeholder="请输入链接"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="发布日期" prop="fbDate">
<el-date-picker clearable
v-model="queryParams.fbDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择发布日期">
</el-date-picker>
</el-form-item>
<el-form-item label="来源站点" prop="sourceSite">
<el-input
v-model="queryParams.sourceSite"
placeholder="请输入来源站点"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="省份" prop="province">
<el-input
v-model="queryParams.province"
placeholder="请输入省份"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="预估金额,正则提取" prop="estimatedAmount">
<el-input
v-model="queryParams.estimatedAmount"
placeholder="请输入预估金额,正则提取"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['bid:info:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['bid:info:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['bid:info:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['bid:info:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="infoList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="ID" align="center" prop="id" />
<el-table-column label="标题" align="center" prop="title" />
<el-table-column label="链接" align="center" prop="link" />
<el-table-column label="发布日期" align="center" prop="fbDate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.fbDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="来源站点" align="center" prop="sourceSite" />
<el-table-column label="省份" align="center" prop="province" />
<el-table-column label="客户类型:教育/医疗/政府" align="center" prop="customerType" />
<el-table-column label="预估金额,正则提取" align="center" prop="estimatedAmount" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['bid:info:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['bid:info:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改招标信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="标题" prop="title">
<el-input v-model="form.title" placeholder="请输入标题" />
</el-form-item>
<el-form-item label="链接" prop="link">
<el-input v-model="form.link" placeholder="请输入链接" />
</el-form-item>
<el-form-item label="发布日期" prop="fbDate">
<el-date-picker clearable
v-model="form.fbDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择发布日期">
</el-date-picker>
</el-form-item>
<el-form-item label="来源站点" prop="sourceSite">
<el-input v-model="form.sourceSite" placeholder="请输入来源站点" />
</el-form-item>
<el-form-item label="省份" prop="province">
<el-input v-model="form.province" placeholder="请输入省份" />
</el-form-item>
<el-form-item label="预估金额,正则提取" prop="estimatedAmount">
<el-input v-model="form.estimatedAmount" placeholder="请输入预估金额,正则提取" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listInfo, getInfo, delInfo, addInfo, updateInfo } from "@/api/bid/info"
export default {
name: "Info",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
infoList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
title: null,
link: null,
fbDate: null,
sourceSite: null,
province: null,
customerType: null,
estimatedAmount: null,
},
//
form: {},
//
rules: {
}
}
},
created() {
this.getList()
},
methods: {
/** 查询招标信息列表 */
getList() {
this.loading = true
listInfo(this.queryParams).then(response => {
this.infoList = response.rows
this.total = response.total
this.loading = false
})
},
//
cancel() {
this.open = false
this.reset()
},
//
reset() {
this.form = {
id: null,
title: null,
link: null,
fbDate: null,
sourceSite: null,
province: null,
customerType: null,
estimatedAmount: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null
}
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm")
this.handleQuery()
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = "添加招标信息"
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const id = row.id || this.ids
getInfo(id).then(response => {
this.form = response.data
this.open = true
this.title = "修改招标信息"
})
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateInfo(this.form).then(response => {
this.$modal.msgSuccess("修改成功")
this.open = false
this.getList()
})
} else {
addInfo(this.form).then(response => {
this.$modal.msgSuccess("新增成功")
this.open = false
this.getList()
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids
this.$modal.confirm('是否确认删除招标信息编号为"' + ids + '"的数据项?').then(function() {
return delInfo(ids)
}).then(() => {
this.getList()
this.$modal.msgSuccess("删除成功")
}).catch(() => {})
},
/** 导出按钮操作 */
handleExport() {
this.download('bid/info/export', {
...this.queryParams
}, `info_${new Date().getTime()}.xlsx`)
}
}
}
</script>
Loading…
Cancel
Save