planProjectBuildingMaterialsWaterSlag.vue 63 KB

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