windsite.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236
  1. <template>
  2. <div class="global-variable" v-loading="loading">
  3. <div
  4. class="condition"
  5. style="display: flex; justify-content: space-between"
  6. >
  7. <el-form :inline="true" :model="formInline" class="demo-form-inline">
  8. <el-form-item label="风场名称:">
  9. <el-input
  10. v-model="formInline.fieldName"
  11. placeholder="请输入风场名称"
  12. size="small"
  13. class="search-input"
  14. ></el-input>
  15. </el-form-item>
  16. <el-form-item label="选择日期:" size="small">
  17. <el-date-picker
  18. v-model="formInline.timeQuantum"
  19. type="daterange"
  20. range-separator="至"
  21. start-placeholder="开始日期"
  22. end-placeholder="结束日期"
  23. @change="onDateChange"
  24. >
  25. </el-date-picker>
  26. </el-form-item>
  27. <el-form-item label="所属公司:">
  28. <el-input
  29. v-model="formInline.windCompany"
  30. placeholder="所属公司"
  31. size="small"
  32. class="search-input"
  33. ></el-input>
  34. </el-form-item>
  35. <el-form-item label="所在省:">
  36. <el-select
  37. v-model="form.shengfeng"
  38. placeholder="请选择"
  39. value-key="areaId"
  40. @change="handleProvinceChange"
  41. size="small"
  42. class="search-input"
  43. >
  44. <el-option
  45. v-for="item in provinceNameOptions"
  46. :key="item.areaId"
  47. :label="item.province"
  48. :value="item.areaId"
  49. >
  50. </el-option>
  51. </el-select>
  52. </el-form-item>
  53. <el-form-item>
  54. <el-button type="primary" @click="onSubmit" size="small"
  55. >查询</el-button
  56. >
  57. <el-button @click="reset" size="small">重置</el-button>
  58. </el-form-item>
  59. </el-form>
  60. <div class="newly">
  61. <el-button @click="upfile" size="small">导入</el-button>
  62. <el-button @click="newnuedialog" size="small">新增</el-button>
  63. </div>
  64. </div>
  65. <div class="list-page">
  66. <el-table
  67. class="center-align-table"
  68. :data="tableData"
  69. border
  70. :cell-style="rowStyle"
  71. >
  72. <el-table-column align="center" fixed prop="" label="风场名称">
  73. <template slot-scope="scope">
  74. <el-button
  75. @click="particulars(scope.row)"
  76. type="text"
  77. size="small"
  78. >{{ scope.row.fieldName }}</el-button
  79. >
  80. </template>
  81. </el-table-column>
  82. <el-table-column prop="windCompany" align="center" label="所属公司">
  83. </el-table-column>
  84. <el-table-column
  85. prop="windCompany"
  86. align="center"
  87. label="风机数量"
  88. min-width="80"
  89. >
  90. <template slot-scope="scope">
  91. <el-button @click="ONdraught(scope.row)" type="text" size="small">{{
  92. scope.row.wegNumber
  93. }}</el-button>
  94. </template>
  95. </el-table-column>
  96. <el-table-column
  97. align="center"
  98. prop="abnormal"
  99. label="测风塔"
  100. min-width="70"
  101. >
  102. <template slot-scope="scope">
  103. <el-button
  104. @click="ONanemometer(scope.row)"
  105. type="text"
  106. size="small"
  107. >{{ scope.row.atrNumber }}</el-button
  108. >
  109. </template>
  110. </el-table-column>
  111. <el-table-column
  112. align="center"
  113. prop="contractNumber"
  114. label="合同功率曲线数"
  115. min-width="100"
  116. >
  117. <template slot-scope="scope">
  118. <el-button @click="ONcurve(scope.row)" type="text" size="small">{{
  119. scope.row.contractNumber
  120. }}</el-button>
  121. </template>
  122. </el-table-column>
  123. <el-table-column
  124. prop="provinceName"
  125. align="center"
  126. min-width="100"
  127. label="所在省/市/自治区"
  128. >
  129. </el-table-column>
  130. <el-table-column
  131. prop="cityName"
  132. align="center"
  133. min-width="100"
  134. label="所在市"
  135. >
  136. </el-table-column>
  137. <el-table-column
  138. prop="createTime"
  139. align="center"
  140. label="创建时间"
  141. min-width="160"
  142. >
  143. </el-table-column>
  144. <el-table-column
  145. prop="state"
  146. align="center"
  147. label="状态"
  148. min-width="80"
  149. >
  150. <template slot-scope="{ row }">
  151. {{ row.state == 1 ? "启用" : "停用" }}
  152. </template>
  153. </el-table-column>
  154. <el-table-column
  155. prop="transition"
  156. align="center"
  157. fixed="right"
  158. label="操作"
  159. width="220"
  160. >
  161. <template slot-scope="scope">
  162. <el-button @click="compile(scope.row)" type="text" size="small"
  163. >编辑</el-button
  164. >
  165. <el-button @click="uploading(scope.row)" type="text" size="small"
  166. >上传</el-button
  167. >
  168. <el-button
  169. v-if="scope.row.state == 0"
  170. @click="start(scope.row, 1)"
  171. type="text"
  172. size="small"
  173. >启用</el-button
  174. >
  175. <el-button
  176. v-else
  177. style="color: #666"
  178. @click="start(scope.row, 0)"
  179. type="text"
  180. size="small"
  181. >停用</el-button
  182. >
  183. <el-button
  184. style="color: #f00"
  185. @click="batch(scope.row)"
  186. type="text"
  187. size="small"
  188. >批量更改</el-button
  189. >
  190. <el-button
  191. style="color: #f00"
  192. @click="deleted(scope.row)"
  193. type="text"
  194. size="small"
  195. >删除</el-button
  196. >
  197. </template>
  198. </el-table-column>
  199. </el-table>
  200. <div class="pagination-container">
  201. <el-pagination
  202. @current-change="handleCurrentChange"
  203. :current-page.sync="formInline.pageNum"
  204. layout="total, prev, pager, next"
  205. :page-size="formInline.pageSize"
  206. :total="formInline.totalSize"
  207. >
  208. </el-pagination>
  209. </div>
  210. </div>
  211. <!-- 弹出层 -->
  212. <!-- 新增 -->
  213. <el-dialog
  214. :title="title"
  215. :visible.sync="nuedialog"
  216. width="1000px"
  217. @close="handleClose"
  218. >
  219. <el-form :model="form" :rules="rules" ref="formRef" label-width="120px">
  220. <div class="general">
  221. <div class="row">
  222. <div class="condition">
  223. <el-form-item label="风场名称:" prop="fieldName">
  224. <el-input v-model="form.fieldName"></el-input>
  225. </el-form-item>
  226. </div>
  227. <div class="condition">
  228. <el-form-item label="空气密度kg/m³:" prop="density">
  229. <el-input v-model="form.density"></el-input>
  230. </el-form-item>
  231. </div>
  232. </div>
  233. <div class="row">
  234. <div class="condition">
  235. <el-form-item label="所属公司:" prop="companyCode">
  236. <selecttree
  237. placeholder="请选择所属公司"
  238. :list="parentOpt"
  239. v-model="form.companyCode"
  240. @change="parentChange"
  241. >
  242. </selecttree>
  243. </el-form-item>
  244. </div>
  245. <div class="condition">
  246. <el-form-item label="海拔高度/米:" prop="elevationHeight">
  247. <el-input v-model="form.elevationHeight"></el-input>
  248. </el-form-item>
  249. </div>
  250. </div>
  251. <div class="row">
  252. <div class="condition">
  253. <el-form-item label="所在省:" prop="provinceName">
  254. <el-select
  255. v-model="form.provinceName"
  256. placeholder="请选择"
  257. value-key="areaId"
  258. @change="fetchCities"
  259. >
  260. <el-option
  261. v-for="item in provinceNameOptions"
  262. :key="item.areaId"
  263. :label="item.province"
  264. :value="item"
  265. >
  266. </el-option>
  267. </el-select>
  268. </el-form-item>
  269. </div>
  270. <div class="condition">
  271. <el-form-item label="所在市:" prop="cityName">
  272. <el-select
  273. v-model="form.cityName"
  274. placeholder="请选择"
  275. value-key="areaId"
  276. >
  277. <el-option
  278. v-for="item in cityNameOptions"
  279. :key="item.areaId"
  280. :label="item.city"
  281. :value="item"
  282. >
  283. </el-option>
  284. </el-select>
  285. </el-form-item>
  286. </div>
  287. </div>
  288. <div class="row">
  289. <div class="condition">
  290. <el-form-item label="测风塔:" prop="anemometerTowerRelationDtos">
  291. <el-select
  292. v-model="form.anemometerTowerRelationDtos"
  293. multiple
  294. collapse-tags
  295. placeholder="请选择"
  296. @focus="logClick"
  297. value-key="anemometerCode"
  298. >
  299. <el-option
  300. v-for="item in options"
  301. :key="item.anemometerCode"
  302. :label="item.anemometerName"
  303. :value="item.anemometerCode"
  304. >
  305. </el-option>
  306. </el-select>
  307. </el-form-item>
  308. </div>
  309. <div class="condition">
  310. <el-form-item label="经纬度类型:">
  311. <el-select
  312. v-model="SFMvalue"
  313. placeholder="请选择"
  314. @change="handleSFMChange"
  315. >
  316. <el-option
  317. v-for="item in SFMoptions"
  318. :key="item.value"
  319. :label="item.label"
  320. :value="item.value"
  321. >
  322. </el-option>
  323. </el-select>
  324. </el-form-item>
  325. </div>
  326. </div>
  327. <div class="row">
  328. <div class="condition">
  329. <el-form-item label="经度:" prop="longitude">
  330. <el-input v-model="form.longitude"></el-input>
  331. </el-form-item>
  332. </div>
  333. <div class="condition">
  334. <el-form-item label="纬度:" prop="latitude">
  335. <el-input v-model="form.latitude"></el-input>
  336. </el-form-item>
  337. </div>
  338. </div>
  339. </div>
  340. </el-form>
  341. <div class="bianji" v-show="listedfiles">
  342. <el-table :data="filetableData" style="width: 100%">
  343. <el-table-column prop="fileName" label="文件名"> </el-table-column>
  344. <el-table-column prop="type" label="文件类型"> </el-table-column>
  345. <el-table-column fixed="right" label="操作" width="120">
  346. <template slot-scope="scope">
  347. <el-button
  348. @click.native.prevent="deleteRow(scope.row)"
  349. type="text"
  350. size="small"
  351. >
  352. 删除
  353. </el-button>
  354. </template>
  355. </el-table-column>
  356. </el-table>
  357. </div>
  358. <span slot="footer" class="dialog-footer">
  359. <el-button @click="handleClose(false, 'nuedialog')" size="small"
  360. >取 消</el-button
  361. >
  362. <el-button type="primary" @click="newly('formRef')" size="small"
  363. >确 定</el-button
  364. >
  365. <el-button type="primary" size="small" @click="createMachine"
  366. >创建机型</el-button
  367. >
  368. </span>
  369. </el-dialog>
  370. <!-- 风场详情 -->
  371. <WindsiteMessage
  372. :unusualdialog="unusualdialog"
  373. :unusualdialogdata="unusualdialogdata"
  374. @handleClose="handleClose"
  375. >
  376. </WindsiteMessage>
  377. <!-- 测风塔 -->
  378. <windsitemachine
  379. :anemometerdialog="anemometerdialog"
  380. :anemometerData="anemometerData"
  381. @handleClose="handleClose"
  382. >
  383. </windsitemachine>
  384. <!-- 风机数量 -->
  385. <windsitetower
  386. :draught="draught"
  387. :draughtData="draughtData"
  388. @handleClose="handleClose"
  389. ></windsitetower>
  390. <!-- 上传 -->
  391. <windsiteup
  392. :uploadingPOP="uploadingPOP"
  393. :rowdata="rowdata"
  394. :AllTemplateurlDR="AllTemplateurlDR"
  395. @handleClose="handleClose"
  396. ></windsiteup>
  397. <!-- 导入 -->
  398. <windsitetolead
  399. :parentOptdata="parentOptdata"
  400. :AllTemplateurl="AllTemplateurl"
  401. :tolead="tolead"
  402. @handleClose="handleClose"
  403. @onSubmit="onSubmit"
  404. ></windsitetolead>
  405. <!-- 功率曲线 -->
  406. <el-dialog
  407. title="批量修改"
  408. :visible.sync="drawer"
  409. width="85%"
  410. :before-close="batchhandleClose"
  411. >
  412. <div class="batchclass">
  413. <div
  414. class="batch-processing"
  415. v-for="(item, index) in batchList"
  416. :key="index"
  417. >
  418. <p>
  419. 风机名称:
  420. <span>
  421. <el-input v-model="item.engineName" size="small"></el-input
  422. ></span>
  423. </p>
  424. <p>
  425. 海拔高度:
  426. <span>
  427. <el-input v-model="item.hubHeight" size="small"></el-input
  428. ></span>
  429. </p>
  430. <p>
  431. 额定容量:
  432. <span>
  433. <el-input v-model="item.ratedCapacity" size="small"></el-input
  434. ></span>
  435. </p>
  436. <p>
  437. 经度:
  438. <span>
  439. <el-input v-model="item.longitude" size="small"></el-input
  440. ></span>
  441. </p>
  442. <p>
  443. 维度:
  444. <span>
  445. <el-input v-model="item.latitude" size="small"></el-input
  446. ></span>
  447. </p>
  448. </div>
  449. </div>
  450. <div style="height: 30px; text-align: right; margin-top: 10px">
  451. <el-button
  452. class="batch-submit"
  453. type="primary"
  454. size="small"
  455. @click="ONbatch"
  456. >提交</el-button
  457. >
  458. </div>
  459. </el-dialog>
  460. <el-dialog
  461. title="合同功率曲线"
  462. :visible.sync="curve"
  463. :before-close="GBhandleClose"
  464. width="40%"
  465. >
  466. <el-table :data="curvelist" style="width: 100%">
  467. <el-table-column type="index" width="50"> </el-table-column>
  468. <el-table-column prop="machineTypeCode" label="机型名称" width="">
  469. </el-table-column>
  470. <el-table-column prop="createTime" label="上传时间" width="">
  471. </el-table-column>
  472. <el-table-column fixed="right" label="操作" width="150">
  473. <template slot-scope="scope">
  474. <el-button @click="handleClick(scope.row)" type="text" size="small"
  475. >删除</el-button
  476. >
  477. <el-button @click="XZClick(scope.row)" type="text" size="small"
  478. >下载</el-button
  479. >
  480. </template>
  481. </el-table-column>
  482. </el-table>
  483. </el-dialog>
  484. </div>
  485. </template>
  486. <script>
  487. import {
  488. WindFieldListPage,
  489. createWindField,
  490. delWindFieldById,
  491. findAllProvince,
  492. getAllWindCompany,
  493. getAnemometerTowerByField,
  494. getAnemometerTowerNameList,
  495. getCitiesByPId,
  496. getWindFieldVo,
  497. updateWindFieldStateById,
  498. windEngineGrouPage,
  499. windFieldDto,
  500. getAllTemplate,
  501. delWindFieldResource,
  502. getWindEngineGroupListByFieldCode,
  503. bathUpdateWindEngineGroup,
  504. getWindFieldContractByFieldCode,
  505. delWindFieldContractById,
  506. } from "@/api/ledger.js";
  507. import selecttree from "../../components/selecttree";
  508. import WindsiteMessage from "./component/windsiteMessage.vue";
  509. import windsitemachine from "./component/windsitemachine.vue";
  510. import windsitetolead from "./component/windsitetolead.vue";
  511. import windsitetower from "./component/windsitetower.vue";
  512. import windsiteup from "./component/windsiteup.vue";
  513. import { log } from "plotly.js-dist";
  514. export default {
  515. components: {
  516. WindsiteMessage,
  517. windsitemachine,
  518. windsitetower,
  519. windsiteup,
  520. windsitetolead,
  521. selecttree,
  522. },
  523. data() {
  524. return {
  525. loading: false,
  526. treeval: "",
  527. tableData: [],
  528. formInline: {
  529. fieldName: "",
  530. timeQuantum: [],
  531. pageNum: 1,
  532. pageSize: 10,
  533. totalSize: 0,
  534. windCompany: "",
  535. shengfeng: "",
  536. },
  537. startDate: "",
  538. endDate: "",
  539. parentOpt: [],
  540. form: {
  541. anemometerTowerRelationDtos: [],
  542. areaCode: "",
  543. cityId: "",
  544. cityName: "",
  545. density: "",
  546. elevationHeight: "",
  547. fieldName: "",
  548. latitude: "",
  549. longitude: "",
  550. provinceId: "",
  551. provinceName: "",
  552. ratedCapacityNumber: "",
  553. companyCode: "",
  554. },
  555. SFMoptions: [
  556. {
  557. label: "十进制形式",
  558. value: "1",
  559. },
  560. {
  561. label: "度分秒形式",
  562. value: "2",
  563. },
  564. ],
  565. SFMvalue: "",
  566. rules: {
  567. fieldName: [
  568. { required: true, message: "请输入风场名称", trigger: "blur" },
  569. ],
  570. density: [
  571. { required: true, message: "请输入空气密度", trigger: "blur" },
  572. { validator: this.validateNumber, trigger: "blur" },
  573. ],
  574. companyCode: [
  575. { required: true, message: "请选择所属公司", trigger: "change" },
  576. ],
  577. elevationHeight: [
  578. { required: true, message: "请输入海拔高度", trigger: "blur" },
  579. { validator: this.validateNumber, trigger: "blur" },
  580. ],
  581. provinceName: [
  582. { required: true, message: "请选择所在省", trigger: "change" },
  583. ],
  584. cityName: [
  585. { required: true, message: "请选择所在市", trigger: "change" },
  586. ],
  587. longitude: [
  588. { required: true, message: "请输入经度", trigger: "blur" },
  589. { validator: this.validateNumber, trigger: "blur" },
  590. ],
  591. latitude: [
  592. { required: true, message: "请输入纬度", trigger: "blur" },
  593. { validator: this.validateNumber, trigger: "blur" },
  594. ],
  595. // anemometerTowerRelationDtos: [
  596. // { required: true, message: "请选择测风塔", trigger: "change" },
  597. // ],
  598. },
  599. provinceNameOptions: [],
  600. cityNameOptions: [],
  601. options: [],
  602. filetableData: [],
  603. anemometerData: [],
  604. draughtData: {},
  605. unusualdialogdata: {},
  606. parentOptdata: [],
  607. AllTemplateurl: {},
  608. AllTemplateurlDR: {},
  609. rowdata: {},
  610. listedfiles: false,
  611. nuedialog: false,
  612. unusualdialog: false,
  613. tolead: false,
  614. draught: false,
  615. anemometerdialog: false,
  616. uploadingPOP: false,
  617. newform: {
  618. unit: "",
  619. province: "",
  620. city: "",
  621. descr: "",
  622. },
  623. isEdit: false,
  624. title: "新增",
  625. detail: {},
  626. drawer: false,
  627. batchVal1: "",
  628. batchVal2: "",
  629. batchVal3: "",
  630. batchVal4: "",
  631. batchVal5: "",
  632. batchList: [],
  633. curve: false,
  634. curvelist: [],
  635. shengID: "",
  636. };
  637. },
  638. created() {
  639. this.onSubmit();
  640. this.postsheng();
  641. this.relevanceunit();
  642. this.TowerNameList();
  643. this.getAllTemplate();
  644. },
  645. methods: {
  646. logClick() {
  647. this.TowerNameList();
  648. },
  649. handleClose(value, dialogName) {
  650. this[dialogName] = value;
  651. if (this.$refs.formRef) {
  652. this.$refs.formRef.resetFields();
  653. }
  654. // this.$refs.formRef.resetFields();
  655. this.form = Object.assign({}, this.$options.data().form);
  656. },
  657. // 列表居中展示
  658. rowStyle() {
  659. return "text-align:center";
  660. },
  661. getAllTemplate() {
  662. getAllTemplate().then((res) => {
  663. this.AllTemplateurl = res.data;
  664. this.AllTemplateurlDR = res.data;
  665. });
  666. },
  667. // 时间转换
  668. onDateChange(date) {
  669. if (Array.isArray(date)) {
  670. this.startDate = this.$formatDate(date[0]);
  671. this.endDate = this.$formatDate(date[1]);
  672. if (this.endDate < this.startDate) {
  673. this.endDate = this.startDate;
  674. }
  675. } else {
  676. this.startDate = null;
  677. this.endDate = null;
  678. }
  679. },
  680. // 省
  681. async postsheng() {
  682. try {
  683. const res = await findAllProvince();
  684. this.provinceNameOptions = res.data;
  685. } catch (error) {
  686. console.error("Error fetching province data:", error);
  687. }
  688. },
  689. // 市
  690. fetchCities(item, city) {
  691. console.log(item, this.newform.province);
  692. this.newform.province = item;
  693. this.form.province = item;
  694. this.form.cityName = "";
  695. let data = {
  696. provinceId: item.areaId,
  697. };
  698. getCitiesByPId(data).then((res) => {
  699. this.cityNameOptions = res.data;
  700. });
  701. if (city) {
  702. this.newform.city = Object.assign(
  703. {},
  704. { areaId: city.areaId, city: city.city }
  705. );
  706. }
  707. },
  708. // 测风塔
  709. TowerNameList() {
  710. getAnemometerTowerNameList().then((res) => {
  711. this.options = res.data;
  712. });
  713. },
  714. // 关联风场
  715. async relevanceunit() {
  716. try {
  717. const res = await getAllWindCompany();
  718. this.parentOpt = res.data;
  719. this.parentOptdata = res.data;
  720. } catch (error) {
  721. console.error("Error fetching wind company data:", error);
  722. }
  723. },
  724. parentChange(data) {
  725. //data为当前选中对象
  726. console.log(data);
  727. },
  728. // 查询
  729. handleProvinceChange(value) {
  730. this.shengID = value;
  731. },
  732. onSubmit() {
  733. let paramsData = {
  734. fieldName: this.formInline?.fieldName || undefined,
  735. beginTime: this.startDate || undefined,
  736. endTime: this.endDate || undefined,
  737. pageNum: this.formInline.pageNum || 1,
  738. companyName: this.formInline.windCompany,
  739. provinceId: this.shengID, // 这里就是你获取到的值
  740. pageSize: 10,
  741. };
  742. console.log(this.formInline.shengfeng, "shengfeng");
  743. this.loading = true;
  744. WindFieldListPage(paramsData)
  745. .then((res) => {
  746. this.tableData = res.data.list;
  747. this.formInline.totalSize = res.data.totalSize;
  748. this.loading = false;
  749. })
  750. .catch((error) => {
  751. this.loading = false;
  752. console.error(error);
  753. });
  754. },
  755. //分页数据切换
  756. handleCurrentChange(val) {
  757. this.formInline.pageNum = val;
  758. this.onSubmit();
  759. },
  760. // 停用
  761. start(row, type) {
  762. let objectval = {
  763. fieldCode: row.fieldCode,
  764. state: type === 0 ? 0 : 1,
  765. };
  766. updateWindFieldStateById(objectval).then((res) => {
  767. this.$message({
  768. message: "状态已更新成功",
  769. type: "success",
  770. });
  771. // this.$message(`${type === 1 ? '状态已更新成功' : '状态已更新成功'}`);
  772. row.state = type === 1 ? 0 : 1;
  773. this.onSubmit();
  774. });
  775. },
  776. processData(data) {
  777. console.log(data);
  778. if (!data) {
  779. console.error("Data is undefined");
  780. return;
  781. }
  782. return data.map((code) => ({
  783. towerCode: code,
  784. }));
  785. },
  786. // 新增提交
  787. newly(formName) {
  788. this.$refs[formName].validate((valid) => {
  789. if (!valid) {
  790. this.$message.error("表单验证失败!");
  791. return false;
  792. }
  793. // 判断是否需要转换经纬度
  794. if (this.SFMvalue === "2") {
  795. // 转换经度和纬度
  796. const longitudeDecimal = this.$convertDMSToDecimal(
  797. this.form.longitude
  798. );
  799. const latitudeDecimal = this.$convertDMSToDecimal(this.form.latitude);
  800. console.log(longitudeDecimal, latitudeDecimal, "...........");
  801. // 检查转换是否成功
  802. if (longitudeDecimal !== null) {
  803. this.form.longitude = longitudeDecimal;
  804. } else {
  805. this.$message.error("经度格式不正确!");
  806. return;
  807. }
  808. if (latitudeDecimal !== null) {
  809. this.form.latitude = latitudeDecimal;
  810. } else {
  811. this.$message.error("纬度格式不正确!");
  812. return;
  813. }
  814. }
  815. // Prepare the params object
  816. const params = JSON.parse(JSON.stringify(this.form));
  817. params.anemometerTowerRelationDtos = this.processData(
  818. this.form.anemometerTowerRelationDtos
  819. );
  820. params.cityName = this.form.cityName.city;
  821. params.cityId = this.form.cityName.areaId;
  822. params.provinceName = this.form.provinceName.province;
  823. params.provinceId = this.form.provinceName.areaId;
  824. params.areaCode = this.form.cityName.areaCode;
  825. if (this.isEdit) {
  826. params.fieldCode = this.detail.fieldCode;
  827. }
  828. console.log(this.form, params);
  829. // return;
  830. // Determine which API to call
  831. const API = this.isEdit
  832. ? windFieldDto(params)
  833. : createWindField(params);
  834. // Execute the API call
  835. API.then((res) => {
  836. // Adjust based on your API response
  837. this.$message.success(this.isEdit ? "编辑成功" : "新增成功");
  838. this.onSubmit();
  839. this.isEdit = false;
  840. this.nuedialog = false;
  841. }).catch((error) => {});
  842. });
  843. },
  844. handleSFMChange(newValue) {
  845. this.form.longitude = "";
  846. this.form.latitude = "";
  847. },
  848. // 重置
  849. reset() {
  850. this.formInline.fieldName = "";
  851. this.formInline.timeQuantum = "";
  852. this.shengID = "";
  853. this.startDate = "";
  854. this.endDate = "";
  855. this.form.shengfeng = "";
  856. this.onSubmit();
  857. },
  858. //导入提交
  859. UPsubmit() {
  860. this.tolead = false;
  861. },
  862. //查看详情
  863. particulars(row) {
  864. getWindFieldVo({
  865. fieldCode: row.fieldCode,
  866. }).then((res) => {
  867. this.unusualdialogdata = res.data;
  868. this.unusualdialog = true;
  869. });
  870. },
  871. //风机详情
  872. ONdraught(row) {
  873. this.draughtData = row;
  874. this.draught = true;
  875. },
  876. //测风塔详情
  877. ONanemometer(row) {
  878. getAnemometerTowerByField({
  879. fieldCode: row.fieldCode,
  880. }).then((res) => {
  881. this.anemometerData = res.data;
  882. this.anemometerdialog = true;
  883. });
  884. },
  885. // 合同曲线数
  886. ONcurve(row) {
  887. this.curve = true;
  888. getWindFieldContractByFieldCode({ fieldCode: row.fieldCode }).then(
  889. (res) => {
  890. this.curvelist = res.data;
  891. }
  892. );
  893. },
  894. handleClick(row) {
  895. delWindFieldContractById({ windFieldContractId: row.id })
  896. .then((res) => {
  897. this.$message({
  898. message: "删除成功",
  899. type: "success",
  900. });
  901. this.curvelist = this.curvelist.filter((item) => item.id !== row.id);
  902. })
  903. .catch((error) => {});
  904. },
  905. // 下载附件
  906. XZClick(row) {
  907. const link = document.createElement("a");
  908. link.href = row.contractSource;
  909. link.download = ""; // 可以设置默认下载文件名
  910. link.target = "_blank"; // 新窗口打开
  911. document.body.appendChild(link);
  912. link.click();
  913. document.body.removeChild(link);
  914. },
  915. GBhandleClose() {
  916. this.curve = false;
  917. this.onSubmit();
  918. },
  919. // 编辑
  920. compile(row) {
  921. getWindFieldVo({
  922. fieldCode: row.fieldCode,
  923. })
  924. .then((res) => {
  925. this.filetableData = res.data.windFieldResourceVos;
  926. const item = JSON.parse(JSON.stringify(res.data));
  927. this.detail = item;
  928. Object.keys(this.form).forEach((key) => {
  929. this.form[key] = item[key];
  930. });
  931. this.form.anemometerTowerRelationDtos = item.anemometerTowerByFieldVos
  932. ? item.anemometerTowerByFieldVos.map(
  933. (element) => element.anemometerCode
  934. )
  935. : [];
  936. this.detail = row;
  937. this.nuedialog = true;
  938. this.listedfiles = true;
  939. this.title = "编辑";
  940. this.isEdit = true;
  941. })
  942. .catch((error) => {
  943. console.error("Error fetching wind field data:", error);
  944. });
  945. },
  946. // 上传附件
  947. uploading(row) {
  948. this.uploadingPOP = true;
  949. this.rowdata = row;
  950. },
  951. // 删除
  952. deleted(row) {
  953. console.log(row, "row");
  954. if (row.state == "1") {
  955. this.$message({
  956. type: "error",
  957. message: "该项处于启用状态,无法删除!",
  958. });
  959. return;
  960. }
  961. this.$confirm("此操作将永久删除该文件,是否继续?", "提示", {
  962. confirmButtonText: "确定",
  963. cancelButtonText: "取消",
  964. type: "warning",
  965. })
  966. .then(() => {
  967. delWindFieldById({ fieldCode: row.fieldCode })
  968. .then((res) => {
  969. if (res.code === -1) {
  970. // Assuming -1 indicates success, adjust according to actual API response
  971. this.$message({
  972. type: "error",
  973. message: "删除失败!",
  974. });
  975. } else {
  976. this.$message({
  977. type: "success",
  978. message: "删除成功!",
  979. });
  980. this.onSubmit();
  981. }
  982. })
  983. .catch((error) => {});
  984. })
  985. .catch(() => {
  986. // 取消删除
  987. this.$message({
  988. type: "info",
  989. message: "已取消删除",
  990. });
  991. });
  992. },
  993. // 删除附件
  994. deleteRow(row) {
  995. this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
  996. confirmButtonText: "确定",
  997. cancelButtonText: "取消",
  998. type: "warning",
  999. })
  1000. .then(() => {
  1001. delWindFieldResource({ id: row.id }).then((res) => {
  1002. const index = this.filetableData.indexOf(row);
  1003. if (index !== -1) {
  1004. this.filetableData.splice(index, 1);
  1005. }
  1006. this.$message({
  1007. type: "success",
  1008. message: "删除成功!",
  1009. });
  1010. });
  1011. })
  1012. .catch(() => {
  1013. this.$message({
  1014. type: "info",
  1015. message: "已取消删除",
  1016. });
  1017. });
  1018. },
  1019. // 导入
  1020. upfile() {
  1021. this.tolead = true;
  1022. },
  1023. // 新增
  1024. newnuedialog() {
  1025. this.nuedialog = true;
  1026. this.listedfiles = false;
  1027. this.title = "新增";
  1028. },
  1029. // 数字验证
  1030. validateNumber(rule, value, callback) {
  1031. const { regex, errorMessage } = this.getValidationConfig(rule.field);
  1032. if (!value) {
  1033. callback(new Error("该项不能为空"));
  1034. } else if (!regex.test(value)) {
  1035. callback(new Error(errorMessage));
  1036. } else {
  1037. callback();
  1038. }
  1039. },
  1040. getValidationConfig(fieldName) {
  1041. switch (fieldName) {
  1042. case "density":
  1043. return {
  1044. regex: /^\d{1,3}(\.\d{1,3})?$/,
  1045. errorMessage: "该项必须为不超过三位数且小数点后不超过三位数的数字",
  1046. };
  1047. case "elevationHeight":
  1048. return {
  1049. regex: /^\d{1,4}(\.\d{1,2})?$/,
  1050. errorMessage: "该项必须为不超过四位数且小数点后不超两位数的数字",
  1051. };
  1052. case "longitude":
  1053. case "latitude":
  1054. return {
  1055. regex: /^[+-]?\d+(\.\d+)?$|^[+-]?\d{1,3}°\d{1,2}′\d{1,2}″$/,
  1056. errorMessage:
  1057. "请输入有效的经纬度格式,可以是度分秒格式(如:91°06′00″)或十进制格式(如:116.39138889)",
  1058. };
  1059. default:
  1060. return {
  1061. regex: /^[^\u4e00-\u9fa5]+$/,
  1062. errorMessage: "请输入有效数字,不能包含汉字或其他非法字符",
  1063. };
  1064. }
  1065. },
  1066. batch(row) {
  1067. if (row.wegNumber != 0) {
  1068. getWindEngineGroupListByFieldCode({ fieldCode: row.fieldCode }).then(
  1069. (res) => {
  1070. this.batchList = res.data;
  1071. }
  1072. );
  1073. this.drawer = true;
  1074. } else {
  1075. this.$message({
  1076. message: "暂无风机无法批量更改",
  1077. type: "warning",
  1078. });
  1079. }
  1080. },
  1081. ONbatch() {
  1082. bathUpdateWindEngineGroup({
  1083. windEngineGroupUpdateDtoList: this.batchList,
  1084. })
  1085. .then((res) => {
  1086. this.drawer = false;
  1087. this.$message({
  1088. title: "成功",
  1089. message: "风机组信息更新成功",
  1090. type: "success",
  1091. });
  1092. })
  1093. .catch((error) => {});
  1094. },
  1095. batchhandleClose(done) {
  1096. this.batchList = [];
  1097. done();
  1098. },
  1099. createMachine() {
  1100. // this.$router.push({
  1101. // path: "/home/Ledger/milltype?id=192",
  1102. // });
  1103. window.open("/home/Ledger/milltype?id=192", "_blank");
  1104. },
  1105. },
  1106. };
  1107. </script>
  1108. <style lang="scss" scoped>
  1109. .general {
  1110. display: flex;
  1111. flex-direction: column;
  1112. .row {
  1113. display: flex;
  1114. justify-content: space-between;
  1115. }
  1116. .condition {
  1117. width: 50%;
  1118. .el-select {
  1119. width: 360px;
  1120. }
  1121. .el-form-item {
  1122. margin-bottom: 22px;
  1123. }
  1124. }
  1125. }
  1126. .UPcondition {
  1127. display: flex;
  1128. p {
  1129. width: 74px;
  1130. text-align: right;
  1131. line-height: 40px;
  1132. }
  1133. .el-select {
  1134. width: 100%;
  1135. margin-bottom: 20px;
  1136. }
  1137. .el-input {
  1138. margin-bottom: 20px;
  1139. }
  1140. }
  1141. .model-center {
  1142. color: #666;
  1143. line-height: 40px;
  1144. height: 40px;
  1145. font-size: 14px;
  1146. }
  1147. .batchclass {
  1148. max-height: 550px;
  1149. overflow: hidden;
  1150. overflow-y: auto;
  1151. position: relative;
  1152. }
  1153. .batch-processing {
  1154. display: flex;
  1155. justify-content: space-between;
  1156. margin-bottom: 20px;
  1157. p {
  1158. .el-input {
  1159. width: 200px;
  1160. }
  1161. }
  1162. }
  1163. .batch-name {
  1164. margin-left: 20px;
  1165. .el-input {
  1166. width: 200px;
  1167. }
  1168. }
  1169. ::v-deep .el-date-editor--daterange.el-input__inner {
  1170. width: 260px;
  1171. }
  1172. .bianji {
  1173. margin-top: 10px;
  1174. }
  1175. ::v-deep .el-dialog__footer {
  1176. text-align: center;
  1177. }
  1178. </style>