diff --git a/src/components/DialogJustForm.vue b/src/components/DialogJustForm.vue
index b359221..867a514 100644
--- a/src/components/DialogJustForm.vue
+++ b/src/components/DialogJustForm.vue
@@ -46,6 +46,19 @@
:disabled="detailMode"
/>
+
+ 选择文件
+ 只能上传jpg/png文件,且不超过500kb
+
import { pick as __pick } from "@/utils/filters";
+import Cookies from 'js-cookie'
function reConstructTreeData(listObj) {
const entry = [];
@@ -112,7 +126,8 @@ export default {
const dataForm = {};
this.configs.form.rows.forEach((row) => {
row.forEach((col) => {
- dataForm[col.prop] = col.default ?? null;
+ if (col.upload) dataForm[col.prop] = col.default ?? [];
+ else dataForm[col.prop] = col.default ?? null;
if (col.fetchData)
col.fetchData().then(({ data: res }) => {
@@ -148,7 +163,7 @@ export default {
col.options.splice(0);
}
- return col
+ return col;
});
}
});
@@ -164,6 +179,13 @@ export default {
created() {
// console.log('[dialog] created!!! wouldn\'t create again...')
},
+ computed: {
+ uploadHeaders() {
+ return {
+ token: Cookies.get('token') || ''
+ }
+ }
+ },
methods: {
/** utitilities */
showButton(operate) {
@@ -213,7 +235,7 @@ export default {
if (res && res.code === 0) {
const dataFormKeys = Object.keys(this.dataForm);
console.log("keys ===> ", dataFormKeys);
-
+
// console.log('data form keys: ', dataFormKeys, pick(res.data, dataFormKeys))
this.dataForm = __pick(res.data, dataFormKeys);
console.log("pick(res.data, dataFormKeys) ===> ", __pick(res.data, dataFormKeys));
@@ -297,6 +319,10 @@ export default {
}
},
+ handleUploadChange(file, fileList) {
+ console.log('[Upload] handleUploadChange...', file, fileList)
+ },
+
handleClose() {
// this.resetForm();
this.selfVisible = false;
diff --git a/src/components/noTemplateComponents/uploadComponent.js b/src/components/noTemplateComponents/uploadComponent.js
new file mode 100644
index 0000000..df3d063
--- /dev/null
+++ b/src/components/noTemplateComponents/uploadComponent.js
@@ -0,0 +1,39 @@
+export default {
+ name: 'UploadComponent',
+ props: {
+ existingFiles: {
+ type: Array,
+ default: () => [ /** { }, { }, ... */]
+ },
+ typeCode: {
+ type: String,
+ default: '' // 文件类型编码
+ },
+ bind: { // element-ui 的 props
+ type: Object,
+ default: () => ({})
+ }
+ },
+ data() {
+ return {
+ }
+ },
+ computed: {
+ fileList: {
+ set(list) { },
+ get() {
+ // TODO:计划要根据 existingFiles 来过滤
+ return []
+ }
+ }
+ },
+ methods: {
+
+ },
+ render: function (h) {
+ return h('el-upload', { props: { action: this.bind.action ?? '#', 'file-list': this.fileList } }, [
+ h('el-button', { props: { size: 'small', type: 'primary' } }, '选择文件'),
+ h('div', { slot: 'tip', 'class': 'el-upload__tip' }, '只能上传jpg/png文件,且不超过500kb')
+ ])
+ }
+}
\ No newline at end of file
diff --git a/src/views/modules/pms/equipmentType/config.js b/src/views/modules/pms/equipmentType/config.js
index d668cee..06f5ce0 100644
--- a/src/views/modules/pms/equipmentType/config.js
+++ b/src/views/modules/pms/equipmentType/config.js
@@ -94,7 +94,7 @@ export default function () {
],
// [{ textarea: true, label: "描述信息", prop: "description", elparams: { placeholder: "描述信息" } }],
[{ input: true, label: "备注", prop: "remark", elparams: { placeholder: "备注" } }],
- [{ upload: true, label: "上传资料", prop: "upload", elparams: null }],
+ [{ upload: true, actionUrl: window.SITE_CONFIG['apiURL'] + '/pms/equipmentTypeFile', label: "上传资料", fileList:[], prop: "upload", elparams: null }],
],
operations: [
{ name: "add", label: "保存", type: "primary", permission: "pms:equipmentType:save", showOnEdit: false },
diff --git a/src/views/modules/pms/equipmentType/index.vue b/src/views/modules/pms/equipmentType/index.vue
index 7ccdd8e..64962e1 100644
--- a/src/views/modules/pms/equipmentType/index.vue
+++ b/src/views/modules/pms/equipmentType/index.vue
@@ -7,7 +7,7 @@ import initConfig from './config';
import ListViewWithHead from '@/views/atomViews/ListViewWithHead.vue';
export default {
- name: 'ProductionLineView',
+ name: 'EquipmentTypeView',
components: { ListViewWithHead },
provide() {
return {