实训案例管理 新增字段4个初始资金 修改

master
CherrysChang 5 years ago
parent 969e592cb0
commit a969899286
  1. 73
      src/views/train/case-detail.vue

@ -1,20 +1,58 @@
<template>
<div class="caseInputForm">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" class="demo-form-inline" label-width="90px">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" class="demo-form-inline" label-width="150px">
<el-card class="box-card">
<div slot="header">
<span class="item-title-font"><i class="el-icon-minus icon-minus-rotated"></i>实训信息</span>
<el-button type="primary" style="float: right;" size="medium" @click="goBackList">返回</el-button>
</div>
<el-row :gutter="2" type="flex">
<el-col :span="12">
<el-form-item label="实训名称" prop="name">
<el-input v-model.trim="dataForm.name" :disabled="formAction==2" placeholder="实训名称" style="width: 360px;"></el-input>
<el-input v-model.trim="dataForm.name" :disabled="formAction==2" placeholder="实训名称" maxlength="30" style="max-width: 360px;"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="实训用途" prop="type">
<el-select v-model="dataForm.type" placeholder="实训用途" :disabled="formAction==2" style="width: 360px;">
<el-select v-model="dataForm.type" placeholder="实训用途" :disabled="formAction==2" style="max-width: 360px;width: 100%">
<el-option label="考核" value="1"></el-option>
<el-option label="练习" value="2"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="2" type="flex">
<el-col :span="12">
<el-form-item label="微信账户初始资金" prop="wechatInitMoney">
<el-input v-model.trim="dataForm.wechatInitMoney" :disabled="formAction==2" placeholder="微信账户初始资金" maxlength="12" style="max-width: 360px;">
<i slot="suffix"></i>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="支付宝账户初始资金" prop="alipayInitMoney">
<el-input v-model.trim="dataForm.alipayInitMoney" :disabled="formAction==2" placeholder="支付宝账户初始资金" style="max-width: 360px;">
<i slot="suffix"></i>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="2" type="flex">
<el-col :span="12">
<el-form-item label="银行卡账户初始资金" prop="bankcardInitMoney">
<el-input v-model.trim="dataForm.bankcardInitMoney" :disabled="formAction==2" placeholder="银行卡账户初始资金" style="max-width: 360px;">
<i slot="suffix"></i>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="数字钱包初始资产">
<el-input v-model.trim="dataForm.digitwalletInitMoney" :disabled="true" placeholder="数字钱包初始资产" style="max-width: 360px;">
<i slot="suffix"></i>
</el-input>
</el-form-item>
</el-col>
</el-row>
</el-card>
<el-card class="box-card">
<div slot="header">
@ -51,7 +89,7 @@
<el-form-item :prop="'taskList.'+scope.$index+'.taskOperate'" :rules="dataRule.taskOperate" class="score-input" >
<el-select v-model="scope.row.taskOperate" size="small" :disabled="formAction == 2" style="width: 100px;">
<el-option label="大于" value="1"></el-option>
<el-option label="小于" value="2"></el-option>
<el-option label="小于" value="-1"></el-option>
</el-select>
</el-form-item>
</el-col>
@ -118,12 +156,27 @@
callback();
}
};
var validateMoney = (rule, value, callback) => {
if (!value) {
callback(new Error('请输入初始资金'));
} else if (!(/^[0-9]\d{0,8}(\.\d{1,2})?$/.test(value))) {
callback(new Error('请输入整数位最多9位,小数位最多2位的数字'));
} else if (value <= 0) {
callback(new Error('请输入大于0的数字'));
} else {
callback();
}
};
return {
formAction: 0, // 0add,1:edit,2:view
dataForm: {
id: '',
type: '',
name: '',
wechatInitMoney: '',
alipayInitMoney: '',
bankcardInitMoney: '',
digitwalletInitMoney: 0,
taskList: [],
isAdmin: 1, //
},
@ -136,6 +189,18 @@
type: [
{ required: true, message: '请选择实训用途', trigger: 'change' }
],
wechatInitMoney: [
{ required: true, message: '请输入初始资金', trigger: 'change' },
{validator: validateMoney, trigger: 'blur'}
],
alipayInitMoney: [
{ required: true, message: '请输入初始资金', trigger: 'change' },
{validator: validateMoney, trigger: 'blur'}
],
bankcardInitMoney: [
{ required: true, message: '请输入初始资金', trigger: 'change' },
{validator: validateMoney, trigger: 'blur'}
],
taskOperate: [
{ required: true, message: '请选择设置项', trigger: 'change' }
],

Loading…
Cancel
Save