diff --git a/.env.development b/.env.development index 1244d0b..7dc61fc 100644 --- a/.env.development +++ b/.env.development @@ -1,3 +1,3 @@ -VITE_BASE_URL=http://localhost:12080/admin-api +VITE_BASE_URL=http://192.168.0.106:12080/admin-api VITE_BASE_URL_IMAGE=http://localhost:12080/admin-api \ No newline at end of file diff --git a/src/pages/overhaulOrder/addForm.vue b/src/pages/overhaulOrder/addForm.vue index 07fa3ad..8dc2eea 100644 --- a/src/pages/overhaulOrder/addForm.vue +++ b/src/pages/overhaulOrder/addForm.vue @@ -107,14 +107,15 @@ const faultType = ref([]) const isDisabled = ref(false) const choosesingleColumnItem = ref([]) + const msg = ref('') function submit() { // 校验 if (!form.value.describes) { proxy.$modal.showToast('请输入故障描述') return; } - if (!form.value.deviceNumber) { - proxy.$modal.showToast('请选择设备名称或者维修工单') + if (!form.value.deviceName) { + proxy.$modal.showToast(msg.value) return; } if (!form.value.faultType) { @@ -248,6 +249,7 @@ type: type.value }).then((res) => { if (!res.data) { + msg.value = res.msg form.value.deviceName = '' form.value.factoryAreaName = '' form.value.factoryAreaNumber = '' @@ -256,7 +258,9 @@ form.value.deviceName = res.data.name form.value.factoryAreaName = res.data.factoryAreaName form.value.factoryAreaNumber = res.data.factoryAreaNumber - }).catch(() => { + }).catch((error) => { + console.log(error) + msg.value = error.msg form.value.deviceName = '' form.value.factoryAreaName = '' form.value.factoryAreaNumber = '' @@ -265,7 +269,9 @@ moldApi.getMoldDetailsByNumber({ number: form.value.deviceNumber }).then((res) => { + console.log(22,res) if (!res.data) { + msg.value = res.msg form.value.deviceName = '' form.value.factoryAreaName = '' form.value.factoryAreaNumber = '' @@ -274,7 +280,9 @@ form.value.deviceName = res.data.name form.value.factoryAreaName = res.data.factoryAreaName form.value.factoryAreaNumber = res.data.factoryAreaNumber - }).catch(() => { + }).catch((error) => { + console.log(error) + msg.value = error.msg form.value.deviceName = '' form.value.factoryAreaName = '' form.value.factoryAreaNumber = '' diff --git a/src/pages/repairOrder/addForm.vue b/src/pages/repairOrder/addForm.vue index 26f1966..b9a33d8 100644 --- a/src/pages/repairOrder/addForm.vue +++ b/src/pages/repairOrder/addForm.vue @@ -94,8 +94,11 @@ import * as moldApi from "@/api/mold.js" import * as dictApi from "@/api/dict.js" import * as repairOrderApi from "@/api/repairOrder.js" - + import { useCountStore } from '@/store' + const { proxy } = getCurrentInstance() + // 获取自定义的store + const store = useCountStore() const loading = ref(false) const appDeviceMoldType = ref([]) @@ -316,6 +319,7 @@ } } + const appDeviceMoldType1 = ref([]) onLoad(async option => { if (option.type) type.value = option.type; if (option.data) { @@ -334,17 +338,26 @@ }; await getDeviceList() maintenanceShift.value = await dictApi.getDict('maintenance_shift') - appDeviceMoldType.value = await dictApi.getDict('app_device_mold_type') - + appDeviceMoldType1.value = await dictApi.getDict('app_device_mold_type') + faultType.value = await dictApi.getDict('fault_type') if (type.value == 'MOLD') { - appDeviceMoldType.value = appDeviceMoldType.value.filter((item => item.value == "MOLD")) + appDeviceMoldType.value = appDeviceMoldType1.value.filter((item => item.value == "MOLD")) } else { - appDeviceMoldType.value = appDeviceMoldType.value.filter((item => item.value != "MOLD")) + appDeviceMoldType.value = [] + + if(store.roles.some(item=>item.indexOf('device')>-1)){ + appDeviceMoldType.value = appDeviceMoldType1.value.filter((item => item.value == "DEVICE")) + } + if(store.roles.some(item=>item.indexOf('tech')>-1)){ + appDeviceMoldType.value = appDeviceMoldType1.value.filter((item => item.value == "TECH")) + } + if(store.roles.some(item=>item.indexOf('tech')>-1&&item.indexOf('device')>-1)){ + appDeviceMoldType.value = appDeviceMoldType1.value.filter((item => item.value != "MOLD")) + } } form.value.type = appDeviceMoldType.value[0].value form.value.typeName = appDeviceMoldType.value[0].label - faultType.value = await dictApi.getDict('fault_type') }) diff --git a/src/store/modules/countStore.ts b/src/store/modules/countStore.ts index b9e18b4..2f2bf5f 100644 --- a/src/store/modules/countStore.ts +++ b/src/store/modules/countStore.ts @@ -119,9 +119,9 @@ const useStore = defineStore('storeId', { this.id = ''// 用户编号 this.name = '' this.avatar = '' - this.roles = '' this.permissions = '' this.role = '' + this.roles = [] this.post = '' this.dept = '' removeToken()