planProjectBuildingMaterialsWaterSlag.vue 62 KB

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