planProjectCoke.vue 65 KB

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