Compare commits

...

6 Commits

6 changed files with 111 additions and 46 deletions

View File

@ -45,6 +45,7 @@ const errorHandler = async (error) => {
* 请求拦截器
*/
publicAxios.interceptors.request.use(async (config) => {
console.log('config', config);
const UserStore = useUserStore();
if (UserStore.hasToken()) {
config.headers['authorization'] = config.headers['authorization'] ?? UserStore.token;

View File

@ -3,6 +3,7 @@ import * as materialApi from './material';
import * as knowledgeApi from './knowledge';
import * as leaseSuperviseApi from './leaseSupervise';
import * as productionDealerApi from './productionDealer';
import * as useSuperviseApi from './useSupervise';
export default {
...materialApi,
@ -10,4 +11,5 @@ export default {
...knowledgeApi,
...leaseSuperviseApi,
...productionDealerApi,
...useSuperviseApi,
};

View File

@ -0,0 +1,24 @@
import request from '@/utils/axios';
export function getUseSuperviseList(params) {
return request('/inputGoods/supervise/page', {
params,
});
}
export function delUseSupervise(ids) {
return request(`/inputGoods/supervise/delete/${ids}`);
}
export function addUseSupervise(data) {
return request('/inputGoods/supervise/save', {
method: 'POST',
data,
});
}
export function editUseSupervise(data) {
return request('/inputGoods/supervise/edit', {
method: 'PUT',
data,
});
}

View File

@ -27,7 +27,9 @@
<el-button type="primary" @click="handleInfo(row)">详情</el-button>
<el-button @click="deleteFn(row.id, delSeed, getData)">删除</el-button>
</template>
<template #photoUrl-form="{ type }"> <Attrs v-model:attrs="attrs" :type="type == 'add' ? 'add' : 'view'" :limit="2" /> </template>
<template #photoUrl-form="{ type }">
<Attrs v-model:attrs="attrs" :type="type == 'add' ? 'add' : 'view'" :limit="2" />
</template>
</avue-crud>
</section>
</template>

View File

@ -20,19 +20,26 @@
@row-save="handleRowSave"
@row-update="handleRowUpdate"
>
<template #land-form="{ type }">
<!-- <template #land-form="{ type }">
<section if="type == 'add'">地块</section>
</template> -->
<template #report-form="type">
<Attrs v-model:attrs="attrs" :type="type" />
</template>
</avue-crud>
</section>
</template>
<script setup>
import { reactive, ref, watch } from 'vue';
import { CRUD_OPTIONS, pageData } from '@/config';
import { reactive, ref, watch, onMounted } from 'vue';
import { CRUD_OPTIONS, pageData, customRules } from '@/config';
import { useBasicInfo } from '@/views/inputSuppliesManage/hooks/useBasicInfo';
const { loadFinish, materialTwoLevel, materialTypes } = useBasicInfo();
import inputSuppliesApi from '@/apis/inputSuppliesApi';
import assistFn from '@/views/inputSuppliesManage/hooks/useAssistFn';
import Attrs from '@/views/inputSuppliesManage/common/Attrs.vue';
const { deleteFn } = new assistFn();
const { getUseSuperviseList, delUseSupdervise, addUseSupdervise, editUseSupdervise } = inputSuppliesApi;
const { loadFinish, materialTypes } = useBasicInfo();
watch(
() => loadFinish.value,
@ -42,6 +49,7 @@ watch(
}
}
);
onMounted(getData);
/* --------------- data --------------- */
// #region
const crudRef = ref(null);
@ -90,46 +98,61 @@ const option = ref({
change: handleTypeChange,
},
{
label: '名',
label: '',
prop: 'name',
rules: customRules({ msg: '请输入名称' }),
},
{
label: '联系方式',
prop: 'phone',
rules: customRules({ msg: '请输入联系方式' }),
},
{
label: '投入品名称',
prop: 'materialName',
prop: 'inputName',
rules: customRules({ msg: '请输入投入品名称' }),
},
{
label: '分类',
prop: 'type',
prop: 'classifyId',
type: 'cascader',
dicData: [],
rules: customRules({ msg: '请选择分类' }),
},
{
label: '购买量',
prop: 't1',
prop: 'buyNumber',
rules: customRules({ msg: '请输入购买量' }),
},
{
label: '购买时间',
prop: 't2',
type: 'date',
format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD',
prop: 'buyTime',
rules: customRules({ msg: '请选择购买时间' }),
},
{
label: '使用量',
prop: 't3',
prop: 'useNumber',
rules: customRules({ msg: '请输入使用量' }),
},
{
label: '使用时间',
prop: 't4',
format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD',
prop: 'useTime',
rules: customRules({ msg: '请选择使用时间' }),
},
{
label: '使用对象',
prop: 't5',
prop: 'useObject',
rules: customRules({ msg: '请输入使用对象' }),
},
{
label: '关联地块',
prop: 'land',
prop: 'landName',
rules: customRules({ msg: '请输入地块名称' }),
},
],
group: [
@ -141,38 +164,48 @@ const option = ref({
column: [
{
label: '检测时间',
prop: 'checkTime',
span: 24,
prop: 'detectionTime',
type: 'date',
valueFormat: 'yyyy-MM-dd',
format: 'yyyy-MM-dd',
},
{
label: '检测结果',
prop: 'result',
span: 24,
prop: 'detectionResult',
},
{
label: '投入品名称',
prop: 'unit',
span: 24,
prop: 'detectionUnit',
},
{
label: '检测报告',
prop: 'report',
span: 24,
},
],
},
],
});
const attrs = ref([]);
// #endregion
/* --------------- methods --------------- */
// #region
function getData(reset = 1) {
async function getData(reset = 1) {
_loading.value = true;
reset == 1 && (pageData.value.currentPage = 1);
console.log('get data');
let res = await getUseSuperviseList({
current: pageData.value.currentPage,
size: pageData.value.pageSize,
dataType: searchCondition.value.searchType,
name: searchCondition.value.keywords,
});
_loading.value = false;
if (res.code == 200) {
data.value = res.data.records;
pageData.value.total = res.data.total;
console.log('res', res);
}
}
function handleTypeChange(val) {
console.log(

View File

@ -37,13 +37,16 @@
<el-button type="success" icon="download" @click="handleExport">导出</el-button>
<el-button type="success" icon="upload" @click="onUpload">导入</el-button>
</template>
<template #area-form>
<section class="area_form_">
<template #area-form="{ type }">
<section v-show="type != 'view'" class="area_form_">
<el-input-number v-model="landArea" :precision="2" :step="1" :min="1" controls-position="right"></el-input-number>
<el-select v-model="unitValue">
<el-option v-for="item in unitOptions" :key="'unitOptions_' + item.value" :label="item.label" :value="item.label" />
</el-select>
</section>
<section v-show="type == 'view'">
{{ landArea + unitValue }}
</section>
</template>
<template #propertyCertificateUrl-form="{ type }">
<Attrs v-model:attrs="attrs" :type="type" />
@ -269,9 +272,10 @@ const option = reactive({
trigger: 'blur',
},
],
change: handleChangeGrid,
},
{
label: '用地分类1',
label: '用地分类',
prop: 'landTypeId',
type: 'cascader',
dicData: landTreeDic,
@ -306,6 +310,14 @@ const option = reactive({
trigger: 'blur',
},
],
viewDisplay: false,
},
{
hide: true,
label: '位置',
prop: 'address',
addDisplay: false,
editDisplay: false,
},
{
label: '是否土地流转',
@ -476,35 +488,27 @@ async function getList(reset = 1) {
v.coordinateView = v.coordinate;
v.soilTypeName = v.soilType;
v.soilTypeId = v.soilId;
v._villageCode = handleArea(v);
v._villageCode = v.villageCode;
v.landTypeId = [v.pid, v.landType];
console.log('vvv', v);
});
pageData.value.total = total;
}
}
function handleGetGrid(res) {
console.log('res', res);
return res.records ?? [];
return res?.data?.records ?? [];
}
function handleChangeGrid(val) {
val.item && filterArea(val.item.townCode);
}
function filterArea(id) {
option.group[0].column[4].dicData = regionData.value.find((v) => v.areaCode == id)?.areaChildVOS ?? [];
}
async function handleGetRegion() {
let res = await getRegion();
if (res.code == 200) {
option.group[0].column[5];
regionData.value = res?.data?.[0].areaChildVOS?.[0].areaChildVOS?.[0].areaChildVOS ?? [];
}
console.log('region', res);
}
function handleArea(v) {
const { provinceCode, cityCode, county, townCode, villageCode } = v;
let _area = [provinceCode, cityCode, county, townCode, villageCode];
let _arr = [];
for (let i = 0; i < _area.length; i++) {
if (!_area[i]) return;
_arr.push(_area[i]);
}
return _arr;
}
function handleSizeChange(val) {
pageData.value.pageSize = val;
getList();
@ -581,7 +585,7 @@ function handleData(val) {
data.propertyCertificateUrl = urls.join();
data.landCertificateUrl = landOwnerUrls.join();
data.landUrl = landUrls.join();
data.villageCode = data._villageCode[data._villageCode.length - 1] || '';
data.villageCode = data._villageCode;
data.landTypeId = data.landTypeId[data.landTypeId.length - 1];
data.soilType = data.soilTypeId;
if (local.value.length != 0) {
@ -617,14 +621,13 @@ async function handleRowUpdate(form, index, done, loading) {
}
async function rowEdit(row) {
console.log('rowEdit', row);
handleOtherInfo(row);
filterArea(row.townCode);
crudRef.value.rowEdit(row);
}
function handleOtherInfo(obj) {
landArea.value = obj.area;
unitValue.value = obj.landUnit;
console.log('option', obj._villageCode, option.group[0].column[4]);
if (obj.propertyCertificateUrl) {
attrs.value = obj.propertyCertificateUrl.split(',').map((v, i) => {
return {