planProjectCoking.vue 72 KB

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