baseInfo.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. this.baseInfo.progress = 'BASE';
  65. this.baseInfo.projectId = this.projectStore.projectInfo.id;
  66. createAssetsCalculate(this.baseInfo).then(res => {
  67. if (res.code == 200) {
  68. ElMessage({
  69. showClose: true,
  70. message: res.message,
  71. type: 'success'
  72. })
  73. this.$router.push('/home/assets/workbench/calculate/eqptBaseInfo')
  74. this.getCalculateProgress();
  75. }
  76. })
  77. }
  78. })
  79. },
  80. // 获取未完成测算表的进度信息并保存到缓存
  81. getCalculateProgress() {
  82. getUnFinishedCalculateProgress(this.projectStore.projectInfo.id).then(res => {
  83. if (res.data) {
  84. this.projectStore.setCalculateProgress(res.data);
  85. }
  86. })
  87. }
  88. }
  89. }
  90. </script>
  91. <style scoped>
  92. .contrl {
  93. font-size: 20px;
  94. width: 75%;
  95. border-right: 1.5px #dae1eb solid;
  96. padding: 20px 20px 20px 0px;
  97. float: left;
  98. }
  99. :deep(*) {
  100. color-scheme: light;
  101. --el-color-primary: #ff6154;
  102. --el-color-primary-light-3: #ff7154;
  103. --el-color-primary-light-5: #ff8154;
  104. --el-color-primary-light-7: #ff9154;
  105. --el-color-primary-light-8: #ffa999;
  106. --el-color-primary-light-9: #ffa854;
  107. --el-color-primary-dark-2: #ff8154;
  108. }
  109. </style>