代码提交

This commit is contained in:
jiang 2025-09-22 18:52:41 +08:00
parent 28eb3f2fab
commit ebe21dfd11
6 changed files with 960 additions and 1118 deletions

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="upload-file"> <div class="upload-file">
<el-upload <z
multiple multiple
:action="uploadFileUrl" :action="uploadFileUrl"
:before-upload="handleBeforeUpload" :before-upload="handleBeforeUpload"
@ -23,7 +23,7 @@
<template v-if="fileType"> 格式为 <b style="color: #f56c6c">{{ fileType.join("/") }}</b> </template> <template v-if="fileType"> 格式为 <b style="color: #f56c6c">{{ fileType.join("/") }}</b> </template>
的文件 的文件
</div> </div>
</el-upload> </z>
<!-- 文件列表 --> <!-- 文件列表 -->
<transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul"> <transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul">

View File

@ -0,0 +1,379 @@
<template>
<!-- 修复标题模板字符串语法错误规范属性顺序 -->
<el-dialog
title="新增装备"
:visible.sync="isVisible"
width="70%"
style="z-index: 3000 !important;"
:modal="false"
:close-on-click-modal="false"
:before-close="handleClose"
destroy-on-close
>
<!-- 弹窗内容区域 -->
<div class="app-content">
<el-form
label-width="180px"
ref="formRef"
label-position="right"
:model="form"
:rules="equipRules"
>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="装备名称:" prop="deviceName">
<el-input
autocomplete="off"
maxlength="30"
v-model="form.deviceName"
clearable
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="装备类目:" prop="deviceTypeList">
<el-cascader
v-model="form.deviceTypeList"
:show-all-levels="true"
:options="deviceTypeTree"
:props="partTypeTreeProps"
placeholder="请选择装备类目"
ref="dialogTypeCascader"
@change="dialogTypeChange"
style="width: 100%"
></el-cascader>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="装备单位:" prop="unitName">
<el-input
autocomplete="off"
maxlength="20"
v-model="form.unitName"
clearable
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="装备品牌" prop="brand">
<el-input
v-model="form.brand"
autocomplete="off"
maxlength="20"
clearable
/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="出厂日期:" prop="productionDate">
<el-date-picker
v-model="form.productionDate"
placeholder="请选择出厂日期"
value-format="yyyy-MM-DD"
type="date"
style="width: 100%"
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="租赁价格(天/元)" prop="dayLeasePrice">
<el-input
@input="handlePriceInput"
clearable
maxlength="20"
placeholder="请输入租赁价格"
v-model="form.dayLeasePrice"
/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="联系人:" prop="person">
<el-input
v-model="form.person"
placeholder="请输入联系人"
clearable
maxlength="10"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系电话:" prop="personPhone">
<el-input
v-model="form.personPhone"
placeholder="请输入联系电话"
clearable
maxlength="11"
/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="装备数量:" prop="deviceCount">
<el-input
v-model="form.deviceCount"
placeholder="请输入装备数量"
type="number"
clearable
maxlength="10"
:disabled="form.deviceType == 0"
/>
</el-form-item>
</el-col>
<!-- 临时录入使用 - start -->
<el-col :span="12">
<el-form-item label="原值:" prop="buyPrice">
<el-input-number
v-model="form.buyPrice"
placeholder="请输入原值"
clearable
maxlength="20"
:controls="false"
align="left"
style="width: 100%"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="管理方式:" prop="deviceType">
<!-- 0 编码 1 数量 -->
<el-select
v-model="form.deviceType"
placeholder="请选择管理方式"
clearable
@change="deviceTypeChange"
style="width: 100%"
>
<el-option label="编码" :value="0"/>
<el-option label="数量" :value="1"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="标准使用时间:" prop="expirationTime">
<el-date-picker
type="date"
style="width: 100%"
value-format="yyyy-MM-DD"
placeholder="请选择标准使用时间"
v-model="form.expirationTime"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<!-- 底部按钮区域 -->
<template #footer>
<div class="dialog-footer">
<el-button @click="handleClose">取消</el-button>
<el-button type="primary" @click="handleSubmit">确认</el-button>
</div>
</template>
</el-dialog>
</template>
<script>
import { equipmentAddApiNew, getEquipmentAddIdApi, getEquipmentTypeApi } from '@/api/EquipmentEntryApply'
export default {
name: 'EquipmentEntryEditDialog', //
props: {
// prop
isVisible: {
type: Boolean,
default: false,
description: '控制弹窗显示与隐藏'
},
orderId: {
type: String,
default: '',
description: '关联的订单ID字符串'
}
},
emits: ['update:isVisible', 'submit', 'getOrderId'], //
data() {
return {
deviceTypeTree: [],
partTypeTreeProps: {
children: 'children',
label: 'name',
value: 'id'
},
orderId: '',
form: {
deviceName: '',
deviceTypeList: [],
deviceCount: 1,
originaValue: '',
itemTypeModel: '',
deviceType: '',
buyPrice: '',
unitName: '',
code: '',
brand: '',
typeId: '',
companyId: '',
productionDate: '',
dayLeasePrice: '',
person: '',
personPhone: '',
deviceWeight: '',
checkDate: '',
checkCycle: '',
devInfoProperties: [],
tableList: [],
isZone: true,
zoneId: '',
expirationTime: '',
orderId: ''
},//
equipRules: {
originaValue: [
{ required: true, message: '请输入原值', trigger: 'blur' }
],
buyPrice: [
{ required: true, message: '请输入原值', trigger: 'blur' }
],
itemTypeModel: [
{ required: true, message: '请输入规格型号', trigger: 'blur' }
],
deviceType: [
{ required: false, message: '请选择管理方式', trigger: 'change' }
],
deviceName: [
{ required: true, message: '请输入装备名称', trigger: 'blur' }
],
deviceTypeList: [
{ required: true, message: '请选择装备类目', trigger: 'change' }
],
deviceCount: [
{ required: true, message: '请输入装备数量', trigger: 'blur' }
],
unitName: [
{ required: true, message: '装备单位不可为空', trigger: 'blur' }
],
brand: [
{ required: true, message: '请输入装备品牌', trigger: 'blur' }
],
code: [
{ required: true, message: '请输入装备编号', trigger: 'change' }
],
companyId: [
{ required: true, message: '请选择所属公司', trigger: 'change' }
],
productionDate: [
{ required: true, message: '请选择出厂日期', trigger: 'change' }
],
dayLeasePrice: [
{ required: true, message: '请输入日租金', trigger: 'blur' }
],
expirationTime: [
{ required: true, trigger: 'change', message: '请选择标准使用时间' }
],
person: [
{ required: true, message: '联系人不能为空', trigger: 'blur' }
],
checkDate: [
{ required: true, message: '校验日期不能为空', trigger: 'blur' }
],
checkCycle: [
{ required: true, message: '校验周期不能为空', trigger: 'blur' }
],
personPhone: [
{ required: true, message: '联系电话不能为空', trigger: 'blur' },
{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: '请输入正确的手机号码', trigger: 'blur' }
]
}
}
},
watch: {
isVisible(val) {
if (val) {
this.getTypeTreeData()
}
}
},
methods: {
deviceTypeChange(val) {
if (val === 0) {
this.form.deviceCount = '1'
}
},
async dialogTypeChange() {
this.options = []
const cascader = this.$refs.dialogTypeCascader
const deviceTypeList = cascader.getCheckedNodes()
if (deviceTypeList.length > 0) {
this.form.unitName = deviceTypeList[0].data.unitName
this.form.dayLeasePrice = deviceTypeList[0].data.leasePrice
}
},
//
handlePriceInput(v) {
this.form.dayLeasePrice = v.replace(/[^\d.]/g, '')
},
//
async getTypeTreeData() {
const res = await getEquipmentTypeApi()
this.deviceTypeTree = res.data
},
/**
* 处理弹窗关闭
*/
handleClose() {
this.$refs.formRef.resetFields()
this.$emit('update:isVisible', false)
},
/**
* 处理表单提交
*/
async handleSubmit() {
this.$refs['formRef'].validate(async valid => {
if (valid) {
if (!this.orderId) {
const result = await getEquipmentAddIdApi()
this.orderId = result.data.id
}
this.form.orderId = this.orderId
// ID
this.form.typeId = this.form.deviceTypeList[this.form.deviceTypeList.length - 1]
const res = await equipmentAddApiNew(this.form)
if (res.code === 200) {
//
this.$emit('getOrderId', {
orderId: this.orderId
})
this.handleClose()
}
}
}
)
}
}
}
</script>
<style lang="scss" scoped>
.dialog-content {
padding: 10px 0;
min-height: 200px; //
}
.dialog-footer {
display: flex;
justify-content: flex-end;
gap: 10px; //
}
</style>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,349 @@
<template>
<!-- 修复标题模板字符串语法错误规范属性顺序 -->
<el-dialog
title="装备录入"
:visible.sync="isVisible"
width="70%"
:modal="false"
:close-on-click-modal="false"
:before-close="handleClose"
destroy-on-close
>
<!-- 弹窗内容区域 -->
<div class="app-content">
<!-- 商品管理 -->
<el-form
:model="queryParams"
ref="queryFormRef"
:inline="true"
inline
label-width="auto"
size="small"
>
<!-- 表单搜索 -->
<el-row>
<el-col :span="6">
<el-form-item label="装备名称" prop="deviceName">
<el-input
v-model.trim="queryParams.deviceName"
style="width: 100%"
clearable
placeholder="请输入装备名称"
/>
</el-form-item>
</el-col>
<el-col :span="5" style="float: right">
<el-form-item>
<el-button class="primary-lease" type="primary" @click="queryTableList">
查询
</el-button>
<el-button
class="primary-lease"
type="primary"
@click="resetTableList"
>
重置
</el-button>
<el-button
class="primary-lease"
type="primary"
@click="equipmentDeployment"
v-show="!isAddVisible"
>
新增装备
</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<!-- 表格 -->
<el-table
:data="tableData"
style="width: auto"
show-overflow-tooltip
>
<el-table-column label="序号" align="center" width="80" type="index"></el-table-column>
<el-table-column align="center" label="装备名称">
<template scope="{ row }">
{{ `${row.deviceName}` }}
</template>
</el-table-column>
<el-table-column align="center" prop="code" label="装备编号"/>
<el-table-column align="center" prop="typeName" label="装备类目">
<template scope="{ row }">
<span>
{{ row.proType }} <span v-show="row.proType">/</span>
{{ row.mainGx }}<span v-show="row.mainGx">/</span>
{{ row.childGx }}<span v-show="row.childGx">/</span>
{{ row.devCategory }}<span v-show="row.devCategory">/</span>
{{ row.devSubcategory }}<span v-show="row.devSubcategory">/</span>
{{ row.devName }}
</span>
</template>
</el-table-column>
<el-table-column align="center" prop="devModel" label="装备型号"/>
<el-table-column align="center" prop="nextCheckDate" label="下次检验日期">
<template scope="{ row }">
<span>{{
row.nextCheckDate
}}</span>
</template>
</el-table-column>
<el-table-column align="center" label="装备状态">
<template scope="{ row }">
<el-tag v-if="row.entryStatus == 0" size="small" type="info">待审批</el-tag>
<el-tag v-if="row.entryStatus == 1" size="small" type="warning">已审批</el-tag>
<el-tag v-if="row.entryStatus == 2" size="small" type="success">审批驳回</el-tag>
<el-tag v-if="row.entryStatus == 3" size="small" type="danger">草稿</el-tag>
</template>
</el-table-column>
<el-table-column
prop="name"
label="操作"
min-width="160px"
align="center"
v-if="!isAddVisible"
>
<template scope="{ row }">
<el-button
size="small"
type="primary"
@click="editRowInfo(row)"
>
编辑
</el-button>
<el-button
size="small"
type="danger"
@click="deleteRowInfo(row)"
>删除
</el-button>
</template>
</el-table-column>
<el-table-column
prop="name"
label="操作"
min-width="160px"
align="center"
v-if="!isApprovalVisible"
>
<template scope="{ row }">
<el-button
size="small"
type="primary"
@click="approval(row,1)"
>
通过
</el-button>
<el-button
size="small"
type="primary"
@click="approval(row,2)"
>
驳回
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
:total="total"
@pagination="getList"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
/>
</div>
<!-- 底部按钮区域 -->
<template #footer>
<div class="dialog-footer" v-show="!isAddVisible">
<el-button @click="handleClose">取消</el-button>
<el-button type="primary" @click="handleSubmit" :disabled="tableData.length==0">确认提交</el-button>
</div>
</template>
<EquipmentEntryEditDialog
:is-visible.sync="isEditVisible"
:order-id="orderId"
@getOrderId="getOrderId"
/>
</el-dialog>
</template>
<script>
import EquipmentEntryEditDialog from '@/views/EquipmentEntryApply/equipmentInput/edit.vue'
// 使defineComponent
import {
equipmentDraftListApiNew,
equipmentPassAndRejectApiNew,
equipmentSubmitApiNew,
removeDeviceApi
} from '@/api/EquipmentEntryApply'
export default {
name: 'EquipmentEntryDialog',
components: { EquipmentEntryEditDialog },
//
props: {
// prop
isVisible: {
type: Boolean,
default: false,
description: '控制弹窗显示与隐藏'
},
isAddVisible: {
type: Boolean,
default: false
},
orderId: {
type: String,
default: '',
description: '关联的订单ID字符串'
},
isApprovalVisible: {
type: Boolean,
default: false
}
},
emits: ['update:isVisible', 'submit'], //
data() {
return {
isEditVisible: false,
//
tableData: [],
total: 0,
queryParams: {
orderId: '',
deviceName: '',
pageNum: 1,
pageSize: 10
},
//
formData: {
//
equipmentName: '',
model: '',
quantity: 1
}
}
},
watch: {
isVisible(val) {
if (val) {
this.getList()
}
}
},
methods: {
async approval(row, status) {
equipmentPassAndRejectApiNew({ devIds: row.maId, status: status, id: this.orderId }).then(res => {
if (res.code === 200) {
this.$message({
type: 'success',
message: '操作成功'
})
this.getList()
}
})
},
//
async getList() {
try {
this.queryParams.orderId = this.orderId
const res = await equipmentDraftListApiNew(this.queryParams)
this.tableData = res.data.rows
this.total = res.data.total
} catch (error) {
console.error('获取列表失败:', error)
}
},
getOrderId(data) {
this.orderId = data.orderId
this.queryTableList()
},
//
queryTableList() {
this.queryParams.pageNum = 1
this.getList()
},
equipmentDeployment() {
this.isEditVisible = true
},
//
async deleteRowInfo(row) {
this.$confirm('是否确定删除?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
return removeDeviceApi([row.maId])
})
.then(res => {
if (res.code === 200) {
this.$message({
type: 'success',
message: '删除成功'
})
this.getList()
}
})
.catch(() => {
})
},
//
resetTableList() {
this.$refs.queryFormRef.resetFields()
this.queryParams.pageNum = 1
this.getList()
},
/**
* 处理弹窗关闭
*/
handleClose() {
this.$emit('update:isVisible', false)
},
/**
* 处理表单提交
*/
handleSubmit() {
equipmentSubmitApiNew({ id: this.orderId, status: 0 }).then(res => {
if (res.code === 200) {
this.$message({
type: 'success',
message: '提交成功'
})
this.handleClose()
this.$emit('submit', {
orderId: this.orderId
})
}
})
}
}
}
</script>
<style lang="scss" scoped>
.dialog-content {
padding: 10px 0;
min-height: 200px; //
}
.dialog-footer {
display: flex;
justify-content: flex-end;
gap: 10px; //
}
</style>

View File

@ -1,19 +1,15 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<template v-if="!isEquipmentInputShow"> <template>
<el-form :model="queryParams" ref="queryFormRef" inline label-width="auto" size="small"> <el-form
:model="queryParams"
ref="queryFormRef"
inline
label-width="auto"
size="small"
>
<!-- 表单搜索 --> <!-- 表单搜索 -->
<el-row> <el-row>
<el-col :span="5">
<el-form-item label="关键字" prop="keyWord">
<el-input
clearable
style="width: 100%"
placeholder="请输入关键字"
v-model.trim="queryParams.keyWord"
/>
</el-form-item>
</el-col>
<el-col :span="5"> <el-col :span="5">
<el-form-item label="审批状态" prop="status"> <el-form-item label="审批状态" prop="status">
<el-select <el-select
@ -35,32 +31,24 @@
value-format="YYYY-MM-DD" value-format="YYYY-MM-DD"
placeholder="请选择申请时间" placeholder="请选择申请时间"
v-model="queryParams.applyTime" v-model="queryParams.applyTime"
> />
</el-date-picker>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="9"> <el-col :span="5" style="float:right;">
<el-form-item prop="code"> <el-form-item>
<el-button class="primary-lease" type="primary" @click="onHandleSQuery()"> <el-button class="primary-lease" type="primary" @click="getEquipmentApplyList">
查询 查询
</el-button> </el-button>
<el-button class="primary-lease" type="primary" @click="onHandleReset()"> <el-button class="primary-lease" type="primary" @click="resetForm">
重置 重置
</el-button> </el-button>
<el-button <el-button
class="primary-lease" class="primary-lease"
type="primary" type="primary"
@click="onHandleEquipmentInput()" @click="showEquipmentInput()"
> >
装备录入 装备录入
</el-button> </el-button>
<el-button
class="primary-lease"
type="primary"
@click="onHandleBatchImport()"
>
批量导入
</el-button>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -80,25 +68,25 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
<template slot-scope="{ row }"> <template slot-scope="{ row }">
<el-button type="primary" size="small" @click="onHandleView(row)"> <el-button type="primary" size="small" @click="showEquipmentInput(row.id, true)">
查看 查看
</el-button> </el-button>
<el-button <el-button
type="primary" type="primary"
size="small" size="small"
@click="onHandleEdit(row)" @click="showEquipmentInput(row.id, false)"
v-if="row.status == 3" v-if="row.status == '3'"
> >
编辑 编辑
</el-button> </el-button>
<el-button type="primary" size="small" @click="onHandleDelete(row)"> <!-- <el-button type="primary" size="small" v-if="row.status == '0'" @click="deleteItem(row)">
删除 删除
</el-button> </el-button>-->
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 分页 -->
<!-- 分页 -->
<pagination <pagination
:total="total" :total="total"
@pagination="handlePageChange" @pagination="handlePageChange"
@ -107,27 +95,31 @@
/> />
</el-form> </el-form>
</template> </template>
<EquipmentEntryDialog
<EquipmentInput :order-ids="orderIds" :is-view="isView" v-else @backList="onHandleBackList"/> :is-visible.sync="isVisible"
:order-id="orderId"
:is-add-visible="isAddVisible"
:is-approval-visible="true"
@submit="getEquipmentApplyList"
/>
</div> </div>
</template> </template>
<script> <script>
import { getEquipmentApplyListApi, equipmentDelApiNew } from '@/api/EquipmentEntryApply/index' import { getEquipmentApplyListApi, equipmentDelApiNew } from '@/api/EquipmentEntryApply/index'
import EquipmentInput from '@/views/EquipmentEntryApply/equipmentInput/index.vue' import EquipmentEntryDialog from '@/views/EquipmentEntryApply/equipmentInput/index1.vue'
export default { export default {
components: { components: {
EquipmentInput EquipmentEntryDialog
}, },
data() { data() {
return { return {
total: 0, total: 0,
orderIds: '', orderId: '',
isView: false, isVisible: false,
isEquipmentInputShow: false, isAddVisible: false,
queryParams: { queryParams: {
keyWord: '',
status: '', status: '',
applyTime: '', applyTime: '',
pageNum: 1, pageNum: 1,
@ -140,106 +132,72 @@ export default {
this.getEquipmentApplyList() this.getEquipmentApplyList()
}, },
methods: { methods: {
// /**
* 获取装备申请列表
*/
getEquipmentApplyList() { getEquipmentApplyList() {
getEquipmentApplyListApi(this.queryParams).then((res) => { getEquipmentApplyListApi(this.queryParams)
console.log('获取装备申请列表***', res) .then(res => {
this.tableData = res.data.rows this.tableData = res.data.rows
this.total = res.data.total this.total = res.data.total
}).catch(error => { })
console.error('获取装备申请列表失败:', error) .catch(error => {
}) console.error('获取装备申请列表失败:', error)
})
}, },
// /**
handlePageChange(pageNum) { * 分页变化处理
this.queryParams.pageNum = pageNum */
handlePageChange() {
this.getEquipmentApplyList() this.getEquipmentApplyList()
}, },
handleSizeChange(pageSize) { /**
this.queryParams.pageSize = pageSize * 重置表单
this.getEquipmentApplyList() */
}, resetForm() {
onHandleSQuery() {
console.log('查询')
this.getEquipmentApplyList()
},
onHandleReset() {
console.log('重置')
this.queryParams = {
keyWord: '',
status: '',
applyTime: '',
pageNum: 1,
pageSize: 10
}
this.$refs.queryFormRef.resetFields() this.$refs.queryFormRef.resetFields()
this.queryParams.pageNum = 1
this.getEquipmentApplyList() this.getEquipmentApplyList()
}, },
onHandleEquipmentInput() { /**
this.orderIds = '' * 显示装备录入/编辑/查看界面
this.isView = false */
this.isEquipmentInputShow = true showEquipmentInput(orderId, isAddVisible) {
this.orderId = orderId
this.isVisible = true
this.isAddVisible = isAddVisible
}, },
onHandleBatchImport() { /**
console.log('批量导入') * 删除项目
}, */
deleteItem(row) {
onHandleView(row) {
console.log('查看', row)
this.orderIds = row.id
this.isView = true
this.isEquipmentInputShow = true
},
onHandleEdit(row) {
this.orderIds = row.id
this.isView = false
this.isEquipmentInputShow = true
console.log('编辑', row)
},
onHandleDelete(row) {
this.$confirm('是否确定删除?', '提示', { this.$confirm('是否确定删除?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { })
console.log('删除', row) .then(() => equipmentDelApiNew({ id: row.id }))
equipmentDelApiNew({ id: row.id }).then((res) => { .then(res => {
console.log('删除结果', res)
if (res.code === 200) { if (res.code === 200) {
this.$message({ this.$message.success('删除成功')
type: 'success',
message: '删除成功',
duration: 1000
})
this.getEquipmentApplyList() this.getEquipmentApplyList()
} else { } else {
this.$message({ this.$message.error('删除失败')
type: 'error', }
message: '删除失败', })
duration: 1000 .catch(error => {
}) if (error !== 'cancel') { //
console.error('删除失败:', error)
this.$message.error('删除失败,请重试')
} }
}).catch(error => {
console.error('删除失败:', error)
this.$message.error('删除失败,请重试')
}) })
}).catch(() => {
//
})
},
onHandleBackList() {
this.isEquipmentInputShow = false
this.getEquipmentApplyList()
} }
} }
} }
</script> </script>

View File

@ -1,19 +1,15 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<template v-if="!isEquipmentInputShow"> <template>
<el-form :model="queryParams" ref="queryFormRef" inline label-width="auto" size="small"> <el-form
:model="queryParams"
ref="queryFormRef"
inline
label-width="auto"
size="small"
>
<!-- 表单搜索 --> <!-- 表单搜索 -->
<el-row> <el-row>
<el-col :span="5">
<el-form-item label="关键字" prop="keyWord">
<el-input
clearable
style="width: 100%"
placeholder="请输入关键字"
v-model.trim="queryParams.keyWord"
/>
</el-form-item>
</el-col>
<el-col :span="5"> <el-col :span="5">
<el-form-item label="审批状态" prop="status"> <el-form-item label="审批状态" prop="status">
<el-select <el-select
@ -22,8 +18,8 @@
placeholder="请选择审批状态" placeholder="请选择审批状态"
v-model="queryParams.status" v-model="queryParams.status"
> >
<el-option label="待审批" value="0" /> <el-option label="待审批" value="0"/>
<el-option label="已审批" value="1" /> <el-option label="已审批" value="1"/>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -35,53 +31,51 @@
value-format="YYYY-MM-DD" value-format="YYYY-MM-DD"
placeholder="请选择申请时间" placeholder="请选择申请时间"
v-model="queryParams.applyTime" v-model="queryParams.applyTime"
> />
</el-date-picker>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="9"> <el-col :span="5" style="float:right;">
<el-form-item prop="code"> <el-form-item>
<el-button class="primary-lease" type="primary" @click="onHandleSQuery()"> <el-button class="primary-lease" type="primary" @click="getEquipmentApplyList">
查询 查询
</el-button> </el-button>
<el-button class="primary-lease" type="primary" @click="onHandleReset()"> <el-button class="primary-lease" type="primary" @click="resetForm">
重置 重置
</el-button> </el-button>
<el-button
class="primary-lease"
type="primary"
@click="onHandleBatchImport()"
>
批量导入
</el-button>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<!-- 表格 --> <!-- 表格 -->
<el-table :data="tableData"> <el-table :data="tableData">
<el-table-column label="序号" align="center" width="55" type="index" /> <el-table-column label="序号" align="center" width="55" type="index"/>
<el-table-column prop="createUser" label="申请人" align="center" /> <el-table-column prop="createUser" label="申请人" align="center"/>
<el-table-column prop="createTime" label="申请时间" align="center" /> <el-table-column prop="createTime" label="申请时间" align="center"/>
<el-table-column prop="devCount" label="设备数量" align="center" /> <el-table-column prop="devCount" label="设备数量" align="center"/>
<el-table-column prop="status" align="center" label="审批状态"> <el-table-column prop="status" align="center" label="审批状态">
<template slot-scope="{ row }"> <template slot-scope="{ row }">
<el-tag v-if="row.status == 0" size="small" type="info">待审批</el-tag> <el-tag v-if="row.status == 0" size="small" type="info">待审批</el-tag>
<el-tag v-if="row.status == 1" size="small" type="warning">已完成</el-tag> <el-tag v-if="row.status == 1" size="small" type="warning">已审批</el-tag>
<el-tag v-if="row.status == 3" size="small" type="success">草稿</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
<template slot-scope="{ row }"> <template slot-scope="{ row }">
<el-button type="primary" size="small" @click="onHandleView(row)"> <el-button type="primary" size="small" @click="showEquipmentInput(row.id, true)">
查看 查看
</el-button> </el-button>
<el-button type="primary" size="small" @click="onHandleAuditing(row)"> <el-button
type="primary"
size="small"
@click="showEquipmentInput(row.id, false)"
v-if="row.status == '0'"
>
审批 审批
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 分页 -->
<pagination <pagination
:total="total" :total="total"
@pagination="handlePageChange" @pagination="handlePageChange"
@ -90,31 +84,35 @@
/> />
</el-form> </el-form>
</template> </template>
<EquipmentEntryDialog
<!-- <EquipmentInput :order-ids="orderIds" :is-view="isView" v-else @backList="onHandleBackList" />--> :is-visible.sync="isVisible"
:order-id="orderId"
:is-add-visible="true"
:is-approval-visible="isApprovalVisible"
/>
</div> </div>
</template> </template>
<script> <script>
import { getEquipmentApplyListApi, equipmentDelApiNew } from '@/api/EquipmentEntryApply/index' import { getEquipmentApplyListApi, equipmentDelApiNew } from '@/api/EquipmentEntryApply/index'
import EquipmentEntryDialog from '@/views/EquipmentEntryApply/equipmentInput/index1.vue'
export default { export default {
components: { components: {
/* EquipmentInput */ EquipmentEntryDialog
}, },
data() { data() {
return { return {
total: 0, total: 0,
orderIds: '', orderId: '',
isView: false, isVisible: false,
isEquipmentInputShow: false, isAddVisible: false,
isApprovalVisible: false,
queryParams: { queryParams: {
keyWord: '',
status: '0', status: '0',
applyTime: '', applyTime: '',
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10
}, },
tableData: [] tableData: []
} }
@ -123,106 +121,79 @@ export default {
this.getEquipmentApplyList() this.getEquipmentApplyList()
}, },
methods: { methods: {
// /**
* 获取装备申请列表
*/
getEquipmentApplyList() { getEquipmentApplyList() {
getEquipmentApplyListApi(this.queryParams).then((res) => { getEquipmentApplyListApi(this.queryParams)
console.log('获取装备申请列表***', res) .then(res => {
this.tableData = res.data.rows this.tableData = res.data.rows
this.total = res.data.total this.total = res.data.total
}).catch(error => { })
console.error('获取装备申请列表失败:', error) .catch(error => {
}) console.error('获取装备申请列表失败:', error)
})
}, },
// /**
handlePageChange(pageNum) { * 分页变化处理
this.queryParams.pageNum = pageNum */
handlePageChange() {
this.getEquipmentApplyList() this.getEquipmentApplyList()
}, },
handleSizeChange(pageSize) { /**
this.queryParams.pageSize = pageSize * 重置表单
this.getEquipmentApplyList() */
}, resetForm() {
onHandleSQuery() {
console.log('查询')
this.getEquipmentApplyList()
},
onHandleReset() {
console.log('重置')
this.queryParams = {
keyWord: '',
status: '0',
applyTime: '',
pageNum: 1,
pageSize: 10,
}
this.$refs.queryFormRef.resetFields() this.$refs.queryFormRef.resetFields()
this.queryParams.pageNum = 1
this.getEquipmentApplyList() this.getEquipmentApplyList()
}, },
onHandleEquipmentInput() { /**
this.orderIds = '' * 显示装备录入/编辑/查看界面
this.isView = false */
this.isEquipmentInputShow = true showEquipmentInput(orderId, isApprovalVisible) {
this.orderId = orderId
this.isVisible = true
this.isApprovalVisible = isApprovalVisible
}, },
/**
* 批量导入
*/
onHandleBatchImport() { onHandleBatchImport() {
console.log('批量导入') console.log('批量导入')
}, },
onHandleView(row) { /**
console.log('查看', row) * 删除项目
this.orderIds = row.id */
this.isView = true deleteItem(row) {
this.isEquipmentInputShow = true
},
onHandleAuditing(row) {
this.orderIds = row.id
this.isView = false
this.isEquipmentInputShow = true
console.log('审批', row)
},
onHandleDelete(row) {
this.$confirm('是否确定删除?', '提示', { this.$confirm('是否确定删除?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { })
console.log('删除', row) .then(() => equipmentDelApiNew({ id: row.id }))
equipmentDelApiNew({ id: row.id }).then((res) => { .then(res => {
console.log('删除结果', res)
if (res.code === 200) { if (res.code === 200) {
this.$message({ this.$message.success('删除成功')
type: 'success',
message: '删除成功',
duration: 1000,
})
this.getEquipmentApplyList() this.getEquipmentApplyList()
} else { } else {
this.$message({ this.$message.error('删除失败')
type: 'error', }
message: '删除失败', })
duration: 1000, .catch(error => {
}) if (error !== 'cancel') { //
console.error('删除失败:', error)
this.$message.error('删除失败,请重试')
} }
}).catch(error => {
console.error('删除失败:', error)
this.$message.error('删除失败,请重试')
}) })
}).catch(() => {
//
})
},
onHandleBackList() {
this.isEquipmentInputShow = false
this.getEquipmentApplyList()
} }
} }
} }
</script> </script>
@ -241,4 +212,3 @@ export default {
margin-right: 8px; margin-right: 8px;
} }
</style> </style>