planProjectSinter.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. fixed="left"
  178. prop="unit"
  179. label="计量单位"
  180. width="160px"
  181. :show-overflow-tooltip="true"
  182. >
  183. <template slot-scope="scope">
  184. <span>{{ nameObj.unitid.obj[scope.row.unit] ? nameObj.unitid.obj[scope.row.unit] : scope.row.unit }}</span>
  185. </template>
  186. </el-table-column>
  187. <el-table-column
  188. prop="yearmonth"
  189. label="月份"
  190. fixed="left"
  191. width="80px"
  192. :show-overflow-tooltip="true"
  193. ></el-table-column>
  194. <el-table-column
  195. prop="line"
  196. label="工序"
  197. fixed="left"
  198. width="160px"
  199. :show-overflow-tooltip="true"
  200. >
  201. <template slot-scope="scope">
  202. <span>{{ nameObj.workprocid.obj[scope.row.line] ? nameObj.workprocid.obj[scope.row.line].name : scope.row.line }}</span>
  203. </template>
  204. </el-table-column>
  205. <el-table-column
  206. prop="weight"
  207. label="年度计划量"
  208. width="160px"
  209. :show-overflow-tooltip="true"
  210. >
  211. <template slot-scope="scope">
  212. <el-form-item
  213. v-if="!isCheck && scope.row.isSelection && scope.row.state !== '2'"
  214. :prop="scope.row.seq + '.weight'"
  215. :rules="tableFormRules.weight"
  216. >
  217. <el-input clearable
  218. style="width: 100%;"
  219. v-model="tableFormDataObj[scope.row.seq].weight"
  220. refcous="true"
  221. @keydown.native="keyDown" :id="scope.$index + scope.column.id"
  222. @change="chnageSecondVal(scope.row.seq, tableFormDataObj[scope.row.seq].secondVal, scope.$index)"
  223. ></el-input>
  224. <template slot="error" slot-scope="scope">
  225. <p class="error" :title="scope.error">{{ scope.error }}</p>
  226. </template>
  227. </el-form-item>
  228. <span v-else>{{scope.row.weight}}</span>
  229. </template>
  230. </el-table-column>
  231. <el-table-column
  232. prop="cjsj"
  233. label="创建时间"
  234. width="160px"
  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="160px"
  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="160px"
  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. title="年计划编制-轧钢复制"
  423. :visible.sync="dialog.editorBox2.show"
  424. width="400px"
  425. :close-on-click-modal="false"
  426. :show-close="!loading"
  427. >
  428. <div>
  429. <el-form
  430. :model="dialog.editorBox2.form.data"
  431. ref="dialog_form2"
  432. size="mini"
  433. label-width="300px"
  434. :rules="dialog.editorBox2.form.rules"
  435. >
  436. <el-row>
  437. <el-col>
  438. <el-col :span="12">
  439. <el-form-item
  440. label="月份"
  441. prop="yearmonth"
  442. label-width="100px"
  443. >
  444. <zj-timegran-date
  445. v-model="dialog.editorBox2.form.data.yearmonth"
  446. style="width: 150%;"
  447. :timegranId="'MONTH'"
  448. :rules="dialog.editorBox2.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: 'SJ',
  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. arr: []
  618. },
  619. workprocid: {
  620. obj: {
  621. 'AT3013': {
  622. id: 'AT3013',
  623. name: '1#烧结'
  624. },
  625. 'AT3014': {
  626. id: 'AT3014',
  627. name: '2#烧结'
  628. },
  629. 'AT3015': {
  630. id: 'AT3015',
  631. name: '3#烧结'
  632. }
  633. },
  634. arr: [{
  635. id: 'AT3013',
  636. name: '1#烧结'
  637. },
  638. {
  639. id: 'AT3014',
  640. name: '2#烧结'
  641. },
  642. {
  643. id: 'AT3015',
  644. name: '3#烧结'
  645. }
  646. ]
  647. },
  648. location: {
  649. obj: {},
  650. arr: [],
  651. showDataArr: []
  652. },
  653. locateid: {
  654. obj: {},
  655. arr: []
  656. },
  657. networkid: {
  658. obj: {},
  659. arr: []
  660. },
  661. userId: {
  662. obj: {},
  663. arr: []
  664. }
  665. },
  666. dialog: {
  667. fRow: null,
  668. editorBox: {
  669. show: false,
  670. type: '',
  671. form: {
  672. default: {
  673. workprocid: ''
  674. },
  675. data: {
  676. unitid: '',
  677. line: '',
  678. yearmonth: '',
  679. weight: '',
  680. memo: ''
  681. },
  682. rules: {
  683. weight: [
  684. { required: true, message: '该项不能为空', trigger: 'change' },
  685. { validator: zCheckNumber1, trigger: 'change' }
  686. ],
  687. yearmonth: [{ required: true, message: '该项不能为空', trigger: 'change' }],
  688. unitid: [{ required: true, message: '该项不能为空', trigger: 'change' }],
  689. line: [{ required: true, message: '该项不能为空', trigger: 'change' }]
  690. }
  691. }
  692. },
  693. editorBox2: {
  694. show: false,
  695. type: '',
  696. form: {
  697. data: {
  698. yearmonth: ''
  699. },
  700. rules: {
  701. yearmonth: [{ required: true, message: '该项不能为空', trigger: 'change' }]
  702. }
  703. }
  704. }
  705. },
  706. butPrivilege: {
  707. QUERY: false,
  708. PUT: false,
  709. CHECK: false,
  710. UNDOCHECK: false
  711. },
  712. loginName: getCookie('loginName')
  713. }
  714. },
  715. created () {
  716. // 获取按钮权限
  717. this.activeMenu = window.localStorage.getItem('activeMenu');
  718. for (let key in this.butPrivilege) {
  719. this.butPrivilege[key] = this.checkPrivilege(this.activeMenu + key);
  720. }
  721. },
  722. mounted () {
  723. let that = this;
  724. window.PEDataObj = {
  725. // 将数据绑定到window上,供main页面使用
  726. vm: that,
  727. // tableArr:用于导出成Excel的表格的信息
  728. tableArr: [
  729. {
  730. name: '',
  731. id: 'singleTable'
  732. }
  733. ]
  734. };
  735. that.$nextTick(() => {
  736. // 立即获取的height有一定偏差,通过setTimeout延迟来解决
  737. setTimeout(() => {
  738. that.singleTableHeight = that.getRoleHeight(that.$refs['singleTable'].$el) - 45;
  739. }, 1);
  740. });
  741. // 接收路由参数
  742. if (that.$route.query.networkid) {
  743. that.filterForm.disabled.networkid = true;
  744. that.filterForm.data.networkid = that.$route.query.networkid.split(',');
  745. }
  746. // 当有审核与取消审核权限时,默认其为审核人,审核人无法修改数据
  747. if (that.butPrivilege.CHECK || that.butPrivilege.UNDOCHECK) {
  748. that.isCheck = true;
  749. }
  750. // 管理员在这里录入数据
  751. if (that.loginName === 'admin' && that.filterForm.disabled.networkid) {
  752. that.isCheck = false;
  753. }
  754. // that.getLocation();
  755. that.getLocateIdData();
  756. that.getNetworkIdData();
  757. // that.getTableData();
  758. that.getUnitIdData();
  759. },
  760. methods: {
  761. // 计算树区域高度
  762. getRoleHeight (dom) {
  763. return window.innerHeight - dom.offsetTop;
  764. },
  765. // 自定义的表格合计方法:只给指定列进行合计
  766. getSummaries (param) {
  767. const prop = ['apportvalue', 'realvalue', 'wastage', 'weight']; // 合计列绑定的prop
  768. return commonSummaries(param, prop);
  769. },
  770. // 获取工序列表
  771. // getNodeData () {
  772. // let that = this
  773. // let url = 'pass/ems/v1/trmworkprocs/getIdAndName?issettle=1';
  774. // that.axios.get(url)
  775. // .then(function (res) {
  776. // if (res.code === '0') {
  777. // let arr = [];
  778. // let obj = {};
  779. // for (let item of res.data) {
  780. // arr.push({
  781. // id: item.id,
  782. // name: item.name
  783. // })
  784. // obj[item.id] = item.name;
  785. // }
  786. // that.nameObj.workprocid.arr = arr;
  787. // that.nameObj.workprocid.obj = obj;
  788. // that.connn();
  789. // } else {
  790. // that.$message.error(res.message);
  791. // }
  792. // });
  793. // },
  794. getUnitIdData () {
  795. let that = this
  796. let url = 'pass/ems/v1/trmunits/getIdAndName';
  797. that.axios.get(url)
  798. .then(function (res) {
  799. if (res.code === '0') {
  800. let arr = [];
  801. let obj = {};
  802. for (let item of res.data) {
  803. arr.push({
  804. id: item.id,
  805. name: item.name
  806. })
  807. obj[item.id] = item.name;
  808. if (item.name === '吨') {
  809. that.nameObj.unitid.defaults = that.nameObj.unitid.defaults ? that.nameObj.unitid.defaults : item.id;
  810. }
  811. }
  812. that.nameObj.unitid.arr = arr;
  813. that.nameObj.unitid.obj = obj;
  814. } else {
  815. that.$message.error(res.message);
  816. }
  817. });
  818. },
  819. // 获取站所
  820. getNetworkIdData () {
  821. let that = this
  822. let url = 'pass/ems/v1/trmstations/getidandname/';
  823. that.axios.get(url)
  824. .then(function (res) {
  825. if (res.code === '0') {
  826. let arr = [];
  827. let obj = {};
  828. for (let item of res.data) {
  829. arr.push({
  830. id: item.id,
  831. name: item.name
  832. })
  833. obj[item.id] = item.name;
  834. }
  835. that.nameObj.networkid.arr = arr;
  836. that.nameObj.networkid.obj = obj;
  837. } else {
  838. that.$message.error(res.message);
  839. }
  840. });
  841. },
  842. but_copy_plural () {
  843. let that = this;
  844. let SubmitData = [];
  845. for (let key in that.tableFormDataObj) {
  846. SubmitData.push({
  847. weight: that.tableFormDataObj[key].weight,
  848. cjr: that.tableFormDataObj[key].cjr,
  849. memo: that.tableFormDataObj[key].memo,
  850. line: that.tableFormDataObj[key].line,
  851. unit: that.tableFormDataObj[key].unit,
  852. parentid: that.filterForm.data.parentid,
  853. yearmonth: that.dialog.editorBox2.form.data.yearmonth
  854. });
  855. }
  856. that.$refs['dialog_form2'].validate((valid) => {
  857. if (valid) {
  858. that.loading = true;
  859. that.axios.post('pass/ems/v1/emsprodplanyears/', SubmitData, {
  860. contentType: 'application/json'
  861. })
  862. .then(function (res) {
  863. if (res.code === '0') {
  864. that.$message({
  865. message: '复制成功',
  866. type: 'success'
  867. });
  868. that.getTableData();
  869. that.dialog.editorBox2.show = false;
  870. } else {
  871. that.$message.error(res.message);
  872. }
  873. that.loading = false;
  874. }).catch(function () {
  875. that.loading = false;
  876. });
  877. } else {
  878. this.$message.error('至少选择一条数据');
  879. }
  880. });
  881. },
  882. connn () {
  883. let that = this;
  884. if (!that.filterForm.data.networkid || that.filterForm.data.networkid.length === 0) {
  885. that.nameObj.location.showDataArr = that.nameObj.workprocid.arr;
  886. } else {
  887. let url = 'pass/ems/v1/trmelectricitylocations/getWorkprocs?workshop=' + that.filterForm.data.networkid.toString();
  888. that.axios.get(url)
  889. .then(function (res) {
  890. if (res.code === '0') {
  891. let arr = [];
  892. for (let item of res.data) {
  893. arr.push({
  894. id: item.id,
  895. name: item.name
  896. })
  897. }
  898. that.nameObj.location.showDataArr = arr;
  899. } else {
  900. that.$message.error(res.message);
  901. }
  902. });
  903. }
  904. },
  905. // 获取位置
  906. getLocateIdData () {
  907. let that = this
  908. let url = 'pass/ems/v1/trmlocations/getidandname/';
  909. that.axios.get(url)
  910. .then(function (res) {
  911. if (res.code === '0') {
  912. let arr = [];
  913. let obj = {};
  914. for (let item of res.data) {
  915. arr.push({
  916. id: item.id,
  917. name: item.name
  918. })
  919. obj[item.id] = item.name;
  920. }
  921. that.nameObj.locateid.arr = arr;
  922. that.nameObj.locateid.obj = obj;
  923. } else {
  924. that.$message.error(res.message);
  925. }
  926. });
  927. },
  928. // 获取表格中的数据
  929. getTableData (pageNum) {
  930. let that = this,
  931. params = {},
  932. pData = {
  933. yearmonth: that.filterForm.data.yearmonth,
  934. workprocid: that.filterForm.data.workprocid.toString(),
  935. location: that.filterForm.data.location.toString(),
  936. networkid: that.filterForm.data.networkid.toString(),
  937. itemname: that.filterForm.data.itemname,
  938. zt: that.filterForm.data.zt,
  939. measureid: that.filterForm.data.measureid,
  940. exactsearch: that.filterForm.data.searchtype,
  941. parentid: that.filterForm.data.parentid
  942. };
  943. for (let key in pData) {
  944. if (pData[key]) {
  945. params[key] = pData[key];
  946. }
  947. }
  948. that.pageNum = pageNum || that.pageNum;
  949. that.tableLoading = true;
  950. // let url = 'pass/ems/v1/trmtransfereactvalues/getDateEditForPage/?pageNum=' + that.pageNum + '&pageSize=' + that.pageSize;
  951. // if (that.isCheck) {
  952. // url = 'pass/ems/v1/trmtransfereactvalues/?pageNum=' + that.pageNum + '&pageSize=' + that.pageSize;
  953. // }
  954. let url = 'pass/ems/v1/emsprodplanyears/?pageNum=' + that.pageNum + '&pageSize=' + that.pageSize;
  955. that.axios.get(url, {
  956. params: params
  957. })
  958. .then(function (res) {
  959. if (res.code === '0') {
  960. let arr = [];
  961. for (let i = 0; i < res.data.list.length; i++) {
  962. let item = res.data.list[i];
  963. arr.push({
  964. seq: i,
  965. unit: item.unit,
  966. line: item.line,
  967. yearmonth: item.yearmonth,
  968. weight: item.weight,
  969. cjr: item.cjr,
  970. cjsj: item.cjsj,
  971. jzsj: item.jzsj,
  972. xgr: item.xgr,
  973. xgsj: item.xgsj,
  974. cp: item.cp,
  975. sysl: item.sysl,
  976. wxsy: item.wxsy,
  977. zt: item.zt,
  978. parentid: item.parentid,
  979. no: item.no,
  980. id: item.id,
  981. memo: item.memo
  982. });
  983. }
  984. that.total = res.data.total;
  985. that.tableData = arr;
  986. that.getAdds();
  987. } else {
  988. that.$message.error(res.message);
  989. }
  990. that.$nextTick(() => {
  991. setTimeout(() => {
  992. that.singleTableHeight = that.getRoleHeight(that.$refs['singleTable'].$el) - 46;
  993. }, 1);
  994. });
  995. that.tableLoading = false;
  996. }).catch(function () {
  997. that.tableLoading = false;
  998. });
  999. },
  1000. // 获取表格中的数据
  1001. getTableDataEdit () {
  1002. let that = this,
  1003. params = {},
  1004. pData = {
  1005. yearmonth: that.filterForm.data.yearmonth,
  1006. workprocid: that.filterForm.data.workprocid.toString(),
  1007. location: that.filterForm.data.location.toString(),
  1008. networkid: that.filterForm.data.networkid.toString(),
  1009. itemname: that.filterForm.data.itemname,
  1010. exactsearch: that.filterForm.data.searchtype,
  1011. parentid: that.filterForm.data.parentid
  1012. };
  1013. for (let key in pData) {
  1014. if (pData[key]) {
  1015. params[key] = pData[key];
  1016. }
  1017. }
  1018. that.tableLoading = true;
  1019. let url = 'pass/ems/v1/emsprodplanyears/getDateEditForPage/?pageNum=1&pageSize=' + that.pageSize;
  1020. that.axios.get(url, {
  1021. params: params
  1022. })
  1023. .then(function (res) {
  1024. if (res.code === '0') {
  1025. let arr = [];
  1026. for (let i = 0; i < res.data.list.length; i++) {
  1027. let item = res.data.list[i];
  1028. arr.push({
  1029. seq: i,
  1030. unit: item.unit,
  1031. line: item.line,
  1032. yearmonth: item.yearmonth,
  1033. weight: item.weight,
  1034. cjr: item.cjr,
  1035. cjsj: item.cjsj,
  1036. jzsj: item.jzsj,
  1037. xgr: item.xgr,
  1038. xgsj: item.xgsj,
  1039. cp: item.cp,
  1040. sysl: item.sysl,
  1041. zt: item.zt,
  1042. wxsy: item.wxsy
  1043. });
  1044. }
  1045. that.total = res.data.total;
  1046. that.tableData = arr;
  1047. that.getAdds();
  1048. } else {
  1049. that.$message.error(res.message);
  1050. }
  1051. that.$nextTick(() => {
  1052. setTimeout(() => {
  1053. that.singleTableHeight = that.getRoleHeight(that.$refs['singleTable'].$el) - 46;
  1054. }, 1);
  1055. });
  1056. that.tableLoading = false;
  1057. }).catch(function () {
  1058. that.tableLoading = false;
  1059. });
  1060. },
  1061. // 合并相同的用电地点
  1062. arraySpanMethod ({ row, column, rowIndex, columnIndex }) {
  1063. let that = this;
  1064. let tableData = this.$refs.singleTable.tableData
  1065. let c1 = row.workprocid;
  1066. let c2 = row.location;
  1067. let c3 = row.workshop;
  1068. let c4 = row.clock;
  1069. let c5 = row.clocke;
  1070. let rowsPan = 1;
  1071. // let adds = this.$refs.singleTable.tableData[rowIndex].realvalue;
  1072. if (column['property'] === 'workprocid' || column['property'] === 'adds') {
  1073. if (rowIndex > 0 && c1 === tableData[rowIndex - 1].workprocid && c2 === tableData[rowIndex - 1].location &&
  1074. c3 === tableData[rowIndex - 1].workshop && c4 === tableData[rowIndex - 1].clock && c5 === tableData[rowIndex - 1].clocke) {
  1075. return {
  1076. rowspan: 0,
  1077. colspan: 0
  1078. };
  1079. };
  1080. while (tableData[rowIndex + rowsPan] && c1 === tableData[rowIndex + rowsPan].workprocid && c2 === tableData[rowIndex + rowsPan].location &&
  1081. c3 === tableData[rowIndex + rowsPan].workshop && c4 === tableData[rowIndex + rowsPan].clock && c5 === tableData[rowIndex + rowsPan].clocke) {
  1082. rowsPan += 1
  1083. }
  1084. return {
  1085. rowspan: rowsPan,
  1086. colspan: 1
  1087. };
  1088. }
  1089. },
  1090. // 改变表格显示条数
  1091. tableSizeChange (val) {
  1092. let that = this;
  1093. that.pageSize = val;
  1094. that.getTableData(1);
  1095. },
  1096. // 重置搜索
  1097. tableDataCancel () {
  1098. let that = this;
  1099. for (let key in that.filterForm.data) {
  1100. if (!that.filterForm.disabled || !that.filterForm.disabled[key]) {
  1101. if (that.filterForm.data[key] instanceof Array) {
  1102. that.filterForm.data[key] = [];
  1103. } else {
  1104. that.filterForm.data[key] = '';
  1105. }
  1106. }
  1107. }
  1108. that.getTableData(1);
  1109. },
  1110. keyDown (event1, disabledFlag) {
  1111. let tdTarget = event1.target;
  1112. let _this = this;
  1113. while (tdTarget.tagName !== 'TD') {
  1114. tdTarget = tdTarget.parentElement;
  1115. }
  1116. // 如果按下键盘下键或者回车键
  1117. if (event.keyCode === 40 || event.keyCode === 13) {
  1118. let index = parseInt(this.rowIndex);
  1119. // index++;
  1120. if (index !== this.seqArr[this.seqArr.length - 1]) {
  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 === 38) { // 键盘上键
  1134. let index = parseInt(this.rowIndex);
  1135. if (index !== this.seqArr[0]) {
  1136. for (let i = 0; i < this.seqArr.length; i++) {
  1137. if (index === this.seqArr[i]) {
  1138. index = this.seqArr[i - 1];
  1139. break;
  1140. }
  1141. }
  1142. }
  1143. this.editSetFlag = index + this.columnId;
  1144. let id = '#' + this.editSetFlag;
  1145. this.$nextTick(() => {
  1146. $(id).click();
  1147. });
  1148. } else if (event.keyCode === 37) { // 键盘左键
  1149. $(tdTarget).prevAll().find('input:text').last().click();
  1150. } else if (event.keyCode === 39) { // 键盘右键
  1151. $(tdTarget).nextAll().find('input').eq(0).click();
  1152. }
  1153. },
  1154. // 只允许对未接受的数据进行操作
  1155. checkboxT (row, index) {
  1156. if (row.zt === '2' && !this.isCheck) {
  1157. return false;
  1158. } else {
  1159. return true;
  1160. }
  1161. },
  1162. handleSelectionChange (val) {
  1163. let that = this;
  1164. let tableFormDataObj = {};
  1165. let arr = [];
  1166. for (let item of val) {
  1167. arr.push(item.seq);
  1168. }
  1169. this.seqArr = arr.sort(sortNumber);
  1170. for (let item of that.tableData) {
  1171. item.isSelection = false;
  1172. }
  1173. for (let item of val) {
  1174. let obj = {};
  1175. let xId = item.seq;
  1176. if (that.tableFormDataObj[xId]) {
  1177. // 如果已存在该数据则使用该数据
  1178. tableFormDataObj[xId] = that.tableFormDataObj[xId];
  1179. } else {
  1180. // 负责则从对应行中获取行内原数据
  1181. for (let key in item) {
  1182. obj[key] = item[key];
  1183. }
  1184. item.realvalue = (!isNaN(Number(item.apportvalue)) && !isNaN(Number(item.wastage))) ? Number(item.apportvalue) + Number(item.wastage) - Number(item.secondVal) : item.realvalue;
  1185. tableFormDataObj[xId] = obj;
  1186. }
  1187. item.isSelection = true;
  1188. }
  1189. for (let item of that.tableData) {
  1190. if (item.isSelection === false) {
  1191. item.realvalue = (!isNaN(Number(item.apportvalue)) && !isNaN(Number(item.wastage))) ? Number(item.apportvalue) + Number(item.wastage) - Number(item.secondVal) : item.realvalue;
  1192. }
  1193. }
  1194. that.tableFormDataObj = tableFormDataObj;
  1195. that.multipleSelection = val;
  1196. this.getAdds();
  1197. },
  1198. // 当上月底码发生改变时计算抄度与实际电量
  1199. getApportValue (seq, value, rowIndex, event) {
  1200. let that = this;
  1201. if (!isNaN(Number(value))) {
  1202. if (!isNaN(Number(that.tableFormDataObj[seq].mintvalue)) && !isNaN(Number(that.tableFormDataObj[seq].mendvalue)) && that.tableFormDataObj[seq].mintvalue !== null && that.tableFormDataObj[seq].mendvalue !== null) {
  1203. let poor = that.floatComputed(Number(that.tableFormDataObj[seq].mendvalue), Number(that.tableFormDataObj[seq].mintvalue), '-');
  1204. that.tableFormDataObj[seq].apportvalue = that.floatComputed(poor, Number(that.tableFormDataObj[seq].mods), '*').toFixed(0);
  1205. let rv1 = that.floatComputed(Number(that.tableFormDataObj[seq].apportvalue), Number(that.tableFormDataObj[seq].wastage), '+');
  1206. that.tableFormDataObj[seq].realvalue = that.floatComputed(rv1, Number(that.tableFormDataObj[seq].secondVal), '-').toFixed(0);
  1207. that.showRealValue(rowIndex, that.tableFormDataObj[seq].realvalue);
  1208. }
  1209. }
  1210. },
  1211. // 手动修改抄度后计算实际电量
  1212. chnageApportvalue (seq, value, rowIndex) {
  1213. let that = this;
  1214. if (!isNaN(Number(value)) && !isNaN(Number(that.tableFormDataObj[seq].wastage))) {
  1215. that.tableFormDataObj[seq].realvalue = that.floatComputed(Number(value), Number(that.tableFormDataObj[seq].wastage), '+').toFixed(0);
  1216. }
  1217. that.showRealValue(rowIndex, that.tableFormDataObj[seq].realvalue);
  1218. },
  1219. // 手动修改损耗后计算实际电量
  1220. chnageWastage (seq, value, rowIndex) {
  1221. let that = this;
  1222. if (!isNaN(Number(value)) && !isNaN(Number(that.tableFormDataObj[seq].apportvalue)) && that.tableFormDataObj[seq].apportvalue !== null) {
  1223. let rv1 = that.floatComputed(Number(value), Number(that.tableFormDataObj[seq].apportvalue), '+');
  1224. that.tableFormDataObj[seq].realvalue = that.floatComputed(rv1, Number(that.tableFormDataObj[seq].secondVal), '-').toFixed(0);
  1225. that.showRealValue(rowIndex, that.tableFormDataObj[seq].realvalue);
  1226. }
  1227. },
  1228. // 手动修改二次转供电后计算实际电量
  1229. chnageSecondVal (seq, value, rowIndex) {
  1230. let that = this;
  1231. if (!isNaN(Number(value)) && !isNaN(Number(that.tableFormDataObj[seq].apportvalue)) && that.tableFormDataObj[seq].apportvalue !== null) {
  1232. let val1 = that.floatComputed(Number(that.tableFormDataObj[seq].apportvalue), Number(that.tableFormDataObj[seq].wastage), '+');
  1233. that.tableFormDataObj[seq].realvalue = that.floatComputed(val1, Number(value), '-').toFixed(0);
  1234. that.showRealValue(rowIndex, that.tableFormDataObj[seq].realvalue);
  1235. }
  1236. },
  1237. // 统计合计值
  1238. getAdds () {
  1239. let that = this;
  1240. let wlarr = [];
  1241. for (var i = 0; i < that.tableData.length; i++) {
  1242. wlarr.push(that.tableData[i].workprocid + '-' + that.tableData[i].location + '-' + that.tableData[i].workshop + '-' + that.tableData[i].clock + '-' + that.tableData[i].clocke);
  1243. }
  1244. let wls = [...new Set(wlarr)]
  1245. let arrs = [];
  1246. for (let wl of wls) {
  1247. let adds = 0;
  1248. for (let item of that.tableData) {
  1249. if (wl === item.workprocid + '-' + item.location + '-' + item.workshop + '-' + item.clock + '-' + item.clocke) {
  1250. adds = that.floatComputed(Number(item.realvalue), adds, '+');
  1251. }
  1252. }
  1253. for (let i = 0; i < that.tableData.length; i++) {
  1254. if (wl === that.tableData[i].workprocid + '-' + that.tableData[i].location + '-' + that.tableData[i].workshop + '-' + that.tableData[i].clock + '-' + that.tableData[i].clocke) {
  1255. that.tableData[i].adds = adds;
  1256. }
  1257. }
  1258. }
  1259. },
  1260. // 展示实际电量
  1261. showRealValue (rowIndex, value) {
  1262. let that = this;
  1263. for (let i = 0; i < that.tableData.length; i++) {
  1264. if (i === rowIndex) {
  1265. that.tableData[i].realvalue = value;
  1266. }
  1267. }
  1268. this.getAdds();
  1269. },
  1270. // 批量修改
  1271. but_edit_plural () {
  1272. let that = this;
  1273. if (that.multipleSelection.length > 0) {
  1274. that.$refs['dialog_form_arr'].validate((valid, obj) => {
  1275. if (valid) {
  1276. let SubmitData = [];
  1277. for (let key in that.tableFormDataObj) {
  1278. SubmitData.push({
  1279. no: that.tableFormDataObj[key].no,
  1280. weight: that.tableFormDataObj[key].weight,
  1281. cjr: that.tableFormDataObj[key].cjr,
  1282. memo: that.tableFormDataObj[key].memo,
  1283. cjsj: that.tableFormDataObj[key].cjsj,
  1284. jzsj: that.tableFormDataObj[key].jzsj,
  1285. line: that.tableFormDataObj[key].line,
  1286. xgr: that.tableFormDataObj[key].xgr,
  1287. xgsj: that.tableFormDataObj[key].xgsj,
  1288. cp: that.tableFormDataObj[key].cp,
  1289. sysl: that.tableFormDataObj[key].sysl,
  1290. zt: that.tableFormDataObj[key].zt,
  1291. wxsy: that.tableFormDataObj[key].wxsy,
  1292. unit: that.tableFormDataObj[key].unit,
  1293. parentid: that.filterForm.data.parentid,
  1294. yearmonth: that.tableFormDataObj[key].yearmonth
  1295. });
  1296. }
  1297. that.loading = true;
  1298. that.axios.put('pass/ems/v1/emsprodplanyears/batchupdate', SubmitData)
  1299. .then(function (res) {
  1300. if (res.code === '0') {
  1301. that.$message({
  1302. message: '修改成功',
  1303. type: 'success'
  1304. });
  1305. that.getTableData();
  1306. that.dialog.editorBox.show = false;
  1307. } else {
  1308. that.$message.error(res.message);
  1309. }
  1310. that.loading = false;
  1311. }).catch(function () {
  1312. that.loading = false;
  1313. });
  1314. }
  1315. });
  1316. } else {
  1317. this.$message.error('至少选择一条数据');
  1318. }
  1319. },
  1320. dataSave () {
  1321. let that = this;
  1322. let SubmitData = [];
  1323. SubmitData.push({
  1324. yearmonth: that.dialog.editorBox.form.data.yearmonth,
  1325. weight: that.dialog.editorBox.form.data.weight,
  1326. unit: that.dialog.editorBox.form.data.unitid,
  1327. line: that.dialog.editorBox.form.data.line,
  1328. parentid: that.filterForm.data.parentid,
  1329. memo: that.dialog.editorBox.form.data.memo
  1330. });
  1331. console.log(SubmitData)
  1332. that.$refs['dialog_form'].validate((valid) => {
  1333. if (valid) {
  1334. that.loading = true;
  1335. that.axios.post('pass/ems/v1/emsprodplanyears/', SubmitData, {
  1336. contentType: 'application/json'
  1337. })
  1338. .then(function (res) {
  1339. if (res.code === '0') {
  1340. that.$message({
  1341. message: '新增成功',
  1342. type: 'success'
  1343. });
  1344. that.getTableData();
  1345. that.dialog.editorBox.show = false;
  1346. } else {
  1347. that.$message.error(res.message);
  1348. }
  1349. that.loading = false;
  1350. }).catch(function () {
  1351. that.loading = false;
  1352. });
  1353. }
  1354. }
  1355. );
  1356. },
  1357. // 批量删除
  1358. but_del_plural () {
  1359. let that = this;
  1360. if (that.multipleSelection.length > 0) {
  1361. let SubmitData = [];
  1362. for (let item of that.multipleSelection) {
  1363. if (item.zt === '2') {
  1364. this.$message.error('已经审核的数据不能删除');
  1365. return;
  1366. }
  1367. SubmitData.push({
  1368. no: item.no
  1369. });
  1370. }
  1371. that.$confirm('是否删除已选数据?', '提示', {
  1372. confirmButtonText: '确定',
  1373. cancelButtonText: '取消',
  1374. state: 'warning'
  1375. }).then(() => {
  1376. that.axios.delete('pass/ems/v1/emsprodplanyears/delete', {
  1377. data: SubmitData,
  1378. contentType: 'application/json;charset=UTF-8'
  1379. })
  1380. .then(function (res) {
  1381. if (res.code === '0') {
  1382. that.$message({
  1383. message: '删除成功',
  1384. type: 'success'
  1385. });
  1386. that.getTableData();
  1387. } else {
  1388. that.$message.error(res.message);
  1389. }
  1390. }).catch(function () {
  1391. });
  1392. }).catch(() => {
  1393. });
  1394. } else {
  1395. this.$message.error('至少要选择一条数据');
  1396. }
  1397. },
  1398. upState (state = '2') {
  1399. let that = this;
  1400. let dataArr = [];
  1401. for (let item of that.multipleSelection) {
  1402. if (item.state !== state) {
  1403. dataArr.push(item);
  1404. }
  1405. }
  1406. if (dataArr.length > 0) {
  1407. that.$confirm('本次将要' + (state === '2' ? '审核' : '撤销审核') + dataArr.length + '条数据,是否确定?', '提示', {
  1408. confirmButtonText: '确定',
  1409. cancelButtonText: '取消',
  1410. state: 'warning'
  1411. }).then(() => {
  1412. let SubmitData = [];
  1413. for (let item of dataArr) {
  1414. SubmitData.push({
  1415. state: state,
  1416. id: item.id
  1417. });
  1418. }
  1419. that.loading = true;
  1420. that.axios.put('pass/ems/v1/trmtransfereactvalues/batchcheck2', SubmitData)
  1421. .then(function (res) {
  1422. if (res.code === '0') {
  1423. that.$message({
  1424. message: (state === '2' ? '审核' : '撤销') + '成功',
  1425. type: 'success'
  1426. });
  1427. that.getTableData();
  1428. } else {
  1429. that.$message.error(res.message);
  1430. }
  1431. that.loading = false;
  1432. }).catch(function () {
  1433. that.loading = false;
  1434. });
  1435. }).catch(() => {
  1436. });
  1437. } else {
  1438. if (that.multipleSelection.length > 0) {
  1439. this.$message.error('没有需要' + (state === '2' ? '审核' : '撤销') + '的数据');
  1440. } else {
  1441. this.$message.error('至少要选择一条数据');
  1442. }
  1443. }
  1444. },
  1445. but_add () {
  1446. let that = this;
  1447. that.dialog.editorBox.show = true;
  1448. setTimeout(() => {
  1449. that.$refs['dialog_form'].clearValidate();
  1450. }, 100);
  1451. },
  1452. but_copy () {
  1453. let that = this;
  1454. if (that.multipleSelection.length > 0) {
  1455. that.dialog.editorBox2.show = true;
  1456. setTimeout(() => {
  1457. that.$refs['dialog_form2'].clearValidate();
  1458. }, 100);
  1459. } else {
  1460. this.$message.error('至少要选择一条数据');
  1461. }
  1462. },
  1463. tableRowClassName ({row, rowIndex}) {
  1464. // 把每一行的索引放进row
  1465. row.index = rowIndex;
  1466. },
  1467. cellClick (row, column, cell, event) {
  1468. let _this = this;
  1469. this.rowIndex = row.index;
  1470. this.columnId = column.id;
  1471. _this.editSetFlag = row.index + column.id;
  1472. _this.focusTarget = event.target;
  1473. while (_this.focusTarget.tagName !== 'TD') {
  1474. _this.focusTarget = _this.focusTarget.parentElement;
  1475. }
  1476. _this.$nextTick(() => {
  1477. let target = this.focusTarget;
  1478. $(target).find('input').focus();
  1479. });
  1480. }
  1481. }
  1482. }
  1483. function sortNumber (a, b) {
  1484. return a - b
  1485. }
  1486. </script>
  1487. <style lang="less">
  1488. .outElectricity{
  1489. min-width: 700px;
  1490. height: 100%;
  1491. .box {
  1492. height: 100%;
  1493. padding: 15px 15px 0 15px;
  1494. .box-top {
  1495. .el-form-item {
  1496. margin-bottom: 7px;
  1497. }
  1498. .box-top-gjl {
  1499. overflow: hidden;
  1500. padding: 7px 0;
  1501. border-top: 1px solid #ccc;
  1502. }
  1503. }
  1504. .rowDisable td {
  1505. color: #6bb025 !important;
  1506. }
  1507. .el-table .el-table__row {
  1508. height: 35px;
  1509. }
  1510. .el-table__body .el-form-item--mini.el-form-item {
  1511. margin: 0px;
  1512. .error {
  1513. overflow: hidden;
  1514. color: #f56c6c;
  1515. font-size: 12px;
  1516. line-height: 1;
  1517. }
  1518. }
  1519. }
  1520. .color_no {
  1521. color: #7a7a7a;
  1522. }
  1523. .color_yes {
  1524. color: #1a9f17;
  1525. }
  1526. .cnspicuous .el-checkbox__input.is-disabled .el-checkbox__inner {
  1527. background-color: #dcdfe6;
  1528. border-color: #babbbf;
  1529. }
  1530. }
  1531. </style>