赵士淞
2023-01-19 a7d2699e22b685ffb8a8f521dd725a6fdfbdf3de
eladmin-web-master/src/views/project/projectProgress/index.vue
@@ -60,8 +60,18 @@
          <el-form-item label="周数" prop="belongWeek">
            <el-input v-model.number="form.belongWeek" style="width: 370px;" :disabled="disabled || crud.status.add !== 1" />
          </el-form-item>
          <el-form-item label="项目进度" prop="projectProgress">
          <el-form-item v-if="crud.status.add !== 1" label="本周预计" prop="lastedProgress">
            <el-input v-model="form.lastProjectProcess.estimatedProgress" style="width: 370px;" :disabled="true">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="本周实际" prop="projectProgress">
            <el-input v-model="form.projectProgress" style="width: 370px;" :disabled="disabled">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="下周预计" prop="estimatedProgress">
            <el-input v-model="form.estimatedProgress" style="width: 370px;" :disabled="disabled">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
@@ -94,14 +104,19 @@
            <el-tag>{{ scope.row.project.name }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column show-overflow-tooltip prop="lastedProgress" label="预计进度">
        <el-table-column show-overflow-tooltip prop="lastedProgress" label="本周预计">
          <template slot-scope="scope">
            {{ (scope.row.lastedProgress ? scope.row.lastedProgress : 0) + '%' }}
            {{ (scope.row.lastProjectProcess.estimatedProgress ? scope.row.lastProjectProcess.estimatedProgress : 0) + '%' }}
          </template>
        </el-table-column>
        <el-table-column show-overflow-tooltip prop="projectProgress" label="实际进度">
        <el-table-column show-overflow-tooltip prop="projectProgress" label="本周实际">
          <template slot-scope="scope">
            <span :style="{ color: scope.row.lastedProgress > scope.row.projectProgress ? 'red' : '' }">{{ (scope.row.projectProgress ? scope.row.projectProgress : 0) + '%' }}</span>
            <span :style="{ color: scope.row.lastedProgress > scope.row.projectProgress ? 'red' : '' }">{{ (scope.row.projectProgress ? scope.row.projectProgress + '%' : '') }}</span>
          </template>
        </el-table-column>
        <el-table-column show-overflow-tooltip prop="estimatedProgress" label="下周预计">
          <template slot-scope="scope">
            {{ (scope.row.estimatedProgress ? scope.row.estimatedProgress + '%' : '') }}
          </template>
        </el-table-column>
        <el-table-column show-overflow-tooltip prop="moneyTotalInit" label="计划总成本">
@@ -116,7 +131,11 @@
            ({{ scope.row.lastProjectProcess.moneyTotalCost != null && scope.row.lastProjectProcess.moneyTotalCost != '' ? crud.toMoney(scope.row.moneyTotalCost - scope.row.lastProjectProcess.moneyTotalCost) : 0 }})
          </template>
        </el-table-column>
        <el-table-column show-overflow-tooltip prop="realLastCost" label="本周消化工时" />
        <el-table-column show-overflow-tooltip prop="realLastCost" label="本周消化工时">
          <template slot-scope="scope">
            {{ scope.row.lastProjectProcess.realLastCost != null ? scope.row.realLastCost - scope.row.lastProjectProcess.realLastCost : 0 }}
          </template>
        </el-table-column>
        <el-table-column show-overflow-tooltip prop="workTotalInit" label="总工作量">
          <template slot-scope="scope">
            {{ scope.row.workTotalInit != null && scope.row.workTotalInit != '' ? crud.toMoney(scope.row.workTotalInit) : 0 }}
@@ -161,7 +180,7 @@
import pagination from '@crud/Pagination'
import constant from '../../../utils/constant'
const defaultForm = { id: null, project: { id: null }, belongYear: null, belongWeek: null, approveStatus: null, projectProgress: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null }
const defaultForm = { id: null, project: { id: null }, belongYear: null, belongWeek: null, approveStatus: null, projectProgress: null, estimatedProgress: null, lastProjectProcess: {}, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null }
export default {
  name: 'ProjectProgress',
  components: { pagination, crudOperation, rrOperation, udOperation },
@@ -181,7 +200,7 @@
    }
    // 周数(1~53)验证
    var weekValidate = (rule, value, callback) => {
      if (value != null && value !== '' && (isNaN(value) || !Number.isInteger(value) || Number(value) <= 1 || Number(value) >= 53)) {
      if (value != null && value !== '' && (isNaN(value) || !Number.isInteger(value) || Number(value) < 1 || Number(value) > 53)) {
        callback(new Error('请输入 1 到 53 以内的正整数'))
      } else {
        callback()
@@ -216,12 +235,15 @@
          { validator: weekValidate, trigger: 'blur' }
        ],
        projectProgress: [
          { required: true, message: '进度不能为空', trigger: 'blur' },
          { required: true, message: '本周实际不能为空', trigger: 'blur' },
          { validator: progressValidate, trigger: 'blur' }
        ],
        estimatedProgress: [
          { required: true, message: '下周预计不能为空', trigger: 'blur' },
          { validator: progressValidate, trigger: 'blur' }
        ],
        approveStatus: [
          { required: true, message: '进度不能为空', trigger: 'blur' },
          { validator: progressValidate, trigger: 'blur' }
          { required: true, message: '承认状态不能为空', trigger: 'blur' }
        ]
      },
      queryTypeOptions: [
@@ -312,15 +334,6 @@
        // 禁用状态
        this.disabled = false
      }
      this.rules['project.id'].forEach(element => {
        element.required = !(this.disabled || this.crud.status.add !== 1)
      })
      this.rules.projectProgress.forEach(element => {
        element.required = !(this.disabled)
      })
      this.rules.approveStatus.forEach(element => {
        element.required = !(this.disabled)
      })
    }
  }
}