dash.vue 9.1 KB

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