statement-consume.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="日期" prop="date">
  5. <el-date-picker clearable
  6. v-model="queryParams.date"
  7. type="date"
  8. value-format="yyyy-MM-dd"
  9. placeholder="请选择日期">
  10. </el-date-picker>
  11. </el-form-item>
  12. <el-form-item>
  13. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  14. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  15. </el-form-item>
  16. </el-form>
  17. <el-row :gutter="10" class="mb8">
  18. <!-- <el-col :span="1.5">-->
  19. <!-- <el-button-->
  20. <!-- type="primary"-->
  21. <!-- plain-->
  22. <!-- icon="el-icon-plus"-->
  23. <!-- size="mini"-->
  24. <!-- @click="handleAdd"-->
  25. <!-- v-hasPermi="['ems:EmsEcoD:add']"-->
  26. <!-- >新增</el-button>-->
  27. <!-- </el-col>-->
  28. <!-- <el-col :span="1.5">-->
  29. <!-- <el-button-->
  30. <!-- type="success"-->
  31. <!-- plain-->
  32. <!-- icon="el-icon-edit"-->
  33. <!-- size="mini"-->
  34. <!-- :disabled="single"-->
  35. <!-- @click="handleUpdate"-->
  36. <!-- v-hasPermi="['ems:EmsEcoD:edit']"-->
  37. <!-- >修改</el-button>-->
  38. <!-- </el-col>-->
  39. <!-- <el-col :span="1.5">-->
  40. <!-- <el-button-->
  41. <!-- type="danger"-->
  42. <!-- plain-->
  43. <!-- icon="el-icon-delete"-->
  44. <!-- size="mini"-->
  45. <!-- :disabled="multiple"-->
  46. <!-- @click="handleDelete"-->
  47. <!-- v-hasPermi="['ems:EmsEcoD:remove']"-->
  48. <!-- >删除</el-button>-->
  49. <!-- </el-col>-->
  50. <!-- <el-col :span="1.5">-->
  51. <!-- <el-button-->
  52. <!-- type="warning"-->
  53. <!-- plain-->
  54. <!-- icon="el-icon-download"-->
  55. <!-- size="mini"-->
  56. <!-- @click="handleExport"-->
  57. <!-- v-hasPermi="['ems:EmsEcoD:export']"-->
  58. <!-- >导出</el-button>-->
  59. <!-- </el-col>-->
  60. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  61. </el-row>
  62. <el-table v-loading="loading" :data="pvConsumeHList">
  63. <el-table-column label="对象名称" align="center" prop="objName"/>
  64. <el-table-column label="日期" align="center" prop="date" width="180">
  65. <template slot-scope="scope">
  66. <span>{{ parseTime(scope.row.date, '{y}-{m}-{d}') }}</span>
  67. </template>
  68. </el-table-column>
  69. <el-table-column label="时间" align="center" prop="time">
  70. <template slot-scope="scope">
  71. <span>{{ scope.row.time }}</span>
  72. </template>
  73. </el-table-column>
  74. <el-table-column label="视在功率(kW)" align="center" prop="s"/>
  75. <el-table-column label="有功功率(kW)" align="center" prop="p"/>
  76. <el-table-column label="无功功率(kW)" align="center" prop="q"/>
  77. </el-table>
  78. <pagination
  79. v-show="total>0"
  80. :total="total"
  81. :page.sync="queryParams.pageNum"
  82. :limit.sync="queryParams.pageSize"
  83. @pagination="getList"
  84. />
  85. <!-- 添加或修改节能计量日对话框 -->
  86. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  87. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  88. <el-form-item label="园区代码" prop="areaCode">
  89. <el-input v-model="form.areaCode" placeholder="请输入园区代码"/>
  90. </el-form-item>
  91. <el-form-item label="日期" prop="date">
  92. <el-date-picker clearable
  93. v-model="form.date"
  94. type="date"
  95. value-format="yyyy-MM-dd"
  96. placeholder="请选择日期">
  97. </el-date-picker>
  98. </el-form-item>
  99. <el-form-item label="节电(千瓦时)" prop="elecEcoQuantity">
  100. <el-input v-model="form.elecEcoQuantity" placeholder="请输入节电"/>
  101. </el-form-item>
  102. <el-form-item label="节电金额(元)" prop="elecEcoCost">
  103. <el-input v-model="form.elecEcoCost" placeholder="请输入节电金额"/>
  104. </el-form-item>
  105. <el-form-item label="节水量 (吨)" prop="waterEcoQuantity">
  106. <el-input v-model="form.waterEcoQuantity" placeholder="请输入节水量 "/>
  107. </el-form-item>
  108. <el-form-item label="节水金额(元)" prop="waterEcoCost">
  109. <el-input v-model="form.waterEcoCost" placeholder="请输入节水金额"/>
  110. </el-form-item>
  111. </el-form>
  112. <div slot="footer" class="dialog-footer">
  113. <el-button type="primary" @click="submitForm">确 定</el-button>
  114. <el-button @click="cancel">取 消</el-button>
  115. </div>
  116. </el-dialog>
  117. </div>
  118. </template>
  119. <script>
  120. import {addEmsEcoD, delEmsEcoD, getEmsEcoD, updateEmsEcoD} from "@/api/ems/EmsEcoD";
  121. import {getPowerData} from "@/api/mgr/elecUseH";
  122. import {parseTime} from "@/utils/ruoyi";
  123. export default {
  124. name: "EmsEcoD",
  125. data() {
  126. return {
  127. // 遮罩层
  128. loading: true,
  129. // 选中数组
  130. ids: [],
  131. // 非单个禁用
  132. single: true,
  133. // 非多个禁用
  134. multiple: true,
  135. // 显示搜索条件
  136. showSearch: true,
  137. // 总条数
  138. total: 0,
  139. // 节能计量日表格数据
  140. EmsEcoDList: [],
  141. pvConsumeHList: [],
  142. // 弹出层标题
  143. title: "",
  144. // 是否显示弹出层
  145. open: false,
  146. // 查询参数
  147. queryParams: {
  148. pageNum: 1,
  149. pageSize: 10,
  150. areaCode: null,
  151. date: parseTime(new Date(), '{y}-{m}-{d}'),
  152. },
  153. // 表单参数
  154. form: {},
  155. // 表单校验
  156. rules: {
  157. areaCode: [
  158. {required: true, message: "园区代码不能为空", trigger: "blur"}
  159. ],
  160. date: [
  161. {required: true, message: "日期不能为空", trigger: "blur"}
  162. ],
  163. }
  164. };
  165. },
  166. created() {
  167. this.getList();
  168. },
  169. methods: {
  170. /** 查询节能计量日列表 */
  171. getList() {
  172. this.loading = true;
  173. getPowerData(this.queryParams).then(response => {
  174. this.pvConsumeHList = response.rows
  175. this.total = response.total
  176. this.loading = false
  177. })
  178. },
  179. // 取消按钮
  180. cancel() {
  181. this.open = false;
  182. this.reset();
  183. },
  184. // 表单重置
  185. reset() {
  186. this.form = {
  187. id: null,
  188. areaCode: null,
  189. date: null
  190. };
  191. this.resetForm("form");
  192. },
  193. /** 搜索按钮操作 */
  194. handleQuery() {
  195. this.queryParams.pageNum = 1;
  196. this.getList();
  197. },
  198. /** 重置按钮操作 */
  199. resetQuery() {
  200. this.resetForm("queryForm");
  201. this.handleQuery();
  202. },
  203. // 多选框选中数据
  204. handleSelectionChange(selection) {
  205. this.ids = selection.map(item => item.id)
  206. this.single = selection.length !== 1
  207. this.multiple = !selection.length
  208. },
  209. /** 新增按钮操作 */
  210. handleAdd() {
  211. this.reset();
  212. this.open = true;
  213. this.title = "添加节能计量日";
  214. },
  215. /** 修改按钮操作 */
  216. handleUpdate(row) {
  217. this.reset();
  218. const id = row.id || this.ids
  219. getEmsEcoD(id).then(response => {
  220. this.form = response.data;
  221. this.open = true;
  222. this.title = "修改节能计量日";
  223. });
  224. },
  225. /** 提交按钮 */
  226. submitForm() {
  227. this.$refs["form"].validate(valid => {
  228. if (valid) {
  229. if (this.form.id != null) {
  230. updateEmsEcoD(this.form).then(response => {
  231. this.$modal.msgSuccess("修改成功");
  232. this.open = false;
  233. this.getList();
  234. });
  235. } else {
  236. addEmsEcoD(this.form).then(response => {
  237. this.$modal.msgSuccess("新增成功");
  238. this.open = false;
  239. this.getList();
  240. });
  241. }
  242. }
  243. });
  244. },
  245. /** 删除按钮操作 */
  246. handleDelete(row) {
  247. const ids = row.id || this.ids;
  248. this.$modal.confirm('是否确认删除节能计量日编号为"' + ids + '"的数据项?').then(function () {
  249. return delEmsEcoD(ids);
  250. }).then(() => {
  251. this.getList();
  252. this.$modal.msgSuccess("删除成功");
  253. }).catch(() => {
  254. });
  255. },
  256. /** 导出按钮操作 */
  257. handleExport() {
  258. this.download('ems/EmsEcoD/export', {
  259. ...this.queryParams
  260. }, `EmsEcoD_${new Date().getTime()}.xlsx`)
  261. }
  262. }
  263. };
  264. </script>