|
@@ -3,116 +3,59 @@
|
|
|
<div class="condition">
|
|
|
<el-form :inline="true" :model="formInline" class="demo-form-inline">
|
|
|
<el-form-item label="单位名称:">
|
|
|
- <el-input
|
|
|
- v-model="formInline.user"
|
|
|
- placeholder="请输入单位名称"
|
|
|
- size="small"
|
|
|
- ></el-input>
|
|
|
+ <el-input v-model="formInline.companyName" placeholder="请输入单位名称" size="small"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="状态:">
|
|
|
- <el-select
|
|
|
- v-model="formInline.region"
|
|
|
- placeholder="选择状态"
|
|
|
- size="small "
|
|
|
- >
|
|
|
+ <el-select v-model="formInline.state" placeholder="选择状态" size="small ">
|
|
|
<el-option label="启用" value="1"></el-option>
|
|
|
- <el-option label="停用" value="2"></el-option>
|
|
|
+ <el-option label="停用" value="0"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
- <el-button type="primary" @click="onSubmit" size="small"
|
|
|
- >查询</el-button
|
|
|
- >
|
|
|
+ <el-button type="primary" @click="onSubmit" size="small">查询</el-button>
|
|
|
<el-button @click="reset" size="small">重置</el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
<div class="list-page">
|
|
|
<div class="newly">
|
|
|
- <el-button type="primary" @click="newnuedialog" size="small"
|
|
|
- >新增</el-button
|
|
|
- >
|
|
|
+ <el-button type="primary" @click="newnuedialog" size="small">新增</el-button>
|
|
|
</div>
|
|
|
|
|
|
- <el-table
|
|
|
- class="center-align-table"
|
|
|
- :data="tableData"
|
|
|
- border
|
|
|
- :cell-style="rowStyle"
|
|
|
- stripe
|
|
|
- row-key="id"
|
|
|
- default-expand-all
|
|
|
- :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
|
|
- >
|
|
|
+ <el-table class="center-align-table" :data="tableData" border :cell-style="rowStyle" stripe row-key="id"
|
|
|
+ default-expand-all :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
|
|
|
<!-- Table Columns -->
|
|
|
- <el-table-column fixed prop="name" align="center" label="单位名称">
|
|
|
+ <el-table-column fixed prop="codeName" align="center" label="单位名称">
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="" align="center" label="单位ID">
|
|
|
+ <el-table-column prop="cityId" align="center" label="单位ID">
|
|
|
</el-table-column>
|
|
|
|
|
|
- <el-table-column prop="abnormal" label="风场数量" width="80">
|
|
|
+ <el-table-column prop="" label="风场数量" width="80">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button
|
|
|
- v-if="scope.row.abnormal == 1"
|
|
|
- @click="particulars(scope.row)"
|
|
|
- type="text"
|
|
|
- size="small"
|
|
|
- >10</el-button
|
|
|
- >
|
|
|
- <span v-else>/</span>
|
|
|
+ <el-button @click="particulars(scope.row)" type="text" size="small"></el-button>
|
|
|
+
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
- <el-table-column prop="" align="center" label="状态" width="100">
|
|
|
+ <el-table-column prop="state" align="center" label="状态" width="100">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ {{ row.state === 0 ? '启用' : '停用' }}
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="" align="center" label="转换时间">
|
|
|
</el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="transition"
|
|
|
- align="center"
|
|
|
- fixed="right"
|
|
|
- label="操作"
|
|
|
- width="200"
|
|
|
- >
|
|
|
+ <el-table-column prop="state" align="center" fixed="right" label="操作" width="200">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button @click="compile(scope.row)" type="text" size="small"
|
|
|
- >编辑</el-button
|
|
|
- >
|
|
|
- <el-button @click="newcomer(scope.row)" type="text" size="small"
|
|
|
- >新增</el-button
|
|
|
- >
|
|
|
- <el-button
|
|
|
- v-if="scope.row.transition == 1"
|
|
|
- @click="start(scope.row)"
|
|
|
- type="text"
|
|
|
- size="small"
|
|
|
- >启用</el-button
|
|
|
- >
|
|
|
- <el-button
|
|
|
- v-else
|
|
|
- style="color: #666"
|
|
|
- @click="stop(scope.row)"
|
|
|
- type="text"
|
|
|
- size="small"
|
|
|
- >停用</el-button
|
|
|
- >
|
|
|
- <el-button
|
|
|
- style="color: #f00"
|
|
|
- @click="deleted(scope.row)"
|
|
|
- type="text"
|
|
|
- size="small"
|
|
|
- >删除</el-button
|
|
|
- >
|
|
|
+ <el-button @click="compile(scope.row)" type="text" size="small">编辑</el-button>
|
|
|
+ <el-button @click="newcomer(scope.row)" type="text" size="small">新增</el-button>
|
|
|
+ <el-button v-if="scope.row.state == 1" @click="start(scope.row, 1)" type="text" size="small">启用</el-button>
|
|
|
+ <el-button v-else style="color: #666" @click="start(scope.row, 0)" type="text" size="small">停用</el-button>
|
|
|
+ <el-button style="color: #f00" @click="deleted(scope.row)" type="text" size="small">删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
<div class="pagination-container">
|
|
|
- <el-pagination
|
|
|
- :page-size="10"
|
|
|
- :pager-count="11"
|
|
|
- layout="total, prev, pager, next"
|
|
|
- :total="35"
|
|
|
- >
|
|
|
+ <el-pagination :page-size="10" :pager-count="11" layout="total, prev, pager, next" :total="35">
|
|
|
</el-pagination>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -122,14 +65,10 @@
|
|
|
<el-dialog :title="title" :visible.sync="nuedialog" width="380px">
|
|
|
<el-form ref="newform" :rules="rules" :model="newform" label-width="90px">
|
|
|
<el-form-item label="单位名称:" prop="unit">
|
|
|
- <el-input v-model="newform.unit" size="small"></el-input>
|
|
|
+ <el-input v-model="newform.companyName" size="small"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="所属省:" prop="province">
|
|
|
- <el-select
|
|
|
- v-model="newform.province"
|
|
|
- placeholder="请选择"
|
|
|
- size="small"
|
|
|
- >
|
|
|
+ <el-select v-model="newform.province" placeholder="请选择" size="small">
|
|
|
<el-option label="区域一" value="shanghai"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
@@ -139,11 +78,7 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="备注:">
|
|
|
- <el-input
|
|
|
- v-model="newform.name"
|
|
|
- size="small"
|
|
|
- type="textarea"
|
|
|
- ></el-input>
|
|
|
+ <el-input v-model="newform.name" size="small" type="textarea"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
@@ -154,13 +89,7 @@
|
|
|
|
|
|
<!-- 风场数量 -->
|
|
|
<el-dialog title="风场数量" :visible.sync="unusualdialog" width="1000px">
|
|
|
- <el-table
|
|
|
- class="center-align-table"
|
|
|
- :data="tableData"
|
|
|
- border
|
|
|
- :cell-style="rowStyle"
|
|
|
- stripe
|
|
|
- >
|
|
|
+ <el-table class="center-align-table" :data="tableData" border :cell-style="rowStyle" stripe>
|
|
|
<!-- Table Columns -->
|
|
|
<el-table-column fixed prop="name" align="center" label="风场名称">
|
|
|
</el-table-column>
|
|
@@ -179,12 +108,7 @@
|
|
|
</el-table>
|
|
|
|
|
|
<div class="pagination-container">
|
|
|
- <el-pagination
|
|
|
- :page-size="10"
|
|
|
- :pager-count="11"
|
|
|
- layout="total, prev, pager, next"
|
|
|
- :total="35"
|
|
|
- >
|
|
|
+ <el-pagination :page-size="10" :pager-count="11" layout="total, prev, pager, next" :total="35">
|
|
|
</el-pagination>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
@@ -192,52 +116,45 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { getAllWindCompany, addCompany, updateStateCompany } from "@/api/ledger.js";
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ // 查询
|
|
|
+ formInline: {
|
|
|
+ companyName: "",
|
|
|
+ state: "",
|
|
|
+ },
|
|
|
+ // 新增
|
|
|
+ newform: {
|
|
|
+ cityId: "",
|
|
|
+ cityName: "",
|
|
|
+ companyName: "",
|
|
|
+ described: "",
|
|
|
+ parentCode: "",
|
|
|
+ provinceId: "",
|
|
|
+ provinceName: ""
|
|
|
+ },
|
|
|
+
|
|
|
rules: {
|
|
|
unit: [{ required: true, message: "请填写单位名称", trigger: "blur" }],
|
|
|
province: [{ required: true, message: "请选择省", trigger: "change" }],
|
|
|
city: [{ required: true, message: "请选择省", trigger: "change" }],
|
|
|
},
|
|
|
- formInline: {
|
|
|
- user: "",
|
|
|
- region: "",
|
|
|
- },
|
|
|
- tableData: [
|
|
|
- {
|
|
|
- id: 1,
|
|
|
- name: "王小虎",
|
|
|
- transition: "1",
|
|
|
- },
|
|
|
- {
|
|
|
- id: 3,
|
|
|
- name: "王小虎",
|
|
|
- abnormal: "1",
|
|
|
- transition: "0",
|
|
|
- children: [
|
|
|
- {
|
|
|
- id: 31,
|
|
|
|
|
|
- name: "王小虎",
|
|
|
+ tableData: [
|
|
|
|
|
|
- abnormal: "1",
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
],
|
|
|
nuedialog: false,
|
|
|
unusualdialog: false,
|
|
|
- newform: {
|
|
|
- unit: "",
|
|
|
- province: "",
|
|
|
- city: "",
|
|
|
- descr: "",
|
|
|
- },
|
|
|
+
|
|
|
title: "新增",
|
|
|
warningShown: false,
|
|
|
};
|
|
|
},
|
|
|
+ created() {
|
|
|
+ this.onSubmit()
|
|
|
+ },
|
|
|
methods: {
|
|
|
rowStyle() {
|
|
|
return "text-align:center";
|
|
@@ -245,15 +162,62 @@ export default {
|
|
|
|
|
|
// 查询
|
|
|
onSubmit() {
|
|
|
- console.log("submit!");
|
|
|
+ let objectval = {
|
|
|
+ companyName: this.formInline.companyName,
|
|
|
+ state: this.formInline.state,
|
|
|
+ }
|
|
|
+ getAllWindCompany(objectval).then((res) => {
|
|
|
+ this.tableData = res.data
|
|
|
+ });
|
|
|
},
|
|
|
// 重置
|
|
|
reset() {
|
|
|
- this.formInline.user = "";
|
|
|
- this.formInline.region = "";
|
|
|
+ this.formInline.companyName = ""
|
|
|
+ this.formInline.state = ""
|
|
|
+ getAllWindCompany({
|
|
|
+ companyName: "",
|
|
|
+ state: ""
|
|
|
+ }).then((res) => {
|
|
|
+ this.tableData = res.data
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ // 启用/停用
|
|
|
+ start(row, type) {
|
|
|
+ let objectval = {
|
|
|
+ companyCode: row.companyCode,
|
|
|
+ state: type === 1 ? 0 : 1,
|
|
|
+ }
|
|
|
+ updateStateCompany(objectval).then((res) => {
|
|
|
+ this.$message({
|
|
|
+ message: '状态已更新成功',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ // this.$message(`${type === 1 ? '状态已更新成功' : '状态已更新成功'}`);
|
|
|
+ row.state = type === 1 ? 0 : 1
|
|
|
+ this.onSubmit()
|
|
|
+ })
|
|
|
},
|
|
|
- // 新增
|
|
|
+
|
|
|
+ // 新增触发
|
|
|
+ newnuedialog() {
|
|
|
+ this.nuedialog = true;
|
|
|
+ this.title = "新增";
|
|
|
+ },
|
|
|
+ // 新增提交
|
|
|
newly() {
|
|
|
+ let objectval = {
|
|
|
+ cityId: this.formInline.companyName,
|
|
|
+ cityName: this.formInline.state,
|
|
|
+ companyName: this.a,
|
|
|
+ described: this.a,
|
|
|
+ parentCode: this.a,
|
|
|
+ provinceId: this.a,
|
|
|
+ provinceName: this.a,
|
|
|
+ }
|
|
|
+ addCompany(objectval).then((res) => {
|
|
|
+
|
|
|
+ })
|
|
|
this.nuedialog = false;
|
|
|
},
|
|
|
|
|
@@ -271,10 +235,8 @@ export default {
|
|
|
this.nuedialog = true;
|
|
|
this.title = "新增";
|
|
|
},
|
|
|
- // 启用
|
|
|
- start(row) {},
|
|
|
- // 停用
|
|
|
- stop(row) {},
|
|
|
+
|
|
|
+
|
|
|
// 删除
|
|
|
deleted(row) {
|
|
|
if (row.transition === "0") {
|
|
@@ -309,10 +271,7 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
|
|
|
- newnuedialog() {
|
|
|
- this.nuedialog = true;
|
|
|
- this.title = "新增";
|
|
|
- },
|
|
|
+
|
|
|
},
|
|
|
};
|
|
|
</script>
|