generationPlan.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  1. <template>
  2. <div class="generationPlan">
  3. <div class="generationBtn">
  4. <p class="titleSty">发电计划管理</p>
  5. <div class="periodSeach">
  6. <div class="exceed">
  7. <span style="margin-top: 3px;">场站名称:</span>
  8. <el-select v-model="windTurbines" placeholder="请选择">
  9. <el-option
  10. v-for="item in windFramoptions"
  11. :key="item.no"
  12. :label="item.stationName"
  13. :value="item.no">
  14. </el-option>
  15. </el-select>
  16. </div>
  17. <el-button type="primary" style="margin-left: 10px;" v-on:click="getSeachData">搜索</el-button>
  18. <el-button style="margin-left: 10px;" @click="reset">重置</el-button>
  19. </div>
  20. <div style="display:flex;justify-content: space-between;padding: 10px;">
  21. <el-row :gutter="10" class="regionalBtn">
  22. <el-col :span="1.5">
  23. <el-button
  24. type="primary"
  25. plain
  26. icon="Plus"
  27. size="mini"
  28. @click="handleAdd"
  29. >新增</el-button>
  30. </el-col>
  31. <el-col :span="1.5">
  32. <el-button
  33. type="success"
  34. plain
  35. icon="Edit"
  36. size="mini"
  37. @click="handleUpdate"
  38. >修改</el-button>
  39. </el-col>
  40. <el-col :span="1.5">
  41. <el-button
  42. type="danger"
  43. plain
  44. icon="Delete"
  45. size="mini"
  46. @click="handleDelete"
  47. >删除</el-button>
  48. </el-col>
  49. <el-col :span="1.5">
  50. <el-button
  51. type="warning"
  52. plain
  53. icon="DocumentCopy"
  54. size="mini"
  55. @click="handleCopy"
  56. >复制</el-button>
  57. </el-col>
  58. </el-row>
  59. </div>
  60. <div class="windframTableData">
  61. <el-table :data="windframtableData" border style="width: 100%" @row-click="rowClick">
  62. <el-table-column label="操作" width="60" align="center">
  63. <template #default="scope">
  64. <el-radio v-model="windframradio" :label="scope.row"></el-radio>
  65. </template>
  66. </el-table-column>
  67. <el-table-column label="场站名称">
  68. <template #default="scope">
  69. <span>{{scope.row.windplantName ? scope.row.windplantName : scope.row.pvStationName}}</span>
  70. </template>
  71. </el-table-column>
  72. <el-table-column label="计划年月">
  73. <template #default="scope">
  74. <span>{{scope.row.year}}年</span>
  75. <span>{{scope.row.month}}月</span>
  76. </template>
  77. </el-table-column>
  78. <el-table-column label="计划发电量(Wkw/h)">
  79. <template #default="scope">
  80. <span>{{scope.row.generatingcapacity}}万千瓦时</span>
  81. </template>
  82. </el-table-column>
  83. </el-table>
  84. <el-pagination
  85. @size-change="handleSizeChange"
  86. @current-change="handleCurrentChange"
  87. :current-page="page.currentPage"
  88. :page-size="page.pagesize"
  89. layout="total, prev, pager, next, jumper"
  90. :total="page.total">
  91. </el-pagination>
  92. </div>
  93. </div>
  94. <el-dialog :title="title" v-model="dialogVisible" width="600px" :close-on-click-modal="false" @close="closeDialog">
  95. <div class="windframFrom">
  96. <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
  97. <el-form-item label="场站名称" prop="station">
  98. <el-select v-model="ruleForm.station" placeholder="请选择场站" @change="chooseStation">
  99. <el-option
  100. v-for="item in windFramoptions"
  101. :key="item.no"
  102. :label="item.stationName"
  103. :value="item.no">
  104. </el-option>
  105. </el-select>
  106. </el-form-item>
  107. <el-form-item label="期次名称" prop="project">
  108. <el-select v-model="ruleForm.project" placeholder="请选择期次" :disabled="!showProject">
  109. <el-option
  110. v-for="item in projectOptions"
  111. :key="item.projectNo"
  112. :label="item.projectName"
  113. :value="item.projectNo">
  114. </el-option>
  115. </el-select>
  116. </el-form-item>
  117. <el-form-item label="计划年月" prop="monthVal">
  118. <el-date-picker
  119. v-model="ruleForm.monthVal"
  120. type="month"
  121. value-format="yyyy-MM"
  122. placeholder="选择日期">
  123. </el-date-picker>
  124. </el-form-item>
  125. <el-form-item label="计划发电" prop="planElectric">
  126. <el-input type="number"
  127. v-model="ruleForm.planElectric"
  128. placeholder="请输入计划发电量"
  129. @keyup.native="ruleForm.planElectric = $utils.oninput(ruleForm.planElectric, 3, 'float')"></el-input>
  130. </el-form-item>
  131. </el-form>
  132. </div>
  133. <template #footer>
  134. <span class="dialog-footer">
  135. <el-button @click="resetForm" v-if="!single">重 置</el-button>
  136. <el-button @click="dialogVisible = false" v-else>取 消</el-button>
  137. <el-button type="primary" @click="submitForm('ruleForm')">确 定</el-button>
  138. </span>
  139. </template>
  140. </el-dialog>
  141. </div>
  142. </template>
  143. <script>
  144. import {apiGetWindplantprojectListByWindplantNo, apiGetgetProjectplanList, apiGetaddProjectplan, apiGetStation,
  145. apiGetupdateProjectplan, apiGetdeleteProjectplan} from '../../api/api'
  146. export default {
  147. name:'generationPlan',
  148. data() {
  149. return {
  150. title:'',
  151. windframtableData:[],
  152. windframradio: {},
  153. single: false,
  154. showProject: false,
  155. dialogVisible:false,
  156. windTurbines: '',
  157. windFramoptions:[],
  158. projectOptions: [],
  159. page:{
  160. pagesize: 12,
  161. currentPage: 1,
  162. total: 0
  163. },
  164. ruleForm: {
  165. station: '',
  166. project: '',
  167. monthVal: '',
  168. planElectric: ''
  169. },
  170. rules: {
  171. station: [
  172. { required: true, message: '请选择场站', trigger: 'change' }
  173. ],
  174. project: [
  175. { required: true, message: '请选择期次', trigger: 'change' }
  176. ],
  177. monthVal: [
  178. { required: true, message: '请选择日期', trigger: 'change' }
  179. ],
  180. planElectric: [
  181. { required: true, message: '请输入计划发电量', trigger: 'blur' }
  182. ],
  183. }
  184. }
  185. },
  186. mounted() {
  187. this.getProjectplanList()
  188. this.getWindFramData()
  189. },
  190. methods:{
  191. getSeachData() {
  192. this.page.currentPage = 1
  193. this.getProjectplanList('seach')
  194. },
  195. chooseStation(val) {
  196. this.getProjectData(val)
  197. },
  198. // 根据风场获取期次数据
  199. getProjectData(val) {
  200. let that = this
  201. let params = {
  202. stationNo: val
  203. }
  204. apiGetWindplantprojectListByWindplantNo(params).then(datas =>{
  205. if (datas && datas.data && datas.data.list) {
  206. that.showProject = true
  207. that.projectOptions = datas.data.list
  208. }
  209. })
  210. },
  211. reset() {
  212. this.windTurbines = ''
  213. this.page = {
  214. pagesize: 12,
  215. currentPage: 1,
  216. total: 0
  217. }
  218. this.getProjectplanList()
  219. },
  220. handleSizeChange(val){
  221. this.page.pagesize = val
  222. this.getProjectplanList('seach')
  223. },
  224. handleCurrentChange(val){
  225. this.page.currentPage =val
  226. this.getProjectplanList('seach')
  227. },
  228. closeDialog() {
  229. this.showProject = true
  230. this.$refs['ruleForm'].clearValidate()
  231. },
  232. submitForm(formName) {
  233. console.log('ruleForm====>>>>',this.ruleForm)
  234. this.$refs[formName].validate((valid) => {
  235. if (valid) {
  236. let that = this
  237. that.addOrUpdatewindframDate()
  238. }
  239. });
  240. },
  241. // 新增/修改风电场配置
  242. addOrUpdatewindframDate() {
  243. let that = this
  244. let params = {
  245. windpower: that.ruleForm.station,
  246. projectid: that.ruleForm.project,
  247. year: that.ruleForm.monthVal.substring(0, that.ruleForm.monthVal.indexOf('-')),
  248. month: that.ruleForm.monthVal.substring(that.ruleForm.monthVal.indexOf('-')+1, that.ruleForm.monthVal.length),
  249. generatingcapacity: that.ruleForm.planElectric
  250. }
  251. if (!that.single) {
  252. apiGetaddProjectplan(params).then(datas =>{
  253. that.changeshowData(datas)
  254. })
  255. } else {
  256. params.id = that.windframradio.id
  257. apiGetupdateProjectplan(params).then(datas =>{
  258. that.changeshowData(datas)
  259. })
  260. }
  261. },
  262. changeshowData(datas) {
  263. if (datas.msg === '操作成功') {
  264. this.dialogVisible = false
  265. if (!this.single) {
  266. this.$message({
  267. message: '发电计划信息新增成功',
  268. type: 'success'
  269. });
  270. } else {
  271. this.$message({
  272. message: '发电计划信息修改成功',
  273. type: 'success'
  274. });
  275. }
  276. this.single = false
  277. this.getProjectplanList('seach')
  278. }
  279. },
  280. resetForm() {
  281. this.ruleForm = {
  282. station: '',
  283. project: '',
  284. monthVal: '',
  285. planElectric: ''
  286. }
  287. },
  288. // 新增区域信息
  289. handleAdd() {
  290. this.dialogVisible = true
  291. this.single = false
  292. this.showProject = false
  293. this.title = '新增发电计划'
  294. this.ruleForm = {
  295. station: '',
  296. project: '',
  297. monthVal: '',
  298. planElectric: ''
  299. }
  300. this.$nextTick(() =>{
  301. this.resetForm()
  302. this.$refs['ruleForm'].clearValidate()
  303. })
  304. },
  305. // 获取风电场数据
  306. getWindFramData() {
  307. let that = this
  308. apiGetStation().then(datas =>{
  309. if (datas && datas.data && datas.data.list) {
  310. that.windFramoptions = datas.data.list
  311. // that.windTurbines = datas.data.list[0].no
  312. }
  313. })
  314. },
  315. // 复制区域信息
  316. handleCopy() {
  317. this.dialogVisible = true
  318. this.title = '复制发电计划'
  319. this.single = false
  320. this.showProject = true
  321. this.ruleForm = {
  322. station: this.windframradio.windpower,
  323. project: this.windframradio.projectid,
  324. monthVal: this.windframradio.year + '-' + this.windframradio.month,
  325. planElectric: this.windframradio.generatingcapacity
  326. }
  327. this.getProjectData(this.windframradio.windpower)
  328. },
  329. // 修改区域信息
  330. handleUpdate() {
  331. this.dialogVisible = true
  332. this.single = true
  333. this.showProject = true
  334. this.getProjectData(this.windframradio.windpower)
  335. this.title = '修改发电计划'
  336. this.ruleForm = {
  337. station: this.windframradio.windpower,
  338. project: this.windframradio.projectid,
  339. monthVal: this.windframradio.year + '-' + this.windframradio.month,
  340. planElectric: this.windframradio.generatingcapacity
  341. }
  342. },
  343. rowClick(row, column, event) {
  344. this.windframradio = row
  345. },
  346. // 删除区域信息
  347. handleDelete() {
  348. this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
  349. confirmButtonText: '确定',
  350. cancelButtonText: '取消',
  351. type: 'warning'
  352. }).then(() => {
  353. let that = this
  354. let params = {
  355. id: that.windframradio.id
  356. }
  357. apiGetdeleteProjectplan(params).then(datas =>{
  358. if (datas.msg === '操作成功') {
  359. that.getProjectplanList()
  360. }
  361. })
  362. if (that.windframtableData.length>0) {
  363. that.windframradio = that.windframtableData[0]
  364. }
  365. that.$message({
  366. type: 'success',
  367. message: '删除成功!'
  368. });
  369. })
  370. },
  371. //获取风电场列表数据
  372. getProjectplanList(type) {
  373. let that = this
  374. let params = {
  375. pageNum: that.page.currentPage,
  376. pageSize: that.page.pagesize
  377. }
  378. if (type) {
  379. params.windpower = that.windTurbines
  380. }
  381. apiGetgetProjectplanList(params).then(datas =>{
  382. if (datas && datas.rows) {
  383. that.windframtableData = datas.rows
  384. that.windframradio = datas.rows[0]
  385. that.page.total = datas.total
  386. }
  387. })
  388. }
  389. }
  390. }
  391. </script>
  392. <style lang="less">
  393. .generationPlan{
  394. .generationBtn{
  395. background: #fff;
  396. padding: 10px 20px 0 20px;
  397. .titleSty{
  398. border-left: 4px solid #2996da;
  399. padding-left: 5px;
  400. font-size: 14px;
  401. margin-left:20px;
  402. }
  403. .periodSeach{
  404. display: flex;
  405. margin:20px;
  406. .exceed{
  407. display: flex;
  408. margin-right:20px;
  409. .el-select{
  410. width: 200px;
  411. margin-right:10px;
  412. .el-input__inner{
  413. height:30px;
  414. }
  415. .el-input__suffix{
  416. .el-select__caret{
  417. line-height:30px;
  418. }
  419. }
  420. }
  421. }
  422. }
  423. span{
  424. font-size:14px;
  425. }
  426. .regionalBtn{
  427. padding-left: 10px;
  428. }
  429. .exceed{
  430. display: flex;
  431. margin-right:20px;
  432. .exTime{
  433. width: 240px;
  434. .el-select__tags{
  435. left: 1px;
  436. background:#fff;
  437. }
  438. }
  439. }
  440. .el-select{
  441. width: 160px;
  442. margin-right:10px;
  443. .el-input__inner{
  444. height:30px;
  445. }
  446. .el-input__suffix{
  447. .el-select__caret{
  448. line-height:30px;
  449. }
  450. }
  451. }
  452. .el-button{
  453. height: 30px;
  454. // width:100px;
  455. padding: 0 30px ;
  456. // padding-top: 8px;
  457. span{
  458. margin:0;
  459. }
  460. }
  461. }
  462. .windframTableData{
  463. padding: 10px 20px;
  464. .el-table{
  465. .el-table__body-wrapper{
  466. .el-table__empty-block{
  467. height: 550px !important;
  468. }
  469. }
  470. .el-input__inner{
  471. height: 30px !important;
  472. }
  473. .el-radio__label{
  474. display: none;
  475. }
  476. }
  477. .el-pagination{
  478. margin-top: 20px;
  479. text-align: end;
  480. position: relative;
  481. }
  482. }
  483. .el-overlay{
  484. .el-dialog{
  485. .windframFrom{
  486. .el-form{
  487. .el-select {
  488. width: 100%;
  489. .el-input__wrapper{
  490. height: 30px !important;
  491. }
  492. }
  493. .el-input {
  494. width: calc(100% - 30px);
  495. }
  496. .el-date-editor{
  497. height: 30px;
  498. }
  499. }
  500. }
  501. }
  502. }
  503. }
  504. </style>