dash.vue 8.7 KB

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