planProjectBuildingMaterialsFactory.vue 69 KB

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