Compare commits

..

No commits in common. "c329fa58643dc22653bac1aa04553983a79b9d52" and "9210d98ff85085d17d79efd376f8aafd97dfd1af" have entirely different histories.

5 changed files with 65 additions and 85 deletions

View File

@ -4,19 +4,22 @@
"version" : "0.0", "version" : "0.0",
"configurations" : [ "configurations" : [
{ {
"app-plus" : { "app-plus" :
"launchtype" : "local" {
}, "launchtype" : "local"
"default" : { },
"launchtype" : "local" "default" :
}, {
"mp-weixin" : { "launchtype" : "local"
"launchtype" : "local" },
}, "mp-weixin" :
"type" : "uniCloud" {
"launchtype" : "local"
},
"type" : "uniCloud"
}, },
{ {
"playground" : "standard", "playground" : "custom",
"type" : "uni-app:app-android" "type" : "uni-app:app-android"
} }
] ]

View File

@ -3,8 +3,7 @@ module.exports = {
// baseUrl: 'https://www.nuoyunr.com', // baseUrl: 'https://www.nuoyunr.com',
// baseUrl: 'http://124.222.105.7:48080', // baseUrl: 'http://124.222.105.7:48080',
// baseUrl: 'http://192.168.1.4:48080', // baseUrl: 'http://192.168.1.4:48080',
// baseUrl: "http://localhost:48080", baseUrl: "http://localhost:48080",
baseUrl: "http://rzqhb7.natappfree.cc",
imagesUrl: 'http://shequ.0315e.com/static/images/pages/', imagesUrl: 'http://shequ.0315e.com/static/images/pages/',
baseImageUrl: 'https://www.nuoyunr.com/minio/', baseImageUrl: 'https://www.nuoyunr.com/minio/',
shareUrl: 'https://www.lighting-it.cn/share?inviteId=', shareUrl: 'https://www.lighting-it.cn/share?inviteId=',

View File

@ -121,15 +121,9 @@ export default {
cusFromValueList:[''], cusFromValueList:[''],
// //
cusFromIndex:0, cusFromIndex:0,
twId: null,
} }
}, },
onLoad(data){ onLoad(){
if (data && data.twId){
this.twId = data.twId
}else {
this.twId = null
}
if(!getToken()){ if(!getToken()){
uni.reLaunch({ uni.reLaunch({
url: '/pages/login/login' url: '/pages/login/login'
@ -378,9 +372,6 @@ export default {
userId: this.userInfo.id, userId: this.userInfo.id,
soType: "01" soType: "01"
} }
if (this.twId){
paramsObj.twId = this.twId
}
request({ request({
url: '/admin-api/repair/so/page', url: '/admin-api/repair/so/page',
method: 'get', method: 'get',

View File

@ -50,7 +50,6 @@
<text class="label"></text> <text class="label"></text>
<text class="repairNum"></text> <text class="repairNum"></text>
<view class="submit" @click="toPart">采购</view> <view class="submit" @click="toPart">采购</view>
<view class="submit" @click="toInWares">入库单</view>
<view class="submit" @click="submitBefore">{{ isReceive ? '通知领料' : '通知退料' }}</view> <view class="submit" @click="submitBefore">{{ isReceive ? '通知领料' : '通知退料' }}</view>
</view> </view>
@ -123,11 +122,6 @@ export default {
computed: {}, computed: {},
methods: { methods: {
toInWares(){
uni.navigateTo({
url: '/pages-order/orderList/orderList?twId=' + this.twId
})
},
async submitBefore(){ async submitBefore(){
if (!this.selectRows || this.selectRows.length === 0){ if (!this.selectRows || this.selectRows.length === 0){
uni.showToast({ uni.showToast({

View File

@ -11,7 +11,7 @@
<view class="formItem" v-if="isInput"> <view class="formItem" v-if="isInput">
<text class="formLabel">关键字</text> <text class="formLabel">关键字</text>
<input type="text" style="text-align: right" v-model="query" placeholder="名称、规格、编码"/> <input type="text" style="text-align: right" v-model="query" placeholder="名称、规格、编码"/>
<view @click="searchQuery" style="width: 3rem">查询</view> <view @click="searchQuery">查询</view>
</view> </view>
<view class="formItem" v-if="!isInput"> <view class="formItem" v-if="!isInput">
<text class="formLabel">备注</text> <text class="formLabel">备注</text>
@ -35,8 +35,8 @@
</view> </view>
</uni-card> </uni-card>
<uni-collapse ref="collapse"> <uni-collapse ref="collapse">
<uni-collapse-item v-for="(key, index) in keys" :key="index" :title="key + `(${values.get(key).length})`"> <uni-collapse-item v-for="[key, value] in partList" :title="key + `(${value.length})`">
<uni-card v-for="(item, index) in values.get(key)" :key="index"> <uni-card v-for="(item, index) in value" :key="index">
<template> <template>
<view class="card-header"> <view class="card-header">
<radio v-if="isInput" :checked="item.isSelected" @click="chooseItem(item)"/> <radio v-if="isInput" :checked="item.isSelected" @click="chooseItem(item)"/>
@ -45,19 +45,16 @@
</template> </template>
<view class="formItem"> <view class="formItem">
<view class="formLabel">进价</view> <view class="formLabel">进价</view>
<input type="number" style="text-align: right" v-model="item.wares.purPrice" <input type="number" style="text-align: right" v-model="item.wares.purPrice" placeholder="请输入单价"/>
placeholder="请输入单价"/>
</view> </view>
<view class="formItem"> <view class="formItem">
<view class="formLabel">售价</view> <view class="formLabel">售价</view>
<input type="number" style="text-align: right" v-model="item.wares.price" <input type="number" style="text-align: right" v-model="item.wares.price" placeholder="请输入单价"/>
placeholder="请输入单价"/>
</view> </view>
<view class="formItem"> <view class="formItem">
<view class="formLabel">分类</view> <view class="formLabel">分类</view>
<view> <view>
<picker @change="bindPickerChange($event, item)" :range="options" <picker @change="bindPickerChange($event, item)" :range="options" range-key="label">
range-key="label">
<view class="picker"> <view class="picker">
{{ getServerName(item.wares.type) }} {{ getServerName(item.wares.type) }}
</view> </view>
@ -66,8 +63,7 @@
</view> </view>
<view class="formItem"> <view class="formItem">
<view class="formLabel">计量单价</view> <view class="formLabel">计量单价</view>
<picker @change="bindUnitChange($event, item)" :range="unitList" <picker @change="bindUnitChange($event, item)" :range="unitList" range-key="label">
range-key="label">
<view class="picker"> <view class="picker">
{{ getUnitName(item.wares.unit) }} {{ getUnitName(item.wares.unit) }}
</view> </view>
@ -75,23 +71,30 @@
</view> </view>
<view class="formItem" v-if="!isInput"> <view class="formItem" v-if="!isInput">
<view class="formLabel">数量</view> <view class="formLabel">数量</view>
<input type="number" style="text-align: right" v-model="item.waresCount" <input type="number" style="text-align: right" v-model="item.waresCount" placeholder="请输入数量"/>
placeholder="请输入数量"/>
</view> </view>
<view class="formItem" v-if="isInput"> <view class="formItem" v-if="isInput">
<view class="formLabel">数量</view> <view class="formLabel">数量</view>
<input type="number" style="text-align: right" v-model="item.inCount" <input type="number" style="text-align: right" v-model="item.inCount" placeholder="请输入数量"/>
placeholder="请输入数量"/>
</view> </view>
<view class="formItem"> <view class="formItem">
<view class="formLabel">仓库</view> <view class="formLabel">仓库</view>
<uni-data-picker placeholder="请选择仓库" popup-title="请选择仓库" <uni-data-picker placeholder="请选择仓库" popup-title="请选择仓库" :localdata="waresTree" v-model="item.wares.warehouse">
:localdata="waresTree" v-model="item.wares.warehouse">
</uni-data-picker> </uni-data-picker>
</view> </view>
</uni-card> </uni-card>
</uni-collapse-item> </uni-collapse-item>
</uni-collapse> </uni-collapse>
<!-- <uni-card v-for="(item, index) in partList" :key="index" :title="item.name" :extra="'上次价格:'+item.purPrice">-->
<!-- <view class="formItem">-->
<!-- <view class="formLabel">单价</view>-->
<!-- <input type="number" style="text-align: right" v-model="item.newPrice" placeholder="请输入单价"/>-->
<!-- </view>-->
<!-- <view class="formItem">-->
<!-- <view class="formLabel">数量</view>-->
<!-- <input type="number" style="text-align: right" v-model="item.count" placeholder="请输入数量"/>-->
<!-- </view>-->
<!-- </uni-card>-->
</view> </view>
</view> </view>
<view class="footer"> <view class="footer">
@ -148,8 +151,6 @@ export default {
subLoading: false, subLoading: false,
waresTree: [], waresTree: [],
chooseWares: null, chooseWares: null,
keys: [],
values: null
}; };
}, },
onLoad(data) { onLoad(data) {
@ -165,14 +166,13 @@ export default {
if (getJSONData("applyWaresForm")) { if (getJSONData("applyWaresForm")) {
this.formData = getJSONData("applyWaresForm") this.formData = getJSONData("applyWaresForm")
this.wares = this.formData.items this.wares = this.formData.items
this.twId = this.formData.id
this.init() this.init()
} }
} }
}, },
computed: {}, computed: {},
methods: { methods: {
listWarehouse() { listWarehouse(){
request({ request({
url: '/admin-api/conf/baseWarehouse/list', url: '/admin-api/conf/baseWarehouse/list',
method: 'get' method: 'get'
@ -181,29 +181,29 @@ export default {
}) })
}, },
chooseItem(item) { chooseItem(item) {
const index = this.selectRows.findIndex(i => i.id === item.id); const parentIndex = this.partList.map(([key, value]) => value).reduce((acc, value) => acc.concat(value)).findIndex(i => i.id === item.id)
if (index === -1) { const index = this.selectRows.findIndex(i => i.id === item.id)
item.isSelected = true; if (index === -1){
this.selectRows.push(item); this.$set(item, 'isSelected', true)
} else { this.selectRows.push(item)
item.isSelected = false; }else {
this.selectRows.splice(index, 1); this.$set(item, 'isSelected', false)
this.selectRows.splice(index, 1)
} }
if (parentIndex !== -1){
// Map const partListFlat = this.partList
const partListFlat = Array.from(this.values.values()).flat(); .map(([key, value]) => value)
.reduce((acc, value) => acc.concat(value), []);
// Map this.$set(partListFlat, parentIndex, { ...partListFlat[parentIndex], isSelected: item.isSelected });
const updatedValues = new Map(); const updatedPartList = this.partList.map(([key, value]) => {
for (const [key, value] of this.values) { const newValue = value.map(v => {
const newValue = value.map(v => { const foundItem = partListFlat.find(f => f.id === v.id);
const foundItem = partListFlat.find(f => f.id === v.id); return foundItem ? { ...v, ...foundItem } : v;
return foundItem ? { ...v, ...foundItem } : v; });
return [key, newValue];
}); });
updatedValues.set(key, newValue); this.$set(this, 'partList', updatedPartList);
} }
this.values = updatedValues;
}, },
searchQuery() { searchQuery() {
this.getSoiId() this.getSoiId()
@ -213,7 +213,7 @@ export default {
const index = this.unitList.findIndex(item => item.value === id) const index = this.unitList.findIndex(item => item.value === id)
if (index !== -1) { if (index !== -1) {
return this.unitList[index].label return this.unitList[index].label
} else { }else {
return "请选择" return "请选择"
} }
} }
@ -324,8 +324,6 @@ export default {
i.totalPrice = i.waresCount * i.wares.purPrice i.totalPrice = i.waresCount * i.wares.purPrice
}) })
}) })
this.keys = this.partList.map(([key, value]) => key)
this.values = new Map(this.partList)
}) })
}, },
/** /**
@ -361,7 +359,7 @@ export default {
*/ */
submit() { submit() {
const userInfo = getUserInfo() const userInfo = getUserInfo()
const values = Array.from(this.values.values()).flat(); const values = this.partList.map(([key, value]) => value).reduce((acc, value) => acc.concat(value))
const data = { const data = {
soType: '01', soType: '01',
purchaseType: '01', purchaseType: '01',
@ -389,9 +387,6 @@ export default {
} }
})] })]
data.waresList = [...values.map(item => item.wares)] data.waresList = [...values.map(item => item.wares)]
if (this.twId) {
data.twId = this.twId
}
request({ request({
url: '/admin-api/repair/so/create', url: '/admin-api/repair/so/create',
method: 'post', method: 'post',
@ -427,40 +422,38 @@ export default {
}) })
}) })
const values = this.partList.map(([key, value]) => value) const values = this.partList.map(([key, value]) => value)
if (!this.selectRows || this.selectRows.length === 0) { if (!this.selectRows || this.selectRows.length === 0){
values.forEach(item => { values.forEach(item => {
item.forEach(i => { item.forEach(i => {
i.isSelected = false i.isSelected = false
}) })
}) })
} else { }else {
values.forEach(item => { values.forEach(item => {
item.forEach(i => { item.forEach(i => {
i.isSelected = this.selectRows.findIndex(j => j.id === i.id) !== -1 i.isSelected = this.selectRows.findIndex(j => j.id === i.id) !== -1
}) })
}) })
} }
this.keys = this.partList.map(([key, value]) => key)
this.values = new Map(this.partList)
}) })
}, },
/** /**
* 入库 * 入库
*/ */
inWare() { inWare() {
if (!this.subLoading) { if (!this.subLoading){
this.subLoading = true this.subLoading = true
const data = { const data = {
id: this.soId, id: this.soId,
soNo: createUniqueCodeByHead("RK") soNo: createUniqueCodeByHead("RK")
} }
const values = Array.from(this.values.values()).flat(); const values = this.partList.map(([key, value]) => value).reduce((acc, item) => acc.concat(item))
if (this.selectRows && this.selectRows.length > 0) { if (this.selectRows && this.selectRows.length > 0){
const ids = this.selectRows.map(item => item.id) const ids = this.selectRows.map(item => item.id)
const newSelect = values.filter(item => ids.includes(item.id)) const newSelect = values.filter(item => ids.includes(item.id))
data.soiList = [...newSelect] data.soiList = [...newSelect]
data.waresList = [...newSelect.map(item => item.wares)] data.waresList = [...newSelect.map(item => item.wares)]
} else { }else {
data.soiList = [...values] data.soiList = [...values]
data.waresList = [...values.map(item => item.wares)] data.waresList = [...values.map(item => item.wares)]
} }