baseInfo.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <div class="contrl">
  3. <el-form ref="baseInfo" :model="baseInfo" label-width="auto" style="margin-top: 10px;" :rules="baseInfoRules">
  4. <el-divider content-position="left"><span style="color:#ff6154;">基本信息</span></el-divider>
  5. <el-row :gutter="10">
  6. <el-col :span="12">
  7. <el-form-item label="测算名:" class="form-item" prop="calculateName">
  8. <el-input v-model="baseInfo.calculateName" clearable style="width: 100%;" />
  9. </el-form-item>
  10. </el-col>
  11. </el-row>
  12. <el-row :gutter="10">
  13. <el-col :span="12">
  14. <el-form-item label="评估基准日:" class="form-item" prop="valuationBasisDate">
  15. <el-date-picker v-model="baseInfo.valuationBasisDate" type="date" placeholder="选择评估基准日"
  16. style="width: 100%;" />
  17. </el-form-item>
  18. </el-col>
  19. </el-row>
  20. <el-button plain type="danger" style="float: right;" @click="createCalculate()">
  21. 下一步
  22. <el-icon style="vertical-align: -20%;">
  23. <ArrowRightBold />
  24. </el-icon>
  25. </el-button>
  26. </el-form>
  27. </div>
  28. </template>
  29. <script>
  30. import { mapStores } from 'pinia'
  31. import { assetsProjectInfo } from '@/stores/assetsProjectStore';
  32. import { createAssetsCalculate, getUnFinishedCalculateProgress } from '@/api/assetsCalculate';
  33. export default {
  34. data() {
  35. return {
  36. baseInfo: {
  37. },
  38. baseInfoRules: {
  39. calculateName: [
  40. { required: true, message: '请输入测算表名', trigger: 'blur' }
  41. ],
  42. valuationBasisDate: [
  43. { required: true, message: '请选择评估基准日', trigger: 'blur' }
  44. ]
  45. }
  46. }
  47. },
  48. computed: {
  49. ...mapStores(assetsProjectInfo),
  50. },
  51. created() {
  52. if (this.projectStore.calculateProgress) {
  53. this.baseInfo.id = this.projectStore.calculateProgress.id;
  54. this.baseInfo.projectId = this.projectStore.projectInfo.id;
  55. this.baseInfo.calculateName = this.projectStore.calculateProgress.calculateName;
  56. this.baseInfo.valuationBasisDate = this.projectStore.calculateProgress.valuationBasisDate;
  57. }
  58. },
  59. methods: {
  60. // 创建测算表,填写测算表基础信息
  61. createCalculate() {
  62. this.$refs.baseInfo.validate((valid) => {
  63. if (valid) {
  64. if (!this.projectStore.calculateProgress.id) {
  65. this.baseInfo.progress = 'BASE';
  66. }
  67. this.baseInfo.projectId = this.projectStore.projectInfo.id;
  68. createAssetsCalculate(this.baseInfo).then(res => {
  69. if (res.code == 200) {
  70. ElMessage({
  71. showClose: true,
  72. message: res.message,
  73. type: 'success'
  74. })
  75. this.$router.push('/home/assets/workbench/calculate/eqptBaseInfo')
  76. this.getCalculateProgress();
  77. }
  78. })
  79. }
  80. })
  81. },
  82. // 获取未完成测算表的进度信息并保存到缓存
  83. getCalculateProgress() {
  84. getUnFinishedCalculateProgress(this.projectStore.projectInfo.id).then(res => {
  85. if (res.data) {
  86. this.projectStore.setCalculateProgress(res.data);
  87. }
  88. })
  89. }
  90. }
  91. }
  92. </script>
  93. <style scoped>
  94. .contrl {
  95. font-size: 20px;
  96. width: 75%;
  97. border-right: 1.5px #dae1eb solid;
  98. padding: 20px 20px 20px 0px;
  99. float: left;
  100. }
  101. :deep(*) {
  102. color-scheme: light;
  103. --el-color-primary: #ff6154;
  104. --el-color-primary-light-3: #ff7154;
  105. --el-color-primary-light-5: #ff8154;
  106. --el-color-primary-light-7: #ff9154;
  107. --el-color-primary-light-8: #ffa999;
  108. --el-color-primary-light-9: #ffa854;
  109. --el-color-primary-dark-2: #ff8154;
  110. }
  111. </style>