dash.vue 11 KB

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