dash.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441
  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. <div v-if='permissions.permissions?.projectAdd' class='flex flex-center flex-justify-start'>
  20. <base-button class="ml-20 mt-20" icon="Plus" title="新增"
  21. @click="showAdd = true"/>
  22. <base-button class="ml-20 mt-20" icon="Edit" title="项目导入"
  23. @click="showImport = 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 v-loading='addLoading'>
  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. addLoading: false,
  158. data: [],
  159. form: {},
  160. option: {
  161. refreshBtn: false,
  162. tip: false,
  163. columnBtn: false,
  164. searchShow: true,
  165. editBtn: true,
  166. editBtnText: '跟踪审计',
  167. editBtnIcon: 'Operation',
  168. addBtn: false,
  169. delBtn: true,
  170. border: true,
  171. index: true,
  172. align: 'center',
  173. viewBtn: true,
  174. menuWidth: 320,
  175. dialogClickModal: false,
  176. column: [
  177. {
  178. label: '项目名称',
  179. prop: 'name',
  180. addDisplay: false,
  181. editDisplay: false
  182. },
  183. {
  184. label: '项目总投资(万元)',
  185. prop: 'totalAmount',
  186. width: 180,
  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. },
  197. {
  198. label: '项目类型',
  199. prop: 'projectTypeName',
  200. type: 'select',
  201. width: 180,
  202. dicUrl: '/api/blade-system/dict-biz/dictionary?code=project-tags',
  203. props: {
  204. label: 'dictValue',
  205. value: 'dictKey'
  206. }
  207. },
  208. {
  209. label: '项目领域',
  210. prop: 'dictName',
  211. width: 200
  212. },
  213. {
  214. label: '发债时间',
  215. prop: 'issueDate',
  216. type: 'month',
  217. width: 120
  218. },
  219. {
  220. label: '更新时间',
  221. prop: 'updateTime',
  222. type: 'month',
  223. width: 120
  224. }]
  225. },
  226. page: {
  227. size: 10,
  228. current: 1,
  229. total: 0
  230. },
  231. stage: [],
  232. typeList: [],
  233. tagsList: [],
  234. num: '',
  235. projectForm: {
  236. name: '',
  237. totalAmount: '',
  238. projectType: '',
  239. tags: '',
  240. introduction: ''
  241. },
  242. rules: {
  243. name: [
  244. { required: true, message: '请输入项目名称', trigger: 'blur' }
  245. ],
  246. projectType: [
  247. {
  248. required: true,
  249. message: '请选择项目类型',
  250. trigger: 'change'
  251. }
  252. ],
  253. tags: [
  254. {
  255. required: true,
  256. message: '请选择项目标签',
  257. trigger: 'change'
  258. }
  259. ]
  260. }
  261. }
  262. },
  263. created () {
  264. this.getTypeList()
  265. this.$bus.on('serach', (res) => {
  266. this.onLoad(res)
  267. })
  268. },
  269. computed: {
  270. permissionList () {
  271. return {
  272. delBtn: vaildData(this.permissions.permissions.home_del, false)
  273. }
  274. }
  275. },
  276. methods: {
  277. switchTab (item, index) {
  278. this.active = index
  279. this.onLoad({ stageId: item.id === -1 ? '' : item.id })
  280. },
  281. onLoad (query = {}) {
  282. this.loading = true
  283. const data = { ...query }
  284. this.$api.project.projectList(this.page.currentPage, this.page.pageSize, data).then(res => {
  285. this.loading = false
  286. if (res.code === 200) {
  287. this.data = res.data.records
  288. this.num = res.msg
  289. this.page.total = res.data.total
  290. this.loading = false
  291. }
  292. this.getStageList()
  293. })
  294. },
  295. beforeOpen (done, type) {
  296. if (['view'].includes(type)) {
  297. this.$router.push({
  298. path: '/home/details',
  299. query: { id: this.form.id, type: '0', ownerId: this.form.createUser }
  300. })
  301. } else if (type === 'edit') {
  302. this.$alert('功能建设中,尽情期待...', '消息提醒', {
  303. confirmButtonText: 'OK'
  304. })
  305. // this.$router.push({
  306. // path: '/home/details',
  307. // query: { id: this.form.id, type: '1' }
  308. // })
  309. }
  310. },
  311. currentChange (currentPage) {
  312. this.page.current = currentPage
  313. },
  314. sizeChange (pageSize) {
  315. this.page.size = pageSize
  316. },
  317. refreshChange () {
  318. this.onLoad()
  319. },
  320. rowDel (row) {
  321. this.$confirm('确定删除选择的项目?', {
  322. confirmButtonText: '确定',
  323. cancelButtonText: '取消',
  324. type: 'warning'
  325. })
  326. .then(() => {
  327. this.$api.project.projectRemove({ ids: row.id }).then(res => {
  328. if (res.code === 200) {
  329. this.$message.success(res.msg)
  330. this.onLoad()
  331. } else {
  332. this.$message.error(res.msg)
  333. }
  334. })
  335. })
  336. },
  337. getStageList () {
  338. this.$api.project.userStageList().then(res => {
  339. if (res.code === 200) {
  340. this.stage = res.data
  341. }
  342. })
  343. },
  344. getTypeList () {
  345. this.$api.project.typeList({ type: 1, size: 999, current: 1 }).then(res => {
  346. this.typeList = res.data.records
  347. })
  348. this.$api.common.dicList({ code: 'project-tags' }).then(res => {
  349. if (res.code === 200) {
  350. this.tagsList = res.data
  351. }
  352. })
  353. },
  354. projectSave () {
  355. if (this.disable) {
  356. this.$message.error('正在处理,请稍后...')
  357. return
  358. }
  359. this.$refs.form.validate((valid) => {
  360. if (valid) {
  361. this.disable = true
  362. this.addLoading = true
  363. this.$api.project.projectAdd(this.projectForm).then(res => {
  364. this.disable = false
  365. this.addLoading = false
  366. if (res.code === 200) {
  367. this.showAdd = false
  368. this.$message.success(res.msg)
  369. this.onLoad()
  370. } else {
  371. this.showAdd = false
  372. this.$message.error(res.msg)
  373. }
  374. })
  375. }
  376. })
  377. },
  378. success (res) {
  379. this.showImport = false
  380. this.$message.success('上传成功')
  381. this.onLoad()
  382. }
  383. }
  384. }
  385. </script>
  386. <style lang="scss" scoped>
  387. .tip {
  388. width: 260px;
  389. height: 38px;
  390. background-color: #FBF6ED;
  391. font-weight: 500;
  392. flex-wrap: nowrap;
  393. margin-left: 20px;
  394. }
  395. .total-s {
  396. width: 220px;
  397. height: 70px;
  398. border: 1px solid #825618;
  399. border-radius: 10px;
  400. margin-right: 20px;
  401. box-shadow: 2px 2px 10px 2px rgba(113, 73, 39, 0.3);
  402. .sp {
  403. color: #ECAB56;
  404. white-space: nowrap;
  405. }
  406. .sp1 {
  407. color: #ECAB56;
  408. }
  409. }
  410. .total {
  411. width: 220px;
  412. height: 70px;
  413. border-radius: 10px;
  414. margin-right: 20px;
  415. background-color: #F0F2F7;
  416. .sp {
  417. color: #707070;
  418. white-space: nowrap;
  419. margin-right: 20px;
  420. }
  421. .sp1 {
  422. color: #825618;
  423. }
  424. }
  425. .curd {
  426. :deep(.avue-crud__menu) {
  427. min-height: 10px;
  428. }
  429. }
  430. </style>