Compare commits

..

No commits in common. "5fc7e3a76b35c7fb192666ec67b504cdb7f38b69" and "51ce76786cb6afc9ca965b5305fb26bee2d3437e" have entirely different histories.

5 changed files with 52 additions and 75 deletions

View File

@ -4,7 +4,6 @@ VITE_APP_NAME = 'daimp-front-main'
VITE_APP_TITLE = '数字农业产业管理平台' VITE_APP_TITLE = '数字农业产业管理平台'
VITE_APP_SUB_OS = '//localhost:9526/sub-operation-service/' VITE_APP_SUB_OS = '//localhost:9526/sub-operation-service/'
VITE_APP_SUB_OA = '//localhost:9527/sub-operation-admin/' VITE_APP_SUB_OA = '//localhost:9527/sub-operation-admin/'
# VITE_APP_SUB_GAS = 'http://192.168.18.128:9528/sub-government-affairs-service/'
VITE_APP_SUB_GAS = '//localhost:9528/sub-government-affairs-service/' VITE_APP_SUB_GAS = '//localhost:9528/sub-government-affairs-service/'
VITE_APP_SUB_GAA = '//localhost:9525/sub-government-admin/' VITE_APP_SUB_GAA = '//localhost:9525/sub-government-admin/'
VITE_APP_SUB_GSS = '//localhost:9529/sub-government-screen-service/' VITE_APP_SUB_GSS = '//localhost:9529/sub-government-screen-service/'

View File

@ -8,10 +8,13 @@ export function getProduceList(data) {
}); });
} }
/* 新增产出品 */ /* 新增产出品 */
export function addProduceGoods(data = {}) { export function addProduceGoods(data) {
return request('/goods/business/goods/add', { return request('/goods/business/goods/add', {
method: 'POST', method: 'POST',
data: data, headers: {
'Content-Type': 'application/json',
},
data: JSON.stringify(data),
}); });
} }
@ -23,11 +26,11 @@ export function editProduceGoods(data) {
}); });
} }
/* 删除产出品 */ /* 编辑产出品 */
export function delProduceGoods(id) { export function delProduceGoods(data) {
return request(`/goods/business/goods/remove?ids=${id}`, { return request('/goods/business/goods/remove', {
method: 'POST', method: 'POST',
// data, data,
}); });
} }

View File

@ -13,12 +13,12 @@ export default {
component: () => import('@/views/produceGoods/list/index.vue'), component: () => import('@/views/produceGoods/list/index.vue'),
meta: { title: '产出品列表', icon: 'Document' }, meta: { title: '产出品列表', icon: 'Document' },
}, },
// { {
// path: '/sub-government-affairs-service/produceGoods1', path: '/sub-government-affairs-service/produceGoods1',
// name: 'produceGoods1', name: 'produceGoods1',
// component: () => import('@/views/produceGoods/test/index.vue'), component: () => import('@/views/produceGoods/test/index.vue'),
// meta: { title: '投入品监管平台', icon: 'Document' }, meta: { title: '投入品监管平台', icon: 'Document' },
// }, },
], ],
}; };
// export default produceGoodsRoutes; // export default produceGoodsRoutes;

View File

@ -36,8 +36,8 @@
type="date" type="date"
placeholder="请选择种植日期" placeholder="请选择种植日期"
:disabled-date="disabledDate" :disabled-date="disabledDate"
format="YYYY-MM-DD" format="YYYY/MM/DD"
value-format="YYYY-MM-DD" value-format="YYYY/MM/DD"
:size="size" :size="size"
/> />
</template> </template>
@ -102,7 +102,7 @@ const state = reactive({
size: 10, size: 10,
}, },
form: {}, form: {},
selectionRow: [], selection: [],
options: { options: {
...CRUD_OPTIONS, ...CRUD_OPTIONS,
addBtn: false, addBtn: false,
@ -331,12 +331,12 @@ const refreshChange = () => {
// //
const selectionChange = (rows) => { const selectionChange = (rows) => {
state.selectionRow = rows; state.selection = rows;
console.info('selectionChange', state.selectionRow); console.info('selectionChange', state.selection);
}; };
const handleIds = () => { const handleIds = () => {
let datalist = state.selectionRow.map((m) => { let datalist = state.selection.map((m) => {
return { landId: m.landId, landName: m.landName }; return { landId: m.landId, landName: m.landName };
}); });

View File

@ -4,9 +4,9 @@
ref="crudRef" ref="crudRef"
v-model:search="searchCondition" v-model:search="searchCondition"
v-model:page="pageData" v-model:page="pageData"
:table-loading="_loading"
:data :data
:option :option
:loading="_loading"
:before-close="handleCloseDialog" :before-close="handleCloseDialog"
@search-change=" @search-change="
(form, done) => { (form, done) => {
@ -55,7 +55,7 @@ import { getLandsList } from '@/apis/land';
import { ElMessage } from 'element-plus'; import { ElMessage } from 'element-plus';
// import { Download } from '@element-plus/icons-vue'; // import { Download } from '@element-plus/icons-vue';
const { getProduceList, addProduceGoods, editProduceGoods, delProduceGoods, exportProduceGoods } = produceGoodsApi; const { getProduceList, addProduceGoods, editProduceGoods, exportProduceGoods } = produceGoodsApi;
onMounted(async () => { onMounted(async () => {
await getBusiness(); await getBusiness();
await getLands(); await getLands();
@ -65,7 +65,7 @@ onMounted(async () => {
/* --------------- data --------------- */ /* --------------- data --------------- */
// #region // #region
const crudRef = ref(); const crudRef = ref();
const _loading = ref(true); const _loading = ref(false);
const searchCondition = ref({ const searchCondition = ref({
landName: '', landName: '',
quantity: null, quantity: null,
@ -85,8 +85,6 @@ const priceData = ref({
value2: '公斤', value2: '公斤',
}); });
const priceOptions = ref([]); const priceOptions = ref([]);
const lands = ref([]);
const produceMain = ref([]);
const data = ref([]); const data = ref([]);
const option = ref({ const option = ref({
...CRUD_OPTIONS, ...CRUD_OPTIONS,
@ -95,7 +93,7 @@ const option = ref({
{ {
search: true, search: true,
label: '地块名称', label: '地块名称',
prop: 'landId', prop: 'landName',
type: 'select', type: 'select',
dicData: [], dicData: [],
props: { props: {
@ -120,13 +118,9 @@ const option = ref({
], ],
}, },
{ {
label: '产品名称', label: '种植作物',
prop: 'goodsName', prop: 'goodsName',
rules: customRules({ msg: '请输入产品名称' }), // rules: customRules({ msg: '' }),
},
{
label: '产品描述',
prop: 'goodsDesc',
}, },
{ {
label: '种植面积', label: '种植面积',
@ -136,7 +130,7 @@ const option = ref({
}, },
{ {
label: '经营主体', label: '经营主体',
prop: 'producerId', prop: 'producerName',
dicData: [], dicData: [],
props: { props: {
label: 'dictLabel', label: 'dictLabel',
@ -144,7 +138,6 @@ const option = ref({
}, },
type: 'select', type: 'select',
rules: customRules({ msg: '请选择经营主体' }), rules: customRules({ msg: '请选择经营主体' }),
render: ({ row }) => row.producerName,
}, },
{ {
label: '生长周期', label: '生长周期',
@ -181,7 +174,6 @@ const option = ref({
{ {
label: '单价', label: '单价',
prop: 'marketPrice', prop: 'marketPrice',
render: ({ row }) => `${row.marketPrice}${row.priceUnit}/${row.weightUnit}`,
}, },
{ {
label: '创建时间', label: '创建时间',
@ -197,6 +189,7 @@ const actions = reactive([
name: '详情', name: '详情',
icon: 'view', icon: 'view',
event: ({ row }) => { event: ({ row }) => {
// handleCheckRegister(0);
crudRef.value.rowView(row); crudRef.value.rowView(row);
}, },
}, },
@ -204,15 +197,6 @@ const actions = reactive([
name: '编辑', name: '编辑',
icon: 'edit', icon: 'edit',
event: ({ row }) => { event: ({ row }) => {
produceNum.value = {
num: row.quantity * 1,
type: row.unit,
};
priceData.value = {
num: row.marketPrice * 1,
value1: row.priceUnit,
value2: row.weightUnit,
};
crudRef.value.rowEdit(row); crudRef.value.rowEdit(row);
}, },
}, },
@ -220,13 +204,7 @@ const actions = reactive([
type: 'danger', type: 'danger',
name: '删除', name: '删除',
icon: 'delete', icon: 'delete',
event: async ({ row }) => { event: ({ row }) => row,
let res = await delProduceGoods(row.id);
if (res.code == 200) {
ElMessage.success('删除成功');
getData();
}
},
}, },
]); ]);
// #endregion // #endregion
@ -240,7 +218,7 @@ async function getBusiness() {
size: 999, size: 999,
}); });
if (res.code == 200) { if (res.code == 200) {
option.value.column[5].dicData = produceMain.value = res.data.records; option.value.column[4].dicData = res.data.records;
} }
} }
async function getLands() { async function getLands() {
@ -249,8 +227,9 @@ async function getLands() {
size: 999, size: 999,
}); });
if (res.code == 200) { if (res.code == 200) {
option.value.column[0].dicData = lands.value = res.data.records; option.value.column[0].dicData = res.data.records;
} }
console.log('res', res);
} }
async function getPriceUnit() { async function getPriceUnit() {
let res = await GetEntityList({ dictType: 'sys_price_unit', current: 1, size: 999 }); let res = await GetEntityList({ dictType: 'sys_price_unit', current: 1, size: 999 });
@ -274,12 +253,11 @@ async function getData(resetPage) {
current: pageData.value.currentPage, current: pageData.value.currentPage,
size: pageData.value.pageSize, size: pageData.value.pageSize,
...searchCondition.value, ...searchCondition.value,
landName: searchCondition.value.landId,
}; };
let res = await getProduceList(_data); let res = await getProduceList(_data);
if (res.code == 200) { if (res.code == 200) {
data.value = res.data.records; data.value = res.data.records;
console.log('data', res); console.log('data', data.value);
pageData.value.total = res.data.total; pageData.value.total = res.data.total;
} }
_loading.value = false; _loading.value = false;
@ -288,29 +266,26 @@ function handleCloseDialog(done) {
done(); done();
} }
function handleData(val) { function handleData(val) {
let obj = Object.assign({}, val); let _data = Object.assign({}, val);
let _data = { return {
landId: obj.landId, // id: _data.id,
producerId: obj.producerId, landName: _data.landName,
growthCycle: obj.growthCycle, producerName: _data.producerName,
qualityGrade: obj.qualityGrade, growthCycle: _data.growthCycle,
goodsName: obj.goodsName, qualityGrade: _data.qualityGrade,
goodsDesc: obj.goodsDesc, goodsName: _data.goodsName,
plantingId: '0', plantingId: '0',
plantingName: 'test',
quantity: produceNum.value.num, quantity: produceNum.value.num,
unit: produceNum.value.type, unit: produceNum.value.type,
marketPrice: priceData.value.num, marketPrice: priceData.value.num,
priceUnit: priceData.value.value1, priceUnit: priceData.value.value1,
weightUnit: priceData.value.value2, weightUnit: priceData.value.value2,
}; };
_data.landName = lands.value.find((v) => v.id == obj.landId).landName;
_data.producerName = produceMain.value.find((v) => v.dictValue == obj.producerId).dictLabel;
if (obj.id) _data.id = obj.id;
return _data;
} }
async function handleRowSave(row, done, loading) { async function handleRowSave(row, done, loading) {
let res = await addProduceGoods(handleData(row)); let _data = handleData(row);
console.log(_data);
let res = await addProduceGoods(_data);
loading(); loading();
if (res.code == 200) { if (res.code == 200) {
ElMessage.success('保存成功'); ElMessage.success('保存成功');
@ -319,13 +294,13 @@ async function handleRowSave(row, done, loading) {
done(); done();
} }
async function handleRowUpdate(row, index, done, loading) { async function handleRowUpdate(row, index, done, loading) {
let res = await editProduceGoods(handleData(row)); // let data = handleData(row);
loading(); // let res;
console.log('res'); // loading();
if (res.code == 200) { // if (res.code == 200) {
ElMessage.success(`编辑成功`); // ElMessage.success(`${basicInfo.value ? '' : ''}`);
getData(); // getData();
} // }
done(); done();
} }
// async function handleExport() { // async function handleExport() {