Commit 142627e5 authored by 张俊's avatar 张俊

组织新增

parent e515b59c
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
</div> </div>
<div v-else> <div v-else>
<el-upload <el-upload
action="/awecloud/static/image/upload" action="/apaas/static/image/upload"
:file-list="fileArray" :file-list="fileArray"
:list-type="type=='picture'?'picture-card':''" :list-type="type=='picture'?'picture-card':''"
:limit="max" :limit="max"
...@@ -53,6 +53,10 @@ export default { ...@@ -53,6 +53,10 @@ export default {
type: Boolean, type: Boolean,
default: false default: false
}, },
directory: {
type: String,
default: ''
},
max: { max: {
type: Number, type: Number,
default: 1 default: 1
...@@ -93,6 +97,13 @@ export default { ...@@ -93,6 +97,13 @@ export default {
this.hideUpload = this.fileArray.length >= this.max; this.hideUpload = this.fileArray.length >= this.max;
} }
}, },
created(){
if(this.directory){
this.anotherData={
directory: this.directory
}
}
},
methods: { methods: {
beforeAvatarUpload(file) { beforeAvatarUpload(file) {
if (this.type == "mp3") { if (this.type == "mp3") {
...@@ -122,16 +133,16 @@ export default { ...@@ -122,16 +133,16 @@ export default {
if (this.type == "mp3") { if (this.type == "mp3") {
if (response.success == 1) { if (response.success == 1) {
this.fileArray.push({ this.fileArray.push({
url: response.data.dbUrl, url: response.data,
name: response.data.fileName name: file.name
}); });
} }
this.$emit("getNewList", this.fileArray); this.$emit("getNewList", this.fileArray);
} else if (this.type == "picture") { } else if (this.type == "picture") {
if (response.success == 1) { if (response.success == 1) {
this.fileArray.push({ this.fileArray.push({
url: response.data.dbUrl, url: response.data,
name: response.data.fileName name: file.name
}); });
} }
this.$emit("getNewList", this.fileArray); this.$emit("getNewList", this.fileArray);
...@@ -139,15 +150,15 @@ export default { ...@@ -139,15 +150,15 @@ export default {
this.hideUpload = fileList.length >= this.max; this.hideUpload = fileList.length >= this.max;
}, },
handleRemove(file, fileList) { handleRemove(file, fileList) {
if (!(fileList && fileList.length > 0)) { // if (!(fileList && fileList.length > 0)) {
return; // return;
} // }
let url = file.url; let url = file.url;
let detection = true; let detection = true;
if (url) detection = url.indexOf("blob") != -1; if (url) detection = url.indexOf("blob") != -1;
if (detection) { if (detection) {
this.fileArray.forEach((item, i, arr) => { this.fileArray.forEach((item, i, arr) => {
if (item.url === file.response.data.dbUrl) { if (item.url === file.url) {
this.fileArray.splice(i, 1); this.fileArray.splice(i, 1);
} }
}); });
...@@ -158,6 +169,7 @@ export default { ...@@ -158,6 +169,7 @@ export default {
} }
}); });
} }
this.hideUpload = fileList.length >= this.max; this.hideUpload = fileList.length >= this.max;
this.$emit("getNewList", this.fileArray); this.$emit("getNewList", this.fileArray);
}, },
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<p class="formname">组织机构简称:</p> <p class="formname">组织机构简称:</p>
<el-input v-model="form.shortname"></el-input> <el-input v-model="form.shortname"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="code"> <el-form-item prop="code" v-if="edit_flag">
<p class="formname">组织机构编码:</p> <p class="formname">组织机构编码:</p>
<el-input v-model="form.code" disabled></el-input> <el-input v-model="form.code" disabled></el-input>
</el-form-item> </el-form-item>
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
:list="imgList" :list="imgList"
@getNewList="getNewList" @getNewList="getNewList"
ref="servicepic" ref="servicepic"
directory="manage"
></upload-file> ></upload-file>
<span class="removepic" @click="removepic">更换封面</span> <span class="removepic" @click="removepic">更换封面</span>
</el-form-item> </el-form-item>
...@@ -79,10 +80,8 @@ export default { ...@@ -79,10 +80,8 @@ export default {
date:'', date:'',
fileList:'' fileList:''
}, },
open:true,
open1:false,
open2:'true',
now_user: 2, //0:普通用户,1:组织管理员,2:超级管理员 now_user: 2, //0:普通用户,1:组织管理员,2:超级管理员
edit_flag:0,//0:新增,1:编辑:2详情
imgList: [], imgList: [],
area_arr:[ area_arr:[
{ {
...@@ -126,14 +125,14 @@ export default { ...@@ -126,14 +125,14 @@ export default {
{ required: true, message: '请输入组织机构名称', trigger: 'blur' }, { required: true, message: '请输入组织机构名称', trigger: 'blur' },
], ],
shortname:[ shortname:[
{ required: true, message: '请输入组织机构简称', trigger: 'blur' }, // { required: true, message: '请输入组织机构简称', trigger: 'blur' },
], ],
desc:[ desc:[
{ required: true, message: '请输入组织说明', trigger: 'blur' }, // { required: true, message: '请输入组织说明', trigger: 'blur' },
{ max: 200, message: '长度小于200个字符', trigger: 'blur' } { max: 200, message: '长度小于200个字符', trigger: 'blur' }
], ],
fileList:[ fileList:[
{required: true, message: '请上传图片', trigger: 'change'} // {required: true, message: '请上传图片', trigger: 'change'}
] ]
} }
...@@ -148,10 +147,39 @@ export default { ...@@ -148,10 +147,39 @@ export default {
this.$store.commit('rolefun',data) this.$store.commit('rolefun',data)
this.getOriginArr() this.getOriginArr()
}); });
console.log(this.$route); this.get_now_page()
}, },
mounted() {}, mounted() {},
methods: { methods: {
get_now_page(){
if(this.$route.path.indexOf('add')!==-1){
this.edit_flag = 0
}
if(this.$route.path.indexOf('edit')!==-1){
this.edit_flag = 1
}
if(this.$route.path.indexOf('detail')!==-1){
this.edit_flag = 2
}
},
add_user(){
var temp = {
"department_name":this.form.name,
"description":this.form.desc,
"department_display":this.form.shortname,
"picture_path":this.form.fileList,
}
this.$http
.post('/apaas/backmgt/department',temp)
.then(response => {
console.log(response);
this.$message.success('保存成功')
this.$router.back(-1)
})
.catch((response)=> {
});
},
getOriginArr(){ getOriginArr(){
this.$http this.$http
.get('/static/serviceedit.json') .get('/static/serviceedit.json')
...@@ -170,7 +198,7 @@ export default { ...@@ -170,7 +198,7 @@ export default {
console.log('submit!'); console.log('submit!');
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
if (valid) { if (valid) {
alert('submit!'); this.add_user()
} else { } else {
console.log('error submit!!'); console.log('error submit!!');
return false; return false;
...@@ -180,7 +208,7 @@ export default { ...@@ -180,7 +208,7 @@ export default {
getNewList(val) { getNewList(val) {
console.log(val); console.log(val);
this.form.fileList = "" this.form.fileList = ""
this.form.fileList = url.map((v,k)=>{ this.form.fileList = val.map((v,k)=>{
return v.url return v.url
}).join(';') }).join(';')
console.log(this.form.fileList) console.log(this.form.fileList)
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<img v-if="now_edit==1" src="@/assets/imgs/nav_ic_anquan_sel.png" alt=""> <img v-if="now_edit==1" src="@/assets/imgs/nav_ic_anquan_sel.png" alt="">
<img v-if="now_edit!==1" src="@/assets/imgs/nav_ic_anquan_nor.png" alt=""> 服务安全设置</div> <img v-if="now_edit!==1" src="@/assets/imgs/nav_ic_anquan_nor.png" alt=""> 服务安全设置</div>
</div> </div>
<el-form ref="form" :rules="rules" :model="form" label-width="0px" v-if="now_edit==0"> <el-form ref="form" :rules="rules" :model="form" label-width="0px" v-show="now_edit==0">
<el-form-item prop="name"> <el-form-item prop="name">
<p class="formname">服务名称:</p> <p class="formname">服务名称:</p>
<el-input v-model="form.name"></el-input> <el-input v-model="form.name"></el-input>
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
:readOnly="false" :readOnly="false"
fit="fill" fit="fill"
:list="imgList" :list="imgList"
directory="service"
@getNewList="getNewList" @getNewList="getNewList"
ref="servicepic" ref="servicepic"
></upload-file> ></upload-file>
...@@ -96,7 +97,7 @@ ...@@ -96,7 +97,7 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<div class="safe_set" v-if="now_edit==1"> <div class="safe_set" v-show="now_edit==1">
<div class="safe_title"> <div class="safe_title">
<div v-for="(item,index) in safe_arr" :key="index+4000" <div v-for="(item,index) in safe_arr" :key="index+4000"
class="safe_select" class="safe_select"
...@@ -168,9 +169,9 @@ export default { ...@@ -168,9 +169,9 @@ export default {
}, },
open:1, open:1,
maxline:'', maxline:'',
open1:false, open1:0,
maxline1:'', maxline1:'',
open2:'true', open2:0,
usetime1:'', usetime1:'',
now_user: 2, //0:普通用户,1:组织管理员,2:超级管理员 now_user: 2, //0:普通用户,1:组织管理员,2:超级管理员
now_edit:0,//信息和安全切换 now_edit:0,//信息和安全切换
...@@ -323,9 +324,9 @@ export default { ...@@ -323,9 +324,9 @@ export default {
"descript": this.form.desc, "descript": this.form.desc,
"service_safe_config":{ // 安全配置 超管传入 "service_safe_config":{ // 安全配置 超管传入
fusing:this.open, fusing:this.open,
max_connections:this.maxline, max_connections:parseInt(this.maxline),
req_intervals:this.open1, req_intervals:this.open1,
max_req_num:this.maxline1, max_req_num:parseInt(this.maxline1),
valid_time:this.usetime1, valid_time:this.usetime1,
time_unit:this.timevalue, time_unit:this.timevalue,
tls:this.open2, tls:this.open2,
...@@ -335,6 +336,7 @@ export default { ...@@ -335,6 +336,7 @@ export default {
.put("/apaas/service/v3/service/manager",temp) .put("/apaas/service/v3/service/manager",temp)
.then((response) => { .then((response) => {
console.log(response); console.log(response);
this.$message.success('保存成功')
this.getServiceInfo() this.getServiceInfo()
}) })
.catch(function(response) { .catch(function(response) {
...@@ -348,13 +350,25 @@ export default { ...@@ -348,13 +350,25 @@ export default {
this.onSubmit('form') this.onSubmit('form')
}, },
openstart(){ openstart(){
this.open = !this.open if(this.open){
this.open = 0
}else{
this.open = 1
}
}, },
openstart1(){ openstart1(){
this.open1 = !this.open1 if(this.open1){
this.open1 = 0
}else{
this.open1 = 1
}
}, },
openstart2(){ openstart2(){
this.open2 = !this.open2 if(this.open2){
this.open2 = 0
}else{
this.open2 = 1
}
}, },
removepic(){ removepic(){
this.$refs.servicepic.handleRemove() this.$refs.servicepic.handleRemove()
...@@ -373,7 +387,7 @@ export default { ...@@ -373,7 +387,7 @@ export default {
getNewList(val) { getNewList(val) {
console.log(val); console.log(val);
this.form.fileList = "" this.form.fileList = ""
this.form.fileList = url.map((v,k)=>{ this.form.fileList = val.map((v,k)=>{
return v.url return v.url
}).join(';') }).join(';')
console.log(this.form.fileList) console.log(this.form.fileList)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment