test #47

Merged
gtz217 merged 273 commits from test into master 2023-10-17 08:53:54 +08:00
2 changed files with 46 additions and 57 deletions
Showing only changes of commit fc94d0cccc - Show all commits

View File

@ -1,7 +1,7 @@
<!-- <!--
filename: dialogForm.vue filename: dialogForm.vue
author: liubin author: liubin
date: 2023-08-02 10:32:36 date: 2023-08-15 10:32:36
description: 弹窗的表单组件 description: 弹窗的表单组件
--> -->
@ -45,6 +45,18 @@
type="datetime" type="datetime"
:placeholder="`请选择${col.label}`" :placeholder="`请选择${col.label}`"
v-bind="col.bind"></el-date-picker> v-bind="col.bind"></el-date-picker>
<el-upload
class="upload-in-dialog"
v-if="col.upload"
:file-list="uploadedFileList"
:action="col.url"
:on-success="handleUploadSuccess"
v-bind="col.bind">
<el-button size="small" type="primary">点击上传</el-button>
<div class="el-upload__tip" slot="tip" v-if="col.uploadTips">
{{ col.uploadTips || '只能上传jpg/png文件大小不超过2MB' }}
</div>
</el-upload>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -90,6 +102,7 @@ export default {
return { return {
formLoading: true, formLoading: true,
optionListOf: {}, optionListOf: {},
uploadedFileList: [],
}; };
}, },
computed: { computed: {
@ -196,6 +209,20 @@ export default {
} }
if (!promiseList.length) this.formLoading = false; if (!promiseList.length) this.formLoading = false;
}, },
//
// bind
handleUploadSuccess(response, file, fileList) {
//
if ('fileNames' in this.form) this.form.fileNames.push(file.name);
//
if ('fileUrls' in this.form) this.form.fileUrls.push(response.data);
// console.log('[dialogForm:handleUploadSuccess]', response, file, fileList, this.form);
this.$modal.msgSuccess('上传成功');
},
getFileName(fileUrl) {
return fileUrl.split('/').pop();
}
}, },
}; };
</script> </script>

View File

@ -54,6 +54,8 @@ import {
exportEquipmentTypeExcel, exportEquipmentTypeExcel,
} from '@/api/base/equipmentType'; } from '@/api/base/equipmentType';
import { getAccessToken } from '@/utils/auth';
export default { export default {
name: 'EquipmentType', name: 'EquipmentType',
components: {}, components: {},
@ -86,40 +88,7 @@ export default {
{ prop: 'name', label: '设备类型名称', align: 'center' }, { prop: 'name', label: '设备类型名称', align: 'center' },
{ prop: 'code', label: '检测类型编码', align: 'center' }, { prop: 'code', label: '检测类型编码', align: 'center' },
{ prop: 'remark', label: '备注', align: 'center' }, { prop: 'remark', label: '备注', align: 'center' },
// {
// label: '',
// alignt: 'center',
// subcomponent: {
// render: function (h) {
// return h('div', null, [
// h(
// 'el-button',
// {
// props: {
// icon: 'el-icon-edit',
// size: 'mini',
// type: 'text',
// },
// },
// ' '
// ),
// h(
// 'el-button',
// {
// props: {
// icon: 'el-icon-edit',
// size: 'mini',
// type: 'text',
// },
// },
// ' '
// ),
// ]);
// },
// },
// },
], ],
//
searchBarFormConfig: [ searchBarFormConfig: [
{ {
type: 'input', type: 'input',
@ -133,11 +102,6 @@ export default {
name: 'search', name: 'search',
color: 'primary', color: 'primary',
}, },
// {
// type: 'button',
// btnName: '',
// name: 'reset',
// },
{ {
type: 'separate', type: 'separate',
}, },
@ -159,22 +123,6 @@ export default {
// color: 'warning', // color: 'warning',
// }, // },
], ],
//
// formRows: [
// [
// {
// input: true,
// label: '',
// prop: 'name',
// rules: [{ required: true, message: '', trigger: 'blur' }],
// // bind: {
// // disabled: true, // some condition, like detail mode...
// // }
// },
// ],
// [{ input: true, label: '', prop: 'code' }],
// [{ input: true, label: '', prop: 'remark' }],
// ],
rows: [ rows: [
[ [
{ {
@ -198,13 +146,17 @@ export default {
select: true, select: true,
label: '父类', label: '父类',
prop: 'parentId', prop: 'parentId',
// other... url: '/base/equipment-type/page?pageNo=1&pageSize=100',
}, },
{ {
upload: true, upload: true,
label: '上传资料', label: '上传资料',
prop: 'uploadFiles', prop: 'uploadFiles',
// other... url: process.env.VUE_APP_BASE_API + '/admin-api/infra/file/upload', //
bind: {
headers: { Authorization: 'Bearer ' + getAccessToken() },
'show-file-list': false,
},
}, },
], ],
[{ input: true, label: '备注', prop: 'remark' }], [{ input: true, label: '备注', prop: 'remark' }],
@ -221,6 +173,14 @@ export default {
form: {}, form: {},
}; };
}, },
watch: {
// form: {
// handler: function (val, oldVal) {
// console.log('[watch:form]', val, oldVal);
// },
// deep: true,
// },
},
created() { created() {
this.getList(); this.getList();
}, },
@ -248,6 +208,8 @@ export default {
name: undefined, name: undefined,
parentId: undefined, parentId: undefined,
remark: undefined, remark: undefined,
fileNames: [],
fileUrls: [],
}; };
this.resetForm('form'); this.resetForm('form');
}, },