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

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"
>
<div class="header">
<div class="type_btn">
<!-- <div class="type_btn">
<el-button-group>
<el-button
@click="handleClick(1, '矽灵通RISCV')"
@ -35,7 +35,7 @@
@click="handleClick(10, '教学型ARM')"
>教学型ARM</el-button>
</el-button-group>
</div>
</div> -->
<h1 class="title">库存管理</h1>
<span class="date">{{ date }}</span>
<el-input
@ -44,6 +44,14 @@
suffix-icon="el-icon-search"
@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>
</el-row>
<el-row>
@ -55,7 +63,7 @@
</el-row>
<div class="table_container">
<div class="title">
<div class="name">{{ terminalTypeDesc }}</div>
<div class="name">{{ fzDeviceType ? fzDeviceType : '全部' }}</div>
<div class="num">
<span>{{ "总数:" + totalnum }}</span>
</div>
@ -125,6 +133,8 @@
command="教学型RISCV"
>教学型RISCV</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>
<div class="remove_icon" @click="close">X</div>
@ -215,9 +225,22 @@ export default {
operationType: 1, // 1-2-
form: {},
totalnum: 0,
terminalType: 0,
terminalTypeDesc: '全部',
searchNo: ''
searchNo: '',
fzDeviceType: '',
deviceOptions: [
'矽灵通RISCV',
'矽灵通ARM',
'矽望通',
'矽慧通',
'矽达通RISCV',
'矽达通ARM',
'AIIT-RISCV',
'AIIT-ARM',
'教学型RISCV',
'教学型ARM',
'矽数通工业型RISCV',
'矽数通工业型ARM'
]
}
},
mounted() {
@ -231,12 +254,6 @@ export default {
this.totalnum = res.data.length
})
},
getListByType(data) {
getListByType(data).then((res) => {
this.list = res.data
this.totalnum = res.data.length
})
},
handleClick(type, desc) {
this.terminalType = type
this.terminalTypeDesc = desc
@ -245,13 +262,10 @@ export default {
}
this.getListByType(data)
},
handleSearch(no) {
if (!no) {
this.terminalTypeDesc = '全部'
this.getList()
} else {
handleSearch() {
if (this.searchNo) {
const data = {
device_no: no
device_no: this.searchNo
}
getListByNo(data).then((res) => {
if (res.data) {
@ -263,6 +277,14 @@ export default {
this.totalnum = 0
}
})
} else {
const data = {
type: this.fzDeviceType
}
getListByType(data).then((res) => {
this.list = res.data
this.totalnum = res.data.length
})
}
},
remove(fzDeviceNo) {
@ -288,7 +310,7 @@ export default {
this.visible = true
},
add() {
this.form = { fzDeviceType: '矽灵通RISCV' }
this.form = { fzDeviceType: this.fzDeviceType ? this.fzDeviceType : '矽灵通RISCV' }
this.operationType = 1 //
this.visible = true
},
@ -296,7 +318,46 @@ export default {
this.visible = false
},
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 =
this.operationType === 1
? await add(data)
@ -329,6 +390,9 @@ export default {
display: inline-block;
margin-left: 20%;
}
.el-select{
width: 280px;
}
.type_btn {
// margin-right: 10%;
float: right;