dl_site_system/dl_vue/src/views/statistics/inquiryItem/index.vue

305 lines
8.9 KiB
Vue
Raw Normal View History

2025-07-14 16:19:21 +08:00
<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="name">
<el-input
v-model="queryParams.name"
placeholder="请输入姓名"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="来源国家" prop="national">
<el-input
v-model="queryParams.national"
placeholder="请输入来源国家"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="洲" prop="oceania">
<el-input
v-model="queryParams.oceania"
placeholder="请输入洲"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="时间范围" prop="dataRange">
<el-date-picker
v-model="queryParams.dataRange"
type="daterange"
align="right"
unlink-panels
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
:picker-options="pickerOptions"
>
</el-date-picker>
</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="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['busi:inquiryItem:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="inquiryItemList" @selection-change="handleSelectionChange">
<el-table-column type="index" width="60" label="序号" align="center"/>
<el-table-column v-if="columnSet.company" label="公司名称" align="center" prop="companyName" />
<el-table-column v-if="columnSet.name" label="姓名" align="center" prop="name" />
<el-table-column v-if="columnSet.tel" label="电话" align="center" prop="tel" />
<el-table-column v-if="columnSet.title" label="标题" align="center" prop="title" />
<el-table-column v-if="columnSet.email" label="电子邮件" align="center" prop="email" />
<el-table-column label="内容" align="center" prop="content" />
<el-table-column label="IP" align="center" prop="ip" />
<el-table-column label="来源国家" align="center" prop="national" />
<el-table-column label="洲" align="center" prop="oceania" />
<el-table-column label="提交时间" align="center" prop="createTime"/>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import { listInquiryItem, getInquiryItem, delInquiryItem, addInquiryItem, updateInquiryItem,getInquirySet } from "@/api/busi/inquiryItem";
export default {
name: "InquiryItem",
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 在线询盘记录表格数据
inquiryItemList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
dataRange: '',
startDate: '',
endDate: '',
companyName: null,
name: null,
tel: null,
title: null,
content: null,
email: null,
ip: null,
national: null,
oceania: null,
pageUrl: null,
tenantId: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
},
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])
}
}]
},
columnSet:{
company:false,
email:false,
name:false,
tel:false,
title:false,
}
};
},
created() {
this.getList();
},
methods: {
/** 查询在线询盘记录列表 */
getList() {
this.loading = true;
//先查动态表头
getInquirySet({}).then(rep=>{
this.columnSet = rep.data
listInquiryItem(this.queryParams).then(response => {
this.inquiryItemList = response.data.records;
this.total = response.data.total;
this.loading = false;
});
})
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
companyName: null,
name: null,
tel: null,
title: null,
content: null,
email: null,
ip: null,
national: null,
oceania: null,
pageUrl: null,
tenantId: null,
creator: null,
createTime: null,
updater: null,
updateTime: null,
delFlag: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
if (this.queryParams.dataRange && this.queryParams.dataRange.length > 1) {
this.queryParams.startDate = this.formatDate(this.queryParams.dataRange[0])
this.queryParams.endDate = this.formatDate(this.queryParams.dataRange[1])
}else{
this.queryParams.startDate = null
this.queryParams.endDate = null
}
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
getInquiryItem(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) {
updateInquiryItem(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addInquiryItem(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 delInquiryItem(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('busi/inquiryItem/export', {
...this.queryParams
}, `inquiryItem_${new Date().getTime()}.xlsx`)
2025-08-07 18:16:27 +08:00
},
/**
* 格式化时间戳
*/
formatDate(timestamp) {
const date = new Date(timestamp)
const year = date.getFullYear()
// 月份是从0开始的所以要加1
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
return `${year}-${month}-${day}`
},
2025-07-14 16:19:21 +08:00
}
};
</script>