白胚维护完成
This commit is contained in:
parent
2919bdfc90
commit
7d27322db5
@ -21,7 +21,7 @@ function httpRequest(url : string, method : any, data = {}, headerCustom = {}) {
|
|||||||
const finalHeader = Object.assign({}, header, headerCustom);
|
const finalHeader = Object.assign({}, header, headerCustom);
|
||||||
uni.setStorageSync('baseURL', myconfig.base_url)
|
uni.setStorageSync('baseURL', myconfig.base_url)
|
||||||
uni.request({
|
uni.request({
|
||||||
url: myconfig.base_url + url, // 拼接基础URL和请求路径
|
url: url==='http://192.168.1.2:7000/v1/auth/login'?url:myconfig.base_url + url, // 拼接基础URL和请求路径
|
||||||
method: method,
|
method: method,
|
||||||
data: data, // 如果是GET请求,data应该为null
|
data: data, // 如果是GET请求,data应该为null
|
||||||
header: finalHeader,
|
header: finalHeader,
|
||||||
|
@ -44,7 +44,7 @@ const onSubmit = () => {
|
|||||||
'username':username.value,
|
'username':username.value,
|
||||||
'password':password.value,
|
'password':password.value,
|
||||||
}
|
}
|
||||||
postAction('/v1/auth/login',data,{'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'}).then((res:any) => {
|
postAction('http://192.168.1.2:7000/v1/auth/login',data,{'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'}).then((res:any) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
const token = res.data;
|
const token = res.data;
|
||||||
localStorage.setItem("token", token);
|
localStorage.setItem("token", token);
|
||||||
|
@ -10,13 +10,15 @@ const level = ref('' as any)
|
|||||||
const id= ref('' as any)
|
const id= ref('' as any)
|
||||||
|
|
||||||
onMounted(()=>{
|
onMounted(()=>{
|
||||||
|
init()
|
||||||
|
})
|
||||||
|
const init =()=>{
|
||||||
getAction('/rawFabricLevels',{page:1,size:100}).then((res:any)=>{
|
getAction('/rawFabricLevels',{page:1,size:100}).then((res:any)=>{
|
||||||
if(res.code===200){
|
if(res.code===200){
|
||||||
list.value=res.data.recond
|
list.value=res.data.record
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
}
|
||||||
|
|
||||||
const onClickLeft = () =>{
|
const onClickLeft = () =>{
|
||||||
history.back()
|
history.back()
|
||||||
}
|
}
|
||||||
@ -37,6 +39,7 @@ const submit =()=>{
|
|||||||
if(res.code===200){
|
if(res.code===200){
|
||||||
showPop.value=false
|
showPop.value=false
|
||||||
showToast('编辑成功!')
|
showToast('编辑成功!')
|
||||||
|
init()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
@ -44,6 +47,7 @@ const submit =()=>{
|
|||||||
if(res.code===200){
|
if(res.code===200){
|
||||||
showPop.value=false
|
showPop.value=false
|
||||||
showToast('提交成功!')
|
showToast('提交成功!')
|
||||||
|
init()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -53,6 +57,7 @@ const delItem = (item:any) =>{
|
|||||||
deleteAction(url).then((res:any)=>{
|
deleteAction(url).then((res:any)=>{
|
||||||
if(res.code===200){
|
if(res.code===200){
|
||||||
showToast('删除成功!')
|
showToast('删除成功!')
|
||||||
|
init()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -75,8 +80,8 @@ const delItem = (item:any) =>{
|
|||||||
<view class="grid-item">操作</view>
|
<view class="grid-item">操作</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="grid-container" v-for="(item,index) in list" :key="index">
|
<view class="grid-container" v-for="(item,index) in list" :key="index">
|
||||||
<view class="grid-item">{{item.name}}</view>
|
|
||||||
<view class="grid-item">{{item.id}}</view>
|
<view class="grid-item">{{item.id}}</view>
|
||||||
|
<view class="grid-item">{{item.level}}</view>
|
||||||
<view
|
<view
|
||||||
class="grid-item"><span style="color: #35a5f7" @click="edit(item)">编辑</span> <span
|
class="grid-item"><span style="color: #35a5f7" @click="edit(item)">编辑</span> <span
|
||||||
style="color: red" @click="delItem(item)">删除
|
style="color: red" @click="delItem(item)">删除
|
||||||
|
@ -1,23 +1,65 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
|
||||||
import { ref } from 'vue'
|
import { onMounted, ref } from 'vue'
|
||||||
|
import { deleteAction, getAction, postAction, putAction } from '../../common/http';
|
||||||
|
import { showToast } from 'vant';
|
||||||
|
|
||||||
const showPop = ref(false)
|
const showPop = ref(false)
|
||||||
const list= ref([{}] as any[])
|
const list= ref([] as any[])
|
||||||
const form = ref({list:[{}]} as any)
|
const form = ref({active:false} as any)
|
||||||
|
const name = ref('')
|
||||||
|
|
||||||
|
onMounted(()=>{
|
||||||
|
init()
|
||||||
|
})
|
||||||
|
|
||||||
|
const init=()=>{
|
||||||
|
getAction('/suppliers',{page:1,size:100}).then((res:any)=>{
|
||||||
|
if(res.code===200){
|
||||||
|
list.value=res.data.record
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const onClickLeft = () =>{
|
const onClickLeft = () =>{
|
||||||
history.back()
|
history.back()
|
||||||
}
|
}
|
||||||
const onClickRight=()=>{
|
const onClickRight=()=>{
|
||||||
showPop.value=true
|
showPop.value=true
|
||||||
|
form.value={active:false}
|
||||||
}
|
}
|
||||||
const edit = (item:any) =>{
|
const edit = (item:any) =>{
|
||||||
console.log(item)
|
form.value=item
|
||||||
showPop.value=true
|
showPop.value=true
|
||||||
}
|
}
|
||||||
const submit =()=>{
|
const submit =()=>{
|
||||||
|
if(form.value.id){
|
||||||
|
putAction('/suppliers',{id:form.value.id,name:form.value.name,active:form.value.active}).then((res:any)=>{
|
||||||
|
if(res.code===200){
|
||||||
|
showPop.value=false
|
||||||
|
showToast('提交成功!')
|
||||||
|
init()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
postAction('/suppliers',{name:form.value.name,active:form.value.active}).then((res:any)=>{
|
||||||
|
if(res.code===200){
|
||||||
|
showPop.value=false
|
||||||
|
showToast('提交成功!')
|
||||||
|
init()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//删除
|
||||||
|
const del=(item:any)=>{
|
||||||
|
let url='/suppliers/'+item.id
|
||||||
|
deleteAction(url).then((res:any)=>{
|
||||||
|
if(res.code===200){
|
||||||
|
showToast('删除成功!')
|
||||||
|
init()
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -31,6 +73,18 @@ const submit =()=>{
|
|||||||
@click-left="onClickLeft"
|
@click-left="onClickLeft"
|
||||||
@click-right="onClickRight"
|
@click-right="onClickRight"
|
||||||
/>
|
/>
|
||||||
|
<view>
|
||||||
|
<van-cell-group inset>
|
||||||
|
<van-field
|
||||||
|
v-model="name"
|
||||||
|
name="供应商名称"
|
||||||
|
label="供应商名称"
|
||||||
|
colon
|
||||||
|
class="bot"
|
||||||
|
label-width="6em"
|
||||||
|
/>
|
||||||
|
</van-cell-group>
|
||||||
|
</view>
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<view class="grid-container">
|
<view class="grid-container">
|
||||||
<view class="grid-item">编号</view>
|
<view class="grid-item">编号</view>
|
||||||
@ -39,12 +93,12 @@ const submit =()=>{
|
|||||||
<view class="grid-item">操作</view>
|
<view class="grid-item">操作</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="grid-container" v-for="(item,index) in list" :key="index">
|
<view class="grid-container" v-for="(item,index) in list" :key="index">
|
||||||
<view class="grid-item">{{item.name}}</view>
|
|
||||||
<view class="grid-item">{{item.id}}</view>
|
<view class="grid-item">{{item.id}}</view>
|
||||||
|
<view class="grid-item">{{item.name}}</view>
|
||||||
<view class="grid-item">{{item.id}}</view>
|
<view class="grid-item">{{item.id}}</view>
|
||||||
<view
|
<view
|
||||||
class="grid-item"><span style="color: #35a5f7" @click="edit(item)">编辑</span> <span
|
class="grid-item"><span style="color: #35a5f7" @click="edit(item)">编辑</span> <span
|
||||||
style="color: red">删除
|
style="color: red" @click="del(item)">删除
|
||||||
</span></view>
|
</span></view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -65,9 +119,9 @@ const submit =()=>{
|
|||||||
/>
|
/>
|
||||||
<van-field name="状态" label="状态" colon label-width="6em">
|
<van-field name="状态" label="状态" colon label-width="6em">
|
||||||
<template #input>
|
<template #input>
|
||||||
<van-radio-group v-model="form.type1" direction="horizontal">
|
<van-radio-group v-model="form.active" direction="horizontal">
|
||||||
<van-radio name="1">启用</van-radio>
|
<van-radio :name="true">启用</van-radio>
|
||||||
<van-radio name="2">禁用</van-radio>
|
<van-radio :name="false">禁用</van-radio>
|
||||||
</van-radio-group>
|
</van-radio-group>
|
||||||
</template>
|
</template>
|
||||||
</van-field>
|
</van-field>
|
||||||
|
Loading…
Reference in New Issue
Block a user