|
@@ -16,14 +16,16 @@
|
|
|
<el-select
|
|
|
style="margin-right: 8px"
|
|
|
size="mini"
|
|
|
- v-model="value"
|
|
|
+ v-model="workUnit"
|
|
|
placeholder="请选择"
|
|
|
+ clearable
|
|
|
>
|
|
|
+ <el-option label="全部" value=""> </el-option>
|
|
|
<el-option
|
|
|
- v-for="item in options"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value"
|
|
|
+ v-for="item in workUnitOptions"
|
|
|
+ :key="item.organAbbr"
|
|
|
+ :label="item.organAbbr"
|
|
|
+ :value="item.organAbbr"
|
|
|
>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
@@ -106,7 +108,11 @@ import UpdateOnExternalRisksTable from "./components/update-on-external-risks-ta
|
|
|
import WeeklyPlanSituationTable from "./components/weekly-plan-situation-table.vue";
|
|
|
import WeeklyViolationSituationTable from "./components/weekly-violation-situation-table.vue";
|
|
|
import moment from "moment";
|
|
|
-import { getReportWeek } from "@/api/secure/daily-newspaper";
|
|
|
+import {
|
|
|
+ getReportWeek,
|
|
|
+ getWorkUnitList,
|
|
|
+ weekExport,
|
|
|
+} from "@/api/secure/daily-newspaper";
|
|
|
export default {
|
|
|
components: {
|
|
|
Level3AbovePlansTable,
|
|
@@ -130,17 +136,8 @@ export default {
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
},
|
|
|
- value: "",
|
|
|
- options: [
|
|
|
- {
|
|
|
- value: "选项1",
|
|
|
- label: "黄金糕",
|
|
|
- },
|
|
|
- {
|
|
|
- value: "选项2",
|
|
|
- label: "双皮奶",
|
|
|
- },
|
|
|
- ],
|
|
|
+ workUnit: "", // 作业单位
|
|
|
+ workUnitOptions: [],
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -151,10 +148,15 @@ export default {
|
|
|
mounted() {
|
|
|
// 设置默认为最近的一周
|
|
|
this.setRecentWeek();
|
|
|
+ this.getWorkUnit();
|
|
|
this.handleQuery();
|
|
|
},
|
|
|
methods: {
|
|
|
moment,
|
|
|
+ async getWorkUnit() {
|
|
|
+ const { data } = await getWorkUnitList();
|
|
|
+ this.workUnitOptions = data;
|
|
|
+ },
|
|
|
setRecentWeek() {
|
|
|
const today = new Date();
|
|
|
const diffDays = today.getDay() === 0 ? -6 : 1 - today.getDay(); // 调整到周一作为一周的开始
|
|
@@ -186,6 +188,7 @@ export default {
|
|
|
},
|
|
|
/** 重置按钮操作 */
|
|
|
resetQuery() {
|
|
|
+ this.workUnit = "";
|
|
|
// 设置默认为最近的一周
|
|
|
this.setRecentWeek();
|
|
|
this.handleQuery();
|
|
@@ -210,7 +213,21 @@ export default {
|
|
|
const day = String(date.getDate()).padStart(2, "0");
|
|
|
return `${year}${month}${day}`;
|
|
|
},
|
|
|
- onExport() {},
|
|
|
+ async onExport() {
|
|
|
+ const res = await weekExport(this.startDate, this.endDate);
|
|
|
+ if (res) {
|
|
|
+ const elink = document.createElement("a");
|
|
|
+ elink.download = `周报-${this.startDate}_${this.endDate}.xls`;
|
|
|
+ elink.style.display = "none";
|
|
|
+ const blob = new Blob([res], { type: "application/x-msdownload" });
|
|
|
+ elink.href = URL.createObjectURL(blob);
|
|
|
+ document.body.appendChild(elink);
|
|
|
+ elink.click();
|
|
|
+ document.body.removeChild(elink);
|
|
|
+ } else {
|
|
|
+ this.$message.error("导出异常请联系管理员");
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|