库存管理页面修改设备类型选择方式,新增设备编号自动添加前缀

This commit is contained in:
龚祖望 2023-11-30 16:24:28 +08:00
parent 5c413a345d
commit cbe5bd13f3
1 changed files with 84 additions and 20 deletions

View File

@ -6,7 +6,7 @@
style="align-items: baseline; margin-bottom: 30px" style="align-items: baseline; margin-bottom: 30px"
> >
<div class="header"> <div class="header">
<div class="type_btn"> <!-- <div class="type_btn">
<el-button-group> <el-button-group>
<el-button <el-button
@click="handleClick(1, '矽灵通RISCV')" @click="handleClick(1, '矽灵通RISCV')"
@ -35,7 +35,7 @@
@click="handleClick(10, '教学型ARM')" @click="handleClick(10, '教学型ARM')"
>教学型ARM</el-button> >教学型ARM</el-button>
</el-button-group> </el-button-group>
</div> </div> -->
<h1 class="title">库存管理</h1> <h1 class="title">库存管理</h1>
<span class="date">{{ date }}</span> <span class="date">{{ date }}</span>
<el-input <el-input
@ -44,6 +44,14 @@
suffix-icon="el-icon-search" suffix-icon="el-icon-search"
@change="handleSearch" @change="handleSearch"
/> />
<el-select v-model="fzDeviceType" style="margin-left:20px" clearable placeholder="请选择" @change="handleSearch">
<el-option
v-for="(item, index) in deviceOptions"
:key="index"
:value="item"
:label="item"
/>
</el-select>
</div> </div>
</el-row> </el-row>
<el-row> <el-row>
@ -55,7 +63,7 @@
</el-row> </el-row>
<div class="table_container"> <div class="table_container">
<div class="title"> <div class="title">
<div class="name">{{ terminalTypeDesc }}</div> <div class="name">{{ fzDeviceType ? fzDeviceType : '全部' }}</div>
<div class="num"> <div class="num">
<span>{{ "总数:" + totalnum }}</span> <span>{{ "总数:" + totalnum }}</span>
</div> </div>
@ -125,6 +133,8 @@
command="教学型RISCV" command="教学型RISCV"
>教学型RISCV</el-dropdown-item> >教学型RISCV</el-dropdown-item>
<el-dropdown-item command="教学型ARM">教学型ARM</el-dropdown-item> <el-dropdown-item command="教学型ARM">教学型ARM</el-dropdown-item>
<el-dropdown-item command="矽数通工业型RISCV">矽数通工业型RISCV</el-dropdown-item>
<el-dropdown-item command="矽数通工业型ARM">矽数通工业型ARM</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
<div class="remove_icon" @click="close">X</div> <div class="remove_icon" @click="close">X</div>
@ -215,9 +225,22 @@ export default {
operationType: 1, // 1-2- operationType: 1, // 1-2-
form: {}, form: {},
totalnum: 0, totalnum: 0,
terminalType: 0, searchNo: '',
terminalTypeDesc: '全部', fzDeviceType: '',
searchNo: '' deviceOptions: [
'矽灵通RISCV',
'矽灵通ARM',
'矽望通',
'矽慧通',
'矽达通RISCV',
'矽达通ARM',
'AIIT-RISCV',
'AIIT-ARM',
'教学型RISCV',
'教学型ARM',
'矽数通工业型RISCV',
'矽数通工业型ARM'
]
} }
}, },
mounted() { mounted() {
@ -231,12 +254,6 @@ export default {
this.totalnum = res.data.length this.totalnum = res.data.length
}) })
}, },
getListByType(data) {
getListByType(data).then((res) => {
this.list = res.data
this.totalnum = res.data.length
})
},
handleClick(type, desc) { handleClick(type, desc) {
this.terminalType = type this.terminalType = type
this.terminalTypeDesc = desc this.terminalTypeDesc = desc
@ -245,13 +262,10 @@ export default {
} }
this.getListByType(data) this.getListByType(data)
}, },
handleSearch(no) { handleSearch() {
if (!no) { if (this.searchNo) {
this.terminalTypeDesc = '全部'
this.getList()
} else {
const data = { const data = {
device_no: no device_no: this.searchNo
} }
getListByNo(data).then((res) => { getListByNo(data).then((res) => {
if (res.data) { if (res.data) {
@ -263,6 +277,14 @@ export default {
this.totalnum = 0 this.totalnum = 0
} }
}) })
} else {
const data = {
type: this.fzDeviceType
}
getListByType(data).then((res) => {
this.list = res.data
this.totalnum = res.data.length
})
} }
}, },
remove(fzDeviceNo) { remove(fzDeviceNo) {
@ -288,7 +310,7 @@ export default {
this.visible = true this.visible = true
}, },
add() { add() {
this.form = { fzDeviceType: '矽灵通RISCV' } this.form = { fzDeviceType: this.fzDeviceType ? this.fzDeviceType : '矽灵通RISCV' }
this.operationType = 1 // this.operationType = 1 //
this.visible = true this.visible = true
}, },
@ -296,7 +318,46 @@ export default {
this.visible = false this.visible = false
}, },
async save() { async save() {
const data = { ...this.form } let prepend = ''
switch (this.form.fzDeviceType) {
case '矽灵通RISCV':
prepend = '3559A 5G-'
break
case '矽灵通ARM':
prepend = '3559A 4G-'
break
case '矽望通':
prepend = 'M7 A7 5G-'
break
case '矽慧通':
prepend = 'MLU220 5G-'
break
case '矽达通RISCV':
prepend = 'RISCV 4G-1'
break
case '矽达通ARM':
prepend = 'ARM 4G-'
break
case 'AIIT-RISCV':
prepend = 'RISCV-'
break
case 'AIIT-ARM':
prepend = 'ARM-'
break
case '教学型RISCV':
prepend = 'EDU-RISCV-'
break
case '教学型ARM':
prepend = 'EDU-ARM-'
break
case '矽数通工业型RISCV':
prepend = 'RISCV LoRa-'
break
case '矽数通工业型ARM':
prepend = 'M4 LoRa-'
break
}
const data = { ...this.form, fzDeviceNo: prepend + this.form.fzDeviceNo }
const res = const res =
this.operationType === 1 this.operationType === 1
? await add(data) ? await add(data)
@ -329,6 +390,9 @@ export default {
display: inline-block; display: inline-block;
margin-left: 20%; margin-left: 20%;
} }
.el-select{
width: 280px;
}
.type_btn { .type_btn {
// margin-right: 10%; // margin-right: 10%;
float: right; float: right;