|
@@ -1,13 +1,11 @@
|
|
|
<template>
|
|
|
- <div :class="className" :style="{ height: '100%', width: width }">
|
|
|
+ <div
|
|
|
+ :class="className"
|
|
|
+ :style="{ height: '100%', width: width, padding: '15px' }"
|
|
|
+ >
|
|
|
<div class="select-container">
|
|
|
<el-form
|
|
|
- style="
|
|
|
- display: grid;
|
|
|
- grid-template-columns: 1fr 1fr 1fr;
|
|
|
- align-items: center;
|
|
|
- grid-gap: 5px;
|
|
|
- "
|
|
|
+ style="display: grid; grid-template-columns: 1fr 1fr 1fr; grid-gap: 5px"
|
|
|
label-width="100px"
|
|
|
>
|
|
|
<el-form-item label="评估指标">
|
|
@@ -23,7 +21,7 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="行业">
|
|
|
- <el-select
|
|
|
+ <el-select
|
|
|
v-model="matchForm.industry"
|
|
|
style="width: 100%"
|
|
|
filterable
|
|
@@ -38,7 +36,7 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="企业分类">
|
|
|
- <el-select
|
|
|
+ <el-select
|
|
|
v-model="matchForm.companyType"
|
|
|
style="width: 100%"
|
|
|
clearable
|
|
@@ -52,14 +50,16 @@
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="相差值阈值"></el-form-item>
|
|
|
+ <el-form-item label="相差值阈值">
|
|
|
+ <el-input
|
|
|
+ v-model="matchForm.threshold"
|
|
|
+ placeholder="请输入内容"
|
|
|
+ style="width: 100%"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
<!-- 用电:月度;用气:年度;用人:季度 -->
|
|
|
<el-form-item label="年度">
|
|
|
- <el-select
|
|
|
- v-model="matchForm.year"
|
|
|
- style="width: 100%"
|
|
|
- filterable
|
|
|
- >
|
|
|
+ <el-select v-model="matchForm.year" style="width: 100%" filterable>
|
|
|
<el-option
|
|
|
v-for="key in yearsOptions"
|
|
|
:key="key"
|
|
@@ -69,10 +69,103 @@
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="月度"></el-form-item>
|
|
|
- <el-form-item label="季度"></el-form-item>
|
|
|
+ <el-form-item label="月度" v-if="matchForm.dataKey === 'powerConsume'">
|
|
|
+ <div style="display: flex; gap: 5px">
|
|
|
+ <el-select v-model="matchForm.elecStartMonth" filterable>
|
|
|
+ <el-option
|
|
|
+ v-for="key in monthOptions"
|
|
|
+ :key="key"
|
|
|
+ :label="key"
|
|
|
+ :value="key"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ <span>-</span>
|
|
|
+ <el-select v-model="matchForm.elecEndMonth" filterable>
|
|
|
+ <el-option
|
|
|
+ v-for="key in monthOptions"
|
|
|
+ :key="key"
|
|
|
+ :label="key"
|
|
|
+ :value="key"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ label="季度"
|
|
|
+ v-if="matchForm.dataKey === 'employeeNumber'"
|
|
|
+ >
|
|
|
+ <div style="display: flex; gap: 5px">
|
|
|
+ <el-select v-model="matchForm.manStartSeason" filterable>
|
|
|
+ <el-option
|
|
|
+ v-for="key in seasonOptions"
|
|
|
+ :key="key"
|
|
|
+ :label="key"
|
|
|
+ :value="key"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ <span>-</span>
|
|
|
+ <el-select v-model="matchForm.manEndSeason" filterable>
|
|
|
+ <el-option
|
|
|
+ v-for="key in seasonOptions"
|
|
|
+ :key="key"
|
|
|
+ :label="key"
|
|
|
+ :value="key"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-search"
|
|
|
+ @click="submit"
|
|
|
+ size="mini"
|
|
|
+ >搜索</el-button
|
|
|
+ >
|
|
|
+ </el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
+ <el-table :data="tableData" border>\
|
|
|
+ code: "2422"
|
|
|
+ enterpriseName: "企业1"
|
|
|
+ location: "A"
|
|
|
+ trueThreshold: -0.24883973894126177
|
|
|
+ typeName: "A"
|
|
|
+ typeNum: "1"
|
|
|
+ <el-table-column prop="enterpriseName" label="企业名称" sortable></el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="location"
|
|
|
+ label="坐落地"
|
|
|
+ width="200" sortable
|
|
|
+ ></el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="code"
|
|
|
+ label="行业代码"
|
|
|
+ width="200"
|
|
|
+ ></el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="typeName"
|
|
|
+ label="企业分类"
|
|
|
+ width="200"
|
|
|
+ ></el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="trueThreshold"
|
|
|
+ label="相差值"
|
|
|
+ width="200" sortable
|
|
|
+ ></el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <el-pagination
|
|
|
+ v-show="total > 0"
|
|
|
+ :total="total"
|
|
|
+ :page.sync="matchForm.pageNum"
|
|
|
+ :limit.sync="matchForm.pageSize"
|
|
|
+ @pagination="submit"
|
|
|
+ >
|
|
|
+ </el-pagination>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
@@ -97,10 +190,14 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ total: 0,
|
|
|
matchForm: {
|
|
|
- dataKey: "funding", //评估指标
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ dataKey: "powerConsume", //评估指标
|
|
|
industry: "", //行业
|
|
|
companyType: "", //企业分类
|
|
|
+ threshold: null, //相差值阈值
|
|
|
// 用电
|
|
|
year: "", //年度 (用电和用人都用这个年度)
|
|
|
elecStartMonth: "", //起始月
|
|
@@ -109,14 +206,7 @@ export default {
|
|
|
manStartSeason: "", //起始季度
|
|
|
manEndSeason: "", //结束季度
|
|
|
},
|
|
|
- dataKeys: [
|
|
|
- "funding",
|
|
|
- "energyConsume",
|
|
|
- "paidTax",
|
|
|
- "taxableIncome",
|
|
|
- "totalIndustrialValue",
|
|
|
- "powerConsume",
|
|
|
- ], // 可选项
|
|
|
+ dataKeys: ["powerConsume", "energyConsume", "employeeNumber"], // 可选项
|
|
|
keyToChinese: {
|
|
|
landArea: "用地面积",
|
|
|
totalIndustrialValue: "工业总产值",
|
|
@@ -135,9 +225,10 @@ export default {
|
|
|
monthMap: new Map(),
|
|
|
yearsOptions: [],
|
|
|
enterTypeList: [],
|
|
|
- enterTypeList:[],
|
|
|
+ enterTypeList: [],
|
|
|
industryData: [],
|
|
|
industryMap: new Map(),
|
|
|
+ tableData: [],
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
@@ -231,6 +322,114 @@ export default {
|
|
|
const item = this.enterTypeList.find((element) => element.number === num);
|
|
|
return item ? item.name : null;
|
|
|
},
|
|
|
+ submit() {
|
|
|
+ // 清除无关字段
|
|
|
+ this.clearUnrelatedFields();
|
|
|
+ // 必填项校验
|
|
|
+ if (this.validateForm()) {
|
|
|
+ // this.$message.success("提交成功");
|
|
|
+ // console.log(this.matchForm);
|
|
|
+ analysisMatch(this.matchForm).then(res=>{
|
|
|
+ // console.log(res,"test")
|
|
|
+ if(res && res?.rows){
|
|
|
+ this.total = res.total;
|
|
|
+ this.tableData = res.rows.map(item => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ trueThreshold: parseFloat(item.trueThreshold).toFixed(4) // 转换并保留4位小数
|
|
|
+ };
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ clearUnrelatedFields() {
|
|
|
+ const { dataKey } = this.matchForm;
|
|
|
+ if (dataKey === "powerConsume") {
|
|
|
+ this.matchForm.manStartSeason = "";
|
|
|
+ this.matchForm.manEndSeason = "";
|
|
|
+ } else if (dataKey === "employeeNumber") {
|
|
|
+ this.matchForm.elecStartMonth = "";
|
|
|
+ this.matchForm.elecEndMonth = "";
|
|
|
+ } else if (dataKey === "energyConsume") {
|
|
|
+ this.matchForm.manStartSeason = "";
|
|
|
+ this.matchForm.manEndSeason = "";
|
|
|
+ this.matchForm.elecStartMonth = "";
|
|
|
+ this.matchForm.elecEndMonth = "";
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ validateForm() {
|
|
|
+ const { matchForm } = this;
|
|
|
+
|
|
|
+ // 行业校验
|
|
|
+ if (!matchForm.industry) {
|
|
|
+ this.$message.error("请选择行业");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 阈值校验
|
|
|
+ const threshold = parseFloat(matchForm.threshold);
|
|
|
+ if (isNaN(threshold)) {
|
|
|
+ this.$message.error("请填写有效的相差值阈值");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ matchForm.threshold = threshold; // 转换为数字
|
|
|
+
|
|
|
+ // 年度必填校验
|
|
|
+ if (!matchForm.year) {
|
|
|
+ this.$message.error("请选择年度");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 针对 powerConsume 的校验
|
|
|
+ if (matchForm.dataKey === "powerConsume") {
|
|
|
+ if (!matchForm.elecStartMonth) {
|
|
|
+ this.$message.error("请选择起始月度");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (!matchForm.elecEndMonth) {
|
|
|
+ this.$message.error("请选择结束月度");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (matchForm.elecStartMonth > matchForm.elecEndMonth) {
|
|
|
+ this.$message.error("起始月度必须小于等于结束月度");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 针对 employeeNumber 的校验
|
|
|
+ if (matchForm.dataKey === "employeeNumber") {
|
|
|
+ if (!matchForm.manStartSeason) {
|
|
|
+ this.$message.error("请选择起始季度");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (!matchForm.manEndSeason) {
|
|
|
+ this.$message.error("请选择结束季度");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (matchForm.manStartSeason > matchForm.manEndSeason) {
|
|
|
+ this.$message.error("起始季度必须小于等于结束季度");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return true; // 所有校验通过
|
|
|
+ },
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ seasonOptions() {
|
|
|
+ const options = this.matchForm.year
|
|
|
+ ? this.seasonMap.get(this.matchForm.year)
|
|
|
+ : [];
|
|
|
+ return options || []; // 以防得到 undefined
|
|
|
+ },
|
|
|
+ monthOptions() {
|
|
|
+ const options = this.matchForm.year
|
|
|
+ ? this.monthMap.get(this.matchForm.year)
|
|
|
+ : [];
|
|
|
+ return options || []; // 以防得到 undefined
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|