Commit 593ef8c4 authored by “yiyousong”'s avatar “yiyousong”

pref:修改添加工作人员图片

parent 2dbcca49
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
title="编辑工作人员" title="编辑工作人员"
ok-text="确认" ok-text="确认"
cancel-text="取消" cancel-text="取消"
@ok="hideModal"
width="820px" width="820px"
:maskClosable="false" :maskClosable="false"
> >
...@@ -199,9 +198,10 @@ ...@@ -199,9 +198,10 @@
list-type="picture-card" list-type="picture-card"
class="avatar-uploader" class="avatar-uploader"
:show-upload-list="false" :show-upload-list="false"
:customRequest="uploadImg"
:before-upload="beforeUpload" :before-upload="beforeUpload"
:action="api + 'base/file/commonupload'"
:accept="accept" :accept="accept"
@change="handleChange"
> >
<img <img
v-if="form.photoPath" v-if="form.photoPath"
...@@ -307,11 +307,16 @@ ...@@ -307,11 +307,16 @@
</a-col> </a-col>
</a-row> </a-row>
</a-form-model> </a-form-model>
<!-- 按钮 -->
<div slot="footer">
<a-button @click="handleReset">重置</a-button>
<a-button type="primary" @click="hideModal">确定</a-button>
</div>
</a-modal> </a-modal>
</template> </template>
<script> <script>
import { getWindowList, saveWorkman, uploadFile } from "@/services/dept"; import { getWindowList, saveWorkman } from "@/services/dept";
import { modelList } from "@/services/basicsetFun"; import { modelList } from "@/services/basicsetFun";
import { changePhone, changeLandline } from "@/utils/validate"; import { changePhone, changeLandline } from "@/utils/validate";
export default { export default {
...@@ -485,17 +490,18 @@ export default { ...@@ -485,17 +490,18 @@ export default {
// 关闭对话框 // 关闭对话框
handleClose() { handleClose() {
this.$refs.formData.resetFields(); this.$refs.formData.resetFields();
this.loading = false;
this.Visible = false; this.Visible = false;
}, },
// 重置
handleReset() {
this.$refs.formData.resetFields();
},
// 照片上传 // 照片上传
async uploadImg(info) { handleChange({ file }) {
this.loading = true; this.loading = true;
const formData = new FormData(); if (file.status == "done") {
formData.append("file", info.file); this.form.photoPath = file.response.url;
let res = await uploadFile(formData);
let { code, url } = res.data;
if (code === 1) {
this.form.photoPath = url;
this.loading = false; this.loading = false;
} }
}, },
......
...@@ -555,12 +555,13 @@ export default { ...@@ -555,12 +555,13 @@ export default {
// 关闭对话框 // 关闭对话框
handleClose() { handleClose() {
this.$refs.formData.resetFields(); this.$refs.formData.resetFields();
this.loading = false;
this.Visible = false; this.Visible = false;
}, },
// 照片上传 // 照片上传
handleChange({ file }) { handleChange({ file }) {
this.loading = true; this.loading = true;
if (file.type == "done") { if (file.status == "done") {
this.form.photoPath = file.response.url; this.form.photoPath = file.response.url;
this.loading = false; this.loading = false;
} }
......
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