diff --git a/src/pages.json b/src/pages.json index 147037a..e197c82 100644 --- a/src/pages.json +++ b/src/pages.json @@ -695,10 +695,15 @@ "navigationStyle": "custom", "navigationBarTextStyle": "white" } + }, + { + "path": "pages/mes/RawMaterialForm/index", + "style": { + "navigationBarTitleText": "原料填报", + "navigationStyle": "custom", + "navigationBarTextStyle": "white" + } } - - - ], "globalStyle": { "navigationBarTextStyle": "black", diff --git a/src/pages/mes/RawMaterialForm/index.vue b/src/pages/mes/RawMaterialForm/index.vue new file mode 100644 index 0000000..23701e0 --- /dev/null +++ b/src/pages/mes/RawMaterialForm/index.vue @@ -0,0 +1,278 @@ + + + + + diff --git a/src/pages/mes/RawMaterialForm/model.ts b/src/pages/mes/RawMaterialForm/model.ts new file mode 100644 index 0000000..30f568c --- /dev/null +++ b/src/pages/mes/RawMaterialForm/model.ts @@ -0,0 +1,17 @@ +import http from '@/utils/requestDatam'; + +export function getProductByCode(code: string): Promise { + return http.get('/nongyao/productInfoByCode?code=' + code); +} + +export function getIngredientByRegistrationNo(registrationNo: string): Promise { + return http.get('/nongyao/ingredientInfoByRegistrationNo?registrationNo=' + registrationNo); +} + +export function getSupplierByIngredientCode(ingredientCode: string): Promise { + return http.get('/nongyao/supplierInfoByIngredientCode?ingredientCode=' + ingredientCode); +} + +export function productIngredientSupplierSubmit(params: any): Promise { + return http.post('/nongyao/productIngredientSupplierSubmit', params); +} diff --git a/src/pages/mes/index.vue b/src/pages/mes/index.vue index e159ab6..33cf81c 100644 --- a/src/pages/mes/index.vue +++ b/src/pages/mes/index.vue @@ -30,6 +30,29 @@ + + + + + 原料 + + + + + + @@ -42,9 +65,10 @@ export default class RawAppointment extends BasePage { childData: any; menuList = session.getMenus; newmenuList: any = []; + newmenuList2: any = []; onReady() { this.newmenuList = this.menuList.filter((item) => item.perms == 'mesCh'); - console.log('1234', this.menuList); + this.newmenuList2 = this.menuList.filter((item) => item.perms == 'mesYl'); } } diff --git a/src/utils/page.ts b/src/utils/page.ts index 6cf81dc..6571f87 100644 --- a/src/utils/page.ts +++ b/src/utils/page.ts @@ -16,6 +16,7 @@ export const page = { ProductionQtyInspDetail: '/pages/mes/ProductionQtyInsp/detail', ChangePalletNew: '/pages/mes/ChangePalletNew/index', EmptyEflux: '/pages/mes/EmptyEflux/index', + RawMaterialForm: '/pages/mes/RawMaterialForm/index', }, shouye: '/pages/shouye/index', me: '/pages/shouye/me', diff --git a/src/utils/requestDatam.ts b/src/utils/requestDatam.ts new file mode 100644 index 0000000..bf6653e --- /dev/null +++ b/src/utils/requestDatam.ts @@ -0,0 +1,91 @@ +import Request from 'luch-request'; +import Vue from 'vue'; + +// 创建实例 +const request = new Request({ + baseURL: 'http://192.168.0.224:8082/data-service/api/', + timeout: 10000, + header: { + 'Content-Type': 'application/json', + apiToken: 'VtkIwAZkwguhcxOnazlDrPsTu64bQ1NC', + }, +}); + +// 请求拦截器 +request.interceptors.request.use( + (config) => { + // 显示加载提示 + uni.showLoading({ + title: '加载中...', + mask: true, + }); + return config; + }, + (error) => { + // 隐藏加载提示 + uni.hideLoading(); + return Promise.reject(error); + }, +); + +// 响应拦截器 +request.interceptors.response.use( + (response) => { + // 隐藏加载提示 + uni.hideLoading(); + if (response.data.msg === 'success') { + return response.data.data.rowData; + } + uni.showToast({ + title: '请求失败', + icon: 'none', + duration: 2000, + }); + return Promise.reject('请求错误'); + }, + (error) => { + // 隐藏加载提示 + uni.hideLoading(); + + // 错误处理 + uni.showToast({ + title: error.message || '请求失败', + icon: 'none', + duration: 2000, + }); + return Promise.reject(error); + }, +); + +// 定义请求方法类型 +interface RequestOptions { + url: string; + data?: any; + params?: any; + method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'OPTIONS'; + header?: any; +} + +// 封装请求方法 +const http = { + request: (options: RequestOptions) => { + return request.request(options); + }, + get: (url: string, params?: any, header?: any) => { + return request.get(url, { params, header }); + }, + post: (url: string, data?: any, header?: any) => { + return request.post(url, data, { header }); + }, + put: (url: string, data?: any, header?: any) => { + return request.put(url, data, { header }); + }, + delete: (url: string, data?: any, header?: any) => { + return request.delete(url, { data, header }); + }, +}; + +// 挂载到Vue原型 +Vue.prototype.$http = http; + +export default http;