measuringLocationEntry.vue 75 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687
  1. <template>
  2. <!-- 计量点数据录入 -->
  3. <div class="measuringLocationAdd">
  4. <div class="box">
  5. <div class="box-top">
  6. <el-form
  7. style="overflow: hidden;"
  8. :style="filterForm.show ? null : { height: '0px' }"
  9. size="mini"
  10. label-width="80px"
  11. >
  12. <el-row>
  13. <el-col :span="6">
  14. <el-form-item label="时间粒度">
  15. <el-select
  16. filterable
  17. clearable
  18. v-model="filterForm.data.timegranid"
  19. placeholder="时间粒度"
  20. style="width: 100%;"
  21. >
  22. <el-option
  23. v-for="item of nameObj.timegranid.arr"
  24. :key="item.id"
  25. :value="item.id"
  26. :label="item.name"
  27. ></el-option>
  28. </el-select>
  29. </el-form-item>
  30. </el-col>
  31. <el-col :span="6">
  32. <el-form-item label="日期">
  33. <!-- <el-date-picker
  34. value-format="yyyy-MM-dd"
  35. type="date"
  36. v-model="filterForm.data.clock"
  37. placeholder="时间"
  38. style="width: 100%;"
  39. ></el-date-picker> -->
  40. <!-- <zj-timegran-date
  41. v-model="filterForm.data.clock"
  42. style="width: 100%;"
  43. :timegranId="filterForm.data.timegranid"
  44. :oneFoo="getTableData"
  45. :defaultOffset="-1"
  46. ></zj-timegran-date> -->
  47. <zj-timegran-date
  48. v-model="filterForm.data.clock"
  49. style="width: 100%;"
  50. :type="'daterange'"
  51. :timegranId="filterForm.data.timegranid"
  52. :oneFoo="getTableData"
  53. :defaultOffset="-1"
  54. ></zj-timegran-date>
  55. </el-form-item>
  56. </el-col>
  57. <el-col :span="6">
  58. <el-form-item label="能介类型">
  59. <el-select
  60. filterable
  61. clearable
  62. v-model="filterForm.data.energytypeid"
  63. placeholder="能介类型"
  64. style="width: 100%;"
  65. @change="filterForm.data.energyid = []"
  66. >
  67. <el-option
  68. v-for="item of nameObj.energytypeid.arr"
  69. :key="item.id"
  70. :value="item.id"
  71. :label="item.name"
  72. ></el-option>
  73. </el-select>
  74. </el-form-item>
  75. </el-col>
  76. <el-col :span="6">
  77. <el-form-item label="能介">
  78. <el-select
  79. filterable
  80. clearable
  81. multiple
  82. collapse-tags
  83. v-model="filterForm.data.energyid"
  84. placeholder="能介"
  85. style="width: 100%;"
  86. >
  87. <template v-for="item of nameObj.energyid.arr">
  88. <el-option
  89. v-if="item.energytypeid === filterForm.data.energytypeid || filterForm.data.energytypeid === ''"
  90. :key="item.id"
  91. :value="item.id"
  92. :label="item.name"
  93. ></el-option>
  94. </template>
  95. </el-select>
  96. </el-form-item>
  97. </el-col>
  98. </el-row>
  99. <el-row>
  100. <el-col :span="6">
  101. <el-form-item label="手抄或自动">
  102. <el-select
  103. filterable
  104. clearable
  105. v-model="filterForm.data.itemtype"
  106. placeholder="手抄或自动"
  107. style="width: 100%;"
  108. >
  109. <el-option
  110. v-for="item of nameObj.itemtype.arr"
  111. :key="item.id"
  112. :value="item.id"
  113. :label="item.name"
  114. ></el-option>
  115. </el-select>
  116. </el-form-item>
  117. </el-col>
  118. <el-col :span="6">
  119. <el-form-item label="位置">
  120. <el-select
  121. filterable
  122. clearable
  123. multiple
  124. collapse-tags
  125. v-model="filterForm.data.locateid"
  126. placeholder="位置"
  127. style="width: 100%;"
  128. :disabled="filterForm.disabled.locateid"
  129. >
  130. <el-option
  131. v-for="item of nameObj.locateid.arr"
  132. :key="item.id"
  133. :value="item.id"
  134. :label="item.name"
  135. ></el-option>
  136. </el-select>
  137. </el-form-item>
  138. </el-col>
  139. <el-col :span="6">
  140. <el-form-item label="计量点编号">
  141. <el-input
  142. clearable
  143. v-model.trim="filterForm.data.itemid"
  144. placeholder="计量点编号"
  145. style="width: 100%;"
  146. @keyup.enter.native="getTableData(1)"
  147. ></el-input>
  148. </el-form-item>
  149. </el-col>
  150. <el-col :span="6">
  151. <el-form-item label="计量点名称">
  152. <el-input
  153. clearable
  154. v-model.trim="filterForm.data.itemname"
  155. placeholder="计量点名称"
  156. style="width: 100%;"
  157. @keyup.enter.native="getTableData(1)"
  158. ></el-input>
  159. </el-form-item>
  160. </el-col>
  161. </el-row>
  162. <el-row>
  163. <el-col :span="6">
  164. <el-form-item label="工序">
  165. <el-select
  166. filterable clearable
  167. v-model="filterForm.data.costid"
  168. placeholder="工序"
  169. multiple
  170. collapse-tags
  171. style="width: 100%;"
  172. >
  173. <el-option
  174. v-for="item of nameObj.workprocid.arr"
  175. :key="item.id"
  176. :value="item.id"
  177. :label="item.name"
  178. ></el-option>
  179. </el-select>
  180. </el-form-item>
  181. </el-col>
  182. <el-col :span="6">
  183. <el-form-item label="站所">
  184. <el-select
  185. filterable
  186. clearable
  187. multiple
  188. collapse-tags
  189. v-model="filterForm.data.networkid"
  190. placeholder="站所"
  191. style="width: 100%;"
  192. >
  193. <el-option
  194. v-for="item of nameObj.networkid.arr"
  195. :key="item.id"
  196. :value="item.id"
  197. :label="item.name"
  198. ></el-option>
  199. </el-select>
  200. </el-form-item>
  201. </el-col>
  202. <!-- <el-col :span="6">
  203. <el-form-item label="计量层级">
  204. <el-select
  205. filterable clearable
  206. v-model="filterForm.data.hierarchy"
  207. placeholder="计量层级"
  208. style="width: 100%;"
  209. >
  210. <el-option
  211. v-for="item of nameObj.hierarchy.arr"
  212. :key="item.id"
  213. :value="item.id"
  214. :label="item.name"
  215. ></el-option>
  216. </el-select>
  217. </el-form-item>
  218. </el-col> -->
  219. <el-col :span="6">
  220. <el-form-item label="TAG点别名">
  221. <el-input
  222. clearable
  223. v-model.trim="filterForm.data.tagAlias"
  224. placeholder="TAG点别名"
  225. style="width: 100%;"
  226. @keyup.enter.native="getTableData(1)"
  227. ></el-input>
  228. </el-form-item>
  229. </el-col>
  230. <el-col :span="6">
  231. <el-form-item label="用能属性">
  232. <el-select
  233. filterable clearable
  234. v-model="filterForm.data.propertyid"
  235. placeholder="用能属性"
  236. multiple
  237. collapse-tags
  238. style="width: 100%;"
  239. >
  240. <el-option
  241. v-for="item of nameObj.propertyid.arr"
  242. :key="item.id"
  243. :value="item.id"
  244. :label="item.name"
  245. ></el-option>
  246. </el-select>
  247. </el-form-item>
  248. </el-col>
  249. </el-row>
  250. </el-form>
  251. <div class="box-top-gjl">
  252. <el-button
  253. type="primary"
  254. size="mini"
  255. @click="look_trendChart()"
  256. >查看趋势</el-button>
  257. <el-button
  258. class="button"
  259. type="primary"
  260. size="mini"
  261. icon="el-icon-edit-outline"
  262. v-privilege="activeMenu + 'PUT'"
  263. @click="but_edit_plural()"
  264. :loading="loading"
  265. >修改</el-button>
  266. <el-button
  267. class="button"
  268. type="primary"
  269. size="mini"
  270. v-privilege="activeMenu + 'PUT'"
  271. @click="but_re_compute()"
  272. :loading="loading"
  273. >重新计算</el-button>
  274. <el-button
  275. class="button"
  276. type="primary"
  277. size="mini"
  278. v-privilege="activeMenu + 'PUT'"
  279. @click="but_redata()"
  280. :loading="loading"
  281. >重新生成数据</el-button>
  282. <div style="float:right; text-align: right;">
  283. <el-button
  284. class="button"
  285. type="primary"
  286. size="mini"
  287. icon="el-icon-search"
  288. v-privilege="activeMenu + 'QUERY'"
  289. @click="getTableData(1)"
  290. >查询</el-button>
  291. <el-button
  292. class="button"
  293. type="primary"
  294. size="mini"
  295. icon="el-icon-refresh"
  296. v-privilege="activeMenu + 'QUERY'"
  297. @click="tableDataCancel();"
  298. >重置</el-button>
  299. <el-button
  300. size="mini"
  301. :icon="filterForm.show ? 'el-icon-caret-top' : 'el-icon-caret-bottom'"
  302. :title="filterForm.show ? '收起搜索区' : '展开搜索区'"
  303. @click="filterForm.show = !filterForm.show;
  304. $nextTick(() => {
  305. singleTableHeight = getRoleHeight($refs['singleTable'].$el) - 45;
  306. }
  307. );"
  308. >{{ filterForm.show ? '收起' : '展开' }}</el-button>
  309. </div>
  310. </div>
  311. </div>
  312. <div class="box-bottom">
  313. <el-form
  314. size="mini"
  315. ref="dialog_form_arr"
  316. label-width="0px"
  317. :model="tableFormDataObj"
  318. >
  319. <el-table
  320. stripe
  321. id="singleTable"
  322. ref="singleTable"
  323. :data="tableData"
  324. v-loading="tableLoading"
  325. style="width: 100%;"
  326. :height="singleTableHeight"
  327. border
  328. size="mini"
  329. highlight-current-row
  330. @selection-change="handleSelectionChange"
  331. show-summary
  332. :summary-method="getSummaries"
  333. >
  334. <el-table-column
  335. sortable
  336. type="selection"
  337. width="40"
  338. align="center"
  339. fixed="left"
  340. ></el-table-column>
  341. <el-table-column
  342. sortable
  343. prop="timegranid"
  344. label="时间粒度"
  345. width="75px"
  346. :show-overflow-tooltip="true"
  347. >
  348. <template slot-scope="scope">
  349. <span>{{ nameObj.timegranid.obj[scope.row.timegranid] ? nameObj.timegranid.obj[scope.row.timegranid] : scope.row.timegranid }}</span>
  350. </template>
  351. </el-table-column>
  352. <el-table-column
  353. sortable
  354. prop="clock"
  355. label="时间"
  356. width="75px"
  357. :show-overflow-tooltip="true"
  358. ></el-table-column>
  359. <el-table-column
  360. sortable
  361. prop="itemid"
  362. label="计量点编号"
  363. min-width="120px"
  364. :show-overflow-tooltip="true"
  365. ></el-table-column>
  366. <el-table-column
  367. sortable
  368. prop="itemname"
  369. label="计量点名称"
  370. min-width="120px"
  371. :show-overflow-tooltip="true"
  372. ></el-table-column>
  373. <el-table-column
  374. sortable
  375. prop="tagAlias"
  376. label="TAG别名"
  377. min-width="120px"
  378. :show-overflow-tooltip="true"
  379. ></el-table-column>
  380. <el-table-column
  381. sortable
  382. prop="propertyid"
  383. label="用能属性"
  384. min-width="120px"
  385. :show-overflow-tooltip="true"
  386. ></el-table-column>
  387. <el-table-column
  388. sortable prop="ename"
  389. label="能介"
  390. width="70px"
  391. :show-overflow-tooltip="true"
  392. ></el-table-column>
  393. <el-table-column
  394. sortable
  395. prop="costid"
  396. label="工序"
  397. min-width="100px"
  398. :show-overflow-tooltip="true"
  399. >
  400. <template slot-scope="scope">
  401. <span>{{ nameObj.workprocid.obj[scope.row.costid] ? nameObj.workprocid.obj[scope.row.costid] : scope.row.costid }}</span>
  402. </template>
  403. </el-table-column>
  404. <el-table-column
  405. sortable prop="lname"
  406. label="位置"
  407. width="75px"
  408. :show-overflow-tooltip="true"
  409. ></el-table-column>
  410. <el-table-column
  411. sortable
  412. prop="tagModulus"
  413. label="倍率"
  414. width="60px"
  415. :show-overflow-tooltip="true"
  416. ></el-table-column>
  417. <el-table-column
  418. sortable
  419. :sort-by="function(row, index) { return sortFoo(row, index, 'unitid') }"
  420. prop="unitid"
  421. label="计量单位"
  422. width="75px"
  423. :show-overflow-tooltip="true"
  424. >
  425. <template slot-scope="scope">
  426. <span>{{ nameObj.unitid.obj[scope.row.unitid] ? nameObj.unitid.obj[scope.row.unitid] : scope.row.unitid }}</span>
  427. </template>
  428. </el-table-column>
  429. <el-table-column
  430. sortable
  431. prop="mintvalue"
  432. label="仪表期初值"
  433. min-width="100px"
  434. :show-overflow-tooltip="true"
  435. ></el-table-column>
  436. <el-table-column
  437. sortable
  438. prop="mendvalue"
  439. label="仪表期末值"
  440. min-width="100px"
  441. :show-overflow-tooltip="true"
  442. ></el-table-column>
  443. <el-table-column
  444. sortable
  445. label="期末-期初"
  446. min-width="100px"
  447. :show-overflow-tooltip="true"
  448. >
  449. <template slot-scope="scope">
  450. <span>{{ isNaN(scope.row.mendvalue - scope.row.mintvalue) ? '' : floatComputed(scope.row.mendvalue, scope.row.mintvalue, '-') }}</span>
  451. </template>
  452. </el-table-column>
  453. <el-table-column
  454. sortable
  455. prop="actualvalue"
  456. label="计算值"
  457. min-width="100px"
  458. :show-overflow-tooltip="true"
  459. ></el-table-column>
  460. <el-table-column
  461. sortable
  462. prop="correctvalue"
  463. label="修正值"
  464. min-width="100px"
  465. :show-overflow-tooltip="true"
  466. > <template slot-scope="scope">
  467. <el-form-item
  468. v-if="scope.row.isSelection"
  469. :prop="scope.row.itemid + '-' + scope.row.clock + '-' + scope.row.timegranid + '.correctvalue'"
  470. :rules="dialog.editorBox.form.rules.correctvalue"
  471. >
  472. <el-input
  473. clearable
  474. style="width: 100%;"
  475. v-model.trim="tableFormDataObj[scope.row.itemid + '-' + scope.row.clock + '-' + scope.row.timegranid].correctvalue"
  476. @change="tableFormDataObj[scope.row.itemid + '-' + scope.row.clock + '-' + scope.row.timegranid].apportvalue = floatComputed(scope.row.actualvalue, tableFormDataObj[scope.row.itemid + '-' + scope.row.clock + '-' + scope.row.timegranid].correctvalue, '+')"
  477. ></el-input>
  478. <template
  479. slot="error"
  480. slot-scope="scope"
  481. >
  482. <p
  483. class="error"
  484. :title="scope.error"
  485. >{{ scope.error }}</p>
  486. </template>
  487. </el-form-item>
  488. <span v-else>{{scope.row.correctvalue}}</span>
  489. </template>
  490. </el-table-column>
  491. <el-table-column
  492. sortable
  493. prop="apportvalue"
  494. label="最终值"
  495. min-width="100px"
  496. :show-overflow-tooltip="true"
  497. > <template slot-scope="scope">
  498. <el-form-item
  499. v-if="scope.row.isSelection"
  500. :prop="scope.row.itemid + '-' + scope.row.clock + '-' + scope.row.timegranid + '.apportvalue'"
  501. :rules="dialog.editorBox.form.rules.apportvalue"
  502. >
  503. <el-input
  504. clearable
  505. style="width: 100%;"
  506. v-model.trim="tableFormDataObj[scope.row.itemid + '-' + scope.row.clock + '-' + scope.row.timegranid].apportvalue"
  507. @change="tableFormDataObj[scope.row.itemid + '-' + scope.row.clock + '-' + scope.row.timegranid].correctvalue = floatComputed(tableFormDataObj[scope.row.itemid + '-' + scope.row.clock + '-' + scope.row.timegranid].apportvalue, scope.row.actualvalue, '-')"
  508. ></el-input>
  509. <template
  510. slot="error"
  511. slot-scope="scope"
  512. >
  513. <p
  514. class="error"
  515. :title="scope.error"
  516. >{{ scope.error }}</p>
  517. </template>
  518. </el-form-item>
  519. <span v-else>{{scope.row.apportvalue}}</span>
  520. </template>
  521. </el-table-column>
  522. <!-- <el-table-column
  523. sortable
  524. prop="sumvalue"
  525. label="累计值"
  526. min-width="100px"
  527. :show-overflow-tooltip="true"
  528. > </el-table-column> -->
  529. <el-table-column
  530. sortable
  531. prop="updatereason"
  532. label="修改原因"
  533. min-width="100px"
  534. :show-overflow-tooltip="true"
  535. > <template slot-scope="scope">
  536. <el-form-item
  537. v-if="scope.row.isSelection"
  538. :prop="scope.row.itemid + '-' + scope.row.clock + '-' + scope.row.timegranid + '.updatereason'"
  539. :rules="dialog.editorBox.form.rules.updatereason"
  540. >
  541. <el-input
  542. clearable
  543. style="width: 100%;"
  544. v-model.trim="tableFormDataObj[scope.row.itemid + '-' + scope.row.clock + '-' + scope.row.timegranid].updatereason"
  545. ></el-input>
  546. <template
  547. slot="error"
  548. slot-scope="scope"
  549. >
  550. <p
  551. class="error"
  552. :title="scope.error"
  553. >{{ scope.error }}</p>
  554. </template>
  555. </el-form-item>
  556. <span v-else>{{scope.row.updatereason}}</span>
  557. </template>
  558. </el-table-column>
  559. <el-table-column
  560. sortable
  561. prop="bz"
  562. label="备注"
  563. min-width="100px"
  564. :show-overflow-tooltip="true"
  565. > <template slot-scope="scope">
  566. <el-form-item
  567. v-if="scope.row.isSelection"
  568. :prop="scope.row.itemid + '-' + scope.row.clock + '-' + scope.row.timegranid + '.bz'"
  569. :rules="dialog.editorBox.form.rules.bz"
  570. >
  571. <el-input
  572. clearable
  573. style="width: 100%;"
  574. v-model.trim="tableFormDataObj[scope.row.itemid + '-' + scope.row.clock + '-' + scope.row.timegranid].bz"
  575. ></el-input>
  576. <template
  577. slot="error"
  578. slot-scope="scope"
  579. >
  580. <p
  581. class="error"
  582. :title="scope.error"
  583. >{{ scope.error }}</p>
  584. </template>
  585. </el-form-item>
  586. <span v-else>{{scope.row.bz}}</span>
  587. </template>
  588. </el-table-column>
  589. <el-table-column
  590. sortable
  591. prop="rectime"
  592. label="创建时间"
  593. min-width="120px"
  594. :show-overflow-tooltip="true"
  595. ></el-table-column>
  596. <el-table-column
  597. sortable
  598. prop="updateUser"
  599. label="创建人"
  600. min-width="80px"
  601. :show-overflow-tooltip="true"
  602. ></el-table-column>
  603. <el-table-column
  604. sortable
  605. prop="updateman"
  606. label="修改人"
  607. width="65px"
  608. :show-overflow-tooltip="true"
  609. ></el-table-column>
  610. <el-table-column
  611. sortable
  612. prop="updatetime"
  613. label="修改时间"
  614. width="125px"
  615. :show-overflow-tooltip="true"
  616. ></el-table-column>
  617. <!-- <el-table-column
  618. class-name="gn-TableDownloadExcel-none"
  619. label="操作"
  620. align="center"
  621. width="70px"
  622. fixed="right"
  623. >
  624. <template slot-scope="scope">
  625. <div>
  626. <el-button
  627. type="primary"
  628. size="mini"
  629. v-privilege="activeMenu + 'PUT'"
  630. @click="but_edit(scope.row)"
  631. >修改</el-button>
  632. </div>
  633. </template>
  634. </el-table-column> -->
  635. </el-table>
  636. </el-form>
  637. <el-pagination
  638. layout="total, sizes, prev, pager, next, jumper"
  639. :total="total"
  640. :page-sizes="[10, 20, 50, 100, 500, 1000]"
  641. :page-size="pageSize"
  642. :current-page.sync="pageNum"
  643. @size-change="tableSizeChange"
  644. @current-change="getTableData()"
  645. style="text-align: right;margin-top: 10px;"
  646. ></el-pagination>
  647. </div>
  648. </div>
  649. <!-- <el-dialog
  650. :title="'计量点数据 - ' + (dialog.editorBox.type === 'add' ? '新增' : '修改')"
  651. :visible.sync="dialog.editorBox.show"
  652. width="600px"
  653. :close-on-click-modal="false"
  654. :show-close="!loading"
  655. >
  656. <div>
  657. <el-form
  658. ref="dialog_form"
  659. :model="dialog.editorBox.form.data"
  660. :rules="dialog.editorBox.form.rules"
  661. size="mini"
  662. label-width="70px"
  663. >
  664. <el-form-item label="计算值">
  665. <el-input clearable
  666. style="width: 100%;"
  667. v-model="dialog.editorBox.form.data.actualvalue"
  668. readonly
  669. ></el-input>
  670. </el-form-item>
  671. <el-form-item label="修正值" prop="correctvalue">
  672. <el-input clearable
  673. style="width: 100%;"
  674. v-model="dialog.editorBox.form.data.correctvalue"
  675. @change="dialog.editorBox.form.data.apportvalue = floatComputed(dialog.editorBox.form.data.actualvalue, dialog.editorBox.form.data.correctvalue, '+')"
  676. ></el-input>
  677. </el-form-item>
  678. <el-form-item label="最终值" prop="apportvalue">
  679. <el-input clearable
  680. style="width: 100%;"
  681. v-model="dialog.editorBox.form.data.apportvalue"
  682. @change="dialog.editorBox.form.data.correctvalue = floatComputed(dialog.editorBox.form.data.apportvalue, dialog.editorBox.form.data.actualvalue, '-')"
  683. ></el-input>
  684. </el-form-item>
  685. <el-form-item label="备注" prop="bz">
  686. <el-input clearable
  687. style="width: 100%;"
  688. v-model="dialog.editorBox.form.data.bz"
  689. ></el-input>
  690. </el-form-item>
  691. <el-form-item label="修改原因" prop="updatereason">
  692. <el-input clearable
  693. style="width: 100%;"
  694. v-model="dialog.editorBox.form.data.updatereason"
  695. ></el-input>
  696. </el-form-item>
  697. </el-form>
  698. </div>
  699. <span
  700. slot="footer"
  701. class="dialog-footer"
  702. >
  703. <el-button @click="dialog.editorBox.show = false" :loading="loading">取 消</el-button>
  704. <el-button
  705. type="primary"
  706. @click="dataSave"
  707. :loading="loading"
  708. >保 存</el-button>
  709. </span>
  710. </el-dialog> -->
  711. <el-dialog
  712. title="趋势图"
  713. :visible.sync="dialog.trendChart.show"
  714. width="900px"
  715. :close-on-click-modal="false"
  716. :show-close="!loading"
  717. >
  718. <div>
  719. <el-form
  720. label-width="83px"
  721. size="mini"
  722. inline
  723. >
  724. <!-- <el-form-item label="查看连续周期">
  725. <el-checkbox></el-checkbox>
  726. </el-form-item> -->
  727. <el-form-item label="图表类型">
  728. <el-select
  729. filterable
  730. clearable
  731. v-model="dialog.trendChart.form.data.chartSeriesType"
  732. @change="chartSeriesType"
  733. >
  734. <el-option
  735. value="bar"
  736. label="柱状图"
  737. ></el-option>
  738. <el-option
  739. value="line"
  740. label="折线图"
  741. ></el-option>
  742. </el-select>
  743. </el-form-item>
  744. <el-form-item label="业务日期(前)">
  745. <el-input-number
  746. v-model="dialog.trendChart.size"
  747. @change="getTrendChart()"
  748. :min="1"
  749. :max="365"
  750. label=""
  751. >
  752. </el-input-number>
  753. </el-form-item>
  754. <span>天</span>
  755. </el-form>
  756. <div style="min-height: 400px;">
  757. <icore-graphical
  758. ref="graphical"
  759. v-if="dialog.trendChart.show && dialog.trendChart.chart.show"
  760. :option="dialog.trendChart.chart.option"
  761. :width="'100%'"
  762. :height="'400px'"
  763. >
  764. </icore-graphical>
  765. </div>
  766. </div>
  767. <span
  768. slot="footer"
  769. class="dialog-footer"
  770. >
  771. <el-button @click="dialog.trendChart.show = false">取 消</el-button>
  772. </span>
  773. </el-dialog>
  774. </div>
  775. </template>
  776. <script>
  777. import { zCheckNumber1 } from '~/utils/validator.js'
  778. import store from '@/store/index.js';
  779. import timegranDate from '@/components/zg/timegranDate.vue'
  780. import { formatDate, XtcommonSummaries } from '@/utils/util.js';
  781. export default {
  782. name: 'measuringLocationAdd',
  783. components: {
  784. 'zj-timegran-date': timegranDate
  785. },
  786. data () {
  787. return {
  788. multipleSelection: [],
  789. tableFormDataObj: {},
  790. store,
  791. userInfo: {
  792. data: null
  793. },
  794. activeMenu: '',
  795. filterForm: {
  796. show: true,
  797. data: {
  798. itemtype: '',
  799. clock: '',
  800. energytypeid: '',
  801. energyid: '',
  802. timegranid: '',
  803. locateid: '',
  804. itemid: '',
  805. itemname: '',
  806. networkid: '',
  807. hierarchy: '',
  808. tagAlias: '',
  809. propertyid: ''
  810. },
  811. disabled: {
  812. locateid: false
  813. },
  814. rules: {
  815. }
  816. },
  817. pageNum: 1,
  818. pageSize: 20,
  819. total: 0,
  820. singleTableHeight: 200,
  821. tableData: [],
  822. nameObj: {
  823. workprocid: {
  824. obj: {},
  825. arr: []
  826. },
  827. timegranid: {
  828. obj: {},
  829. arr: []
  830. },
  831. energytypeid: {
  832. obj: {},
  833. arr: []
  834. },
  835. energyid: {
  836. obj: {},
  837. arr: []
  838. },
  839. propertyid: {
  840. obj: {},
  841. arr: []
  842. },
  843. itemtype: {
  844. obj: {
  845. 'AUTO': '自动上传',
  846. 'MANUAL': '手抄',
  847. 'VIRTUAL': '虚拟'
  848. },
  849. arr: [
  850. {
  851. id: 'AUTO',
  852. name: '自动上传'
  853. },
  854. {
  855. id: 'MANUAL',
  856. name: '手抄'
  857. },
  858. {
  859. id: 'VIRTUAL',
  860. name: '虚拟'
  861. }
  862. ]
  863. },
  864. locateid: {
  865. obj: {},
  866. arr: []
  867. },
  868. networkid: {
  869. obj: {},
  870. arr: []
  871. },
  872. hierarchy: {
  873. obj: {},
  874. arr: []
  875. },
  876. unitid: {
  877. obj: {},
  878. arr: []
  879. }
  880. },
  881. loading: false,
  882. tableLoading: false,
  883. dialog: {
  884. editorBox: {
  885. show: false,
  886. type: '',
  887. form: {
  888. data: {
  889. itemid: '',
  890. correctvalue: '',
  891. apportvalue: '',
  892. bz: '',
  893. updatereason: ''
  894. },
  895. rules: {
  896. correctvalue: [
  897. { required: true, message: '该项不能为空', trigger: 'change' },
  898. { validator: zCheckNumber1, trigger: 'change' }
  899. ],
  900. apportvalue: [
  901. { required: true, message: '该项不能为空', trigger: 'change' },
  902. { validator: zCheckNumber1, trigger: 'change' }
  903. ],
  904. update_reason: [
  905. { required: true, message: '该项不能为空', trigger: 'change' }
  906. ]
  907. }
  908. }
  909. },
  910. trendChart: {
  911. show: false,
  912. size: 7,
  913. form: {
  914. data: {
  915. chartSeriesType: 'bar'
  916. }
  917. },
  918. chart: {
  919. show: true,
  920. option: {
  921. tooltip: {
  922. trigger: 'axis'
  923. },
  924. legend: {
  925. data: []
  926. },
  927. toolbox: {
  928. feature: {
  929. saveAsImage: {}
  930. }
  931. },
  932. xAxis: {
  933. type: 'category',
  934. data: []
  935. },
  936. yAxis: {
  937. type: 'value'
  938. },
  939. series: [
  940. // {
  941. // name: '计量点1号',
  942. // type: 'bar',
  943. // data: [1230, 2234, 3000, 4500, 3120]
  944. // },
  945. // {
  946. // name: '计量点2号',
  947. // type: 'bar',
  948. // data: [1980, 1200, 3200, 2300, 3212]
  949. // }
  950. ]
  951. }
  952. }
  953. }
  954. }
  955. }
  956. },
  957. created () {
  958. this.activeMenu = window.localStorage.getItem('activeMenu');
  959. },
  960. mounted () {
  961. let that = this;
  962. window.PEDataObj = {
  963. // 将数据绑定到window上,供main页面使用
  964. vm: that,
  965. // tableArr:用于导出成Excel的表格的信息
  966. tableArr: [
  967. {
  968. name: '',
  969. id: 'singleTable'
  970. }
  971. ]
  972. };
  973. that.$nextTick(() => {
  974. // 立即获取的height有一定偏差,通过setTimeout延迟来解决
  975. setTimeout(() => {
  976. that.singleTableHeight = that.getRoleHeight(that.$refs['singleTable'].$el) - 45;
  977. }, 1);
  978. });
  979. that.store.dispatch('getUserInfo').then((res) => {
  980. that.userInfo.data = res.data;
  981. });
  982. // 接收路由参数
  983. if (that.$route.query.locateid) {
  984. that.filterForm.disabled.locateid = true;
  985. that.filterForm.data.locateid = that.$route.query.locateid;
  986. }
  987. if (that.$route.query.timegranid) {
  988. that.filterForm.data.timegranid = that.$route.query.timegranid;
  989. }
  990. if (that.$route.query.itemtype) {
  991. that.filterForm.data.itemtype = that.$route.query.itemtype;
  992. }
  993. that.getTimeGranData();
  994. that.getEnergyTypeIdData();
  995. that.getEnergyIdData();
  996. that.getLocateIdData();
  997. that.getNetworkIdData();
  998. that.getworkprocidData();
  999. that.getHierarchyData();
  1000. that.getUnitIdData();
  1001. that.getPropertyIdData();
  1002. // that.getTableData();
  1003. },
  1004. methods: {
  1005. // 计算树区域高度
  1006. getRoleHeight (dom) {
  1007. return window.innerHeight - dom.offsetTop;
  1008. },
  1009. // 自定义的表格合计方法:只给指定列进行合计
  1010. getSummaries (param) {
  1011. const prop = ['actualvalue', 'correctvalue', 'apportvalue', 'sumvalue']; // 合计列绑定的prop
  1012. return XtcommonSummaries(param, prop);
  1013. },
  1014. // 获取时间粒度(计量点数据录入)
  1015. getTimeGranData () {
  1016. let that = this
  1017. let url = 'pass/ems/v1/tcmdatasourcetimegrans/getTimegranRmCalpointValue';
  1018. that.axios.get(url)
  1019. .then(function (res) {
  1020. if (res.code === '0') {
  1021. let arr = [];
  1022. let obj = {};
  1023. for (let item of res.data) {
  1024. arr.push({
  1025. id: item.TIMEGRANID,
  1026. name: item.NAME
  1027. })
  1028. obj[item.TIMEGRANID] = item.NAME;
  1029. that.filterForm.data.timegranid = that.filterForm.data.timegranid ? that.filterForm.data.timegranid : item.TIMEGRANID;
  1030. }
  1031. that.nameObj.timegranid.arr = arr;
  1032. that.nameObj.timegranid.obj = obj;
  1033. } else {
  1034. that.$message.error(res.message);
  1035. }
  1036. });
  1037. },
  1038. // 获取能介类型
  1039. getEnergyTypeIdData () {
  1040. let that = this
  1041. let url = 'pass/ems/v1/trmenergytypes/selectNameAndId/';
  1042. that.axios.get(url)
  1043. .then(function (res) {
  1044. if (res.code === '0') {
  1045. let arr = [];
  1046. let obj = {};
  1047. for (let item of res.data) {
  1048. arr.push({
  1049. id: item.id,
  1050. name: item.name
  1051. })
  1052. obj[item.id] = item.name;
  1053. }
  1054. that.nameObj.energytypeid.arr = arr;
  1055. that.nameObj.energytypeid.obj = obj;
  1056. } else {
  1057. that.$message.error(res.message);
  1058. }
  1059. });
  1060. },
  1061. // 获取能介
  1062. getEnergyIdData () {
  1063. let that = this;
  1064. let url = 'pass/ems/v1/trmenergys/selectNameAndId/';
  1065. that.axios.get(url)
  1066. .then(function (res) {
  1067. if (res.code === '0') {
  1068. let arr = [];
  1069. let obj = {};
  1070. for (let item of res.data) {
  1071. arr.push({
  1072. id: item.id,
  1073. name: item.name,
  1074. energytypeid: item.energytypeid,
  1075. unitid: item.unitid
  1076. })
  1077. obj[item.id] = {
  1078. name: item.name,
  1079. unitid: item.unitid
  1080. }
  1081. }
  1082. that.nameObj.energyid.arr = arr;
  1083. that.nameObj.energyid.obj = obj;
  1084. } else {
  1085. that.$message.error(res.message);
  1086. }
  1087. });
  1088. },
  1089. // 获取位置
  1090. getLocateIdData () {
  1091. let that = this
  1092. let url = 'pass/ems/v1/trmlocations/getidandname/';
  1093. that.axios.get(url)
  1094. .then(function (res) {
  1095. if (res.code === '0') {
  1096. let arr = [];
  1097. let obj = {};
  1098. for (let item of res.data) {
  1099. arr.push({
  1100. id: item.id,
  1101. name: item.name
  1102. })
  1103. obj[item.id] = item.name;
  1104. }
  1105. that.nameObj.locateid.arr = arr;
  1106. that.nameObj.locateid.obj = obj;
  1107. } else {
  1108. that.$message.error(res.message);
  1109. }
  1110. });
  1111. },
  1112. // 获取站所
  1113. getNetworkIdData () {
  1114. let that = this
  1115. let url = 'pass/ems/v1/trmstations/getidandname/';
  1116. that.axios.get(url)
  1117. .then(function (res) {
  1118. if (res.code === '0') {
  1119. let arr = [];
  1120. let obj = {};
  1121. for (let item of res.data) {
  1122. arr.push({
  1123. id: item.id,
  1124. name: item.name
  1125. })
  1126. obj[item.id] = item.name;
  1127. }
  1128. that.nameObj.networkid.arr = arr;
  1129. that.nameObj.networkid.obj = obj;
  1130. } else {
  1131. that.$message.error(res.message);
  1132. }
  1133. });
  1134. },
  1135. // 获取计量层级
  1136. getHierarchyData () {
  1137. let that = this
  1138. let url = 'pass/ems/v1/trmcalpoints/getRmCalpoint/';
  1139. that.axios.get(url)
  1140. .then(function (res) {
  1141. if (res.code === '0') {
  1142. let arr = [];
  1143. let obj = {};
  1144. for (let item of res.data) {
  1145. arr.push({
  1146. id: item.id,
  1147. name: item.name
  1148. })
  1149. obj[item.id] = item.name;
  1150. }
  1151. that.nameObj.hierarchy.arr = arr;
  1152. that.nameObj.hierarchy.obj = obj;
  1153. } else {
  1154. that.$message.error(res.message);
  1155. }
  1156. });
  1157. },
  1158. // 获取标准计量单位
  1159. getUnitIdData () {
  1160. let that = this
  1161. let url = 'pass/ems/v1/trmunits/getIdAndName';
  1162. that.axios.get(url)
  1163. .then(function (res) {
  1164. if (res.code === '0') {
  1165. let arr = [];
  1166. let obj = {};
  1167. for (let item of res.data) {
  1168. arr.push({
  1169. id: item.id,
  1170. name: item.name
  1171. })
  1172. obj[item.id] = item.name;
  1173. if (item.name === '吨') {
  1174. that.nameObj.unitid.defaults = that.nameObj.unitid.defaults ? that.nameObj.unitid.defaults : item.id;
  1175. }
  1176. }
  1177. that.nameObj.unitid.arr = arr;
  1178. that.nameObj.unitid.obj = obj;
  1179. } else {
  1180. that.$message.error(res.message);
  1181. }
  1182. });
  1183. },
  1184. // 获取属性
  1185. getPropertyIdData () {
  1186. let that = this
  1187. let url = 'pass/ems/v1/trmenergypropertys/getidandname/';
  1188. that.axios.get(url)
  1189. .then(function (res) {
  1190. if (res.code === '0') {
  1191. let arr = [];
  1192. let obj = {};
  1193. for (let item of res.data) {
  1194. arr.push({
  1195. id: item.id,
  1196. name: item.name
  1197. })
  1198. obj[item.id] = item.name;
  1199. }
  1200. that.nameObj.propertyid.arr = arr;
  1201. that.nameObj.propertyid.obj = obj;
  1202. } else {
  1203. that.$message.error(res.message);
  1204. }
  1205. });
  1206. },
  1207. // 获取表格中的数据
  1208. getTableData (pageNum) {
  1209. let that = this,
  1210. params = {
  1211. itemtype: that.filterForm.data.itemtype,
  1212. clock: that.filterForm.data.clock[0],
  1213. clocke: that.filterForm.data.clock[1],
  1214. energytypeid: that.filterForm.data.energytypeid,
  1215. energyid: that.filterForm.data.energyid.toString(),
  1216. timegranid: that.filterForm.data.timegranid,
  1217. locateid: that.filterForm.data.locateid.toString(),
  1218. itemid: that.filterForm.data.itemid,
  1219. itemname: that.filterForm.data.itemname,
  1220. networkid: that.filterForm.data.networkid.toString(),
  1221. hierarchy: that.filterForm.data.hierarchy,
  1222. tagAlias: that.filterForm.data.tagAlias,
  1223. propertyid: that.filterForm.data.propertyid.toString(),
  1224. costid: that.filterForm.data.costid.join(',')
  1225. };
  1226. that.pageNum = pageNum || that.pageNum;
  1227. that.tableLoading = true;
  1228. let url = 'pass/ems/v1/trmcalpoints/getDate312ForPage?pageNum=' + that.pageNum + '&pageSize=' + that.pageSize;
  1229. that.axios.get(url, {
  1230. params: params
  1231. })
  1232. .then(function (res) {
  1233. if (res.code === '0') {
  1234. let arr = [];
  1235. for (let item of res.data.list) {
  1236. arr.push({
  1237. itemid: item.ITEMID,
  1238. clock: item.CLOCK,
  1239. itemname: item.ITEMNAME,
  1240. tagAlias: item.TAG_ALIAS,
  1241. tagModulus: item.TAG_MODULUS,
  1242. unitid: item.UNITID,
  1243. mintvalue: item.MINTVALUE,
  1244. mendvalue: item.MENDVALUE,
  1245. actualvalue: item.ACTUALVALUE,
  1246. correctvalue: item.CORRECTVALUE,
  1247. apportvalue: item.APPORTVALUE,
  1248. sumvalue: item.SUMVALUE,
  1249. bz: item.BZ,
  1250. updatereason: item.UPDATE_REASON,
  1251. rectime: item.REC_TIME,
  1252. updateUser: item.UPDATE_USER,
  1253. ename: item.ENAME,
  1254. lname: item.LNAME,
  1255. updateman: item.UPMAN,
  1256. updatetime: item.UPTIME,
  1257. costid: item.COSTID,
  1258. // 暂时没显示
  1259. itemtype: item.ITEMTYPE,
  1260. timegranid: item.TIMEGRANID,
  1261. propertyid: that.nameObj.propertyid.obj[item.PROPERTYID]
  1262. })
  1263. }
  1264. that.tableData = arr;
  1265. that.total = res.data.total;
  1266. } else {
  1267. that.$message.error(res.message);
  1268. }
  1269. that.tableLoading = false;
  1270. that.$nextTick(() => {
  1271. setTimeout(() => {
  1272. that.singleTableHeight = that.getRoleHeight(that.$refs['singleTable'].$el) - 46;
  1273. }, 1);
  1274. });
  1275. }).catch(function () {
  1276. that.tableLoading = false;
  1277. });
  1278. },
  1279. // 改变表格显示条数
  1280. tableSizeChange (val) {
  1281. let that = this;
  1282. that.pageSize = val;
  1283. that.getTableData(1);
  1284. },
  1285. // 重置搜索
  1286. tableDataCancel () {
  1287. let that = this;
  1288. for (let key in that.filterForm.data) {
  1289. if (!that.filterForm.disabled || !that.filterForm.disabled[key]) {
  1290. if (that.filterForm.data[key] instanceof Array) {
  1291. that.filterForm.data[key] = [];
  1292. } else {
  1293. that.filterForm.data[key] = '';
  1294. }
  1295. }
  1296. }
  1297. that.getTableData(1);
  1298. },
  1299. // 批量修改
  1300. but_edit_plural () {
  1301. let that = this;
  1302. if (that.multipleSelection.length > 0) {
  1303. that.$refs['dialog_form_arr'].validate((valid, msg) => {
  1304. if (valid) {
  1305. let SubmitData = [];
  1306. for (let key in that.tableFormDataObj) {
  1307. SubmitData.push({
  1308. clock: that.tableFormDataObj[key].clock,
  1309. timegranid: that.tableFormDataObj[key].timegranid,
  1310. itemid: that.tableFormDataObj[key].itemid,
  1311. actualvalue: that.tableFormDataObj[key].actualvalue,
  1312. correctvalue: that.tableFormDataObj[key].correctvalue,
  1313. apportvalue: that.tableFormDataObj[key].apportvalue,
  1314. updatereason: that.tableFormDataObj[key].updatereason,
  1315. bz: that.tableFormDataObj[key].bz
  1316. });
  1317. }
  1318. that.loading = true;
  1319. that.axios.put('pass/ems/v1/trmcalpointvalues/batchupdate', SubmitData)
  1320. .then(function (res) {
  1321. if (res.code === '0') {
  1322. that.$message({
  1323. message: '修改成功',
  1324. type: 'success'
  1325. });
  1326. that.getTableData();
  1327. that.dialog.editorBox.show = false;
  1328. } else {
  1329. that.$message.error(res.message);
  1330. }
  1331. that.loading = false;
  1332. }).catch(function () {
  1333. that.loading = false;
  1334. });
  1335. } else {
  1336. let col = Object.keys(msg)[0].split('.')[1];
  1337. if (col && col === 'CORRECTVALUE') {
  1338. this.$message.error('请填写正确的修正值');
  1339. } else if (col && col === 'APPORTVALUE') {
  1340. this.$message.error('请填写正确的最终值');
  1341. } else {
  1342. this.$message.error('数据不完整或者格式错误');
  1343. }
  1344. }
  1345. });
  1346. } else {
  1347. this.$message.error('至少要选择一条数据');
  1348. }
  1349. },
  1350. // 批量重新计算(由小时表数据计算而来)
  1351. but_re_compute () {
  1352. let that = this;
  1353. if (that.multipleSelection.length > 0) {
  1354. that.$refs['dialog_form_arr'].validate((valid) => {
  1355. if (valid) {
  1356. let SubmitData = {};
  1357. for (let key in that.tableFormDataObj) {
  1358. SubmitData = {
  1359. clock: that.filterForm.data.clock[0],
  1360. clocke: that.filterForm.data.clock[1],
  1361. timegranid: that.tableFormDataObj[key].timegranid,
  1362. itemid: that.tableFormDataObj[key].itemid,
  1363. tb: 'hour',
  1364. energytypeid: that.tableFormDataObj[key].energytypeid,
  1365. energyid: that.tableFormDataObj[key].energyid,
  1366. locateid: that.tableFormDataObj[key].locateid,
  1367. itemname: that.tableFormDataObj[key].itemname,
  1368. networkid: that.tableFormDataObj[key].networkid,
  1369. tagAlias: that.tableFormDataObj[key].tagAlias,
  1370. propertyid: that.tableFormDataObj[key].propertyid
  1371. }
  1372. // SubmitData.push({
  1373. // clock: that.tableFormDataObj[key].clock,
  1374. // timegranid: that.tableFormDataObj[key].timegranid,
  1375. // itemid: that.tableFormDataObj[key].itemid
  1376. // });
  1377. }
  1378. that.loading = true;
  1379. that.axios.get('pass/ems/v1/trmactvalues/reDatas', {
  1380. params: SubmitData
  1381. })
  1382. .then(function (res) {
  1383. if (res.code === '0') {
  1384. that.$message({
  1385. message: '重新计算成功',
  1386. type: 'success'
  1387. });
  1388. that.getTableData();
  1389. that.dialog.editorBox.show = false;
  1390. } else {
  1391. that.$message.error(res.message);
  1392. }
  1393. that.loading = false;
  1394. }).catch(function () {
  1395. that.loading = false;
  1396. });
  1397. }
  1398. });
  1399. } else {
  1400. this.$message.error('至少要选择一条数据');
  1401. }
  1402. },
  1403. // but_edit (row) {
  1404. // let that = this;
  1405. // that.dialog.editorBox.form.data.itemid = row.itemid;
  1406. // that.dialog.editorBox.form.data.clock = row.clock;
  1407. // that.dialog.editorBox.form.data.timegranid = row.timegranid;
  1408. // that.dialog.editorBox.form.data.actualvalue = row.actualvalue;
  1409. // that.dialog.editorBox.form.data.correctvalue = row.correctvalue;
  1410. // that.dialog.editorBox.form.data.apportvalue = row.apportvalue;
  1411. // that.dialog.editorBox.form.data.bz = row.bz;
  1412. // that.dialog.editorBox.form.data.updatereason = row.updatereason;
  1413. // that.dialog.editorBox.type = 'edit';
  1414. // that.dialog.editorBox.show = true;
  1415. // },
  1416. // dataSave () {
  1417. // let that = this;
  1418. // let SubmitData = {
  1419. // itemid: that.dialog.editorBox.form.data.itemid,
  1420. // clock: that.dialog.editorBox.form.data.clock,
  1421. // timegranid: that.dialog.editorBox.form.data.timegranid,
  1422. // actualvalue: that.dialog.editorBox.form.data.actualvalue,
  1423. // correctvalue: that.dialog.editorBox.form.data.correctvalue,
  1424. // apportvalue: that.dialog.editorBox.form.data.apportvalue,
  1425. // bz: that.dialog.editorBox.form.data.bz,
  1426. // update_reason: that.dialog.editorBox.form.data.updatereason,
  1427. // update_user: that.userInfo.data.userCode
  1428. // };
  1429. // that.$refs['dialog_form'].validate((valid) => {
  1430. // if (valid) {
  1431. // that.loading = true;
  1432. // that.axios.put('pass/ems/v1/trmcalpointvalues/update', SubmitData)
  1433. // .then(function (res) {
  1434. // if (res.code === '0') {
  1435. // that.$message({
  1436. // message: '修改成功',
  1437. // type: 'success'
  1438. // });
  1439. // that.getTableData();
  1440. // that.dialog.editorBox.show = false;
  1441. // } else {
  1442. // that.$message.error(res.message);
  1443. // }
  1444. // that.loading = false;
  1445. // }).catch(function () {
  1446. // that.loading = false;
  1447. // });
  1448. // }
  1449. // });
  1450. // },
  1451. // 表格中多选按钮的相关方法
  1452. handleSelectionChange (val) {
  1453. let that = this;
  1454. let tableFormDataObj = {};
  1455. for (let item of that.tableData) {
  1456. item.isSelection = false;
  1457. }
  1458. for (let item of val) {
  1459. let obj = {};
  1460. let xId = item.itemid + '-' + item.clock + '-' + item.timegranid;
  1461. if (that.tableFormDataObj[xId]) {
  1462. tableFormDataObj[xId] = that.tableFormDataObj[xId];
  1463. } else {
  1464. for (let key in item) {
  1465. obj[key] = item[key];
  1466. }
  1467. tableFormDataObj[xId] = obj;
  1468. }
  1469. item.isSelection = true;
  1470. }
  1471. that.tableFormDataObj = tableFormDataObj;
  1472. that.multipleSelection = val;
  1473. },
  1474. look_trendChart () {
  1475. let that = this;
  1476. if (this.multipleSelection && this.multipleSelection.length > 0) {
  1477. that.getTrendChart();
  1478. that.dialog.trendChart.show = true;
  1479. } else {
  1480. this.$message.error('请选择计量点');
  1481. }
  1482. },
  1483. getTrendChart () {
  1484. let that = this;
  1485. let SubmitData = {
  1486. size: that.dialog.trendChart.size,
  1487. list: []
  1488. };
  1489. for (let item of that.multipleSelection) {
  1490. SubmitData.list.push({
  1491. itemid: item.itemid,
  1492. clock: that.filterForm.data.clock,
  1493. timegranid: that.filterForm.data.timegranid
  1494. });
  1495. }
  1496. let url = 'pass/ems/v1/trmcalpoints/getDate312ForChart';
  1497. that.axios.post(url, SubmitData, {
  1498. contentType: 'application/json'
  1499. })
  1500. .then(function (res) {
  1501. if (res.code === '0') {
  1502. let legendArr = [],
  1503. xAxisArr = [],
  1504. seriesArr = [];
  1505. for (let item of res.data) {
  1506. for (let key in item) {
  1507. let itemname = /\$.*$/.exec(key)[0].replace(/^\$/, '');
  1508. legendArr.push(itemname);
  1509. let seriesObj = {
  1510. name: itemname,
  1511. type: that.dialog.trendChart.form.data.chartSeriesType,
  1512. data: []
  1513. };
  1514. let clocks = [];
  1515. for (let item2 of item[key]) {
  1516. seriesObj.data.push(item2.APPORTVALUE);
  1517. clocks.push(item2.CLOCK);
  1518. }
  1519. seriesArr.push(seriesObj);
  1520. if (xAxisArr.length === 0) {
  1521. xAxisArr = clocks;
  1522. }
  1523. }
  1524. }
  1525. that.dialog.trendChart.chart.option.legend.data = legendArr;
  1526. that.dialog.trendChart.chart.option.xAxis.data = xAxisArr;
  1527. that.dialog.trendChart.chart.option.series = seriesArr;
  1528. // that.$refs['graphical'].setGraphical();
  1529. that.dialog.trendChart.chart.show = false;
  1530. setTimeout(() => {
  1531. that.dialog.trendChart.chart.show = true;
  1532. }, 100);
  1533. } else {
  1534. that.$message.error(res.message);
  1535. }
  1536. }).catch(function () {
  1537. });
  1538. },
  1539. // 获取工序
  1540. getworkprocidData () {
  1541. let that = this
  1542. let url = 'pass/ems/v1/trmworkprocs/getIdAndName';
  1543. that.axios.get(url)
  1544. .then(function (res) {
  1545. if (res.code === '0') {
  1546. let arr = [];
  1547. let obj = {};
  1548. for (let item of res.data) {
  1549. arr.push({
  1550. id: item.id,
  1551. name: item.name
  1552. })
  1553. obj[item.id] = item.name;
  1554. }
  1555. that.nameObj.workprocid.arr = arr;
  1556. that.nameObj.workprocid.obj = obj;
  1557. } else {
  1558. that.$message.error(res.message);
  1559. }
  1560. });
  1561. },
  1562. chartSeriesType () {
  1563. let that = this;
  1564. for (let item of that.dialog.trendChart.chart.option.series) {
  1565. item.type = that.dialog.trendChart.form.data.chartSeriesType;
  1566. }
  1567. // that.dialog.trendChart.chart.show = false;
  1568. // setTimeout(() => {
  1569. // that.dialog.trendChart.chart.show = true;
  1570. // }, 100);
  1571. that.$refs['graphical'].setGraphical();
  1572. },
  1573. // 重新生成数据
  1574. but_redata () {
  1575. let that = this;
  1576. if (!that.filterForm.data.clock || that.filterForm.data.clock.length === 0) {
  1577. that.$message.warning('请选择日期范围');
  1578. return true;
  1579. }
  1580. if (!that.filterForm.data.clock[0] || !that.filterForm.data.clock[1]) {
  1581. that.$message.warning('请选择开始日期与结束日期');
  1582. return true;
  1583. }
  1584. if (!that.filterForm.data.timegranid) {
  1585. that.$message.warning('请选择时间粒度');
  1586. return true;
  1587. }
  1588. let params = {
  1589. itemtype: that.filterForm.data.itemtype,
  1590. clock: that.filterForm.data.clock[0],
  1591. clocke: that.filterForm.data.clock[1],
  1592. energytypeid: that.filterForm.data.energytypeid,
  1593. energyid: that.filterForm.data.energyid.toString(),
  1594. timegranid: that.filterForm.data.timegranid,
  1595. locateid: that.filterForm.data.locateid.toString(),
  1596. itemid: that.filterForm.data.itemid,
  1597. itemname: that.filterForm.data.itemname,
  1598. networkid: that.filterForm.data.networkid.toString(),
  1599. tagAlias: that.filterForm.data.tagAlias,
  1600. propertyid: that.filterForm.data.propertyid.toString()
  1601. };
  1602. that.$confirm('是否重新生成数据?日期跨度不易太长!否则运行时间较长', '提示', {
  1603. confirmButtonText: '确定',
  1604. cancelButtonText: '取消',
  1605. state: 'warning'
  1606. }).then(() => {
  1607. that.loading = true;
  1608. let url = 'pass/ems/v1/trmcalpointvalues/reData'
  1609. that.axios.get(url, {
  1610. params: params
  1611. })
  1612. .then(function (res) {
  1613. if (res.code === '0') {
  1614. if (res.message && res.message !== '操作成功') {
  1615. that.$message.warning('重新生成数据成功, 其中【' + res.message + '】');
  1616. } else {
  1617. that.$message({
  1618. message: '重新生成数据成功',
  1619. type: 'success'
  1620. });
  1621. }
  1622. that.getTableData();
  1623. } else {
  1624. that.$message.error(res.message);
  1625. }
  1626. that.loading = false;
  1627. }).catch(function () {
  1628. that.loading = false;
  1629. });
  1630. }).catch(() => {
  1631. });
  1632. }
  1633. }
  1634. }
  1635. </script>
  1636. <style lang="less">
  1637. .measuringLocationAdd {
  1638. min-width: 700px;
  1639. height: 100%;
  1640. .box {
  1641. height: 100%;
  1642. padding: 15px 15px 0 15px;
  1643. .box-top {
  1644. .el-form-item {
  1645. margin-bottom: 7px;
  1646. }
  1647. .box-top-gjl {
  1648. overflow: hidden;
  1649. padding: 7px 0;
  1650. border-top: 1px solid #ccc;
  1651. // border-bottom: 1px solid #ccc;
  1652. // margin-bottom: 6px;
  1653. }
  1654. }
  1655. .el-table .el-table__row {
  1656. height: 35px;
  1657. }
  1658. .el-table__body .el-form-item--mini.el-form-item {
  1659. margin: 0px;
  1660. .error {
  1661. overflow: hidden;
  1662. color: #f56c6c;
  1663. font-size: 12px;
  1664. line-height: 1;
  1665. }
  1666. }
  1667. }
  1668. .attribute-box {
  1669. .item {
  1670. border: #ccc 1px solid;
  1671. padding: 5px;
  1672. margin-bottom: 6px;
  1673. .bt {
  1674. font-size: 14px;
  1675. font-weight: 600;
  1676. color: #000;
  1677. padding-left: 10px;
  1678. border-left: #008fe0 5px solid;
  1679. }
  1680. }
  1681. }
  1682. }
  1683. </style>