1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
| <template>
| <div class="License">
| <el-container>
| <el-main>
| <avue-form
| :option="option"
| v-model="form"
| :upload-after="uploadAfter"
| :upload-delete="uploadDelete"
| >
| </avue-form
| ></el-main>
| </el-container>
| </div>
| </template>
|
| <script>
| import { update } from "@/api/securityUnit/securityUnit";
| export default {
| props: ["row"],
| data() {
| return {
| form: {
| imgUrl: [],
| },
| option: {
| submitBtn: false,
| emptyBtn: false,
| labelWidth: 120,
| column: [
| {
| label: "",
| prop: "imgUrl",
| type: "upload",
| listType: "picture-img",
| span: 24,
| propsHttp: {
| res: "data",
| },
| tip: "只能上传jpg/png格式图片,且不超过2Mb",
|
| action: "/api/blade-resource/oss/endpoint/put-files?file=",
| },
| ],
| },
| };
| },
| mounted() {
| this.seeImg();
| // console.log(this.row.licence);
| },
| comments: {
| srcList() {
| return [this.res];
| },
| },
| methods: {
| seeImg() {
| if (this.row.licence == "") {
| // console.log("暂无保安公司许可证");
| } else {
| // console.log("have");
| this.form.imgUrl = this.row.licence;
| }
| },
| saveLock(name, val) {
| window.localStorage.setItem(name, val);
| },
| uploadDelete(column, file) {
| this.row.licence = "";
| this.saveLock("danweidata", JSON.stringify(this.row));
| return update(this.row)
| .then(() => {
| this.$message({
| type: "success",
| message: "删除成功!",
| });
| // done();
| })
| .catch((error) => {
| this.$message({
| type: "warning",
| message: "删除照片失败,再重试!",
| });
| // done();
| });
| },
| uploadAfter(res, done, loading, column) {
| this.row.licence = res.url;
| this.saveLock("danweidata", JSON.stringify(this.row));
| update(this.row).then(
| () => {
| this.$message({
| type: "success",
| message: "添加成功!",
| });
| done();
| },
| (error) => {
| this.$message({
| type: "warning",
| message: "请上传图片,再重试!",
| });
| done();
| }
| );
| done();
| },
| },
| };
| </script>
|
| <style lang="scss" scoped>
| .License {
| padding-top: 15px;
| background-color: #fff;
| }
| .el-main {
| background-color: #fff;
| color: #333;
| text-align: center;
| position: relative;
| right: 5%;
| }
| </style>
|
|