代码优化

This commit is contained in:
BianLzhaoMin 2024-08-19 17:08:14 +08:00
parent f40a8a5119
commit 9bfcacb4df
1 changed files with 89 additions and 105 deletions

View File

@ -1,21 +1,12 @@
<template> <template>
<div class="app-container" id="secondStore"> <div class="app-container" id="secondStore">
<div <div class="upper-sec">
class="upper-sec" <div :class="[{ clicked: leaseType == 1 }]" @click="toggleBtn(1)">
> 长期领用
<div </div>
:class="[{ clicked: leaseType == 1 }]" <div :class="[{ clicked: leaseType == 0 }]" @click="toggleBtn(0)">
@click="toggleBtn(1)" 工程领用
> </div>
长期领用
</div>
<div
:class="[{ clicked: leaseType == 0 }]"
@click="toggleBtn(0)"
>
工程领用
</div>
</div> </div>
<el-form <el-form
:model="queryParams" :model="queryParams"
@ -166,7 +157,6 @@
label="工程名称" label="工程名称"
align="center" align="center"
key="3" key="3"
prop="proName" prop="proName"
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
v-if="leaseType == 0" v-if="leaseType == 0"
@ -175,49 +165,43 @@
label="类型名称" label="类型名称"
align="center" align="center"
key="4" key="4"
prop="typeName" prop="typeName"
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
/> />
<el-table-column <el-table-column
label="规格型号" label="规格型号"
align="center" align="center"
key="5" key="5"
prop="modelName"
prop="modelName" :show-overflow-tooltip="true"
:show-overflow-tooltip="true"
/> />
<el-table-column <el-table-column
label="计量单位" label="计量单位"
align="center" align="center"
key="6" key="6"
prop="nuitName"
prop="nuitName" :show-overflow-tooltip="true"
:show-overflow-tooltip="true"
/> />
<el-table-column <el-table-column
label="总量" label="总量"
align="center" align="center"
key="7" key="7"
prop="num"
prop="num" :show-overflow-tooltip="true"
:show-overflow-tooltip="true" v-if="leaseType == 1"
v-if="leaseType == 1"
/> />
<el-table-column <el-table-column
label="库存数量" label="库存数量"
align="center" align="center"
key="8" key="8"
prop="stockNum"
prop="stockNum" :show-overflow-tooltip="true"
:show-overflow-tooltip="true" v-if="leaseType == 1"
v-if="leaseType == 1"
/> />
<el-table-column <el-table-column
label="领用数量" label="领用数量"
align="center" align="center"
key="9" key="9"
prop="receiveNum" prop="receiveNum"
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
v-if="leaseType == 1" v-if="leaseType == 1"
@ -231,21 +215,19 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="在用数量" label="在用数量"
align="center" align="center"
key="10" key="10"
prop="receiveNum"
prop="receiveNum" :show-overflow-tooltip="true"
:show-overflow-tooltip="true" v-if="leaseType == 0"
v-if="leaseType == 0"
/> />
<el-table-column <el-table-column
label="操作" label="操作"
align="center" align="center"
key="11" key="11"
width="150"
width="150" v-if="leaseType == 1"
v-if="leaseType == 1"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
@ -273,11 +255,10 @@
</el-table> </el-table>
<pagination <pagination
v-show="total > 0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList(leaseType)"
/> />
<!-- 出库弹窗 --> <!-- 出库弹窗 -->
@ -318,9 +299,9 @@
<el-form-item label="出库数量" prop="outNum"> <el-form-item label="出库数量" prop="outNum">
<el-input <el-input
v-model="form.outNum" v-model="form.outNum"
placeholder="请输入出库数量" placeholder="请输入出库数量"
maxlength="20" maxlength="20"
/> />
</el-form-item> </el-form-item>
<el-form-item label="班组名称" prop="teamName"> <el-form-item label="班组名称" prop="teamName">
@ -383,12 +364,9 @@
/> />
</el-form-item> </el-form-item>
<el-form-item label="领用数量" prop="ckNum"> <el-form-item label="领用数量" prop="ckNum">
<el-input <el-input v-model="nform.ckNum" disabled />
v-model="nform.ckNum"
disabled
/>
</el-form-item> </el-form-item>
<!-- <el-form-item label="已出库数量" prop="ckNum"> <!-- <el-form-item label="已出库数量" prop="ckNum">
<el-input v-model="nform.ckNum" disabled /> <el-input v-model="nform.ckNum" disabled />
</el-form-item>--> </el-form-item>-->
@ -437,7 +415,7 @@
width="1200px" width="1200px"
append-to-body append-to-body
> >
<!-- <el-form <!-- <el-form
:model="dialogQuery" :model="dialogQuery"
ref="dialogQuery" ref="dialogQuery"
size="small" size="small"
@ -482,7 +460,12 @@
align="center" align="center"
width="80" width="80"
type="index" type="index"
:index="indexContinuation(dialogQuery.pageNum, dialogQuery.pageSize)" :index="
indexContinuation(
dialogQuery.pageNum,
dialogQuery.pageSize,
)
"
> >
<!-- <template slot-scope="scope"> <!-- <template slot-scope="scope">
<span>{{ <span>{{
@ -521,10 +504,10 @@
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
/> />
<el-table-column <el-table-column
label="出库时间" label="出库时间"
align="center" align="center"
prop="outTime" prop="outTime"
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
/> />
</el-table> </el-table>
@ -613,7 +596,7 @@ export default {
} }
}, },
trigger: 'blur', trigger: 'blur',
} },
], ],
teamName: [ teamName: [
{ {
@ -641,7 +624,7 @@ export default {
} }
}, },
trigger: 'blur', trigger: 'blur',
} },
], ],
teamName: [ teamName: [
{ {
@ -675,9 +658,9 @@ export default {
}, },
methods: { methods: {
// //
toggleBtn (count) { toggleBtn(count) {
this.leaseType = count; this.leaseType = count
this.getList(this.leaseType); this.getList(this.leaseType)
}, },
// //
getUnitList() { getUnitList() {
@ -728,7 +711,7 @@ export default {
/** 查询列表 */ /** 查询列表 */
getList(leaseType) { getList(leaseType) {
this.loading = true this.loading = true
this.queryParams.leaseType = leaseType; this.queryParams.leaseType = leaseType
secondaryWarehouseList(this.queryParams).then((response) => { secondaryWarehouseList(this.queryParams).then((response) => {
this.deviceList = response.rows this.deviceList = response.rows
this.total = response.total this.total = response.total
@ -750,7 +733,7 @@ export default {
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1 // this.queryParams.pageNum = 1
this.getList(this.leaseType) this.getList(this.leaseType)
}, },
handleDialogQuery() { handleDialogQuery() {
@ -815,7 +798,8 @@ export default {
this.$refs['form'].validate((valid) => { this.$refs['form'].validate((valid) => {
if (valid) { if (valid) {
if ( if (
parseInt(this.form.outNum) > parseInt(this.form.zkNum) parseInt(this.form.outNum) >
parseInt(this.form.zkNum)
) { ) {
this.$message.error('出库数量不可大于在库数量') this.$message.error('出库数量不可大于在库数量')
return return
@ -892,29 +876,29 @@ export default {
width: 60px !important; width: 60px !important;
margin-bottom: 10px; margin-bottom: 10px;
} }
.upper-sec{ .upper-sec {
display: flex; display: flex;
margin-bottom: 15px; margin-bottom: 15px;
div{ div {
box-sizing: border-box; box-sizing: border-box;
padding: 10px 30px; padding: 10px 30px;
background-color: #fff; background-color: #fff;
color: #999999; color: #999999;
font-size: 14px; font-size: 14px;
cursor: pointer; cursor: pointer;
} }
div:first-child{ div:first-child {
border-bottom-left-radius: 3px; border-bottom-left-radius: 3px;
border-top-left-radius: 3px; border-top-left-radius: 3px;
} }
div:last-child{ div:last-child {
border-top-right-radius: 3px; border-top-right-radius: 3px;
border-bottom-right-radius: 3px; border-bottom-right-radius: 3px;
} }
.clicked{ .clicked {
background-color: #409EFF; background-color: #409eff;
color: #fff; color: #fff;
} }
} }
.clickText { .clickText {
color: #02a7f0; color: #02a7f0;