|
@@ -3,6 +3,17 @@
|
|
|
<div class="create-body">
|
|
|
<div class="title">添加机构</div>
|
|
|
<el-form :model="agency" :rules="rules" ref="agency" label-width="12%" class="demo-report">
|
|
|
+ <!--<el-form-item prop="file" label="头像">-->
|
|
|
+ <!--<el-row class="demo-avatar demo-basic">-->
|
|
|
+ <!--<el-col :span="12">-->
|
|
|
+ <!--<div class="demo-basic--circle">-->
|
|
|
+ <!--<div class="block">-->
|
|
|
+ <!--<el-avatar :size="200" src="https://www.baidu.com/img/bd_logo1.png"></el-avatar>-->
|
|
|
+ <!--</div>-->
|
|
|
+ <!--</div>-->
|
|
|
+ <!--</el-col>-->
|
|
|
+ <!--</el-row>- -->
|
|
|
+ <!--</el-form-item>-->
|
|
|
<el-form-item label="机构名称" prop="name">
|
|
|
<el-input v-if="isModifyMode" v-model="agency.name"></el-input>
|
|
|
<!--<span v-if="!isModifyMode">{{agency.name}}</span>-->
|
|
@@ -24,11 +35,65 @@
|
|
|
<!--<span v-if="!isModifyMode">{{agency.address}}</span>-->
|
|
|
</el-form-item>
|
|
|
<el-form-item label="测评机构能力" prop="name">
|
|
|
- <el-input v-if="isModifyMode" v-model="agency.ability"></el-input>
|
|
|
+ <el-checkbox-group v-if="isModifyMode" v-model="agency.ability">
|
|
|
+ <span v-for="(item,index) in serviceTypes" :key="index">
|
|
|
+ <el-checkbox :label="item" name="type">{{item}} </el-checkbox>
|
|
|
+ </span>
|
|
|
+ </el-checkbox-group>
|
|
|
<!--<span v-if="!isModifyMode">{{agency.ability}}</span>-->
|
|
|
</el-form-item>
|
|
|
<el-form-item label="测评机构资源" prop="name">
|
|
|
- <el-input v-if="isModifyMode" v-model="agency.resource"></el-input>
|
|
|
+ <span v-for="item in agency.resource" :key="item.id">
|
|
|
+ 资源类型: <el-select v-model="item.type" placeholder="请选择" style="width: 150px" :value="item.type">
|
|
|
+ <el-option
|
|
|
+ v-for="item in resourceTypes"
|
|
|
+ :key="item"
|
|
|
+ :label="item"
|
|
|
+ :value="item">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ 资源名称: <el-input v-model="item.name" style="width: 150px"></el-input>
|
|
|
+ 总量: <el-input-number :min="0" v-model="item.totalNum"></el-input-number>
|
|
|
+ 可用数量: <el-input-number :min="0" :max="item.totalNum" v-model="item.availableNum"></el-input-number>
|
|
|
+ <el-button type="danger" icon="el-icon-delete" @click="removeAgencyResource(item.id)"></el-button>
|
|
|
+ <br/>
|
|
|
+ </span>
|
|
|
+ <el-button type="primary" icon="el-icon-circle-plus" plain size="small" @click="addAgencyResource">添加资源
|
|
|
+ </el-button>
|
|
|
+ <!--<div>-->
|
|
|
+ <!--<el-row>-->
|
|
|
+ <!--<el-col :span="2">-->
|
|
|
+ <!--<span>专家数量</span>-->
|
|
|
+ <!--</el-col>-->
|
|
|
+ <!--<el-col :span="10">-->
|
|
|
+ <!--共 <el-input-number :min="0" v-model="agency.professionalsCount"-->
|
|
|
+ <!--placeholder="0"></el-input-number> 人,-->
|
|
|
+ <!--可用 <el-input-number :min="0" v-model="agency.professionalsFreeCount"-->
|
|
|
+ <!--placeholder="0"></el-input-number> 人;-->
|
|
|
+ <!--</el-col>-->
|
|
|
+ <!--</el-row>-->
|
|
|
+ <!--<el-row>-->
|
|
|
+ <!--<el-col :span="2">-->
|
|
|
+ <!--<span>服务器数量</span>-->
|
|
|
+ <!--</el-col>-->
|
|
|
+ <!--<el-col :span="10">-->
|
|
|
+ <!--共 <el-input-number :min="0" v-model="agency.serversCount" placeholder="0"></el-input-number> 台,-->
|
|
|
+ <!--可用 <el-input-number :min="0" v-model="agency.serversFreeCount"-->
|
|
|
+ <!--placeholder="0"></el-input-number> 台;-->
|
|
|
+ <!--</el-col>-->
|
|
|
+ <!--</el-row>-->
|
|
|
+ <!--<el-row>-->
|
|
|
+ <!--<el-col :span="2">-->
|
|
|
+ <!--<span>专用设备数量</span>-->
|
|
|
+ <!--</el-col>-->
|
|
|
+ <!--<el-col :span="10">-->
|
|
|
+ <!--共 <el-input-number :min="0" v-model="agency.devicesCount" placeholder="0"></el-input-number> 台,-->
|
|
|
+ <!--可用 <el-input-number :min="0" v-model="agency.devicesFreeCount"-->
|
|
|
+ <!--placeholder="0"></el-input-number> 台。-->
|
|
|
+ <!--</el-col>-->
|
|
|
+ <!--</el-row>-->
|
|
|
+ <!--</div>-->
|
|
|
+ <!--<el-input v-if="isModifyMode" v-model="agency.resource"></el-input>-->
|
|
|
<!--<span v-if="!isModifyMode">{{agency.resource}}</span>-->
|
|
|
</el-form-item>
|
|
|
<el-form-item prop="file" label="头像">
|
|
@@ -111,6 +176,7 @@
|
|
|
import Http from '@/js/http'
|
|
|
import Apis from '@/js/api'
|
|
|
import {notify} from '@/constants/index'
|
|
|
+import {getAllAbilities, getAllAgencyResourceTypes} from '@/js/index'
|
|
|
|
|
|
export default {
|
|
|
name: 'AgencyAdd',
|
|
@@ -119,14 +185,30 @@ export default {
|
|
|
userId: 0,
|
|
|
isModifyMode: true,
|
|
|
dialogVisible: false,
|
|
|
+ serviceTypes: [],
|
|
|
+ resourceTypes: [],
|
|
|
agency: {
|
|
|
mobile: '',
|
|
|
email: '',
|
|
|
name: '',
|
|
|
bankAccount: '',
|
|
|
address: '',
|
|
|
- ability: '',
|
|
|
- resource: '',
|
|
|
+ ability: [],
|
|
|
+ resource: [
|
|
|
+ {
|
|
|
+ id: 0,
|
|
|
+ type: '',
|
|
|
+ name: '',
|
|
|
+ totalNum: 0,
|
|
|
+ availableNum: 0,
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ professionalsCount: 0,
|
|
|
+ professionalsFreeCount: 0,
|
|
|
+ serversCount: 0,
|
|
|
+ serversFreeCount: 0,
|
|
|
+ devicesCount: 0,
|
|
|
+ devicesFreeCount: 0,
|
|
|
photo: [],
|
|
|
photoUrl: '',
|
|
|
password: '',
|
|
@@ -150,10 +232,36 @@ export default {
|
|
|
// conclusion: [
|
|
|
// {required: true, message: '请输入报告结论', trigger: 'blur'}
|
|
|
// ]
|
|
|
- }
|
|
|
+ },
|
|
|
+ tableData: [{
|
|
|
+ date: '2016-05-02',
|
|
|
+ name: '王小虎',
|
|
|
+ address: '上海市普陀区金沙江路 1518 弄'
|
|
|
+ }, {
|
|
|
+ date: '2016-05-04',
|
|
|
+ name: '王小虎',
|
|
|
+ address: '上海市普陀区金沙江路 1517 弄'
|
|
|
+ }, {
|
|
|
+ date: '2016-05-01',
|
|
|
+ name: '王小虎',
|
|
|
+ address: '上海市普陀区金沙江路 1519 弄'
|
|
|
+ }, {
|
|
|
+ date: '2016-05-03',
|
|
|
+ name: '王小虎',
|
|
|
+ address: '上海市普陀区金沙江路 1516 弄'
|
|
|
+ }]
|
|
|
}
|
|
|
},
|
|
|
+ mounted () {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.init()
|
|
|
+ })
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ init () {
|
|
|
+ this.setServiceTypes()
|
|
|
+ this.setResourceTypes()
|
|
|
+ },
|
|
|
//加载数据
|
|
|
loadData: function () {
|
|
|
},
|
|
@@ -256,6 +364,50 @@ export default {
|
|
|
password: '',
|
|
|
username: '',
|
|
|
}
|
|
|
+ },
|
|
|
+ setServiceTypes () {
|
|
|
+ this.serviceTypes = getAllAbilities()
|
|
|
+ },
|
|
|
+ addAgencyResource () {
|
|
|
+ const tmpResource = {
|
|
|
+ id: this.agency.resource.length,
|
|
|
+ type: this.resourceTypes[0],
|
|
|
+ name: '',
|
|
|
+ totalNum: 0,
|
|
|
+ availableNum: 0,
|
|
|
+ }
|
|
|
+ this.agency.resource.push(tmpResource)
|
|
|
+ this.checkAgencyResourceVaild()
|
|
|
+ },
|
|
|
+ removeAgencyResource (id) {
|
|
|
+ this.agency.resource.splice(id, 1)
|
|
|
+ for (var i = 0; i < this.agency.resource.length; i++) {
|
|
|
+ this.agency.resource[i].id = i
|
|
|
+ }
|
|
|
+ },
|
|
|
+ setResourceTypes () {
|
|
|
+ this.resourceTypes = getAllAgencyResourceTypes()
|
|
|
+ },
|
|
|
+ checkAgencyResourceVaild () {
|
|
|
+ if (this.agency.resource.length === 0) {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ for (var i = 0;i<this.agency.resource.length;i++) {
|
|
|
+ const item = this.agency.resource[i]
|
|
|
+ if (item.type === '') {
|
|
|
+ notify('error','资源类型不能为空')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (item.name === '') {
|
|
|
+ notify('error','资源名称不能为空')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (item.totalNum < item.availableNum) {
|
|
|
+ notify('error','资源总数量不能低于可用数量')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true
|
|
|
}
|
|
|
},
|
|
|
created: function () {
|
|
@@ -312,4 +464,8 @@ export default {
|
|
|
height: 178px;
|
|
|
display: block;
|
|
|
}
|
|
|
+
|
|
|
+ .el-input-number {
|
|
|
+ width: 150px;
|
|
|
+ }
|
|
|
</style>
|