budgetReview.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720
  1. <template>
  2. <section>
  3. <!--列表-->
  4. <el-table :data="list" ref="multipleTable" v-if="showTable" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;"
  5. :default-expand-all="defaultExpandAllFlg" >
  6. <el-table-column type="selection" width="55"></el-table-column>
  7. <el-table-column type="expand" :label="''">
  8. <!-- <template slot-scope="props">
  9. <el-timeline>
  10. </el-timeline>
  11. </template> -->
  12. </el-table-column>
  13. <el-table-column prop="projectName" :label="'项目名称'" sortable>
  14. <template slot-scope="scope">
  15. <div>
  16. <span>
  17. {{scope.row.projectName}}
  18. </span>
  19. </div>
  20. </template>
  21. </el-table-column>
  22. <el-table-column prop="groupName" :label="'分组名称'" sortable>
  23. <template slot-scope="scope">
  24. <div>
  25. <span>
  26. {{scope.row.groupName}}
  27. </span>
  28. </div>
  29. </template>
  30. </el-table-column>
  31. <el-table-column prop="creator" :label="'提交人'" sortable>
  32. <template slot-scope="scope">
  33. <div>
  34. <span v-if="user.userNameNeedTranslate == '1'">
  35. <ww-open-data type='userName' :openid='scope.row.creator'></ww-open-data>
  36. </span>
  37. <span v-else>
  38. {{scope.row.creator}}
  39. </span>
  40. </div>
  41. </template>
  42. </el-table-column>
  43. <el-table-column prop="createTime" :label="'提交时间'" sortable>
  44. <template slot-scope="scope">
  45. <div>
  46. <span>
  47. {{scope.row.createTime}}
  48. </span>
  49. </div>
  50. </template>
  51. </el-table-column>
  52. <el-table-column prop="oldManDay" :label="'变更前预估工时'" sortable>
  53. <template slot-scope="scope">
  54. <div>
  55. <span>
  56. {{scope.row.oldManDay}}
  57. </span>
  58. </div>
  59. </template>
  60. </el-table-column>
  61. <el-table-column prop="changeManDay" :label="'预估工时变更'" sortable>
  62. <template slot-scope="scope">
  63. <div>
  64. <span>
  65. {{scope.row.changeManDay}}
  66. </span>
  67. </div>
  68. </template>
  69. </el-table-column>
  70. <el-table-column prop="nowManDay" :label="'变更后预估工时'" sortable>
  71. <template slot-scope="scope">
  72. <div>
  73. <span>
  74. {{scope.row.nowManDay}}
  75. </span>
  76. </div>
  77. </template>
  78. </el-table-column>
  79. <el-table-column prop="status" :label="$t('state.states')" sortable>
  80. <template slot-scope="scope">
  81. <span v-if="scope.row.status == 0" style="color:#DAA520;">{{ '待审核'}}</span>
  82. <span v-else-if="scope.row.status == 1" style="color:#32CD32;">{{ $t('state.alreadyPassed') }}</span>
  83. <span v-else-if="scope.row.status == 2" style="color:#FF0000;">{{ $t('state.rejected') }}</span>
  84. </template>
  85. </el-table-column>
  86. <el-table-column :label="$t('operation')" width="220">
  87. <template slot-scope="scope">
  88. <el-button v-if="scope.row.status==0" type="primary" :loading="logining" size="small" @click="review(scope.row.id,1)">{{ $t('btn.through') }}</el-button>
  89. <el-button v-if="scope.row.status==0" type="danger" :loading="logining" size="small" @click="review(scope.row.id,2)">{{ $t('btn.rejected') }}</el-button>
  90. </template>
  91. </el-table-column>
  92. </el-table>
  93. <!--工具条-->
  94. <!-- <el-col v-if="search.value != -1" :span="24" class="toolbar">
  95. <el-pagination
  96. @size-change="handleSizeChange"
  97. @current-change="handleCurrentChange"
  98. :page-sizes="[20 , 50 , 80 , 100]"
  99. :page-size="20"
  100. layout="total, sizes, prev, pager, next"
  101. :total="total"
  102. style="float:right;"
  103. ></el-pagination>
  104. </el-col> -->
  105. </section>
  106. </template>
  107. <script>
  108. import util from "../../common/js/util";
  109. // 引入自定义组件
  110. import selectCat from "@/components/select.vue"
  111. // 引入自定义级联组件
  112. import vueCascader from "@/components/cascader.vue"
  113. import cascaderOption from "@/components/cascaderOption.vue"
  114. export default {
  115. components: {
  116. selectCat,
  117. vueCascader,
  118. cascaderOption
  119. },
  120. data() {
  121. return {
  122. yuzhongCompId: 3385,
  123. roleList:[{value: 1,label: 'CRC&LM'},{value: 2,label: 'PM'}],
  124. batchDenyLoading: false,
  125. batchDenyDialog: false,
  126. batchDenyData: {ids:'',reason:''},
  127. batchApproveLoading: false,
  128. denyForm:null,
  129. denyReasonDialog:false,
  130. isAllSelect:false,
  131. user: JSON.parse(sessionStorage.getItem("user")),
  132. permissions: JSON.parse(sessionStorage.getItem("permissions")),
  133. search: {
  134. projectId:null,
  135. departmentIdArray: null,
  136. departmentId:null,
  137. // date: null,
  138. startDate: null,
  139. endDate: null,
  140. state:0,
  141. userId: null,
  142. userIdArray: []
  143. },
  144. users: [],
  145. option:[],
  146. tableHeight: 0,
  147. listLoading: false,
  148. total: 0,
  149. page: 1,
  150. size: 20,
  151. list: [],
  152. logining: false,
  153. multipleSelection: [],
  154. usersList: [],
  155. searchUsersList: [],
  156. dataTime: [],
  157. recordDialogVisible: false,
  158. recordLists: [],
  159. totals: 0,
  160. pageIndexList: 1,
  161. pageSizeList: 20,
  162. undoForm: {
  163. // reason: '',
  164. // userId: '',
  165. // createDate: ''
  166. },
  167. undoFormDialog: false,
  168. detailsDialog: false,
  169. idx: 0, // 详情索引
  170. detailsList: [],
  171. undoFormLoading: false,
  172. approveinData: null,
  173. approveinDialog: false,
  174. isbatch: false,
  175. defaultExpandAllFlg: false,
  176. showTable: true
  177. };
  178. },
  179. filters: {
  180. // 过滤
  181. amounts(value) {
  182. var zhi = +value + 0
  183. return zhi.toFixed(1)
  184. }
  185. },
  186. methods: {
  187. viewOneReport(r) {
  188. this.http.post("/report/getAuditWorkflowList", {reportId:r.id},
  189. res => {
  190. if (res.code == "ok") {
  191. this.$set(r,'auditorList', res.data);
  192. }
  193. },
  194. error => {
  195. this.undoFormLoading = false
  196. this.$message({
  197. message: error,
  198. type: "error"
  199. });
  200. });
  201. },
  202. expandChange(row, expandedRows) {
  203. var reportList = row.data;
  204. for (var i=0;i<reportList.length; i++) {
  205. var r = reportList[i];
  206. if (r.auditorList) continue;
  207. this.http.post("/report/getAuditWorkflowList", {reportId:r.id},
  208. res => {
  209. if (res.code == "ok") {
  210. this.$set(r,'auditorList', res.data);
  211. }
  212. },
  213. error => {
  214. this.undoFormLoading = false
  215. this.$message({
  216. message: error,
  217. type: "error"
  218. });
  219. });
  220. }
  221. },
  222. detailsClick(item, i) {
  223. this.detailsDialog = true
  224. this.detailsList = item.membdateList
  225. this.idx = i
  226. },
  227. // 审核记录撤销点击确定
  228. clickCancel() {
  229. this.undoFormLoading = true
  230. this.http.post('/report/denyHisReport', this.undoForm,
  231. res => {
  232. this.undoFormLoading = false
  233. if (res.code == "ok") {
  234. this.$message({
  235. message: this.$t('Revocationofsuccess'),
  236. type: "success"
  237. });
  238. this.undoFormDialog = false
  239. this.recordList()
  240. } else {
  241. this.$message({
  242. message: res.msg,
  243. type: "error"
  244. });
  245. }
  246. },
  247. error => {
  248. this.undoFormLoading = false
  249. this.$message({
  250. message: error,
  251. type: "error"
  252. });
  253. });
  254. },
  255. undoCli(item, i) {
  256. // console.log(item)
  257. this.undoFormDialog = true
  258. this.undoForm = {reason: ''}
  259. // this.undoForm.reason = ''
  260. if(i){
  261. this.undoForm.hisId = item.id
  262. }else{
  263. this.undoForm.hisId = item.membdateList[0].id
  264. }
  265. this.ioss = i
  266. // if(i == 0) {
  267. // this.undoForm.createDate = item.indate.split(' ')[0]
  268. // this.undoForm.userId = item.userId
  269. // } else {
  270. // this.undoForm.hisId = item.id
  271. // }
  272. },
  273. // 获取审核记录
  274. recordList() {
  275. // this.recordDialogVisible = true
  276. // return
  277. this.http.post( '/report-audit-log/getProjectReportAuditLog', {
  278. companyId: this.user.companyId,
  279. pageIndex: this.pageIndexList,
  280. pageSize: this.pageSizeList
  281. },
  282. res => {
  283. if (res.code == "ok") {
  284. for (var i in res.data.records) {
  285. res.data.records[i].result.indexOf(this.$t('btn.through')) == '-1' ? res.data.records[i].flg = false : res.data.records[i].flg = true
  286. }
  287. this.recordLists = res.data.records
  288. this.totals = res.data.total
  289. if(this.recordLists.length != 0){
  290. this.detailsList = this.recordLists[this.idx].membdateList
  291. }
  292. } else {
  293. this.$message({
  294. message: res.msg,
  295. type: "error"
  296. });
  297. }
  298. },
  299. error => {
  300. this.$message({
  301. message: error,
  302. type: "error"
  303. });
  304. });
  305. },
  306. // 获取部门列表
  307. getDepartment() {
  308. this.http.post( this.port.manage.depList, {},
  309. res => {
  310. if (res.code == "ok") {
  311. var list1 = JSON.parse(JSON.stringify(res.data));
  312. this.option = this.changeArr(list1);
  313. console.log(this.option, '部门')
  314. } else {
  315. this.$message({
  316. message: res.msg,
  317. type: "error"
  318. });
  319. }
  320. },
  321. error => {
  322. this.$message({
  323. message: error,
  324. type: "error"
  325. });
  326. });
  327. },
  328. handleSelectionChange(val) {
  329. this.multipleSelection = val;
  330. },
  331. batchApprove(isPass) {
  332. var ids = '';
  333. for (var i=0;i<this.multipleSelection.length; i++) {
  334. var line = this.multipleSelection[i];
  335. var array = line.data;
  336. if (this.user.company.companyName == '成都明夷电子科技有限公司') {
  337. ids += line.reportIds+',';
  338. } else {
  339. for (var m=0;m<array.length; m++) {
  340. ids += array[m].id+',';
  341. }
  342. }
  343. }
  344. if (ids.length > 0) {
  345. ids = ids.substring(0, ids.length-1);
  346. }
  347. //等待
  348. if(isPass){
  349. this.isbatch = true
  350. this.approveinData = {
  351. ids: ids
  352. }
  353. if(this.user.timeType.needEvaluate == 1){
  354. this.$set(this.approveinData,'evaluate','')
  355. this.approveinDialog = true
  356. }else{
  357. this.batchApproveLoading = true
  358. this.listLoading = true;
  359. this.batchApproveinfun()
  360. }
  361. }else{
  362. this.batchDenyDialog = true
  363. this.batchDenyData.ids = ids
  364. this.batchDenyData.reason = ''
  365. }
  366. },
  367. batchApproveinfun(){
  368. this.http.post('/report/batchApproveReport', this.approveinData,
  369. res => {
  370. this.batchApproveLoading = false
  371. this.listLoading = false;
  372. if (res.code == "ok") {
  373. this.approveinDialog = false
  374. this.getList();
  375. } else {
  376. this.$message({
  377. message: res.msg,
  378. type: "error"
  379. });
  380. }
  381. },
  382. error => {
  383. this.listLoading = false;
  384. this.$message({
  385. message: error,
  386. type: "error"
  387. });
  388. });
  389. },
  390. batchDenyClick(){
  391. this.batchDenyLoading = true
  392. this.listLoading = true;
  393. this.http.post('/report/batchDenyReport', this.batchDenyData,
  394. res => {
  395. this.batchDenyLoading = false;
  396. this.batchDenyDialog = false
  397. this.listLoading = false;
  398. if (res.code == "ok") {
  399. this.getList();
  400. } else {
  401. this.$message({
  402. message: res.msg,
  403. type: "error"
  404. });
  405. }
  406. },
  407. error => {
  408. this.listLoading = false;
  409. this.$message({
  410. message: error,
  411. type: "error"
  412. });
  413. });
  414. },
  415. //分页
  416. handleCurrentChange(val) {
  417. this.page = val;
  418. this.getList();
  419. },
  420. handleSizeChange(val) {
  421. this.size = val;
  422. this.getList();
  423. },
  424. //分页
  425. handleCurrentChangeList(val) {
  426. this.pageIndexList = val;
  427. this.recordList();
  428. },
  429. handleSizeChangeList(val) {
  430. this.pageSizeList = val;
  431. this.recordList();
  432. },
  433. test(){
  434. console.log(this.search.userId);
  435. },
  436. searchUserIds(deptId){
  437. this.searchUsersList = this.usersList.filter(item => deptId == item.departmentId)
  438. },
  439. usersSearch(e){
  440. if(e == false){
  441. this.getList()
  442. }
  443. },
  444. //获取待审核的数据列表
  445. getList(e) {
  446. this.listLoading = true;
  447. this.http.post("/group-budget-review/list",{},
  448. res => {
  449. this.listLoading = false;
  450. if (res.code == "ok") {
  451. this.list = res.data;
  452. } else {
  453. this.$message({
  454. message: res.msg,
  455. type: "error"
  456. });
  457. }
  458. },
  459. error => {
  460. this.listLoading = false;
  461. this.$message({
  462. message: error,
  463. type: "error"
  464. });
  465. });
  466. },
  467. review(id,checkType){
  468. this.http.post("/group-budget-review/check", {id:id,checkType:checkType},
  469. res => {
  470. if (res.code == "ok") {
  471. this.$message({
  472. message:"操作成功",
  473. type: "success"
  474. });
  475. this.getList();
  476. } else {
  477. this.$message({
  478. message: res.msg,
  479. type: "error"
  480. });
  481. }
  482. },
  483. error => {
  484. this.$message({
  485. message: error,
  486. type: "error"
  487. });
  488. });
  489. },
  490. approveinfun(){
  491. this.http.post(this.port.report.approve, this.approveinData,
  492. res => {
  493. this.logining = false;
  494. if (res.code == "ok") {
  495. this.approveinDialog = false
  496. this.$message({
  497. message: this.$t('message.Reviewsucceeded'),
  498. type: "success"
  499. });
  500. this.getList();
  501. } else {
  502. this.$message({
  503. message: res.msg,
  504. type: "error"
  505. });
  506. }
  507. },
  508. error => {
  509. this.logining = false;
  510. this.$message({
  511. message: error,
  512. type: "error"
  513. });
  514. });
  515. },
  516. // 修改数组
  517. changeArr(arr) {
  518. for (var i = 0; i < arr.length; i++) {
  519. if(arr[i].id != -1 && arr[i].id != 0) {
  520. if (arr[i].children != null && arr[i].children.length>0) {
  521. arr[i].children = this.changeArr(arr[i].children);
  522. }
  523. arr[i].id && (arr[i].value = arr[i].id);
  524. delete arr[i].id;
  525. }
  526. }
  527. for(var i in arr) {
  528. if(arr[i].id == -1 || arr[i].id == 0) {
  529. arr.splice(i,1)
  530. }
  531. }
  532. return arr;
  533. },
  534. //获取项目列表
  535. getProjectList() {
  536. this.http.post( this.port.project.list, {},
  537. res => {
  538. if (res.code == "ok") {
  539. this.projectList = res.data;
  540. } else {
  541. this.$message({
  542. message: res.msg,
  543. type: "error"
  544. });
  545. }
  546. },
  547. error => {
  548. this.$message({
  549. message: error,
  550. type: "error"
  551. });
  552. });
  553. },
  554. showDenyDialog(id,i, date, item) {
  555. this.denyReasonDialog = true;
  556. var ids = '';
  557. if (this.user.company.companyName == '成都明夷电子科技有限公司') {
  558. ids = item.reportIds;
  559. } else {
  560. var data = item.data;
  561. data.forEach(element => {
  562. ids +=(element.id+',');
  563. });
  564. }
  565. this.denyForm = {id: id ,i:i, date: date, reportIds: ids, reason:null};
  566. },
  567. // 未通过日报
  568. deny() {
  569. this.logining = true;
  570. this.http.post( this.port.report.deny, this.denyForm,
  571. res => {
  572. this.logining = false;
  573. if (res.code == "ok") {
  574. this.$message({
  575. message: this.denyForm.i==0?this.$t('message.rejectedsuccessfully'):this.$t('Revocationofsuccess'),
  576. type: "success"
  577. });
  578. this.getList();
  579. this.denyReasonDialog = false;
  580. } else {
  581. this.$message({
  582. message: res.msg,
  583. type: "error"
  584. });
  585. }
  586. },
  587. error => {
  588. this.logining = false;
  589. this.$message({
  590. message: error,
  591. type: "error"
  592. });
  593. });
  594. },
  595. // 获取所有人员
  596. getUsers() {
  597. // this.http.post(this.port.manage.list, {
  598. // departmentId: -1,
  599. // pageIndex: 1,
  600. // // pageSize: 99999
  601. // pageSize: -1
  602. // },
  603. this.http.post('/user/getSimpleActiveUserList', {},
  604. res => {
  605. if (res.code == "ok") {
  606. this.usersList = res.data;
  607. this.searchUsersList = this.usersList
  608. } else {
  609. this.$message({
  610. message: res.msg,
  611. type: "error"
  612. });
  613. }
  614. },
  615. error => {
  616. this.$message({
  617. message: error,
  618. type: "error"
  619. });
  620. });
  621. },
  622. // 选择日期后触发
  623. dataTimes() {
  624. // console.log(this.dataTime)
  625. if(this.dataTime){
  626. this.search.startDate = this.dataTime[0]
  627. this.search.endDate = this.dataTime[1]
  628. }else{
  629. this.search.startDate = null
  630. this.search.endDate = null
  631. }
  632. this.getList()
  633. },
  634. // 自定义部门选择
  635. vueCasader(obj) {
  636. console.log(obj, '组件传过来的')
  637. if(obj.distinction == '1') {
  638. if(obj.id != '') {
  639. let arr = []
  640. arr.push(obj.id)
  641. this.search.departmentIdArray = arr
  642. } else {
  643. this.search.departmentIdArray = []
  644. }
  645. this.getList(1)
  646. }
  647. },
  648. selectCal(obj) {
  649. console.log(obj, '过来的数据')
  650. // search.userIdArray
  651. let userListId = obj.arrUserList
  652. let arr = []
  653. for(var i in userListId) {
  654. arr.push(userListId[i].id)
  655. }
  656. this.search.userIdArray = arr
  657. console.log(this.search.userIdArray, '数据看看')
  658. this.usersSearch(false)
  659. },
  660. defaultExpandAllFlgCli() {
  661. this.defaultExpandAllFlg = !this.defaultExpandAllFlg
  662. this.list = JSON.parse(JSON.stringify(this.list))
  663. this.$nextTick(()=>{this.$refs.multipleTable.doLayout()})
  664. this.showTable = false
  665. this.$nextTick(() => {
  666. this.showTable = true
  667. })
  668. }
  669. },
  670. created() {
  671. let height = window.innerHeight;
  672. this.tableHeight = height - 125;
  673. const that = this;
  674. window.onresize = function temp() {
  675. that.tableHeight = window.innerHeight - 125;
  676. };
  677. },
  678. mounted() {
  679. this.getList();
  680. // this.getDepartment();
  681. // this.getProjectList();
  682. // this.getUsers()
  683. }
  684. };
  685. </script>
  686. <style lang="scss">
  687. .propsbtn {
  688. display: inline-block;
  689. padding-left: 20px;
  690. }
  691. </style>