measuringLocationEntry.vue 80 KB

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