planProjectCleanCoal.vue 63 KB

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