374 lines
		
	
	
		
			7.2 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			374 lines
		
	
	
		
			7.2 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| /*
 | |
|  * @Date: 2021-01-21 18:08:29
 | |
|  * @LastEditors: zwq
 | |
|  * @LastEditTime: 2022-02-24 14:55:06
 | |
|  * @FilePath: \basic-admin\src\api\dict\index.js
 | |
|  * @Description: 数据字典定义
 | |
|  */
 | |
| // import request from '@/utils/request'
 | |
| import { requestWithCache } from '@/utils/request'
 | |
| 
 | |
| // 获取设备列表列表
 | |
| export function getDictDevice(data) {
 | |
|   return requestWithCache({
 | |
|     url: '/api/wms/equipment/page',
 | |
|     method: 'post',
 | |
|     data
 | |
|   }).then(res => {
 | |
|     if (res.code === 0) {
 | |
|       return res.data.records
 | |
|     } else {
 | |
|       return []
 | |
|     }
 | |
|   })
 | |
| }
 | |
| 
 | |
| // 获取设备类型列表
 | |
| export function getDictDeviceType(data) {
 | |
|   return requestWithCache({
 | |
|     url: '/common/data-dictionary/equipmentTypeList',
 | |
|     method: 'post',
 | |
|     data
 | |
|   }).then(res => {
 | |
|     if (res.code === 0) {
 | |
|       return res.data
 | |
|     } else {
 | |
|       return []
 | |
|     }
 | |
|   })
 | |
| }
 | |
| 
 | |
| // 获取物料列表
 | |
| export function getDictBom(data) {
 | |
|   return requestWithCache({
 | |
|     url: '/api/wms/material/page',
 | |
|     method: 'post',
 | |
|     data
 | |
|   }).then(res => {
 | |
|     if (res.code === 0) {
 | |
|       return res.data.records
 | |
|     } else {
 | |
|       return []
 | |
|     }
 | |
|   })
 | |
| }
 | |
| 
 | |
| // 获取供应商列表
 | |
| export function getDictSupplier(data) {
 | |
|   return requestWithCache({
 | |
|     url: '/common/data-dictionary/supplierList',
 | |
|     method: 'post',
 | |
|     data
 | |
|   }).then(res => {
 | |
|     if (res.code === 0) {
 | |
|       return res.data
 | |
|     } else {
 | |
|       return []
 | |
|     }
 | |
|   })
 | |
| }
 | |
| 
 | |
| // 获取单位列表
 | |
| export function getDictUnit(data) {
 | |
|   return requestWithCache({
 | |
|     url: '/api/wms/platform-dict/selectPlatformDictDataListByPage',
 | |
|     method: 'post',
 | |
|     data: {
 | |
|       current: 1,
 | |
|       size: 999,
 | |
|       dictTypeId: '1392033901169348609'
 | |
|     }
 | |
|   }).then(res => {
 | |
|     if (res.code === 0) {
 | |
|       return res.data
 | |
|     } else {
 | |
|       return []
 | |
|     }
 | |
|   })
 | |
| }
 | |
| 
 | |
| // 获取物料列表
 | |
| export function getDictMaterial(data) {
 | |
|   return requestWithCache({
 | |
|     url: '/material/material-date/materialList',
 | |
|     method: 'post',
 | |
|     data
 | |
|   }).then(res => {
 | |
|     if (res.code === 0) {
 | |
|       return res.data
 | |
|     } else {
 | |
|       return []
 | |
|     }
 | |
|   })
 | |
| }
 | |
| 
 | |
| // 获取维修类型
 | |
| export function getDictRepairType(data) {
 | |
|   return requestWithCache({
 | |
|     url: '/api/wms/maintenance-type/page',
 | |
|     method: 'post',
 | |
|     data: {
 | |
|       current: 1,
 | |
|       enabled: 1,
 | |
|       size: 999
 | |
|     }
 | |
|   }).then(res => {
 | |
|     if (res.code === 0) {
 | |
|       return res.data.records.map(item => {
 | |
|         return {
 | |
|           id: item.id,
 | |
|           name: item.name
 | |
|         }
 | |
|       })
 | |
|     } else {
 | |
|       return []
 | |
|     }
 | |
|   })
 | |
| }
 | |
| 
 | |
| // 获取员工列表
 | |
| export function getDictWorker() {
 | |
|   return requestWithCache({
 | |
|     url: '/api/wms/worker/page',
 | |
|     method: 'post',
 | |
|     data: {
 | |
|       current: 1,
 | |
|       size: 999
 | |
|     }
 | |
|   }).then(res => {
 | |
|     if (res.code === 0) {
 | |
|       return res.data.records.map(item => {
 | |
|         return {
 | |
|           id: item.id,
 | |
|           name: item.name,
 | |
|           telephone: item.telephone ? item.telephone : ''
 | |
|         }
 | |
|       })
 | |
|     } else {
 | |
|       return []
 | |
|     }
 | |
|   })
 | |
| }
 | |
| 
 | |
| // 获取基础备品备件列表
 | |
| export function getDictSparepart(data) {
 | |
|   return requestWithCache({
 | |
|     url: '/api/wms/tool-spare-part/page',
 | |
|     method: 'post',
 | |
|     data: {
 | |
|       current: 1,
 | |
|       size: 999
 | |
|     }
 | |
|   }).then(res => {
 | |
|     if (res.code === 0) {
 | |
|       return res.data.records.map(item => {
 | |
|         return {
 | |
|           id: item.id,
 | |
|           name: item.name + (item.model ? ' - ' + item.model : '')
 | |
|         }
 | |
|       })
 | |
|     } else {
 | |
|       return []
 | |
|     }
 | |
|   })
 | |
| }
 | |
| 
 | |
| // 获取备件型号
 | |
| export function getDictModel(data) {
 | |
|   return requestWithCache({
 | |
|     url: '/api/wms/tool-spare-part/list',
 | |
|     method: 'post',
 | |
|     data: {
 | |
|       current: 1,
 | |
|       size: 999,
 | |
|       ...data
 | |
|     }
 | |
|   }).then(res => {
 | |
|     if (res.code === 0) {
 | |
|       return res.data.records.map(item => {
 | |
|         return {
 | |
|           id: item.id,
 | |
|           name: item.name
 | |
|         }
 | |
|       })
 | |
|     } else {
 | |
|       return []
 | |
|     }
 | |
|   })
 | |
| }
 | |
| 
 | |
| // 质量---报废: 报废原因
 | |
| export function scrapReasonList(data) {
 | |
|   return requestWithCache({
 | |
|     url: '/api/wms/scrap-information/page',
 | |
|     method: 'post',
 | |
|     data: {
 | |
|       current: 1,
 | |
|       size: 999
 | |
|     }
 | |
|   }).then(res => {
 | |
|     if (res.code === 0) {
 | |
|       return res.data.records.map(item => {
 | |
|         return {
 | |
|           id: item.id,
 | |
|           name: item.scrap
 | |
|         }
 | |
|       })
 | |
|     } else {
 | |
|       return []
 | |
|     }
 | |
|   })
 | |
| }
 | |
| 
 | |
| // 获取故障等级
 | |
| export function faultLevelList(data) {
 | |
|   return requestWithCache({
 | |
|     url: '/common/data-dictionary-business/findAllByTypeOrCategory',
 | |
|     method: 'post',
 | |
|     subname: 'faultLevelList',
 | |
|     data: {
 | |
|       current: 1,
 | |
|       dataCategory: '故障',
 | |
|       dataType: '状况',
 | |
|       enabled: 1,
 | |
|       size: 999
 | |
|     }
 | |
|   }).then(res => {
 | |
|     if (res.code === 0) {
 | |
|       return res.data.records.map(item => {
 | |
|         return {
 | |
|           id: item.id,
 | |
|           name: item.dataValue
 | |
|         }
 | |
|       })
 | |
|     } else {
 | |
|       return []
 | |
|     }
 | |
|   })
 | |
| }
 | |
| 
 | |
| // 获取保养周期
 | |
| export function maintainPeriod(data) {
 | |
|   return requestWithCache({
 | |
|     url: '/api/wms/platform-dict/selectPlatformDictDataListByPage',
 | |
|     method: 'post',
 | |
|     data: {
 | |
|       current: 1,
 | |
|       enabled: 1,
 | |
|       size: 999,
 | |
|       dictTypeId: '1393406291017252866'
 | |
|     }
 | |
|   }).then(res => {
 | |
|     if (res.code === 0) {
 | |
|       return res.data.records.map(item => {
 | |
|         return {
 | |
|           id: item.id,
 | |
|           name: item.dataName
 | |
|         }
 | |
|       })
 | |
|     } else {
 | |
|       return []
 | |
|     }
 | |
|   })
 | |
| }
 | |
| 
 | |
| // 质量检测计划 获取检测频率
 | |
| export function detectionPeriod(data) {
 | |
|   return requestWithCache({
 | |
|     url: '/common/data-dictionary-business/findAllByTypeOrCategory',
 | |
|     method: 'post',
 | |
|     subname: 'detectionPeriod',
 | |
|     data: {
 | |
|       current: 1,
 | |
|       dataCategory: '时间',
 | |
|       dataType: '频率',
 | |
|       enabled: 1,
 | |
|       size: 999
 | |
|     }
 | |
|   }).then(res => {
 | |
|     if (res.code === 0) {
 | |
|       return res.data.records.map(item => {
 | |
|         return {
 | |
|           id: item.id,
 | |
|           name: item.dataValue
 | |
|         }
 | |
|       })
 | |
|     } else {
 | |
|       return []
 | |
|     }
 | |
|   })
 | |
| }
 | |
| 
 | |
| // 获取设备类型的参数
 | |
| export function equipmentTypeParam(id) {
 | |
|   return requestWithCache({
 | |
|     url: '/equipment/equipment-parameter/findAllByIdOrName',
 | |
|     method: 'post',
 | |
|     data: {
 | |
|       current: 1,
 | |
|       equipmentTypeId: id,
 | |
|       size: 999
 | |
|     }
 | |
|   }).then(res => {
 | |
|     if (res.code === 0) {
 | |
|       return res.data.records.map(item => {
 | |
|         return {
 | |
|           id: item.id,
 | |
|           name: item.paramName
 | |
|         }
 | |
|       })
 | |
|     } else {
 | |
|       return []
 | |
|     }
 | |
|   })
 | |
| }
 | |
| 
 | |
| // 获取设备状态
 | |
| 
 | |
| export function statusList(id) {
 | |
|   return requestWithCache({
 | |
|     url: '/api/wms/configure-display/page',
 | |
|     method: 'post',
 | |
|     data: {
 | |
|       current: 1,
 | |
|       size: 999
 | |
|     }
 | |
|   }).then(res => {
 | |
|     if (res.code === 0) {
 | |
|       return res.data.records.map(item => {
 | |
|         return {
 | |
|           id: item.id,
 | |
|           name: item.status
 | |
|         }
 | |
|       })
 | |
|     } else {
 | |
|       return []
 | |
|     }
 | |
|   })
 | |
| }
 | |
| 
 | |
| // 获取角色列表
 | |
| export function workerRoleList() {
 | |
|   return requestWithCache({
 | |
|     url: '/api/wms/platform-dict/selectPlatformDictDataListByPage',
 | |
|     method: 'post',
 | |
|     data: {
 | |
|       dictTypeId: '1383318968677273601',
 | |
|       current: 1,
 | |
|       size: 999
 | |
|     }
 | |
|   }).then(res => {
 | |
|     if (res.code === 0) {
 | |
|       return res.data.records.map(item => {
 | |
|         return {
 | |
|           id: item.id,
 | |
|           name: item.dataName
 | |
|         }
 | |
|       })
 | |
|     } else {
 | |
|       return []
 | |
|     }
 | |
|   })
 | |
| }
 | |
| 
 |