planProjectGeneration.vue 81 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843
  1. <template>
  2. <!-- 年度计划编制-发电厂 -->
  3. <!-- 当有审核与取消审核权限时,默认其为审核人,审核人无法修改数据 -->
  4. <div class="outElectricity">
  5. <div class="box">
  6. <div class="box-top">
  7. <el-form
  8. style="overflow: hidden;"
  9. :style="filterForm.show ? null : { height: '0px' }"
  10. size="mini"
  11. label-width="75px"
  12. >
  13. <el-row>
  14. <el-col :span="5">
  15. <!-- <el-form-item label="工序">
  16. <el-select
  17. filterable clearable
  18. v-model="filterForm.data.networkid"
  19. multiple
  20. collapse-tags
  21. placeholder="机焦厂"
  22. style="width: 100%;"
  23. disabled
  24. @change="connn()"
  25. >
  26. <el-option
  27. v-for="item of nameObj.networkid.arr"
  28. :key="item.id"
  29. :value="item.id"
  30. :label="item.name"
  31. ></el-option>
  32. </el-select>
  33. </el-form-item> -->
  34. </el-col>
  35. <el-col :span="6">
  36. <el-form-item label="年份">
  37. <zj-timegran-date
  38. v-model="filterForm.data.yearmonth"
  39. style="width: 100%;"
  40. :timegranId="'YEAR'"
  41. :oneFoo="getTableData"
  42. :custom="1"
  43. ></zj-timegran-date>
  44. </el-form-item>
  45. </el-col>
  46. <el-col :span="5">
  47. </el-col>
  48. <el-col :span="5">
  49. </el-col>
  50. </el-row>
  51. </el-form>
  52. <div class="box-top-gjl">
  53. <el-form size="mini" label-width="75px">
  54. <el-row>
  55. <el-col :span="16">
  56. <el-button
  57. class="button"
  58. type="primary"
  59. size="mini"
  60. icon="el-icon-plus"
  61. @click="but_add"
  62. :loading="loading"
  63. >新增</el-button>
  64. <el-button
  65. class="button"
  66. type="primary"
  67. size="mini"
  68. icon="el-icon-plus"
  69. @click="but_copy"
  70. :loading="loading"
  71. v-if="butPrivilege.PUT && !isCheck"
  72. >复制</el-button>
  73. <el-button
  74. class="button"
  75. type="primary"
  76. size="mini"
  77. icon="el-icon-edit-outline"
  78. @click="but_edit_plural()"
  79. :loading="loading"
  80. v-if="butPrivilege.PUT && !isCheck"
  81. >修改</el-button>
  82. <el-button
  83. class="button"
  84. type="danger"
  85. size="mini"
  86. icon="el-icon-delete"
  87. v-if="butPrivilege.PUT && !isCheck"
  88. @click="but_del_plural()"
  89. :loading="loading"
  90. >删除</el-button>
  91. <!-- 当有审核与取消审核权限时,默认其为审核人,审核人无法修改数据 -->
  92. <el-button
  93. class="button"
  94. type="primary"
  95. size="mini"
  96. icon="el-icon-view"
  97. @click="upState()"
  98. :loading="loading"
  99. v-if="butPrivilege.CHECK && isCheck"
  100. >审核</el-button>
  101. <el-button
  102. class="button"
  103. size="mini"
  104. icon="el-icon-refresh"
  105. @click="upState('1')"
  106. :loading="loading"
  107. v-if="butPrivilege.UNDOCHECK && isCheck"
  108. >撤销审核</el-button>
  109. </el-col>
  110. <el-col :span="8">
  111. <div style="float:right; text-align: right;">
  112. <el-button
  113. class="button"
  114. type="primary"
  115. size="mini"
  116. icon="el-icon-search"
  117. v-if="butPrivilege.QUERY"
  118. @click="getTableData(1)"
  119. >查询</el-button>
  120. <el-button
  121. size="mini"
  122. :icon="filterForm.show ? 'el-icon-caret-top' : 'el-icon-caret-bottom'"
  123. :title="filterForm.show ? '收起搜索区' : '展开搜索区'"
  124. @click="filterForm.show = !filterForm.show;
  125. $nextTick(() => {
  126. singleTableHeight = getRoleHeight($refs['singleTable'].$el) - 45;
  127. }
  128. );"
  129. >{{ filterForm.show ? '收起' : '展开' }}</el-button>
  130. </div>
  131. </el-col>
  132. </el-row>
  133. </el-form>
  134. </div>
  135. </div>
  136. <div class="box-bottom">
  137. <el-form
  138. size="mini"
  139. ref="dialog_form_arr"
  140. label-width="0px"
  141. :model="tableFormDataObj"
  142. >
  143. <el-table stripe
  144. id="singleTable"
  145. ref="singleTable"
  146. :data="tableData"
  147. v-loading="tableLoading"
  148. style="width: 100%;"
  149. :height="singleTableHeight"
  150. border
  151. size="mini"
  152. highlight-current-row
  153. @selection-change="handleSelectionChange"
  154. show-summary
  155. :summary-method="getSummaries"
  156. :span-method="arraySpanMethod"
  157. :row-class-name="tableRowClassName"
  158. @cell-click="cellClick"
  159. >
  160. <el-table-column
  161. type="selection"
  162. width="40"
  163. align="center"
  164. :selectable='checkboxT'
  165. fixed="left"
  166. class-name="cnspicuous"
  167. ></el-table-column>
  168. <el-table-column
  169. sortable
  170. prop="index"
  171. type="index"
  172. label="序号"
  173. fixed="left"
  174. width="50px"
  175. :show-overflow-tooltip="true"
  176. ></el-table-column>
  177. <el-table-column
  178. prop="yearmonth"
  179. label="月份"
  180. fixed="left"
  181. width="80px"
  182. :show-overflow-tooltip="true"
  183. ></el-table-column>
  184. <el-table-column
  185. fixed="left"
  186. prop="unit"
  187. label="计量单位"
  188. width="80px"
  189. :show-overflow-tooltip="true"
  190. >
  191. </el-table-column>
  192. <el-table-column
  193. label="煤气机组"
  194. >
  195. <el-table-column
  196. prop="weight"
  197. label="40MW"
  198. fixed="left"
  199. width="80px"
  200. :show-overflow-tooltip="true"
  201. ><template slot-scope="scope">
  202. <el-form-item
  203. v-if="!isCheck && scope.row.isSelection && scope.row.state !== '2'"
  204. :prop="scope.row.seq + '.weight'"
  205. >
  206. <el-input clearable
  207. v-for="(itemform, key) in tableFormDataObj[scope.row.seq].weight"
  208. style="width: 100%;"
  209. v-model="itemform['AT4002']"
  210. v-if="!isNaN(Number(itemform['AT4002']))"
  211. refcous="true"
  212. :rules="tableFormRules.weight"
  213. oninput="this.value = this.value.replace(/[^\d.]/g,'');"
  214. @keydown.native="keyDown" :id="scope.$index + scope.column.id"
  215. @change="chnageSecondVal(scope.row.seq, tableFormDataObj[scope.row.seq].secondVal, scope.$index)"
  216. :key="key"
  217. ></el-input>
  218. <template slot="error" slot-scope="scope">
  219. <p class="error" :title="scope.error">{{ scope.error }}</p>
  220. </template>
  221. </el-form-item>
  222. <span v-else v-for="(item, index) in tableData[scope.row.index].weight" :key="index">{{item['AT4002']}}</span>
  223. </template>
  224. </el-table-column>
  225. <el-table-column
  226. prop="weight"
  227. label="25MW"
  228. fixed="left"
  229. width="80px"
  230. :show-overflow-tooltip="true"
  231. ><template slot-scope="scope">
  232. <el-form-item
  233. v-if="!isCheck && scope.row.isSelection && scope.row.state !== '2'"
  234. :prop="scope.row.seq + '.weight'"
  235. >
  236. <el-input clearable
  237. v-for="(itemform, key) in tableFormDataObj[scope.row.seq].weight"
  238. style="width: 100%;"
  239. v-model="itemform['AT4001']"
  240. v-if="!isNaN(Number(itemform['AT4001']))"
  241. refcous="true"
  242. :rules="tableFormRules.weight"
  243. oninput="this.value = this.value.replace(/[^\d.]/g,'');"
  244. @keydown.native="keyDown" :id="scope.$index + scope.column.id"
  245. @change="chnageSecondVal(scope.row.seq, tableFormDataObj[scope.row.seq].secondVal, scope.$index)"
  246. :key="key"
  247. ></el-input>
  248. <template slot="error" slot-scope="scope">
  249. <p class="error" :title="scope.error">{{ scope.error }}</p>
  250. </template>
  251. </el-form-item>
  252. <span v-else v-for="(item, index) in tableData[scope.row.index].weight" :key="index">{{item['AT4001']}}</span>
  253. </template>
  254. </el-table-column>
  255. <el-table-column
  256. prop="weight"
  257. label="45MW"
  258. fixed="left"
  259. width="80px"
  260. :show-overflow-tooltip="true"
  261. ><template slot-scope="scope">
  262. <el-form-item
  263. v-if="!isCheck && scope.row.isSelection && scope.row.state !== '2'"
  264. :prop="scope.row.seq + '.weight'"
  265. >
  266. <el-input clearable
  267. v-for="(itemform, key) in tableFormDataObj[scope.row.seq].weight"
  268. style="width: 100%;"
  269. v-model="itemform['AT4003']"
  270. v-if="!isNaN(Number(itemform['AT4003']))"
  271. refcous="true"
  272. :rules="tableFormRules.weight"
  273. oninput="this.value = this.value.replace(/[^\d.]/g,'');"
  274. @keydown.native="keyDown" :id="scope.$index + scope.column.id"
  275. @change="chnageSecondVal(scope.row.seq, tableFormDataObj[scope.row.seq].secondVal, scope.$index)"
  276. :key="key"
  277. ></el-input>
  278. <template slot="error" slot-scope="scope">
  279. <p class="error" :title="scope.error">{{ scope.error }}</p>
  280. </template>
  281. </el-form-item>
  282. <span v-else v-for="(item, index) in tableData[scope.row.index].weight" :key="index">{{item['AT4003']}}</span>
  283. </template>
  284. </el-table-column>
  285. <!-- <el-table-column
  286. prop="weight"
  287. label="6MW"
  288. fixed="left"
  289. width="80px"
  290. :show-overflow-tooltip="true"
  291. ><template slot-scope="scope">
  292. <el-form-item
  293. v-if="!isCheck && scope.row.isSelection && scope.row.state !== '2'"
  294. :prop="scope.row.seq + '.weight'"
  295. >
  296. <el-input clearable
  297. v-for="(itemform, key) in tableFormDataObj[scope.row.seq].weight"
  298. style="width: 100%;"
  299. v-model="itemform['AT4008']"
  300. v-if="!isNaN(Number(itemform['AT4008']))"
  301. refcous="true"
  302. :rules="tableFormRules.weight"
  303. oninput="this.value = this.value.replace(/[^\d.]/g,'');"
  304. @keydown.native="keyDown" :id="scope.$index + scope.column.id"
  305. @change="chnageSecondVal(scope.row.seq, tableFormDataObj[scope.row.seq].secondVal, scope.$index)"
  306. :key="key"
  307. ></el-input>
  308. <template slot="error" slot-scope="scope">
  309. <p class="error" :title="scope.error">{{ scope.error }}</p>
  310. </template>
  311. </el-form-item>
  312. <span v-else v-for="(item, index) in tableData[scope.row.index].weight" :key="index">{{item['AT4008']}}</span>
  313. </template>
  314. </el-table-column>
  315. <el-table-column
  316. prop="weight"
  317. label="3MW"
  318. width="80px"
  319. :show-overflow-tooltip="true"
  320. ><template slot-scope="scope">
  321. <el-form-item
  322. v-if="!isCheck && scope.row.isSelection && scope.row.state !== '2'"
  323. :prop="scope.row.seq + '.weight'"
  324. >
  325. <el-input clearable
  326. v-for="(itemform, key) in tableFormDataObj[scope.row.seq].weight"
  327. style="width: 100%;"
  328. v-model="itemform['AT2022']"
  329. v-if="!isNaN(Number(itemform['AT2022']))"
  330. refcous="true"
  331. :rules="tableFormRules.weight"
  332. oninput="this.value = this.value.replace(/[^\d.]/g,'');"
  333. @keydown.native="keyDown" :id="scope.$index + scope.column.id"
  334. @change="chnageSecondVal(scope.row.seq, tableFormDataObj[scope.row.seq].secondVal, scope.$index)"
  335. :key="key"
  336. ></el-input>
  337. <template slot="error" slot-scope="scope">
  338. <p class="error" :title="scope.error">{{ scope.error }}</p>
  339. </template>
  340. </el-form-item>
  341. <span v-else v-for="(item, index) in tableData[scope.row.index].weight" :key="index">{{item['AT2022']}}</span>
  342. </template>
  343. </el-table-column> -->
  344. </el-table-column>
  345. <el-table-column
  346. prop="weight"
  347. label="15MW干熄焦"
  348. width="80px"
  349. :show-overflow-tooltip="true"
  350. ><template slot-scope="scope">
  351. <el-form-item
  352. v-if="!isCheck && scope.row.isSelection && scope.row.state !== '2'"
  353. :prop="scope.row.seq + '.weight'"
  354. >
  355. <el-input clearable
  356. v-for="(itemform, key) in tableFormDataObj[scope.row.seq].weight"
  357. style="width: 100%;"
  358. v-model="itemform['AT4004']"
  359. v-if="!isNaN(Number(itemform['AT4004']))"
  360. refcous="true"
  361. :rules="tableFormRules.weight"
  362. oninput="this.value = this.value.replace(/[^\d.]/g,'');"
  363. @keydown.native="keyDown" :id="scope.$index + scope.column.id"
  364. :key="key"
  365. ></el-input>
  366. <template slot="error" slot-scope="scope">
  367. <p class="error" :title="scope.error">{{ scope.error }}</p>
  368. </template>
  369. </el-form-item>
  370. <span v-else v-for="(item, index) in tableData[scope.row.index].weight" :key="index">{{item['AT4004']}}</span>
  371. </template>
  372. </el-table-column>
  373. <el-table-column
  374. prop="weight"
  375. label="TRT发电"
  376. width="80px"
  377. :show-overflow-tooltip="true"
  378. ><template slot-scope="scope">
  379. <el-form-item
  380. v-if="!isCheck && scope.row.isSelection && scope.row.state !== '2'"
  381. :prop="scope.row.seq + '.weight'"
  382. >
  383. <el-input clearable
  384. v-for="(itemform, key) in tableFormDataObj[scope.row.seq].weight"
  385. style="width: 100%;"
  386. v-model="itemform['AT3022']"
  387. v-if="!isNaN(Number(itemform['AT3022']))"
  388. refcous="true"
  389. :rules="tableFormRules.weight"
  390. oninput="this.value = this.value.replace(/[^\d.]/g,'');"
  391. @keydown.native="keyDown" :id="scope.$index + scope.column.id"
  392. :key="key"
  393. ></el-input>
  394. <template slot="error" slot-scope="scope">
  395. <p class="error" :title="scope.error">{{ scope.error }}</p>
  396. </template>
  397. </el-form-item>
  398. <span v-else v-for="(item, index) in tableData[scope.row.index].weight" :key="index">{{item['AT3022']}}</span>
  399. </template>
  400. </el-table-column>
  401. <el-table-column
  402. prop="total"
  403. label="产量合计"
  404. width="80px"
  405. :show-overflow-tooltip="true"
  406. ><template slot-scope="scope">
  407. <span v-if="!isCheck && scope.row.isSelection && scope.row.state !== '2'">{{ rowSum(scope.row) }}</span>
  408. <span v-else>{{ scope.row.total }}</span>
  409. </template></el-table-column>
  410. <el-table-column
  411. prop="cjsj"
  412. label="创建时间"
  413. width="160px"
  414. :show-overflow-tooltip="true"
  415. ></el-table-column>
  416. <el-table-column
  417. prop="cjr"
  418. label="创建人"
  419. width="80px"
  420. :show-overflow-tooltip="true"
  421. ></el-table-column>
  422. <el-table-column
  423. prop="xgsj"
  424. label="修改时间"
  425. width="160px"
  426. :show-overflow-tooltip="true"
  427. >
  428. </el-table-column>
  429. <el-table-column
  430. prop="xgr"
  431. label="修改人"
  432. width="80px"
  433. :show-overflow-tooltip="true"
  434. ></el-table-column>
  435. <el-table-column
  436. prop="memo"
  437. label="备注"
  438. width="280px"
  439. :show-overflow-tooltip="true"
  440. >
  441. <template slot-scope="scope">
  442. <el-form-item
  443. v-if="!isCheck && scope.row.isSelection && scope.row.state !== '2'"
  444. :prop="scope.row.seq + '.memo'"
  445. :rules="tableFormRules.memo"
  446. ><el-input clearable
  447. style="width: 100%;"
  448. v-model="tableFormDataObj[scope.row.seq].memo"
  449. refcous="true"
  450. @keydown.native="keyDown" :id="scope.$index + scope.column.id"
  451. @change="chnageSecondVal(scope.row.seq, tableFormDataObj[scope.row.seq].secondVal, scope.$index)"
  452. ></el-input>
  453. <template slot="error" slot-scope="scope">
  454. <p class="error" :title="scope.error">{{ scope.error }}</p>
  455. </template>
  456. </el-form-item>
  457. <span v-else>{{ scope.row.memo }}</span>
  458. </template>
  459. </el-table-column>
  460. <el-table-column
  461. prop="id"
  462. label="ID"
  463. width="140px"
  464. v-if="filterForm.data.show"
  465. ></el-table-column>
  466. </el-table>
  467. </el-form>
  468. <el-pagination
  469. layout="total, sizes, prev, pager, next, jumper"
  470. :total="total"
  471. :page-sizes="[10, 20, 50, 100, 500, 1000]"
  472. :page-size="pageSize"
  473. :current-page.sync="pageNum"
  474. @size-change="tableSizeChange"
  475. @current-change="getTableData()"
  476. style="text-align: right;margin-top: 10px;"
  477. ></el-pagination>
  478. </div>
  479. </div>
  480. <el-dialog
  481. title="年计划编制-发电 新增"
  482. :visible.sync="dialog.editorBox.show"
  483. width="600px"
  484. :close-on-click-modal="false"
  485. :show-close="!loading"
  486. >
  487. <div>
  488. <el-form
  489. :model="dialog.editorBox.form.data"
  490. ref="dialog_form"
  491. size="mini"
  492. label-width="95px"
  493. :rules="dialog.editorBox.form.rules"
  494. >
  495. <el-row>
  496. <el-col :span="12">
  497. <el-form-item
  498. label="工序"
  499. prop="line"
  500. >
  501. <el-select
  502. placeholder=""
  503. prop="line"
  504. v-model="dialog.editorBox.form.data.line"
  505. style="width: 100%;"
  506. :rules="dialog.editorBox.form.line"
  507. >
  508. <el-option
  509. v-for="item of nameObj.workprocid.arr"
  510. :key="item.id"
  511. :value="item.id"
  512. :label="item.name"
  513. ></el-option>
  514. </el-select>
  515. </el-form-item>
  516. </el-col>
  517. <el-col :span="12">
  518. <el-form-item
  519. label="月份"
  520. prop="yearmonth"
  521. >
  522. <zj-timegran-date
  523. v-model="dialog.editorBox.form.data.yearmonth"
  524. style="width: 100%;"
  525. :timegranId="'MONTH'"
  526. :defaultOffset="-1"
  527. :rules="dialog.editorBox.form.yearmonth"
  528. ></zj-timegran-date>
  529. </el-form-item>
  530. </el-col>
  531. </el-row>
  532. <el-row>
  533. <el-col :span="12">
  534. <el-form-item
  535. label="计划量"
  536. prop="weight"
  537. >
  538. <el-input
  539. clearable
  540. v-model="dialog.editorBox.form.data.weight"
  541. style="width: 100%;"
  542. :rules="dialog.editorBox.form.weight"
  543. >
  544. </el-input>
  545. </el-form-item>
  546. </el-col>
  547. <el-col :span="12">
  548. <el-form-item
  549. label="备注"
  550. prop="memo"
  551. >
  552. <el-input
  553. clearable
  554. v-model="dialog.editorBox.form.data.memo"
  555. style="width: 100%;"
  556. >
  557. </el-input>
  558. </el-form-item>
  559. </el-col>
  560. </el-row>
  561. </el-form>
  562. </div>
  563. <span
  564. slot="footer"
  565. class="dialog-footer"
  566. >
  567. <el-button
  568. :loading="loading"
  569. @click="dialog.editorBox.show = false"
  570. >取 消</el-button>
  571. <el-button
  572. type="primary"
  573. @click="dataSave"
  574. :loading="loading"
  575. >保 存</el-button>
  576. </span>
  577. </el-dialog>
  578. <el-dialog
  579. title="年计划编制-发电厂复制"
  580. :visible.sync="dialog.editorBox2.show"
  581. width="400px"
  582. :close-on-click-modal="false"
  583. :show-close="!loading"
  584. >
  585. <div>
  586. <el-form
  587. :model="dialog.editorBox2.form.data"
  588. ref="dialog_form2"
  589. size="mini"
  590. label-width="300px"
  591. :rules="dialog.editorBox2.form.rules"
  592. >
  593. <el-row>
  594. <el-col>
  595. <el-col :span="12">
  596. <el-form-item
  597. label="月份"
  598. prop="memo"
  599. label-width="60px"
  600. >
  601. <zj-timegran-date
  602. v-model="dialog.editorBox2.form.data.yearmonth"
  603. style="width: 150%;"
  604. :timegranId="'MONTH'"
  605. :defaultOffset="-1"
  606. :rules="dialog.editorBox.form.yearmonth"
  607. ></zj-timegran-date>
  608. </el-form-item>
  609. </el-col>
  610. </el-col>
  611. </el-row>
  612. </el-form>
  613. </div>
  614. <span
  615. slot="footer"
  616. class="dialog-footer"
  617. >
  618. <el-button
  619. :loading="loading"
  620. @click="dialog.editorBox2.show = false"
  621. >取 消</el-button>
  622. <el-button
  623. type="primary"
  624. @click="but_copy_plural"
  625. :loading="loading"
  626. >保 存</el-button>
  627. </span>
  628. </el-dialog>
  629. </div>
  630. </template>
  631. <script>
  632. import { zCheckNumber1 } from '~/utils/validator.js'
  633. import timegranDate from '~/components/zg/timegranDate.vue'
  634. import {formatDate, XtcommonSummaries, getCookie} from '@/utils/util.js';
  635. export default {
  636. name: 'outElectricity',
  637. components: {
  638. 'zj-timegran-date': timegranDate
  639. },
  640. data () {
  641. let setDate = new Date();
  642. setDate.setDate(15);
  643. setDate.setMonth((setDate.getMonth() - 1));
  644. return {
  645. rowIndex: '',
  646. columnId: '',
  647. focusTarget: null,
  648. seqArr: [],
  649. editSetFlag: '',
  650. isCheck: false, // 是否为审核人
  651. filterForm: {
  652. show: true,
  653. data: {
  654. clock: '',
  655. clockc: '',
  656. workprocid: [],
  657. location: [],
  658. networkid: [],
  659. state: '',
  660. itemname: '',
  661. searchtype: '0',
  662. measureid: '',
  663. line: '',
  664. unit: 'Kwh',
  665. yearmonth: '',
  666. weight: '',
  667. cjr: '',
  668. xgr: '',
  669. xgsj: '',
  670. memo: '',
  671. cp: '',
  672. sysl: '',
  673. wxsy: '',
  674. parentid: 'FDC',
  675. cjsj: '',
  676. jzsj: '',
  677. zt: '',
  678. show: false
  679. },
  680. rules: {
  681. },
  682. disabled: {
  683. networkid: false
  684. }
  685. },
  686. pageNum: 1,
  687. pageSize: 100,
  688. total: 0,
  689. singleTableHeight: 100,
  690. tableData: [
  691. ],
  692. originalData: [],
  693. loading: false,
  694. tableLoading: false,
  695. multipleSelection: [],
  696. tableFormDataObj: {},
  697. tableFormRules: {
  698. mintvalue: [
  699. // { required: true, message: '该项不能为空', trigger: 'change' },
  700. { validator: zCheckNumber1, trigger: 'change' }
  701. ],
  702. mendvalue: [
  703. // { required: true, message: '该项不能为空', trigger: 'change' },
  704. { validator: zCheckNumber1, trigger: 'change' }
  705. ],
  706. weight: [
  707. { required: true, message: '该项不能为空', trigger: 'change' },
  708. { validator: zCheckNumber1, trigger: 'change' }
  709. ],
  710. wastage: [
  711. { validator: zCheckNumber1, trigger: 'change' }
  712. ],
  713. secondVal: [
  714. { validator: zCheckNumber1, trigger: 'change' }
  715. ],
  716. memo: [
  717. ]
  718. },
  719. nameObj: {
  720. state: {
  721. obj: {
  722. '0': {
  723. name: '未编辑',
  724. color: '#7a7a7a'
  725. },
  726. '1': {
  727. name: '已编辑',
  728. color: 'rgb(28, 111, 217)'
  729. },
  730. '2': {
  731. name: '已审核',
  732. color: 'red'
  733. },
  734. '3': {
  735. name: '已接收',
  736. color: 'red'
  737. }
  738. },
  739. arr: [
  740. {
  741. id: '0',
  742. name: '未编辑'
  743. },
  744. {
  745. id: '1',
  746. name: '已编辑'
  747. },
  748. {
  749. id: '2',
  750. name: '已审核'
  751. },
  752. {
  753. name: '已接收',
  754. color: 'red'
  755. }
  756. ]
  757. },
  758. type: {
  759. obj: {
  760. '0': '否',
  761. '1': '是'
  762. },
  763. arr: [
  764. {
  765. id: '0',
  766. name: '否'
  767. },
  768. {
  769. id: '1',
  770. name: '是'
  771. }
  772. ]
  773. },
  774. unitid: {
  775. obj: {
  776. 't': {
  777. id: 't',
  778. name: '吨'
  779. }
  780. },
  781. arr: [
  782. {
  783. id: 't',
  784. name: '吨'
  785. }
  786. ]
  787. },
  788. workprocid: {
  789. obj: {
  790. 'AT4003': {
  791. id: 'AT4003',
  792. name: '煤气机组45MW'
  793. },
  794. 'AT4002': {
  795. id: 'AT4002',
  796. name: '煤气机组40MW'
  797. },
  798. 'AT4001': {
  799. id: 'AT4001',
  800. name: '煤气机组25MW'
  801. },
  802. // 'AT4008': {
  803. // id: 'AT4008',
  804. // name: '煤气机组6MW'
  805. // },
  806. // 'AT2022': {
  807. // id: 'AT2022',
  808. // name: '煤气机组3MW'
  809. // },
  810. 'AT4004': {
  811. id: 'AT4004',
  812. name: '15MW干熄焦'
  813. },
  814. 'AT3022': {
  815. id: 'AT3022',
  816. name: 'TRT发电'
  817. }},
  818. arr: [{
  819. id: 'AT4003',
  820. name: '煤气机组45MW'
  821. },
  822. {
  823. id: 'AT4002',
  824. name: '煤气机组40MW'
  825. },
  826. {
  827. id: 'AT4001',
  828. name: '煤气机组25MW'
  829. },
  830. // {
  831. // id: 'AT4008',
  832. // name: '煤气机组6MW'
  833. // },
  834. // {
  835. // id: 'AT2022',
  836. // name: '煤气机组3MW'
  837. // },
  838. {
  839. id: 'AT4004',
  840. name: '15MW干熄焦'
  841. },
  842. {
  843. id: 'AT3022',
  844. name: 'TRT发电'
  845. }]
  846. },
  847. location: {
  848. obj: {},
  849. arr: [],
  850. showDataArr: []
  851. },
  852. locateid: {
  853. obj: {},
  854. arr: []
  855. },
  856. networkid: {
  857. obj: {},
  858. arr: []
  859. },
  860. userId: {
  861. obj: {},
  862. arr: []
  863. }
  864. },
  865. dialog: {
  866. fRow: null,
  867. editorBox: {
  868. show: false,
  869. type: '',
  870. form: {
  871. default: {
  872. workprocid: ''
  873. },
  874. data: {
  875. unitid: '',
  876. line: '',
  877. yearmonth: '',
  878. weight: '',
  879. memo: ''
  880. },
  881. rules: {
  882. weight: [
  883. { required: true, message: '该项不能为空', trigger: 'change' },
  884. { validator: zCheckNumber1, trigger: 'change' }
  885. ],
  886. yearmonth: [{ required: true, message: '该项不能为空', trigger: 'change' }],
  887. unitid: [{ required: true, message: '该项不能为空', trigger: 'change' }],
  888. line: [{ required: true, message: '该项不能为空', trigger: 'change' }]
  889. }
  890. }
  891. },
  892. editorBox2: {
  893. show: false,
  894. type: '',
  895. form: {
  896. data: {
  897. yearmonth: ''
  898. },
  899. rules: {
  900. yearmonth: [{ required: true, message: '该项不能为空', trigger: 'change' }]
  901. }
  902. }
  903. }
  904. },
  905. butPrivilege: {
  906. QUERY: false,
  907. PUT: false,
  908. CHECK: false,
  909. UNDOCHECK: false
  910. },
  911. loginName: getCookie('loginName')
  912. }
  913. },
  914. created () {
  915. // 获取按钮权限
  916. this.activeMenu = window.localStorage.getItem('activeMenu');
  917. for (let key in this.butPrivilege) {
  918. this.butPrivilege[key] = this.checkPrivilege(this.activeMenu + key);
  919. }
  920. },
  921. mounted () {
  922. let that = this;
  923. window.PEDataObj = {
  924. // 将数据绑定到window上,供main页面使用
  925. vm: that,
  926. // tableArr:用于导出成Excel的表格的信息
  927. tableArr: [
  928. {
  929. name: '',
  930. id: 'singleTable'
  931. }
  932. ]
  933. };
  934. that.$nextTick(() => {
  935. // 立即获取的height有一定偏差,通过setTimeout延迟来解决
  936. setTimeout(() => {
  937. that.singleTableHeight = that.getRoleHeight(that.$refs['singleTable'].$el) - 45;
  938. }, 1);
  939. });
  940. // 接收路由参数
  941. if (that.$route.query.networkid) {
  942. that.filterForm.disabled.networkid = true;
  943. that.filterForm.data.networkid = that.$route.query.networkid.split(',');
  944. }
  945. // 当有审核与取消审核权限时,默认其为审核人,审核人无法修改数据
  946. if (that.butPrivilege.CHECK || that.butPrivilege.UNDOCHECK) {
  947. that.isCheck = true;
  948. }
  949. // 管理员在这里录入数据
  950. if (that.loginName === 'admin' && that.filterForm.disabled.networkid) {
  951. that.isCheck = false;
  952. }
  953. // that.getLocation();
  954. that.getLocateIdData();
  955. that.getNetworkIdData();
  956. // that.getTableData();
  957. that.getUnitIdData();
  958. },
  959. methods: {
  960. // 计算树区域高度
  961. getRoleHeight (dom) {
  962. return window.innerHeight - dom.offsetTop;
  963. },
  964. // 自定义的表格合计方法:只给指定列进行合计
  965. getSummaries (param) {
  966. const prop = ['apportvalue', 'realvalue', 'wastage', 'total']; // 合计列绑定的prop
  967. const {columns, data} = param;
  968. const sums = XtcommonSummaries(param, prop);
  969. let that = this;
  970. columns.forEach((column, index) => {
  971. if (index === 1) {
  972. sums[index] = '合计';
  973. return;
  974. };
  975. let lineTotal = 0;
  976. let lineTotal1 = 0;
  977. let lineTotal2 = 0;
  978. let lineTotal3 = 0;
  979. let lineTotal4 = 0;
  980. let lineTotal5 = 0;
  981. let weiItem = 0;
  982. switch (column.property) {
  983. case 'weight':
  984. lineTotal = 0;
  985. lineTotal1 = 0;
  986. lineTotal2 = 0;
  987. lineTotal3 = 0;
  988. lineTotal4 = 0;
  989. lineTotal5 = 0;
  990. for (let i = 0; i < that.tableData.length; i++) {
  991. that.tableData[i].weight.forEach((item, key) => {
  992. weiItem = (isNaN(item['AT4002']) ? 0 : item['AT4002']);
  993. lineTotal += Number(weiItem);
  994. });
  995. that.tableData[i].weight.forEach((item, key) => {
  996. weiItem = (isNaN(item['AT4001']) ? 0 : item['AT4001']);
  997. lineTotal1 += Number(weiItem);
  998. });
  999. that.tableData[i].weight.forEach((item, key) => {
  1000. weiItem = (isNaN(item['AT4008']) ? 0 : item['AT4008']);
  1001. lineTotal2 += Number(weiItem);
  1002. });
  1003. // that.tableData[i].weight.forEach((item, key) => {
  1004. // weiItem = (isNaN(item['AT2022']) ? 0 : item['AT2022']);
  1005. // lineTotal3 += Number(weiItem);
  1006. // });
  1007. that.tableData[i].weight.forEach((item, key) => {
  1008. weiItem = (isNaN(item['AT3022']) ? 0 : item['AT3022']);
  1009. lineTotal5 += Number(weiItem);
  1010. });
  1011. that.tableData[i].weight.forEach((item, key) => {
  1012. weiItem = (isNaN(item['AT4004']) ? 0 : item['AT4004']);
  1013. lineTotal4 += Number(weiItem);
  1014. });
  1015. that.tableData[i].weight.forEach((item, key) => {
  1016. weiItem = (isNaN(item['AT4003']) ? 0 : item['AT4003']);
  1017. lineTotal3 += Number(weiItem);
  1018. });
  1019. };
  1020. sums[index] = (index % 8 === 0) ? lineTotal5 : (
  1021. (index % 7 === 0) ? lineTotal4 : (index % 6 === 0) ? lineTotal3 : (index % 5 === 0) ? lineTotal1 : lineTotal);
  1022. break;
  1023. default:
  1024. break;
  1025. }
  1026. });
  1027. return sums;
  1028. },
  1029. // 获取工序列表
  1030. // getNodeData () {
  1031. // let that = this
  1032. // let url = 'pass/ems/v1/trmworkprocs/getIdAndName?issettle=1';
  1033. // that.axios.get(url)
  1034. // .then(function (res) {
  1035. // if (res.code === '0') {
  1036. // let arr = [];
  1037. // let obj = {};
  1038. // for (let item of res.data) {
  1039. // arr.push({
  1040. // id: item.id,
  1041. // name: item.name
  1042. // })
  1043. // obj[item.id] = item.name;
  1044. // }
  1045. // that.nameObj.workprocid.arr = arr;
  1046. // that.nameObj.workprocid.obj = obj;
  1047. // that.connn();
  1048. // } else {
  1049. // that.$message.error(res.message);
  1050. // }
  1051. // });
  1052. // },
  1053. getUnitIdData () {
  1054. let that = this
  1055. let url = 'pass/ems/v1/trmunits/getIdAndName';
  1056. that.axios.get(url)
  1057. .then(function (res) {
  1058. if (res.code === '0') {
  1059. let arr = [];
  1060. let obj = {};
  1061. for (let item of res.data) {
  1062. arr.push({
  1063. id: item.id,
  1064. name: item.name
  1065. })
  1066. obj[item.id] = item.name;
  1067. if (item.name === '吨') {
  1068. that.nameObj.unitid.defaults = that.nameObj.unitid.defaults ? that.nameObj.unitid.defaults : item.id;
  1069. }
  1070. }
  1071. that.nameObj.unitid.arr = arr;
  1072. that.nameObj.unitid.obj = obj;
  1073. } else {
  1074. that.$message.error(res.message);
  1075. }
  1076. });
  1077. },
  1078. // 获取站所
  1079. getNetworkIdData () {
  1080. let that = this
  1081. let url = 'pass/ems/v1/trmstations/getidandname/';
  1082. that.axios.get(url)
  1083. .then(function (res) {
  1084. if (res.code === '0') {
  1085. let arr = [];
  1086. let obj = {};
  1087. for (let item of res.data) {
  1088. arr.push({
  1089. id: item.id,
  1090. name: item.name
  1091. })
  1092. obj[item.id] = item.name;
  1093. }
  1094. that.nameObj.networkid.arr = arr;
  1095. that.nameObj.networkid.obj = obj;
  1096. } else {
  1097. that.$message.error(res.message);
  1098. }
  1099. });
  1100. },
  1101. but_copy_plural () {
  1102. let that = this;
  1103. let SubmitData = [];
  1104. for (let key in that.tableFormDataObj) {
  1105. let memoArr = that.tableFormDataObj[key].memo.split(';');
  1106. for (let i = 0; i < that.tableFormDataObj[key].weight.length; i++) {
  1107. for (let keyname in that.tableFormDataObj[key].weight[i]) {
  1108. SubmitData.push({
  1109. weight: that.tableFormDataObj[key].weight[i][keyname],
  1110. memo: memoArr[i],
  1111. unit: that.tableFormDataObj[key].unit,
  1112. parentid: that.filterForm.data.parentid,
  1113. line: that.tableFormDataObj[key].line[i][i],
  1114. yearmonth: that.dialog.editorBox2.form.data.yearmonth
  1115. });
  1116. };
  1117. };
  1118. }
  1119. that.$refs['dialog_form2'].validate((valid) => {
  1120. if (valid) {
  1121. that.loading = true;
  1122. that.axios.post('pass/ems/v1/emsprodplanyears/', SubmitData, {
  1123. contentType: 'application/json'
  1124. })
  1125. .then(function (res) {
  1126. if (res.code === '0') {
  1127. that.$message({
  1128. message: '复制成功',
  1129. type: 'success'
  1130. });
  1131. that.getTableData();
  1132. that.dialog.editorBox2.show = false;
  1133. } else {
  1134. that.$message.error(res.message);
  1135. }
  1136. that.loading = false;
  1137. }).catch(function () {
  1138. that.loading = false;
  1139. });
  1140. } else {
  1141. this.$message.error('至少选择一条数据');
  1142. }
  1143. });
  1144. },
  1145. connn () {
  1146. let that = this;
  1147. if (!that.filterForm.data.networkid || that.filterForm.data.networkid.length === 0) {
  1148. that.nameObj.location.showDataArr = that.nameObj.workprocid.arr;
  1149. } else {
  1150. let url = 'pass/ems/v1/trmelectricitylocations/getWorkprocs?workshop=' + that.filterForm.data.networkid.toString();
  1151. that.axios.get(url)
  1152. .then(function (res) {
  1153. if (res.code === '0') {
  1154. let arr = [];
  1155. for (let item of res.data) {
  1156. arr.push({
  1157. id: item.id,
  1158. name: item.name
  1159. })
  1160. }
  1161. that.nameObj.location.showDataArr = arr;
  1162. } else {
  1163. that.$message.error(res.message);
  1164. }
  1165. });
  1166. }
  1167. },
  1168. // 获取位置
  1169. getLocateIdData () {
  1170. let that = this
  1171. let url = 'pass/ems/v1/trmlocations/getidandname/';
  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.locateid.arr = arr;
  1185. that.nameObj.locateid.obj = obj;
  1186. } else {
  1187. that.$message.error(res.message);
  1188. }
  1189. });
  1190. },
  1191. // 获取表格中的数据
  1192. getTableData (pageNum) {
  1193. let that = this,
  1194. params = {},
  1195. pData = {
  1196. yearmonth: that.filterForm.data.yearmonth,
  1197. workprocid: that.filterForm.data.workprocid.toString(),
  1198. location: that.filterForm.data.location.toString(),
  1199. networkid: that.filterForm.data.networkid.toString(),
  1200. itemname: that.filterForm.data.itemname,
  1201. zt: that.filterForm.data.zt,
  1202. measureid: that.filterForm.data.measureid,
  1203. exactsearch: that.filterForm.data.searchtype,
  1204. parentid: that.filterForm.data.parentid,
  1205. parentNum: that.nameObj.workprocid.arr.length
  1206. };
  1207. for (let key in pData) {
  1208. if (pData[key]) {
  1209. params[key] = pData[key];
  1210. }
  1211. }
  1212. that.pageNum = pageNum || that.pageNum;
  1213. that.tableLoading = true;
  1214. // let url = 'pass/ems/v1/trmtransfereactvalues/getDateEditForPage/?pageNum=' + that.pageNum + '&pageSize=' + that.pageSize;
  1215. // if (that.isCheck) {
  1216. // url = 'pass/ems/v1/trmtransfereactvalues/?pageNum=' + that.pageNum + '&pageSize=' + that.pageSize;
  1217. // }
  1218. let url = 'pass/ems/v1/emsprodplanyears/getList?pageNum=' + that.pageNum + '&pageSize=' + that.pageSize;
  1219. that.axios.get(url, {
  1220. params: params
  1221. })
  1222. .then(function (res) {
  1223. if (res.code === '0') {
  1224. let arr = [];
  1225. let index = 0;
  1226. let chirItem = res.data.list[0];
  1227. for (let e in chirItem) {
  1228. let item = chirItem[e];
  1229. let weightArr = [];
  1230. let lineArr = [];
  1231. let sum = 0;
  1232. let noArr = [];
  1233. let memoLong = '';
  1234. for (let i = 0; i < chirItem[e].length; i++) {
  1235. weightArr.push({
  1236. [item[i].line]: item[i].weight
  1237. });
  1238. lineArr.push({
  1239. [i]: item[i].line
  1240. });
  1241. noArr.push({
  1242. [i]: item[i].no
  1243. });
  1244. if (item[i].memo !== null && item[i].memo !== '') {
  1245. memoLong = memoLong + item[i].memo + ';';
  1246. }
  1247. sum += item[i].weight;
  1248. };
  1249. arr.push({
  1250. seq: index,
  1251. unit: item[chirItem[e].length - 1].unit,
  1252. line: lineArr,
  1253. yearmonth: item[chirItem[e].length - 1].yearmonth,
  1254. weight: weightArr,
  1255. cjr: item[chirItem[e].length - 1].cjr,
  1256. cjsj: item[chirItem[e].length - 1].cjsj,
  1257. jzsj: item[chirItem[e].length - 1].jzsj,
  1258. xgr: item[chirItem[e].length - 1].xgr,
  1259. xgsj: item[chirItem[e].length - 1].xgsj,
  1260. cp: item[chirItem[e].length - 1].cp,
  1261. sysl: item[chirItem[e].length - 1].sysl,
  1262. wxsy: item[chirItem[e].length - 1].wxsy,
  1263. zt: item[chirItem[e].length - 1].zt,
  1264. parentid: item[chirItem[e].length - 1].parentid,
  1265. no: noArr,
  1266. id: item[chirItem[e].length - 1].id,
  1267. memo: memoLong,
  1268. total: sum
  1269. });
  1270. index = index + 1;
  1271. }
  1272. that.total = res.data.total;
  1273. that.tableData = JSON.parse(JSON.stringify(arr));
  1274. that.originalData = JSON.parse(JSON.stringify(arr));
  1275. that.getAdds();
  1276. } else {
  1277. that.$message.error(res.message);
  1278. }
  1279. that.$nextTick(() => {
  1280. setTimeout(() => {
  1281. that.singleTableHeight = that.getRoleHeight(that.$refs['singleTable'].$el) - 46;
  1282. }, 1);
  1283. });
  1284. that.tableLoading = false;
  1285. }).catch(function () {
  1286. that.tableLoading = false;
  1287. });
  1288. },
  1289. // 获取表格中的数据
  1290. getTableDataEdit () {
  1291. let that = this,
  1292. params = {},
  1293. pData = {
  1294. yearmonth: that.filterForm.data.yearmonth,
  1295. workprocid: that.filterForm.data.workprocid.toString(),
  1296. location: that.filterForm.data.location.toString(),
  1297. networkid: that.filterForm.data.networkid.toString(),
  1298. itemname: that.filterForm.data.itemname,
  1299. exactsearch: that.filterForm.data.searchtype,
  1300. parentid: that.filterForm.data.parentid
  1301. };
  1302. for (let key in pData) {
  1303. if (pData[key]) {
  1304. params[key] = pData[key];
  1305. }
  1306. }
  1307. that.tableLoading = true;
  1308. let url = 'pass/ems/v1/emsprodplanyears/getDateEditForPage/?pageNum=1&pageSize=' + that.pageSize;
  1309. that.axios.get(url, {
  1310. params: params
  1311. })
  1312. .then(function (res) {
  1313. if (res.code === '0') {
  1314. let arr = [];
  1315. for (let i = 0; i < res.data.list.length; i++) {
  1316. let item = res.data.list[i];
  1317. arr.push({
  1318. seq: i,
  1319. unit: item.unit,
  1320. line: item.line,
  1321. yearmonth: item.yearmonth,
  1322. weight: item.weight,
  1323. cjr: item.cjr,
  1324. cjsj: item.cjsj,
  1325. jzsj: item.jzsj,
  1326. xgr: item.xgr,
  1327. xgsj: item.xgsj,
  1328. cp: item.cp,
  1329. sysl: item.sysl,
  1330. zt: item.zt,
  1331. wxsy: item.wxsy
  1332. });
  1333. }
  1334. that.total = res.data.total;
  1335. that.tableData = arr;
  1336. that.getAdds();
  1337. } else {
  1338. that.$message.error(res.message);
  1339. }
  1340. that.$nextTick(() => {
  1341. setTimeout(() => {
  1342. that.singleTableHeight = that.getRoleHeight(that.$refs['singleTable'].$el) - 46;
  1343. }, 1);
  1344. });
  1345. that.tableLoading = false;
  1346. }).catch(function () {
  1347. that.tableLoading = false;
  1348. });
  1349. },
  1350. // 合并相同的用电地点
  1351. arraySpanMethod ({ row, column, rowIndex, columnIndex }) {
  1352. let that = this;
  1353. let tableData = this.$refs.singleTable.tableData
  1354. let c1 = row.workprocid;
  1355. let c2 = row.location;
  1356. let c3 = row.workshop;
  1357. let c4 = row.clock;
  1358. let c5 = row.clocke;
  1359. let rowsPan = 1;
  1360. // let adds = this.$refs.singleTable.tableData[rowIndex].realvalue;
  1361. if (column['property'] === 'workprocid' || column['property'] === 'adds') {
  1362. if (rowIndex > 0 && c1 === tableData[rowIndex - 1].workprocid && c2 === tableData[rowIndex - 1].location &&
  1363. c3 === tableData[rowIndex - 1].workshop && c4 === tableData[rowIndex - 1].clock && c5 === tableData[rowIndex - 1].clocke) {
  1364. return {
  1365. rowspan: 0,
  1366. colspan: 0
  1367. };
  1368. };
  1369. while (tableData[rowIndex + rowsPan] && c1 === tableData[rowIndex + rowsPan].workprocid && c2 === tableData[rowIndex + rowsPan].location &&
  1370. c3 === tableData[rowIndex + rowsPan].workshop && c4 === tableData[rowIndex + rowsPan].clock && c5 === tableData[rowIndex + rowsPan].clocke) {
  1371. rowsPan += 1
  1372. }
  1373. return {
  1374. rowspan: rowsPan,
  1375. colspan: 1
  1376. };
  1377. }
  1378. },
  1379. // 改变表格显示条数
  1380. tableSizeChange (val) {
  1381. let that = this;
  1382. that.pageSize = val;
  1383. that.getTableData(1);
  1384. },
  1385. // 重置搜索
  1386. tableDataCancel () {
  1387. let that = this;
  1388. for (let key in that.filterForm.data) {
  1389. if (!that.filterForm.disabled || !that.filterForm.disabled[key]) {
  1390. if (that.filterForm.data[key] instanceof Array) {
  1391. that.filterForm.data[key] = [];
  1392. } else {
  1393. that.filterForm.data[key] = '';
  1394. }
  1395. }
  1396. }
  1397. that.getTableData(1);
  1398. },
  1399. keyDown (event1, disabledFlag) {
  1400. let tdTarget = event1.target;
  1401. let _this = this;
  1402. while (tdTarget.tagName !== 'TD') {
  1403. tdTarget = tdTarget.parentElement;
  1404. }
  1405. // 如果按下键盘下键或者回车键
  1406. if (event.keyCode === 40 || event.keyCode === 13) {
  1407. let index = parseInt(this.rowIndex);
  1408. // index++;
  1409. if (index !== this.seqArr[this.seqArr.length - 1]) {
  1410. for (let i = 0; i < this.seqArr.length; i++) {
  1411. if (index === this.seqArr[i]) {
  1412. index = this.seqArr[i + 1];
  1413. break;
  1414. }
  1415. }
  1416. }
  1417. this.editSetFlag = index + this.columnId;
  1418. let id = '#' + this.editSetFlag;
  1419. this.$nextTick(() => {
  1420. $(id).click();
  1421. });
  1422. } else if (event.keyCode === 38) { // 键盘上键
  1423. let index = parseInt(this.rowIndex);
  1424. if (index !== this.seqArr[0]) {
  1425. for (let i = 0; i < this.seqArr.length; i++) {
  1426. if (index === this.seqArr[i]) {
  1427. index = this.seqArr[i - 1];
  1428. break;
  1429. }
  1430. }
  1431. }
  1432. this.editSetFlag = index + this.columnId;
  1433. let id = '#' + this.editSetFlag;
  1434. this.$nextTick(() => {
  1435. $(id).click();
  1436. });
  1437. } else if (event.keyCode === 37) { // 键盘左键
  1438. $(tdTarget).prevAll().find('input:text').last().click();
  1439. } else if (event.keyCode === 39) { // 键盘右键
  1440. $(tdTarget).nextAll().find('input').eq(0).click();
  1441. }
  1442. },
  1443. // 只允许对未接受的数据进行操作
  1444. checkboxT (row, index) {
  1445. if (row.zt === '2' && !this.isCheck) {
  1446. return false;
  1447. } else {
  1448. return true;
  1449. }
  1450. },
  1451. handleSelectionChange (val) {
  1452. let that = this;
  1453. let tableFormDataObj = {};
  1454. let arr = [];
  1455. for (let item of val) {
  1456. arr.push(item.seq);
  1457. }
  1458. this.seqArr = arr.sort(sortNumber);
  1459. for (let item of that.tableData) {
  1460. item.isSelection = false;
  1461. }
  1462. // 引用类型拷贝值JSON.parse(JSON.stringify(obj)
  1463. let arrcha = [...JSON.parse(JSON.stringify(that.originalData))].filter(x => [...val].every(y => y.id !== x.id));
  1464. for (let item of arrcha) {
  1465. // 取消选择时赋初始值
  1466. for (let weiIndex in that.tableData[item.seq].weight) {
  1467. for (let weiKey in that.tableData[item.seq].weight[weiIndex]) {
  1468. that.tableData[item.seq].weight[weiIndex][weiKey] = that.originalData[item.seq].weight[weiIndex][weiKey];
  1469. }
  1470. }
  1471. // that.tableData[item.seq] = JSON.parse(JSON.stringify(that.originalData[item.seq]));
  1472. };
  1473. for (let item of val) {
  1474. let obj = {};
  1475. let xId = item.seq;
  1476. if (that.tableFormDataObj[xId]) {
  1477. // 如果已存在该数据则使用该数据
  1478. tableFormDataObj[xId] = that.tableFormDataObj[xId];
  1479. } else {
  1480. // 负责则从对应行中获取行内原数据
  1481. for (let key in item) {
  1482. obj[key] = item[key];
  1483. }
  1484. item.realvalue = (!isNaN(Number(item.apportvalue)) && !isNaN(Number(item.wastage))) ? Number(item.apportvalue) + Number(item.wastage) - Number(item.secondVal) : item.realvalue;
  1485. tableFormDataObj[xId] = obj;
  1486. }
  1487. item.isSelection = true;
  1488. }
  1489. for (let item of that.tableData) {
  1490. if (item.isSelection === false) {
  1491. item.realvalue = (!isNaN(Number(item.apportvalue)) && !isNaN(Number(item.wastage))) ? Number(item.apportvalue) + Number(item.wastage) - Number(item.secondVal) : item.realvalue;
  1492. }
  1493. }
  1494. that.tableFormDataObj = tableFormDataObj;
  1495. that.multipleSelection = val;
  1496. this.getAdds();
  1497. },
  1498. // 当上月底码发生改变时计算抄度与实际电量
  1499. getApportValue (seq, value, rowIndex, event) {
  1500. let that = this;
  1501. if (!isNaN(Number(value))) {
  1502. if (!isNaN(Number(that.tableFormDataObj[seq].mintvalue)) && !isNaN(Number(that.tableFormDataObj[seq].mendvalue)) && that.tableFormDataObj[seq].mintvalue !== null && that.tableFormDataObj[seq].mendvalue !== null) {
  1503. let poor = that.floatComputed(Number(that.tableFormDataObj[seq].mendvalue), Number(that.tableFormDataObj[seq].mintvalue), '-');
  1504. that.tableFormDataObj[seq].apportvalue = that.floatComputed(poor, Number(that.tableFormDataObj[seq].mods), '*').toFixed(0);
  1505. let rv1 = that.floatComputed(Number(that.tableFormDataObj[seq].apportvalue), Number(that.tableFormDataObj[seq].wastage), '+');
  1506. that.tableFormDataObj[seq].realvalue = that.floatComputed(rv1, Number(that.tableFormDataObj[seq].secondVal), '-').toFixed(0);
  1507. that.showRealValue(rowIndex, that.tableFormDataObj[seq].realvalue);
  1508. }
  1509. }
  1510. },
  1511. // 手动修改抄度后计算实际电量
  1512. chnageApportvalue (seq, value, rowIndex) {
  1513. let that = this;
  1514. if (!isNaN(Number(value)) && !isNaN(Number(that.tableFormDataObj[seq].wastage))) {
  1515. that.tableFormDataObj[seq].realvalue = that.floatComputed(Number(value), Number(that.tableFormDataObj[seq].wastage), '+').toFixed(0);
  1516. }
  1517. that.showRealValue(rowIndex, that.tableFormDataObj[seq].realvalue);
  1518. },
  1519. // 手动修改损耗后计算实际电量
  1520. chnageWastage (seq, value, rowIndex) {
  1521. let that = this;
  1522. if (!isNaN(Number(value)) && !isNaN(Number(that.tableFormDataObj[seq].apportvalue)) && that.tableFormDataObj[seq].apportvalue !== null) {
  1523. let rv1 = that.floatComputed(Number(value), Number(that.tableFormDataObj[seq].apportvalue), '+');
  1524. that.tableFormDataObj[seq].realvalue = that.floatComputed(rv1, Number(that.tableFormDataObj[seq].secondVal), '-').toFixed(0);
  1525. that.showRealValue(rowIndex, that.tableFormDataObj[seq].realvalue);
  1526. }
  1527. },
  1528. // 手动修改二次转供电后计算实际电量
  1529. chnageSecondVal (seq, value, rowIndex) {
  1530. let that = this;
  1531. if (!isNaN(Number(value)) && !isNaN(Number(that.tableFormDataObj[seq].apportvalue)) && that.tableFormDataObj[seq].apportvalue !== null) {
  1532. let val1 = that.floatComputed(Number(that.tableFormDataObj[seq].apportvalue), Number(that.tableFormDataObj[seq].wastage), '+');
  1533. that.tableFormDataObj[seq].realvalue = that.floatComputed(val1, Number(value), '-').toFixed(0);
  1534. that.showRealValue(rowIndex, that.tableFormDataObj[seq].realvalue);
  1535. }
  1536. },
  1537. // 统计合计值
  1538. getAdds () {
  1539. let that = this;
  1540. let wlarr = [];
  1541. for (var i = 0; i < that.tableData.length; i++) {
  1542. wlarr.push(that.tableData[i].workprocid + '-' + that.tableData[i].location + '-' + that.tableData[i].workshop + '-' + that.tableData[i].clock + '-' + that.tableData[i].clocke);
  1543. }
  1544. let wls = [...new Set(wlarr)]
  1545. let arrs = [];
  1546. for (let wl of wls) {
  1547. let adds = 0;
  1548. for (let item of that.tableData) {
  1549. if (wl === item.workprocid + '-' + item.location + '-' + item.workshop + '-' + item.clock + '-' + item.clocke) {
  1550. adds = that.floatComputed(Number(item.realvalue), adds, '+');
  1551. }
  1552. }
  1553. for (let i = 0; i < that.tableData.length; i++) {
  1554. if (wl === that.tableData[i].workprocid + '-' + that.tableData[i].location + '-' + that.tableData[i].workshop + '-' + that.tableData[i].clock + '-' + that.tableData[i].clocke) {
  1555. that.tableData[i].adds = adds;
  1556. }
  1557. }
  1558. }
  1559. },
  1560. // 展示实际电量
  1561. showRealValue (rowIndex, value) {
  1562. let that = this;
  1563. for (let i = 0; i < that.tableData.length; i++) {
  1564. if (i === rowIndex) {
  1565. that.tableData[i].realvalue = value;
  1566. }
  1567. }
  1568. this.getAdds();
  1569. },
  1570. // 批量修改
  1571. but_edit_plural () {
  1572. let that = this;
  1573. if (that.multipleSelection.length > 0) {
  1574. that.$refs['dialog_form_arr'].validate((valid, obj) => {
  1575. if (valid) {
  1576. let SubmitData = [];
  1577. for (let key in that.tableFormDataObj) {
  1578. let memoArr = that.tableFormDataObj[key].memo.split(';');
  1579. for (let i = 0; i < that.tableFormDataObj[key].weight.length; i++) {
  1580. for (let keyname in that.tableFormDataObj[key].weight[i]) {
  1581. SubmitData.push({
  1582. weight: that.tableFormDataObj[key].weight[i][keyname],
  1583. no: that.tableFormDataObj[key].no[i][i],
  1584. memo: memoArr[i],
  1585. cjsj: that.tableFormDataObj[key].cjsj,
  1586. jzsj: that.tableFormDataObj[key].jzsj,
  1587. zt: that.tableFormDataObj[key].zt,
  1588. parentid: that.filterForm.data.parentid,
  1589. yearmonth: that.tableFormDataObj[key].yearmonth
  1590. });
  1591. };
  1592. };
  1593. };
  1594. that.loading = true;
  1595. that.axios.put('pass/ems/v1/emsprodplanyears/batchupdateList', SubmitData)
  1596. .then(function (res) {
  1597. if (res.code === '0') {
  1598. that.$message({
  1599. message: '修改成功',
  1600. type: 'success'
  1601. });
  1602. that.getTableData();
  1603. that.dialog.editorBox.show = false;
  1604. } else {
  1605. that.$message.error(res.message);
  1606. }
  1607. that.loading = false;
  1608. }).catch(function () {
  1609. that.loading = false;
  1610. });
  1611. }
  1612. });
  1613. } else {
  1614. this.$message.error('至少选择一条数据');
  1615. }
  1616. },
  1617. dataSave () {
  1618. let that = this;
  1619. let SubmitData = [];
  1620. SubmitData.push({
  1621. yearmonth: that.dialog.editorBox.form.data.yearmonth,
  1622. weight: that.dialog.editorBox.form.data.weight,
  1623. unit: that.filterForm.data.unit,
  1624. line: that.dialog.editorBox.form.data.line,
  1625. parentid: that.filterForm.data.parentid,
  1626. memo: that.dialog.editorBox.form.data.memo
  1627. });
  1628. that.$refs['dialog_form'].validate((valid) => {
  1629. if (valid) {
  1630. that.loading = true;
  1631. that.axios.post('pass/ems/v1/emsprodplanyears/', SubmitData, {
  1632. contentType: 'application/json'
  1633. })
  1634. .then(function (res) {
  1635. if (res.code === '0') {
  1636. that.$message({
  1637. message: '新增成功',
  1638. type: 'success'
  1639. });
  1640. that.getTableData();
  1641. that.dialog.editorBox.show = false;
  1642. } else {
  1643. that.$message.error(res.message);
  1644. }
  1645. that.loading = false;
  1646. }).catch(function () {
  1647. that.loading = false;
  1648. });
  1649. }
  1650. }
  1651. );
  1652. },
  1653. // 批量删除
  1654. but_del_plural () {
  1655. let that = this;
  1656. if (that.multipleSelection.length > 0) {
  1657. let SubmitData = [];
  1658. for (let item of that.multipleSelection) {
  1659. if (item.zt === '2') {
  1660. this.$message.error('已经审核的数据不能删除');
  1661. return;
  1662. };
  1663. for (let noItem in item.no) {
  1664. SubmitData.push({
  1665. no: item.no[noItem][noItem]
  1666. });
  1667. };
  1668. }
  1669. that.$confirm('是否删除已选数据?', '提示', {
  1670. confirmButtonText: '确定',
  1671. cancelButtonText: '取消',
  1672. state: 'warning'
  1673. }).then(() => {
  1674. that.axios.delete('pass/ems/v1/emsprodplanyears/delete', {
  1675. data: SubmitData,
  1676. contentType: 'application/json;charset=UTF-8'
  1677. })
  1678. .then(function (res) {
  1679. if (res.code === '0') {
  1680. that.$message({
  1681. message: '删除成功',
  1682. type: 'success'
  1683. });
  1684. that.getTableData();
  1685. } else {
  1686. that.$message.error(res.message);
  1687. }
  1688. }).catch(function () {
  1689. });
  1690. }).catch(() => {
  1691. });
  1692. } else {
  1693. this.$message.error('至少要选择一条数据');
  1694. }
  1695. },
  1696. upState (state = '2') {
  1697. let that = this;
  1698. let dataArr = [];
  1699. for (let item of that.multipleSelection) {
  1700. if (item.state !== state) {
  1701. dataArr.push(item);
  1702. }
  1703. }
  1704. if (dataArr.length > 0) {
  1705. that.$confirm('本次将要' + (state === '2' ? '审核' : '撤销审核') + dataArr.length + '条数据,是否确定?', '提示', {
  1706. confirmButtonText: '确定',
  1707. cancelButtonText: '取消',
  1708. state: 'warning'
  1709. }).then(() => {
  1710. let SubmitData = [];
  1711. for (let item of dataArr) {
  1712. SubmitData.push({
  1713. state: state,
  1714. id: item.id
  1715. });
  1716. }
  1717. that.loading = true;
  1718. that.axios.put('pass/ems/v1/trmtransfereactvalues/batchcheck2', SubmitData)
  1719. .then(function (res) {
  1720. if (res.code === '0') {
  1721. that.$message({
  1722. message: (state === '2' ? '审核' : '撤销') + '成功',
  1723. type: 'success'
  1724. });
  1725. that.getTableData();
  1726. } else {
  1727. that.$message.error(res.message);
  1728. }
  1729. that.loading = false;
  1730. }).catch(function () {
  1731. that.loading = false;
  1732. });
  1733. }).catch(() => {
  1734. });
  1735. } else {
  1736. if (that.multipleSelection.length > 0) {
  1737. this.$message.error('没有需要' + (state === '2' ? '审核' : '撤销') + '的数据');
  1738. } else {
  1739. this.$message.error('至少要选择一条数据');
  1740. }
  1741. }
  1742. },
  1743. but_add () {
  1744. let that = this;
  1745. that.dialog.editorBox.show = true;
  1746. setTimeout(() => {
  1747. that.$refs['dialog_form'].clearValidate();
  1748. }, 100);
  1749. },
  1750. but_copy () {
  1751. let that = this;
  1752. if (that.multipleSelection.length > 0) {
  1753. that.dialog.editorBox2.show = true;
  1754. setTimeout(() => {
  1755. that.$refs['dialog_form2'].clearValidate();
  1756. }, 100);
  1757. } else {
  1758. this.$message.error('至少要选择一条数据');
  1759. }
  1760. },
  1761. tableRowClassName ({row, rowIndex}) {
  1762. // 把每一行的索引放进row
  1763. row.index = rowIndex;
  1764. },
  1765. cellClick (row, column, cell, event) {
  1766. let _this = this;
  1767. this.rowIndex = row.index;
  1768. this.columnId = column.id;
  1769. _this.editSetFlag = row.index + column.id;
  1770. _this.focusTarget = event.target;
  1771. while (_this.focusTarget.tagName !== 'TD') {
  1772. _this.focusTarget = _this.focusTarget.parentElement;
  1773. }
  1774. _this.$nextTick(() => {
  1775. let target = this.focusTarget;
  1776. $(target).find('input').focus();
  1777. });
  1778. },
  1779. // 获取一行的总和
  1780. rowSum: function (item, event) {
  1781. let result = 0;
  1782. let that = this;
  1783. for (let weiIndex in item.weight) {
  1784. for (let weiKey in item.weight[weiIndex]) {
  1785. result += Number(item.weight[weiIndex][weiKey]);
  1786. }
  1787. }
  1788. return result;
  1789. }
  1790. }
  1791. }
  1792. function sortNumber (a, b) {
  1793. return a - b
  1794. }
  1795. </script>
  1796. <style lang="less">
  1797. .outElectricity{
  1798. min-width: 700px;
  1799. height: 100%;
  1800. .box {
  1801. height: 100%;
  1802. padding: 15px 15px 0 15px;
  1803. .box-top {
  1804. .el-form-item {
  1805. margin-bottom: 7px;
  1806. }
  1807. .box-top-gjl {
  1808. overflow: hidden;
  1809. padding: 7px 0;
  1810. border-top: 1px solid #ccc;
  1811. }
  1812. }
  1813. .rowDisable td {
  1814. color: #6bb025 !important;
  1815. }
  1816. .el-table .el-table__row {
  1817. height: 35px;
  1818. }
  1819. .el-table__body .el-form-item--mini.el-form-item {
  1820. margin: 0px;
  1821. .error {
  1822. overflow: hidden;
  1823. color: #f56c6c;
  1824. font-size: 12px;
  1825. line-height: 1;
  1826. }
  1827. }
  1828. }
  1829. .color_no {
  1830. color: #7a7a7a;
  1831. }
  1832. .color_yes {
  1833. color: #1a9f17;
  1834. }
  1835. .cnspicuous .el-checkbox__input.is-disabled .el-checkbox__inner {
  1836. background-color: #dcdfe6;
  1837. border-color: #babbbf;
  1838. }
  1839. }
  1840. </style>