master
parent
ac04bb5952
commit
86cc6e3212
@ -0,0 +1,34 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
export function index(params) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/admin/url_check/index',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export function save(data) {
|
||||
return request({
|
||||
url: '/api/admin/url_check/save',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function show(params) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/admin/url_check/show',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function destroy(params) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/admin/url_check/destroy',
|
||||
params
|
||||
})
|
||||
}
|
||||
@ -0,0 +1,247 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- 编辑-->
|
||||
<xy-dialog :is-show.sync="isShow" title="网站编辑" type="form" :form="detail" :rules="rules" @submit="editor"
|
||||
ref="addActivity">
|
||||
|
||||
<template v-slot:name>
|
||||
<div class="xy-table-item">
|
||||
<div class="xy-table-item-label">
|
||||
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>网站名称
|
||||
</div>
|
||||
<div class="xy-table-item-content">
|
||||
<el-input clearable placeholder="请填写网站名称" v-model="detail.name" style="width: 300px;" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-slot:url>
|
||||
<div class="xy-table-item">
|
||||
<div class="xy-table-item-label">
|
||||
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>网址
|
||||
</div>
|
||||
<div class="xy-table-item-content">
|
||||
<el-input clearable placeholder="请输入网址" v-model="detail.url" style="width: 300px;" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<template v-slot:datetimerange>
|
||||
<div class="xy-table-item">
|
||||
<div class="xy-table-item-label">
|
||||
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>时间范围
|
||||
</div>
|
||||
<div class="xy-table-item-content">
|
||||
<el-date-picker v-model="detail.datetimerange" type="datetimerange" :picker-options="pickerOptions"
|
||||
range-separator="至" value-format="yyyy-MM-dd HH:mm:ss" start-placeholder="开始日期" end-placeholder="结束日期"
|
||||
align="right">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
|
||||
<template v-slot:mobile>
|
||||
<div class="xy-table-item">
|
||||
<div class="xy-table-item-label">短信接收人
|
||||
</div>
|
||||
<div class="xy-table-item-content">
|
||||
<el-input type="textarea" clearable placeholder="请填写短信接收人手机号英文逗号隔开" v-model="detail.mobile" style="width: 300px;" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<template v-slot:status>
|
||||
<div class="xy-table-item">
|
||||
<div class="xy-table-item-label">状态
|
||||
</div>
|
||||
<div class="xy-table-item-content">
|
||||
<el-select clearable v-model="detail.status">
|
||||
<el-option :value="1" label="启用"></el-option>
|
||||
<el-option :value="0" label="禁用"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
</xy-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
save,
|
||||
show
|
||||
} from "@/api/other/url_check";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
|
||||
return {
|
||||
isShow: false,
|
||||
id: "",
|
||||
type: "add",
|
||||
pickerOptions: {
|
||||
shortcuts: [{
|
||||
text: '最近一周',
|
||||
onClick(picker) {
|
||||
const end = new Date();
|
||||
const start = new Date();
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
|
||||
picker.$emit('pick', [start, end]);
|
||||
}
|
||||
}, {
|
||||
text: '最近一个月',
|
||||
onClick(picker) {
|
||||
const end = new Date();
|
||||
const start = new Date();
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
|
||||
picker.$emit('pick', [start, end]);
|
||||
}
|
||||
}, {
|
||||
text: '最近三个月',
|
||||
onClick(picker) {
|
||||
const end = new Date();
|
||||
const start = new Date();
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
|
||||
picker.$emit('pick', [start, end]);
|
||||
}
|
||||
}]
|
||||
},
|
||||
action: `${process.env.VUE_APP_BASE_API}/api/admin/upload-file`,
|
||||
detail: {
|
||||
name: "",
|
||||
url: "",
|
||||
mobile: "",
|
||||
status: 1,
|
||||
start_time: "",
|
||||
end_time: "",
|
||||
datetimerange:[]
|
||||
},
|
||||
rules: {
|
||||
name: [{
|
||||
required: true,
|
||||
message: "网站名称必填"
|
||||
}],
|
||||
url: [{
|
||||
required: true,
|
||||
message: "网站的域名必填"
|
||||
}]
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
isShow(newVal) {
|
||||
if (newVal) {
|
||||
if (this.type === 'editor') {
|
||||
this.getDetail()
|
||||
}
|
||||
} else {
|
||||
this.id = ''
|
||||
this.type = ''
|
||||
this.$refs['addActivity'].reset()
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
async getDetail() {
|
||||
let res = await show({
|
||||
id: this.id
|
||||
})
|
||||
Object.assign(this.detail, res);
|
||||
this.detail.datetimerange.push(this.$moment(res.start_time).format("YYYY-MM-DD HH:mm:ss"));
|
||||
this.detail.datetimerange.push(this.$moment(res.end_time).format("YYYY-MM-DD HH:mm:ss"));
|
||||
|
||||
this.detail.mobile=res.mobile.join(',')
|
||||
this.detail.url=res.url.join(',')
|
||||
},
|
||||
editor() {
|
||||
this.detail.start_time = this.detail.datetimerange[0];
|
||||
this.detail.end_time = this.detail.datetimerange[1];
|
||||
this.detail.mobile=this.detail.mobile.split(',')
|
||||
this.detail.url=this.detail.url.split(',')
|
||||
save(this.detail).then(res => {
|
||||
this.isShow = false
|
||||
this.$Message.success("操作成功");
|
||||
this.$emit('refresh')
|
||||
})
|
||||
},
|
||||
|
||||
},
|
||||
computed: {
|
||||
|
||||
},
|
||||
mounted() {
|
||||
let that = this;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.contract-add-plan {
|
||||
min-height: 30px;
|
||||
border: 1px solid #dcdee2;
|
||||
border-radius: 4px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
align-content: center;
|
||||
|
||||
padding: 0 8px;
|
||||
|
||||
&-no-plan {
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
color: #CDD0D5;
|
||||
}
|
||||
}
|
||||
|
||||
.xy-table-item-label {
|
||||
width: 140px;
|
||||
}
|
||||
|
||||
.xy-table-item-price {
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
z-index: 1;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
content: '(元)'
|
||||
}
|
||||
|
||||
::v-deep .el-input__clear {
|
||||
position: relative;
|
||||
right: 30px;
|
||||
z-index: 2;
|
||||
}
|
||||
}
|
||||
|
||||
.xy-table-item-price-wan {
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
content: '(万元)'
|
||||
}
|
||||
|
||||
::v-deep .el-input__clear {
|
||||
position: relative;
|
||||
right: 46px;
|
||||
z-index: 2;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,172 @@
|
||||
<template>
|
||||
<div>
|
||||
<lx-header icon="md-apps" style="margin-bottom: 10px; border: 0px; margin-top: 15px" text="网站监测">
|
||||
<div slot="content"></div>
|
||||
<slot>
|
||||
<div class="selects">
|
||||
|
||||
<div>
|
||||
<span style="padding: 0 6px;word-break: keep-all;">
|
||||
关键字
|
||||
</span>
|
||||
<Input v-model="select.keyword" placeholder="请输入关键字" style="width: 180px"></Input>
|
||||
</div>
|
||||
|
||||
<Button style="margin-left: 10px" type="primary" @click="select={page:1,keyword:''}">重置
|
||||
</Button>
|
||||
<Button style="margin-left: 10px" type="primary" @click="doSearch">查询</Button>
|
||||
<Button style="margin-left: 10px" type="primary" @click="add">新增</Button>
|
||||
</div>
|
||||
</slot>
|
||||
</lx-header>
|
||||
|
||||
|
||||
<xy-table :list="list" :table-item="table" :total="total" @pageSizeChange="pageSizeChange" @pageIndexChange="pageChange">
|
||||
<template v-slot:btns>
|
||||
<el-table-column fixed="right" header-align="center" align="center" label="操作" width="300">
|
||||
<template slot-scope="scope">
|
||||
<div class="slot-btns">
|
||||
<Button type="primary" @click="edit(scope.row)">编辑</Button>
|
||||
<Button type="error" @click="deleteitem(scope.row)" style="margin-left: 10px;">删除</Button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
</xy-table>
|
||||
|
||||
<addSite ref="addActivity" @refresh="load()"></addSite>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
index,
|
||||
save,
|
||||
destroy,
|
||||
show
|
||||
} from "@/api/other/url_check";
|
||||
|
||||
import addSite from '@/views/other/components/addSite'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
addSite
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
select: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
keyword: '',
|
||||
},
|
||||
total: 0,
|
||||
list: [],
|
||||
table: [{
|
||||
prop: 'name',
|
||||
label: '网站名称',
|
||||
align: 'left',
|
||||
fixed: 'left',
|
||||
|
||||
},{
|
||||
prop: 'url',
|
||||
label: '网址',
|
||||
align: 'left',
|
||||
width: 280,
|
||||
fixed: 'left',
|
||||
|
||||
}, {
|
||||
prop: 'mobile',
|
||||
label: '短信接受人',
|
||||
align: 'left',
|
||||
width: 180,
|
||||
fixed: 'left',
|
||||
formatter: (v1, v2, value) => {
|
||||
return value.join(',');
|
||||
}
|
||||
|
||||
}, {
|
||||
prop: 'start_time',
|
||||
label: '项目开始时间',
|
||||
width: 180,
|
||||
align: 'center'
|
||||
|
||||
}, {
|
||||
prop: 'end_time',
|
||||
label: '项目结束时间',
|
||||
width: 180,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'created_at',
|
||||
label: '创建信息',
|
||||
width: 180,
|
||||
formatter: (v1, v2, value) => {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
doSearch() {
|
||||
this.select.page = 1;
|
||||
this.load();
|
||||
},
|
||||
add() {
|
||||
this.$refs['addActivity'].isShow = true
|
||||
},
|
||||
pageSizeChange(e) {
|
||||
this.select.page_size = e;
|
||||
this.select.page = 1;
|
||||
this.load();
|
||||
},
|
||||
async load() {
|
||||
const res = await index(this.select)
|
||||
this.total = res.total
|
||||
this.list = res.data
|
||||
},
|
||||
deleteitem(row) {
|
||||
destroy({
|
||||
id: row.id
|
||||
}).then(res => {
|
||||
this.load();
|
||||
this.$Message.success("操作成功");
|
||||
})
|
||||
},
|
||||
edit(row) {
|
||||
this.$refs['addActivity'].id = row.id;
|
||||
this.$refs['addActivity'].isShow = true;
|
||||
this.$refs['addActivity'].type = 'editor'
|
||||
},
|
||||
config(row){
|
||||
this.$refs['addActivityConfig'].id = row.id;
|
||||
this.$refs['addActivityConfig'].isShow = true;
|
||||
this.$refs['addActivityConfig'].type = 'editor'
|
||||
},
|
||||
pageChange(e) {
|
||||
this.select.page = e
|
||||
this.load()
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.load()
|
||||
},
|
||||
created() {
|
||||
let type = parseInt(this.$route.path.split("_")[1]);
|
||||
this.type = this.select.is_auth = type;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.selects {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
&>div {
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in new issue