planProjectCleanCoal.vue 64 KB

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