measuringLocationEntry.vue 80 KB

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