提交 13481885 authored 作者: 龙菲's avatar 龙菲

虚拟展厅增加数据验证,文创产品按钮布局修改

上级 9dbcb696
...@@ -164,7 +164,9 @@ export default { ...@@ -164,7 +164,9 @@ export default {
// 取消编辑 // 取消编辑
cancelForm() { cancelForm() {
this.$emit("handleClose"); this.$emit("handleClose");
this.reset(); // this.reset();
this.resetChildData();
this.reloadParent();
}, },
resetChildData() { resetChildData() {
......
...@@ -367,7 +367,7 @@ export default { ...@@ -367,7 +367,7 @@ export default {
} }
.dialog-footer { .dialog-footer {
display: flex; display: flex;
align-items: flex-end; justify-content: flex-end;
margin: 20px; margin: 20px;
} }
.upload-box { .upload-box {
......
...@@ -26,6 +26,7 @@ export const title = [{ ...@@ -26,6 +26,7 @@ export const title = [{
showOverFlowToolTip: true showOverFlowToolTip: true
}, },
{ {
prop: "phone", prop: "phone",
label: "手机号", label: "手机号",
......
...@@ -170,9 +170,9 @@ export default { ...@@ -170,9 +170,9 @@ export default {
const res = await getDeptTree(); const res = await getDeptTree();
console.log(111, res); console.log(111, res);
if (res.code == 0) { if (res.code == 0) {
this.treeData = res.data; this.treeData = res.data[0].children; //去除默认顶级部门
this.currentDeptNo = this.treeData[0].deptNo; this.currentDeptNo = this.treeData[0].deptNo;
this.loadListData(); this.loadListData();
} }
}, },
// 加载表格数据 // 加载表格数据
......
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
<div class="label">{{ title }}</div> <div class="label">{{ title }}</div>
</div> </div>
<div class="dialog-content"> <div class="dialog-content">
<el-form :model="dialogForm" class="basic-info"> <el-form :model="dialogForm" class="basic-info" ref="form" :rules="rules">
<el-form-item label="名称" :label-width="formLabelWidth"> <el-form-item label="名称" :label-width="formLabelWidth" prop="name">
<el-input <el-input
v-model="dialogForm.name" v-model="dialogForm.name"
autocomplete="off" autocomplete="off"
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
<el-switch v-model="status"> </el-switch> <el-switch v-model="status"> </el-switch>
</el-form-item> </el-form-item>
<el-form-item label="链接" :label-width="formLabelWidth"> <el-form-item label="链接" :label-width="formLabelWidth" prop="url">
<!-- <el-switch v-model="dialogForm.url"> </el-switch> --> <!-- <el-switch v-model="dialogForm.url"> </el-switch> -->
<el-input <el-input
v-model="dialogForm.url" v-model="dialogForm.url"
...@@ -207,6 +207,10 @@ export default { ...@@ -207,6 +207,10 @@ export default {
pidModalKey: 0, pidModalKey: 0,
regionCodeModalKey: 0, regionCodeModalKey: 0,
faceImage: [], faceImage: [],
rules: {
name: [{ required: true, message: "请输入名称", trigger: "blur" }],
url: [{ required: true, message: "请输入链接", trigger: "blur" }],
},
}; };
}, },
methods: { methods: {
...@@ -240,73 +244,77 @@ export default { ...@@ -240,73 +244,77 @@ export default {
} }
}); });
}, },
async handleSubmit() { handleSubmit() {
let params = { ...this.dialogForm }; this.$refs.form.validate(async (valid) => {
// // 回填图片 if (valid) {
// if (this.faceImage.length > 0) { let params = { ...this.dialogForm };
// params.faceImage = this.faceImage[0].fileId; // // 回填图片
// } // if (this.faceImage.length > 0) {
// return; // params.faceImage = this.faceImage[0].fileId;
let deleteFileArr = []; // }
let file = this.$refs.faceImage.getFiles(); // return;
if (file.length > 0) { let deleteFileArr = [];
let formData = new FormData(); let file = this.$refs.faceImage.getFiles();
switch (file[0].status) { if (file.length > 0) {
case "ready": let formData = new FormData();
formData.append("faceImage", file[0].raw); switch (file[0].status) {
let upLoadRes = await uploadV1(formData); case "ready":
if (upLoadRes.code == 0) { formData.append("faceImage", file[0].raw);
params.faceImage = upLoadRes.data[0].fileId; let upLoadRes = await uploadV1(formData);
} else { if (upLoadRes.code == 0) {
this.$message.error("上传失败!:" + upLoadRes.data.msg); params.faceImage = upLoadRes.data[0].fileId;
} else {
this.$message.error("上传失败!:" + upLoadRes.data.msg);
}
deleteFileArr.push(this.dialogForm.faceImage);
break;
case "success":
params.faceImage = file[0].fileId;
break;
} }
deleteFileArr.push(this.dialogForm.faceImage); } else {
break; params.faceImage = "";
case "success": }
params.faceImage = file[0].fileId;
break;
}
} else {
params.faceImage = "";
}
// 处理行政区划 // 处理行政区划
if (params.regionCode instanceof Array) { if (params.regionCode instanceof Array) {
params.regionCode = params.regionCode[params.regionCode.length - 1]; params.regionCode = params.regionCode[params.regionCode.length - 1];
} }
// 处理所属部门 // 处理所属部门
if (params.deptId instanceof Array) { if (params.deptId instanceof Array) {
params.deptId = params.deptId[params.deptId.length - 1]; params.deptId = params.deptId[params.deptId.length - 1];
} }
// 处理状态 // 处理状态
params.status = this.status ? 1 : 0; params.status = this.status ? 1 : 0;
if (this.dialogForm.bvId) { if (this.dialogForm.bvId) {
let res = await editVirtual(params); let res = await editVirtual(params);
if (res.code == 0) { if (res.code == 0) {
this.$message.success("修改成功!"); this.$message.success("修改成功!");
this.reload(); this.reload();
} }
} else { } else {
// let params = { ...this.dialogForm }; // let params = { ...this.dialogForm };
// // // 回填图片 // // // 回填图片
// // if (this.faceImage.length > 0) { // // if (this.faceImage.length > 0) {
// // params.faceImage = this.faceImage[0].fileId; // // params.faceImage = this.faceImage[0].fileId;
// // } // // }
// // 处理行政区划 // // 处理行政区划
// params.regionCode = params.regionCode[params.regionCode.length - 1]; // params.regionCode = params.regionCode[params.regionCode.length - 1];
// // 处理所属部门 // // 处理所属部门
// params.deptId = params.deptId[params.deptId.length - 1]; // params.deptId = params.deptId[params.deptId.length - 1];
// // 处理状态 // // 处理状态
// params.status = this.status ? 1 : 0; // params.status = this.status ? 1 : 0;
// return // return
let res = await addVirtual(params); let res = await addVirtual(params);
if (res.code == 0) { if (res.code == 0) {
this.$message.success("添加成功!"); this.$message.success("添加成功!");
this.reload(); this.reload();
}
}
} }
} });
}, },
reload() { reload() {
this.$emit("refresh", true); //需要重新获取orgTree this.$emit("refresh", true); //需要重新获取orgTree
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论