planProjectBuildingMaterialsWaterSlag.vue 63 KB

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