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

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

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