You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1344 lines
49 KiB
Vue

<template>
<div class="app-container">
<el-row :gutter="20">
<el-col :span="4" :xs="24">
<div class="head-container">
<el-input
v-model="deptName"
placeholder="请输入设备类型名称"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</div>
<div class="head-container">
<el-tree
:data="devicetypeOptions"
:props="defaultProps"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
node-key="id"
default-expand-all
highlight-current
@node-click="handleNodeClick"
/>
</div>
</el-col>
<el-col :span="20":xs="24">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<!-- <el-form-item label="设备编号" prop="deviceCode">-->
<!-- <el-input-->
<!-- v-model="queryParams.deviceCode"-->
<!-- placeholder="请输入设备编号"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label="设备名称" prop="deviceName">
<el-input
v-model="queryParams.deviceName"
placeholder="请输入设备名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="所属工位,关联pd_base_station_info的station_id" prop="stationId">-->
<!-- <el-input-->
<!-- v-model="queryParams.stationId"-->
<!-- placeholder="请输入所属工位,关联pd_base_station_info的station_id"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="资产编号" prop="assetNumber">-->
<!-- <el-input-->
<!-- v-model="queryParams.assetNumber"-->
<!-- placeholder="请输入资产编号"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label="设备位置" prop="deviceLocation">
<el-input
v-model="queryParams.deviceLocation"
placeholder="请输入设备位置"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="设备类型,关联dm_base_device_type的device_type_id" prop="deviceTypeId">-->
<!-- <el-input-->
<!-- v-model="queryParams.deviceTypeId"-->
<!-- placeholder="请输入设备类型,关联dm_base_device_type的device_type_id"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="设备规格" prop="deviceSpec">-->
<!-- <el-input-->
<!-- v-model="queryParams.deviceSpec"-->
<!-- placeholder="请输入设备规格"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label="供应商" prop="supplierId">
<el-input
v-model="queryParams.suplierName"
placeholder="请输入供应商"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="设备状态" prop="deviceStatus">
<el-select
v-model="queryParams.deviceStatus"
placeholder="设备状态"
clearable
style="width: 240px"
>
<el-option
v-for="dict in dict.type.device_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="是否标识1-是2-否" prop="isFlag">-->
<!-- <el-input-->
<!-- v-model="queryParams.isFlag"-->
<!-- placeholder="请输入是否标识1-是2-否"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['dms:ledger:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['dms:ledger:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['dms:ledger:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['dms:ledger:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="ledgerList"
:row-class-name="tableRowClassName"
:row-style="selectedstyle"
@row-click="getDeviceTypes"
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="主键标识" align="center" prop="deviceId" />-->
<el-table-column label="设备编号" align="center" prop="deviceCode" key="device1"/>
<el-table-column label="设备名称" align="center" prop="deviceName" key="device2"/>
<el-table-column label="所属工位" align="center" prop="stationId" key="device3"/>
<el-table-column label="资产编号" align="center" prop="assetNumber" key="device4"/>
<el-table-column label="设备位置" align="center" prop="deviceLocation" key="device5"/>
<!-- <el-table-column label="设备类型" align="center" prop="deviceTypeId" />-->
<el-table-column label="设备类型" align="center" prop="deviceTypeId" key="device6" >
<template slot-scope="scope">
<span
v-for="(item, index) in devicetypeList"
:key="index"
:value="item.devicetypeList"
v-if="scope.row.deviceTypeId == item.deviceTypeId"
>
{{ item.typeName }}
</span>
</template>
</el-table-column>
<el-table-column label="设备规格" align="center" prop="deviceSpec" key="device7"/>
<!-- <el-table-column label="供应商" align="center" prop="suplierName" />-->
<el-table-column label="供应商" align="center" prop="suplierName" key="device8" >
<template slot-scope="scope">
<span
v-for="(item, index) in supplierList"
:key="index"
:value="item.supplierList"
v-if="scope.row.supplierId == item.supplierId"
>
{{ item.suplierName }}
</span>
</template>
</el-table-column>
<!-- <el-table-column label="设备状态" align="center" prop="deviceStatus" />-->
<el-table-column label="设备状态" align="center" prop="deviceStatus" key="device9">
<template slot-scope="scope">
<dict-tag :options="dict.type.device_status" :value="scope.row.deviceStatus"/>
</template>
</el-table-column>
<!-- <el-table-column label="是否标识1-是2-否" align="center" prop="isFlag" />-->
<!-- <el-table-column label="标识" align="center" prop="isFlag">-->
<!-- <template slot-scope="scope">-->
<!-- <dict-tag :options="dict.type.is_flag" :value="scope.row.isFlag"/>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="备注" align="center" prop="remark" key="device10" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['dms:ledger:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['dms:ledger:remove']"
>删除</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-col>
</el-row>
<el-row :gutter="20">
<el-col :span="20":offset="4":xs="20">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
class="deviceTypeClass"
size="mini"
v-bind:style="[isStyle?{color:'white', backgroundColor:'#1890ff'}:{}] "
@click="getDeviceTypes"
v-hasPermi="['dms:ledger:add']"
>设备类型</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
size="mini"
@click="getDeviceSupliers"
v-hasPermi="['dms:ledger:add']"
>设备供应商</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
size="mini"
@click="getDeviceDepreciations"
v-hasPermi="['dms:ledger:add']"
>设备折旧</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="primary"-->
<!-- plain-->
<!-- icon="el-icon-plus"-->
<!-- size="mini"-->
<!-- @click="getDeviceCheckplans"-->
<!-- v-hasPermi="['dms:ledger:add']"-->
<!-- >设备盘点</el-button>-->
<!-- </el-col>-->
<el-col :span="1.5">
<el-button
type="primary"
plain
size="mini"
@click="getDeviceInstalls"
v-hasPermi="['dms:ledger:add']"
>设备安装</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
size="mini"
@click="getDeviceInfos"
v-hasPermi="['dms:ledger:add']"
>设备转移</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
size="mini"
@click="getDeviceDebuggings"
v-hasPermi="['dms:ledger:add']"
>设备调试</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="success"-->
<!-- plain-->
<!-- icon="el-icon-edit"-->
<!-- size="mini"-->
<!-- :disabled="single"-->
<!-- @click="getDeviceTypes"-->
<!-- v-hasPermi="['dms:ledger:edit']"-->
<!-- >修改2</el-button>-->
<!-- </el-col>-->
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
</el-row>
<!-- el-table-column中的key为唯一标识目的是确保渲染时数据可以被渲染出来key中的数据没有意义只要唯一即可-->
<el-table v-loading="loading" :data="devicetypeList2" v-if=deviceTypeIf
:v-if="refreshTable"
row-key="deviceTypeId"
:default-expand-all="isExpandAll"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
<el-table-column label="类型编号" align="center" prop="typeCode" key="type1" />
<el-table-column label="类型名称" align="center" prop="typeName"key="type2" />
<!-- <el-table-column label="是否标识1-是2-否" align="center" prop="isFlag" />-->
<!-- <el-table-column label="标识" align="center" prop="isFlag" key="type3">-->
<!-- <template slot-scope="scope">-->
<!-- <dict-tag :options="dict.type.is_flag" :value="scope.row.isFlag"/>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="祖级列表" align="center" prop="ancestors" key="type4"/>-->
<el-table-column label="备注" align="center" prop="remark" key="type5"/>
</el-table>
<!-- 删掉这个eltable会导致上面eltable的树级无法显示-->
<el-table
v-if=deviceTypeIf
v-loading="loading"
:data="devicetypeList2"
row-key="deviceTypeId"
:default-expand-all="isExpandAll"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
</el-table>
<el-table v-loading="loading" :data="supplierList" v-if=deviceSuplierIf>
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="主键标识" align="center" prop="supplierId" key="sup5"/>-->
<el-table-column label="供应商编号" align="center" prop="suplierCode" key="sup1"/>
<el-table-column label="供应商名称" align="center" prop="suplierName" key="sup2"/>
<el-table-column label="供应商联系人" align="center" prop="suplierPerson" key="sup3"/>
<el-table-column label="供应商电话" align="center" prop="suplierTel" key="sup4" />
<el-table-column label="供应商地址" align="center" prop="suplierAddress" key="sup6"/>
<!-- <el-table-column label="供应商状态" align="center" prop="suplierStatus" />-->
<el-table-column label="供应商状态" align="center" prop="suplierStatus" key="sup7">
<template slot-scope="scope">
<dict-tag :options="dict.type.suplier_status" :value="scope.row.suplierStatus"/>
</template>
</el-table-column>
<!-- <el-table-column label="是否标识1-是2-否" align="center" prop="isFlag" />-->
<!-- <el-table-column label="标识" align="center" prop="isFlag" key="sup8">-->
<!-- <template slot-scope="scope">-->
<!-- <dict-tag :options="dict.type.is_flag" :value="scope.row.isFlag"/>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="备注" align="center" prop="remark" key="sup9"/>
</el-table>
<el-table v-loading="loading" :data="devicedepreciationList" v-if=deviceDepreciationIf >
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="主键标识" align="center" prop="deviceDepreciationId" />-->
<el-table-column label="设备ID" align="center" prop="deviceId" key="deper2"/>
<el-table-column label="设备名称" align="center" prop="deviceId"key="deper20" >
<template slot-scope="scope">
<span
v-for="(item, index) in ledgerList"
:key="index"
:value="item.ledgerList"
v-if="scope.row.deviceId == item.deviceId"
>
{{ item.deviceName }}
</span>
</template>
</el-table-column>
<el-table-column label="维修次数" align="center" prop="repairFrequency"key="deper3" />
<el-table-column label="维修费用" align="center" prop="repairCosts" key="deper4"/>
<el-table-column label="折旧费用" align="center" prop="depreciationCost" key="depre1" />
<el-table-column label="投入时间" align="center" prop="putintoTime" width="180" key="deper5">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.putintoTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="使用年限" align="center" prop="useLife" key="deper6"/>
<!-- <el-table-column label="是否标识1-是2-否" align="center" prop="isFlag" />-->
<!-- <el-table-column label="标识" align="center" prop="isFlag">-->
<!-- <template slot-scope="scope">-->
<!-- <dict-tag :options="dict.type.is_flag" :value="scope.row.isFlag"/>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="备注" align="center" prop="remark" key="deper7" />
</el-table>
<el-table v-loading="loading" :data="checkplanList" v-if=deviceCheckplanIf>
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="盘点计划ID" align="center" prop="flowCheckplanId" key="flow1" />-->
<el-table-column label="盘点计划ID" align="center" prop="flowCheckplanId" key="flow1">
<template slot-scope="scope">
<router-link :to="'/dms/detail/index/' + scope.row.flowCheckplanId" class="link-type">
<span>{{ scope.row.flowCheckplanId }}</span>
</router-link>
</template>
</el-table-column>
<el-table-column label="盘点单号" align="center" prop="checkCode" key="flow2"/>
<el-table-column label="计划盘点时间" align="center" prop="planTime" width="180" key="flow3">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.planTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="盘点人员" align="center" prop="checkBy" key="flow4"/>
<!-- <el-table-column label="设备类型ID关联dms_base_device_type的device_type_id" align="center" prop="deviceTypeId" />-->
<el-table-column label="设备类型" align="center" prop="deviceTypeId" key="flow5" >
<template slot-scope="scope">
<span
v-for="(item, index) in devicetypeList"
:key="index"
:value="item.devicetypeList"
v-if="scope.row.deviceTypeId == item.deviceTypeId"
>
{{ item.typeName }}
</span>
</template>
</el-table-column>
<el-table-column label="盘点数量" align="center" prop="checkAmount" key="flow6" />
<el-table-column label="剩余数量" align="center" prop="surplusCheckAmount" key="flow7"/>
<!-- <el-table-column label="盘点状态(0未盘点1已盘点2盘点中)" align="center" prop="checkState" />-->
<el-table-column label="盘点状态" align="center" prop="checkState">
<template slot-scope="scope">
<dict-tag :options="dict.type.dms_check_state" :value="scope.row.checkState"/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
</el-table>
<el-table v-loading="loading" :data="installList" v-if="deviceInstallIf">
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="主键ID" align="center" prop="deviceInstallId" />-->
<el-table-column label="设备ID" align="center" prop="deviceId" key="install1" />
<el-table-column label="设备名称" align="center" prop="deviceId" key="install2" >
<template slot-scope="scope">
<span
v-for="(item, index) in ledgerList"
:key="index"
:value="item.ledgerList"
v-if="scope.row.deviceId == item.deviceId"
>
{{ item.deviceName }}
</span>
</template>
</el-table-column>
<el-table-column label="安装地点" align="center" prop="installPosition" key="install3" />
<el-table-column label="安装时间" align="center" prop="installTime" width="180" key="install4">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.installTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="安装人员" align="center" prop="installPersion" key="install5" />
<!-- <el-table-column label="${comment}" align="center" prop="workOrder" />-->
<el-table-column label="备注" align="center" prop="remark" key="install6"/>
</el-table>
<el-table v-loading="loading" :data="infoList" v-if="deviceInfoIf" >
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键ID" align="center" prop="transferInfoId" key="info1" />
<el-table-column label="设备ID" align="center" prop="deviceId" key="info2"/>
<el-table-column label="设备名称" align="center" prop="deviceId" key="info3">
<template slot-scope="scope">
<span
v-for="(item, index) in ledgerList"
:key="index"
:value="item.ledgerList"
v-if="scope.row.deviceId == item.deviceId"
>
{{ item.deviceName }}
</span>
</template>
</el-table-column>
<el-table-column label="设备原位置" align="center" prop="devicePosition" key="info4"/>
<el-table-column label="设备转移位置" align="center" prop="devicePositionNew" key="info5"/>
<el-table-column label="设备转移人员" align="center" prop="devicePositionOperator"key="info6" />
<el-table-column label="设备转移原因" align="center" prop="devicePositionReason" key="info7"/>
<el-table-column label="设备转移时间" align="center" prop="deviceTransferTime" width="180" key="info8">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.deviceTransferTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" key="info9"/>
</el-table>
<el-table v-loading="loading" :data="debuggingList" v-if="deviceDebuggingIf">
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="主键ID" align="center" prop="deviceDebuggingId" />-->
<el-table-column label="调试单号" align="center" prop="workOrder" key="work1"/>
<!-- <el-table-column label="设备ID,关联dms_base_device_ledger的device_id" align="center" prop="deviceId" />-->
<el-table-column label="设备名称" align="center" prop="deviceId" key="work2">
<template slot-scope="scope">
<span
v-for="(item, index) in ledgerList"
:key="index"
:value="item.ledgerList"
v-if="scope.row.deviceId == item.deviceId"
>
{{ item.deviceName }}
</span>
</template>
</el-table-column>
<!-- <el-table-column label="调试状态(0未调试1调试中2已完成)" align="center" prop="status" />-->
<el-table-column label="调试状态" align="center" prop="status" key="work3">
<template slot-scope="scope">
<dict-tag :options="dict.type.dms_status" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="调试时间" align="center" prop="debugTime" width="180" key="work4">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.debugTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="调试人员" align="center" prop="debugPerson"key="work5" />
<el-table-column label="备注" align="center" prop="remark"key="work6" />
</el-table>
</el-col>
</el-row>
<!-- 添加或修改设备台账信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="设备编号" prop="deviceCode">
<el-input v-model="form.deviceCode" placeholder="请输入设备编号" />
</el-form-item>
<el-form-item label="设备名称" prop="deviceName">
<el-input v-model="form.deviceName" placeholder="请输入设备名称" />
</el-form-item>
<el-form-item label="所属工位" prop="stationId">
<el-input v-model="form.stationId" placeholder="请输入所属工位,关联pd_base_station_info的station_id" />
</el-form-item>
<el-form-item label="资产编号" prop="assetNumber">
<el-input v-model="form.assetNumber" placeholder="请输入资产编号" />
</el-form-item>
<el-form-item label="设备位置" prop="deviceLocation">
<el-input v-model="form.deviceLocation" placeholder="请输入设备位置" />
</el-form-item>
<!-- <el-form-item label="设备类型" prop="deviceTypeId">-->
<!-- <el-input v-model="form.deviceTypeId" placeholder="请输入设备类型,关联dm_base_device_type的device_type_id" />-->
<!-- </el-form-item>-->
<el-form-item label="设备类型" prop="deviceTypeId" >
<el-select v-model="form.deviceTypeId" placeholder="请输入设备类型">
<el-option
v-for="item in devicetypeList"
:key="item.deviceTypeId"
:label="item.typeName"
:value="item.deviceTypeId.toString()">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="设备规格" prop="deviceSpec">
<el-input v-model="form.deviceSpec" placeholder="请输入设备规格" />
</el-form-item>
<!-- <el-form-item label="供应商" prop="supplierId">-->
<!-- <el-input v-model="form.supplierId" placeholder="请输入供应商,关联dm_base_device_supplier的supplier_id" />-->
<!-- </el-form-item>-->
<el-form-item label="供应商" prop="supplierId" >
<el-select v-model="form.supplierId" placeholder="请输入供应商">
<el-option
v-for="item in supplierList"
:key="item.supplierId"
:label="item.suplierName"
:value="item.supplierId.toString()">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="设备状态" prop="deviceStatus">
<el-radio-group v-model="form.deviceStatus">
<el-radio
v-for="dict in dict.type.device_status"
:key="dict.value"
:label="parseInt(dict.value)"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<!-- <el-form-item label="标识" prop="isFlag">-->
<!-- <el-radio-group v-model="form.isFlag">-->
<!-- <el-radio-->
<!-- v-for="dict in dict.type.is_flag"-->
<!-- :key="dict.value"-->
<!-- :label="parseInt(dict.value)"-->
<!-- >{{dict.label}}</el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listLedger, getLedger, delLedger, addLedger, updateLedger } from "@/api/dms/ledger";
import { listDevicetype ,selectDevicetypeByDeviceId}from "@/api/dms/devicetype";
import { getSuplier, listSuplier } from '@/api/dms/suplier'
import { listDevicedepreciation } from '@/api/dms/devicedepreciation'
import Treeselect from '@riophae/vue-treeselect'
import { listCheckplan } from '@/api/dms/checkplan'
import { listInstall } from '@/api/dms/install'
import { listInfo } from '@/api/dms/info'
import { listDebugging } from '@/api/dms/debugging'
export default {
name: "Ledger",
dicts: ['is_flag','suplier_status','device_status','dms_check_state','dms_variation_flag','dms_status'],
components: {
Treeselect
},
data() {
return {
isStyle:false,
isAutofocus:"",
getIndex:"",
deviceDebuggingIf:false,
deviceInfoIf:false,
deviceSuplierIf:false,
deviceTypeIf:false,
deviceDepreciationIf:false,
deviceCheckplanIf:false,
deviceInstallIf:false,
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
//设备折旧
devicedepreciationList:[],
// 设备调试信息表格数据
debuggingList: [],
// 设备转移信息表格数据
infoList: [],
// 设备台账信息表格数据
ledgerList: [],
//设备类型信息
devicetypeList:[],
//树形设备类型信息
devicetypeList2:"",
//设备盘点集合
checkplanList:[],
//设备安装信息
installList:[],
//供应商信息
supplierList:[],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
typeNames:undefined,
devicetypeOptions:[],
defaultProps: {
children: "children",
label: "typeName"
},
deptName:undefined,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
deviceCode: null,
deviceName: null,
stationId: null,
assetNumber: null,
deviceLocation: null,
deviceTypeId: null,
TypeName: null,
suplierName: null,
deviceSpec: null,
supplierId: null,
deviceStatus: null,
isFlag: null,
deviceId: null,
},
// 是否展开,默认全部展开
isExpandAll: false,
// 重新渲染表格状态
refreshTable: true,
// 表单参数
form: {},
// 表单校验
rules: {
deviceCode: [
{ required: true, message: "设备编号不能为空", trigger: "blur" }
],
deviceName: [
{ required: true, message: "设备名称不能为空", trigger: "blur" }
],
deviceTypeId: [
{ required: true, message: "设备类型不能为空", trigger: "blur" }
],
}
};
},
watch: {
// 根据名称筛选部门树
deptName(val) {
this.$refs.tree.filter(val);
}
},
created() {
this.getList();
this.getDeviceType();
this.getSuplier()
this.getTreeselect();
this.getDeviceDepreciation();
this.getDeviceCheckplan();
this.getDeviceinstall();
this.getInfo();
this.getDebugging();
},
methods: {
selectedstyle ({row, rowIndex}) {
if ((this.getIndex) === rowIndex ) {
return {
"background-color": "#cdffff"
};
}
},
tableRowClassName ({row, rowIndex}) {
row.index = rowIndex;
},
//控制设备类型表格展开关闭
getDeviceTypes(row,event,column) {
this.isStyle=true;
if (row.deviceId!=null){
this.getIndex=row.index
}
if (this.queryParams.deviceId ==null && row.deviceId==null){
//查询全部
//this.getDeviceType3();
// alert("1")
}
else if (row.deviceId!=this.queryParams.deviceId){
// alert("2")
if (row.deviceId!=null){
this.queryParams.deviceId = row.deviceId;
//根据id查询
this.getDeviceType2();
}
else {
this.deviceTypeIf = true;
this.deviceSuplierIf = false;
this.deviceInstallIf = false;
this.deviceDepreciationIf = false;
this.deviceCheckplanIf = false;
this.deviceInfoIf = false;
this.deviceDebuggingIf = false;
}
}
else if (this.queryParams.deviceId == row.deviceId){
// alert("3")
//不查询
this.deviceTypeIf = true;
this.deviceSuplierIf = false;
this.deviceInstallIf = false;
this.deviceDepreciationIf = false;
this.deviceCheckplanIf = false;
this.deviceInfoIf = false;
this.deviceDebuggingIf = false;
}
else {
alert("未知错误")
}
},
//控制设备供应商表格展开关闭
getDeviceSupliers(row,event,column) {
this.isStyle=false;
// console.log("a1???????????????????")
if (this.queryParams.deviceId ==null && row.deviceId==null){
// this.getSuplier2();
// alert("1")
}
else if (row.deviceId!=this.queryParams.deviceId){
// alert("2")
if (this.queryParams.deviceId!=null&&row.deviceId==null){
// alert("2.5")/
// alert(this.queryParams.deviceId)
// this.queryParams.deviceId = row.deviceId;
this.getSuplier2();
}
else {
// alert("2.7")
this.deviceTypeIf = false;
this.deviceSuplierIf = true;
this.deviceInstallIf = false;
this.deviceDepreciationIf = false;
this.deviceCheckplanIf = false;
this.deviceInfoIf = false;
this.deviceDebuggingIf = false;
}
}
else if (this.queryParams.deviceId == row.deviceId){
// alert("3")
this.deviceTypeIf = false;
this.deviceSuplierIf = true;
this.deviceInstallIf = false;
this.deviceDepreciationIf = false;
this.deviceCheckplanIf = false;
this.deviceInfoIf = false;
this.deviceDebuggingIf = false;
}
else {
alert("4")
}
},
//控制设备折旧表格展开关闭
getDeviceDepreciations(row,event,column) {
this.isStyle=false;
if (this.queryParams.deviceId ==null && row.deviceId==null){
//查询全部
// this.getDeviceDepreciation2();
// alert("1")
}
else if (row.deviceId!=this.queryParams.deviceId){
// alert("2")
if (this.queryParams.deviceId!=null&&row.deviceId==null){
// alert("2.5")
console.log(this.devicedepreciationList)
//根据id查询
this.getDeviceDepreciation2();
}
else {
// alert("2.7")
this.deviceDepreciationIf = true;
this.deviceInstallIf= false;
this.deviceTypeIf = false;
this.deviceSuplierIf = false;
this.deviceCheckplanIf = false;
this.deviceInfoIf = false;
this.deviceDebuggingIf = false;
}
}
else if (this.queryParams.deviceId == row.deviceId){
// alert("3")
//不查询
this.deviceDepreciationIf = true;
this.deviceInstallIf= false;
this.deviceTypeIf = false;
this.deviceSuplierIf = false;
this.deviceCheckplanIf = false;
this.deviceInfoIf = false;
this.deviceDebuggingIf = false;
}
else {
alert("未知错误")
}
},
//todo 盘点明细与设备连接,盘点信息与设备类型连接,先不做
//控制设备盘点表格展开关闭
getDeviceCheckplans() {
this.deviceCheckplanIf = true;
this.deviceTypeIf = false;
this.deviceInstallIf= false;
this.deviceSuplierIf = false;
this.deviceDepreciationIf = false;
this.deviceInfoIf = false;
this.deviceDebuggingIf = false;
},
//控制设备安装表格展开关闭
getDeviceInstalls(row,event,column) {
this.isStyle=false;
if (this.queryParams.deviceId ==null && row.deviceId==null){
//查询全部
// this.getDeviceinstall2();
// alert("1")
}
else if (row.deviceId!=this.queryParams.deviceId){
// alert("2")
if (this.queryParams.deviceId!=null&&row.deviceId==null){
// alert("2.5")
console.log(this.devicedepreciationList)
//根据id查询
this.getDeviceinstall2();
}
else {
// alert("2.7")
this.deviceInstallIf= true;
this.deviceCheckplanIf = false;
this.deviceTypeIf = false;
this.deviceSuplierIf = false;
this.deviceDepreciationIf = false;
this.deviceInfoIf = false;
this.deviceDebuggingIf = false;
}
}
else if (this.queryParams.deviceId == row.deviceId){
// alert("3")
//不查询
this.deviceInstallIf= true;
this.deviceCheckplanIf = false;
this.deviceTypeIf = false;
this.deviceSuplierIf = false;
this.deviceDepreciationIf = false;
this.deviceInfoIf = false;
this.deviceDebuggingIf = false;
}
else {
alert("未知错误")
}
},
//控制设备转移表格展开关闭
getDeviceInfos(row,event,column) {
this.isStyle=false;
if (this.queryParams.deviceId ==null && row.deviceId==null){
//查询全部
// this.getInfo2();
// alert("1")
}
else if (row.deviceId!=this.queryParams.deviceId){
// alert("2")
if (this.queryParams.deviceId!=null&&row.deviceId==null){
// alert("2.5")
console.log(this.devicedepreciationList)
//根据id查询
this.getInfo2();
}
else {
// alert("2.7")
this.deviceInstallIf= false;
this.deviceCheckplanIf = false;
this.deviceTypeIf = false;
this.deviceSuplierIf = false;
this.deviceDepreciationIf = false;
this.deviceInfoIf = true;
this.deviceDebuggingIf = false;
}
}
else if (this.queryParams.deviceId == row.deviceId){
// alert("3")
//不查询
this.deviceInstallIf= false;
this.deviceCheckplanIf = false;
this.deviceTypeIf = false;
this.deviceSuplierIf = false;
this.deviceDepreciationIf = false;
this.deviceInfoIf = true;
this.deviceDebuggingIf = false;
}
else {
alert("未知错误")
}
},
//控制设备调试表格展开关闭
getDeviceDebuggings(row,event,column) {
this.isStyle=false;
if (this.queryParams.deviceId ==null && row.deviceId==null){
//查询全部
// this.getDebugging2();
// alert("1")
}
else if (row.deviceId!=this.queryParams.deviceId){
// alert("2")
if (this.queryParams.deviceId!=null&&row.deviceId==null){
// alert("2.5")
console.log(this.devicedepreciationList)
//根据id查询
this.getDebugging2();
}
else {
// alert("2.7")
this.deviceInstallIf= false;
this.deviceCheckplanIf = false;
this.deviceTypeIf = false;
this.deviceSuplierIf = false;
this.deviceDepreciationIf = false;
this.deviceInfoIf = false;
this.deviceDebuggingIf = true;
}
}
else if (this.queryParams.deviceId == row.deviceId){
// alert("3")
//不查询
this.deviceInstallIf= false;
this.deviceCheckplanIf = false;
this.deviceTypeIf = false;
this.deviceSuplierIf = false;
this.deviceDepreciationIf = false;
this.deviceInfoIf = false;
this.deviceDebuggingIf = true;
}
else {
alert("未知错误")
}
},
/** 查询设备盘点计划列表 */
getDeviceCheckplan() {
listCheckplan(this.queryParams).then(response => {
this.checkplanList = response.rows;
});
},
/** 查询设备调试信息列表 */
getDebugging() {
listDebugging(this.queryParams).then(response => {
this.debuggingList = response.rows;
});
},
getDebugging2() {
listDebugging(this.queryParams).then(response => {
this.debuggingList = response.rows;
this.deviceInstallIf= false;
this.deviceCheckplanIf = false;
this.deviceTypeIf = false;
this.deviceSuplierIf = false;
this.deviceDepreciationIf = false;
this.deviceInfoIf = false;
this.deviceDebuggingIf = true;
});
},
/** 查询设备转移信息列表 */
getInfo() {
listInfo(this.queryParams).then(response => {
this.infoList = response.rows;
});
},
getInfo2() {
listInfo(this.queryParams).then(response => {
this.infoList = response.rows;
this.deviceInstallIf= false;
this.deviceCheckplanIf = false;
this.deviceTypeIf = false;
this.deviceSuplierIf = false;
this.deviceDepreciationIf = false;
this.deviceInfoIf = true;
this.deviceDebuggingIf = false;
});
},
/** 查询设备安装信息列表 */
getDeviceinstall() {
listInstall(this.queryParams).then(response => {
this.installList = response.rows;
});
},
getDeviceinstall2() {
listInstall(this.queryParams).then(response => {
this.installList = response.rows;
this.deviceInstallIf= true;
this.deviceCheckplanIf = false;
this.deviceTypeIf = false;
this.deviceSuplierIf = false;
this.deviceDepreciationIf = false;
this.deviceInfoIf = false;
this.deviceDebuggingIf = false;
});
},
/** 查询设备折旧信息列表 */
getDeviceDepreciation() {
listDevicedepreciation(this.queryParams).then(response => {
this.devicedepreciationList = response.rows;
});
},
getDeviceDepreciation2() {
listDevicedepreciation(this.queryParams).then(response => {
this.devicedepreciationList = response.rows;
this.deviceDepreciationIf = true;
this.deviceInstallIf= false;
this.deviceTypeIf = false;
this.deviceSuplierIf = false;
this.deviceCheckplanIf = false;
this.deviceInfoIf = false;
this.deviceDebuggingIf = false;
});
},
/** 查询设备类型信息下拉树结构 */
getTreeselect() {
listDevicetype().then(response => {
this.devicetypeOptions = [];
const data = { deviceTypeId: 0, typeName: '顶级节点', children: [] };
data.children = this.handleTree(response.data, "deviceTypeId", "parentId");
this.devicetypeOptions.push(data);
// console.log(data)
});
},
/** 查询设备台账信息列表 */
getList() {
this.loading = true;
listLedger(this.queryParams).then(response => {
this.ledgerList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 筛选节点
filterNode(value, data) {
// console.log(data);
// console.log(data.children)
if (!value) return true;
return data.typeName.indexOf(value) !== -1;
},
// 节点单击事件
handleNodeClick(data) {
this.deviceTypeIf = false;
this.deviceSuplierIf = false;
this.deviceInstallIf = false;
this.deviceDepreciationIf = false;
this.deviceCheckplanIf = false;
this.deviceInfoIf = false;
this.deviceDebuggingIf = false;
this.queryParams.deviceTypeId = null;
if (data.deviceTypeId==0){
this.handleQuery();
}
else {
this.queryParams.deviceTypeId = data.deviceTypeId;
console.log(data)
this.handleQuery();
}
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
deviceId: null,
deviceCode: null,
deviceName: null,
stationId: null,
assetNumber: null,
deviceLocation: null,
deviceTypeId: null,
TypeName: null,
deviceSpec: null,
supplierId: null,
suplierName:null,
deviceStatus: null,
isFlag: null,
remark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
//查询设备类型
getDeviceType2(){
selectDevicetypeByDeviceId(this.queryParams).then(response => {
// console.log(response)
this.devicetypeList2 = response.data;
this.deviceTypeIf = true;
this.deviceSuplierIf = false;
this.deviceInstallIf = false;
this.deviceDepreciationIf = false;
this.deviceCheckplanIf = false;
this.deviceInfoIf = false;
this.deviceDebuggingIf = false;
});
},
getDeviceType3() {
listDevicetype(this.queryParams).then(response => {
this.devicetypeList2 = this.handleTree(response.data, "deviceTypeId", "parentId");
this.deviceTypeIf = true;
this.deviceSuplierIf = false;
this.deviceInstallIf = false;
this.deviceDepreciationIf = false;
this.deviceCheckplanIf = false;
this.deviceInfoIf = false;
this.deviceDebuggingIf = false;
});
},
//查询设备类型
getDeviceType(){
listDevicetype().then(response => {
this.devicetypeList = response.data;
});
},
//查询供应商
//防止初始化时跳转到供应商
getSuplier(){
listSuplier().then(response => {
this.supplierList = response.rows;
})
},
getSuplier2(){
listSuplier(this.queryParams).then(response => {
this.supplierList = response.rows;
this.deviceTypeIf = false;
this.deviceSuplierIf = true;
this.deviceInstallIf = false;
this.deviceDepreciationIf = false;
this.deviceCheckplanIf = false;
this.deviceInfoIf = false;
this.deviceDebuggingIf = false;
})
},
/** 搜索按钮操作 */
handleQuery() {
this.deviceTypeIf = false;
this.deviceSuplierIf = false;
this.deviceInstallIf = false;
this.deviceDepreciationIf = false;
this.deviceCheckplanIf = false;
this.deviceInfoIf = false;
this.deviceDebuggingIf = false;
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.deviceInstallIf= false;
this.deviceCheckplanIf = false;
this.deviceTypeIf = false;
this.deviceSuplierIf = false;
this.deviceDepreciationIf = false;
this.deviceInfoIf = false;
this.deviceDebuggingIf = false;
this.queryParams.deviceTypeId = null;
this.$refs.tree.setCurrentKey(null)
this.queryParams.suplierName = null;
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.deviceId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加设备台账信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const deviceId = row.deviceId || this.ids
getLedger(deviceId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改设备台账信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.deviceId != null) {
updateLedger(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addLedger(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const deviceIds = row.deviceId || this.ids;
this.$modal.confirm('是否确认删除设备台账信息编号为"' + deviceIds + '"的数据项?').then(function() {
return delLedger(deviceIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('dms/ledger/export', {
...this.queryParams
}, `ledger_${new Date().getTime()}.xlsx`)
}
}
};
</script>
<style lang="scss">
.el-row{
margin-top: 10px;
}
.el-table tbody tr:hover>td {
background-color:transparent !important
}
//.el-button.deviceTypeClass:focus{
// color:#ffffff;
// background-color:#1890ff;
//}
</style>