|
@@ -33,14 +33,14 @@
|
|
|
<!-- 日期表 -->
|
|
|
<div class="dataForm" style="margin-right: 20px">
|
|
|
<el-date-picker
|
|
|
- v-model="value1"
|
|
|
+ v-model="serach_month"
|
|
|
type="month"
|
|
|
placeholder="2023-08"
|
|
|
>
|
|
|
</el-date-picker>
|
|
|
</div>
|
|
|
<!-- 按钮 -->
|
|
|
- <el-button @click="searchBtn" style="background-color: rgb(40, 155, 209); color: black">查询</el-button>
|
|
|
+ <el-button @click="searchBtn(company_ids, serach_month)" style="background-color: rgb(40, 155, 209); color: black">查询</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 表格 -->
|
|
@@ -165,122 +165,83 @@
|
|
|
|
|
|
<script>
|
|
|
import axios from "axios";
|
|
|
+import { rccztabledataInfo } from "../../servuces/prove";
|
|
|
+import { nowmonthy } from "../../servuces/getnowtime";
|
|
|
+import { column } from "../../store/tuozhuai";
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
-
|
|
|
currentTime: "",
|
|
|
company_ids: [],
|
|
|
//表格各类属性
|
|
|
tableData: [],
|
|
|
+ tableDatahj: [],
|
|
|
//下拉框内属性
|
|
|
options: [],
|
|
|
//日期表属性
|
|
|
- pickerOptions: {
|
|
|
- shortcuts: [
|
|
|
-
|
|
|
- {
|
|
|
- text: "最近一个月",
|
|
|
- onClick(picker) {
|
|
|
- const end = new Date();
|
|
|
- const start = new Date();
|
|
|
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
|
|
|
- picker.$emit("pick", [start, end]);
|
|
|
- },
|
|
|
- },
|
|
|
-
|
|
|
- ],
|
|
|
- },
|
|
|
- value1: [("2023-08-01")],
|
|
|
+ serach_month: '',
|
|
|
};
|
|
|
},
|
|
|
- computed: {
|
|
|
- Riqi : function getNowFormatDate() {
|
|
|
- let date = new Date(),
|
|
|
- year = date.getFullYear(), //获取完整的年份(4位)
|
|
|
- month = date.getMonth() + 1, //获取当前月份(0-11,0代表1月)
|
|
|
- strDate = date.getDate(); // 获取当前日(1-31)
|
|
|
- if (month < 10) month = `0${month}`; // 如果月份是个位数,在前面补0
|
|
|
- if (strDate < 10) strDate = `0${strDate}`; // 如果日是个位数,在前面补0
|
|
|
+ created () {
|
|
|
+ const data = sessionStorage.getItem('company_data');
|
|
|
+ if (data) {
|
|
|
+ this.options = JSON.parse(data)
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
- return `${year}-${month}`;
|
|
|
- }
|
|
|
- },
|
|
|
mounted() {
|
|
|
- this.updateTime(); //时间
|
|
|
- this.getTableDate(); //开始获取表格
|
|
|
- this.getSelectDate(); //下拉框接口数据
|
|
|
- console.log(this.Riqi);
|
|
|
- this.value1 =this.Riqi;
|
|
|
+ column(this);
|
|
|
+ this.updateTime();
|
|
|
+ this.getTableData(); //开始获取表格
|
|
|
},
|
|
|
beforeDestroy() {
|
|
|
// 在组件销毁前清除定时器,避免内存泄漏
|
|
|
clearInterval(this.timer);
|
|
|
},
|
|
|
methods: {
|
|
|
-
|
|
|
//表格接口数据
|
|
|
- getTableDate() {
|
|
|
- axios
|
|
|
- .get("http://192.168.2.55:8022/plugins/lhyt/shjy_detail", {
|
|
|
- params: {
|
|
|
- company_ids: this.company_ids.join(),
|
|
|
- search_month: this.Riqi,
|
|
|
- }
|
|
|
- })
|
|
|
- .then((res) => {
|
|
|
- console.log("--------", res.data.data);
|
|
|
- this.tableData = res.data.data;
|
|
|
- });
|
|
|
- },
|
|
|
- //下拉框数据
|
|
|
- getSelectDate() {
|
|
|
- axios
|
|
|
- .get("http://192.168.2.55:8022/plugins/lhyt/get_companies")
|
|
|
- .then((ret) => {
|
|
|
- this.options = ret.data.data;
|
|
|
- });
|
|
|
- },
|
|
|
- //更新时间
|
|
|
- updateTime() {
|
|
|
- // 在组件挂载结束时启动定时器,每秒更新一次时间
|
|
|
- this.currentTime = this.getCurrentTime();
|
|
|
- //每秒更新一次
|
|
|
- this.timer = setInterval(() => {
|
|
|
- this.currentTime = this.getCurrentTime();
|
|
|
- }, 1000);
|
|
|
- },
|
|
|
- getCurrentTime() {
|
|
|
- const now = new Date();
|
|
|
- const year = now.getFullYear();
|
|
|
- const month = String(now.getMonth() + 1).padStart(2, "0");
|
|
|
- const day = String(now.getDate()).padStart(2, "0");
|
|
|
- const hours = String(now.getHours()).padStart(2, "0");
|
|
|
- const minutes = String(now.getMinutes()).padStart(2, "0");
|
|
|
- const seconds = String(now.getSeconds()).padStart(2, "0");
|
|
|
- return `${year}.${month}.${day} ${hours}:${minutes}:${seconds}`;
|
|
|
- },
|
|
|
- resetDateFilter() {
|
|
|
- this.$refs.filterTable.clearFilter("date");
|
|
|
- },
|
|
|
- clearFilter() {
|
|
|
- this.$refs.filterTable.clearFilter();
|
|
|
- },
|
|
|
- formatter(row, column) {
|
|
|
- return row.address;
|
|
|
- },
|
|
|
- filterTag(value, row) {
|
|
|
- return row.tag === value;
|
|
|
- },
|
|
|
- filterHandler(value, row, column) {
|
|
|
- const property = column["property"];
|
|
|
- return row[property] === value;
|
|
|
- },
|
|
|
- //查询
|
|
|
- searchBtn() {
|
|
|
- this.getTableDate()
|
|
|
-
|
|
|
- }
|
|
|
+ getTableData () {
|
|
|
+ this.serach_month = nowmonthy;
|
|
|
+ rccztabledataInfo({ "company_ids": '', "search_month": nowmonthy}).then(res => {
|
|
|
+ this.tableData = res.data;
|
|
|
+ this.tableDatahj = res.footer
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //查询
|
|
|
+ searchBtn(value, value1) {
|
|
|
+ const company_ids = value.join(',');
|
|
|
+ const date = new Date(value1);
|
|
|
+ // 获取年份和月份
|
|
|
+ const year = date.getFullYear();
|
|
|
+ const month = date.getMonth() + 1; // 月份从0开始,需要加1
|
|
|
+
|
|
|
+ // 将年份和月份拼接成所需形式的字符串
|
|
|
+ const serach_date = `${year}-${month}`;
|
|
|
+ rccztabledataInfo({ "company_ids": company_ids, "search_month": serach_date}).then(res => {
|
|
|
+ this.tableData = res.data;
|
|
|
+ this.tableDatahj = res.footer
|
|
|
+
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //更新时间
|
|
|
+ updateTime() {
|
|
|
+ // 在组件挂载结束时启动定时器,每秒更新一次时间
|
|
|
+ this.currentTime = this.getCurrentTime();
|
|
|
+ //每秒更新一次
|
|
|
+ this.timer = setInterval(() => {
|
|
|
+ this.currentTime = this.getCurrentTime();
|
|
|
+ }, 1000);
|
|
|
+ },
|
|
|
+ getCurrentTime() {
|
|
|
+ const now = new Date();
|
|
|
+ const year = now.getFullYear();
|
|
|
+ const month = String(now.getMonth() + 1).padStart(2, "0");
|
|
|
+ const day = String(now.getDate()).padStart(2, "0");
|
|
|
+ const hours = String(now.getHours()).padStart(2, "0");
|
|
|
+ const minutes = String(now.getMinutes()).padStart(2, "0");
|
|
|
+ const seconds = String(now.getSeconds()).padStart(2, "0");
|
|
|
+ return `${year}.${month}.${day} ${hours}:${minutes}:${seconds}`;
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|