From fbc6ecaa97165cfc8bc2b8be6a292e8a9e6c0d10 Mon Sep 17 00:00:00 2001 From: wangzenghua <1048523306@qq.com> Date: Tue, 11 Feb 2025 03:17:09 +0000 Subject: [PATCH] =?UTF-8?q?feat:=E4=BA=A7=E5=93=81=E8=B4=A8=E9=87=8F?= =?UTF-8?q?=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/.env.development | 14 ++++ main/src/micro/app.js | 4 +- .../src/store/modules/user.js | 2 +- .../src/views/trace/breeding/coding/index.vue | 70 +++++++++++++------ .../src/views/trace/breeding/quality/form.vue | 8 ++- .../views/trace/breeding/quality/index.vue | 28 ++++---- 6 files changed, 87 insertions(+), 39 deletions(-) create mode 100644 main/.env.development diff --git a/main/.env.development b/main/.env.development new file mode 100644 index 0000000..108a86e --- /dev/null +++ b/main/.env.development @@ -0,0 +1,14 @@ +# 开发环境 +VITE_PORT = 9000 +VITE_APP_NAME = 'daimp-front-main' +VITE_APP_TITLE = '数字农业产业管理平台' +VITE_APP_SUB_OS = '//localhost:9526/sub-operation-service/' +VITE_APP_SUB_ADMIN = '//localhost:9527/sub-admin/' +VITE_APP_SUB_GAS = '//localhost:9528/suv-government-affairs-service/' +# 接口 +VITE_APP_BASE_API = '/apis' +VITE_APP_BASE_URL = 'http://192.168.18.99:8080' +VITE_APP_UPLOAD_API = '/uploadApis' +VITE_APP_UPLOAD_URL = 'http://192.168.18.99:9300' +VITE_APP_SYSTEM_API = '/systemApis' +VITE_APP_SYSTEM_URL = 'http://192.168.18.99:99/stage-api' \ No newline at end of file diff --git a/main/src/micro/app.js b/main/src/micro/app.js index 0932275..0091920 100644 --- a/main/src/micro/app.js +++ b/main/src/micro/app.js @@ -1,11 +1,11 @@ import actions from './actions'; -const { VITE_APP_SUB_VUE, VITE_APP_SUB_ADMIN, VITE_APP_SUB_GAS } = import.meta.env; +const { VITE_APP_SUB_OS, VITE_APP_SUB_ADMIN, VITE_APP_SUB_GAS } = import.meta.env; export const leftApps = [ // { // name: 'sub-operation-service', - // entry: VITE_APP_SUB_VUE, + // entry: VITE_APP_SUB_OS, // activeRule: '/sub-operation-service/', // title: '运营服务', // icon: 'platform/icon-home.png', diff --git a/sub-government-affairs-service/src/store/modules/user.js b/sub-government-affairs-service/src/store/modules/user.js index 6859f8b..a2ce72d 100644 --- a/sub-government-affairs-service/src/store/modules/user.js +++ b/sub-government-affairs-service/src/store/modules/user.js @@ -6,7 +6,7 @@ export const useUserStore = defineStore({ id: GenKey('userStore'), state: () => ({ token: - 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX2tleSI6IjU0ZGVjMzk4LTRhZmQtNDUyOS1hYjFkLTExZGZlZjU5NjJhOSIsInVzZXJuYW1lIjoiYWRtaW4ifQ._bHoqldw4oL_MqZxrHv81ShD3Z0GJYSdWietR1mHAfKluNi3SSs1PRZNrq1v-WTQyXgz1QgsBimPB48iqP7o6Q', + 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX2tleSI6IjA5MzRhYzQ0LWUyZWEtNDNkOS1iYjZiLTg2YzBhOWZmYmJiYyIsInVzZXJuYW1lIjoiYWRtaW4ifQ.43OzhYseqkg5KDD3WyY1xXURyuoX-00MBLrqQVsdH14jfAtL-zPCrMT_WLtHKFicLg9ohTz0oE2nHUYRS-sZBA', userInfo: {}, currentOrg: null, orgList: [], diff --git a/sub-government-affairs-service/src/views/trace/breeding/coding/index.vue b/sub-government-affairs-service/src/views/trace/breeding/coding/index.vue index be49713..98106d2 100644 --- a/sub-government-affairs-service/src/views/trace/breeding/coding/index.vue +++ b/sub-government-affairs-service/src/views/trace/breeding/coding/index.vue @@ -84,14 +84,18 @@ const state = reactive({ label: '溯源码', prop: 'id', search: true, - display: false, + addDisplay: false, + editDisplay: false, + viewDisplay: true, width: 200, }, { label: '采收批次', prop: 'harvestBatch', width: 200, - display: false, + addDisplay: false, + editDisplay: false, + viewDisplay: true, }, { label: '产品名称', @@ -187,8 +191,8 @@ const state = reactive({ rangeSeparator: '至', startPlaceholder: '开始日期', endPlaceholder: '结束日期', - format: 'YYYY-MM-DD HH:mm:ss', - valueFormat: 'YYYY-MM-DD HH:mm:ss', + format: 'YYYY-MM-DD', + valueFormat: 'YYYY-MM-DD', width: 200, hide: true, display: false, @@ -233,7 +237,9 @@ const state = reactive({ { label: '原产地', prop: 'originAddress', - display: false, + addDisplay: false, + editDisplay: false, + viewDisplay: true, overHidden: true, width: 200, }, @@ -243,6 +249,9 @@ const state = reactive({ type: 'cascader', // search: true, hide: true, + addDisplay: true, + editDisplay: true, + viewDisplay: false, props: { label: 'areaName', value: 'areaCode', @@ -264,7 +273,7 @@ const state = reactive({ label: '原产地详细地址', prop: 'originAddressDetail', hide: true, - span: 24, + // span: 24, }, // { // label: '经营主体', @@ -355,6 +364,7 @@ const state = reactive({ // 加载 const loadData = async () => { state.loading = true; + delete state.query.datetime; GetEntityList(state.query) .then((res) => { if (res.code === 200) { @@ -393,11 +403,12 @@ const sizeChange = (size) => { // 搜索 const searchChange = (params, done) => { if (done) done(); - state.query = params; if (params?.datetime) { - state.query.harvestStartTime = params.datetime[0]; - state.query.harvestEndTime = params.datetime[1]; + params.harvestStartTime = params.datetime[0]; + params.harvestEndTime = params.datetime[1]; } + delete params.datetime; + state.query = params; state.query.current = 1; loadData(); }; @@ -442,19 +453,32 @@ const setCity = (row) => { } }; -// const setCityChange = ({ value, dic }) => { -// debugger; -// const labels = []; -// let currentOptions = dic; -// value.forEach((val) => { -// const option = dic.find((item) => item.areaCode === val); -// if (option) { -// labels.push(option.label); -// currentOptions = option.children || []; -// } -// }); -// state.form.originAddress = labels.join(' / '); -// }; +function findLabelByValue(tree = [], targetValue) { + for (let i = 0; i < tree.length; i++) { + const node = tree[i]; + if (node.areaCode === targetValue) { + return node.areaName; + } + if (node.areaChildVOS && node.areaChildVOS.length > 0) { + const result = findLabelByValue(node.areaChildVOS, targetValue); + if (result) { + return result; + } + } + } + return null; +} + +const setCityChange = ({ value, dic }) => { + const labels = []; + value.forEach((val) => { + const label = findLabelByValue(dic, val); + if (label) { + labels.push(label); + } + }); + state.form.originAddress = labels.join(''); +}; // 新增 const rowSave = (row, done, loading) => { @@ -558,7 +582,7 @@ const onUploadExcel = (formData) => { }; const onDownloadExcel = (url) => { - downloadFile(url, `采收赋码-导入模板.xlsx`, 'blob'); + downloadFile(url, `采收赋码-导入模板.xlsx`); }; // 导出 diff --git a/sub-government-affairs-service/src/views/trace/breeding/quality/form.vue b/sub-government-affairs-service/src/views/trace/breeding/quality/form.vue index 1262950..8a10fb3 100644 --- a/sub-government-affairs-service/src/views/trace/breeding/quality/form.vue +++ b/sub-government-affairs-service/src/views/trace/breeding/quality/form.vue @@ -15,6 +15,9 @@ + @@ -32,7 +35,6 @@ const props = defineProps({ }, }); -// const emit = defineEmits(['on-confirm']); const app = useApp(); const formRef = ref(null); const state = reactive({ @@ -41,6 +43,9 @@ const state = reactive({ options: { gutter: 20, labelWidth: 150, + submitText: '保存', + emptyBtn: false, + // menuPosition: 'right', column: [ { label: '采收批次', @@ -183,6 +188,7 @@ watch( () => props.row, (val) => { if (!isEmpty(val)) { + state.form.harvestId = val?.id ?? null; state.form.harvestBatch = val?.harvestBatch ?? null; state.form.productName = val?.productName ?? null; } diff --git a/sub-government-affairs-service/src/views/trace/breeding/quality/index.vue b/sub-government-affairs-service/src/views/trace/breeding/quality/index.vue index 8992543..1d305c2 100644 --- a/sub-government-affairs-service/src/views/trace/breeding/quality/index.vue +++ b/sub-government-affairs-service/src/views/trace/breeding/quality/index.vue @@ -73,7 +73,7 @@ const state = reactive({ label: '溯源码', prop: 'id', search: true, - display: false, + disabled: true, width: 200, }, { @@ -174,8 +174,8 @@ const state = reactive({ rangeSeparator: '至', startPlaceholder: '开始日期', endPlaceholder: '结束日期', - format: 'YYYY-MM-DD HH:mm:ss', - valueFormat: 'YYYY-MM-DD HH:mm:ss', + format: 'YYYY-MM-DD', + valueFormat: 'YYYY-MM-DD', width: 200, hide: true, display: false, @@ -193,6 +193,14 @@ const state = reactive({ trigger: 'blur', }, }, + { + label: '创建时间', + prop: 'createTime', + width: 200, + addDisplay: false, + editDisplay: false, + viewDisplay: true, + }, { label: '质检报告', prop: 'qualityReportUrl', @@ -216,12 +224,6 @@ const state = reactive({ trigger: 'blur', }, }, - { - label: '创建时间', - prop: 'createTime', - width: 200, - display: false, - }, ], actions: [ { @@ -253,6 +255,7 @@ const state = reactive({ // 加载 const loadData = async () => { state.loading = true; + delete state.query.datetime; GetEntityList(state.query) .then((res) => { if (res.code === 200) { @@ -291,11 +294,12 @@ const sizeChange = (size) => { // 搜索 const searchChange = (params, done) => { if (done) done(); - state.query = params; if (params?.datetime) { - state.query.qualityStartTime = params.datetime[0]; - state.query.qualityEndTime = params.datetime[1]; + params.qualityStartTime = params.datetime[0]; + params.qualityEndTime = params.datetime[1]; } + delete params.datetime; + state.query = params; state.query.current = 1; loadData(); };