weicd
2023-01-18 95cd39d71cfb15489b7ce1819748e7522832a1f2
eladmin-web-master/src/views/project/projectType/index.vue
@@ -5,14 +5,6 @@
      <div v-if="crud.props.searchToggle">
        <!-- 搜索 -->
        <el-input v-model="query.name" clearable placeholder="请输入名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <el-select v-model="query.standardUnitCurrency" 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>
        <rrOperation />
      </div>
      <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
@@ -33,11 +25,16 @@
              />
            </el-select>
          </el-form-item>
          <el-form-item label="标准单价金额" prop="standardUnitPrice">
            <money-input :key="random" v-model="form.standardUnitPrice" :width="330" />
          <el-form-item label="标准报价单金" prop="standardQuotationPrice">
            <money-input :key="random" v-model="form.standardQuotationPrice" :width="330" />
          </el-form-item>
          <el-form-item label="标准利润金额" prop="standardProfitPrice">
            <money-input :key="random" v-model="form.standardProfitPrice" :width="330" />
          <el-form-item label="标准绩效单金" prop="standardPerformancePrice">
            <money-input :key="random" v-model="form.standardPerformancePrice" :width="330" />
          </el-form-item>
          <el-form-item label="标准绩效目标" prop="standardPerformanceObjectives">
            <el-input v-model="form.standardPerformanceObjectives" filterable placeholder="请输入绩效目标" style="width: 330px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="标准工作量单位" prop="standardWorkloadUnit">
            <el-select v-model="form.standardWorkloadUnit" filterable placeholder="请选择" style="width: 330px;">
@@ -67,14 +64,19 @@
            <el-tag>{{ dict.label[standardUnitCurrency][scope.row.standardUnitCurrency] }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="standardUnitPrice" label="标准单价金额">
        <el-table-column prop="standardQuotationPrice" label="标准报价单金">
          <template slot-scope="scope">
            {{ crud.toMoney(scope.row.standardUnitPrice) }}
            {{ crud.toMoney(scope.row.standardQuotationPrice) }}
          </template>
        </el-table-column>
        <el-table-column prop="standardProfitPrice" label="标准利润金额">
        <el-table-column prop="standardPerformancePrice" label="标准绩效单金">
          <template slot-scope="scope">
            {{ crud.toMoney(scope.row.standardProfitPrice) }}
            {{ crud.toMoney(scope.row.standardPerformancePrice) }}
          </template>
        </el-table-column>
        <el-table-column prop="standardPerformanceObjectives" label="标准绩效目标">
          <template slot-scope="scope">
            {{ scope.row.standardPerformanceObjectives }}%
          </template>
        </el-table-column>
        <el-table-column prop="standardWorkloadUnit" label="标准工作量单位">
@@ -109,7 +111,7 @@
import moneyInput from '../../assembly/moneyInput/index.vue'
import constant from '../../../utils/constant'
const defaultForm = { id: null, name: null, standardUnitCurrency: null, standardUnitPrice: null, standardProfitPrice: null, standardWorkloadUnit: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null }
const defaultForm = { id: null, name: null, standardUnitCurrency: null, standardQuotationPrice: null, standardPerformancePrice: null, standardPerformanceObjectives: null, standardWorkloadUnit: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null }
export default {
  name: 'ProjectType',
  components: { pagination, crudOperation, rrOperation, udOperation, moneyInput },
@@ -119,38 +121,47 @@
    return CRUD({ title: '项目类型', url: 'api/projectType', idField: 'id', sort: 'id,desc', crudMethod: { ...crudProjectType }})
  },
  data() {
    var checkStandardUnitPricet = (rule, value, callback) => {
    var checkStandardQuotationPrice = (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(new Error('标准单价金额不能为空'))
        callback(new Error('标准报价单金不能为空'))
      }
    }
    var checkStandardProfitPrice = (rule, value, callback) => {
    var checkStandardPerformancePrice = (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(new Error('标准利润金额不能为空'))
        callback(new Error('标准绩效单金不能为空'))
      }
    }
    // 比例(百内)验证
    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()
      }
    }
    return {
@@ -168,19 +179,21 @@
        standardUnitCurrency: [
          { required: true, message: '标准单价币种不能为空', trigger: 'blur' }
        ],
        standardUnitPrice: [
          { required: true, validator: checkStandardUnitPricet, trigger: 'blur' }
        standardQuotationPrice: [
          { required: true, validator: checkStandardQuotationPrice, trigger: 'blur' }
        ],
        standardProfitPrice: [
          { required: true, validator: checkStandardProfitPrice, trigger: 'blur' }
        standardPerformancePrice: [
          { required: true, validator: checkStandardPerformancePrice, trigger: 'blur' }
        ],
        standardPerformanceObjectives: [
          { required: true, validator: proportionValidate, trigger: 'blur' }
        ],
        standardWorkloadUnit: [
          { required: true, message: '标准工作量单位不能为空', trigger: 'blur' }
        ]
      },
      queryTypeOptions: [
        { key: 'name', display_name: '名称' },
        { key: 'standardUnitCurrency', display_name: '标准单价币种' }
        { key: 'name', display_name: '名称' }
      ],
      // 标准单价币种
      standardUnitCurrency: constant.STANDARD_UNIT_CURRENCY,