planProjectCBD.vue 76 KB

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