dash.vue 27 KB

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