自用申请,审核
This commit is contained in:
parent
39dde4d227
commit
811bdd6046
|
|
@ -0,0 +1,69 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 自用申请-列表
|
||||
export const getApplyListApi = (data = {}) => {
|
||||
return request({
|
||||
url: '/material-mall/decChange/getDevDetailsInfo',
|
||||
method: 'GET',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
// 新增申请-列表
|
||||
export const addApplyApi = (data) => {
|
||||
return request({
|
||||
url: '/material-mall/decChange/addDevDetails',
|
||||
method: 'POST',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 自用申请-列表
|
||||
export const getListApi = (data = {}) => {
|
||||
return request({
|
||||
url: '/material-mall/decChange/getList',
|
||||
method: 'GET',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 申请-获取详情
|
||||
export const getApplyDetailsApi = (data = {}) => {
|
||||
return request({
|
||||
url: '/material-mall/decChange/getDevDetailsById',
|
||||
method: 'get',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 修改申请-列表
|
||||
export const editApplyApi = (data) => {
|
||||
return request({
|
||||
url: '/material-mall/decChange/updateDevDetails',
|
||||
method: 'POST',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 申请-删除
|
||||
export const deleteApplyApi = (data) => {
|
||||
return request({
|
||||
url: '/material-mall/decChange/deleteDevDetails',
|
||||
method: 'POST',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
// 审核通过/驳回
|
||||
export const applyPassApi = (data) => {
|
||||
return request({
|
||||
url: '/material-mall/decChange/approve',
|
||||
method: 'POST',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,612 @@
|
|||
<template>
|
||||
<!-- 基础页面 -->
|
||||
<div class="app-container">
|
||||
<el-card v-show="showSearch" style="margin-bottom: 20px">
|
||||
<el-form :model="queryParams" ref="queryForm" :rules="outFormRules" size="small" inline label-width="auto" >
|
||||
|
||||
<el-form-item label="需求单位:" prop="useUnit">
|
||||
<el-input v-model="queryParams.useUnit" placeholder="请输入需求单位" :disabled="queryParams.status=='0'" clearable/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="使用项目:" prop="proCode">
|
||||
<el-select
|
||||
clearable
|
||||
style="width: 100%"
|
||||
placeholder="请选择使用项目"
|
||||
v-model="queryParams.proCode"
|
||||
@change="onChangeProCode"
|
||||
>
|
||||
<el-option
|
||||
:key="item.proCode"
|
||||
:label="item.proName"
|
||||
:value="item.proCode"
|
||||
v-for="item in useProjectList"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="项目类型:" prop="proType">
|
||||
<el-select clearable style="width: 100%" placeholder="请选择项目类型" v-model="queryParams.proType">
|
||||
<el-option value="0" label="线路"/>
|
||||
<el-option value="1" label="电缆"/>
|
||||
<el-option value="2" label="变电"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="电压等级:" prop="voltageLevel">
|
||||
<el-select
|
||||
clearable
|
||||
style="width: 100%"
|
||||
placeholder="请选择电压等级:"
|
||||
v-model="queryParams.voltageLevel"
|
||||
>
|
||||
<el-option
|
||||
:key="item.voltage"
|
||||
:value="item.voltage"
|
||||
:label="`${item.voltage}kV`"
|
||||
v-for="item in voltageList"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="项目所在省:" prop="proProvince">
|
||||
<el-select
|
||||
clearable
|
||||
style="width: 100%"
|
||||
placeholder="请选择项目所在省"
|
||||
v-model="queryParams.proProvince"
|
||||
@change="onChangeProvince"
|
||||
>
|
||||
<el-option
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.label"
|
||||
v-for="item in provinceList"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="项目所在市:" prop="proCity">
|
||||
<el-select
|
||||
clearable
|
||||
style="width: 100%"
|
||||
placeholder="请选择项目所在市"
|
||||
v-model="queryParams.proCity"
|
||||
@change="onChangeCity"
|
||||
>
|
||||
<el-option
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.label"
|
||||
v-for="item in cityList"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="项目所在区/县:" prop="proCounty">
|
||||
<el-select
|
||||
clearable
|
||||
style="width: 100%"
|
||||
placeholder="请选择项目所在区/县"
|
||||
v-model="queryParams.proCounty"
|
||||
>
|
||||
<el-option
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.label"
|
||||
v-for="item in countyList"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="使用日期:" prop="useTime" >
|
||||
<el-date-picker
|
||||
v-model="queryParams.useTime"
|
||||
type="date"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="选择日期"
|
||||
style="width: 210px"
|
||||
@change="useTimeChange"
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 表单按钮 -->
|
||||
<el-row>
|
||||
<el-form-item style="margin-left:20px">
|
||||
<el-button icon="el-icon-refresh" @click="handleBack">返回</el-button>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
</el-card>
|
||||
|
||||
<el-card>
|
||||
<el-row :gutter="10" class="mb8" justify="end">
|
||||
<el-col :span="4">
|
||||
<span style="font-size: 20px; font-weight: 800">申请列表</span>
|
||||
</el-col>
|
||||
<el-col v-if="!routerParams.isView" :span="20" style="display: flex; justify-content: flex-end">
|
||||
<el-button type="primary" @click="handleDialog">添加</el-button>
|
||||
<el-button type="primary" @click="submit">确定申请</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
v-loading="isLoading"
|
||||
:data="tableList"
|
||||
highlight-current-row
|
||||
border
|
||||
stripe
|
||||
:max-height="650"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-table-column
|
||||
type="index"
|
||||
width="55"
|
||||
label="序号"
|
||||
align="center"
|
||||
/>
|
||||
<el-table-column label="分类" align="center" prop="devType" :show-overflow-tooltip="true" >
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.devType==1">{{ "装备" }}</span>
|
||||
<span v-if="scope.row.devType==2">{{ "工具" }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="类目" align="center" prop="category" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="名称" align="center" prop="typeName" :show-overflow-tooltip="true" width="120px"/>
|
||||
<el-table-column label="规格型号" align="center" prop="typeModelName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="管理模式" align="center" prop="manageType" :show-overflow-tooltip="true" >
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.manageType==0">{{ "编码设备" }}</span>
|
||||
<span v-if="scope.row.manageType==1">{{ "数量设备" }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="设备编码" align="center" prop="devCode" :show-overflow-tooltip="true" width="140px"/>
|
||||
<el-table-column label="当前库存" align="center" prop="storageNum" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="申请数量" align="center" prop="num" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="使用到期日期" align="center" prop="useTime" width="160px">
|
||||
<template slot-scope="scope">
|
||||
<el-date-picker
|
||||
v-model="scope.row.useTime"
|
||||
type="date"
|
||||
format="yyyy-MM-dd"
|
||||
style="width: 100%"
|
||||
placeholder="选择日期"
|
||||
>
|
||||
</el-date-picker>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" v-if="!routerParams.isView">
|
||||
<template slot-scope="{ row }">
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(row)" style="color: red"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
|
||||
<!-- 添加申请 -->
|
||||
<el-dialog title="添加申请" :visible.sync="openAdd" width="1200px" append-to-body>
|
||||
<el-form :model="addQuery" ref="addQuery" size="small" :inline="true" label-width="80px">
|
||||
<el-form-item label="名称" prop="typeName">
|
||||
<el-input v-model="addQuery.typeName" maxlength="20" placeholder="请输入名称"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="规格型号" prop="typeModelName">
|
||||
<el-input v-model="addQuery.typeModelName" maxlength="20" placeholder="请输入规格型号"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="编码" prop="devCode">
|
||||
<el-input v-model="addQuery.devCode" maxlength="20" placeholder="请输入编码"/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleAddQuery">查询</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetAddQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row :gutter="10" class="mb8" justify="end">
|
||||
<el-col style="display: flex; justify-content: flex-end">
|
||||
<el-button type="primary" @click="saveAdd">确定添加</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-table ref="addTable" :data="addList" height="500" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" :selectable="selectable" />
|
||||
<el-table-column label="序号" align="center" width="80" type="index">
|
||||
<template slot-scope="scope">
|
||||
<span>{{
|
||||
(addQuery.pageNum - 1) * 10 + scope.$index + 1
|
||||
}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="分类" align="center" prop="devType" :show-overflow-tooltip="true" >
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.devType==1">{{ "装备" }}</span>
|
||||
<span v-if="scope.row.devType==2">{{ "工具" }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="类目" align="center" prop="category" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="名称" align="center" prop="typeName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="规格型号" align="center" prop="typeModelName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="管理模式" align="center" prop="manageType" :show-overflow-tooltip="true" >
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.manageType==0">{{ "编码设备" }}</span>
|
||||
<span v-if="scope.row.manageType==1">{{ "数量设备" }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="设备编码" align="center" prop="devCode" :show-overflow-tooltip="true" width="140px"/>
|
||||
<el-table-column label="当前库存" align="center" prop="storageNum" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="申请数量" align="center" prop="num" >
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.manageType==0">{{ 1 }}</span>
|
||||
<el-input-number v-if="scope.row.manageType==1" :disabled="isRowSelected(scope.row)" v-model="scope.row.num" :min="0" :max="scope.row.storageNum" :default-value="0" style="width: 120px" @change="applyNumChange(scope.row)"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="addTotal > 0"
|
||||
:total="addTotal"
|
||||
:page.sync="addQuery.pageNum"
|
||||
:limit.sync="addQuery.pageSize"
|
||||
@pagination="getApplyList"
|
||||
/>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getListByApplyIdApi, deleteToolApi, updateToolApplyApi } from '@/api/toolsManage'
|
||||
import { getApplyListApi,addApplyApi,getApplyDetailsApi,editApplyApi } from '@/api/business'
|
||||
import {
|
||||
getUseProjectListAPI,
|
||||
getVoltageListAPI,
|
||||
addProjectOutAPI
|
||||
} from '@/api/EquipmentLedger/equ-out'
|
||||
import { regionData } from 'element-china-area-data'
|
||||
// import AddNum from './components/AddNum'
|
||||
// import AddCode from './components/AddCode'
|
||||
|
||||
export default {
|
||||
name: 'AddEditApply',
|
||||
// components: { AddNum, AddCode },
|
||||
data() {
|
||||
return {
|
||||
routerParams: {},
|
||||
isLoading: false,
|
||||
showSearch: true,
|
||||
timeRange: [],
|
||||
queryParams: {
|
||||
type: 2, // 出库
|
||||
status: '0', // 变更状态
|
||||
proCode: '', // 使用项目id
|
||||
proName: '', // 使用项目名称
|
||||
proType: '', // 项目类型
|
||||
voltageLevel: '', // 电压等级
|
||||
proProvince: '', // 项目所在省
|
||||
proCity: '', // 项目所在市
|
||||
proCounty: '', // 项目所在区/县
|
||||
proLocation: '', // 详细地址
|
||||
useUnit: '', // 需求单位
|
||||
useTime:null,
|
||||
pageNum: 1, // 页码
|
||||
pageSize: 10, // 每页条数
|
||||
},
|
||||
useProjectList: [], // 使用项目下拉选
|
||||
voltageList: [], // 电压等级下拉选
|
||||
provinceList: [],
|
||||
cityList: [],
|
||||
countyList: [],
|
||||
|
||||
outFormRules: {
|
||||
status: [{ required: true, message: '请选择变更状态', trigger: 'change' }],
|
||||
proCode: [{ required: true, message: '请选择使用项目', trigger: 'change' }],
|
||||
proType: [{ required: true, message: '请选择项目类型', trigger: 'change' }],
|
||||
voltageLevel: [{ required: true, message: '请选择电压等级', trigger: 'change' }],
|
||||
proProvince: [{ required: true, message: '请选择项目所在省', trigger: 'change' }],
|
||||
proCity: [{ required: true, message: '请选择项目所在市', trigger: 'change' }],
|
||||
proCounty: [{ required: true, message: '请选择项目所在区/县', trigger: 'change' }],
|
||||
proLocation: [{ required: true, message: '请输入详细地址', trigger: 'blur' }],
|
||||
useUnit: [{ required: true, message: '请输入需求单位', trigger: 'blur' }],
|
||||
},
|
||||
|
||||
typeList: [
|
||||
{ label: '数量管理', value: '1' },
|
||||
{ label: '编码管理', value: '0' },
|
||||
],
|
||||
total: 0, // 总条数
|
||||
// 表格数据
|
||||
tableList: [],
|
||||
openAdd: false, // 添加申请
|
||||
addQuery: { // 添加申请查询
|
||||
typeName: '', // 名称
|
||||
typeModelName: '', // 规格型号
|
||||
devCode: '', // 设备编码
|
||||
pageNum: 1, // 页码
|
||||
pageSize: 10, // 每页条数
|
||||
},
|
||||
addTotal: 0, // 总条数
|
||||
addList: [], // 添加申请列表
|
||||
addTempList: [], // 添加申请临时列表
|
||||
ids: [], // 选中的id
|
||||
single: false, // 单选
|
||||
multiple: false, // 多选
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.routerParams = this.$route.query
|
||||
let title = '新增申请'
|
||||
if (this.routerParams.isView) {
|
||||
title = '查看工申请'
|
||||
} else if (this.routerParams.isEdit) {
|
||||
title = '编辑申请'
|
||||
}
|
||||
this.queryParams.id = this.routerParams.id || ''
|
||||
this.getUseProjectList()
|
||||
this.queryParams.status == '0' ? this.queryParams.useUnit = sessionStorage.getItem('deptName') : ''
|
||||
this.provinceList = regionData
|
||||
const obj = Object.assign({}, this.$route, { title })
|
||||
this.$tab.updatePage(obj)
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
// 获取使用项目的下拉选
|
||||
async getUseProjectList() {
|
||||
const res = await getUseProjectListAPI()
|
||||
const result = await getVoltageListAPI()
|
||||
this.useProjectList = res.data
|
||||
this.voltageList = result.data
|
||||
},
|
||||
|
||||
// 选择使用项目
|
||||
onChangeProCode(value) {
|
||||
this.queryParams.proCode = value
|
||||
this.queryParams.proName = this.useProjectList.find((item) => item.proCode === value)?.proName || ''
|
||||
},
|
||||
|
||||
// 选择省份
|
||||
onChangeProvince(value) {
|
||||
if (!value) {
|
||||
this.cityList = []
|
||||
return
|
||||
}
|
||||
this.cityList = this.provinceList.find((item) => item.label === value)?.children || []
|
||||
},
|
||||
|
||||
// 选择城市
|
||||
onChangeCity(value) {
|
||||
if (!value) {
|
||||
this.countyList = []
|
||||
return
|
||||
}
|
||||
this.countyList = this.cityList.find((item) => item.label === value)?.children || []
|
||||
},
|
||||
|
||||
// 获取列表
|
||||
async getList(emit = {}) {
|
||||
console.log('🚀 ~ emit:', emit)
|
||||
if (emit.id) {
|
||||
this.queryParams.id = emit.id
|
||||
// 存到 route
|
||||
this.$route.query.id = this.queryParams.id
|
||||
}
|
||||
console.log('列表-查询', this.queryParams)
|
||||
this.isLoading = true
|
||||
try {
|
||||
const params = { ...this.queryParams }
|
||||
const res = await getApplyDetailsApi(params)
|
||||
this.tableList = res.data.devDetailsList || []
|
||||
if(this.queryParams.id){
|
||||
this.queryParams = res.data.devInfo || {}
|
||||
this.queryParams.status = '0'
|
||||
this.queryParams.useUnit = sessionStorage.getItem('deptName')
|
||||
}
|
||||
this.total = res.data.total || 0
|
||||
} catch (error) {
|
||||
this.tableList = []
|
||||
this.total = 0
|
||||
} finally {
|
||||
this.isLoading = false
|
||||
}
|
||||
},
|
||||
// 删除
|
||||
handleDelete(row) {
|
||||
this.tableList = this.tableList.filter((item) => item.id !== row.id)
|
||||
},
|
||||
|
||||
//添加申请弹窗
|
||||
handleDialog() {
|
||||
this.addQuery.pageNum = 1
|
||||
this.getApplyList()
|
||||
this.openAdd = true
|
||||
|
||||
},
|
||||
|
||||
getApplyList() {
|
||||
getApplyListApi(this.addQuery).then(response => {
|
||||
this.addList = response.data.rows
|
||||
this.addList.forEach(item => {
|
||||
if(item.manageType == 0) { // 编码设备
|
||||
item.num = 1
|
||||
}
|
||||
})
|
||||
this.addTotal = response.data.total
|
||||
})
|
||||
},
|
||||
|
||||
//查询
|
||||
handleAddQuery() {
|
||||
this.addQuery.pageNum = 1
|
||||
this.getApplyList()
|
||||
},
|
||||
|
||||
// 重置
|
||||
resetAddQuery() {
|
||||
this.addQuery = {
|
||||
typeName: '', // 名称
|
||||
typeModelName: '', // 规格型号
|
||||
devCode: '', // 设备编码
|
||||
pageNum: 1, // 页码
|
||||
pageSize: 10, // 每页条数
|
||||
}
|
||||
this.getApplyList()
|
||||
},
|
||||
|
||||
handleBack() {
|
||||
this.$router.go(-1)
|
||||
},
|
||||
|
||||
useTimeChange(val) {
|
||||
console.log('🚀 ~ val:', val)
|
||||
// if (val) {
|
||||
// // 将Date对象转换为yyyy-MM-dd格式字符串
|
||||
// const year = val.getFullYear()
|
||||
// const month = String(val.getMonth() + 1).padStart(2, '0')
|
||||
// const day = String(val.getDate()).padStart(2, '0')
|
||||
// const formattedDate = `${year}-${month}-${day}`
|
||||
|
||||
this.tableList.forEach(item => {
|
||||
item.useTime = val
|
||||
})
|
||||
},
|
||||
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.addTempList = []
|
||||
this.ids = selection.map(item => item.id)
|
||||
selection.forEach(item => {
|
||||
this.addTempList.push({
|
||||
id: item.id,
|
||||
typeId: item.typeId,
|
||||
devType: item.devType,
|
||||
category: item.category,
|
||||
typeName: item.typeName,
|
||||
typeModelName: item.typeModelName,
|
||||
manageType: item.manageType,
|
||||
devCode: item.devCode,
|
||||
storageNum: item.storageNum,
|
||||
num: item.typeModelName==1? 1: item.num,
|
||||
useTime: null
|
||||
})
|
||||
})
|
||||
this.single = selection.length != 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
|
||||
selectable(row, index) {
|
||||
if(row.num == 0 || row.num == null) { // 库存为0
|
||||
return false
|
||||
}else if(this.tableList.some(item => item.id == row.id && item.typeId == row.typeId)) { // 已经添加过
|
||||
return false
|
||||
}
|
||||
else{
|
||||
return true
|
||||
}
|
||||
},
|
||||
|
||||
// 检查行是否被选中
|
||||
isRowSelected(row) {
|
||||
return this.ids.includes(row.id)
|
||||
},
|
||||
|
||||
applyNumChange(row) {
|
||||
console.log('🚀 ~ row:', row)
|
||||
if(row.num > row.storageNum) { // 申请数量大于库存
|
||||
this.$message({
|
||||
type:'error',
|
||||
message: '申请数量不能大于当前库存',
|
||||
})
|
||||
row.num = 0
|
||||
}
|
||||
},
|
||||
|
||||
//确认添加
|
||||
saveAdd() {
|
||||
console.log('🚀 ~ this.addTempList:', this.addTempList)
|
||||
if(!this.ids.length) { // 没有选中数据
|
||||
this.$message({
|
||||
type:'error',
|
||||
message: '请勾选数据',
|
||||
})
|
||||
return
|
||||
}
|
||||
this.addTempList.forEach(item => {
|
||||
this.tableList.push(item)
|
||||
})
|
||||
// 清除勾选相关的数据
|
||||
this.addTempList = []
|
||||
this.ids = []
|
||||
this.$refs.addTable.clearSelection()
|
||||
this.openAdd = false
|
||||
|
||||
},
|
||||
|
||||
// 提交
|
||||
async submit() {
|
||||
this.$refs.queryForm.validate(async(valid) => {
|
||||
if (valid) {
|
||||
this.$confirm('是否确定提交申请?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}).then(async () => {
|
||||
this.isLoading = true
|
||||
try {
|
||||
//新增
|
||||
if(!this.routerParams.isEdit && !this.routerParams.id) {
|
||||
this.queryParams.type = 2
|
||||
this.queryParams.leaseType = 0
|
||||
const tempTableList = this.tableList.map(item => ({
|
||||
...item,
|
||||
category: null
|
||||
}))
|
||||
const params = {
|
||||
devInfo: this.queryParams,
|
||||
devDetailsList: tempTableList,
|
||||
}
|
||||
const res = await addApplyApi(params)
|
||||
if(res.code == 200) {
|
||||
this.$message({
|
||||
type:'success',
|
||||
message: '添加成功!',
|
||||
})
|
||||
this.$router.go(-1)
|
||||
// this.$tab.closeOpenPage({ path: '/business/applyList' })
|
||||
}
|
||||
}else if(this.routerParams.isEdit && this.routerParams.id) {
|
||||
// 修改
|
||||
this.queryParams.type = 2
|
||||
this.queryParams.leaseType = 0
|
||||
const tempTableList = this.tableList.map(item => ({
|
||||
...item,
|
||||
category: null
|
||||
}))
|
||||
const params = {
|
||||
devInfo: this.queryParams,
|
||||
devDetailsList: tempTableList,
|
||||
}
|
||||
const res = await editApplyApi(params)
|
||||
if(res.code == 200) {
|
||||
this.$message({
|
||||
type:'success',
|
||||
message: '修改成功!',
|
||||
})
|
||||
this.$router.go(-1)
|
||||
// this.$tab.closeOpenPage({ path: '/business/applyList' })
|
||||
}
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.log('🚀 ~ error:', error)
|
||||
} finally {
|
||||
this.isLoading = false
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
||||
|
|
@ -1,269 +0,0 @@
|
|||
<template>
|
||||
<!-- 基础页面 -->
|
||||
<div class="app-container">
|
||||
<el-card v-show="showSearch" style="margin-bottom: 20px">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" inline @submit.native.prevent>
|
||||
<el-form-item label="工具名称" prop="parentTypeName">
|
||||
<el-input
|
||||
v-model="queryParams.parentTypeName"
|
||||
placeholder="请输入工具名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
style="width: 240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="规格型号" prop="typeName">
|
||||
<el-input
|
||||
v-model="queryParams.typeName"
|
||||
placeholder="请输入规格型号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
style="width: 240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="管理模式" prop="manageType">
|
||||
<el-select
|
||||
v-model="queryParams.manageType"
|
||||
placeholder="请选择管理模式"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 240px"
|
||||
>
|
||||
<el-option v-for="item in typeList" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 表单按钮 -->
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">查询</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card>
|
||||
<el-row :gutter="10" class="mb8" justify="end">
|
||||
<el-col :span="4">
|
||||
<span style="font-size: 20px; font-weight: 800">工具录入申请列表</span>
|
||||
</el-col>
|
||||
<el-col v-if="!routerParams.isView" :span="20" style="display: flex; justify-content: flex-end">
|
||||
<el-button type="primary" @click="handleNumDialog">新增数量工具</el-button>
|
||||
<el-button type="primary" @click="handleCodeDialog">新增编码工具</el-button>
|
||||
<el-button type="primary" @click="submit">提交申请</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
v-loading="isLoading"
|
||||
:data="tableList"
|
||||
highlight-current-row
|
||||
border
|
||||
stripe
|
||||
:max-height="650"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-table-column
|
||||
type="index"
|
||||
width="55"
|
||||
label="序号"
|
||||
align="center"
|
||||
:index="(index) => (queryParams.pageNum - 1) * queryParams.pageSize + index + 1"
|
||||
/>
|
||||
<el-table-column
|
||||
v-for="(column, index) in tableColumns"
|
||||
show-overflow-tooltip
|
||||
:key="index"
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
align="center"
|
||||
>
|
||||
<!-- 插槽 -->
|
||||
<template v-slot="{ row }">
|
||||
<component :is="column.render ? { render: (h) => column.render(h, { row }) } : 'span'">
|
||||
{{ !column.render ? row[column.prop] : '' }}
|
||||
</component>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" v-if="!routerParams.isView">
|
||||
<template slot-scope="{ row }">
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(row)" style="color: red"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页 -->
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-card>
|
||||
|
||||
<!-- 数量 -->
|
||||
<AddNum ref="addNum" @getList="getList" />
|
||||
<!-- 编码 -->
|
||||
<AddCode ref="addCode" @getList="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getListByApplyIdApi, deleteToolApi, updateToolApplyApi } from '@/api/toolsManage'
|
||||
import AddNum from './components/AddNum'
|
||||
import AddCode from './components/AddCode'
|
||||
|
||||
export default {
|
||||
name: 'AddEditTools',
|
||||
components: { AddNum, AddCode },
|
||||
data() {
|
||||
return {
|
||||
routerParams: {},
|
||||
isLoading: false,
|
||||
showSearch: true,
|
||||
timeRange: [],
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
parentTypeName: null,
|
||||
typeName: null,
|
||||
manageType: null,
|
||||
applyId: null,
|
||||
},
|
||||
typeList: [
|
||||
{ label: '数量管理', value: '1' },
|
||||
{ label: '编码管理', value: '0' },
|
||||
],
|
||||
total: 0, // 总条数
|
||||
// 表头
|
||||
tableColumns: [
|
||||
{ label: '工具专业', prop: 'fourthParentName' },
|
||||
{ label: '施工类型', prop: 'greatGrandparentName' },
|
||||
{ label: '工具类型', prop: 'grandparentTypeName' },
|
||||
{ label: '工具名称', prop: 'parentTypeName' },
|
||||
{ label: '规格型号', prop: 'typeName' },
|
||||
{
|
||||
label: '管理模式',
|
||||
prop: 'manageType',
|
||||
render: (h, { row }) => {
|
||||
return row.manageType == '1' ? h('span', {}, '数量管理') : h('span', {}, '编码管理')
|
||||
},
|
||||
},
|
||||
{ label: '申请数量', prop: 'applyNum' },
|
||||
],
|
||||
// 表格数据
|
||||
tableList: [],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.routerParams = this.$route.query
|
||||
let title = '新增工具'
|
||||
if (this.routerParams.isView) {
|
||||
title = '查看工具'
|
||||
} else if (this.routerParams.isEdit) {
|
||||
title = '编辑工具'
|
||||
}
|
||||
this.queryParams.applyId = this.routerParams.applyId || ''
|
||||
const obj = Object.assign({}, this.$route, { title })
|
||||
this.$tab.updatePage(obj)
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
// 查询
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
// 重置
|
||||
handleReset() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.queryParams.pageSize = 10
|
||||
this.queryParams.parentId = '0'
|
||||
this.queryParams.level = '1'
|
||||
this.$refs.queryForm.resetFields()
|
||||
this.getList()
|
||||
},
|
||||
// 获取列表
|
||||
async getList(emit = {}) {
|
||||
console.log('🚀 ~ emit:', emit)
|
||||
if (emit.applyId) {
|
||||
this.queryParams.applyId = emit.applyId
|
||||
// 存到 route
|
||||
this.$route.query.applyId = this.queryParams.applyId
|
||||
}
|
||||
console.log('列表-查询', this.queryParams)
|
||||
this.isLoading = true
|
||||
try {
|
||||
const params = { ...this.queryParams }
|
||||
const res = await getListByApplyIdApi(params)
|
||||
this.tableList = res.rows || []
|
||||
this.total = res.total || 0
|
||||
} catch (error) {
|
||||
this.tableList = []
|
||||
this.total = 0
|
||||
} finally {
|
||||
this.isLoading = false
|
||||
}
|
||||
},
|
||||
// 删除
|
||||
handleDelete(row) {
|
||||
console.log('🚀 ~ row:', row)
|
||||
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}).then(async () => {
|
||||
this.isLoading = true
|
||||
try {
|
||||
await deleteToolApi({ typeId: row.typeId, applyId: this.queryParams.applyId })
|
||||
// 提示
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!',
|
||||
})
|
||||
this.getList()
|
||||
} catch (error) {
|
||||
console.log('🚀 ~ error:', error)
|
||||
} finally {
|
||||
this.isLoading = false
|
||||
}
|
||||
})
|
||||
},
|
||||
handleNumDialog() {
|
||||
const applyId = this.queryParams.applyId
|
||||
this.$refs.addNum.openDialog(applyId)
|
||||
},
|
||||
handleCodeDialog() {
|
||||
const applyId = this.queryParams.applyId
|
||||
this.$refs.addCode.openDialog(applyId)
|
||||
},
|
||||
// 提交
|
||||
async submit() {
|
||||
this.$confirm('是否确定提交申请?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}).then(async () => {
|
||||
this.isLoading = true
|
||||
try {
|
||||
await updateToolApplyApi({ id: this.queryParams.applyId, status: '1' })
|
||||
// 提示
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '操作成功!',
|
||||
})
|
||||
this.$tab.closeOpenPage({ path: '/toolsManage/applicantList' })
|
||||
} catch (error) {
|
||||
console.log('🚀 ~ error:', error)
|
||||
} finally {
|
||||
this.isLoading = false
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
|
|
@ -0,0 +1,238 @@
|
|||
<template>
|
||||
<!-- 基础页面 -->
|
||||
<div class="app-container">
|
||||
<el-card v-show="showSearch" style="margin-bottom: 20px">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" inline label-width="auto">
|
||||
<el-form-item label="项目名称:" prop="proCode">
|
||||
<el-select
|
||||
clearable
|
||||
placeholder="请选择项目名称"
|
||||
v-model="queryParams.proCode"
|
||||
>
|
||||
<el-option
|
||||
:key="item.proCode"
|
||||
:label="item.proName"
|
||||
:value="item.proCode"
|
||||
v-for="item in useProjectList"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="任务状态" prop="taskStatus">
|
||||
<el-select
|
||||
v-model="queryParams.taskStatus"
|
||||
placeholder="请选择任务状态"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 240px"
|
||||
>
|
||||
<el-option v-for="item in statusList" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<!-- 日期范围 -->
|
||||
<el-form-item label="申请日期">
|
||||
<el-date-picker
|
||||
v-model="timeRange"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
clearable
|
||||
unlink-panels
|
||||
value-format="yyyy-MM-dd"
|
||||
format="yyyy-MM-dd"
|
||||
style="width: 240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 表单按钮 -->
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">查询</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card>
|
||||
<el-row :gutter="10" class="mb8" justify="end">
|
||||
<el-col :span="4">
|
||||
<span style="font-size: 20px; font-weight: 800">申请列表</span>
|
||||
</el-col>
|
||||
<el-col :span="20" style="display: flex; justify-content: flex-end">
|
||||
<el-button type="primary" icon="el-icon-plus" @click="handleAdd">新建申请</el-button>
|
||||
</el-col>
|
||||
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" /> -->
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
v-loading="isLoading"
|
||||
:data="tableList"
|
||||
highlight-current-row
|
||||
border
|
||||
stripe
|
||||
:max-height="650"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-table-column
|
||||
type="index"
|
||||
width="55"
|
||||
label="序号"
|
||||
align="center"
|
||||
:index="(index) => (queryParams.pageNum - 1) * queryParams.pageSize + index + 1"
|
||||
/>
|
||||
<el-table-column label="申请单号" align="center" prop="code" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="项目名称" align="center" prop="proName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="申请装备数" align="center" prop="devNum" :show-overflow-tooltip="true" width="120px"/>
|
||||
<el-table-column label="申请工具数" align="center" prop="toolNum" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="任务状态" align="center" prop="taskStatus" :show-overflow-tooltip="true" >
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.taskStatus == '0'" type="warning">待审核</el-tag>
|
||||
<el-tag v-if="scope.row.taskStatus == '1'" type="success">已通过</el-tag>
|
||||
<el-tag v-if="scope.row.taskStatus == '2'" type="danger">已驳回</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="申请人" align="center" prop="createBy" :show-overflow-tooltip="true" width="140px"/>
|
||||
<el-table-column label="申请时间" align="center" prop="createTime" width="160px"/>
|
||||
<el-table-column label="操作" align="center">
|
||||
<template slot-scope="{ row }">
|
||||
<el-button size="mini" type="text" icon="el-icon-zoom-in" @click="handleView(row)">查看</el-button>
|
||||
<el-button v-if="row.taskStatus != 1" size="mini" type="text" icon="el-icon-edit" @click="handleEdit(row)">编辑</el-button>
|
||||
<el-button v-if="row.taskStatus != 1" size="mini" type="text" icon="el-icon-delete" @click="handleDelete(row)" style="color: red"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页 -->
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getToolApplyListApi, deleteToolApplyApi } from '@/api/toolsManage'
|
||||
import { getListApi,deleteApplyApi } from '@/api/business'
|
||||
import {
|
||||
getUseProjectListAPI,
|
||||
} from '@/api/EquipmentLedger/equ-out'
|
||||
export default {
|
||||
name: 'ApplyList',
|
||||
data() {
|
||||
return {
|
||||
isLoading: false,
|
||||
showSearch: true,
|
||||
timeRange: [],
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
taskStatus: null,
|
||||
createBy: null,
|
||||
startTime: null,
|
||||
endTime: null,
|
||||
},
|
||||
statusList: [
|
||||
{ label: '待审核', value: '0' },
|
||||
{ label: '已通过', value: '1' },
|
||||
{ label: '已驳回', value: '2' },
|
||||
],
|
||||
total: 0, // 总条数
|
||||
// 表格数据
|
||||
tableList: [],
|
||||
useProjectList: [], // 使用项目下拉选
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getUseProjectList()
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
// 获取使用项目的下拉选
|
||||
async getUseProjectList() {
|
||||
const res = await getUseProjectListAPI()
|
||||
this.useProjectList = res.data
|
||||
},
|
||||
|
||||
|
||||
// 查询
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
// 重置
|
||||
handleReset() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.queryParams.pageSize = 10
|
||||
this.queryParams.parentId = '0'
|
||||
this.queryParams.level = '1'
|
||||
this.queryParams.taskStatus = null
|
||||
this.timeRange = []
|
||||
this.$refs.queryForm.resetFields()
|
||||
this.getList()
|
||||
},
|
||||
// 获取列表
|
||||
async getList() {
|
||||
console.log('列表-查询', this.queryParams)
|
||||
this.isLoading = true
|
||||
this.queryParams.startTime = this.timeRange && this.timeRange[0] ? this.timeRange[0] : null
|
||||
this.queryParams.endTime = this.timeRange && this.timeRange[1] ? this.timeRange[1] : null
|
||||
try {
|
||||
const params = { ...this.queryParams }
|
||||
const res = await getListApi(params)
|
||||
this.tableList = res.data.rows || []
|
||||
this.total = res.data.total || 0
|
||||
} catch (error) {
|
||||
this.tableList = []
|
||||
this.total = 0
|
||||
} finally {
|
||||
this.isLoading = false
|
||||
}
|
||||
},
|
||||
// 新增
|
||||
handleAdd() {
|
||||
this.$router.push({ path: '/business/addApply' })
|
||||
},
|
||||
// 查看
|
||||
handleView(row) {
|
||||
this.$router.push({ path: '/business/addApply', query: { id: row.id, isView: true } })
|
||||
},
|
||||
// 编辑
|
||||
handleEdit(row) {
|
||||
this.$router.push({ path: '/business/addApply', query: { id: row.id, isEdit: true } })
|
||||
},
|
||||
// 删除
|
||||
handleDelete(row) {
|
||||
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}).then(async () => {
|
||||
this.isLoading = true
|
||||
try {
|
||||
await deleteApplyApi({ id: row.id })
|
||||
// 提示
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!',
|
||||
})
|
||||
this.getList()
|
||||
} catch (error) {
|
||||
console.log('🚀 ~ error:', error)
|
||||
} finally {
|
||||
this.isLoading = false
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
|
|
@ -0,0 +1,216 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="70%" :close-on-click-modal="false">
|
||||
<el-card style="margin-bottom: 20px">
|
||||
<el-form v-if="dialogVisible" ref="dialogForm" :model="dialogForm" size="small" inline @submit.native.prevent>
|
||||
<el-form-item label="规格型号">
|
||||
<el-cascader
|
||||
v-model="typeIdList"
|
||||
:options="options"
|
||||
:props="{ value: 'typeId', label: 'typeName' }"
|
||||
clearable
|
||||
@change="handleChange"
|
||||
style="width: 400px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-plus" :disabled="typeIdList.length == 0" @click="handleAdd"
|
||||
>点击填充</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card v-loading="isLoading">
|
||||
<el-row :gutter="10" class="mb8" justify="end">
|
||||
<el-col :span="24" style="display: flex; justify-content: flex-end">
|
||||
<el-button type="primary" :disabled="dialogList.length == 0" @click="submit">确定</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-table :data="dialogList" border stripe highlight-current-row :max-height="500" style="width: 100%">
|
||||
<el-table-column type="index" width="55" label="序号" align="center" />
|
||||
<el-table-column
|
||||
v-for="(column, index) in dialogColumns"
|
||||
:width="column.width"
|
||||
:show-overflow-tooltip="!column.unShowTooltip"
|
||||
:key="index"
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
align="center"
|
||||
>
|
||||
<!-- 插槽 -->
|
||||
<template v-slot="{ row }" v-if="column.prop == 'applyNum'">
|
||||
<el-input-number
|
||||
v-model="row.applyNum"
|
||||
:min="1"
|
||||
:max="9999"
|
||||
:precision="0"
|
||||
:controls="false"
|
||||
style="width: 120px"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center">
|
||||
<template slot-scope="{ row, $index }">
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(index)" style="color: red"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getTreeSelectApi, addApplyCodeApi, addToolApi } from '@/api/toolsManage'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
isLoading: false,
|
||||
dialogTitle: '新增数量工具',
|
||||
dialogVisible: false,
|
||||
dialogForm: {
|
||||
applyId: null,
|
||||
typeId: null,
|
||||
},
|
||||
typeIdList: [],
|
||||
dialogColumns: [
|
||||
{ label: '工具专业', prop: 'fourthParentName' },
|
||||
{ label: '施工类型', prop: 'greatGrandparentName' },
|
||||
{ label: '工具类型', prop: 'grandparentTypeName' },
|
||||
{ label: '工具名称', prop: 'parentTypeName' },
|
||||
{ label: '规格型号', prop: 'typeName' },
|
||||
{ label: '计量单位', prop: 'unitName' },
|
||||
{ label: '申请数量', prop: 'applyNum', width: 150 },
|
||||
],
|
||||
dialogList: [],
|
||||
options: [],
|
||||
activeLabels: [],
|
||||
lastNode: null,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
openDialog(applyId) {
|
||||
console.log('🚀 ~ applyId:', applyId)
|
||||
this.dialogForm.applyId = applyId
|
||||
this.typeIdList = []
|
||||
this.dialogList = []
|
||||
this.dialogVisible = true
|
||||
this.getTreeSelect()
|
||||
},
|
||||
async getTreeSelect() {
|
||||
try {
|
||||
const res = await getTreeSelectApi({ manageType: 1 })
|
||||
console.log('🚀 ~ res:', res)
|
||||
this.options = res.data
|
||||
this.handleTree(this.options)
|
||||
} catch (error) {
|
||||
console.log('🚀 ~ error:', error)
|
||||
}
|
||||
},
|
||||
handleTree(tree) {
|
||||
for (const node of tree) {
|
||||
if (node.level === '5') {
|
||||
// 删除 children
|
||||
delete node.children
|
||||
} else if (node.children && node.children.length > 0) {
|
||||
// 继续递归下级
|
||||
this.handleTree(node.children)
|
||||
}
|
||||
}
|
||||
},
|
||||
handleChange(val) {
|
||||
console.log('🚀 ~ val:', val)
|
||||
this.dialogForm.typeId = val ? val[val.length - 1] : ''
|
||||
this.activeLabels = this.getLabelsFromValuePath(val, this.options)
|
||||
this.lastNode = this.findNodeById(this.options, val[val.length - 1])
|
||||
console.log('🚀 ~ this.lastNode:', this.lastNode)
|
||||
console.log('选中的 labels:', this.activeLabels)
|
||||
},
|
||||
getLabelsFromValuePath(valuePath, options) {
|
||||
let labels = []
|
||||
let currentLevel = options
|
||||
|
||||
for (const val of valuePath) {
|
||||
const node = currentLevel.find((item) => item.typeId === val)
|
||||
if (node) {
|
||||
labels.push(node.typeName)
|
||||
currentLevel = node.children || []
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
return labels
|
||||
},
|
||||
findNodeById(tree, id) {
|
||||
for (const node of tree) {
|
||||
if (node.typeId === id) return node // 找到了就返回
|
||||
if (node.children) {
|
||||
const result = this.findNodeById(node.children, id)
|
||||
if (result) return result // 子节点中找到了
|
||||
}
|
||||
}
|
||||
return null // 没找到
|
||||
},
|
||||
handleAdd() {
|
||||
console.log('🚀 ~ handleAdd:', this.dialogForm.typeId)
|
||||
const typeId = this.typeIdList[this.typeIdList.length - 1]
|
||||
if (this.dialogList.some((item) => item.typeId === typeId)) {
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: '该工具已添加!',
|
||||
})
|
||||
return
|
||||
}
|
||||
this.dialogList.unshift({
|
||||
applyId: this.dialogForm.applyId,
|
||||
typeId,
|
||||
fourthParentName: this.activeLabels[0],
|
||||
greatGrandparentName: this.activeLabels[1],
|
||||
grandparentTypeName: this.activeLabels[2],
|
||||
parentTypeName: this.activeLabels[3],
|
||||
typeName: this.activeLabels[4],
|
||||
unitName: this.lastNode.unitName,
|
||||
applyNum: 1,
|
||||
})
|
||||
console.log('🚀 ~ this.dialogList:', this.dialogList)
|
||||
},
|
||||
handleDelete(index) {
|
||||
this.dialogList.splice(index, 1)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!',
|
||||
})
|
||||
},
|
||||
async submit() {
|
||||
try {
|
||||
this.isLoading = true
|
||||
if (!this.dialogForm.applyId) {
|
||||
const res = await addApplyCodeApi()
|
||||
console.log('🚀 ~ res:', res)
|
||||
this.dialogForm.applyId = res.data.id
|
||||
this.dialogList.forEach((item) => {
|
||||
item.applyId = res.data.id
|
||||
})
|
||||
}
|
||||
await addToolApi(this.dialogList)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '操作成功!',
|
||||
})
|
||||
this.dialogVisible = false
|
||||
this.$emit('getList', { applyId: this.dialogForm.applyId })
|
||||
} catch (error) {
|
||||
console.log('🚀 ~ error:', error)
|
||||
} finally {
|
||||
this.isLoading = false
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
|
|
@ -0,0 +1,364 @@
|
|||
<template>
|
||||
<!-- 基础页面 -->
|
||||
<div class="app-container">
|
||||
<el-card v-show="showSearch" style="margin-bottom: 20px">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" inline label-width="auto" >
|
||||
|
||||
<el-form-item label="需求单位:" prop="useUnit">
|
||||
<el-input v-model="queryParams.useUnit" placeholder="请输入需求单位" :disabled="queryParams.status=='0'" clearable/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="使用项目:" prop="proCode">
|
||||
<el-select
|
||||
clearable
|
||||
style="width: 100%"
|
||||
placeholder="请选择使用项目"
|
||||
v-model="queryParams.proCode"
|
||||
@change="onChangeProCode"
|
||||
>
|
||||
<el-option
|
||||
:key="item.proCode"
|
||||
:label="item.proName"
|
||||
:value="item.proCode"
|
||||
v-for="item in useProjectList"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="项目类型:" prop="proType">
|
||||
<el-select clearable style="width: 100%" placeholder="请选择项目类型" v-model="queryParams.proType">
|
||||
<el-option value="0" label="线路"/>
|
||||
<el-option value="1" label="电缆"/>
|
||||
<el-option value="2" label="变电"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="电压等级:" prop="voltageLevel">
|
||||
<el-select
|
||||
clearable
|
||||
style="width: 100%"
|
||||
placeholder="请选择电压等级:"
|
||||
v-model="queryParams.voltageLevel"
|
||||
>
|
||||
<el-option
|
||||
:key="item.voltage"
|
||||
:value="item.voltage"
|
||||
:label="`${item.voltage}kV`"
|
||||
v-for="item in voltageList"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="项目所在省:" prop="proProvince">
|
||||
<el-select
|
||||
clearable
|
||||
style="width: 100%"
|
||||
placeholder="请选择项目所在省"
|
||||
v-model="queryParams.proProvince"
|
||||
@change="onChangeProvince"
|
||||
>
|
||||
<el-option
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.label"
|
||||
v-for="item in provinceList"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="项目所在市:" prop="proCity">
|
||||
<el-select
|
||||
clearable
|
||||
style="width: 100%"
|
||||
placeholder="请选择项目所在市"
|
||||
v-model="queryParams.proCity"
|
||||
@change="onChangeCity"
|
||||
>
|
||||
<el-option
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.label"
|
||||
v-for="item in cityList"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="项目所在区/县:" prop="proCounty">
|
||||
<el-select
|
||||
clearable
|
||||
style="width: 100%"
|
||||
placeholder="请选择项目所在区/县"
|
||||
v-model="queryParams.proCounty"
|
||||
>
|
||||
<el-option
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.label"
|
||||
v-for="item in countyList"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item style="margin-left:20px">
|
||||
<el-button icon="el-icon-refresh" @click="handleBack">返回</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
</el-card>
|
||||
|
||||
<el-card>
|
||||
<el-row :gutter="10" class="mb8" justify="end">
|
||||
<el-col :span="4">
|
||||
<span style="font-size: 20px; font-weight: 800">申请审核列表</span>
|
||||
</el-col>
|
||||
<el-col v-if="!routerParams.isView" :span="20" style="display: flex; justify-content: flex-end">
|
||||
<el-button type="primary" @click="handlePass">通过</el-button>
|
||||
<el-button type="primary" @click="handleFail">驳回</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
v-loading="isLoading"
|
||||
:data="tableList"
|
||||
highlight-current-row
|
||||
border
|
||||
stripe
|
||||
:max-height="650"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-table-column
|
||||
type="index"
|
||||
width="55"
|
||||
label="序号"
|
||||
align="center"
|
||||
/>
|
||||
<el-table-column label="分类" align="center" prop="devType" :show-overflow-tooltip="true" >
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.devType==1">{{ "装备" }}</span>
|
||||
<span v-if="scope.row.devType==2">{{ "工具" }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="类目" align="center" prop="category" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="名称" align="center" prop="typeName" :show-overflow-tooltip="true" width="120px"/>
|
||||
<el-table-column label="规格型号" align="center" prop="typeModelName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="管理模式" align="center" prop="manageType" :show-overflow-tooltip="true" >
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.manageType==0">{{ "编码设备" }}</span>
|
||||
<span v-if="scope.row.manageType==1">{{ "数量设备" }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="设备编码" align="center" prop="devCode" :show-overflow-tooltip="true" width="140px"/>
|
||||
<el-table-column label="当前库存" align="center" prop="storageNum" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="申请数量" align="center" prop="num" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="使用到期日期" align="center" prop="useTime" width="160px"/>
|
||||
</el-table>
|
||||
</el-card>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getApplyDetailsApi,applyPassApi } from '@/api/business'
|
||||
import {
|
||||
getUseProjectListAPI,
|
||||
getVoltageListAPI,
|
||||
} from '@/api/EquipmentLedger/equ-out'
|
||||
import { regionData } from 'element-china-area-data'
|
||||
|
||||
|
||||
export default {
|
||||
name: 'AddEditApply',
|
||||
// components: { AddNum, AddCode },
|
||||
data() {
|
||||
return {
|
||||
routerParams: {},
|
||||
isLoading: false,
|
||||
showSearch: true,
|
||||
timeRange: [],
|
||||
queryParams: {
|
||||
type: 2, // 出库
|
||||
status: '0', // 变更状态
|
||||
proCode: '', // 使用项目id
|
||||
proName: '', // 使用项目名称
|
||||
proType: '', // 项目类型
|
||||
voltageLevel: '', // 电压等级
|
||||
proProvince: '', // 项目所在省
|
||||
proCity: '', // 项目所在市
|
||||
proCounty: '', // 项目所在区/县
|
||||
proLocation: '', // 详细地址
|
||||
useUnit: '', // 需求单位
|
||||
useTime:null,
|
||||
pageNum: 1, // 页码
|
||||
pageSize: 10, // 每页条数
|
||||
},
|
||||
useProjectList: [], // 使用项目下拉选
|
||||
voltageList: [], // 电压等级下拉选
|
||||
provinceList: [],
|
||||
cityList: [],
|
||||
countyList: [],
|
||||
|
||||
typeList: [
|
||||
{ label: '数量管理', value: '1' },
|
||||
{ label: '编码管理', value: '0' },
|
||||
],
|
||||
total: 0, // 总条数
|
||||
// 表格数据
|
||||
tableList: [],
|
||||
openAdd: false, // 添加申请
|
||||
addQuery: { // 添加申请查询
|
||||
typeName: '', // 名称
|
||||
typeModelName: '', // 规格型号
|
||||
devCode: '', // 设备编码
|
||||
pageNum: 1, // 页码
|
||||
pageSize: 10, // 每页条数
|
||||
},
|
||||
addTotal: 0, // 总条数
|
||||
addList: [], // 添加申请列表
|
||||
addTempList: [], // 添加申请临时列表
|
||||
ids: [], // 选中的id
|
||||
single: false, // 单选
|
||||
multiple: false, // 多选
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.routerParams = this.$route.query
|
||||
let title = '审核'
|
||||
if (this.routerParams.isView) {
|
||||
title = '查看审核'
|
||||
} else if (this.routerParams.isEdit) {
|
||||
title = '审核详情'
|
||||
}
|
||||
this.queryParams.id = this.routerParams.id || ''
|
||||
this.getUseProjectList()
|
||||
this.queryParams.status == '0' ? this.queryParams.useUnit = sessionStorage.getItem('deptName') : ''
|
||||
this.provinceList = regionData
|
||||
const obj = Object.assign({}, this.$route, { title })
|
||||
this.$tab.updatePage(obj)
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
// 获取使用项目的下拉选
|
||||
async getUseProjectList() {
|
||||
const res = await getUseProjectListAPI()
|
||||
const result = await getVoltageListAPI()
|
||||
this.useProjectList = res.data
|
||||
this.voltageList = result.data
|
||||
},
|
||||
|
||||
// 选择使用项目
|
||||
onChangeProCode(value) {
|
||||
this.queryParams.proCode = value
|
||||
this.queryParams.proName = this.useProjectList.find((item) => item.proCode === value)?.proName || ''
|
||||
},
|
||||
|
||||
// 选择省份
|
||||
onChangeProvince(value) {
|
||||
if (!value) {
|
||||
this.cityList = []
|
||||
return
|
||||
}
|
||||
this.cityList = this.provinceList.find((item) => item.label === value)?.children || []
|
||||
},
|
||||
|
||||
// 选择城市
|
||||
onChangeCity(value) {
|
||||
if (!value) {
|
||||
this.countyList = []
|
||||
return
|
||||
}
|
||||
this.countyList = this.cityList.find((item) => item.label === value)?.children || []
|
||||
},
|
||||
|
||||
|
||||
// 查询
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
// 重置
|
||||
handleReset() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.queryParams.pageSize = 10
|
||||
this.queryParams.parentId = '0'
|
||||
this.queryParams.level = '1'
|
||||
this.$refs.queryForm.resetFields()
|
||||
this.getList()
|
||||
},
|
||||
// 获取列表
|
||||
// 获取列表
|
||||
async getList(emit = {}) {
|
||||
console.log('🚀 ~ emit:', emit)
|
||||
if (emit.id) {
|
||||
this.queryParams.id = emit.id
|
||||
// 存到 route
|
||||
this.$route.query.id = this.queryParams.id
|
||||
}
|
||||
console.log('列表-查询', this.queryParams)
|
||||
this.isLoading = true
|
||||
try {
|
||||
const params = { ...this.queryParams }
|
||||
const res = await getApplyDetailsApi(params)
|
||||
this.tableList = res.data.devDetailsList || []
|
||||
if(this.queryParams.id){
|
||||
this.queryParams = res.data.devInfo || {}
|
||||
this.queryParams.status = '0'
|
||||
this.queryParams.useUnit = sessionStorage.getItem('deptName')
|
||||
}
|
||||
this.total = res.data.total || 0
|
||||
} catch (error) {
|
||||
this.tableList = []
|
||||
this.total = 0
|
||||
} finally {
|
||||
this.isLoading = false
|
||||
}
|
||||
},
|
||||
|
||||
//通过
|
||||
handlePass() {
|
||||
this.$confirm('是否确定通过?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}).then(async () => {
|
||||
applyPassApi({ id: this.queryParams.id, taskStatus: '1' }).then(res => {
|
||||
this.$message({
|
||||
type:'success',
|
||||
message: '操作成功!',
|
||||
})
|
||||
this.$router.go(-1)
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
// 驳回
|
||||
handleFail() {
|
||||
this.$confirm('是否确定驳回?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}).then(async () => {
|
||||
applyPassApi({ id: this.queryParams.id, taskStatus: '2' }).then(res => {
|
||||
this.$message({
|
||||
type:'success',
|
||||
message: '操作成功!',
|
||||
})
|
||||
this.$router.go(-1)
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
|
||||
handleBack() {
|
||||
this.$router.push({ path: '/business/auditList' })
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
||||
|
|
@ -0,0 +1,205 @@
|
|||
<template>
|
||||
<!-- 基础页面 -->
|
||||
<div class="app-container">
|
||||
<el-card v-show="showSearch" style="margin-bottom: 20px">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" inline @submit.native.prevent>
|
||||
<el-form-item label="项目名称:" prop="proCode">
|
||||
<el-select
|
||||
clearable
|
||||
placeholder="请选择项目名称"
|
||||
v-model="queryParams.proCode"
|
||||
>
|
||||
<el-option
|
||||
:key="item.proCode"
|
||||
:label="item.proName"
|
||||
:value="item.proCode"
|
||||
v-for="item in useProjectList"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="任务状态" prop="taskStatus">
|
||||
<el-select
|
||||
v-model="queryParams.taskStatus"
|
||||
placeholder="请选择任务状态"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 240px"
|
||||
>
|
||||
<el-option v-for="item in statusList" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<!-- 日期范围 -->
|
||||
<el-form-item label="申请日期">
|
||||
<el-date-picker
|
||||
v-model="timeRange"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
clearable
|
||||
unlink-panels
|
||||
value-format="yyyy-MM-dd"
|
||||
format="yyyy-MM-dd"
|
||||
style="width: 240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 表单按钮 -->
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">查询</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card>
|
||||
<el-row :gutter="10" class="mb8" justify="end">
|
||||
<el-col :span="4">
|
||||
<span style="font-size: 20px; font-weight: 800">申请审核列表</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
v-loading="isLoading"
|
||||
:data="tableList"
|
||||
highlight-current-row
|
||||
border
|
||||
stripe
|
||||
:max-height="650"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-table-column
|
||||
type="index"
|
||||
width="55"
|
||||
label="序号"
|
||||
align="center"
|
||||
:index="(index) => (queryParams.pageNum - 1) * queryParams.pageSize + index + 1"
|
||||
/>
|
||||
<el-table-column label="申请单号" align="center" prop="code" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="项目名称" align="center" prop="proName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="申请装备数" align="center" prop="devNum" :show-overflow-tooltip="true" width="120px"/>
|
||||
<el-table-column label="申请工具数" align="center" prop="toolNum" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="任务状态" align="center" prop="taskStatus" :show-overflow-tooltip="true" >
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.taskStatus == '0'" type="warning">待审核</el-tag>
|
||||
<el-tag v-if="scope.row.taskStatus == '1'" type="success">已通过</el-tag>
|
||||
<el-tag v-if="scope.row.taskStatus == '2'" type="danger">已驳回</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="申请人" align="center" prop="createBy" :show-overflow-tooltip="true" width="140px"/>
|
||||
<el-table-column label="申请时间" align="center" prop="createTime" width="160px"/>
|
||||
<el-table-column label="操作" align="center">
|
||||
<template slot-scope="{ row }">
|
||||
<el-button size="mini" type="text" icon="el-icon-zoom-in" @click="handleView(row)">查看</el-button>
|
||||
<el-button v-if="row.taskStatus == 0" size="mini" type="text" icon="el-icon-edit" @click="handleEdit(row)">审核</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页 -->
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getListApi, } from '@/api/business'
|
||||
import {
|
||||
getUseProjectListAPI,
|
||||
} from '@/api/EquipmentLedger/equ-out'
|
||||
export default {
|
||||
name: 'AuditList',
|
||||
data() {
|
||||
return {
|
||||
isLoading: false,
|
||||
showSearch: true,
|
||||
timeRange: [],
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
status: null,
|
||||
createBy: null,
|
||||
startTime: null,
|
||||
endTime: null,
|
||||
},
|
||||
statusList: [
|
||||
{ label: '待审核', value: '0' },
|
||||
{ label: '已通过', value: '1' },
|
||||
{ label: '已驳回', value: '2' },
|
||||
],
|
||||
total: 0, // 总条数
|
||||
// 表格数据
|
||||
tableList: [],
|
||||
useProjectList: [], // 使用项目下拉选
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getUseProjectList()
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
// 获取使用项目的下拉选
|
||||
async getUseProjectList() {
|
||||
const res = await getUseProjectListAPI()
|
||||
this.useProjectList = res.data
|
||||
},
|
||||
|
||||
// 查询
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
// 重置
|
||||
handleReset() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.queryParams.pageSize = 10
|
||||
this.queryParams.parentId = '0'
|
||||
this.queryParams.level = '1'
|
||||
this.timeRange = []
|
||||
this.$refs.queryForm.resetFields()
|
||||
this.getList()
|
||||
},
|
||||
// 获取列表
|
||||
async getList() {
|
||||
console.log('列表-查询', this.queryParams)
|
||||
this.isLoading = true
|
||||
this.queryParams.startTime = this.timeRange && this.timeRange[0] ? this.timeRange[0] : null
|
||||
this.queryParams.endTime = this.timeRange && this.timeRange[1] ? this.timeRange[1] : null
|
||||
try {
|
||||
const params = { ...this.queryParams }
|
||||
const res = await getListApi(params)
|
||||
this.tableList = res.data.rows || []
|
||||
this.total = res.data.total || 0
|
||||
} catch (error) {
|
||||
this.tableList = []
|
||||
this.total = 0
|
||||
} finally {
|
||||
this.isLoading = false
|
||||
}
|
||||
},
|
||||
// 新增
|
||||
handleAdd() {
|
||||
this.$router.push({ path: '/business/addAudit' })
|
||||
},
|
||||
// 查看
|
||||
handleView(row) {
|
||||
this.$router.push({ path: '/business/addAudit', query: { id: row.id, isView: true } })
|
||||
},
|
||||
// 审核
|
||||
handleEdit(row) {
|
||||
this.$router.push({ path: '/business/addAudit', query: { id: row.id, isEdit: true } })
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
Loading…
Reference in New Issue