dash.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977
  1. <template>
  2. <div class="full-height full-width flex flex-col">
  3. <div class="flex flex-col padding white-bg">
  4. <div class="flex flex-align-center tip">
  5. <el-icon class="ml-20" color="#BC002D">
  6. <WarningFilled />
  7. </el-icon>
  8. <span class="ml-5"
  9. >项目总投资额<span class="main-color bold">{{
  10. num ? Number.parseFloat(num).toLocaleString() : '0'
  11. }}</span
  12. >万元</span
  13. >
  14. </div>
  15. <div
  16. class="flex ml-20 hide-scrollbar"
  17. style="overflow-x: scroll; width: 86vw"
  18. v-show="numList && numList.length > 0"
  19. >
  20. <div
  21. v-for="(item, index) in numList"
  22. :key="item.id"
  23. :class="active === index ? 'total-s' : 'total'"
  24. class="flex flex-center flex-justify-between mt-20 bold font-16 pointer"
  25. @click="switchTab(item, index)"
  26. >
  27. <span class="sp">{{ item.name }}</span>
  28. <span class="sp1"
  29. >{{ item.number }}<span class="grey font-13">个</span></span
  30. >
  31. </div>
  32. </div>
  33. <div class="flex flex-center flex-justify-start">
  34. <base-button
  35. class="ml-20 mt-20"
  36. icon="Plus"
  37. title="新增"
  38. v-if="
  39. dataType === 'project' &&
  40. permissions.vaildPermission('project_new_create')
  41. "
  42. @click="showAdd = true"
  43. />
  44. <base-button
  45. class="ml-20 mt-20"
  46. icon="el-icon-upload"
  47. title="数据导入"
  48. v-if="dataType === 'project'"
  49. @click="diaType = 0"
  50. />
  51. <base-button
  52. class="ml-20 mt-20"
  53. icon="el-icon-download"
  54. title="数据导出"
  55. @click="diaType = 1"
  56. />
  57. <base-button
  58. class="ml-20 mt-20"
  59. type="0"
  60. icon="el-icon-download"
  61. title="汇总数据导出"
  62. @click="diaType = 2"
  63. />
  64. <base-button
  65. class="ml-20 mt-20"
  66. type="0"
  67. icon="el-icon-coordinate"
  68. title="项目结转"
  69. @click="projectCarry"
  70. />
  71. </div>
  72. </div>
  73. <avue-crud
  74. ref="crud"
  75. v-model="form"
  76. v-model:page="page"
  77. :before-open="beforeOpen"
  78. :permission="permissions"
  79. :data="data"
  80. :option="option"
  81. :table-loading="loading"
  82. class="curd"
  83. @row-del="rowDel"
  84. @tree-load="treeLoad"
  85. @current-change="currentChange"
  86. @size-change="sizeChange"
  87. @refresh-change="refreshChange"
  88. @selection-change="selectionChange"
  89. @on-load="onLoad"
  90. >
  91. <template #menu="{ row }">
  92. <el-button
  93. v-if="
  94. dataType === 'asset' && row.project_stage !== 7 && row.can_update
  95. "
  96. icon="Upload"
  97. type="primary"
  98. text
  99. @click="report(row)"
  100. >
  101. {{ row.is_report === 1 ? '项目已上报' : '项目上报' }}
  102. </el-button>
  103. <el-button
  104. v-if="
  105. (row.report_type === 0 ||
  106. row.report_type === 1 ||
  107. row.report_type === 4) &&
  108. row.can_update
  109. "
  110. text
  111. type="primary"
  112. icon="el-icon-upload"
  113. @click="projectReport(row)"
  114. >上报审核
  115. </el-button>
  116. <el-button
  117. text
  118. v-if="
  119. permissions.vaildPermission('projectApprovalBtn') &&
  120. row.report_type === 2
  121. "
  122. type="primary"
  123. icon="el-icon-bell"
  124. @click="rowClick(row, 1)"
  125. >审核
  126. </el-button>
  127. <el-button
  128. v-if="
  129. row.hasOwnProperty('report_type') &&
  130. row.report_type === 3 &&
  131. row.can_update
  132. "
  133. text
  134. type="primary"
  135. icon="el-icon-upload"
  136. @click="projectReportFormal(row)"
  137. >上报固定资产
  138. </el-button>
  139. <el-button
  140. text
  141. type="primary"
  142. icon="el-icon-folder-remove"
  143. @click="projectCancel(row)"
  144. v-if="row.project_stage !== 7 && row.can_update"
  145. >退库
  146. </el-button>
  147. <el-button
  148. text
  149. type="primary"
  150. icon="el-icon-delete"
  151. @click="rowDel(row)"
  152. v-if="row.can_update"
  153. >删除
  154. </el-button>
  155. </template>
  156. <template #plan_storage_time-header="{ column }">
  157. <div class="flex flex-center">
  158. <div class="mr-5">{{ (column || {}).label }}</div>
  159. <el-tooltip content="红色为计划开工时间,蓝色为实际开工时间">
  160. <el-icon>
  161. <InfoFilled />
  162. </el-icon>
  163. </el-tooltip>
  164. </div>
  165. </template>
  166. <template #plan_storage_time="{ row }">
  167. <div class="flex flex-center">
  168. <div
  169. class="mr-5 red"
  170. v-if="row.plan_storage_time !== undefined && row.is_storage === 0"
  171. >
  172. {{ row.plan_storage_time.substring(0, 10) }}
  173. </div>
  174. <div class="mr-5 blue" v-else>
  175. {{ row.storage_time ? row.storage_time.substring(0, 10) : '' }}
  176. </div>
  177. </div>
  178. </template>
  179. <template #plan_commencement_time-header="{ column }">
  180. <div class="flex flex-center">
  181. <div class="mr-5">{{ (column || {}).label }}</div>
  182. <el-tooltip content="红色为计划开工时间,蓝色为实际开工时间">
  183. <el-icon>
  184. <InfoFilled />
  185. </el-icon>
  186. </el-tooltip>
  187. </div>
  188. </template>
  189. <template #plan_commencement_time="{ row }">
  190. <div class="flex flex-center">
  191. <div
  192. class="mr-5 red"
  193. v-if="
  194. row.plan_commencement_time !== undefined &&
  195. (row.is_start === undefined || row.is_start === 0)
  196. "
  197. >
  198. {{ row.plan_commencement_time.substring(0, 10) }}
  199. </div>
  200. <div class="mr-5 blue" v-else>
  201. {{ row.start_time ? row.start_time.substring(0, 10) : '' }}
  202. </div>
  203. </div>
  204. </template>
  205. <template #project_stage="{ row }">
  206. <div class="flex flex-center">
  207. <div>{{ row['$project_stage'] }}</div>
  208. <el-tooltip :content="row.exit_msg" v-if="row.project_stage === 7">
  209. <el-icon @click="showReceipt(row.exit_msg)">
  210. <InfoFilled />
  211. </el-icon>
  212. </el-tooltip>
  213. </div>
  214. </template>
  215. <template #report_type="{ row }">
  216. <div class="flex flex-center">
  217. <el-tag>{{ row.report_type_name }}</el-tag>
  218. <el-tooltip :content="row.receipt_msg">
  219. <el-icon
  220. v-if="row.report_type === 4"
  221. class="ml-10"
  222. @click="showReceipt(row.receipt_msg)"
  223. >
  224. <WarningFilled />
  225. </el-icon>
  226. </el-tooltip>
  227. </div>
  228. </template>
  229. </avue-crud>
  230. <!-- 新增-->
  231. <el-dialog
  232. v-model="showAdd"
  233. append-to-body
  234. center
  235. title="新增项目"
  236. width="35%"
  237. >
  238. <div v-loading="addLoading">
  239. <el-form
  240. ref="form"
  241. :model="projectForm"
  242. class="lab mt-20"
  243. label-width="100px"
  244. :rules="rules"
  245. >
  246. <div class="flex flex-center flex-col mr-20">
  247. <el-form-item class="full-width" label="项目名称" prop="name">
  248. <el-input
  249. v-model="projectForm.name"
  250. clearable
  251. placeholder="输入项目名称"
  252. />
  253. </el-form-item>
  254. <el-form-item
  255. class="full-width"
  256. label="项目总投"
  257. prop="totalAmount"
  258. >
  259. <el-input
  260. v-model="projectForm.totalAmount"
  261. clearable
  262. placeholder="输入项目总投(万元)"
  263. >
  264. <template #append>(万元)</template>
  265. </el-input>
  266. </el-form-item>
  267. <el-form-item class="full-width" label="项目标签" prop="tags">
  268. <el-select
  269. v-model="projectForm.tags"
  270. clearable
  271. placeholder="选择项目标签"
  272. style="width: 100%"
  273. >
  274. <el-option
  275. v-for="item in tagsList"
  276. :key="item.dictKey"
  277. :label="item.dictValue"
  278. :value="item.dictKey"
  279. />
  280. </el-select>
  281. </el-form-item>
  282. <el-form-item class="full-width" label="建设内容">
  283. <el-input
  284. v-model="projectForm.introduction"
  285. :rows="6"
  286. clearable
  287. placeholder="输入项目建设内容"
  288. type="textarea"
  289. />
  290. </el-form-item>
  291. <div class="flex flex-center mt-10">
  292. <base-button
  293. class="mr-20"
  294. icon="Close"
  295. title="取消"
  296. type="0"
  297. @click="showAdd = false"
  298. />
  299. <base-button icon="Check" title="保存" @click="projectSave" />
  300. </div>
  301. </div>
  302. </el-form>
  303. </div>
  304. </el-dialog>
  305. <form-dialog
  306. :dialogType="diaType"
  307. @close="formDialogClose"
  308. @export="exportExcel"
  309. :ids="selectList"
  310. :year="owerQuery.projectYear"
  311. />
  312. <summary-dialog
  313. :dialogType="diaType"
  314. @close="diaType = -1"
  315. :select-num="selectList.length === 0 ? page.total : selectList.length"
  316. @export="exportExcelTotal"
  317. />
  318. <el-dialog v-model="reportShow" width="500px" title="请选择上报时间">
  319. <div v-if="currentReport">
  320. <el-date-picker
  321. v-model="currentReport.report_time"
  322. format="YYYY-MM-DD"
  323. class="mb-20"
  324. placeholder="选择上报时间"
  325. style="width: 100%"
  326. value-format="YYYY-MM-DD"
  327. />
  328. </div>
  329. <div class="flex flex-center full-width flex-justify-end">
  330. <el-button @click="reportShow = false">取 消</el-button>
  331. <el-button @click="track(currentReport)">确 定</el-button>
  332. </div>
  333. </el-dialog>
  334. <!-- 项目审批-->
  335. <el-dialog v-model="showApproval" title="审核" width="500px">
  336. <div class="flex flex-justify-start flex-col">
  337. <div class="full-width flex flex-justify-start flex-align-center mb-20">
  338. <span>审核状态:</span>
  339. <el-radio-group v-model="approvalStatus">
  340. <el-radio :label="3">通过</el-radio>
  341. <el-radio :label="4">不通过</el-radio>
  342. </el-radio-group>
  343. </div>
  344. <el-input
  345. class="mt-20"
  346. type="textarea"
  347. :rows="5"
  348. v-model="approvalMsg"
  349. placeholder="请填写审批意见"
  350. />
  351. <div class="full-width flex flex-justify-end mt-20">
  352. <el-button plain type="primary" @click="showApproval = false"
  353. >取消
  354. </el-button>
  355. <el-button type="primary" @click="projectApproval">确定</el-button>
  356. </div>
  357. </div>
  358. </el-dialog>
  359. </div>
  360. </template>
  361. <script>
  362. import BaseButton from '../../../components/base-button.vue'
  363. import permissionStore from '@/store/permission.js'
  364. import formDialog from '@/views/home/component/form_dialog.vue'
  365. import { getLazyList } from '@/api/project/index.js'
  366. import summaryDialog from '@/views/home/component/summary_dialog.vue'
  367. import { useStore } from '@/store/user.js'
  368. import confing from '@/config/website'
  369. import { ElMessageBox } from 'element-plus'
  370. export default {
  371. name: 'dash',
  372. components: { BaseButton, formDialog, summaryDialog },
  373. setup() {
  374. const permissions = permissionStore()
  375. const user = useStore()
  376. return { permissions, user }
  377. },
  378. data() {
  379. return {
  380. showApproval: false,
  381. approvalMsg: '',
  382. approvalStatus: 3,
  383. reportTime: '',
  384. currentReport: null,
  385. reportShow: false,
  386. dialogLoading: false,
  387. disable: false,
  388. showAdd: false,
  389. active: 0,
  390. loading: false,
  391. addLoading: false,
  392. data: [],
  393. form: {},
  394. option: {
  395. menuBtnTitle: '操作',
  396. refreshBtn: false,
  397. tip: false,
  398. lazy: true,
  399. columnBtn: false,
  400. searchShow: true,
  401. selection: true,
  402. editBtn: true,
  403. editBtnText: '资料管理',
  404. editBtnIcon: 'Document',
  405. addBtn: false,
  406. delBtn: false,
  407. border: true,
  408. reserveSelection: true,
  409. align: 'center',
  410. viewBtn: true,
  411. viewBtnText: '详情',
  412. dialogClickModal: false,
  413. column: [
  414. {
  415. label: '项目名称',
  416. prop: 'name',
  417. addDisplay: false,
  418. editDisplay: false,
  419. fixed: true,
  420. minWidth: 200
  421. },
  422. {
  423. label: '项目情况',
  424. prop: 'project_stage',
  425. type: 'select',
  426. slot: true,
  427. width: 140,
  428. dicUrl:
  429. '/api/blade-system/dict-biz/dictionary?code=project-situation',
  430. props: {
  431. label: 'dictValue',
  432. value: 'dictKey'
  433. }
  434. },
  435. {
  436. label: '项目总投资(万元)',
  437. prop: 'total_amount',
  438. width: 120,
  439. type: 'number',
  440. precision: 2,
  441. formatter: (val, value, label) => {
  442. return val.total_amount.toLocaleString()
  443. }
  444. },
  445. {
  446. label: '责任单位',
  447. prop: 'responsible_unit'
  448. },
  449. {
  450. label: '子项目数量',
  451. prop: 'lot',
  452. width: 120,
  453. hide: true
  454. },
  455. {
  456. label: '是否入库',
  457. prop: 'is_storage',
  458. width: 120,
  459. dicData: [
  460. {
  461. label: '否',
  462. value: 0
  463. },
  464. {
  465. label: '是',
  466. value: 1
  467. }
  468. ]
  469. },
  470. {
  471. label: '计划(实际)入库时间',
  472. prop: 'plan_storage_time',
  473. width: 120,
  474. formatter: (val, value, label) => {
  475. return value.substring(0, 10)
  476. }
  477. },
  478. {
  479. label: '是否开工',
  480. prop: 'is_start',
  481. width: 120,
  482. dicData: [
  483. {
  484. label: '否',
  485. value: 0
  486. },
  487. {
  488. label: '是',
  489. value: 1
  490. }
  491. ]
  492. },
  493. {
  494. label: '计划(实际)开工时间',
  495. prop: 'plan_commencement_time',
  496. width: 120,
  497. formatter: (val, value, label) => {
  498. return value.substring(0, 10)
  499. }
  500. },
  501. {
  502. label: '上报时间',
  503. prop: 'report_time',
  504. width: 120
  505. },
  506. {
  507. label: '认定时间',
  508. prop: 'year',
  509. width: 120
  510. },
  511. {
  512. label: '预警提示',
  513. prop: 'tips',
  514. width: 100
  515. },
  516. {
  517. label: '项目状态',
  518. prop: 'report_type',
  519. width: 170,
  520. slot: true
  521. }
  522. ]
  523. },
  524. page: {
  525. size: 10,
  526. current: 1,
  527. total: 0
  528. },
  529. stage: [],
  530. numList: [],
  531. typeList: [],
  532. tagsList: [],
  533. num: '',
  534. projectForm: {
  535. name: '',
  536. totalAmount: '',
  537. projectType: '1589613582090166274',
  538. tags: '',
  539. introduction: ''
  540. },
  541. rules: {
  542. name: [{ required: true, message: '请输入项目名称', trigger: 'blur' }],
  543. projectType: [
  544. {
  545. required: true,
  546. message: '请选择项目类型',
  547. trigger: 'change'
  548. }
  549. ],
  550. tags: [
  551. {
  552. required: true,
  553. message: '请选择项目标签',
  554. trigger: 'change'
  555. }
  556. ]
  557. },
  558. diaType: -1,
  559. parentId: 0,
  560. queryData: null,
  561. owerQuery: {},
  562. projectStageQuery: {},
  563. selectList: [],
  564. dev: false,
  565. dataType: 'project'
  566. }
  567. },
  568. created() {
  569. this.dev = sessionStorage.getItem('dev') === 'true'
  570. const index = this.option.column.findIndex(sub => sub.prop === 'lot')
  571. const indexLabel = this.option.column.findIndex(
  572. sub => sub.prop === 'responsible_unit'
  573. )
  574. this.dataType = localStorage.getItem('data-type')
  575. if (this.user.info.viewStage === 1) {
  576. // 发改
  577. this.option.column[index].hide = true
  578. this.option.column[indexLabel].label = '责任单位'
  579. } else {
  580. this.option.column[index].hide = false
  581. this.option.column[indexLabel].label = '责任股(科)室'
  582. }
  583. this.$bus.on('serach', (res, type) => {
  584. this.owerQuery = res
  585. if (res.type === false) {
  586. this.projectStageQuery.projectStage = ''
  587. this.active = 0
  588. }
  589. this.onLoad(Object.assign(this.owerQuery, this.projectStageQuery))
  590. this.getNumList(Object.assign(this.owerQuery, this.projectStageQuery))
  591. })
  592. this.getTypeList()
  593. this.getNumList()
  594. },
  595. unmounted() {
  596. sessionStorage.removeItem('selectList')
  597. },
  598. methods: {
  599. switchTab(item, index) {
  600. this.active = index
  601. this.num = this.numList[index].totalAmount
  602. this.projectStageQuery = { projectStage: item.dictKey }
  603. this.onLoad(Object.assign(this.owerQuery, this.projectStageQuery))
  604. },
  605. onLoad(query = {}) {
  606. this.loading = true
  607. if (!Object.hasOwn(this.owerQuery, 'projectYear')) {
  608. this.owerQuery.projectYear = new Date().getFullYear()
  609. }
  610. console.log(this.owerQuery)
  611. const data = { ...this.owerQuery, parentId: this.parentId }
  612. this.queryData = data
  613. console.log(this.queryData)
  614. this.$api.project
  615. .projectList(this.page.currentPage, this.page.pageSize, this.queryData)
  616. .then(res => {
  617. this.loading = false
  618. if (res.code === 200) {
  619. this.data = res.data.records.map(e => {
  620. e.projectStage = e.projectStage + ''
  621. e.selected = true
  622. const xian = e.name.indexOf('县')
  623. e.name = this.dev ? e.name.substring(xian + 1) : e.name
  624. const status = confing.reportTypes.find(
  625. ele => ele.value === e.report_type
  626. )
  627. if (status) {
  628. e.report_type_name = status.label
  629. }
  630. return e
  631. })
  632. this.page.total = res.data.total
  633. }
  634. })
  635. .finally(() => {
  636. this.loading = false
  637. })
  638. },
  639. selectionChange(list) {
  640. this.selectList = list.map(sub => sub.id)
  641. },
  642. beforeOpen(done, type) {
  643. if (['edit'].includes(type)) {
  644. this.$router.push({
  645. path: '/home/details',
  646. query: {
  647. id: this.form.id,
  648. type: '0',
  649. ownerId: this.form.createUser
  650. }
  651. })
  652. } else if (type === 'view') {
  653. this.$router.push({
  654. path: '/home/pro_detail',
  655. query: { id: this.form.id, projectStage: this.form.project_stage }
  656. })
  657. }
  658. },
  659. currentChange(currentPage) {
  660. this.page.current = currentPage
  661. },
  662. sizeChange(pageSize) {
  663. this.page.size = pageSize
  664. },
  665. refreshChange() {
  666. this.getNumList()
  667. this.onLoad()
  668. },
  669. treeLoad(tree, treeNode, resolve) {
  670. this.loading = true
  671. getLazyList(tree.id).then(res => {
  672. this.loading = false
  673. resolve(
  674. res.data.data.childrenList.map(e => {
  675. e.project_stage = e.project_stage.toString()
  676. return e
  677. })
  678. )
  679. })
  680. },
  681. rowDel(row) {
  682. this.$confirm('确定删除选择的项目?', {
  683. confirmButtonText: '确定',
  684. cancelButtonText: '取消',
  685. type: 'warning'
  686. }).then(() => {
  687. this.$api.project.projectRemove({ ids: row.id }).then(res => {
  688. if (res.code === 200) {
  689. this.$message.success(res.msg)
  690. this.onLoad()
  691. } else {
  692. this.$message.error(res.msg)
  693. }
  694. })
  695. })
  696. },
  697. getNumList(data) {
  698. this.$api.project.userNunList(data).then(res => {
  699. if (res.code === 200) {
  700. this.numList = res.data.projectStage
  701. this.num = res.data.projectStage[0].totalAmount
  702. }
  703. })
  704. },
  705. getTypeList() {
  706. this.$api.project
  707. .typeList({ type: 1, size: 999, current: 1 })
  708. .then(res => {
  709. this.typeList = res.data.records
  710. })
  711. this.$api.common.dicList({ code: 'project-tags' }).then(res => {
  712. if (res.code === 200) {
  713. this.tagsList = res.data
  714. }
  715. })
  716. },
  717. report(res) {
  718. if (res.is_report === 1) {
  719. this.$message.error('该项目已经上报')
  720. return
  721. }
  722. this.currentReport = res
  723. this.reportShow = true
  724. },
  725. /**
  726. * 股室上报项目到管理员
  727. * @param res
  728. */
  729. projectReport(res) {
  730. this.$confirm('确认上报至管理员进行审核?').then(ele => {
  731. if (ele === 'confirm') {
  732. this.$api.project.upReportType({ id: res.id }).then(res => {
  733. if (res.code === 200) {
  734. this.$message.success(res.msg)
  735. this.refreshChange()
  736. } else {
  737. this.$message.error(res.msg)
  738. }
  739. })
  740. }
  741. })
  742. },
  743. rowClick(item, type) {
  744. this.form = item
  745. if (type === 1) {
  746. this.showApproval = true
  747. }
  748. },
  749. /**
  750. * 管理员审批项目
  751. * approvalStatus === 4 审核不通过,需要填写原因
  752. */
  753. projectApproval() {
  754. if (this.approvalStatus === 4 && this.approvalMsg.length === 0) {
  755. this.$message.error('请填写审核意见')
  756. return
  757. }
  758. this.showApproval = false
  759. this.$api.project
  760. .approvalProject({
  761. id: this.form.id,
  762. reportType: this.approvalStatus,
  763. receiptMsg: this.approvalMsg
  764. })
  765. .then(res => {
  766. if (res.code === 200) {
  767. this.$message.success(res.msg)
  768. this.approvalStatus = 3
  769. this.approvalMsg = ''
  770. this.refreshChange()
  771. } else {
  772. this.$message.error(res.msg)
  773. }
  774. })
  775. },
  776. /**
  777. * 管理员已经审核通过的项目,上报到固定资产
  778. * @param res
  779. */
  780. projectReportFormal(item) {
  781. this.$confirm('确定上报到固定资产?').then(res => {
  782. if (res === 'confirm') {
  783. this.$api.project.reportToAssets({ ids: item.id }).then(res => {
  784. if (res.code === 200) {
  785. this.$message.success(res.msg)
  786. this.refreshChange()
  787. } else {
  788. this.$message.error(res.msg)
  789. }
  790. })
  791. }
  792. })
  793. },
  794. /**
  795. * 项目结转
  796. */
  797. projectCarry() {
  798. if (this.selectList.length === 0) {
  799. this.$message.error('请先选择要结转的项目')
  800. return
  801. }
  802. this.$api.project
  803. .projectCarry({ ids: this.selectList.join(',') })
  804. .then(res => {
  805. if (res.code === 200) {
  806. this.$message.success(res.msg)
  807. this.refreshChange()
  808. } else {
  809. this.$message.error(res.msg)
  810. }
  811. })
  812. },
  813. /**
  814. * 项目退库
  815. */
  816. projectCancel(res) {
  817. ElMessageBox.prompt('请输入退库原因', '提示', {}).then(({ value }) => {
  818. console.log(value)
  819. if (value === null || value.length === 0) {
  820. this.$message.error('请输入退库原因')
  821. return
  822. }
  823. this.$api.project
  824. .projectCancel({ id: res.id, exitMsg: value })
  825. .then(res => {
  826. if (res.code === 200) {
  827. this.$message.success(res.msg)
  828. this.refreshChange()
  829. } else {
  830. this.$message.error(res.msg)
  831. }
  832. })
  833. })
  834. },
  835. track(res) {
  836. const data = {
  837. id: res.id,
  838. is_report: 1,
  839. report_time: res.report_time
  840. }
  841. this.$api.project.proUpdate(data).then(res => {
  842. this.reportShow = false
  843. if (res.code === 200) {
  844. this.onLoad()
  845. this.$message.success(res.msg)
  846. } else {
  847. this.$message.error(res.msg)
  848. }
  849. })
  850. },
  851. projectSave() {
  852. if (this.disable) {
  853. this.$message.error('正在处理,请稍后...')
  854. return
  855. }
  856. this.$refs.form.validate(valid => {
  857. if (valid) {
  858. this.disable = true
  859. this.addLoading = true
  860. this.$api.project.projectAdd(this.projectForm).then(res => {
  861. this.disable = false
  862. this.addLoading = false
  863. if (res.code === 200) {
  864. this.showAdd = false
  865. this.$message.success(res.msg)
  866. this.projectForm = {
  867. name: '',
  868. totalAmount: '',
  869. projectType: '1589613582090166274',
  870. tags: '',
  871. introduction: ''
  872. }
  873. this.onLoad()
  874. } else {
  875. this.showAdd = false
  876. this.$message.error(res.msg)
  877. }
  878. })
  879. }
  880. })
  881. },
  882. formDialogClose() {
  883. if (this.diaType === 0) {
  884. this.onLoad()
  885. }
  886. this.diaType = -1
  887. },
  888. exportExcel(res, year) {
  889. const data = Object.assign(
  890. { ...this.queryData },
  891. {
  892. columnName: res,
  893. projectIds: this.selectList.join(','),
  894. previewType: 1,
  895. projectYear: year
  896. }
  897. )
  898. this.$router.push({ query: data, path: '/home/excel' })
  899. },
  900. showReceipt(msg) {
  901. this.$confirm(msg, {
  902. confirmButtonText: '确定',
  903. cancelButtonText: '取消',
  904. type: 'warning'
  905. })
  906. },
  907. exportExcelTotal(item) {
  908. const dataIds = {
  909. ...this.queryData,
  910. ...item,
  911. projectIds: this.selectList.join(','),
  912. previewType: 2
  913. }
  914. this.$router.push({ query: dataIds, path: '/home/excel' })
  915. }
  916. }
  917. }
  918. </script>
  919. <style lang="scss" scoped>
  920. .tip {
  921. width: 260px;
  922. height: 38px;
  923. background-color: #fbf6ed;
  924. font-weight: 500;
  925. flex-wrap: nowrap;
  926. margin-left: 20px;
  927. }
  928. .total-s {
  929. width: 200px;
  930. height: 50px;
  931. border: 1px solid #825618;
  932. border-radius: 10px;
  933. margin-right: 20px;
  934. box-shadow: 2px 2px 10px 2px rgba(113, 73, 39, 0.3);
  935. .sp {
  936. color: #ecab56;
  937. white-space: nowrap;
  938. margin-left: 20px;
  939. }
  940. .sp1 {
  941. color: #ecab56;
  942. margin-right: 20px;
  943. }
  944. }
  945. .total {
  946. width: 200px;
  947. height: 50px;
  948. border-radius: 10px;
  949. margin-right: 20px;
  950. background-color: #f0f2f7;
  951. .sp {
  952. color: #707070;
  953. white-space: nowrap;
  954. margin-left: 20px;
  955. }
  956. .sp1 {
  957. color: #825618;
  958. margin-right: 20px;
  959. }
  960. }
  961. .curd {
  962. :deep(.avue-crud__menu) {
  963. min-height: 10px;
  964. }
  965. }
  966. </style>