yaozc
2023-01-17 5df93a0bf12bfc95d9f3c4a67067fd2852603d02
eladmin-web-master/src/views/project/project/index.vue
@@ -13,14 +13,6 @@
            :value="item.id"
          />
        </el-select>
        <el-select v-model="query.unitCurrency" clearable filterable placeholder="请选择单价币种" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in dict[standardUnitCurrency]"
            :key="item.id"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
        <el-select v-model="query.liableUserId" clearable filterable placeholder="请选择责任人" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in userList"
@@ -32,14 +24,6 @@
        <el-select v-model="query.projectStatus" clearable filterable placeholder="请选择项目状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in dict[projectStatus]"
            :key="item.id"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
        <el-select v-model="query.approveStatus" clearable filterable placeholder="请选择批准状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in dict[approveStatus]"
            :key="item.id"
            :label="item.label"
            :value="item.value"
@@ -183,21 +167,31 @@
            </el-tooltip>
          </template>
        </el-table-column>
        <el-table-column prop="performancePrice" label="预算金额" width="120">
        <el-table-column prop="performancePrice" label="绩效金额" width="120">
          <template slot-scope="scope">
            <el-tooltip class="item" effect="dark" :content="scope.row.performancePrice + ' * ' + scope.row.totalTaskTime" placement="top">
              <span>{{ scope.row.performancePrice != null && scope.row.performancePrice != '' ? crud.toMoney(scope.row.performancePrice * scope.row.totalTaskTime) : 0 }}</span>
            </el-tooltip>
          </template>
        </el-table-column>
        <el-table-column prop="totalLaborCost" label="人力成本预算" width="120">
        <el-table-column prop="totalLaborCost" label="项目成本" align="center" width="120">
          <template slot-scope="scope">
            {{ scope.row.totalLaborCost != null && scope.row.totalLaborCost != '' ? crud.toMoney(scope.row.totalLaborCost) : '' }}
            <el-tag v-if="scope.row.performancePrice * scope.row.totalTaskTime < scope.row.totalLaborCost" type="danger">
              {{ scope.row.totalLaborCost != null && scope.row.totalLaborCost != '' ? crud.toMoney(scope.row.totalLaborCost) : '' }}
            </el-tag>
            <span v-else>
              {{ scope.row.totalLaborCost != null && scope.row.totalLaborCost != '' ? crud.toMoney(scope.row.totalLaborCost) : '' }}
            </span>
          </template>
        </el-table-column>
        <el-table-column prop="performanceObjectives" label="绩效目标" width="120">
        <el-table-column prop="performanceObjectives" label="绩效目标" align="center" width="120">
          <template slot-scope="scope">
            {{ (scope.row.performanceObjectives ? scope.row.performanceObjectives : 0) + '%' }}
            <el-tag v-if="scope.row.performancePrice * scope.row.totalTaskTime * (1 - scope.row.performanceObjectives / 100) < scope.row.totalLaborCost" type="warning">
              {{ (scope.row.performanceObjectives ? scope.row.performanceObjectives : 0) + '%' }}
            </el-tag>
            <span v-else>
              {{ (scope.row.performanceObjectives ? scope.row.performanceObjectives : 0) + '%' }}
            </span>
          </template>
        </el-table-column>
        <el-table-column prop="liableUserName" label="责任人" width="80">
@@ -279,15 +273,15 @@
    return CRUD({ title: '项目', url: 'api/project', idField: 'id', sort: 'id,desc', crudMethod: { ...crudProject }})
  },
  data() {
    var checkUnitPrice = (rule, value, callback) => {
    var quotationPrice = (rule, value, callback) => {
      if (value !== null) {
        if (isNaN(Number(value))) {
          callback(new Error('单价金额必须是数字'))
          callback(new Error('报价单金必须是数字'))
        } else {
          if (value <= 0) {
            callback(new Error('单价金额必须大于0'))
            callback(new Error('报价单金必须大于0'))
          } else if (value >= 10000000000) {
            callback(new Error('单价金额必须小于1百亿'))
            callback(new Error('报价单金必须小于1百亿'))
          } else {
            callback()
          }
@@ -296,19 +290,28 @@
        callback(new Error('单价金额不能为空'))
      }
    }
    var checkTotalPrice = (rule, value, callback) => {
    var performancePrice = (rule, value, callback) => {
      if (value !== null) {
        if (isNaN(Number(value))) {
          callback(new Error('报价金额必须是数字'))
          callback(new Error('绩效单金必须是数字'))
        } else {
          if (value < 0) {
            callback(new Error('报价金额必须大于0'))
            callback(new Error('绩效单金必须大于0'))
          } else if (value >= 10000000000) {
            callback(new Error('报价金额必须小于1百亿'))
            callback(new Error('绩效单金必须小于1百亿'))
          } else {
            callback()
          }
        }
      } else {
        callback()
      }
    }
    // 比例(百内)验证
    var proportionValidate = (rule, value, callback) => {
      const reg = /^([0-9]|[1-9]\d)(\.\d{1,2})?$|100$/
      if (value != null && value !== '' && !reg.test(value)) {
        callback(new Error('请输入 一百 以内的正整数或两位小数'))
      } else {
        callback()
      }
@@ -336,10 +339,13 @@
          { required: true, message: '单价币种不能为空', trigger: 'change' }
        ],
        quotationPrice: [
          { required: true, validator: checkUnitPrice, trigger: 'blur' }
          { required: true, validator: quotationPrice, trigger: 'blur' }
        ],
        contractPrice: [
          { validator: checkTotalPrice, trigger: 'blur' }
        performancePrice: [
          { required: true, validator: performancePrice, trigger: 'blur' }
        ],
        performanceObjectives: [
          { required: true, validator: proportionValidate, trigger: 'blur' }
        ],
        projectStatus: [
          { required: true, message: '项目状态不能为空', trigger: 'change' }
@@ -428,9 +434,11 @@
        // 单价币种赋值
        this.form.unitCurrency = res[0].standardUnitCurrency
        // 单价金额赋值
        this.form.quotationPrice = res[0].standardUnitPrice
        this.form.quotationPrice = res[0].standardQuotationPrice
        // 单价金额赋值
        this.form.performancePrice = res[0].standardProfitPrice
        this.form.performancePrice = res[0].standardPerformancePrice
        //
        this.form.performanceObjectives = res[0].standardPerformanceObjectives
        this.random = Math.random()
      })
    },