|
@@ -1,7 +1,7 @@
|
|
|
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, uiContext, UserPageQuery } from '@fast-crud/fast-crud';
|
|
|
-import { createUploaderRules } from "@fast-crud/fast-extends";
|
|
|
import dayjs from 'dayjs';
|
|
|
import * as api from './api';
|
|
|
+import { uploadFile } from './api';
|
|
|
import { auth } from '/@/utils/authFunction';
|
|
|
import { commonCrudConfig } from '/@/utils/commonCrud';
|
|
|
|
|
@@ -156,6 +156,7 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
|
|
|
title:'库存数量',
|
|
|
type:"input",
|
|
|
column: { minWidth: 100 },
|
|
|
+ from:{show: false}
|
|
|
},
|
|
|
warehouse:{
|
|
|
title:'库存仓库',
|
|
@@ -285,18 +286,48 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
|
|
|
column: {
|
|
|
minWidth: 120,
|
|
|
show:false,
|
|
|
- },
|
|
|
+ },
|
|
|
form: {
|
|
|
- // component: { placeholder: '请上传图片' },
|
|
|
+ // show: auth('image:upload'),
|
|
|
component: {
|
|
|
- limit: 1,
|
|
|
uploader: {
|
|
|
- type: "form"
|
|
|
+ type: 'form',
|
|
|
+ limit: 1,
|
|
|
+ accept: ".jpg,.png",
|
|
|
+ uploadRequest: async (file) => {
|
|
|
+ // eslint-disable-next-line no-console
|
|
|
+ // console.log("files::",file);
|
|
|
+ const previewUrl = URL.createObjectURL(file.file);
|
|
|
+ file.value=previewUrl;
|
|
|
+ const formData = new FormData();
|
|
|
+ formData.append('image', file.file);
|
|
|
+ // eslint-disable-next-line no-console
|
|
|
+ // console.log("files::",file);
|
|
|
+ const res = await uploadFile(formData);
|
|
|
+ // eslint-disable-next-line no-console
|
|
|
+ console.log("url::"+res.data.image_url);
|
|
|
+ file.value = res.data.image_url; // 绑定表单字段
|
|
|
+ // const apiUrl = import.meta.env.VITE_API_URL;
|
|
|
+ // const res = await axios.post(`${import.meta.env.VITE_API_URL}/api/system/device/upload-image/`, formData);
|
|
|
+ return {url:res.data.image_url,} // 必须返回包含url的对象
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- },
|
|
|
- rules: createUploaderRules([{ required: true, message: "此项必传", trigger: "change" }]),
|
|
|
- helper: "上传设备图片"
|
|
|
- },
|
|
|
+ }
|
|
|
+ // form: {
|
|
|
+ // // component: { placeholder: '请上传图片' },
|
|
|
+ // component: {
|
|
|
+ // limit: 1,
|
|
|
+ // uploader: {
|
|
|
+ // type: "form"
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // rules: createUploaderRules([{ required: true, message: "此项必传", trigger: "change" }]),
|
|
|
+ // change:()=>{
|
|
|
+
|
|
|
+ // },
|
|
|
+ // helper: "上传设备图片",
|
|
|
+ // },
|
|
|
|
|
|
|
|
|
},
|
|
@@ -333,12 +364,12 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
|
|
|
},
|
|
|
quantity:{
|
|
|
show: false,
|
|
|
- title: '数量',
|
|
|
+ title: '库存数量',
|
|
|
search: { show: false },
|
|
|
type: 'input',
|
|
|
column: { show: false,minWidth: 120 },
|
|
|
form: {
|
|
|
- component: { placeholder: '请输入数量' }
|
|
|
+ component: { placeholder: '请输入库存数量' }
|
|
|
}
|
|
|
},
|
|
|
tags:{
|
|
@@ -362,11 +393,72 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
|
|
|
},
|
|
|
}
|
|
|
},
|
|
|
+ maintenancename: {
|
|
|
+ title: '维修名称',
|
|
|
+ type: 'input',
|
|
|
+ search: { show: false },
|
|
|
+ column: { minWidth: 100 },
|
|
|
+ form: {
|
|
|
+ component: { placeholder: '请输入设备购入价格' },
|
|
|
+ rules: [{ required: true, message: '请输入设备购入价格' }],
|
|
|
+ },
|
|
|
+ },
|
|
|
...commonCrudConfig({
|
|
|
create_datetime: { search: false },
|
|
|
update_datetime: { search: false },
|
|
|
}),
|
|
|
},
|
|
|
+ form: {
|
|
|
+ row: { gutter: 20 },
|
|
|
+ group: {
|
|
|
+ groupType: "tabs", //collapse, tabs
|
|
|
+ accordion: false,
|
|
|
+ groups: {
|
|
|
+ base: {
|
|
|
+ slots: {
|
|
|
+ label: (scope) => {
|
|
|
+ return (
|
|
|
+ <span style={{ color: scope.hasError ? "red" : "green" }}>
|
|
|
+ <fs-icon icon={"ion:checkmark-circle"} />
|
|
|
+ 基础信息
|
|
|
+ </span>
|
|
|
+ );
|
|
|
+ }
|
|
|
+ },
|
|
|
+ icon: "el-icon-goods",
|
|
|
+ columns: ["code","category_name", "name", "status","brand","specification","serial_number","total_quantity","warehouse","is_visible","department","purchase_date","supplier","price","warranty_expiration","image","tenant_id","category","quantity","tags"]
|
|
|
+ },
|
|
|
+ borrow: {
|
|
|
+ label: "借用记录",
|
|
|
+ icon: "el-icon-price-tag",
|
|
|
+ columns: []
|
|
|
+ },
|
|
|
+ maintenance: {
|
|
|
+ label: "维修记录",
|
|
|
+ collapsed: true, //默认折叠
|
|
|
+ icon: "el-icon-warning-outline",
|
|
|
+ columns: ["maintenancename"]
|
|
|
+ },
|
|
|
+ maintain: {
|
|
|
+ label: "保养记录",
|
|
|
+ collapsed: true, //默认折叠
|
|
|
+ icon: "el-icon-warning-outline",
|
|
|
+ columns: []
|
|
|
+ },
|
|
|
+ datastatis: {
|
|
|
+ label: "数据统计",
|
|
|
+ collapsed: true, //默认折叠
|
|
|
+ icon: "el-icon-warning-outline",
|
|
|
+ columns: []
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
};
|