|
@@ -11,12 +11,16 @@
|
|
|
<el-row>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="客户编码" prop="code">
|
|
|
- <el-input v-model="form.code" placeholder="请输入"></el-input>
|
|
|
+ <el-input
|
|
|
+ v-model="form.code"
|
|
|
+ placeholder="请输入"
|
|
|
+ :disabled="isEdit === 'edit'"
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="1"></el-col>
|
|
|
- <el-col :span="15">
|
|
|
- <el-form-item label=".">
|
|
|
+ <el-col :span="15" style="margin-top: 30px">
|
|
|
+ <el-form-item label=" ">
|
|
|
<span>不输入则自动生成,自动编码规则示例:C00001</span>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
@@ -115,7 +119,6 @@
|
|
|
|
|
|
<el-form-item label="上传附件">
|
|
|
<el-upload
|
|
|
- class="upload-demo"
|
|
|
action="/api/service-file/uploadFile"
|
|
|
:headers="uploadHeader"
|
|
|
:on-preview="handlePreview"
|
|
@@ -159,6 +162,9 @@ export default {
|
|
|
type: Object,
|
|
|
default: () => {},
|
|
|
},
|
|
|
+ isEdit: {
|
|
|
+ type: String,
|
|
|
+ },
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -218,19 +224,35 @@ export default {
|
|
|
fileList: [],
|
|
|
};
|
|
|
},
|
|
|
+
|
|
|
created() {
|
|
|
getRegionData({ parentId: "", type: "1" }).then((res) => {
|
|
|
this.countryData = res.data.data;
|
|
|
});
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ form: {
|
|
|
+ handler(val, oldVal) {
|
|
|
+ this.fileList = val.fileInfoList;
|
|
|
+ this.fileList = this.fileList.map((x) => ({ name: x.fileName, ...x }));
|
|
|
+ // console.log(this.fileList, "aaa");
|
|
|
+ },
|
|
|
+ deep: true,
|
|
|
+ immediate: true,
|
|
|
+ },
|
|
|
+ },
|
|
|
methods: {
|
|
|
handleSubmit() {
|
|
|
this.$refs.form.validate((valid) => {
|
|
|
if (valid) {
|
|
|
this.loading = true;
|
|
|
- this.form.fileInfoList = this.fileList.map((x) => ({
|
|
|
- ...x.response.data,
|
|
|
- }));
|
|
|
+ this.form.fileInfoList = this.fileList.map((x) => {
|
|
|
+ if (x.response) {
|
|
|
+ return { ...x.response.data };
|
|
|
+ } else {
|
|
|
+ return { ...x };
|
|
|
+ }
|
|
|
+ });
|
|
|
this.$emit("submit");
|
|
|
}
|
|
|
});
|
|
@@ -251,10 +273,18 @@ export default {
|
|
|
handleSuccess(response, file, fileList) {
|
|
|
this.fileList = fileList;
|
|
|
},
|
|
|
- handleRemove(response, file, fileList) {
|
|
|
+ handleRemove(file, fileList) {
|
|
|
this.fileList = fileList;
|
|
|
},
|
|
|
- handlePreview() {},
|
|
|
+ handlePreview(file) {
|
|
|
+ let path = "";
|
|
|
+ if (file.response) {
|
|
|
+ path = "/file/" + file.response.data.filePath;
|
|
|
+ } else {
|
|
|
+ path = "/file/" + file.filePath;
|
|
|
+ }
|
|
|
+ window.open(path, "_blank");
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|