planProjectMachineCoke.vue 100 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180
  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="100px"
  189. :show-overflow-tooltip="true"
  190. >
  191. <template slot-scope="scope">
  192. <span>{{ nameObj.unitid.obj[scope.row.unit] ? nameObj.unitid.obj[scope.row.unit] : scope.row.unit }}</span>
  193. </template>
  194. </el-table-column>
  195. <!-- <el-table-column
  196. prop="avgTime"
  197. label="平均结焦时间"
  198. fixed="left"
  199. width="80px"
  200. :show-overflow-tooltip="true"
  201. ></el-table-column> -->
  202. <el-table-column
  203. prop="total"
  204. label="合计产量"
  205. fixed="left"
  206. width="160px"
  207. :show-overflow-tooltip="true"
  208. ><template slot-scope="scope">
  209. <span v-if="!isCheck && scope.row.isSelection && scope.row.state !== '2'">{{ rowSum(scope.row) }}</span>
  210. <span v-else>{{ scope.row.total }}</span>
  211. </template>
  212. </el-table-column>
  213. <el-table-column
  214. label="成品焦">
  215. <!-- <el-table-column
  216. label="产生数量"
  217. prop="weight"
  218. rowsPan="3"
  219. fixed="left"
  220. width="120px"
  221. :show-overflow-tooltip="true"
  222. ><template slot-scope="scope">
  223. <el-form-item
  224. v-if="!isCheck && scope.row.isSelection && scope.row.state !== '2'"
  225. :prop="scope.row.seq + '.weight'"
  226. ><el-input clearable
  227. v-for="(itemform, key) in tableFormDataObj[scope.row.seq].weight"
  228. style="width: 100%;"
  229. v-model="itemform['成品焦']"
  230. v-if="!isNaN(Number(itemform['成品焦']))"
  231. refcous="true"
  232. :rules="tableFormRules.weight"
  233. oninput="this.value = this.value.replace(/[^\d.]/g,'');"
  234. @keydown.native="keyDown" :id="scope.$index + scope.column.id"
  235. @change="chnageSecondVal(scope.row.seq, tableFormDataObj[scope.row.seq].secondVal, scope.$index)"
  236. :key="key"
  237. ></el-input>
  238. <template slot="error" slot-scope="scope">
  239. <p class="error" :title="scope.error">{{ scope.error }}</p>
  240. </template>
  241. </el-form-item>
  242. <span v-else v-for="(item, index) in tableData[scope.row.index].weight" :key="index">{{item['成品焦']}}</span>
  243. </template></el-table-column> -->
  244. <el-table-column
  245. prop="weight1"
  246. label="高炉用量"
  247. width="120px"
  248. :show-overflow-tooltip="true"
  249. ><template slot-scope="scope">
  250. <el-form-item
  251. v-if="!isCheck && scope.row.isSelection && scope.row.state !== '2'"
  252. :prop="scope.row.seq + '.weight'"
  253. ><el-input clearable
  254. v-for="(itemform, key) in tableFormDataObj[scope.row.seq].weight1"
  255. style="width: 100%;"
  256. v-model="itemform['成品焦']"
  257. v-if="!isNaN(Number(itemform['成品焦']))"
  258. refcous="true"
  259. :rules="tableFormRules.weight"
  260. oninput="this.value = this.value.replace(/[^\d.]/g,'');"
  261. @keydown.native="keyDown" :id="scope.$index + scope.column.id"
  262. @change="chnageSecondVal(scope.row.seq, tableFormDataObj[scope.row.seq].secondVal, scope.$index)"
  263. :key="key"
  264. ></el-input>
  265. <template slot="error" slot-scope="scope">
  266. <p class="error" :title="scope.error">{{ scope.error }}</p>
  267. </template>
  268. </el-form-item>
  269. <span v-else v-for="(item, index) in tableData[scope.row.index].weight1" :key="index">{{item['成品焦']}}</span>
  270. </template></el-table-column>
  271. <el-table-column
  272. prop="weight2"
  273. label="外销数量"
  274. width="120px"
  275. :show-overflow-tooltip="true"
  276. ><template slot-scope="scope">
  277. <el-form-item
  278. v-if="!isCheck && scope.row.isSelection && scope.row.state !== '2'"
  279. :prop="scope.row.seq + '.weight'"
  280. ><el-input clearable
  281. v-for="(itemform, key) in tableFormDataObj[scope.row.seq].weight2"
  282. style="width: 100%;"
  283. v-model="itemform['成品焦']"
  284. v-if="!isNaN(Number(itemform['成品焦']))"
  285. refcous="true"
  286. :rules="tableFormRules.weight"
  287. oninput="this.value = this.value.replace(/[^\d.]/g,'');"
  288. @keydown.native="keyDown" :id="scope.$index + scope.column.id"
  289. @change="chnageSecondVal(scope.row.seq, tableFormDataObj[scope.row.seq].secondVal, scope.$index)"
  290. :key="key"
  291. ></el-input>
  292. <template slot="error" slot-scope="scope">
  293. <p class="error" :title="scope.error">{{ scope.error }}</p>
  294. </template>
  295. </el-form-item>
  296. <span v-else v-for="(item, index) in tableData[scope.row.index].weight2" :key="index">{{item['成品焦']}}</span>
  297. </template></el-table-column>
  298. <el-table-column
  299. label="生产合计"
  300. prop="subtotal"
  301. fixed="left"
  302. width="120px"
  303. :show-overflow-tooltip="true"
  304. ><template slot-scope="scope">
  305. <template
  306. v-if="!isCheck && scope.row.isSelection && scope.row.state !== '2'"
  307. ><span
  308. v-for="(itemform, key) in tableFormDataObj[scope.row.seq].weight1" v-if="!isNaN(Number(itemform['成品焦']))"
  309. :key="key">{{ Number(itemform['成品焦']) + Number(tableData[scope.row.index].weight2[key]['成品焦']) }}</span>
  310. </template>
  311. <span v-else v-for="(item, index) in tableData[scope.row.index].subtotal" :key="index">{{item['成品焦']}}</span>
  312. </template></el-table-column>
  313. </el-table-column>
  314. <el-table-column
  315. label="小粒焦">
  316. <el-table-column
  317. prop="weight1"
  318. label="高炉用量"
  319. width="120px"
  320. :show-overflow-tooltip="true"
  321. ><template slot-scope="scope">
  322. <el-form-item
  323. v-if="!isCheck && scope.row.isSelection && scope.row.state !== '2'"
  324. :prop="scope.row.seq + '.weight'"
  325. ><el-input clearable
  326. v-for="(itemform, key) in tableFormDataObj[scope.row.seq].weight1"
  327. style="width: 100%;"
  328. v-model="itemform['小粒焦']"
  329. v-if="!isNaN(Number(itemform['小粒焦']))"
  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].weight1" :key="index">{{item['小粒焦']}}</span>
  342. </template></el-table-column>
  343. <el-table-column
  344. prop="weight2"
  345. label="外销数量"
  346. width="120px"
  347. :show-overflow-tooltip="true"
  348. ><template slot-scope="scope">
  349. <el-form-item
  350. v-if="!isCheck && scope.row.isSelection && scope.row.state !== '2'"
  351. :prop="scope.row.seq + '.weight'"
  352. ><el-input clearable
  353. v-for="(itemform, key) in tableFormDataObj[scope.row.seq].weight2"
  354. style="width: 100%;"
  355. v-model="itemform['小粒焦']"
  356. v-if="!isNaN(Number(itemform['小粒焦']))"
  357. refcous="true"
  358. :rules="tableFormRules.weight"
  359. oninput="this.value = this.value.replace(/[^\d.]/g,'');"
  360. @keydown.native="keyDown" :id="scope.$index + scope.column.id"
  361. @change="chnageSecondVal(scope.row.seq, tableFormDataObj[scope.row.seq].secondVal, scope.$index)"
  362. :key="key"
  363. ></el-input>
  364. <template slot="error" slot-scope="scope">
  365. <p class="error" :title="scope.error">{{ scope.error }}</p>
  366. </template>
  367. </el-form-item>
  368. <span v-else v-for="(item, index) in tableData[scope.row.index].weight2" :key="index">{{item['小粒焦']}}</span>
  369. </template></el-table-column>
  370. <el-table-column
  371. label="生产合计"
  372. prop="subtotal"
  373. fixed="left"
  374. width="120px"
  375. :show-overflow-tooltip="true"
  376. ><template slot-scope="scope">
  377. <template
  378. v-if="!isCheck && scope.row.isSelection && scope.row.state !== '2'"
  379. ><span
  380. v-for="(itemform, key) in tableFormDataObj[scope.row.seq].weight1" v-if="!isNaN(Number(itemform['小粒焦']))"
  381. :key="key">{{ Number(itemform['小粒焦']) + Number(tableData[scope.row.index].weight2[key]['小粒焦']) }}</span>
  382. </template>
  383. <span v-else v-for="(item, index) in tableData[scope.row.index].subtotal" :key="index">{{item['小粒焦']}}</span>
  384. </template></el-table-column>
  385. </el-table-column>
  386. <el-table-column
  387. label="焦粉"
  388. ><el-table-column
  389. prop="weight1"
  390. label="烧结用量"
  391. width="120px"
  392. :show-overflow-tooltip="true"
  393. ><template slot-scope="scope">
  394. <el-form-item
  395. v-if="!isCheck && scope.row.isSelection && scope.row.state !== '2'"
  396. :prop="scope.row.seq + '.weight'"
  397. ><el-input clearable
  398. v-for="(itemform, key) in tableFormDataObj[scope.row.seq].weight1"
  399. style="width: 100%;"
  400. v-model="itemform['焦粉']"
  401. v-if="!isNaN(Number(itemform['焦粉']))"
  402. refcous="true"
  403. :rules="tableFormRules.weight"
  404. oninput="this.value = this.value.replace(/[^\d.]/g,'');"
  405. @keydown.native="keyDown" :id="scope.$index + scope.column.id"
  406. @change="chnageSecondVal(scope.row.seq, tableFormDataObj[scope.row.seq].secondVal, scope.$index)"
  407. :key="key"
  408. ></el-input>
  409. <template slot="error" slot-scope="scope">
  410. <p class="error" :title="scope.error">{{ scope.error }}</p>
  411. </template>
  412. </el-form-item>
  413. <span v-else v-for="(item, index) in tableData[scope.row.index].weight1" :key="index">{{item['焦粉']}}</span>
  414. </template></el-table-column>
  415. <el-table-column
  416. prop="weight2"
  417. label="外销数量"
  418. width="120px"
  419. :show-overflow-tooltip="true"
  420. ><template slot-scope="scope">
  421. <el-form-item
  422. v-if="!isCheck && scope.row.isSelection && scope.row.state !== '2'"
  423. :prop="scope.row.seq + '.weight'"
  424. ><el-input clearable
  425. v-for="(itemform, key) in tableFormDataObj[scope.row.seq].weight2"
  426. style="width: 100%;"
  427. v-model="itemform['焦粉']"
  428. v-if="!isNaN(Number(itemform['焦粉']))"
  429. refcous="true"
  430. :rules="tableFormRules.weight"
  431. oninput="this.value = this.value.replace(/[^\d.]/g,'');"
  432. @keydown.native="keyDown" :id="scope.$index + scope.column.id"
  433. @change="chnageSecondVal(scope.row.seq, tableFormDataObj[scope.row.seq].secondVal, scope.$index)"
  434. :key="key"
  435. ></el-input>
  436. <template slot="error" slot-scope="scope">
  437. <p class="error" :title="scope.error">{{ scope.error }}</p>
  438. </template>
  439. </el-form-item>
  440. <span v-else v-for="(item, index) in tableData[scope.row.index].weight2" :key="index">{{item['焦粉']}}</span>
  441. </template></el-table-column>
  442. <el-table-column
  443. label="生产合计"
  444. prop="subtotal"
  445. fixed="left"
  446. width="120px"
  447. :show-overflow-tooltip="true"
  448. ><template slot-scope="scope">
  449. <template
  450. v-if="!isCheck && scope.row.isSelection && scope.row.state !== '2'"
  451. ><span
  452. v-for="(itemform, key) in tableFormDataObj[scope.row.seq].weight1" v-if="!isNaN(Number(itemform['焦粉']))"
  453. :key="key">{{ Number(itemform['焦粉']) + Number(tableData[scope.row.index].weight2[key]['焦粉']) }}</span>
  454. </template>
  455. <span v-else v-for="(item, index) in tableData[scope.row.index].subtotal" :key="index">{{item['焦粉']}}</span>
  456. </template></el-table-column>
  457. </el-table-column>
  458. <el-table-column
  459. label="除尘焦粉"
  460. >
  461. <el-table-column
  462. prop="weight1"
  463. label="高炉用量"
  464. width="120px"
  465. :show-overflow-tooltip="true"
  466. ><template slot-scope="scope">
  467. <el-form-item
  468. v-if="!isCheck && scope.row.isSelection && scope.row.state !== '2'"
  469. :prop="scope.row.seq + '.weight'"
  470. ><el-input clearable
  471. v-for="(itemform, key) in tableFormDataObj[scope.row.seq].weight1"
  472. style="width: 100%;"
  473. v-model="itemform['除尘焦粉']"
  474. v-if="!isNaN(Number(itemform['除尘焦粉']))"
  475. refcous="true"
  476. :rules="tableFormRules.weight"
  477. oninput="this.value = this.value.replace(/[^\d.]/g,'');"
  478. @keydown.native="keyDown" :id="scope.$index + scope.column.id"
  479. @change="chnageSecondVal(scope.row.seq, tableFormDataObj[scope.row.seq].secondVal, scope.$index)"
  480. :key="key"
  481. ></el-input>
  482. <template slot="error" slot-scope="scope">
  483. <p class="error" :title="scope.error">{{ scope.error }}</p>
  484. </template>
  485. </el-form-item>
  486. <span v-else v-for="(item, index) in tableData[scope.row.index].weight1" :key="index">{{item['除尘焦粉']}}</span>
  487. </template></el-table-column>
  488. <el-table-column
  489. prop="weight2"
  490. label="外销数量"
  491. width="120px"
  492. :show-overflow-tooltip="true"
  493. ><template slot-scope="scope">
  494. <el-form-item
  495. v-if="!isCheck && scope.row.isSelection && scope.row.state !== '2'"
  496. :prop="scope.row.seq + '.weight'"
  497. ><el-input clearable
  498. v-for="(itemform, key) in tableFormDataObj[scope.row.seq].weight2"
  499. style="width: 100%;"
  500. v-model="itemform['除尘焦粉']"
  501. v-if="!isNaN(Number(itemform['除尘焦粉']))"
  502. refcous="true"
  503. oninput="this.value = this.value.replace(/[^\d.]/g,'');"
  504. :rules="tableFormRules.weight"
  505. @keydown.native="keyDown" :id="scope.$index + scope.column.id"
  506. @change="chnageSecondVal(scope.row.seq, tableFormDataObj[scope.row.seq].secondVal, scope.$index)"
  507. :key="key"
  508. ></el-input>
  509. <template slot="error" slot-scope="scope">
  510. <p class="error" :title="scope.error">{{ scope.error }}</p>
  511. </template>
  512. </el-form-item>
  513. <span v-else v-for="(item, index) in tableData[scope.row.index].weight2" :key="index">{{item['除尘焦粉']}}</span>
  514. </template></el-table-column>
  515. <el-table-column
  516. label="生产合计"
  517. prop="subtotal"
  518. fixed="left"
  519. width="120px"
  520. :show-overflow-tooltip="true"
  521. ><template slot-scope="scope">
  522. <template
  523. v-if="!isCheck && scope.row.isSelection && scope.row.state !== '2'"
  524. ><span
  525. v-for="(itemform, key) in tableFormDataObj[scope.row.seq].weight1" v-if="!isNaN(Number(itemform['除尘焦粉']))"
  526. :key="key">{{ Number(itemform['除尘焦粉']) + Number(tableData[scope.row.index].weight2[key]['除尘焦粉']) }}</span>
  527. </template>
  528. <span v-else v-for="(item, index) in tableData[scope.row.index].subtotal" :key="index">{{item['除尘焦粉']}}</span>
  529. </template></el-table-column>
  530. </el-table-column>
  531. <el-table-column
  532. prop="cjsj"
  533. label="创建时间"
  534. width="220px"
  535. :show-overflow-tooltip="true"
  536. ></el-table-column>
  537. <el-table-column
  538. prop="cjr"
  539. label="创建人"
  540. width="160px"
  541. :show-overflow-tooltip="true"
  542. ></el-table-column>
  543. <el-table-column
  544. prop="xgsj"
  545. label="修改时间"
  546. width="220px"
  547. :show-overflow-tooltip="true"
  548. >
  549. </el-table-column>
  550. <el-table-column
  551. prop="xgr"
  552. label="修改人"
  553. width="160px"
  554. :show-overflow-tooltip="true"
  555. ></el-table-column>
  556. <el-table-column
  557. prop="memo"
  558. label="备注"
  559. width="350px"
  560. :show-overflow-tooltip="true"
  561. ><template slot-scope="scope">
  562. <el-form-item
  563. v-if="!isCheck && scope.row.isSelection && scope.row.state !== '2'"
  564. :prop="scope.row.seq + '.memo'"
  565. :rules="tableFormRules.memo"
  566. ><el-input clearable
  567. style="width: 100%;"
  568. v-model="tableFormDataObj[scope.row.seq].memo"
  569. refcous="true"
  570. @keydown.native="keyDown" :id="scope.$index + scope.column.id"
  571. @change="chnageSecondVal(scope.row.seq, tableFormDataObj[scope.row.seq].secondVal, scope.$index)"
  572. ></el-input>
  573. <template slot="error" slot-scope="scope">
  574. <p class="error" :title="scope.error">{{ scope.error }}</p>
  575. </template>
  576. </el-form-item>
  577. <span v-else>{{ scope.row.memo }}</span>
  578. </template>
  579. </el-table-column>
  580. <el-table-column
  581. prop="id"
  582. label="ID"
  583. width="140px"
  584. v-if="filterForm.data.show"
  585. ></el-table-column>
  586. </el-table>
  587. </el-form>
  588. <el-pagination
  589. layout="total, sizes, prev, pager, next, jumper"
  590. :total="total"
  591. :page-sizes="[10, 20, 50, 100, 500, 1000]"
  592. :page-size="pageSize"
  593. :current-page.sync="pageNum"
  594. @size-change="tableSizeChange"
  595. @current-change="getTableData()"
  596. style="text-align: right;margin-top: 10px;"
  597. ></el-pagination>
  598. </div>
  599. </div>
  600. <el-dialog
  601. title="年计划编制-机焦厂(主产品) 新增"
  602. :visible.sync="dialog.editorBox.show"
  603. width="600px"
  604. :close-on-click-modal="false"
  605. :show-close="!loading"
  606. >
  607. <div>
  608. <el-form
  609. :model="dialog.editorBox.form.data"
  610. ref="dialog_form"
  611. size="mini"
  612. label-width="95px"
  613. :rules="dialog.editorBox.form.rules"
  614. >
  615. <el-row>
  616. <el-col :span="12">
  617. <el-form-item
  618. label="产品名称"
  619. prop="productid"
  620. >
  621. <el-select
  622. placeholder=""
  623. prop="productid"
  624. v-model="dialog.editorBox.form.data.productid"
  625. style="width: 100%;"
  626. :rules="dialog.editorBox.form.productid"
  627. >
  628. <el-option
  629. v-for="item in nameObj.productid.arr"
  630. :key="item.id"
  631. :value="item.id"
  632. :label="item.name"
  633. ></el-option>
  634. </el-select>
  635. </el-form-item>
  636. </el-col>
  637. <el-col :span="12">
  638. <el-form-item
  639. label="月份"
  640. prop="yearmonth"
  641. >
  642. <zj-timegran-date
  643. v-model="dialog.editorBox.form.data.yearmonth"
  644. style="width: 100%;"
  645. :timegranId="'MONTH'"
  646. :defaultOffset="-1"
  647. :rules="dialog.editorBox.form.yearmonth"
  648. ></zj-timegran-date>
  649. </el-form-item>
  650. </el-col>
  651. </el-row>
  652. <el-row>
  653. <!-- <el-col :span="12">
  654. <el-form-item
  655. label="平均结焦时间"
  656. prop="unit"
  657. >
  658. <el-time-picker
  659. clearable
  660. v-model="dialog.editorBox.form.data.avgTime"
  661. style="width: 100%;"
  662. :rules="dialog.editorBox.form.avgTime"
  663. placeholder="选择消耗时长">
  664. </el-time-picker>
  665. </el-form-item>
  666. </el-col> -->
  667. <!-- <el-col :span="12">
  668. <el-form-item
  669. label="产生数量"
  670. prop="weight"
  671. >
  672. <el-input
  673. clearable
  674. v-model="dialog.editorBox.form.data.weight"
  675. style="width: 100%;"
  676. :rules="dialog.editorBox.form.weight"
  677. >
  678. </el-input>
  679. </el-form-item>
  680. </el-col> -->
  681. <el-col :span="12">
  682. <el-form-item
  683. label="烧结用量"
  684. prop="weight1"
  685. v-if="dialog.editorBox.form.data.productid === '焦粉'"
  686. >
  687. <el-input
  688. clearable
  689. v-model="dialog.editorBox.form.data.weight1"
  690. style="width: 100%;"
  691. :rules="dialog.editorBox.form.weight1"
  692. >
  693. </el-input>
  694. </el-form-item>
  695. <el-form-item
  696. label="高炉用量"
  697. prop="weight1"
  698. v-else
  699. >
  700. <el-input
  701. clearable
  702. v-model="dialog.editorBox.form.data.weight1"
  703. style="width: 100%;"
  704. :rules="dialog.editorBox.form.weight1"
  705. >
  706. </el-input>
  707. </el-form-item>
  708. </el-col>
  709. <!-- </el-row>
  710. <el-row> -->
  711. <el-col :span="12">
  712. <el-form-item
  713. label="外销数量"
  714. prop="weight2"
  715. >
  716. <el-input
  717. clearable
  718. v-model="dialog.editorBox.form.data.weight2"
  719. style="width: 100%;"
  720. :rules="dialog.editorBox.form.weight2"
  721. >
  722. </el-input>
  723. </el-form-item>
  724. </el-col>
  725. </el-row>
  726. <el-row>
  727. <el-col :span="12">
  728. <el-form-item
  729. label="备注"
  730. prop="meno"
  731. >
  732. <el-input
  733. clearable
  734. v-model="dialog.editorBox.form.data.memo"
  735. style="width: 100%;"
  736. >
  737. </el-input>
  738. </el-form-item>
  739. </el-col>
  740. </el-row>
  741. </el-form>
  742. </div>
  743. <span
  744. slot="footer"
  745. class="dialog-footer"
  746. >
  747. <el-button
  748. :loading="loading"
  749. @click="dialog.editorBox.show = false"
  750. >取 消</el-button>
  751. <el-button
  752. type="primary"
  753. @click="dataSave"
  754. :loading="loading"
  755. >保 存</el-button>
  756. </span>
  757. </el-dialog>
  758. <el-dialog
  759. :visible.sync="dialog.editorBox2.show"
  760. width="400px"
  761. :close-on-click-modal="false"
  762. :show-close="!loading"
  763. >
  764. <div>
  765. <el-form
  766. :model="dialog.editorBox2.form.data"
  767. ref="dialog_form2"
  768. size="mini"
  769. label-width="300px"
  770. :rules="dialog.editorBox2.form.rules"
  771. >
  772. <el-row>
  773. <el-col>
  774. <el-col :span="12">
  775. <el-form-item
  776. label="月份"
  777. prop="memo"
  778. label-width="60px"
  779. >
  780. <zj-timegran-date
  781. v-model="dialog.editorBox2.form.data.yearmonth"
  782. style="width: 150%;"
  783. :timegranId="'MONTH'"
  784. :defaultOffset="-1"
  785. :rules="dialog.editorBox.form.yearmonth"
  786. ></zj-timegran-date>
  787. </el-form-item>
  788. </el-col>
  789. </el-col>
  790. </el-row>
  791. </el-form>
  792. </div>
  793. <span
  794. slot="footer"
  795. class="dialog-footer"
  796. >
  797. <el-button
  798. :loading="loading"
  799. @click="dialog.editorBox2.show = false"
  800. >取 消</el-button>
  801. <el-button
  802. type="primary"
  803. @click="but_copy_plural"
  804. :loading="loading"
  805. >保 存</el-button>
  806. </span>
  807. </el-dialog>
  808. </div>
  809. </template>
  810. <script>
  811. import { zCheckNumber1 } from '@/utils/validator.js'
  812. import timegranDate from '@/components/zg/timegranDate.vue'
  813. import {formatDate, commonSummaries, getCookie} from '@/utils/util.js';
  814. export default {
  815. name: 'outElectricity',
  816. components: {
  817. 'zj-timegran-date': timegranDate
  818. },
  819. data () {
  820. let setDate = new Date();
  821. setDate.setDate(15);
  822. setDate.setMonth((setDate.getMonth() - 1));
  823. return {
  824. rowIndex: '',
  825. columnId: '',
  826. focusTarget: null,
  827. seqArr: [],
  828. editSetFlag: '',
  829. isCheck: false, // 是否为审核人
  830. filterForm: {
  831. show: true,
  832. data: {
  833. clock: '',
  834. clockc: '',
  835. workprocid: [],
  836. location: [],
  837. networkid: [],
  838. state: '',
  839. itemname: '',
  840. searchtype: '0',
  841. measureid: '',
  842. line: '',
  843. unit: '',
  844. yearmonth: '',
  845. weight: '',
  846. weight1: '',
  847. weight2: '',
  848. productid: '',
  849. avgTime: '',
  850. cjr: '',
  851. xgr: '',
  852. xgsj: '',
  853. memo: '',
  854. cp: '',
  855. parentid: 'JJZ',
  856. cjsj: '',
  857. jzsj: '',
  858. zt: '',
  859. show: false
  860. },
  861. rules: {
  862. },
  863. disabled: {
  864. networkid: false
  865. }
  866. },
  867. pageNum: 1,
  868. pageSize: 100,
  869. total: 0,
  870. singleTableHeight: 100,
  871. tableData: [
  872. ],
  873. originalData: [],
  874. loading: false,
  875. tableLoading: false,
  876. multipleSelection: [],
  877. tableFormDataObj: {},
  878. tableFormRules: {
  879. mintvalue: [
  880. // { required: true, message: '该项不能为空', trigger: 'change' },
  881. { validator: zCheckNumber1, trigger: 'change' }
  882. ],
  883. mendvalue: [
  884. // { required: true, message: '该项不能为空', trigger: 'change' },
  885. { validator: zCheckNumber1, trigger: 'change' }
  886. ],
  887. weight: [
  888. { required: true, message: '该项不能为空', trigger: 'change' },
  889. { validator: zCheckNumber1, trigger: 'change' }
  890. ],
  891. weight1: [
  892. { required: true, message: '该项不能为空', trigger: 'change' },
  893. { validator: zCheckNumber1, trigger: 'change' }
  894. ],
  895. weight2: [
  896. { required: true, message: '该项不能为空', trigger: 'change' },
  897. { validator: zCheckNumber1, trigger: 'change' }
  898. ],
  899. wastage: [
  900. { validator: zCheckNumber1, trigger: 'change' }
  901. ],
  902. secondVal: [
  903. { validator: zCheckNumber1, trigger: 'change' }
  904. ],
  905. memo: [
  906. ]
  907. },
  908. nameObj: {
  909. state: {
  910. obj: {
  911. '0': {
  912. name: '未编辑',
  913. color: '#7a7a7a'
  914. },
  915. '1': {
  916. name: '已编辑',
  917. color: 'rgb(28, 111, 217)'
  918. },
  919. '2': {
  920. name: '已审核',
  921. color: 'red'
  922. },
  923. '3': {
  924. name: '已接收',
  925. color: 'red'
  926. }
  927. },
  928. arr: [
  929. {
  930. id: '0',
  931. name: '未编辑'
  932. },
  933. {
  934. id: '1',
  935. name: '已编辑'
  936. },
  937. {
  938. id: '2',
  939. name: '已审核'
  940. },
  941. {
  942. name: '已接收',
  943. color: 'red'
  944. }
  945. ]
  946. },
  947. type: {
  948. obj: {
  949. '0': '否',
  950. '1': '是'
  951. },
  952. arr: [
  953. {
  954. id: '0',
  955. name: '否'
  956. },
  957. {
  958. id: '1',
  959. name: '是'
  960. }
  961. ]
  962. },
  963. unitid: {
  964. obj: {
  965. 't': {
  966. id: 't',
  967. name: '吨'
  968. }
  969. },
  970. arr: [
  971. {
  972. id: 't',
  973. name: '吨'
  974. }
  975. ]
  976. },
  977. workprocid: {
  978. obj: {
  979. 'AT3009': {
  980. id: 'AT3009',
  981. name: '粗苯'
  982. },
  983. 'AT3010': {
  984. id: 'AT3010',
  985. name: '硫铵'
  986. }
  987. },
  988. arr: [{
  989. id: 'AT3009',
  990. name: '粗苯'
  991. },
  992. {
  993. id: 'AT3010',
  994. name: '硫铵'
  995. }]
  996. },
  997. productid: {
  998. obj: {
  999. '成品焦': {
  1000. id: '成品焦',
  1001. name: '成品焦'
  1002. },
  1003. '小粒焦': {
  1004. id: '小粒焦',
  1005. name: '小粒焦'
  1006. },
  1007. '焦粉': {
  1008. id: '焦粉',
  1009. name: '焦粉'
  1010. },
  1011. '除尘焦粉': {
  1012. id: '除尘焦粉',
  1013. name: '除尘焦粉'
  1014. }
  1015. },
  1016. arr: [{
  1017. id: '成品焦',
  1018. name: '成品焦'
  1019. },
  1020. {
  1021. id: '小粒焦',
  1022. name: '小粒焦'
  1023. },
  1024. {
  1025. id: '焦粉',
  1026. name: '焦粉'
  1027. },
  1028. {
  1029. id: '除尘焦粉',
  1030. name: '除尘焦粉'
  1031. }]
  1032. },
  1033. location: {
  1034. obj: {},
  1035. arr: [],
  1036. showDataArr: []
  1037. },
  1038. locateid: {
  1039. obj: {},
  1040. arr: []
  1041. },
  1042. networkid: {
  1043. obj: {},
  1044. arr: []
  1045. },
  1046. userId: {
  1047. obj: {},
  1048. arr: []
  1049. }
  1050. },
  1051. dialog: {
  1052. fRow: null,
  1053. editorBox: {
  1054. show: false,
  1055. type: '',
  1056. form: {
  1057. default: {
  1058. workprocid: ''
  1059. },
  1060. data: {
  1061. unitid: '',
  1062. line: '',
  1063. yearmonth: '',
  1064. weight: '',
  1065. weight1: '',
  1066. weight2: '',
  1067. productid: '',
  1068. memo: ''
  1069. },
  1070. rules: {
  1071. weight: [
  1072. { required: true, message: '该项不能为空', trigger: 'change' },
  1073. { validator: zCheckNumber1, trigger: 'change' }
  1074. ],
  1075. weight1: [
  1076. { required: true, message: '该项不能为空', trigger: 'change' },
  1077. { validator: zCheckNumber1, trigger: 'change' }
  1078. ],
  1079. weight2: [
  1080. { required: true, message: '该项不能为空', trigger: 'change' },
  1081. { validator: zCheckNumber1, trigger: 'change' }
  1082. ],
  1083. productid: [{ required: true, message: '该项不能为空', trigger: 'change' }],
  1084. yearmonth: [{ required: true, message: '该项不能为空', trigger: 'change' }],
  1085. unitid: [{ required: true, message: '该项不能为空', trigger: 'change' }],
  1086. line: [{ required: true, message: '该项不能为空', trigger: 'change' }]
  1087. }
  1088. }
  1089. },
  1090. editorBox2: {
  1091. show: false,
  1092. type: '',
  1093. form: {
  1094. data: {
  1095. yearmonth: ''
  1096. },
  1097. rules: {
  1098. yearmonth: [{ required: true, message: '该项不能为空', trigger: 'change' }]
  1099. }
  1100. }
  1101. }
  1102. },
  1103. butPrivilege: {
  1104. QUERY: false,
  1105. PUT: false,
  1106. CHECK: false,
  1107. UNDOCHECK: false
  1108. },
  1109. loginName: getCookie('loginName')
  1110. }
  1111. },
  1112. created () {
  1113. // 获取按钮权限
  1114. this.activeMenu = window.localStorage.getItem('activeMenu');
  1115. for (let key in this.butPrivilege) {
  1116. this.butPrivilege[key] = this.checkPrivilege(this.activeMenu + key);
  1117. }
  1118. },
  1119. mounted () {
  1120. let that = this;
  1121. window.PEDataObj = {
  1122. // 将数据绑定到window上,供main页面使用
  1123. vm: that,
  1124. // tableArr:用于导出成Excel的表格的信息
  1125. tableArr: [
  1126. {
  1127. name: '',
  1128. id: 'singleTable'
  1129. }
  1130. ]
  1131. };
  1132. that.$nextTick(() => {
  1133. // 立即获取的height有一定偏差,通过setTimeout延迟来解决
  1134. setTimeout(() => {
  1135. that.singleTableHeight = that.getRoleHeight(that.$refs['singleTable'].$el) - 45;
  1136. }, 1);
  1137. });
  1138. // 接收路由参数
  1139. if (that.$route.query.networkid) {
  1140. that.filterForm.disabled.networkid = true;
  1141. that.filterForm.data.networkid = that.$route.query.networkid.split(',');
  1142. }
  1143. // 当有审核与取消审核权限时,默认其为审核人,审核人无法修改数据
  1144. if (that.butPrivilege.CHECK || that.butPrivilege.UNDOCHECK) {
  1145. that.isCheck = true;
  1146. }
  1147. // 管理员在这里录入数据
  1148. if (that.loginName === 'admin' && that.filterForm.disabled.networkid) {
  1149. that.isCheck = false;
  1150. }
  1151. // that.getLocation();
  1152. that.getLocateIdData();
  1153. that.getNetworkIdData();
  1154. // that.getTableData();
  1155. that.getUnitIdData();
  1156. },
  1157. methods: {
  1158. // 计算树区域高度
  1159. getRoleHeight (dom) {
  1160. return window.innerHeight - dom.offsetTop;
  1161. },
  1162. detailMessage (row) {
  1163. // console.log(row.date)// 此时就能拿到整行的信息
  1164. },
  1165. // 自定义的表格合计方法:只给指定列进行合计
  1166. getSummaries (param) {
  1167. const prop = ['apportvalue', 'realvalue', 'wastage', 'total']; // 合计列绑定的prop
  1168. const {columns, data} = param;
  1169. const sums = commonSummaries(param, prop);
  1170. let that = this;
  1171. // js中有两种不同的数据类型,一个是基本类型,一个是引用类型,其中Object是引用类型
  1172. // 浅拷贝复制的是引用,深拷贝复制的是实体,简单的说,就是如果b复制a,现在修改b,如果a跟着改变,这种就是浅拷贝如果a不变,就是深拷贝
  1173. // 拷贝值 JSON.parse(JSON.stringify(row))
  1174. columns.forEach((column, index) => {
  1175. if (index === 1) {
  1176. sums[index] = '合计';
  1177. return;
  1178. };
  1179. let priductIdTotal = 0;
  1180. let priductIdTotal1 = 0;
  1181. let priductIdTotal2 = 0;
  1182. let priductIdTotal3 = 0;
  1183. let weiItem = 0;
  1184. switch (column.property) {
  1185. case 'subtotal':
  1186. priductIdTotal = 0;
  1187. priductIdTotal1 = 0;
  1188. priductIdTotal2 = 0;
  1189. priductIdTotal3 = 0;
  1190. for (let i = 0; i < this.tableData.length; i++) {
  1191. this.tableData[i].subtotal.forEach((item, key) => {
  1192. weiItem = (isNaN(item['成品焦']) ? 0 : item['成品焦']);
  1193. priductIdTotal += Number(weiItem);
  1194. });
  1195. that.tableData[i].subtotal.forEach((item, key) => {
  1196. weiItem = (isNaN(item['小粒焦']) ? 0 : item['小粒焦']);
  1197. priductIdTotal1 += Number(weiItem);
  1198. });
  1199. that.tableData[i].subtotal.forEach((item, key) => {
  1200. weiItem = (isNaN(item['焦粉']) ? 0 : item['焦粉']);
  1201. priductIdTotal2 += Number(weiItem);
  1202. });
  1203. that.tableData[i].subtotal.forEach((item, key) => {
  1204. weiItem = (isNaN(item['除尘焦粉']) ? 0 : item['除尘焦粉']);
  1205. priductIdTotal3 += Number(weiItem);
  1206. });
  1207. };
  1208. sums[index] = (index % 16 === 0) ? priductIdTotal3 : (
  1209. (index % 13 === 0) ? priductIdTotal2 : (index % 10 === 0) ? priductIdTotal1 : priductIdTotal);
  1210. break;
  1211. case 'weight1':
  1212. priductIdTotal = 0;
  1213. priductIdTotal1 = 0;
  1214. priductIdTotal2 = 0;
  1215. priductIdTotal3 = 0;
  1216. for (let i = 0; i < that.tableData.length; i++) {
  1217. that.tableData[i].weight1.forEach((item, key) => {
  1218. weiItem = (isNaN(item['成品焦']) ? 0 : item['成品焦']);
  1219. priductIdTotal += Number(weiItem);
  1220. });
  1221. that.tableData[i].weight1.forEach((item, key) => {
  1222. weiItem = (isNaN(item['小粒焦']) ? 0 : item['小粒焦']);
  1223. priductIdTotal1 += Number(weiItem);
  1224. });
  1225. that.tableData[i].weight1.forEach((item, key) => {
  1226. weiItem = (isNaN(item['焦粉']) ? 0 : item['焦粉']);
  1227. priductIdTotal2 += Number(weiItem);
  1228. });
  1229. that.tableData[i].weight1.forEach((item, key) => {
  1230. weiItem = (isNaN(item['除尘焦粉']) ? 0 : item['除尘焦粉']);
  1231. priductIdTotal3 += Number(weiItem);
  1232. });
  1233. };
  1234. sums[index] = (index % 14 === 0) ? priductIdTotal3 : (
  1235. (index % 11 === 0) ? priductIdTotal2 : (index % 8 === 0) ? priductIdTotal1 : priductIdTotal);
  1236. break;
  1237. case 'weight2':
  1238. priductIdTotal = 0;
  1239. priductIdTotal1 = 0;
  1240. priductIdTotal2 = 0;
  1241. priductIdTotal3 = 0;
  1242. for (let i = 0; i < that.tableData.length; i++) {
  1243. that.tableData[i].weight2.forEach((item, key) => {
  1244. weiItem = (isNaN(item['成品焦']) ? 0 : item['成品焦']);
  1245. priductIdTotal += Number(weiItem);
  1246. });
  1247. that.tableData[i].weight2.forEach((item, key) => {
  1248. weiItem = (isNaN(item['小粒焦']) ? 0 : item['小粒焦']);
  1249. priductIdTotal1 += Number(weiItem);
  1250. });
  1251. that.tableData[i].weight2.forEach((item, key) => {
  1252. weiItem = (isNaN(item['焦粉']) ? 0 : item['焦粉']);
  1253. priductIdTotal2 += Number(weiItem);
  1254. });
  1255. that.tableData[i].weight2.forEach((item, key) => {
  1256. weiItem = (isNaN(item['除尘焦粉']) ? 0 : item['除尘焦粉']);
  1257. priductIdTotal3 += Number(weiItem);
  1258. });
  1259. };
  1260. sums[index] = (index % 15 === 0) ? priductIdTotal3 : (
  1261. (index % 12 === 0) ? priductIdTotal2 : (index % 9 === 0) ? priductIdTotal1 : priductIdTotal);
  1262. break;
  1263. default:
  1264. break;
  1265. }
  1266. });
  1267. return sums;
  1268. // return commonSummaries(param, prop);
  1269. },
  1270. // 获取工序列表
  1271. // getNodeData () {
  1272. // let that = this
  1273. // let url = 'pass/ems/v1/trmworkprocs/getIdAndName?issettle=1';
  1274. // that.axios.get(url)
  1275. // .then(function (res) {
  1276. // if (res.code === '0') {
  1277. // let arr = [];
  1278. // let obj = {};
  1279. // for (let item of res.data) {
  1280. // arr.push({
  1281. // id: item.id,
  1282. // name: item.name
  1283. // })
  1284. // obj[item.id] = item.name;
  1285. // }
  1286. // that.nameObj.workprocid.arr = arr;
  1287. // that.nameObj.workprocid.obj = obj;
  1288. // that.connn();
  1289. // } else {
  1290. // that.$message.error(res.message);
  1291. // }
  1292. // });
  1293. // },
  1294. getUnitIdData () {
  1295. let that = this
  1296. let url = 'pass/ems/v1/trmunits/getIdAndName';
  1297. that.axios.get(url)
  1298. .then(function (res) {
  1299. if (res.code === '0') {
  1300. let arr = [];
  1301. let obj = {};
  1302. for (let item of res.data) {
  1303. arr.push({
  1304. id: item.id,
  1305. name: item.name
  1306. })
  1307. obj[item.id] = item.name;
  1308. if (item.name === '吨') {
  1309. that.nameObj.unitid.defaults = that.nameObj.unitid.defaults ? that.nameObj.unitid.defaults : item.id;
  1310. }
  1311. }
  1312. that.nameObj.unitid.arr = arr;
  1313. that.nameObj.unitid.obj = obj;
  1314. } else {
  1315. that.$message.error(res.message);
  1316. }
  1317. });
  1318. },
  1319. // 获取站所
  1320. getNetworkIdData () {
  1321. let that = this
  1322. let url = 'pass/ems/v1/trmstations/getidandname/';
  1323. that.axios.get(url)
  1324. .then(function (res) {
  1325. if (res.code === '0') {
  1326. let arr = [];
  1327. let obj = {};
  1328. for (let item of res.data) {
  1329. arr.push({
  1330. id: item.id,
  1331. name: item.name
  1332. })
  1333. obj[item.id] = item.name;
  1334. }
  1335. that.nameObj.networkid.arr = arr;
  1336. that.nameObj.networkid.obj = obj;
  1337. } else {
  1338. that.$message.error(res.message);
  1339. }
  1340. });
  1341. },
  1342. // 复制
  1343. but_copy_plural () {
  1344. let that = this;
  1345. let SubmitData = [];
  1346. for (let key in that.tableFormDataObj) {
  1347. let memoArr = that.tableFormDataObj[key].memo.split(';');
  1348. for (let i = 0; i < that.tableFormDataObj[key].weight1.length; i++) {
  1349. for (let keyname in that.tableFormDataObj[key].weight1[i]) {
  1350. SubmitData.push({
  1351. // weight: that.tableFormDataObj[key].weight[i][keyname],
  1352. weight1: that.tableFormDataObj[key].weight1[i][keyname],
  1353. weight2: that.tableFormDataObj[key].weight2[i][keyname],
  1354. memo: memoArr[i],
  1355. unit: that.tableFormDataObj[key].unit,
  1356. parentid: that.filterForm.data.parentid,
  1357. productid: that.tableFormDataObj[key].productid[i][i],
  1358. yearmonth: that.dialog.editorBox2.form.data.yearmonth
  1359. });
  1360. };
  1361. };
  1362. }
  1363. that.$refs['dialog_form2'].validate((valid) => {
  1364. if (valid) {
  1365. that.loading = true;
  1366. that.axios.post('pass/ems/v1/emsprodplanyears/', SubmitData, {
  1367. contentType: 'application/json'
  1368. })
  1369. .then(function (res) {
  1370. if (res.code === '0') {
  1371. that.$message({
  1372. message: '复制成功',
  1373. type: 'success'
  1374. });
  1375. that.getTableData();
  1376. that.dialog.editorBox2.show = false;
  1377. } else {
  1378. that.$message.error(res.message);
  1379. }
  1380. that.loading = false;
  1381. }).catch(function () {
  1382. that.loading = false;
  1383. });
  1384. } else {
  1385. this.$message.error('至少选择一条数据');
  1386. }
  1387. });
  1388. },
  1389. connn () {
  1390. let that = this;
  1391. if (!that.filterForm.data.networkid || that.filterForm.data.networkid.length === 0) {
  1392. that.nameObj.location.showDataArr = that.nameObj.workprocid.arr;
  1393. } else {
  1394. let url = 'pass/ems/v1/trmelectricitylocations/getWorkprocs?workshop=' + that.filterForm.data.networkid.toString();
  1395. that.axios.get(url)
  1396. .then(function (res) {
  1397. if (res.code === '0') {
  1398. let arr = [];
  1399. for (let item of res.data) {
  1400. arr.push({
  1401. id: item.id,
  1402. name: item.name
  1403. })
  1404. }
  1405. that.nameObj.location.showDataArr = arr;
  1406. } else {
  1407. that.$message.error(res.message);
  1408. }
  1409. });
  1410. }
  1411. },
  1412. // 获取位置
  1413. getLocateIdData () {
  1414. let that = this
  1415. let url = 'pass/ems/v1/trmlocations/getidandname/';
  1416. that.axios.get(url)
  1417. .then(function (res) {
  1418. if (res.code === '0') {
  1419. let arr = [];
  1420. let obj = {};
  1421. for (let item of res.data) {
  1422. arr.push({
  1423. id: item.id,
  1424. name: item.name
  1425. })
  1426. obj[item.id] = item.name;
  1427. }
  1428. that.nameObj.locateid.arr = arr;
  1429. that.nameObj.locateid.obj = obj;
  1430. } else {
  1431. that.$message.error(res.message);
  1432. }
  1433. });
  1434. },
  1435. // 获取表格中的数据
  1436. getTableData (pageNum) {
  1437. let that = this,
  1438. params = {},
  1439. pData = {
  1440. yearmonth: that.filterForm.data.yearmonth,
  1441. workprocid: that.filterForm.data.workprocid.toString(),
  1442. location: that.filterForm.data.location.toString(),
  1443. networkid: that.filterForm.data.networkid.toString(),
  1444. itemname: that.filterForm.data.itemname,
  1445. zt: that.filterForm.data.zt,
  1446. measureid: that.filterForm.data.measureid,
  1447. exactsearch: that.filterForm.data.searchtype,
  1448. parentid: that.filterForm.data.parentid,
  1449. parentNum: that.nameObj.productid.arr.length
  1450. };
  1451. for (let key in pData) {
  1452. if (pData[key]) {
  1453. params[key] = pData[key];
  1454. }
  1455. }
  1456. that.pageNum = pageNum || that.pageNum;
  1457. that.tableLoading = true;
  1458. // console.log(pData);
  1459. // let url = 'pass/ems/v1/trmtransfereactvalues/getDateEditForPage/?pageNum=' + that.pageNum + '&pageSize=' + that.pageSize;
  1460. // if (that.isCheck) {
  1461. // url = 'pass/ems/v1/trmtransfereactvalues/?pageNum=' + that.pageNum + '&pageSize=' + that.pageSize;
  1462. // }
  1463. let url = 'pass/ems/v1/emsprodplanyears/getList/?pageNum=' + that.pageNum + '&pageSize=' + that.pageSize;
  1464. that.axios.get(url, {
  1465. params: params
  1466. })
  1467. .then(function (res) {
  1468. if (res.code === '0') {
  1469. let arr = [];
  1470. let index = 0;
  1471. let chirItem = res.data.list[0];
  1472. for (let e in chirItem) {
  1473. let item = chirItem[e];
  1474. // let weightArr = [];
  1475. let subtotalArr = [];
  1476. let weightArr1 = [];
  1477. let weightArr2 = [];
  1478. let noArr = [];
  1479. let memoArr = [];
  1480. let sumRow = 0;
  1481. let sum = 0;
  1482. let indexArr = [];
  1483. let productidArr = [];
  1484. let memoLong = '';
  1485. for (let i = 0; i < chirItem[e].length; i++) {
  1486. // weightArr.push({
  1487. // [item[i].productid]: item[i].weight
  1488. // });
  1489. weightArr1.push({
  1490. [item[i].productid]: item[i].weight1
  1491. });
  1492. weightArr2.push({
  1493. [item[i].productid]: item[i].weight2
  1494. });
  1495. productidArr.push({
  1496. [i]: item[i].productid
  1497. });
  1498. memoArr.push({
  1499. [i]: item[i].memo
  1500. });
  1501. noArr.push({
  1502. [i]: item[i].no
  1503. });
  1504. if (item[i].memo !== null && item[i].memo !== '') {
  1505. memoLong = memoLong + item[i].memo + ';';
  1506. };
  1507. indexArr.push({
  1508. [i]: [i]
  1509. });
  1510. subtotalArr.push({
  1511. [item[i].productid]: item[i].weight1 + item[i].weight2
  1512. });
  1513. // sum += item[i].weight + item[i].weight1 + item[i].weight2;
  1514. sum += item[i].weight1 + item[i].weight2;
  1515. };
  1516. arr.push({
  1517. seq: index,
  1518. unit: item[chirItem[e].length - 1].unit,
  1519. line: item[chirItem[e].length - 1].line,
  1520. yearmonth: item[chirItem[e].length - 1].yearmonth,
  1521. cjr: item[chirItem[e].length - 1].cjr,
  1522. cjsj: item[chirItem[e].length - 1].cjsj,
  1523. jzsj: item[chirItem[e].length - 1].jzsj,
  1524. xgr: item[chirItem[e].length - 1].xgr,
  1525. xgsj: item[chirItem[e].length - 1].xgsj,
  1526. cp: item[chirItem[e].length - 1].cp,
  1527. zt: item[chirItem[e].length - 1].zt,
  1528. parentid: item[chirItem[e].length - 1].parentid,
  1529. no: noArr,
  1530. id: item[chirItem[e].length - 1].id,
  1531. total: sum,
  1532. // weight: weightArr,
  1533. subtotal: subtotalArr,
  1534. weight1: weightArr1,
  1535. weight2: weightArr2,
  1536. productid: productidArr,
  1537. memo: memoLong
  1538. });
  1539. index = index + 1;
  1540. }
  1541. // console.log(arr);
  1542. that.total = res.data.total;
  1543. that.tableData = JSON.parse(JSON.stringify(arr));
  1544. that.originalData = JSON.parse(JSON.stringify(arr));
  1545. that.getAdds();
  1546. } else {
  1547. that.$message.error(res.message);
  1548. }
  1549. that.$nextTick(() => {
  1550. setTimeout(() => {
  1551. that.singleTableHeight = that.getRoleHeight(that.$refs['singleTable'].$el) - 46;
  1552. }, 1);
  1553. });
  1554. that.tableLoading = false;
  1555. }).catch(function () {
  1556. that.tableLoading = false;
  1557. });
  1558. },
  1559. // 获取表格中的数据
  1560. getTableDataEdit () {
  1561. let that = this,
  1562. params = {},
  1563. pData = {
  1564. yearmonth: that.filterForm.data.yearmonth,
  1565. workprocid: that.filterForm.data.workprocid.toString(),
  1566. location: that.filterForm.data.location.toString(),
  1567. networkid: that.filterForm.data.networkid.toString(),
  1568. itemname: that.filterForm.data.itemname,
  1569. exactsearch: that.filterForm.data.searchtype,
  1570. parentid: that.filterForm.data.parentid
  1571. };
  1572. for (let key in pData) {
  1573. if (pData[key]) {
  1574. params[key] = pData[key];
  1575. }
  1576. }
  1577. that.tableLoading = true;
  1578. let url = 'pass/ems/v1/emsprodplanyears/getDateEditForPage/?pageNum=1&pageSize=' + that.pageSize;
  1579. that.axios.get(url, {
  1580. params: params
  1581. })
  1582. .then(function (res) {
  1583. if (res.code === '0') {
  1584. let arr = [];
  1585. for (let i = 0; i < res.data.list.length; i++) {
  1586. let item = res.data.list[i];
  1587. arr.push({
  1588. seq: i,
  1589. unit: item.unit,
  1590. line: item.line,
  1591. yearmonth: item.yearmonth,
  1592. // weight: item.weight,
  1593. weight1: item.weight1,
  1594. weight2: item.weight2,
  1595. productid: item.productid,
  1596. cjr: item.cjr,
  1597. cjsj: item.cjsj,
  1598. jzsj: item.jzsj,
  1599. xgr: item.xgr,
  1600. xgsj: item.xgsj,
  1601. cp: item.cp,
  1602. sysl: item.sysl,
  1603. zt: item.zt,
  1604. wxsy: item.wxsy
  1605. });
  1606. }
  1607. that.total = res.data.total;
  1608. that.tableData = arr;
  1609. that.getAdds();
  1610. } else {
  1611. that.$message.error(res.message);
  1612. }
  1613. that.$nextTick(() => {
  1614. setTimeout(() => {
  1615. that.singleTableHeight = that.getRoleHeight(that.$refs['singleTable'].$el) - 46;
  1616. }, 1);
  1617. });
  1618. that.tableLoading = false;
  1619. }).catch(function () {
  1620. that.tableLoading = false;
  1621. });
  1622. },
  1623. // 合并相同的用电地点
  1624. arraySpanMethod ({ row, column, rowIndex, columnIndex }) {
  1625. let that = this;
  1626. let tableData = this.$refs.singleTable.tableData
  1627. let c1 = row.workprocid;
  1628. let c2 = row.location;
  1629. let c3 = row.workshop;
  1630. let c4 = row.clock;
  1631. let c5 = row.clocke;
  1632. let rowsPan = 1;
  1633. // let adds = this.$refs.singleTable.tableData[rowIndex].realvalue;
  1634. if (column['property'] === 'workprocid' || column['property'] === 'adds') {
  1635. if (rowIndex > 0 && c1 === tableData[rowIndex - 1].workprocid && c2 === tableData[rowIndex - 1].location &&
  1636. c3 === tableData[rowIndex - 1].workshop && c4 === tableData[rowIndex - 1].clock && c5 === tableData[rowIndex - 1].clocke) {
  1637. return {
  1638. rowspan: 0,
  1639. colspan: 0
  1640. };
  1641. };
  1642. while (tableData[rowIndex + rowsPan] && c1 === tableData[rowIndex + rowsPan].workprocid && c2 === tableData[rowIndex + rowsPan].location &&
  1643. c3 === tableData[rowIndex + rowsPan].workshop && c4 === tableData[rowIndex + rowsPan].clock && c5 === tableData[rowIndex + rowsPan].clocke) {
  1644. rowsPan += 1
  1645. }
  1646. return {
  1647. rowspan: rowsPan,
  1648. colspan: 1
  1649. };
  1650. }
  1651. },
  1652. // 改变表格显示条数
  1653. tableSizeChange (val) {
  1654. let that = this;
  1655. that.pageSize = val;
  1656. that.getTableData(1);
  1657. },
  1658. // 重置搜索
  1659. tableDataCancel () {
  1660. let that = this;
  1661. for (let key in that.filterForm.data) {
  1662. if (!that.filterForm.disabled || !that.filterForm.disabled[key]) {
  1663. if (that.filterForm.data[key] instanceof Array) {
  1664. that.filterForm.data[key] = [];
  1665. } else {
  1666. that.filterForm.data[key] = '';
  1667. }
  1668. }
  1669. }
  1670. that.getTableData(1);
  1671. },
  1672. // 键盘事件
  1673. keyDown (event1, disabledFlag) {
  1674. let tdTarget = event1.target;
  1675. let _this = this;
  1676. while (tdTarget.tagName !== 'TD') {
  1677. tdTarget = tdTarget.parentElement;
  1678. }
  1679. // 如果按下键盘下键或者回车键
  1680. if (event.keyCode === 40 || event.keyCode === 13) {
  1681. let index = parseInt(this.rowIndex);
  1682. // index++;
  1683. if (index !== this.seqArr[this.seqArr.length - 1]) {
  1684. for (let i = 0; i < this.seqArr.length; i++) {
  1685. if (index === this.seqArr[i]) {
  1686. index = this.seqArr[i + 1];
  1687. break;
  1688. }
  1689. }
  1690. }
  1691. this.editSetFlag = index + this.columnId;
  1692. let id = '#' + this.editSetFlag;
  1693. this.$nextTick(() => {
  1694. $(id).click();
  1695. });
  1696. } else if (event.keyCode === 38) { // 键盘上键
  1697. let index = parseInt(this.rowIndex);
  1698. if (index !== this.seqArr[0]) {
  1699. for (let i = 0; i < this.seqArr.length; i++) {
  1700. if (index === this.seqArr[i]) {
  1701. index = this.seqArr[i - 1];
  1702. break;
  1703. }
  1704. }
  1705. }
  1706. this.editSetFlag = index + this.columnId;
  1707. let id = '#' + this.editSetFlag;
  1708. this.$nextTick(() => {
  1709. $(id).click();
  1710. });
  1711. } else if (event.keyCode === 37) { // 键盘左键
  1712. $(tdTarget).prevAll().find('input:text').last().click();
  1713. } else if (event.keyCode === 39) { // 键盘右键
  1714. $(tdTarget).nextAll().find('input').eq(0).click();
  1715. }
  1716. },
  1717. // 只允许对未接收的数据进行操作
  1718. checkboxT (row, index) {
  1719. if (row.zt === '2' && !this.isCheck) {
  1720. return false;
  1721. } else {
  1722. return true;
  1723. }
  1724. },
  1725. // 选择的值发生改变
  1726. handleSelectionChange (val) {
  1727. // console.log('我要改数据了');
  1728. let that = this;
  1729. let tableFormDataObj = {};
  1730. let valTwo = JSON.parse(JSON.stringify(val));
  1731. let arr = [];
  1732. for (let item of val) {
  1733. arr.push(item.seq);
  1734. }
  1735. this.seqArr = arr.sort(sortNumber);
  1736. for (let item of that.tableData) {
  1737. item.isSelection = false;
  1738. }
  1739. let arrcha = [...JSON.parse(JSON.stringify(that.originalData))].filter(x => [...val].every(y => y.id !== x.id));
  1740. for (let item of arrcha) {
  1741. // 取消选择时赋初始值
  1742. for (let weiIndex in that.tableData[item.seq].weight1) {
  1743. for (let weiKey in that.tableData[item.seq].weight1[weiIndex]) {
  1744. // that.tableData[item.seq].weight[weiIndex][weiKey] = that.originalData[item.seq].weight[weiIndex][weiKey];
  1745. that.tableData[item.seq].weight1[weiIndex][weiKey] = that.originalData[item.seq].weight1[weiIndex][weiKey];
  1746. that.tableData[item.seq].weight2[weiIndex][weiKey] = that.originalData[item.seq].weight2[weiIndex][weiKey];
  1747. }
  1748. }
  1749. // that.tableData[item.seq].weight = JSON.parse(JSON.stringify(that.originalData[item.seq]));
  1750. // that.tableData[item.seq] = JSON.parse(JSON.stringify(that.originalData[item.seq]));
  1751. };
  1752. for (let item of val) {
  1753. let obj = {};
  1754. let xId = item.seq;
  1755. if (that.tableFormDataObj[xId]) {
  1756. // 如果已存在该数据则使用该数据
  1757. tableFormDataObj[xId] = that.tableFormDataObj[xId];
  1758. } else {
  1759. // 负责则从对应行中获取行内原数据
  1760. for (let key in item) {
  1761. obj[key] = item[key];
  1762. }
  1763. item.realvalue = (!isNaN(Number(item.apportvalue)) && !isNaN(Number(item.wastage))) ? Number(item.apportvalue) + Number(item.wastage) - Number(item.secondVal) : item.realvalue;
  1764. tableFormDataObj[xId] = obj;
  1765. }
  1766. item.isSelection = true;
  1767. }
  1768. for (let item of that.tableData) {
  1769. if (item.isSelection === false) {
  1770. // that.tableData[item.seq] = JSON.parse(JSON.stringify(that.originalData[item.seq]));
  1771. item.realvalue = (!isNaN(Number(item.apportvalue)) && !isNaN(Number(item.wastage))) ? Number(item.apportvalue) + Number(item.wastage) - Number(item.secondVal) : item.realvalue;
  1772. }
  1773. }
  1774. that.tableFormDataObj = tableFormDataObj;
  1775. that.multipleSelection = val;
  1776. this.getAdds();
  1777. },
  1778. // 当上月底码发生改变时计算抄度与实际电量
  1779. getApportValue (seq, value, rowIndex, event) {
  1780. let that = this;
  1781. if (!isNaN(Number(value))) {
  1782. if (!isNaN(Number(that.tableFormDataObj[seq].mintvalue)) && !isNaN(Number(that.tableFormDataObj[seq].mendvalue)) && that.tableFormDataObj[seq].mintvalue !== null && that.tableFormDataObj[seq].mendvalue !== null) {
  1783. let poor = that.floatComputed(Number(that.tableFormDataObj[seq].mendvalue), Number(that.tableFormDataObj[seq].mintvalue), '-');
  1784. that.tableFormDataObj[seq].apportvalue = that.floatComputed(poor, Number(that.tableFormDataObj[seq].mods), '*').toFixed(0);
  1785. let rv1 = that.floatComputed(Number(that.tableFormDataObj[seq].apportvalue), Number(that.tableFormDataObj[seq].wastage), '+');
  1786. that.tableFormDataObj[seq].realvalue = that.floatComputed(rv1, Number(that.tableFormDataObj[seq].secondVal), '-').toFixed(0);
  1787. that.showRealValue(rowIndex, that.tableFormDataObj[seq].realvalue);
  1788. }
  1789. }
  1790. },
  1791. // 手动修改抄度后计算实际电量
  1792. chnageApportvalue (seq, value, rowIndex) {
  1793. let that = this;
  1794. if (!isNaN(Number(value)) && !isNaN(Number(that.tableFormDataObj[seq].wastage))) {
  1795. that.tableFormDataObj[seq].realvalue = that.floatComputed(Number(value), Number(that.tableFormDataObj[seq].wastage), '+').toFixed(0);
  1796. }
  1797. that.showRealValue(rowIndex, that.tableFormDataObj[seq].realvalue);
  1798. },
  1799. // 手动修改损耗后计算实际电量
  1800. chnageWastage (seq, value, rowIndex) {
  1801. let that = this;
  1802. if (!isNaN(Number(value)) && !isNaN(Number(that.tableFormDataObj[seq].apportvalue)) && that.tableFormDataObj[seq].apportvalue !== null) {
  1803. let rv1 = that.floatComputed(Number(value), Number(that.tableFormDataObj[seq].apportvalue), '+');
  1804. that.tableFormDataObj[seq].realvalue = that.floatComputed(rv1, Number(that.tableFormDataObj[seq].secondVal), '-').toFixed(0);
  1805. that.showRealValue(rowIndex, that.tableFormDataObj[seq].realvalue);
  1806. }
  1807. },
  1808. // 手动修改二次转供电后计算实际电量
  1809. chnageSecondVal (seq, value, rowIndex) {
  1810. let that = this;
  1811. if (!isNaN(Number(value)) && !isNaN(Number(that.tableFormDataObj[seq].apportvalue)) && that.tableFormDataObj[seq].apportvalue !== null) {
  1812. let val1 = that.floatComputed(Number(that.tableFormDataObj[seq].apportvalue), Number(that.tableFormDataObj[seq].wastage), '+');
  1813. that.tableFormDataObj[seq].realvalue = that.floatComputed(val1, Number(value), '-').toFixed(0);
  1814. that.showRealValue(rowIndex, that.tableFormDataObj[seq].realvalue);
  1815. }
  1816. },
  1817. // 统计合计值
  1818. getAdds () {
  1819. let that = this;
  1820. let wlarr = [];
  1821. for (var i = 0; i < that.tableData.length; i++) {
  1822. wlarr.push(that.tableData[i].workprocid + '-' + that.tableData[i].location + '-' + that.tableData[i].workshop + '-' + that.tableData[i].clock + '-' + that.tableData[i].clocke);
  1823. }
  1824. let wls = [...new Set(wlarr)]
  1825. let arrs = [];
  1826. for (let wl of wls) {
  1827. let adds = 0;
  1828. for (let item of that.tableData) {
  1829. if (wl === item.workprocid + '-' + item.location + '-' + item.workshop + '-' + item.clock + '-' + item.clocke) {
  1830. adds = that.floatComputed(Number(item.realvalue), adds, '+');
  1831. }
  1832. }
  1833. for (let i = 0; i < that.tableData.length; i++) {
  1834. if (wl === that.tableData[i].workprocid + '-' + that.tableData[i].location + '-' + that.tableData[i].workshop + '-' + that.tableData[i].clock + '-' + that.tableData[i].clocke) {
  1835. that.tableData[i].adds = adds;
  1836. }
  1837. }
  1838. }
  1839. },
  1840. // 展示实际电量
  1841. showRealValue (rowIndex, value) {
  1842. let that = this;
  1843. for (let i = 0; i < that.tableData.length; i++) {
  1844. if (i === rowIndex) {
  1845. that.tableData[i].realvalue = value;
  1846. }
  1847. }
  1848. this.getAdds();
  1849. },
  1850. // 批量修改
  1851. but_edit_plural () {
  1852. let that = this;
  1853. if (that.multipleSelection.length > 0) {
  1854. that.$refs['dialog_form_arr'].validate((valid, obj) => {
  1855. if (valid) {
  1856. let SubmitData = [];
  1857. for (let key in that.tableFormDataObj) {
  1858. let memoArr = that.tableFormDataObj[key].memo.split(';');
  1859. for (let i = 0; i < that.tableFormDataObj[key].weight1.length; i++) {
  1860. for (let keyname in that.tableFormDataObj[key].weight1[i]) {
  1861. SubmitData.push({
  1862. // weight: that.tableFormDataObj[key].weight[i][keyname],
  1863. weight1: that.tableFormDataObj[key].weight1[i][keyname],
  1864. weight2: that.tableFormDataObj[key].weight2[i][keyname],
  1865. no: that.tableFormDataObj[key].no[i][i],
  1866. memo: memoArr[i],
  1867. cjsj: that.tableFormDataObj[key].cjsj,
  1868. jzsj: that.tableFormDataObj[key].jzsj,
  1869. line: that.tableFormDataObj[key].line,
  1870. xgr: that.tableFormDataObj[key].xgr,
  1871. xgsj: that.tableFormDataObj[key].xgsj,
  1872. cp: that.tableFormDataObj[key].cp,
  1873. sysl: that.tableFormDataObj[key].sysl,
  1874. zt: that.tableFormDataObj[key].zt,
  1875. wxsy: that.tableFormDataObj[key].wxsy,
  1876. unit: that.tableFormDataObj[key].unit,
  1877. parentid: that.filterForm.data.parentid,
  1878. yearmonth: that.tableFormDataObj[key].yearmonth
  1879. });
  1880. };
  1881. }
  1882. }
  1883. that.loading = true;
  1884. that.axios.put('pass/ems/v1/emsprodplanyears/batchupdateList', SubmitData)
  1885. .then(function (res) {
  1886. if (res.code === '0') {
  1887. that.$message({
  1888. message: '修改成功',
  1889. type: 'success'
  1890. });
  1891. that.getTableData();
  1892. that.dialog.editorBox.show = false;
  1893. } else {
  1894. that.$message.error(res.message);
  1895. }
  1896. that.loading = false;
  1897. }).catch(function () {
  1898. that.loading = false;
  1899. });
  1900. }
  1901. });
  1902. } else {
  1903. this.$message.error('至少选择一条数据');
  1904. }
  1905. },
  1906. dataSave () {
  1907. let that = this;
  1908. let SubmitData = [];
  1909. SubmitData.push({
  1910. yearmonth: that.dialog.editorBox.form.data.yearmonth,
  1911. // weight: that.dialog.editorBox.form.data.weight,
  1912. weight1: that.dialog.editorBox.form.data.weight1,
  1913. weight2: that.dialog.editorBox.form.data.weight2,
  1914. unit: that.dialog.editorBox.form.data.unitid,
  1915. line: that.dialog.editorBox.form.data.line,
  1916. parentid: that.filterForm.data.parentid,
  1917. productid: that.dialog.editorBox.form.data.productid,
  1918. memo: that.dialog.editorBox.form.data.memo
  1919. });
  1920. // console.log(SubmitData)
  1921. that.$refs['dialog_form'].validate((valid) => {
  1922. if (valid) {
  1923. that.loading = true;
  1924. that.axios.post('pass/ems/v1/emsprodplanyears/', SubmitData, {
  1925. contentType: 'application/json'
  1926. })
  1927. .then(function (res) {
  1928. if (res.code === '0') {
  1929. that.$message({
  1930. message: '新增成功',
  1931. type: 'success'
  1932. });
  1933. that.getTableData();
  1934. that.dialog.editorBox.show = false;
  1935. } else {
  1936. that.$message.error(res.message);
  1937. }
  1938. that.loading = false;
  1939. }).catch(function () {
  1940. that.loading = false;
  1941. });
  1942. }
  1943. }
  1944. );
  1945. },
  1946. // 批量删除
  1947. but_del_plural () {
  1948. let that = this;
  1949. if (that.multipleSelection.length > 0) {
  1950. let SubmitData = [];
  1951. for (let item of that.multipleSelection) {
  1952. if (item.zt === '2') {
  1953. this.$message.error('已经审核的数据不能删除');
  1954. return;
  1955. };
  1956. // console.log(item);
  1957. for (let noItem in item.no) {
  1958. SubmitData.push({
  1959. no: item.no[noItem][noItem]
  1960. });
  1961. }
  1962. }
  1963. that.$confirm('是否删除已选数据?', '提示', {
  1964. confirmButtonText: '确定',
  1965. cancelButtonText: '取消',
  1966. state: 'warning'
  1967. }).then(() => {
  1968. that.axios.delete('pass/ems/v1/emsprodplanyears/delete', {
  1969. data: SubmitData,
  1970. contentType: 'application/json;charset=UTF-8'
  1971. })
  1972. .then(function (res) {
  1973. if (res.code === '0') {
  1974. that.$message({
  1975. message: '删除成功',
  1976. type: 'success'
  1977. });
  1978. that.getTableData();
  1979. } else {
  1980. that.$message.error(res.message);
  1981. }
  1982. }).catch(function () {
  1983. });
  1984. }).catch(() => {
  1985. });
  1986. } else {
  1987. this.$message.error('至少要选择一条数据');
  1988. }
  1989. },
  1990. upState (state = '2') {
  1991. let that = this;
  1992. let dataArr = [];
  1993. for (let item of that.multipleSelection) {
  1994. if (item.state !== state) {
  1995. dataArr.push(item);
  1996. }
  1997. }
  1998. if (dataArr.length > 0) {
  1999. that.$confirm('本次将要' + (state === '2' ? '审核' : '撤销审核') + dataArr.length + '条数据,是否确定?', '提示', {
  2000. confirmButtonText: '确定',
  2001. cancelButtonText: '取消',
  2002. state: 'warning'
  2003. }).then(() => {
  2004. let SubmitData = [];
  2005. for (let item of dataArr) {
  2006. SubmitData.push({
  2007. state: state,
  2008. id: item.id
  2009. });
  2010. }
  2011. that.loading = true;
  2012. that.axios.put('pass/ems/v1/trmtransfereactvalues/batchcheck2', SubmitData)
  2013. .then(function (res) {
  2014. if (res.code === '0') {
  2015. that.$message({
  2016. message: (state === '2' ? '审核' : '撤销') + '成功',
  2017. type: 'success'
  2018. });
  2019. that.getTableData();
  2020. } else {
  2021. that.$message.error(res.message);
  2022. }
  2023. that.loading = false;
  2024. }).catch(function () {
  2025. that.loading = false;
  2026. });
  2027. }).catch(() => {
  2028. });
  2029. } else {
  2030. if (that.multipleSelection.length > 0) {
  2031. this.$message.error('没有需要' + (state === '2' ? '审核' : '撤销') + '的数据');
  2032. } else {
  2033. this.$message.error('至少要选择一条数据');
  2034. }
  2035. }
  2036. },
  2037. but_add () {
  2038. let that = this;
  2039. that.dialog.editorBox.show = true;
  2040. setTimeout(() => {
  2041. that.$refs['dialog_form'].clearValidate();
  2042. }, 100);
  2043. },
  2044. but_copy () {
  2045. let that = this;
  2046. if (that.multipleSelection.length > 0) {
  2047. that.dialog.editorBox2.show = true;
  2048. setTimeout(() => {
  2049. that.$refs['dialog_form2'].clearValidate();
  2050. }, 100);
  2051. } else {
  2052. this.$message.error('至少要选择一条数据');
  2053. }
  2054. },
  2055. tableRowClassName ({row, rowIndex}) {
  2056. // 把每一行的索引放进row
  2057. row.index = rowIndex;
  2058. },
  2059. cellClick (row, column, cell, event) {
  2060. let _this = this;
  2061. this.rowIndex = row.index;
  2062. this.columnId = column.id;
  2063. _this.editSetFlag = row.index + column.id;
  2064. _this.focusTarget = event.target;
  2065. while (_this.focusTarget.tagName !== 'TD') {
  2066. _this.focusTarget = _this.focusTarget.parentElement;
  2067. }
  2068. _this.$nextTick(() => {
  2069. let target = this.focusTarget;
  2070. $(target).find('input').focus();
  2071. });
  2072. },
  2073. // 获取一行的总和
  2074. rowSum: function (item, event) {
  2075. let result = 0;
  2076. let that = this;
  2077. for (let weiIndex in item.weight1) {
  2078. for (let weiKey in item.weight1[weiIndex]) {
  2079. result += Number(item.weight1[weiIndex][weiKey]) + Number(item.weight2[weiIndex][weiKey]);
  2080. }
  2081. }
  2082. return result;
  2083. },
  2084. // 小计
  2085. rowSubSum: function (item, event) {
  2086. let result = 0;
  2087. let that = this;
  2088. for (let weiIndex in item.weight1) {
  2089. for (let weiKey in item.weight1[weiIndex]) {
  2090. if (weiKey === '成品焦') {
  2091. result += Number(item.weight1[weiIndex][weiKey]) + Number(item.weight1[weiIndex][weiKey]);
  2092. };
  2093. if (weiKey === '小粒焦') {
  2094. result += Number(item.weight1[weiIndex][weiKey]) + Number(item.weight1[weiIndex][weiKey]);
  2095. };
  2096. };
  2097. }
  2098. return result;
  2099. }
  2100. },
  2101. computed: {
  2102. // 暂时用不上
  2103. activeUsers: function () {
  2104. let that = this;
  2105. return that.tableData.filter(function (tableData) {
  2106. // console.log(tableData);
  2107. for (let item in tableData.weight1) {
  2108. return isNaN((tableData.weight1[item]));
  2109. }
  2110. })
  2111. },
  2112. rowSumc: function (item, event) {
  2113. let result = 0;
  2114. let that = this;
  2115. for (let item of that.tableFormDataOb) {
  2116. result = 0;
  2117. for (let weiIndex in that.tableFormDataObj[item.seq].weight1) {
  2118. for (let weiKey in that.tableFormDataObj[item.seq].weight1[weiIndex]) {
  2119. result += that.tableFormDataObj[item.seq].weight1[weiIndex][weiKey] +
  2120. that.tableFormDataObj[item.seq].weight2[weiIndex][weiKey];
  2121. }
  2122. }
  2123. item.total = result;
  2124. }
  2125. return result;
  2126. }
  2127. }
  2128. }
  2129. function sortNumber (a, b) {
  2130. return a - b
  2131. }
  2132. </script>
  2133. <style lang="less">
  2134. .outElectricity{
  2135. min-width: 700px;
  2136. height: 100%;
  2137. .box {
  2138. height: 100%;
  2139. padding: 15px 15px 0 15px;
  2140. .box-top {
  2141. .el-form-item {
  2142. margin-bottom: 7px;
  2143. }
  2144. .box-top-gjl {
  2145. overflow: hidden;
  2146. padding: 7px 0;
  2147. border-top: 1px solid #ccc;
  2148. }
  2149. }
  2150. .rowDisable td {
  2151. color: #6bb025 !important;
  2152. }
  2153. .el-table .el-table__row {
  2154. height: 35px;
  2155. }
  2156. .el-table__body .el-form-item--mini.el-form-item {
  2157. margin: 0px;
  2158. .error {
  2159. overflow: hidden;
  2160. color: #f56c6c;
  2161. font-size: 12px;
  2162. line-height: 1;
  2163. }
  2164. }
  2165. }
  2166. .color_no {
  2167. color: #7a7a7a;
  2168. }
  2169. .color_yes {
  2170. color: #1a9f17;
  2171. }
  2172. .cnspicuous .el-checkbox__input.is-disabled .el-checkbox__inner {
  2173. background-color: #dcdfe6;
  2174. border-color: #babbbf;
  2175. }
  2176. }
  2177. </style>