feat
This commit is contained in:
		
							parent
							
								
									bf0b232f66
								
							
						
					
					
						commit
						0a8586b97e
					
				| @ -72,12 +72,12 @@ const inputSuppliesRoutes = [ | ||||
|       //   component: () => import('@/views/inputSuppliesManage/enterpriseDealerCheck/index.vue'),
 | ||||
|       //   meta: { title: '企业经销商抽检', icon: 'Document' },
 | ||||
|       // },
 | ||||
|       // {
 | ||||
|       //   path: '/sub-government-affairs-service/useSupervise',
 | ||||
|       //   name: 'useSupervise',
 | ||||
|       //   component: () => import('@/views/inputSuppliesManage/useSupervise/index.vue'),
 | ||||
|       //   meta: { title: '使用监管', icon: 'Document' },
 | ||||
|       // },
 | ||||
|       { | ||||
|         path: '/sub-government-affairs-service/useSupervise', | ||||
|         name: 'useSupervise', | ||||
|         component: () => import('@/views/inputSuppliesManage/useSupervise/index.vue'), | ||||
|         meta: { title: '使用监管', icon: 'Document' }, | ||||
|       }, | ||||
|       { | ||||
|         path: '/sub-government-affairs-service/leaseSupervise', | ||||
|         name: 'leaseSupervise', | ||||
|  | ||||
| @ -30,7 +30,6 @@ | ||||
| <script setup> | ||||
| import { ref, reactive, onMounted } from 'vue'; | ||||
| import { CRUD_OPTIONS } from '@/config'; | ||||
| import { size } from 'lodash'; | ||||
| 
 | ||||
| onMounted(getData); | ||||
| 
 | ||||
|  | ||||
| @ -49,8 +49,8 @@ export function useBasicInfo(set = {}) { | ||||
|         materialTypes[moduleType].push(...handleTypes(children)); | ||||
|         handleTwoLevel(); | ||||
|       }); | ||||
|       console.log('materialTypes --- ', materialTypes); | ||||
|       console.log('materialTwoLevel --- ', materialTwoLevel); | ||||
|       // console.log('materialTypes --- ', materialTypes);
 | ||||
|       // console.log('materialTwoLevel --- ', materialTwoLevel);
 | ||||
|     } | ||||
|     loadFinish.value = true; | ||||
|     let t = setInterval(() => { | ||||
|  | ||||
| @ -58,7 +58,7 @@ | ||||
| </template> | ||||
| 
 | ||||
| <script setup> | ||||
| import { ref, reactive, onMounted, watch, h } from 'vue'; | ||||
| import { ref, reactive, onMounted, watch } from 'vue'; | ||||
| import TypeMenu from '../../common/TypeMenu.vue'; | ||||
| import { CRUD_OPTIONS, pageData, customRules } from '@/config'; | ||||
| import { useBasicInfo } from '@/views/inputSuppliesManage/hooks/useBasicInfo'; | ||||
|  | ||||
| @ -1,18 +1,198 @@ | ||||
| <template> | ||||
|   <section class="custom-page">使用监管 </section> | ||||
|   <section class="custom-page"> | ||||
|     <avue-crud | ||||
|       ref="crudRef" | ||||
|       v-model:search="searchCondition" | ||||
|       v-model:page="pageData" | ||||
|       :table-loading="_loading" | ||||
|       :option="option" | ||||
|       :data="data" | ||||
|       @search-change=" | ||||
|         (form, done) => { | ||||
|           getData(1); | ||||
|           done(); | ||||
|         } | ||||
|       " | ||||
|       @search-reset="getData(1)" | ||||
|       @refresh-change="getData" | ||||
|       @current-change="getData" | ||||
|       @size-change="getData(1)" | ||||
|       @row-save="handleRowSave" | ||||
|       @row-update="handleRowUpdate" | ||||
|     > | ||||
|       <template #land-form="{ type }"> | ||||
|         <section if="type == 'add'">地块</section> | ||||
|       </template> | ||||
|     </avue-crud> | ||||
|   </section> | ||||
| </template> | ||||
| 
 | ||||
| <script setup> | ||||
| import { ref } from 'vue'; | ||||
| import { reactive, ref, watch } from 'vue'; | ||||
| import { CRUD_OPTIONS, pageData } from '@/config'; | ||||
| import { useBasicInfo } from '@/views/inputSuppliesManage/hooks/useBasicInfo'; | ||||
| 
 | ||||
| const { loadFinish, materialTwoLevel, materialTypes } = useBasicInfo(); | ||||
| 
 | ||||
| watch( | ||||
|   () => loadFinish.value, | ||||
|   (bol) => { | ||||
|     if (loadFinish.value) { | ||||
|       console.log('material', materialTypes); | ||||
|     } | ||||
|   } | ||||
| ); | ||||
| /* --------------- data --------------- */ | ||||
| // #region | ||||
| 
 | ||||
| const crudRef = ref(null); | ||||
| const _loading = ref(true); | ||||
| const searchCondition = ref({ | ||||
|   searchType: '', | ||||
|   keywords: '', | ||||
| }); | ||||
| const types = reactive([ | ||||
|   { label: '农药监管', value: '1' }, | ||||
|   { label: '肥料监管', value: '2' }, | ||||
|   { label: '兽药监管', value: '3' }, | ||||
| ]); | ||||
| const data = ref([{}]); | ||||
| const option = ref({ | ||||
|   ...CRUD_OPTIONS, | ||||
|   selection: false, | ||||
|   dialogWidth: '50%', | ||||
|   column: [ | ||||
|     { | ||||
|       hide: true, | ||||
|       search: true, | ||||
|       addDisplay: false, | ||||
|       editDisplay: false, | ||||
|       label: '物资类型', | ||||
|       prop: 'searchType', | ||||
|       type: 'select', | ||||
|       dicData: types, | ||||
|     }, | ||||
|     { | ||||
|       hide: true, | ||||
|       search: true, | ||||
|       addDisplay: false, | ||||
|       editDisplay: false, | ||||
|       label: '关键字', | ||||
|       prop: 'keywords', | ||||
|     }, | ||||
|     { | ||||
|       editDisabled: true, | ||||
|       label: '物资类型', | ||||
|       prop: 'dataType', | ||||
|       type: 'select', | ||||
|       dicData: types, | ||||
|       clearable: false, | ||||
|       value: '1', | ||||
|       change: handleTypeChange, | ||||
|     }, | ||||
|     { | ||||
|       label: '姓名', | ||||
|       prop: 'name', | ||||
|     }, | ||||
|     { | ||||
|       label: '联系方式', | ||||
|       prop: 'phone', | ||||
|     }, | ||||
|     { | ||||
|       label: '投入品名称', | ||||
|       prop: 'materialName', | ||||
|     }, | ||||
|     { | ||||
|       label: '分类', | ||||
|       prop: 'type', | ||||
|       type: 'cascader', | ||||
|       dicData: [], | ||||
|     }, | ||||
|     { | ||||
|       label: '购买量', | ||||
|       prop: 't1', | ||||
|     }, | ||||
|     { | ||||
|       label: '购买时间', | ||||
|       prop: 't2', | ||||
|     }, | ||||
|     { | ||||
|       label: '使用量', | ||||
|       prop: 't3', | ||||
|     }, | ||||
|     { | ||||
|       label: '使用时间', | ||||
|       prop: 't4', | ||||
|     }, | ||||
|     { | ||||
|       label: '使用对象', | ||||
|       prop: 't5', | ||||
|     }, | ||||
|     { | ||||
|       label: '关联地块', | ||||
|       prop: 'land', | ||||
|     }, | ||||
|   ], | ||||
|   group: [ | ||||
|     { | ||||
|       label: '农药检测', | ||||
|       prop: 'pesticide', | ||||
|       // addDisplay: false, | ||||
|       // editDisplay: false, | ||||
|       column: [ | ||||
|         { | ||||
|           label: '检测时间', | ||||
|           prop: 'checkTime', | ||||
|           span: 24, | ||||
|           type: 'date', | ||||
|           valueFormat: 'yyyy-MM-dd', | ||||
|           format: 'yyyy-MM-dd', | ||||
|         }, | ||||
|         { | ||||
|           label: '检测结果', | ||||
|           prop: 'result', | ||||
|           span: 24, | ||||
|         }, | ||||
|         { | ||||
|           label: '投入品名称', | ||||
|           prop: 'unit', | ||||
|           span: 24, | ||||
|         }, | ||||
|         { | ||||
|           label: '检测报告', | ||||
|           prop: 'report', | ||||
|           span: 24, | ||||
|         }, | ||||
|       ], | ||||
|     }, | ||||
|   ], | ||||
| }); | ||||
| // #endregion | ||||
| 
 | ||||
| /* --------------- methods --------------- */ | ||||
| // #region | ||||
| function getData(reset = 1) { | ||||
|   reset == 1 && (pageData.value.currentPage = 1); | ||||
|   console.log('get data'); | ||||
| } | ||||
| function handleTypeChange(val) { | ||||
|   console.log( | ||||
|     'dicData', | ||||
|     materialTypes[val.value].filter((v) => v.value != '0') | ||||
|   ); | ||||
|   option.value.column[6].dicData = materialTypes[val.value].filter((v) => v.value != '0'); | ||||
| } | ||||
| function handleData(val) { | ||||
|   console.log('handleData', val); | ||||
| } | ||||
| function handleRowSave(row, done, laoding) { | ||||
|   handleData(row); | ||||
|   laoding(); | ||||
| } | ||||
| 
 | ||||
| function handleRowUpdate(row, index, done, loading) { | ||||
|   handleData(row); | ||||
|   loading(); | ||||
| } | ||||
| // #endregion | ||||
| </script> | ||||
| 
 | ||||
|  | ||||
| @ -76,12 +76,12 @@ import { ref, reactive, onMounted, watch } from 'vue'; | ||||
| import { CRUD_OPTIONS } from '@/config'; | ||||
| import { useUserStore } from '@/store/modules/user'; | ||||
| import { getLandsList, exportLands, delLand, saveLand, importLands, editLand } from '@/apis/land.js'; | ||||
| import { getRegion } from '@/apis'; | ||||
| import { ElMessage } from 'element-plus'; | ||||
| import useLandHook from './useLandHook'; | ||||
| import Attrs from './common/Attrs.vue'; | ||||
| import { getAssetsFile, downloadFile } from '@/utils'; | ||||
| import { useApp } from '@/hooks'; | ||||
| import { get } from 'lodash'; | ||||
| 
 | ||||
| const app = useApp(); | ||||
| const { loadFinish, resetLandType, searchCondition, unitOptions, unitValue, landTreeDic } = useLandHook(); | ||||
| @ -93,6 +93,7 @@ watch( | ||||
|   () => { | ||||
|     if (loadFinish.value == 2) { | ||||
|       getList(); | ||||
|       handleGetRegion(); | ||||
|     } | ||||
|   } | ||||
| ); | ||||
| @ -257,11 +258,10 @@ const option = reactive({ | ||||
|             value: 'id', | ||||
|             label: 'gridName', | ||||
|           }, | ||||
|           dicMethod: 'get', | ||||
|           dicHeaders: { | ||||
|             authorization: UserStore.token, | ||||
|           }, | ||||
|           dicFormatter: (res) => res?.data?.records ?? [], | ||||
|           dicFormatter: handleGetGrid, | ||||
|           rules: [ | ||||
|             { | ||||
|               required: true, | ||||
| @ -271,7 +271,7 @@ const option = reactive({ | ||||
|           ], | ||||
|         }, | ||||
|         { | ||||
|           label: '用地分类', | ||||
|           label: '用地分类1', | ||||
|           prop: 'landTypeId', | ||||
|           type: 'cascader', | ||||
|           dicData: landTreeDic, | ||||
| @ -288,21 +288,17 @@ const option = reactive({ | ||||
|           label: '用地分类', | ||||
|           prop: 'landClassificationType', | ||||
|           addDisplay: false, | ||||
|           editDisplay: false, | ||||
|         }, | ||||
|         { | ||||
|           label: '位置', | ||||
|           prop: 'villageCode', | ||||
|           prop: '_villageCode', | ||||
|           type: 'cascader', | ||||
|           props: { | ||||
|             label: 'areaName', | ||||
|             value: 'areaCode', | ||||
|             children: 'areaChildVOS', | ||||
|           }, | ||||
|           dicUrl: `${VITE_APP_BASE_API}/system/area/region?areaCode=530000`, | ||||
|           dicHeaders: { | ||||
|             authorization: UserStore.token, | ||||
|           }, | ||||
|           dicFormatter: (res) => res.data ?? [], | ||||
|           rules: [ | ||||
|             { | ||||
|               required: true, | ||||
| @ -331,6 +327,7 @@ const option = reactive({ | ||||
|           label: '是否土地流转', | ||||
|           prop: 'isTransferView', | ||||
|           addDisplay: false, | ||||
|           editDisplay: false, | ||||
|         }, | ||||
|         { | ||||
|           label: '面积', | ||||
| @ -450,6 +447,7 @@ const landOwnerAttrs = ref([]); | ||||
| const landAttrs = ref([]); | ||||
| const rowData = ref([]); | ||||
| const importExcelRef = ref(); | ||||
| const regionData = ref([]); | ||||
| // #endregion | ||||
| 
 | ||||
| /* --------------- methods --------------- */ | ||||
| @ -473,15 +471,39 @@ async function getList(reset = 1) { | ||||
|     const { total, records } = res.data; | ||||
|     data.value = records; | ||||
|     data.value.forEach((v) => { | ||||
|       v.isTransfer = v.landTransfer || 1; | ||||
|       v.isTransferView = v.landTransfer == 1 ? '否' : '是'; | ||||
|       v.isTransfer = v.landTransfer || '1'; | ||||
|       v.isTransferView = v.landTransfer == '1' ? '否' : '是'; | ||||
|       v.coordinateView = v.coordinate; | ||||
|       v.soilTypeName = v.soilType; | ||||
|       v.soilTypeId = v.soilId; | ||||
|       v._villageCode = handleArea(v); | ||||
|       v.landTypeId = [v.pid, v.landType]; | ||||
|       console.log('vvv', v); | ||||
|     }); | ||||
|     pageData.value.total = total; | ||||
|   } | ||||
| } | ||||
| function handleGetGrid(res) { | ||||
|   console.log('res', res); | ||||
|   return res.records ?? []; | ||||
| } | ||||
| async function handleGetRegion() { | ||||
|   let res = await getRegion(); | ||||
|   if (res.code == 200) { | ||||
|     option.group[0].column[5]; | ||||
|   } | ||||
|   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; | ||||
| @ -525,7 +547,7 @@ function handleDelete(id) { | ||||
|     .catch(() => {}); | ||||
| } | ||||
| function handleView(obj) { | ||||
|   handleAttrs(obj); | ||||
|   handleOtherInfo(obj); | ||||
|   rowData.value = obj; | ||||
|   crudRef.value.rowView(obj); | ||||
| } | ||||
| @ -559,27 +581,30 @@ 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._villageCode.length - 1] || ''; | ||||
|   data.landTypeId = data.landTypeId[data.landTypeId.length - 1]; | ||||
|   data.soilType = data.soilTypeId; | ||||
|   if (local.value.length != 0) { | ||||
|     data.coordinate = `${local.value[0]}E,${local.value[1]}N`; | ||||
|   } | ||||
|   delete data.address; | ||||
|   delete data.provinceCode; | ||||
|   delete data.cityCode; | ||||
|   delete data.county; | ||||
|   delete data.townCode; | ||||
|   return data; | ||||
| } | ||||
| async function handleRowSave(val, done, loading) { | ||||
|   console.log('save', val); | ||||
|   let data = handleData(val); | ||||
|   console.log('save -data', data); | ||||
|   // const res = await saveLand(data); | ||||
|   const res = await saveLand(data); | ||||
|   loading(); | ||||
|   // if (res.code == 200) { | ||||
|   //   ElMessage.success('保存成功'); | ||||
|   //   getList(); | ||||
|   //   attrs.value = []; | ||||
|   //   landOwnerAttrs.value = []; | ||||
|   //   done(); | ||||
|   // } | ||||
|   if (res.code == 200) { | ||||
|     ElMessage.success('保存成功'); | ||||
|     getList(); | ||||
|     attrs.value = []; | ||||
|     landOwnerAttrs.value = []; | ||||
|     done(); | ||||
|   } | ||||
| } | ||||
| async function handleRowUpdate(form, index, done, loading) { | ||||
|   let data = handleData(form); | ||||
| @ -591,12 +616,15 @@ async function handleRowUpdate(form, index, done, loading) { | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| async function rowEdit(obj) { | ||||
|   console.log('rowEdit', obj); | ||||
|   handleAttrs(obj); | ||||
|   crudRef.value.rowEdit(obj); | ||||
| async function rowEdit(row) { | ||||
|   console.log('rowEdit', row); | ||||
|   handleOtherInfo(row); | ||||
|   crudRef.value.rowEdit(row); | ||||
| } | ||||
| function handleAttrs(obj) { | ||||
| 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 { | ||||
|  | ||||
| @ -522,6 +522,7 @@ const rowEdit = (row) => { | ||||
| }; | ||||
| const rowUpdate = (row, index, done, loading) => { | ||||
|   delete row.base64; | ||||
|   console.log('row', row); | ||||
|   setCity(row); | ||||
|   UpdateEntity(row) | ||||
|     .then((res) => { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user