Merge remote-tracking branch 'origin/master'

This commit is contained in:
许允枞 2024-10-26 17:08:01 +08:00
commit 103bf42cbe
6 changed files with 451 additions and 21 deletions

View File

@ -22,6 +22,9 @@
<view v-if="showClear" @click="clearNoReadFun" class="navigationBarIcon" :style="{ color: titleColor }"> <view v-if="showClear" @click="clearNoReadFun" class="navigationBarIcon" :style="{ color: titleColor }">
<image src="@/static/images/clear.png" mode="" class="clear-icon"></image> <image src="@/static/images/clear.png" mode="" class="clear-icon"></image>
</view> </view>
<view v-if="addWares" @click="addNewWares" class="navigationBarIcon" style="position: absolute;right: 22px;font-size: 18px">
新增
</view>
</template> </template>
<view class="navigationBarBackExtra"> <view class="navigationBarBackExtra">
<slot name="extra"> <slot name="extra">
@ -53,6 +56,11 @@ export default {
showClear: { showClear: {
type: Boolean, type: Boolean,
default: false default: false
},
//
addWares:{
type: Boolean,
default: false
} }
}, },
mounted() { mounted() {
@ -88,6 +96,9 @@ export default {
}, },
clearNoReadFun(){ clearNoReadFun(){
this.$emit('clearNoRead') this.$emit('clearNoRead')
},
addNewWares(){
this.$emit('addNewWares')
} }
} }
} }

View File

@ -176,16 +176,7 @@ export default {
method: 'get', method: 'get',
params: {ticketId: this.ticketId} params: {ticketId: this.ticketId}
}).then((res) => { }).then((res) => {
let thisList = res.data this.list = res.data
thisList.map((item) => {
getDictTextByCodeAndValue("repair_work_type", item.workType).then(value => {
item.workTypeText = value
}).catch(error => {
item.workTypeText = "未知"
console.error(error);
});
})
this.list = thisList
if (this.list.length > 0) { if (this.list.length > 0) {
console.log(this.list[0].userId) console.log(this.list[0].userId)
this.checkedUserId = this.list[0].userId this.checkedUserId = this.list[0].userId

View File

@ -1,6 +1,6 @@
<template> <template>
<view class="container"> <view class="container">
<VNavigationBar background-color="#fff" title="配件申请" title-color="#333"></VNavigationBar> <VNavigationBar background-color="#fff" title="配件申请" :addWares="true" @addNewWares="addNewWaresFun" title-color="#333"></VNavigationBar>
<view class="search"> <view class="search">
<view class="searchBox"> <view class="searchBox">
<input class="searchInput" v-model="searchName" placeholder="查询配件名称" placeholder-style="font-size: 28rpx" type="text"> <input class="searchInput" v-model="searchName" placeholder="查询配件名称" placeholder-style="font-size: 28rpx" type="text">
@ -82,6 +82,8 @@ export default {
onLoad(data) { onLoad(data) {
this.userInfo = getUserInfo() this.userInfo = getUserInfo()
this.ticketId = data.ticketId this.ticketId = data.ticketId
},
onShow(){
this.init() this.init()
}, },
methods: { methods: {
@ -110,6 +112,7 @@ export default {
this.pageList() this.pageList()
}, },
init() { init() {
this.tabs = []
//tab //tab
request({ request({
url: '/admin-api/repair/wares/getAllTypeList', url: '/admin-api/repair/wares/getAllTypeList',
@ -118,10 +121,12 @@ export default {
console.log(res) console.log(res)
if (res.code == 200 && res.data.length>0) { if (res.code == 200 && res.data.length>0) {
res.data.map((item)=>{ res.data.map((item)=>{
this.tabs.push({ if(item.id){
name:item.name, this.tabs.push({
value:item.id name:item.name,
}) value:item.id
})
}
}) })
} }
}) })
@ -276,6 +281,14 @@ export default {
this.activeId = value this.activeId = value
this.onRefresherrefresh() this.onRefresherrefresh()
}, },
/**
* 添加新的配件
*/
addNewWaresFun(){
uni.navigateTo({
url: '/pages-repair/apply/newWare'
})
},
} }
} }
</script> </script>

View File

@ -0,0 +1,411 @@
<template>
<view class="container">
<VNavigationBar background-color="#fff" title="新增配件" title-color="#333"></VNavigationBar>
<view class="listBox">
<view class="list">
<view class="formItem">
<text class="formLabel require">配件名称</text>
<input type="text" style="text-align: right" v-model="formData.name" placeholder="请输入配件名称"/>
</view>
<view class="formItem">
<text class="formLabel require">所属分类</text>
<picker @change="typePickerChange" :value="typeIndex" :range="allTypeNameList">
<view class="uni-input">{{allTypeNameList[typeIndex]}}</view>
</picker>
</view>
<view class="formItem">
<text class="formLabel require">计量单位</text>
<picker @change="unitPickerChange" :value="unitIndex" :range="allUnitNameList">
<view class="uni-input">{{allUnitNameList[unitIndex]}}</view>
</picker>
</view>
<view class="formItem">
<text class="formLabel">规格型号</text>
<input type="text" style="text-align: right" v-model="formData.model" placeholder="请输入规格型号"/>
</view>
<view class="formItem">
<text class="formLabel">来源</text>
<picker @change="fromPickerChange" :value="fromIndex" :range="allFromNameList">
<view class="uni-input">{{allFromNameList[fromIndex]}}</view>
</picker>
</view>
<view class="formItem">
<text class="formLabel">配件属性</text>
<picker @change="attributePickerChange" :value="attributeIndex" :range="allAttributeNameList">
<view class="uni-input">{{allAttributeNameList[attributeIndex]}}</view>
</picker>
</view>
<view class="formItem">
<text class="formLabel">状态</text>
<view>
<radio-group v-model="formData.status">
<label class="radio-label" v-for="(item, index) in radioOptions" :key="index">
<radio :value="item.value" :checked="item.checked">{{ item.label }}</radio>
</label>
</radio-group>
</view>
</view>
<view class="formItem">
<text class="formLabel">条形码</text>
<input type="text" style="text-align: right" v-model="formData.barCode" placeholder="请输入条形码"/>
</view>
<view class="formItem">
<text class="formLabel">商品编码</text>
<input type="text" style="text-align: right" v-model="formData.code" placeholder="请输入商品编码"/>
</view>
<view class="formItem">
<text class="formLabel">适用子公司</text>
<text class="formValue"></text>
</view>
<view style="padding-bottom: 60rpx;border-bottom: 1px solid #ddd;" class="formItem">
<checkbox-group v-model="checkedCorpIdList">
<checkbox v-for="(item, index) in allCompanyList" :key="index" :value="item.id" :checked="item.checked">{{ item.corpName }}</checkbox>
</checkbox-group>
</view>
<view class="formItem">
<text class="formLabel">适用车型</text>
<text class="formValue"></text>
</view>
<view style="padding-bottom: 60rpx;border-bottom: 1px solid #ddd;" class="formItem">
<textarea style="height: 50px" auto-height placeholder="请输入适用车型" v-model="formData.carModel" />
</view>
<view class="formItem">
<text class="formLabel">备注</text>
<text class="formValue"></text>
</view>
<view style="padding-bottom: 60rpx;border-bottom: 1px solid #ddd;" class="formItem">
<textarea style="height: 50px" auto-height placeholder="请输入备注" v-model="formData.remark" />
</view>
</view>
</view>
<view class="footer">
<text class="label"></text>
<text class="repairNum"></text>
<view class="submit" @click="submit">保存</view>
</view>
</view>
</template>
<script>
import VNavigationBar from "@/components/VNavigationBar.vue";
import request from '@/utils/request';
import {getDictTextByCodeAndValue,createUniqueCodeByHead} from "@/utils/utils";
import {getUserInfo,getJSONData} from '@/utils/auth.js'
export default {
components: {VNavigationBar},
data() {
return {
//
formData:{
name:"",
type:"",
unit:"",
model:"",
dataForm:"",
attribute:"",
status:"",
barCode:"",
code:"",
corpId:"",
carModel:"",
remark:"",
},
//
radioOptions: [
{ label: '启用', value: '01' ,checked:true},
{ label: '禁用', value: '02' ,checked:false}
],
//
allTypeList:[],
//-
allTypeNameList:[],
//
typeIndex:0,
//
allUnitList:[],
//-
allUnitNameList:[],
//
unitIndex:0,
//
allFromList:[],
//-
allFromNameList:[],
//
fromIndex:0,
//
allAttributeList:[],
//-
allAttributeNameList:[],
//
attributeIndex:0,
//
allCompanyList:[],
//id
checkedCorpIdList:[],
};
},
onLoad() {
this.init()
},
computed: {
},
methods: {
/**
* 初始化配件数据
*/
init() {
//
this.selectBaseType()
//
this.selectBaseUnit()
//
this.selectDataFrom()
//
this.selectAttribute()
//
this.selectCompany()
},
/**
* 查所有可选分类
*/
selectBaseType(){
request({
url: '/admin-api/conf/baseType/list',
method: 'get',
params: {type:"02"}
}).then((res) => {
console.log(res)
if (res.code == 200 && res.data.length>0) {
this.allTypeList = res.data
this.allTypeNameList = res.data.map((item)=>{return item.name})
}
})
},
/**
* 查所有可选计量单位
*/
selectBaseUnit(){
request({
url: '/admin-api/system/dict-data/type',
method: 'get',
params:{type:"repair_unit"}
}).then((res) => {
console.log(res)
if (res.code == 200) {
this.allUnitList = res.data
this.allUnitNameList = res.data.map((item)=>{return item.label})
}
})
},
/**
* 查所有可选来源
*/
selectDataFrom(){
request({
url: '/admin-api/system/dict-data/type',
method: 'get',
params:{type:"wares_data_form"}
}).then((res) => {
console.log(res)
if (res.code == 200) {
this.allFromList = res.data
this.allFromNameList = res.data.map((item)=>{return item.label})
}
})
},
/**
* 查所有可选属性
*/
selectAttribute(){
request({
url: '/admin-api/system/dict-data/type',
method: 'get',
params:{type:"wares_attribute"}
}).then((res) => {
console.log(res)
if (res.code == 200) {
this.allAttributeList = res.data
this.allAttributeNameList = res.data.map((item)=>{return item.label})
}
})
},
/**
* 查所有可选子公司
*/
selectCompany(){
request({
url: '/admin-api/base/company/list',
method: 'get'
}).then((res) => {
console.log(res)
if (res.code == 200 && res.data.length>0) {
this.allCompanyList = res.data
this.allCompanyList.map((item)=>{
item.checked=false
})
}
})
},
/**
* 选分类
*/
typePickerChange: function(e) {
console.log('picker发送选择改变携带值为', e.detail.value)
this.typeIndex = e.detail.value
},
/**
* 选计量单位
*/
unitPickerChange: function(e) {
console.log('picker发送选择改变携带值为', e.detail.value)
this.unitIndex = e.detail.value
},
/**
* 选来源
*/
fromPickerChange: function(e) {
console.log('picker发送选择改变携带值为', e.detail.value)
this.fromIndex = e.detail.value
},
/**
* 选属性
*/
attributePickerChange: function(e) {
console.log('picker发送选择改变携带值为', e.detail.value)
this.attributeIndex = e.detail.value
},
/**
* 新增配件
*/
submit() {
//
if(!this.formData.name){
uni.showToast({
title: '请输入配件名称!',
icon: 'none'
})
return
}
//
if(this.checkedCorpIdList.length>0){
this.formData.corpId = this.checkedCorpIdList.join()
}
//
this.formData.type = this.allTypeList[this.typeIndex].id
this.formData.unit = this.allUnitList[this.unitIndex].value
this.formData.dataForm = this.allFromList[this.fromIndex].value
this.formData.attribute = this.allAttributeList[this.attributeIndex].value
request({
url: '/admin-api/repair/wares/create',
method: 'post',
data:this.formData
}).then((res)=>{
if (res.code == 200){
uni.showToast({
title: '新增成功!',
icon: 'none'
})
setTimeout(()=>{
uni.navigateBack()
},700)
}else{
uni.showToast({
title: '操作失败,请联系管理员!',
icon: 'none'
})
}
})
}
}
}
</script>
<style lang="scss">
.container {
height: 100%;
background-color: #F3F5F7;
display: flex;
flex-direction: column;
}
.listBox {
padding: 30 rpx 32 rpx;
flex: 1;
height: 0;
}
.list {
background-color: #fff;
padding: 0 30rpx;
height: 100%;
overflow: auto;
}
.formItem {
box-sizing: border-box;
margin: 0 auto;
padding: 30rpx;
display: flex;
align-items: center;
justify-content: space-between;
column-gap: 20rpx;
border-bottom: 1rpx solid #DDDDDD;
}
.require::before{
content: "*";
color: red;
}
.formLabel {
font-size: 32rpx;
color: #333333;
}
.formValue {
flex: 1;
width: 0;
text-align: right;
font-size: 32rpx;
color: #999999;
}
.repairBottom {
display: flex;
align-items: center;
justify-content: space-between;
}
.repairDesc {
font-size: 28rpx;
color: #858BA0;
}
.repairUnit {
color: #333333;
}
.footer {
padding: 14rpx 32rpx;
background-color: #fff;
display: flex;
align-items: center;
.repairNum {
flex: 1;
width: 0;
margin-right: 10rpx;
}
.submit {
width: 208rpx;
height: 72rpx;
background: #0174F6;
border-radius: 38rpx 38rpx 38rpx 38rpx;
text-align: center;
line-height: 72rpx;
font-size: 32rpx;
color: #FFFFFF;
}
}
</style>

View File

@ -155,11 +155,12 @@ export default {
url: '/pages/login/login' url: '/pages/login/login'
}) })
} else { } else {
//
this.userInfo = getUserInfo()
if (!this.$msgSocket) { if (!this.$msgSocket) {
this.$startMsgSocket(getTenantId(), getStrData("userId")) this.$startMsgSocket(getTenantId(), getStrData("userId"))
} }
} }
this.onRefresherrefresh()
}, },
onShow() { onShow() {
if (!getToken()) { if (!getToken()) {
@ -167,8 +168,6 @@ export default {
url: '/pages/login/login' url: '/pages/login/login'
}) })
} else { } else {
//
this.userInfo = getUserInfo()
this.onRefresherrefresh() this.onRefresherrefresh()
this.getNoReadNum() this.getNoReadNum()
this.getNoticeList() this.getNoticeList()
@ -442,11 +441,10 @@ export default {
} }
.body-top { .body-top {
width: 686rpx; //width: 686rpx;
background: #FFFFFF; background: #FFFFFF;
border-radius: 8rpx 8rpx 8rpx 8rpx; border-radius: 8rpx 8rpx 8rpx 8rpx;
margin: 0 auto; margin: 30rpx 30rpx 0;
padding: 30rpx 30rpx 0;
.body-top-search { .body-top-search {
height: 84rpx; height: 84rpx;

View File

@ -163,6 +163,12 @@
"style": { "style": {
"navigationBarTitleText": "" "navigationBarTitleText": ""
} }
},
{
"path": "apply/newWare",
"style": {
"navigationBarTitleText": ""
}
}, },
{ {
"path": "reviewList/reviewList", "path": "reviewList/reviewList",