ProjectData.vue 65 KB

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