Browse Source

需求:NZKO-694,NZKO-695;内容:资产台账添加,备件申领加备件和设备的筛选功能

master
ljlong_2630 3 months ago
parent
commit
b45ae38eb9
  1. 4
      src/api/device.ts
  2. 5
      src/api/mold.ts
  3. 243
      src/components/device/slectDeviceList.vue
  4. 11
      src/components/item/slectItemList.vue
  5. 3
      src/pages/repairOrder/addServiceRecord.vue
  6. 141
      src/pages/sparePartsApplication/addForm.vue

4
src/api/device.ts

@ -23,4 +23,8 @@ export function getSubList(params) {
// 新增申领备件时获取备件列表 // 新增申领备件时获取备件列表
export function getApplyDeviceList() { export function getApplyDeviceList() {
return http.get('/eam/device-accounts/selectAll') return http.get('/eam/device-accounts/selectAll')
}
// 设备分页列表
export function selectAllByParams(params) {
return http.get('/eam/device-accounts/selectAllByParams',{params})
} }

5
src/api/mold.ts

@ -18,4 +18,9 @@ export function moldList(params) {
// 新增申领备件时获取模具列表 // 新增申领备件时获取模具列表
export function getApplyMoldList() { export function getApplyMoldList() {
return http.get('/eam/item-accounts/selectAll') return http.get('/eam/item-accounts/selectAll')
}
// 新增申领备件时获取模具列表
export function getAllMoldByParams(data) {
return http.post('/eam/mold-accounts/noPage',data)
} }

243
src/components/device/slectDeviceList.vue

@ -0,0 +1,243 @@
<template>
<!-- 选择设备或模具 -->
<u-popup v-model="props.isShowSelectDevice" mode="center" border-radius="14">
<view class="popup-title">选择{{ deviceType }}</view>
<view class="popup">
<u-search placeholder="搜索" v-model="form1.searchName" @change="searchDevice"></u-search>
<view class="list">
<view class="device" v-for="(device, index) in singleColumnList" :key="index" @click="chooseDevice(device)">
<u-checkbox v-model="device.checked" shape="circle" style="margin-top: 8rpx;"></u-checkbox>
<view class="right">
<view class="device-name">
名称: <span>{{device.name}}</span>
</view>
<view class="device-dec">
型号: <span>{{device.specification}}</span>
</view>
<view class="device-dec">
{{ deviceType === 'DEVICE' ? '设备编号' : '模具编号' }}: <span>{{device.number}}</span>
</view>
</view>
</view>
</view>
</view>
<view class="popup-footer">
<view @click="chooseDevice1(0)">取消</view>
<view class="sure" @click="chooseDevice1(1)">确认</view>
</view>
</u-popup>
</template>
<script setup lang="ts">
import {
ref,
defineProps,
defineEmits,
getCurrentInstance,
watch
} from 'vue'
import {
onLoad,
} from '@dcloudio/uni-app'
const props = defineProps({
isShowSelectDevice: {
type: Boolean,
default: () => { return false },
require: true
},
singleColumnList: {
type: Array,
default: () => { return [] },
require: false
},
deviceType: {
type: String,
default: 'DEVICE',
require: true
}
});
// isShowSelectDevice
watch(() => props.isShowSelectDevice, (newValue, oldValue) => {
if (newValue) {
console.log('props.isShowSelectDevice', props.isShowSelectDevice);
form1.value.searchName = null
form1.value.temporarilyNumber = null
form1.value.temporarilyName = null
}
});
const { proxy } = getCurrentInstance()
const repairOrderList = ref([])
const deviceList = ref([])
const type = ref('')
const isShowSelectDevice = ref(false);
const selectVal = ref(null);
const emits = defineEmits(['searchDevice', 'chooseDevice1']);
const form1 = ref({
number: "",
name: "",
specification: "",
qty: 0,
temporarilyNumber: "", //
temporarilyName: "", //
temporarilySpecifications: "", //
searchName: "", //
})
const isDevice = ref(props.deviceType === 'DEVICE');
onLoad((option) => {
if (option.type) type.value = option.type;
if (option.type) isShowSelectDevice.value = option.isShowSelectDevice; //
if (option.selectVal) selectVal.value = option.selectVal; //
})
//
function chooseDevice1(type) {
if (type == 1) {
form1.value.number = form1.value.temporarilyNumber
form1.value.name = form1.value.temporarilyName
form1.value.specification = form1.value.temporarilySpecifications
}
emits('chooseDevice1', type, form1);
}
function searchDevice() {
emits('searchDevice', form1.value.searchName);
}
function chooseDevice(device) {
console.log('props.isShowSelectDevice', props.isShowSelectDevice);
console.log('props.singleColumnList', props.singleColumnList);
let arr = props.singleColumnList.filter(cur => cur.number != device.number)
arr.forEach(device => {
device.checked = false
})
device.checked = !device.checked
let arr1 = props.singleColumnList.filter(cur => cur.number == device.number)
form1.value.temporarilyNumber = arr1[0].number;
form1.value.temporarilyName = arr1[0].name;
form1.value.temporarilySpecifications = arr1[0].specification;
}
</script>
<style lang="scss" scoped>
.add-form-container {
min-height: calc(100vh - 140rpx);
background: white;
padding: 0px 30rpx 140rpx;
}
.footer {
position: fixed;
bottom: 0px;
left: 0px;
width: 100%;
z-index: 22;
}
.btns {
display: flex;
button {
flex: 1;
}
.sure {
background: #409eff;
color: white;
border-radius: 0px;
&::after {
border: 1px solid #409eff;
border-radius: 0px;
}
}
.reset {
background: #F5F5F5;
border-radius: 0px;
&::after {
border-radius: 0px;
}
}
}
.right-button {
background: #409eff;
color: white;
padding: 0rpx 30rpx;
border-radius: 16rpx;
text-align: center;
font-size: 28rpx;
}
.select {
display: flex;
align-items: center;
height: 72rpx;
width: 100%;
.input {
flex: 1;
font-size: 28rpx;
color: #000000;
}
.placeholder {
flex: 1;
font-size: 28rpx;
color: rgb(192, 196, 204);
}
}
.title {
padding: 32rpx 0px;
position: relative;
span {
position: absolute;
left: -16rpx;
color: #fa3534;
padding-top: 6rpx;
}
}
.list {
.device {
display: flex;
margin-bottom: 20rpx;
.device-box {
background: #F5F5F5;
border-radius: 12rpx;
flex: 1;
width: 0rpx;
}
.spare-title {
padding: 20rpx 30rpx;
border-bottom: 1px solid #e4e4e4;
.title-txt {
color: #409eff;
font-size: 30rpx;
font-weight: bold;
}
}
.dec {
color: #9c9c9c;
padding: 20rpx 30rpx 20rpx;
}
}
}
.add-btn {
display: flex;
justify-content: flex-start;
align-items: center;
}
.popup-title {
text-align: center;
font-size: 32rpx;
font-weight: bold;
color: #409eff;
padding: 30rpx 30rpx 0px
}
.popup {
width: 600rpx;
padding: 30rpx 60rpx 30rpx;
}
.popup-footer {
display: flex;
border-top: 1px solid #e4e4e4;
view {
line-height: 100rpx;
flex: 1;
text-align: center;
&.sure {
color: #409eff;
}
}
}
::v-deep .u-checkbox-group {
display: grid !important;
}
</style>

11
src/components/item/slectItemList.vue

@ -12,10 +12,13 @@
<u-checkbox v-model="item.checked" shape="circle" style="margin-top: 8rpx;"></u-checkbox> <u-checkbox v-model="item.checked" shape="circle" style="margin-top: 8rpx;"></u-checkbox>
<view class="right"> <view class="right">
<view class="item-name"> <view class="item-name">
备件名称:<span>{{item.name}}</span> 名称: <span>{{item.name}}</span>
</view> </view>
<view class="item-dec"> <view class="item-dec">
备件编码:<span>{{item.number}}</span> 型号: <span>{{item.specifications}}</span>
</view>
<view class="item-dec">
编码: <span>{{item.number}}</span>
</view> </view>
</view> </view>
</view> </view>
@ -75,9 +78,11 @@
const form1 = ref({ const form1 = ref({
number: "", number: "",
name:"", name:"",
specifications:"",
qty: 0, qty: 0,
temporarilyNumber:"",// temporarilyNumber:"",//
temporarilyName:"",// temporarilyName:"",//
temporarilySpecifications:"",//
searchName:"",// searchName:"",//
}) })
onLoad((option) => { onLoad((option) => {
@ -90,6 +95,7 @@
if(type==1){ if(type==1){
form1.value.number = form1.value.temporarilyNumber form1.value.number = form1.value.temporarilyNumber
form1.value.name = form1.value.temporarilyName form1.value.name = form1.value.temporarilyName
form1.value.specifications = form1.value.temporarilySpecifications
} }
emits('chooseItem1',type,form1); emits('chooseItem1',type,form1);
} }
@ -107,6 +113,7 @@
let arr1 = props.singleColumnList.filter(cur=>cur.number == item.number) let arr1 = props.singleColumnList.filter(cur=>cur.number == item.number)
form1.value.temporarilyNumber = arr1[0].number; form1.value.temporarilyNumber = arr1[0].number;
form1.value.temporarilyName = arr1[0].name; form1.value.temporarilyName = arr1[0].name;
form1.value.temporarilySpecifications = arr1[0].specifications;
} }
</script> </script>

3
src/pages/repairOrder/addServiceRecord.vue

@ -169,9 +169,11 @@
const form1 = ref({ const form1 = ref({
number: "", number: "",
name:"", name:"",
specifications:"",
qty: 0, qty: 0,
temporarilyNumber:"",// temporarilyNumber:"",//
temporarilyName:"",// temporarilyName:"",//
temporarilySpecifications:"",//
searchName:"",// searchName:"",//
}) })
@ -273,6 +275,7 @@
if(type==1){ if(type==1){
form1.value.number = forms.value.temporarilyNumber form1.value.number = forms.value.temporarilyNumber
form1.value.name =forms.value.temporarilyName form1.value.name =forms.value.temporarilyName
form1.value.specifications = form1.value.temporarilySpecifications
} }
await getSparePartsList(null,null); await getSparePartsList(null,null);
isShowSelectItem.value = false; isShowSelectItem.value = false;

141
src/pages/sparePartsApplication/addForm.vue

@ -77,7 +77,7 @@
<view class="popup"> <view class="popup">
<u-form :model="form1" ref="form1Ref" label-width="200rpx"> <u-form :model="form1" ref="form1Ref" label-width="200rpx">
<u-form-item :label="`备件`" prop="number" required> <u-form-item :label="`备件`" prop="number" required>
<view class="select" @click="openSingleColumn('itemNumber',form1.itemNumber,sparePartsList)"> <view class="select" @click="openSingleNewColumn('itemNumber',form1.itemNumber,sparePartsList)">
<view class="input" v-if='form1.itemNumber'> <view class="input" v-if='form1.itemNumber'>
{{form1.name}} {{form1.name}}
</view> </view>
@ -99,7 +99,7 @@
</view> </view>
</u-form-item> </u-form-item>
<u-form-item :label="`${form1.type=='DEVICE'?'设备' : '模具'}`" prop="deviceNumber"> <u-form-item :label="`${form1.type=='DEVICE'?'设备' : '模具'}`" prop="deviceNumber">
<view class="select" @click="openSingleColumn('deviceNumber',form1.deviceNumber,deviceList)"> <view class="select" @click="openSingleNewDeviceColumn('deviceNumber',form1.deviceNumber,deviceList,form1.type)">
<view class="input" v-if='form1.deviceNumber'> <view class="input" v-if='form1.deviceNumber'>
{{form1.deviceName}} {{form1.deviceName}}
</view> </view>
@ -130,6 +130,8 @@
</u-popup> </u-popup>
<u-select v-model="singleColumnShow" mode="single-column" :default-value='singleColumnDefaultValue' <u-select v-model="singleColumnShow" mode="single-column" :default-value='singleColumnDefaultValue'
:list="singleColumnList" @confirm="chooseSingleColumn" @cancle='singleColumnShow = false'></u-select> :list="singleColumnList" @confirm="chooseSingleColumn" @cancle='singleColumnShow = false'></u-select>
<SelectItemList :isShowSelectItem='isShowSelectItem' :singleColumnList='singleColumnList' @searchItem='searchItem' @chooseItem1='chooseItem1'/>
<SelectDeviceList :isShowSelectDevice='isShowSelectDevice' :singleColumnList='singleColumnList' @searchDevice='searchDevice' @chooseDevice1='chooseDevice1' :deviceType='deviceType' />
</view> </view>
</template> </template>
@ -146,6 +148,9 @@
import * as deviceApi from "@/api/device" import * as deviceApi from "@/api/device"
import * as dictApi from "@/api/dict" import * as dictApi from "@/api/dict"
import * as moldApi from "@/api/mold" import * as moldApi from "@/api/mold"
import SelectItemList from "../../components/item/slectItemList.vue"
import SelectDeviceList from "../../components/device/slectDeviceList.vue"
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const loading = ref(false) const loading = ref(false)
@ -157,24 +162,32 @@
const singleColumnShow = ref(false) const singleColumnShow = ref(false)
const singleColumnDefaultValue = ref([]) const singleColumnDefaultValue = ref([])
const singleColumnList = ref([]) const singleColumnList = ref([])
const isShowSelectItem = ref(false)
const isShowSelectDevice = ref(false)
const field = ref('') const field = ref('')
const deviceList = ref([])// const deviceList = ref([])//
const choosesingleColumnItem = ref([]) const choosesingleColumnItem = ref([])
const deviceNumber = ref();
const deviceType = ref('DEVICE')
const form = ref({ const form = ref({
name: '', name: '',
subList: [] subList: []
}) })
const form1 = ref({ const form1 = ref({
itemNumber: undefined, itemNumber: undefined,
name: '',
specifications: '',
type: '', type: '',
deviceNumber: undefined, deviceNumber: undefined,
isRadeIn: '', isRadeIn: '',
currentQty: '', currentQty: '',
qty: '' qty: '',
temporarilySpecifications: ''
}) })
const deviceMoldType = ref([])// const deviceMoldType = ref([])//
const costCenterDept = ref([])// const costCenterDept = ref([])//
const updataKey = ref(0) const updataKey = ref(0)
const tempSparePartsList = ref([]);
// //
function submit() { function submit() {
// //
@ -257,6 +270,128 @@
getApplyDeviceList() getApplyDeviceList()
singleColumnShow.value = false singleColumnShow.value = false
} }
//
function openSingleNewColumn(fieldName, val, list) {
singleColumnList.value = list
field.value = fieldName
if (val) {
singleColumnDefaultValue.value = [list.findIndex(item => item.value == val)]
} else {
singleColumnDefaultValue.value = []
}
isShowSelectItem.value = true;
singleColumnList.value = list
}
async function searchItem(name){
await getSparePartsList(name);
}
async function chooseItem1(type, forms) {
if (!forms.value.number && type == 1) {
proxy.$modal.showToast('请选择备件');
return;
}
if (type == 1) {
form1.value.itemNumber = forms.value.temporarilyNumber;
form1.value.name = forms.value.temporarilyName;
form1.value.specifications = forms.value.temporarilySpecifications;
let param = {
number:form1.value.itemNumber
}
await sparePartsApi.getApplySparePartsList(param).then(res => {
const itemInfo = res.data.find(item=>item.number == form1.value.itemNumber);
if(itemInfo){
form1.value.currentQty = itemInfo.qty;
form1.value.isRadeIn = itemInfo.isRadeIn;
updataKey.value++
}
}).catch(() => { })
}
await getSparePartsList(null);
isShowSelectItem.value = false;
}
//
async function getSparePartsList(name) {
let param = {
name:name
}
await sparePartsApi.getSparePartsList(param).then(res => {
res.data.map(item => {
item.value = item.number
item.label = item.name
})
sparePartsList.value = res.data
singleColumnList.value = sparePartsList.value
}).catch(() => { })
}
//
function openSingleNewDeviceColumn(fieldName, val, list, type) {
singleColumnList.value = list
field.value = fieldName
deviceType.value = type
if (val) {
singleColumnDefaultValue.value = [list.findIndex(item => item.value == val)]
} else {
singleColumnDefaultValue.value = []
}
isShowSelectDevice.value = true;
singleColumnList.value = list
}
async function searchDevice(name){
await getDeviceList(name);
}
async function chooseDevice1(type,forms){
if(!forms.value.number&&type==1){
proxy.$modal.showToast('请选择设备')
return
}
if(type==1){
form1.value.deviceNumber = forms.value.temporarilyNumber
form1.value.deviceName =forms.value.temporarilyName
form1.value.deviceSpecification = form1.value.temporarilySpecifications
}
await getDeviceList(null);
isShowSelectDevice.value = false;
}
//
async function getDeviceList(name) {
let param = {
name:name
}
if (form1.value.type == 'DEVICE') {
await deviceApi.selectAllByParams(param).then(res => {
res.data.map(item => {
item.value = item.number
item.label = item.name
})
deviceList.value = res.data
singleColumnList.value = deviceList.value
console.log(singleColumnList.value)
}).catch(() => { })
} else if (form1.value.type == 'MOLD') {
moldApi.getAllMoldByParams(param).then((res) => {
res.data.map(item => {
item.value = item.number
item.label = item.name
})
deviceList.value = res.data
singleColumnList.value = deviceList.value
console.log(singleColumnList.value)
}).catch(() => { })
}
}
// //
async function getApplySparePartsList() { async function getApplySparePartsList() {
await sparePartsApi.getApplySparePartsList().then(res => { await sparePartsApi.getApplySparePartsList().then(res => {

Loading…
Cancel
Save