feat
This commit is contained in:
		
							parent
							
								
									bf0b232f66
								
							
						
					
					
						commit
						0a8586b97e
					
				| @ -72,12 +72,12 @@ const inputSuppliesRoutes = [ | |||||||
|       //   component: () => import('@/views/inputSuppliesManage/enterpriseDealerCheck/index.vue'),
 |       //   component: () => import('@/views/inputSuppliesManage/enterpriseDealerCheck/index.vue'),
 | ||||||
|       //   meta: { title: '企业经销商抽检', icon: 'Document' },
 |       //   meta: { title: '企业经销商抽检', icon: 'Document' },
 | ||||||
|       // },
 |       // },
 | ||||||
|       // {
 |       { | ||||||
|       //   path: '/sub-government-affairs-service/useSupervise',
 |         path: '/sub-government-affairs-service/useSupervise', | ||||||
|       //   name: 'useSupervise',
 |         name: 'useSupervise', | ||||||
|       //   component: () => import('@/views/inputSuppliesManage/useSupervise/index.vue'),
 |         component: () => import('@/views/inputSuppliesManage/useSupervise/index.vue'), | ||||||
|       //   meta: { title: '使用监管', icon: 'Document' },
 |         meta: { title: '使用监管', icon: 'Document' }, | ||||||
|       // },
 |       }, | ||||||
|       { |       { | ||||||
|         path: '/sub-government-affairs-service/leaseSupervise', |         path: '/sub-government-affairs-service/leaseSupervise', | ||||||
|         name: 'leaseSupervise', |         name: 'leaseSupervise', | ||||||
|  | |||||||
| @ -30,7 +30,6 @@ | |||||||
| <script setup> | <script setup> | ||||||
| import { ref, reactive, onMounted } from 'vue'; | import { ref, reactive, onMounted } from 'vue'; | ||||||
| import { CRUD_OPTIONS } from '@/config'; | import { CRUD_OPTIONS } from '@/config'; | ||||||
| import { size } from 'lodash'; |  | ||||||
| 
 | 
 | ||||||
| onMounted(getData); | onMounted(getData); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -49,8 +49,8 @@ export function useBasicInfo(set = {}) { | |||||||
|         materialTypes[moduleType].push(...handleTypes(children)); |         materialTypes[moduleType].push(...handleTypes(children)); | ||||||
|         handleTwoLevel(); |         handleTwoLevel(); | ||||||
|       }); |       }); | ||||||
|       console.log('materialTypes --- ', materialTypes); |       // console.log('materialTypes --- ', materialTypes);
 | ||||||
|       console.log('materialTwoLevel --- ', materialTwoLevel); |       // console.log('materialTwoLevel --- ', materialTwoLevel);
 | ||||||
|     } |     } | ||||||
|     loadFinish.value = true; |     loadFinish.value = true; | ||||||
|     let t = setInterval(() => { |     let t = setInterval(() => { | ||||||
|  | |||||||
| @ -58,7 +58,7 @@ | |||||||
| </template> | </template> | ||||||
| 
 | 
 | ||||||
| <script setup> | <script setup> | ||||||
| import { ref, reactive, onMounted, watch, h } from 'vue'; | import { ref, reactive, onMounted, watch } from 'vue'; | ||||||
| import TypeMenu from '../../common/TypeMenu.vue'; | import TypeMenu from '../../common/TypeMenu.vue'; | ||||||
| import { CRUD_OPTIONS, pageData, customRules } from '@/config'; | import { CRUD_OPTIONS, pageData, customRules } from '@/config'; | ||||||
| import { useBasicInfo } from '@/views/inputSuppliesManage/hooks/useBasicInfo'; | import { useBasicInfo } from '@/views/inputSuppliesManage/hooks/useBasicInfo'; | ||||||
|  | |||||||
| @ -1,18 +1,198 @@ | |||||||
| <template> | <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> | </template> | ||||||
| 
 | 
 | ||||||
| <script setup> | <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 --------------- */ | /* --------------- data --------------- */ | ||||||
| // #region | // #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 | // #endregion | ||||||
| 
 | 
 | ||||||
| /* --------------- methods --------------- */ | /* --------------- methods --------------- */ | ||||||
| // #region | // #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 | // #endregion | ||||||
| </script> | </script> | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -76,12 +76,12 @@ import { ref, reactive, onMounted, watch } from 'vue'; | |||||||
| import { CRUD_OPTIONS } from '@/config'; | import { CRUD_OPTIONS } from '@/config'; | ||||||
| import { useUserStore } from '@/store/modules/user'; | import { useUserStore } from '@/store/modules/user'; | ||||||
| import { getLandsList, exportLands, delLand, saveLand, importLands, editLand } from '@/apis/land.js'; | import { getLandsList, exportLands, delLand, saveLand, importLands, editLand } from '@/apis/land.js'; | ||||||
|  | import { getRegion } from '@/apis'; | ||||||
| import { ElMessage } from 'element-plus'; | import { ElMessage } from 'element-plus'; | ||||||
| import useLandHook from './useLandHook'; | import useLandHook from './useLandHook'; | ||||||
| import Attrs from './common/Attrs.vue'; | import Attrs from './common/Attrs.vue'; | ||||||
| import { getAssetsFile, downloadFile } from '@/utils'; | import { getAssetsFile, downloadFile } from '@/utils'; | ||||||
| import { useApp } from '@/hooks'; | import { useApp } from '@/hooks'; | ||||||
| import { get } from 'lodash'; |  | ||||||
| 
 | 
 | ||||||
| const app = useApp(); | const app = useApp(); | ||||||
| const { loadFinish, resetLandType, searchCondition, unitOptions, unitValue, landTreeDic } = useLandHook(); | const { loadFinish, resetLandType, searchCondition, unitOptions, unitValue, landTreeDic } = useLandHook(); | ||||||
| @ -93,6 +93,7 @@ watch( | |||||||
|   () => { |   () => { | ||||||
|     if (loadFinish.value == 2) { |     if (loadFinish.value == 2) { | ||||||
|       getList(); |       getList(); | ||||||
|  |       handleGetRegion(); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| ); | ); | ||||||
| @ -257,11 +258,10 @@ const option = reactive({ | |||||||
|             value: 'id', |             value: 'id', | ||||||
|             label: 'gridName', |             label: 'gridName', | ||||||
|           }, |           }, | ||||||
|           dicMethod: 'get', |  | ||||||
|           dicHeaders: { |           dicHeaders: { | ||||||
|             authorization: UserStore.token, |             authorization: UserStore.token, | ||||||
|           }, |           }, | ||||||
|           dicFormatter: (res) => res?.data?.records ?? [], |           dicFormatter: handleGetGrid, | ||||||
|           rules: [ |           rules: [ | ||||||
|             { |             { | ||||||
|               required: true, |               required: true, | ||||||
| @ -271,7 +271,7 @@ const option = reactive({ | |||||||
|           ], |           ], | ||||||
|         }, |         }, | ||||||
|         { |         { | ||||||
|           label: '用地分类', |           label: '用地分类1', | ||||||
|           prop: 'landTypeId', |           prop: 'landTypeId', | ||||||
|           type: 'cascader', |           type: 'cascader', | ||||||
|           dicData: landTreeDic, |           dicData: landTreeDic, | ||||||
| @ -288,21 +288,17 @@ const option = reactive({ | |||||||
|           label: '用地分类', |           label: '用地分类', | ||||||
|           prop: 'landClassificationType', |           prop: 'landClassificationType', | ||||||
|           addDisplay: false, |           addDisplay: false, | ||||||
|  |           editDisplay: false, | ||||||
|         }, |         }, | ||||||
|         { |         { | ||||||
|           label: '位置', |           label: '位置', | ||||||
|           prop: 'villageCode', |           prop: '_villageCode', | ||||||
|           type: 'cascader', |           type: 'cascader', | ||||||
|           props: { |           props: { | ||||||
|             label: 'areaName', |             label: 'areaName', | ||||||
|             value: 'areaCode', |             value: 'areaCode', | ||||||
|             children: 'areaChildVOS', |             children: 'areaChildVOS', | ||||||
|           }, |           }, | ||||||
|           dicUrl: `${VITE_APP_BASE_API}/system/area/region?areaCode=530000`, |  | ||||||
|           dicHeaders: { |  | ||||||
|             authorization: UserStore.token, |  | ||||||
|           }, |  | ||||||
|           dicFormatter: (res) => res.data ?? [], |  | ||||||
|           rules: [ |           rules: [ | ||||||
|             { |             { | ||||||
|               required: true, |               required: true, | ||||||
| @ -331,6 +327,7 @@ const option = reactive({ | |||||||
|           label: '是否土地流转', |           label: '是否土地流转', | ||||||
|           prop: 'isTransferView', |           prop: 'isTransferView', | ||||||
|           addDisplay: false, |           addDisplay: false, | ||||||
|  |           editDisplay: false, | ||||||
|         }, |         }, | ||||||
|         { |         { | ||||||
|           label: '面积', |           label: '面积', | ||||||
| @ -450,6 +447,7 @@ const landOwnerAttrs = ref([]); | |||||||
| const landAttrs = ref([]); | const landAttrs = ref([]); | ||||||
| const rowData = ref([]); | const rowData = ref([]); | ||||||
| const importExcelRef = ref(); | const importExcelRef = ref(); | ||||||
|  | const regionData = ref([]); | ||||||
| // #endregion | // #endregion | ||||||
| 
 | 
 | ||||||
| /* --------------- methods --------------- */ | /* --------------- methods --------------- */ | ||||||
| @ -473,15 +471,39 @@ async function getList(reset = 1) { | |||||||
|     const { total, records } = res.data; |     const { total, records } = res.data; | ||||||
|     data.value = records; |     data.value = records; | ||||||
|     data.value.forEach((v) => { |     data.value.forEach((v) => { | ||||||
|       v.isTransfer = v.landTransfer || 1; |       v.isTransfer = v.landTransfer || '1'; | ||||||
|       v.isTransferView = v.landTransfer == 1 ? '否' : '是'; |       v.isTransferView = v.landTransfer == '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.landTypeId = [v.pid, v.landType]; | ||||||
|  |       console.log('vvv', v); | ||||||
|     }); |     }); | ||||||
|     pageData.value.total = total; |     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) { | function handleSizeChange(val) { | ||||||
|   pageData.value.pageSize = val; |   pageData.value.pageSize = val; | ||||||
| @ -525,7 +547,7 @@ function handleDelete(id) { | |||||||
|     .catch(() => {}); |     .catch(() => {}); | ||||||
| } | } | ||||||
| function handleView(obj) { | function handleView(obj) { | ||||||
|   handleAttrs(obj); |   handleOtherInfo(obj); | ||||||
|   rowData.value = obj; |   rowData.value = obj; | ||||||
|   crudRef.value.rowView(obj); |   crudRef.value.rowView(obj); | ||||||
| } | } | ||||||
| @ -559,27 +581,30 @@ 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._villageCode.length - 1] || ''; | ||||||
|   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) { | ||||||
|     data.coordinate = `${local.value[0]}E,${local.value[1]}N`; |     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; |   return data; | ||||||
| } | } | ||||||
| async function handleRowSave(val, done, loading) { | async function handleRowSave(val, done, loading) { | ||||||
|   console.log('save', val); |  | ||||||
|   let data = handleData(val); |   let data = handleData(val); | ||||||
|   console.log('save -data', data); |   const res = await saveLand(data); | ||||||
|   // const res = await saveLand(data); |  | ||||||
|   loading(); |   loading(); | ||||||
|   // if (res.code == 200) { |   if (res.code == 200) { | ||||||
|   //   ElMessage.success('保存成功'); |     ElMessage.success('保存成功'); | ||||||
|   //   getList(); |     getList(); | ||||||
|   //   attrs.value = []; |     attrs.value = []; | ||||||
|   //   landOwnerAttrs.value = []; |     landOwnerAttrs.value = []; | ||||||
|   //   done(); |     done(); | ||||||
|   // } |   } | ||||||
| } | } | ||||||
| async function handleRowUpdate(form, index, done, loading) { | async function handleRowUpdate(form, index, done, loading) { | ||||||
|   let data = handleData(form); |   let data = handleData(form); | ||||||
| @ -591,12 +616,15 @@ async function handleRowUpdate(form, index, done, loading) { | |||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| async function rowEdit(obj) { | async function rowEdit(row) { | ||||||
|   console.log('rowEdit', obj); |   console.log('rowEdit', row); | ||||||
|   handleAttrs(obj); |   handleOtherInfo(row); | ||||||
|   crudRef.value.rowEdit(obj); |   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) { |   if (obj.propertyCertificateUrl) { | ||||||
|     attrs.value = obj.propertyCertificateUrl.split(',').map((v, i) => { |     attrs.value = obj.propertyCertificateUrl.split(',').map((v, i) => { | ||||||
|       return { |       return { | ||||||
|  | |||||||
| @ -522,6 +522,7 @@ const rowEdit = (row) => { | |||||||
| }; | }; | ||||||
| const rowUpdate = (row, index, done, loading) => { | const rowUpdate = (row, index, done, loading) => { | ||||||
|   delete row.base64; |   delete row.base64; | ||||||
|  |   console.log('row', row); | ||||||
|   setCity(row); |   setCity(row); | ||||||
|   UpdateEntity(row) |   UpdateEntity(row) | ||||||
|     .then((res) => { |     .then((res) => { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user