fix:upload、详情展示

This commit is contained in:
wangzenghua 2025-02-11 08:47:14 +00:00
parent fbc6ecaa97
commit 0c679197ea
6 changed files with 61 additions and 51 deletions

View File

@ -63,10 +63,19 @@ export function ExportEntity(params = {}) {
} }
/** /**
* @Title: 详情 * @Title: 采收详情
*/ */
export function GetEntity(params = {}) { export function GetEntity(params = {}) {
return request(`/trace/code/farmMange/qualityCheck/${params?.id}`, { return request(`/trace/code/farmMange/qualityCheck/${params?.id}`, {
method: 'GET', method: 'GET',
}); });
} }
/**
* @Title: 溯源详情
*/
export function GetTraceDetail(params = {}) {
return request(`/trace/code/farmMange/originalCodeInfo/${params?.id}`, {
method: 'GET',
});
}

View File

@ -3,7 +3,7 @@
* @Author: zenghua.wang * @Author: zenghua.wang
* @Date: 2022-02-23 21:12:37 * @Date: 2022-02-23 21:12:37
* @LastEditors: zenghua.wang * @LastEditors: zenghua.wang
* @LastEditTime: 2025-02-10 14:42:53 * @LastEditTime: 2025-02-11 16:18:41
*/ */
import lodash from 'lodash'; import lodash from 'lodash';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
@ -293,6 +293,16 @@ export const obj2Param = (json) => {
export const getAssetsFile = (url) => { export const getAssetsFile = (url) => {
return new URL(`../assets/${url}`, import.meta.url); return new URL(`../assets/${url}`, import.meta.url);
}; };
/**
* @Title 替换图片url字段值
* @param {*} url
* @returns
*/
export const setUploadField = (url) => {
// if (isEmpty(url) || url.includes('http')) return null;
if (isEmpty(url)) return null;
return url;
};
/** /**
* @Title: 下载文件 * @Title: 下载文件
* @param {void} url: * @param {void} url:

View File

@ -306,11 +306,11 @@ const state = reactive({
rows: 4, rows: 4,
overHidden: true, overHidden: true,
width: 200, width: 200,
rules: { // rules: {
required: true, // required: true,
message: '请输入', // message: '',
trigger: 'blur', // trigger: 'blur',
}, // },
}, },
{ {
label: '创建时间', label: '创建时间',
@ -362,7 +362,7 @@ const state = reactive({
}); });
// //
const loadData = async () => { const loadData = () => {
state.loading = true; state.loading = true;
delete state.query.datetime; delete state.query.datetime;
GetEntityList(state.query) GetEntityList(state.query)

View File

@ -36,24 +36,20 @@ const app = useApp();
const crudRef = ref(null); const crudRef = ref(null);
const state = reactive({ const state = reactive({
loading: false, loading: false,
// query: {
// current: 1,
// size: 10,
// },
options: { options: {
...CRUD_OPTIONS, ...CRUD_OPTIONS,
index: false, index: true,
addBtn: false, addBtn: false,
refreshBtn: false, refreshBtn: false,
selection: false, selection: false,
menu: false, menu: false,
column: [ column: [
{ // {
label: '溯源码', // label: '',
prop: 'id', // prop: 'id',
width: 200, // width: 200,
fixed: true, // fixed: true,
}, // },
{ {
label: '采收批次', label: '采收批次',
prop: 'harvestBatch', prop: 'harvestBatch',
@ -109,14 +105,6 @@ const state = reactive({
prop: 'qualityReportUrl', prop: 'qualityReportUrl',
slot: true, slot: true,
}, },
{
label: '检测说明',
prop: 'qualityDescribe',
type: 'textarea',
overHidden: true,
resize: 'none',
width: 200,
},
{ {
label: '质检人', label: '质检人',
prop: 'qualityPerson', prop: 'qualityPerson',
@ -126,13 +114,16 @@ const state = reactive({
prop: 'qualityTime', prop: 'qualityTime',
width: 200, width: 200,
}, },
{
label: '检测说明',
prop: 'qualityDescribe',
type: 'textarea',
overHidden: true,
resize: 'none',
width: 200,
},
], ],
}, },
// pageData: {
// total: 0,
// currentPage: 1,
// pageSize: 10,
// },
data: {}, data: {},
list: [], list: [],
}); });

View File

@ -23,7 +23,7 @@
</template> </template>
<script setup> <script setup>
import { reactive, ref, watch } from 'vue'; import { reactive, ref, watch } from 'vue';
import { isEmpty, imageToBase64 } from '@/utils'; import { isEmpty, imageToBase64, setUploadField } from '@/utils';
import { useApp } from '@/hooks'; import { useApp } from '@/hooks';
import { CommonUpload } from '@/apis'; import { CommonUpload } from '@/apis';
import { AddEntity } from '@/apis/quality'; import { AddEntity } from '@/apis/quality';
@ -160,11 +160,11 @@ const state = reactive({
slot: true, slot: true,
span: 24, span: 24,
hide: true, hide: true,
rules: { // rules: {
required: true, // required: true,
message: '请选择', // message: '',
trigger: 'blur', // trigger: 'blur',
}, // },
}, },
{ {
label: '检测说明', label: '检测说明',
@ -174,11 +174,11 @@ const state = reactive({
rows: 4, rows: 4,
overHidden: true, overHidden: true,
width: 200, width: 200,
rules: { // rules: {
required: true, // required: true,
message: '请输入', // message: '',
trigger: 'blur', // trigger: 'blur',
}, // },
}, },
], ],
}, },
@ -214,6 +214,7 @@ const rowUploadPicture = async ({ file }) => {
const onSubmit = (row, done) => { const onSubmit = (row, done) => {
delete row.base64; delete row.base64;
row.qualityReportUrl = setUploadField(row.qualityReportUrl);
AddEntity(row) AddEntity(row)
.then((res) => { .then((res) => {
if (res.code === 200) { if (res.code === 200) {

View File

@ -71,7 +71,7 @@ const state = reactive({
column: [ column: [
{ {
label: '溯源码', label: '溯源码',
prop: 'id', prop: 'harvestId',
search: true, search: true,
disabled: true, disabled: true,
width: 200, width: 200,
@ -206,7 +206,6 @@ const state = reactive({
prop: 'qualityReportUrl', prop: 'qualityReportUrl',
type: 'upload', type: 'upload',
span: 24, span: 24,
// hide: true,
slot: true, slot: true,
formslot: true, formslot: true,
}, },
@ -218,11 +217,11 @@ const state = reactive({
rows: 4, rows: 4,
overHidden: true, overHidden: true,
width: 200, width: 200,
rules: { // rules: {
required: true, // required: true,
message: '请输入', // message: '',
trigger: 'blur', // trigger: 'blur',
}, // },
}, },
], ],
actions: [ actions: [
@ -253,7 +252,7 @@ const state = reactive({
}); });
// //
const loadData = async () => { const loadData = () => {
state.loading = true; state.loading = true;
delete state.query.datetime; delete state.query.datetime;
GetEntityList(state.query) GetEntityList(state.query)