dash.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. <template>
  2. <div class="full-height full-width flex flex-col">
  3. <div class="white-bg flex flex-col padding">
  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">项目总投资额<span
  9. class="main-color bold">{{ num ? Number.parseFloat(num).toLocaleString() :'-'}}</span>万元</span>
  10. </div>
  11. <div class="flex ml-20 hide-scrollbar" style="overflow-x: scroll;width: 86vw" v-show='stage && stage.length > 0'>
  12. <div v-for="(item,index) in stage" :key='item.id' :class="active === index ? 'total-s' : 'total'"
  13. class="flex flex-col flex-center mt-20 bold font-16 pointer" @click='switchTab(item,index)'
  14. >
  15. <span class=" sp">{{ item.name }}</span>
  16. <span class=" sp1 mt-5">{{ item.projectNumber }}<span class="grey font-14 ml-5">个</span></span>
  17. </div>
  18. </div>
  19. <base-button class="ml-20 mt-20" icon="Edit" title="项目导入"
  20. @click="showImport = true"/>
  21. <div v-if='permissions.permissions?.projectAdd' class='flex flex-center flex-justify-start'>
  22. <base-button class="ml-20 mt-20" icon="Plus" title="新增"
  23. @click="showAdd = true"/>
  24. </div>
  25. </div>
  26. <avue-crud ref="crud"
  27. v-model="form"
  28. v-model:page="page"
  29. :before-open="beforeOpen"
  30. :data="data"
  31. :option="option"
  32. :permission="permissionList"
  33. :table-loading="loading"
  34. class="curd"
  35. @row-del="rowDel"
  36. @current-change="currentChange"
  37. @size-change="sizeChange"
  38. @refresh-change="refreshChange"
  39. @on-load="onLoad">
  40. <!-- <template #menu="{row}">-->
  41. <!-- <el-button icon="Operation" text @click="track(row.id)">跟踪审计</el-button>-->
  42. <!-- </template>-->
  43. </avue-crud>
  44. <!-- 新增-->
  45. <el-dialog v-model="showAdd"
  46. append-to-body
  47. center
  48. title="新增项目"
  49. width="35%">
  50. <div>
  51. <el-form ref='form' :model="projectForm" class="lab mt-20" label-width="100px" :rules="rules">
  52. <div class="flex flex-center flex-col mr-20">
  53. <el-form-item class="full-width" label="项目名称" prop='name'>
  54. <el-input
  55. v-model="projectForm.name"
  56. clearable
  57. placeholder="输入项目名称"
  58. />
  59. </el-form-item>
  60. <el-form-item class="full-width" label="项目总投" prop='totalAmount'>
  61. <el-input
  62. v-model="projectForm.totalAmount"
  63. clearable
  64. placeholder="输入项目总投(万元)"
  65. >
  66. <template #append>(万元)</template>
  67. </el-input>
  68. </el-form-item>
  69. <el-form-item class="full-width" label="项目类型" prop='projectType'>
  70. <el-select
  71. v-model="projectForm.projectType"
  72. clearable
  73. placeholder="选择项目类型"
  74. style="width: 100%"
  75. >
  76. <el-option
  77. v-for="item in typeList"
  78. :key="item.id"
  79. :label="item.name"
  80. :value="item.id"
  81. />
  82. </el-select>
  83. </el-form-item>
  84. <el-form-item class="full-width" label="项目标签" prop='tags'>
  85. <el-select
  86. v-model="projectForm.tags"
  87. clearable
  88. placeholder="选择项目标签"
  89. style="width: 100%"
  90. >
  91. <el-option
  92. v-for="item in tagsList"
  93. :key="item.dictKey"
  94. :label="item.dictValue"
  95. :value="item.dictKey"
  96. />
  97. </el-select>
  98. </el-form-item>
  99. <el-form-item class="full-width" label="建设内容">
  100. <el-input
  101. v-model="projectForm.introduction"
  102. :rows="6"
  103. clearable
  104. placeholder="输入项目建设内容"
  105. type="textarea"
  106. />
  107. </el-form-item>
  108. <div class="flex flex-center mt-10">
  109. <base-button class="mr-20" icon="Close" title="取消" type="0" @click="showAdd = false"/>
  110. <base-button icon="Check" title="保存" @click="projectSave"/>
  111. </div>
  112. </div>
  113. </el-form>
  114. </div>
  115. </el-dialog>
  116. <!-- 导入-->
  117. <el-dialog v-model='showImport'
  118. append-to-body
  119. center
  120. title="项目导入"
  121. width="50%">
  122. <div class='flex flex-justify-start flex-align-center'>
  123. <span>模版下载:</span>
  124. <el-button type='primary' plain class='ml-20'>模 版</el-button>
  125. </div>
  126. <div class='flex flex-justify-start flex-align-center mt-20'>
  127. <upload-file type='primary' max='1'
  128. @close='showImport = false'
  129. accept='.xls,.xlsx'
  130. :data='{isCovered:0}'
  131. action='/api/blade-project-manage/project/import-project'
  132. @success='success'>确 定</upload-file>
  133. </div>
  134. <el-divider/>
  135. </el-dialog>
  136. </div>
  137. </template>
  138. <script>
  139. import BaseButton from '../../../components/base-button.vue'
  140. import permissionStore from '@/store/permission.js'
  141. import { vaildData } from '@/utils/tools.js'
  142. import uploadFile from '@/components/upload-file.vue'
  143. export default {
  144. name: 'dash',
  145. components: { BaseButton, uploadFile },
  146. setup () {
  147. const permissions = permissionStore()
  148. return { permissions }
  149. },
  150. data () {
  151. return {
  152. disable: false,
  153. showAdd: false,
  154. showImport: false,
  155. active: 0,
  156. loading: false,
  157. data: [],
  158. form: {},
  159. option: {
  160. refreshBtn: false,
  161. tip: false,
  162. columnBtn: false,
  163. searchShow: true,
  164. editBtn: true,
  165. editBtnText: '跟踪审计',
  166. editBtnIcon: 'Operation',
  167. addBtn: false,
  168. delBtn: true,
  169. border: true,
  170. index: true,
  171. align: 'center',
  172. viewBtn: true,
  173. menuWidth: 320,
  174. dialogClickModal: false,
  175. column: [
  176. {
  177. label: '项目名称',
  178. prop: 'name',
  179. addDisplay: false,
  180. editDisplay: false,
  181. width: 400
  182. },
  183. {
  184. label: '项目总投资(万元)',
  185. prop: 'totalAmount',
  186. width: 120,
  187. type: 'number',
  188. precision: 2,
  189. formatter: (val, value, label) => {
  190. return val.totalAmount.toLocaleString()
  191. }
  192. },
  193. {
  194. label: '所属机构',
  195. prop: 'implementingAgency',
  196. width: 240
  197. },
  198. {
  199. label: '项目类型',
  200. prop: 'projectTypeName',
  201. type: 'select',
  202. width: 180,
  203. dicUrl: '/api/blade-system/dict-biz/dictionary?code=project-tags',
  204. props: {
  205. label: 'dictValue',
  206. value: 'dictKey'
  207. }
  208. },
  209. {
  210. label: '项目领域',
  211. prop: 'dictName',
  212. width: 200
  213. },
  214. {
  215. label: '发债时间',
  216. prop: 'issueDate',
  217. type: 'month',
  218. width: 100,
  219. format: 'YYYY-MM',
  220. valueFormat: 'YYYY-MM'
  221. },
  222. {
  223. label: '更新时间',
  224. prop: 'updateTime',
  225. type: 'month',
  226. width: 120,
  227. format: 'YYYY-MM-DD',
  228. valueFormat: 'YYYY-MM-DD'
  229. }]
  230. },
  231. page: {
  232. size: 10,
  233. current: 1,
  234. total: 0
  235. },
  236. stage: [],
  237. typeList: [],
  238. tagsList: [],
  239. num: '',
  240. projectForm: {
  241. name: '',
  242. totalAmount: '',
  243. projectType: '',
  244. tags: '',
  245. introduction: ''
  246. },
  247. rules: {
  248. name: [
  249. { required: true, message: '请输入项目名称', trigger: 'blur' }
  250. ],
  251. projectType: [
  252. {
  253. required: true,
  254. message: '请选择项目类型',
  255. trigger: 'change'
  256. }
  257. ],
  258. tags: [
  259. {
  260. required: true,
  261. message: '请选择项目标签',
  262. trigger: 'change'
  263. }
  264. ]
  265. }
  266. }
  267. },
  268. created () {
  269. this.getTypeList()
  270. this.$bus.on('serach', (res) => {
  271. this.onLoad(res)
  272. })
  273. },
  274. computed: {
  275. permissionList () {
  276. return {
  277. delBtn: vaildData(this.permissions.permissions.home_del, false)
  278. }
  279. }
  280. },
  281. methods: {
  282. switchTab (item, index) {
  283. this.active = index
  284. this.onLoad({ stageId: item.id === -1 ? '' : item.id })
  285. },
  286. onLoad (query = {}) {
  287. this.loading = true
  288. const data = { ...query }
  289. console.log(data)
  290. this.$api.project.projectList(this.page.currentPage, this.page.pageSize, data).then(res => {
  291. this.loading = false
  292. if (res.code === 200) {
  293. this.data = res.data.content
  294. this.num = res.msg
  295. this.page.total = res.data.totalElements
  296. this.loading = false
  297. }
  298. this.getStageList()
  299. })
  300. },
  301. beforeOpen (done, type) {
  302. if (['view'].includes(type)) {
  303. this.$router.push({
  304. path: '/home/details',
  305. query: { id: this.form.id, type: '0', ownerId: this.form.createUser }
  306. })
  307. } else if (type === 'edit') {
  308. this.$alert('功能建设中,尽情期待...', '消息提醒', {
  309. confirmButtonText: 'OK'
  310. })
  311. // this.$router.push({
  312. // path: '/home/details',
  313. // query: { id: this.form.id, type: '1' }
  314. // })
  315. }
  316. },
  317. currentChange (currentPage) {
  318. this.page.current = currentPage
  319. },
  320. sizeChange (pageSize) {
  321. this.page.size = pageSize
  322. },
  323. refreshChange () {
  324. this.onLoad()
  325. },
  326. rowDel (row) {
  327. this.$confirm('确定删除选择的项目?', {
  328. confirmButtonText: '确定',
  329. cancelButtonText: '取消',
  330. type: 'warning'
  331. })
  332. .then(() => {
  333. this.$api.project.projectRemove({ ids: row.id }).then(res => {
  334. if (res.code === 200) {
  335. this.$message.success(res.msg)
  336. this.onLoad()
  337. } else {
  338. this.$message.error(res.msg)
  339. }
  340. })
  341. })
  342. },
  343. getStageList () {
  344. this.$api.project.userStageList().then(res => {
  345. if (res.code === 200) {
  346. this.stage = res.data
  347. }
  348. })
  349. },
  350. getTypeList () {
  351. this.$api.project.typeList().then(res => {
  352. this.typeList = res.data.records
  353. })
  354. this.$api.common.dicList({ code: 'project-tags' }).then(res => {
  355. if (res.code === 200) {
  356. this.tagsList = res.data
  357. }
  358. })
  359. },
  360. projectSave () {
  361. if (this.disable) {
  362. this.$message.error('正在处理,请稍后...')
  363. return
  364. }
  365. this.$refs.form.validate((valid) => {
  366. if (valid) {
  367. this.disable = true
  368. this.$api.project.projectAdd(this.projectForm).then(res => {
  369. this.disable = false
  370. if (res.code === 200) {
  371. this.showAdd = false
  372. this.$message.success(res.msg)
  373. this.onLoad()
  374. } else {
  375. this.showAdd = false
  376. this.$message.error(res.msg)
  377. }
  378. })
  379. }
  380. })
  381. },
  382. success (res) {
  383. this.showImport = false
  384. this.$message.success('上传成功')
  385. this.onLoad()
  386. }
  387. }
  388. }
  389. </script>
  390. <style lang="scss" scoped>
  391. .tip {
  392. width: 260px;
  393. height: 38px;
  394. background-color: #FBF6ED;
  395. font-weight: 500;
  396. flex-wrap: nowrap;
  397. margin-left: 20px;
  398. }
  399. .total-s {
  400. width: 220px;
  401. height: 70px;
  402. border: 1px solid #825618;
  403. border-radius: 10px;
  404. margin-right: 20px;
  405. box-shadow: 2px 2px 10px 2px rgba(113, 73, 39, 0.3);
  406. .sp {
  407. color: #ECAB56;
  408. white-space: nowrap;
  409. }
  410. .sp1 {
  411. color: #ECAB56;
  412. }
  413. }
  414. .total {
  415. width: 220px;
  416. height: 70px;
  417. border-radius: 10px;
  418. margin-right: 20px;
  419. background-color: #F0F2F7;
  420. .sp {
  421. color: #707070;
  422. white-space: nowrap;
  423. margin-right: 20px;
  424. }
  425. .sp1 {
  426. color: #825618;
  427. }
  428. }
  429. .curd {
  430. :deep(.avue-crud__menu) {
  431. min-height: 10px;
  432. }
  433. }
  434. </style>