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) => { publicAxios.interceptors.request.use(async (config) => {
console.log('config', config);
const UserStore = useUserStore(); const UserStore = useUserStore();
if (UserStore.hasToken()) { if (UserStore.hasToken()) {
config.headers['authorization'] = config.headers['authorization'] ?? UserStore.token; 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 knowledgeApi from './knowledge';
import * as leaseSuperviseApi from './leaseSupervise'; import * as leaseSuperviseApi from './leaseSupervise';
import * as productionDealerApi from './productionDealer'; import * as productionDealerApi from './productionDealer';
import * as useSuperviseApi from './useSupervise';
export default { export default {
...materialApi, ...materialApi,
@ -10,4 +11,5 @@ export default {
...knowledgeApi, ...knowledgeApi,
...leaseSuperviseApi, ...leaseSuperviseApi,
...productionDealerApi, ...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 type="primary" @click="handleInfo(row)">详情</el-button>
<el-button @click="deleteFn(row.id, delSeed, getData)">删除</el-button> <el-button @click="deleteFn(row.id, delSeed, getData)">删除</el-button>
</template> </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> </avue-crud>
</section> </section>
</template> </template>

View File

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

View File

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