dash.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964
  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. user.info.viewStage !== 1 &&
  95. dataType === 'asset' &&
  96. row.project_stage !== 7 &&
  97. row.can_update
  98. "
  99. icon="Upload"
  100. type="primary"
  101. text
  102. @click="report(row)"
  103. >
  104. {{ row.is_report === 1 ? '项目已上报' : '项目上报' }}
  105. </el-button>
  106. <el-button
  107. v-if="
  108. (!row.hasOwnProperty('report_type') ||
  109. row.report_type === 1 ||
  110. row.report_type === 4) &&
  111. row.can_update
  112. "
  113. text
  114. type="primary"
  115. icon="el-icon-upload"
  116. @click="projectReport(row)"
  117. >上报审核
  118. </el-button>
  119. <el-button
  120. text
  121. v-if="
  122. permissions.vaildPermission('projectApprovalBtn') &&
  123. row.report_type === 2 &&
  124. row.can_update
  125. "
  126. type="primary"
  127. icon="el-icon-bell"
  128. @click="rowClick(row, 1)"
  129. >审核
  130. </el-button>
  131. <el-button
  132. v-if="
  133. row.hasOwnProperty('report_type') &&
  134. row.report_type === 3 &&
  135. row.can_update
  136. "
  137. text
  138. type="primary"
  139. icon="el-icon-upload"
  140. @click="projectReportFormal(row)"
  141. >上报固定资产
  142. </el-button>
  143. <el-button
  144. text
  145. type="primary"
  146. icon="el-icon-folder-remove"
  147. @click="projectCancel(row)"
  148. v-if="row.project_stage !== 7 && row.can_update"
  149. >退库
  150. </el-button>
  151. <el-button
  152. text
  153. type="primary"
  154. icon="el-icon-delete"
  155. @click="rowDel(row)"
  156. v-if="row.can_update"
  157. >删除
  158. </el-button>
  159. </template>
  160. <template #plan_storage_time-header="{ column }">
  161. <div class="flex flex-center">
  162. <div class="mr-5">{{ (column || {}).label }}</div>
  163. <el-tooltip content="红色为计划开工时间,蓝色为实际开工时间">
  164. <el-icon>
  165. <InfoFilled />
  166. </el-icon>
  167. </el-tooltip>
  168. </div>
  169. </template>
  170. <template #plan_storage_time="{ row }">
  171. <div class="flex flex-center">
  172. <div
  173. class="mr-5 red"
  174. v-if="row.plan_storage_time !== undefined && row.is_storage === 0"
  175. >
  176. {{ row.plan_storage_time.substring(0, 10) }}
  177. </div>
  178. <div class="mr-5 blue" v-else>
  179. {{ row.storage_time ? row.storage_time.substring(0, 10) : '' }}
  180. </div>
  181. </div>
  182. </template>
  183. <template #plan_commencement_time-header="{ column }">
  184. <div class="flex flex-center">
  185. <div class="mr-5">{{ (column || {}).label }}</div>
  186. <el-tooltip content="红色为计划开工时间,蓝色为实际开工时间">
  187. <el-icon>
  188. <InfoFilled />
  189. </el-icon>
  190. </el-tooltip>
  191. </div>
  192. </template>
  193. <template #plan_commencement_time="{ row }">
  194. <div class="flex flex-center">
  195. <div
  196. class="mr-5 red"
  197. v-if="
  198. row.plan_commencement_time !== undefined &&
  199. (row.is_start === undefined || row.is_start === 0)
  200. "
  201. >
  202. {{ row.plan_commencement_time.substring(0, 10) }}
  203. </div>
  204. <div class="mr-5 blue" v-else>
  205. {{ row.start_time ? row.start_time.substring(0, 10) : '' }}
  206. </div>
  207. </div>
  208. </template>
  209. <template #project_stage="{ row }">
  210. <div class="flex flex-center">
  211. <div>{{ row['$project_stage'] }}</div>
  212. <el-tooltip :content="row.exit_msg" v-if="row.project_stage === 7">
  213. <el-icon @click="showReceipt(row.exit_msg)">
  214. <InfoFilled />
  215. </el-icon>
  216. </el-tooltip>
  217. </div>
  218. </template>
  219. <template #report_type="{ row }">
  220. <div class="flex flex-center">
  221. <el-tag>{{ row.report_type_name }}</el-tag>
  222. <el-tooltip :content="row.receipt_msg">
  223. <el-icon
  224. v-if="row.report_type === 4"
  225. class="ml-10"
  226. @click="showReceipt(row.receipt_msg)"
  227. >
  228. <WarningFilled />
  229. </el-icon>
  230. </el-tooltip>
  231. </div>
  232. </template>
  233. </avue-crud>
  234. <!-- 新增-->
  235. <el-dialog
  236. v-model="showAdd"
  237. append-to-body
  238. center
  239. title="新增项目"
  240. width="35%"
  241. >
  242. <div v-loading="addLoading">
  243. <el-form
  244. ref="form"
  245. :model="projectForm"
  246. class="lab mt-20"
  247. label-width="100px"
  248. :rules="rules"
  249. >
  250. <div class="flex flex-center flex-col mr-20">
  251. <el-form-item class="full-width" label="项目名称" prop="name">
  252. <el-input
  253. v-model="projectForm.name"
  254. clearable
  255. placeholder="输入项目名称"
  256. />
  257. </el-form-item>
  258. <el-form-item
  259. class="full-width"
  260. label="项目总投"
  261. prop="totalAmount"
  262. >
  263. <el-input
  264. v-model="projectForm.totalAmount"
  265. clearable
  266. placeholder="输入项目总投(万元)"
  267. >
  268. <template #append>(万元)</template>
  269. </el-input>
  270. </el-form-item>
  271. <el-form-item class="full-width" label="项目标签" prop="tags">
  272. <el-select
  273. v-model="projectForm.tags"
  274. clearable
  275. placeholder="选择项目标签"
  276. style="width: 100%"
  277. >
  278. <el-option
  279. v-for="item in tagsList"
  280. :key="item.dictKey"
  281. :label="item.dictValue"
  282. :value="item.dictKey"
  283. />
  284. </el-select>
  285. </el-form-item>
  286. <el-form-item class="full-width" label="建设内容">
  287. <el-input
  288. v-model="projectForm.introduction"
  289. :rows="6"
  290. clearable
  291. placeholder="输入项目建设内容"
  292. type="textarea"
  293. />
  294. </el-form-item>
  295. <div class="flex flex-center mt-10">
  296. <base-button
  297. class="mr-20"
  298. icon="Close"
  299. title="取消"
  300. type="0"
  301. @click="showAdd = false"
  302. />
  303. <base-button icon="Check" title="保存" @click="projectSave" />
  304. </div>
  305. </div>
  306. </el-form>
  307. </div>
  308. </el-dialog>
  309. <form-dialog
  310. :dialogType="diaType"
  311. @close="formDialogClose"
  312. @export="exportExcel"
  313. :ids="selectList"
  314. />
  315. <summary-dialog
  316. :dialogType="diaType"
  317. @close="diaType = -1"
  318. :select-num="selectList.length === 0 ? page.total : selectList.length"
  319. @export="exportExcelTotal"
  320. />
  321. <el-dialog v-model="reportShow" width="500px" title="请选择上报时间">
  322. <div v-if="currentReport">
  323. <el-date-picker
  324. v-model="currentReport.report_time"
  325. format="YYYY-MM-DD"
  326. class="mb-20"
  327. placeholder="选择上报时间"
  328. style="width: 100%"
  329. value-format="YYYY-MM-DD"
  330. />
  331. </div>
  332. <div class="flex flex-center full-width flex-justify-end">
  333. <el-button @click="reportShow = false">取 消</el-button>
  334. <el-button @click="track(currentReport)">确 定</el-button>
  335. </div>
  336. </el-dialog>
  337. <!-- 项目审批-->
  338. <el-dialog v-model="showApproval" title="审核" width="500px">
  339. <div class="flex flex-justify-start flex-col">
  340. <div class="full-width flex flex-justify-start flex-align-center mb-20">
  341. <span>审核状态:</span>
  342. <el-radio-group v-model="approvalStatus">
  343. <el-radio :label="3">通过</el-radio>
  344. <el-radio :label="4">不通过</el-radio>
  345. </el-radio-group>
  346. </div>
  347. <el-input
  348. class="mt-20"
  349. type="textarea"
  350. :rows="5"
  351. v-model="approvalMsg"
  352. placeholder="请填写审批意见"
  353. />
  354. <div class="full-width flex flex-justify-end mt-20">
  355. <el-button plain type="primary" @click="showApproval = false"
  356. >取消
  357. </el-button>
  358. <el-button type="primary" @click="projectApproval">确定</el-button>
  359. </div>
  360. </div>
  361. </el-dialog>
  362. </div>
  363. </template>
  364. <script>
  365. import BaseButton from '../../../components/base-button.vue'
  366. import permissionStore from '@/store/permission.js'
  367. import formDialog from '@/views/home/component/form_dialog.vue'
  368. import { getLazyList } from '@/api/project/index.js'
  369. import summaryDialog from '@/views/home/component/summary_dialog.vue'
  370. import { useStore } from '@/store/user.js'
  371. import confing from '@/config/website'
  372. import { ElMessageBox } from 'element-plus'
  373. export default {
  374. name: 'dash',
  375. components: { BaseButton, formDialog, summaryDialog },
  376. setup() {
  377. const permissions = permissionStore()
  378. const user = useStore()
  379. return { permissions, user }
  380. },
  381. data() {
  382. return {
  383. showApproval: false,
  384. approvalMsg: '',
  385. approvalStatus: 3,
  386. reportTime: '',
  387. currentReport: null,
  388. reportShow: false,
  389. dialogLoading: false,
  390. disable: false,
  391. showAdd: false,
  392. active: 0,
  393. loading: false,
  394. addLoading: false,
  395. data: [],
  396. form: {},
  397. option: {
  398. menuBtnTitle: '操作',
  399. refreshBtn: false,
  400. tip: false,
  401. lazy: true,
  402. columnBtn: false,
  403. searchShow: true,
  404. selection: true,
  405. editBtn: true,
  406. editBtnText: '资料管理',
  407. editBtnIcon: 'Document',
  408. addBtn: false,
  409. delBtn: false,
  410. border: true,
  411. reserveSelection: true,
  412. align: 'center',
  413. viewBtn: true,
  414. viewBtnText: '详情',
  415. dialogClickModal: false,
  416. column: [
  417. {
  418. label: '项目名称',
  419. prop: 'name',
  420. addDisplay: false,
  421. editDisplay: false,
  422. fixed: true,
  423. minWidth: 200
  424. },
  425. {
  426. label: '项目情况',
  427. prop: 'project_stage',
  428. type: 'select',
  429. slot: true,
  430. width: 140,
  431. dicUrl:
  432. '/api/blade-system/dict-biz/dictionary?code=project-situation',
  433. props: {
  434. label: 'dictValue',
  435. value: 'dictKey'
  436. }
  437. },
  438. {
  439. label: '项目总投资(万元)',
  440. prop: 'total_amount',
  441. width: 120,
  442. type: 'number',
  443. precision: 2,
  444. formatter: (val, value, label) => {
  445. return val.total_amount.toLocaleString()
  446. }
  447. },
  448. {
  449. label: '责任单位',
  450. prop: 'responsible_unit'
  451. },
  452. {
  453. label: '子项目数量',
  454. prop: 'lot',
  455. width: 120,
  456. hide: true
  457. },
  458. {
  459. label: '是否入库',
  460. prop: 'is_storage',
  461. width: 120,
  462. dicData: [
  463. {
  464. label: '否',
  465. value: 0
  466. },
  467. {
  468. label: '是',
  469. value: 1
  470. }
  471. ]
  472. },
  473. {
  474. label: '计划(实际)入库时间',
  475. prop: 'plan_storage_time',
  476. width: 120,
  477. formatter: (val, value, label) => {
  478. return value.substring(0, 10)
  479. }
  480. },
  481. {
  482. label: '是否开工',
  483. prop: 'is_start',
  484. width: 120,
  485. dicData: [
  486. {
  487. label: '否',
  488. value: 0
  489. },
  490. {
  491. label: '是',
  492. value: 1
  493. }
  494. ]
  495. },
  496. {
  497. label: '计划(实际)开工时间',
  498. prop: 'plan_commencement_time',
  499. width: 120,
  500. formatter: (val, value, label) => {
  501. return value.substring(0, 10)
  502. }
  503. },
  504. {
  505. label: '上报时间',
  506. prop: 'report_time',
  507. width: 120
  508. },
  509. {
  510. label: '认定时间',
  511. prop: 'year',
  512. width: 120
  513. },
  514. {
  515. label: '预警提示',
  516. prop: 'tips',
  517. width: 100
  518. },
  519. {
  520. label: '项目状态',
  521. prop: 'report_type',
  522. width: 170,
  523. slot: true
  524. }
  525. ]
  526. },
  527. page: {
  528. size: 10,
  529. current: 1,
  530. total: 0
  531. },
  532. stage: [],
  533. numList: [],
  534. typeList: [],
  535. tagsList: [],
  536. num: '',
  537. projectForm: {
  538. name: '',
  539. totalAmount: '',
  540. projectType: '1589613582090166274',
  541. tags: '',
  542. introduction: ''
  543. },
  544. rules: {
  545. name: [{ required: true, message: '请输入项目名称', trigger: 'blur' }],
  546. projectType: [
  547. {
  548. required: true,
  549. message: '请选择项目类型',
  550. trigger: 'change'
  551. }
  552. ],
  553. tags: [
  554. {
  555. required: true,
  556. message: '请选择项目标签',
  557. trigger: 'change'
  558. }
  559. ]
  560. },
  561. diaType: -1,
  562. parentId: 0,
  563. queryData: null,
  564. owerQuery: {},
  565. projectStageQuery: {},
  566. selectList: [],
  567. dev: false,
  568. dataType: 'project'
  569. }
  570. },
  571. created() {
  572. this.dev = sessionStorage.getItem('dev') === 'true'
  573. const index = this.option.column.findIndex(sub => sub.prop === 'lot')
  574. const indexLabel = this.option.column.findIndex(
  575. sub => sub.prop === 'responsible_unit'
  576. )
  577. this.dataType = localStorage.getItem('data-type')
  578. if (this.user.info.viewStage === 1) {
  579. // 发改
  580. this.option.column[index].hide = true
  581. this.option.column[indexLabel].label = '责任单位'
  582. } else {
  583. this.option.column[index].hide = false
  584. this.option.column[indexLabel].label = '责任股(科)室'
  585. }
  586. this.$bus.on('serach', (res, type) => {
  587. this.owerQuery = res
  588. if (res.type === false) {
  589. this.projectStageQuery.projectStage = ''
  590. this.active = 0
  591. }
  592. this.onLoad(Object.assign(this.owerQuery, this.projectStageQuery))
  593. this.getNumList(Object.assign(this.owerQuery, this.projectStageQuery))
  594. })
  595. this.getTypeList()
  596. this.getNumList()
  597. console.log(this.permissions.vaildPermission('projectApprovalBtn'))
  598. },
  599. unmounted() {
  600. sessionStorage.removeItem('selectList')
  601. },
  602. methods: {
  603. switchTab(item, index) {
  604. this.active = index
  605. this.num = this.numList[index].totalAmount
  606. this.projectStageQuery = { projectStage: item.dictKey }
  607. this.onLoad(Object.assign(this.owerQuery, this.projectStageQuery))
  608. },
  609. onLoad(query = {}) {
  610. this.loading = true
  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.refreshChange()
  768. } else {
  769. this.$message.error(res.msg)
  770. }
  771. })
  772. },
  773. /**
  774. * 管理员已经审核通过的项目,上报到固定资产
  775. * @param res
  776. */
  777. projectReportFormal(item) {
  778. this.$confirm('确定上报到固定资产?').then(res => {
  779. if (res === 'confirm') {
  780. this.$api.project.reportToAssets({ ids: item.id }).then(res => {
  781. if (res.code === 200) {
  782. this.$message.success(res.msg)
  783. this.refreshChange()
  784. } else {
  785. this.$message.error(res.msg)
  786. }
  787. })
  788. }
  789. })
  790. },
  791. /**
  792. * 项目结转
  793. */
  794. projectCarry() {
  795. this.$api.project
  796. .projectCarry({ ids: this.selectList.join(',') })
  797. .then(res => {
  798. if (res.code === 200) {
  799. this.$message.success(res.msg)
  800. this.refreshChange()
  801. } else {
  802. this.$message.error(res.msg)
  803. }
  804. })
  805. },
  806. /**
  807. * 项目退库
  808. */
  809. projectCancel(res) {
  810. ElMessageBox.prompt('请输入退库原因', '提示', {}).then(({ value }) => {
  811. console.log(value)
  812. if (value === null || value.length === 0) {
  813. this.$message.error('请输入退库原因')
  814. return
  815. }
  816. this.$api.project
  817. .projectCancel({ id: res.id, exitMsg: value })
  818. .then(res => {
  819. if (res.code === 200) {
  820. this.$message.success(res.msg)
  821. this.refreshChange()
  822. } else {
  823. this.$message.error(res.msg)
  824. }
  825. })
  826. })
  827. },
  828. track(res) {
  829. const data = {
  830. id: res.id,
  831. is_report: 1,
  832. report_time: res.report_time
  833. }
  834. this.$api.project.proUpdate(data).then(res => {
  835. this.reportShow = false
  836. if (res.code === 200) {
  837. this.onLoad()
  838. this.$message.success(res.msg)
  839. } else {
  840. this.$message.error(res.msg)
  841. }
  842. })
  843. },
  844. projectSave() {
  845. if (this.disable) {
  846. this.$message.error('正在处理,请稍后...')
  847. return
  848. }
  849. this.$refs.form.validate(valid => {
  850. if (valid) {
  851. this.disable = true
  852. this.addLoading = true
  853. this.$api.project.projectAdd(this.projectForm).then(res => {
  854. this.disable = false
  855. this.addLoading = false
  856. if (res.code === 200) {
  857. this.showAdd = false
  858. this.$message.success(res.msg)
  859. this.onLoad()
  860. } else {
  861. this.showAdd = false
  862. this.$message.error(res.msg)
  863. }
  864. })
  865. }
  866. })
  867. },
  868. formDialogClose() {
  869. if (this.diaType === 0) {
  870. this.onLoad()
  871. }
  872. this.diaType = -1
  873. },
  874. exportExcel(res, year) {
  875. console.log(year)
  876. const data = Object.assign(
  877. { ...this.queryData },
  878. {
  879. columnName: res,
  880. projectIds: this.selectList.join(','),
  881. previewType: 1,
  882. year
  883. }
  884. )
  885. this.$router.push({ query: data, path: '/home/excel' })
  886. },
  887. showReceipt(msg) {
  888. this.$confirm(msg, {
  889. confirmButtonText: '确定',
  890. cancelButtonText: '取消',
  891. type: 'warning'
  892. })
  893. },
  894. exportExcelTotal(item) {
  895. const dataIds = {
  896. ...this.queryData,
  897. ...item,
  898. projectIds: this.selectList.join(','),
  899. previewType: 2
  900. }
  901. this.$router.push({ query: dataIds, path: '/home/excel' })
  902. }
  903. }
  904. }
  905. </script>
  906. <style lang="scss" scoped>
  907. .tip {
  908. width: 260px;
  909. height: 38px;
  910. background-color: #fbf6ed;
  911. font-weight: 500;
  912. flex-wrap: nowrap;
  913. margin-left: 20px;
  914. }
  915. .total-s {
  916. width: 200px;
  917. height: 50px;
  918. border: 1px solid #825618;
  919. border-radius: 10px;
  920. margin-right: 20px;
  921. box-shadow: 2px 2px 10px 2px rgba(113, 73, 39, 0.3);
  922. .sp {
  923. color: #ecab56;
  924. white-space: nowrap;
  925. margin-left: 20px;
  926. }
  927. .sp1 {
  928. color: #ecab56;
  929. margin-right: 20px;
  930. }
  931. }
  932. .total {
  933. width: 200px;
  934. height: 50px;
  935. border-radius: 10px;
  936. margin-right: 20px;
  937. background-color: #f0f2f7;
  938. .sp {
  939. color: #707070;
  940. white-space: nowrap;
  941. margin-left: 20px;
  942. }
  943. .sp1 {
  944. color: #825618;
  945. margin-right: 20px;
  946. }
  947. }
  948. .curd {
  949. :deep(.avue-crud__menu) {
  950. min-height: 10px;
  951. }
  952. }
  953. </style>