feat
This commit is contained in:
		
							parent
							
								
									a4ef348840
								
							
						
					
					
						commit
						3f46e067fb
					
				| @ -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; | ||||||
|  | |||||||
| @ -1,23 +1,23 @@ | |||||||
| import request from '@/utils/axios'; | import request from '@/utils/axios'; | ||||||
| 
 | 
 | ||||||
| export function getUseSuperviseList(params) { | export function getUseSuperviseList(params) { | ||||||
|   return request('/inputGoogs/supervise/list', { |   return request('/inputGoods/supervise/page', { | ||||||
|     params, |     params, | ||||||
|   }); |   }); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function delUseSupervise(ids) { | export function delUseSupervise(ids) { | ||||||
|   return request(`/inputGoogs/supervise/delete/${ids}`); |   return request(`/inputGoods/supervise/delete/${ids}`); | ||||||
| } | } | ||||||
| export function addUseSupervise(data) { | export function addUseSupervise(data) { | ||||||
|   return request('/inputGoogs/supervise/save', { |   return request('/inputGoods/supervise/save', { | ||||||
|     method: 'POST', |     method: 'POST', | ||||||
|     data, |     data, | ||||||
|   }); |   }); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function editUseSupervise(data) { | export function editUseSupervise(data) { | ||||||
|   return request('/inputGoogs/supervise/edit', { |   return request('/inputGoods/supervise/edit', { | ||||||
|     method: 'PUT', |     method: 'PUT', | ||||||
|     data, |     data, | ||||||
|   }); |   }); | ||||||
|  | |||||||
| @ -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> | ||||||
|  | |||||||
| @ -20,21 +20,25 @@ | |||||||
|       @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'; | import inputSuppliesApi from '@/apis/inputSuppliesApi'; | ||||||
| import assistFn from '@/views/inputSuppliesManage/hooks/useAssistFn'; | import assistFn from '@/views/inputSuppliesManage/hooks/useAssistFn'; | ||||||
|  | import Attrs from '@/views/inputSuppliesManage/common/Attrs.vue'; | ||||||
| const { deleteFn } = new assistFn(); | const { deleteFn } = new assistFn(); | ||||||
| const { getUseSpuserviseList, delUseSupdervise, addUseSupdervise, editUseSupdervise } = inputSuppliesApi; | const { getUseSuperviseList, delUseSupdervise, addUseSupdervise, editUseSupdervise } = inputSuppliesApi; | ||||||
| const { loadFinish, materialTypes } = useBasicInfo(); | const { loadFinish, materialTypes } = useBasicInfo(); | ||||||
| 
 | 
 | ||||||
| watch( | watch( | ||||||
| @ -45,6 +49,7 @@ watch( | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
| ); | ); | ||||||
|  | onMounted(getData); | ||||||
| /* --------------- data --------------- */ | /* --------------- data --------------- */ | ||||||
| // #region | // #region | ||||||
| const crudRef = ref(null); | const crudRef = ref(null); | ||||||
| @ -93,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: [ | ||||||
| @ -144,31 +164,28 @@ 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 --------------- */ | ||||||
| @ -177,14 +194,16 @@ async function getData(reset = 1) { | |||||||
|   _loading.value = true; |   _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 getUseSpuserviseList({ |   let res = await getUseSuperviseList({ | ||||||
|     page: pageData.value.currentPage, |     current: pageData.value.currentPage, | ||||||
|     size: pageData.value.pageSize, |     size: pageData.value.pageSize, | ||||||
|     dataType: searchCondition.value.searchType, |     dataType: searchCondition.value.searchType, | ||||||
|     name: searchCondition.value.keywords, |     name: searchCondition.value.keywords, | ||||||
|   }); |   }); | ||||||
|   _loading.value = false; |   _loading.value = false; | ||||||
|   if (res.code == 200) { |   if (res.code == 200) { | ||||||
|  |     data.value = res.data.records; | ||||||
|  |     pageData.value.total = res.data.total; | ||||||
|     console.log('res', res); |     console.log('res', res); | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user