|
@@ -0,0 +1,945 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <div>
|
|
|
+ <el-button class="font-small" style="margin:0 10px 10px 0" type="primary" icon="el-icon-edit" @click="handleCreate">
|
|
|
+ 新增
|
|
|
+ </el-button>
|
|
|
+ <el-button class="font-small" type="warning" icon="el-icon-copy-document" @click="handleCopy">
|
|
|
+ 复制
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+ <el-table
|
|
|
+ v-loading="listLoading"
|
|
|
+ element-loading-text="给我一点时间"
|
|
|
+ :data="list"
|
|
|
+ border
|
|
|
+ fit
|
|
|
+ highlight-current-row
|
|
|
+ style="width: 100%;"
|
|
|
+ :row-style="rowStyle"
|
|
|
+ :cell-style="cellStyle"
|
|
|
+ class="elTable table-fixed"
|
|
|
+ row-key="id"
|
|
|
+ default-expand-all
|
|
|
+ >
|
|
|
+ <el-table-column label="序号" align="center" type="index" width="50px" />
|
|
|
+ <el-table-column label="部位" header-align="center" width="100px" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ scope.row.positionName }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="备注" min-width="100px" header-align="center" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ scope.row.note }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" align="center" width="300" fixed="right">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-button type="primary" size="mini" @click="handleSee(row)">查看</el-button>
|
|
|
+ <el-button type="success" size="mini" @click="handleUpdate(row)">编辑</el-button>
|
|
|
+ <el-button type="success" size="mini" @click="handleSparePart(row)">备件</el-button>
|
|
|
+ <el-button size="mini" type="danger" @click="handleDelete(row)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <!-- 弹出层新增or修改 -->
|
|
|
+ <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" :close-on-click-modal="false">
|
|
|
+ <div class="content-add">
|
|
|
+ <el-form ref="createTemp" :rules="rules" :model="createTemp" label-position="right" label-width="100px" style="width: 90%; margin:0 auto;">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="部位名称:" prop="positionName">
|
|
|
+ <el-input ref="positionName" v-model="createTemp.positionName" :disabled="dialogStatus==='sparePart'" type="text" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="备注:" prop="note">
|
|
|
+ <el-input ref="note" v-model="createTemp.note" class="note" :disabled="dialogStatus==='sparePart'" type="textarea" placeholder="备注" autosize maxlength="100" show-word-limit style="width:100%;" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row v-if="isUpdate">
|
|
|
+ <el-col :span="20">
|
|
|
+ <el-form-item label="备件:" prop="partCode">
|
|
|
+ <el-autocomplete
|
|
|
+ v-model="createTemp.partCode"
|
|
|
+ value-key="name"
|
|
|
+ class="inline-input"
|
|
|
+ :fetch-suggestions="sparePartSearch"
|
|
|
+ placeholder="请输入备件编号或备件名称或备件规格"
|
|
|
+ style="width:100%"
|
|
|
+ @select="handleSelectSparePart"
|
|
|
+ >
|
|
|
+ <template slot-scope="{ item }">
|
|
|
+ <b>备件编号:</b><div class="name" style="display: inline;">{{ item.partCode }}</div>
|
|
|
+ | <b>备件名称:</b><span class="addr">{{ item.partName }}</span>
|
|
|
+ | <b>备件规格:</b><span class="addr">{{ item.specification }}</span>
|
|
|
+ </template>
|
|
|
+ </el-autocomplete>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <el-table
|
|
|
+ v-if="isUpdate"
|
|
|
+ :key="tableKey"
|
|
|
+ v-loading="listLoading"
|
|
|
+ element-loading-text="给我一点时间"
|
|
|
+ :data="listAdd"
|
|
|
+ border
|
|
|
+ fit
|
|
|
+ highlight-current-row
|
|
|
+ style="width: 100%;margin-bottom:30px"
|
|
|
+ :row-style="rowStyle"
|
|
|
+ :cell-style="cellStyle"
|
|
|
+ class="elTable table-fixed"
|
|
|
+ >
|
|
|
+ <!-- table表格 -->
|
|
|
+ <el-table-column label="序号" align="center" type="index" width="50px" />
|
|
|
+ <el-table-column label="备件编号" min-width="90px" prop="partCode" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ scope.row.partCode }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="备件名称" min-width="80px" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ scope.row.partName }}</span><br>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="备件规格" prop="specification" align="center" min-width="100">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ scope.row.specification }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column valign="middle" label="配备数量" min-width="90px" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-form :model="scope.row" :rules="rules">
|
|
|
+ <el-form-item prop="amount">
|
|
|
+ <el-input
|
|
|
+ ref="amount"
|
|
|
+ v-model="scope.row.amount"
|
|
|
+ style="margin-top:15px"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column valign="middle" label="备注" min-width="90px" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-form :model="scope.row" :rules="rules">
|
|
|
+ <el-form-item prop="note">
|
|
|
+ <el-input
|
|
|
+ ref="note"
|
|
|
+ v-model="scope.row.note"
|
|
|
+ style="margin-top:15px;"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" align="center" width="100" class-name="small-padding fixed-width" fixed="right">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <!-- <a v-if="dialogStatus==='sparePart'" class="primary" @click="partSave(row)">保存</a> -->
|
|
|
+ <!-- <a v-if="dialogStatus==='create'" class="del" @click="partDelete(row)">删除</a> -->
|
|
|
+ <a class="del" @click="partUpdateDelete(row)">删除</a>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button v-if="dialogStatus==='create'" ref="createb" type="success" :disabled="isokDisable" @click="createData_again()">保存并新增</el-button>
|
|
|
+ <el-button v-if="dialogStatus==='create'" type="primary" :disabled="isokDisable" @click="createData()">保存并关闭</el-button>
|
|
|
+ <el-button v-if="dialogStatus==='create'" @click="dialogFormVisible = false;getList()">取消并关闭</el-button>
|
|
|
+ <el-button v-if="dialogStatus==='sparePart'" type="primary" :disabled="isokDisable" @click="sparePartData()">保存并关闭</el-button>
|
|
|
+ <el-button v-if="dialogStatus==='sparePart'" @click="dialogFormVisible = false;getList()">关闭</el-button>
|
|
|
+ <el-button v-if="dialogStatus==='update'" type="primary" :disabled="isokDisable" @click="updateData()">保存并关闭</el-button>
|
|
|
+ <el-button v-if="dialogStatus==='update'" @click="dialogFormVisible = false;getList()">关闭</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ <el-dialog
|
|
|
+ :title="textMap[dialogStatusSee]"
|
|
|
+ :visible.sync="dialogFormVisibleSee"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ >
|
|
|
+ <div class="content-see">
|
|
|
+ <el-form
|
|
|
+ ref=" seeTemp"
|
|
|
+ :rules="rules"
|
|
|
+ :model=" seeTemp"
|
|
|
+ label-position="right"
|
|
|
+ label-width="120px"
|
|
|
+ style="width: 90%;margin:0 auto;"
|
|
|
+ >
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="部位名称:" prop="positionName">
|
|
|
+ <el-input ref="positionName" v-model="seeTemp.positionName" placeholder="请输入部位名称" disabled />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="备注:" prop="note">
|
|
|
+ <el-input ref="note" v-model="seeTemp.note" placeholder="请输入备注" disabled />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <el-table
|
|
|
+ v-loading="listLoadingSee"
|
|
|
+ element-loading-text="给我一点时间"
|
|
|
+ :data="listSee"
|
|
|
+ border
|
|
|
+ fit
|
|
|
+ highlight-current-row
|
|
|
+ style="width: 100%;"
|
|
|
+ :row-style="rowStyle"
|
|
|
+ :cell-style="cellStyle"
|
|
|
+ class="elTable table-fixed"
|
|
|
+ row-key="id"
|
|
|
+ >
|
|
|
+ <el-table-column label="序号" align="center" type="index" width="50px" />
|
|
|
+ <el-table-column label="备件编号" header-align="center" width="100px" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ scope.row.partCode }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="备件名称" min-width="100px" header-align="center" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ scope.row.partName }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="备件规格" min-width="100px" header-align="center" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ scope.row.specification }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="配备数量" min-width="100px" header-align="center" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ scope.row.amount }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="备注" min-width="100px" header-align="center" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ scope.row.note }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ <div slot="footer" class="dialog-footer" style="bottom:10px">
|
|
|
+ <el-button @click="dialogFormVisibleSee = false">关闭</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ <!-- 弹出层复制信息 -->
|
|
|
+ <el-dialog
|
|
|
+ :title="textMap[dialogStatusCopy]"
|
|
|
+ :visible.sync="dialogFormVisibleCopy"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ >
|
|
|
+ <div class="content-copy">
|
|
|
+ <el-form
|
|
|
+ label-position="right"
|
|
|
+ label-width="110px"
|
|
|
+ style="width: 90%px; margin: 0 auto;"
|
|
|
+ >
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="设备类别:" prop="NewName">
|
|
|
+ <tree-select
|
|
|
+ :disabled="disabled"
|
|
|
+ :width="300"
|
|
|
+ size="small"
|
|
|
+ multiple
|
|
|
+ :data="parentType"
|
|
|
+ :default-props="defaultProps"
|
|
|
+ collapse-tags
|
|
|
+ :node-key="nodeKey"
|
|
|
+ :checked-keys="defaultCheckedKeys"
|
|
|
+ @popoverHide="popoverHide"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer" style="right:30px;position:absolute;bottom:30px">
|
|
|
+ <el-button type="primary" @click="dialogStatus==='create'?createCopyData():createCopyData()">确认</el-button>
|
|
|
+ <el-button @click="dialogFormVisibleCopy = false">关闭</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import waves from '@/directive/waves' // waves directive
|
|
|
+import enterToNext from '@/directive/enterToNext' // enterToNext directive
|
|
|
+import { PostDataByName, GetDataByName, transData, ExecDataByConfig, failproccess } from '@/api/common'
|
|
|
+import { MessageBox } from 'element-ui'
|
|
|
+import TreeSelect from '@/components/TreeSelect'
|
|
|
+import Cookies from 'js-cookie'
|
|
|
+import { parseTime } from '@/utils/index.js'
|
|
|
+export default {
|
|
|
+ name: 'Buwei',
|
|
|
+ components: { TreeSelect },
|
|
|
+ directives: { waves, enterToNext },
|
|
|
+ props: {
|
|
|
+ assetTypeid: {
|
|
|
+ type: Number,
|
|
|
+ default: 0
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ textMap: {
|
|
|
+ create: '新增',
|
|
|
+ update: '编辑',
|
|
|
+ copy: '复制',
|
|
|
+ see: '查看详情',
|
|
|
+ sparePart: '备件'
|
|
|
+ },
|
|
|
+ dialogFormVisibleCopy: false,
|
|
|
+ dialogStatusCopy: '',
|
|
|
+ disabled: false,
|
|
|
+ parentType: [],
|
|
|
+ getParmType: {
|
|
|
+ name: 'geteqclasslist'
|
|
|
+ // idname: 'id',
|
|
|
+ // params: [-1]
|
|
|
+ },
|
|
|
+ defaultProps: {
|
|
|
+ children: 'children',
|
|
|
+ label: 'typeName'
|
|
|
+ },
|
|
|
+ nodeKey: 'id',
|
|
|
+ defaultCheckedKeys: [],
|
|
|
+ dataform: {
|
|
|
+ id: '',
|
|
|
+ name: '',
|
|
|
+ selectType: [],
|
|
|
+ sort: '',
|
|
|
+ enable: ''
|
|
|
+ },
|
|
|
+ UpdateDataRelationParam: {
|
|
|
+ name: '',
|
|
|
+ dataname: '',
|
|
|
+ datavalue: '',
|
|
|
+ valuename: '',
|
|
|
+ values: ''
|
|
|
+ },
|
|
|
+ getdataListParm: {
|
|
|
+ name: 'getPartList',
|
|
|
+ parammaps: {
|
|
|
+ id: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ list: [],
|
|
|
+ total: 0,
|
|
|
+ listLoading: true,
|
|
|
+ dialogStatus: '',
|
|
|
+ dialogFormVisible: false,
|
|
|
+ createTemp: {
|
|
|
+ part: '',
|
|
|
+ note: ''
|
|
|
+ },
|
|
|
+ listAdd: [],
|
|
|
+ tableKey: 0,
|
|
|
+ isokDisable: false,
|
|
|
+ requestSparePart: {
|
|
|
+ name: 'getPartsListBW',
|
|
|
+ page: 1,
|
|
|
+ offset: 1,
|
|
|
+ pagecount: 10,
|
|
|
+ returntype: 'Map',
|
|
|
+ parammaps: {
|
|
|
+ pastureId: Cookies.get('pastureid')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ postDataPramas: {},
|
|
|
+ seeTemp: {},
|
|
|
+ dialogStatusSee: '',
|
|
|
+ dialogFormVisibleSee: false,
|
|
|
+ listLoadingSee: true,
|
|
|
+ totalSee: 0,
|
|
|
+ listSee: [],
|
|
|
+ getdataListParmSee: {
|
|
|
+ name: 'getPositionPartBypid',
|
|
|
+ page: 1,
|
|
|
+ offset: 1,
|
|
|
+ pagecount: 10,
|
|
|
+ returntype: 'Map',
|
|
|
+ parammaps: {}
|
|
|
+ },
|
|
|
+ partTemp: {},
|
|
|
+ postUpdatePramas: {},
|
|
|
+ requestParam: {},
|
|
|
+ rules: {
|
|
|
+ positionName: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }]
|
|
|
+ },
|
|
|
+ rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
|
|
|
+ cellStyle: { padding: 0 + 'px' },
|
|
|
+ isUpdate: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ watch: {
|
|
|
+ assetTypeid(val) {
|
|
|
+ console.log(val)
|
|
|
+ if (this.assetTypeid != null) {
|
|
|
+ this.getdataListParm.parammaps.id = this.assetTypeid
|
|
|
+ this.getList()
|
|
|
+ this.getTypeList()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+
|
|
|
+ // 设置变量
|
|
|
+
|
|
|
+ methods: {
|
|
|
+ // ------------------------------------------------------------------
|
|
|
+ getList() {
|
|
|
+ this.listLoading = true
|
|
|
+ GetDataByName(this.getdataListParm).then(response => {
|
|
|
+ console.log('部位table数据', response.data.list)
|
|
|
+ this.list = response.data.list
|
|
|
+ if (response.data.total) {
|
|
|
+ this.total = response.data.total
|
|
|
+ }
|
|
|
+ // Just to simulate the time of the request
|
|
|
+ setTimeout(() => {
|
|
|
+ this.listLoading = false
|
|
|
+ }, 100)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ resetCreateTemp() {
|
|
|
+ this.listAdd = []
|
|
|
+ this.createTemp = {}
|
|
|
+ },
|
|
|
+ handleCreate() {
|
|
|
+ if (this.assetTypeid != '') {
|
|
|
+ this.resetCreateTemp()
|
|
|
+ this.dialogStatus = 'create'
|
|
|
+ this.dialogFormVisible = true
|
|
|
+ this.isUpdate = true
|
|
|
+ console.log(this.assetTypeid)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ sparePartSearch(queryString, cb) {
|
|
|
+ console.log('备件模糊查询输入值', queryString)
|
|
|
+ this.requestSparePart.parammaps['partCode'] = queryString
|
|
|
+ GetDataByName(this.requestSparePart).then(response => {
|
|
|
+ console.log('备件模糊查询搜索data', response.data.list)
|
|
|
+ cb(response.data.list)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleSelectSparePart(item) {
|
|
|
+ console.log('备件模糊查询选中值', item)
|
|
|
+ if (this.listAdd != null) {
|
|
|
+ // eslint-disable-next-line no-redeclare
|
|
|
+ if (this.listAdd.find(obj => obj.partId === item.partId)) {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '此备件已存在,请重新选择备件'
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$set(item, 'myid', new Date().getTime())
|
|
|
+ this.listAdd.unshift(item)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.listAdd = []
|
|
|
+ this.$set(item, 'myid', new Date().getTime())
|
|
|
+ this.listAdd.unshift(item)
|
|
|
+ }
|
|
|
+ console.log(this.listAdd, 'this.listAdd')
|
|
|
+ },
|
|
|
+ partDelete(row) {
|
|
|
+ console.log(this.listAdd)
|
|
|
+ MessageBox.confirm('设备名称:' + row.partName, '确认删除?', {
|
|
|
+ confirmButtonText: '确认',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ // console.log(this.list2)
|
|
|
+ for (var i = 0; i < this.listAdd.length; i++) {
|
|
|
+ console.log(this.listAdd[i])
|
|
|
+ if (this.listAdd[i].id === row.id) {
|
|
|
+ var listAddIndex = this.listAdd.indexOf(this.listAdd[i])
|
|
|
+ }
|
|
|
+ if (listAddIndex > -1) {
|
|
|
+ this.listAdd.splice(listAddIndex, 1)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ createData() {
|
|
|
+ this.isokDisable = true
|
|
|
+ setTimeout(() => {
|
|
|
+ this.isokDisable = false
|
|
|
+ }, 1000)
|
|
|
+ this.$refs['createTemp'].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ console.log(this.listAdd)
|
|
|
+ if (this.listAdd.length !== 0) {
|
|
|
+ for (var i = 0; i < this.listAdd.length; i++) {
|
|
|
+ if (this.listAdd[i].amount == '' || this.listAdd[i].amount == null) {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '请检查配备数量是否未填写',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ } else {
|
|
|
+ var rulesValue = /^\d+(\.\d{1,3})?$/
|
|
|
+ if (!rulesValue.test(parseFloat(this.listAdd[i].amount))) {
|
|
|
+ this.$message({ type: 'error', message: '配备数量请输入自然数,最多保留两位小数点', duration: 2000 })
|
|
|
+ return false
|
|
|
+ } else {
|
|
|
+ this.postDataPramas.common = { 'returnmap': '0' }
|
|
|
+ this.postDataPramas.data = []
|
|
|
+ this.postDataPramas.data[0] = { 'name': 'insertPart', 'type': 'e', 'parammaps': {
|
|
|
+ positionName: this.createTemp.positionName,
|
|
|
+ note: this.createTemp.note,
|
|
|
+ id: this.assetTypeid
|
|
|
+ }}
|
|
|
+ // eslint-disable-next-line no-irregular-whitespace
|
|
|
+ this.postDataPramas.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.listAdd }}
|
|
|
+ this.postDataPramas.data[1].children = []
|
|
|
+ this.postDataPramas.data[1].children[0] = { 'name': 'insertPositionPart', 'type': 'e', 'parammaps': {
|
|
|
+ positionId: '@insertPart.LastInsertId',
|
|
|
+ note: '@insertSpotList.note',
|
|
|
+ partId: '@insertSpotList.partId',
|
|
|
+ amount: '@insertSpotList.amount'
|
|
|
+ }}
|
|
|
+ ExecDataByConfig(this.postDataPramas).then(response => {
|
|
|
+ console.log('新增保存发送参数', this.postDataPramas)
|
|
|
+ if (response.msg !== 'fail') {
|
|
|
+ this.dialogFormVisible = false
|
|
|
+ this.getList()
|
|
|
+ this.$notify({
|
|
|
+ title: '成功',
|
|
|
+ message: '新增成功',
|
|
|
+ type: 'success',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ failproccess(response, this.$notify)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$notify({
|
|
|
+ title: '',
|
|
|
+ message: '请选择备件',
|
|
|
+ type: 'warning',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ createData_again() {
|
|
|
+ this.isokDisable = true
|
|
|
+ setTimeout(() => {
|
|
|
+ this.isokDisable = false
|
|
|
+ }, 1000)
|
|
|
+ this.$refs['createTemp'].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ console.log(this.listAdd)
|
|
|
+ if (this.listAdd.length !== 0) {
|
|
|
+ for (var i = 0; i < this.listAdd.length; i++) {
|
|
|
+ if (this.listAdd[i].amount == '' || this.listAdd[i].amount == null) {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '请检查配备数量是否未填写',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ } else {
|
|
|
+ this.postDataPramas.common = { 'returnmap': '0' }
|
|
|
+ this.postDataPramas.data = []
|
|
|
+ this.postDataPramas.data[0] = { 'name': 'insertPart', 'type': 'e', 'parammaps': {
|
|
|
+ positionName: this.createTemp.positionName,
|
|
|
+ note: this.createTemp.note,
|
|
|
+ id: this.assetTypeid
|
|
|
+ }}
|
|
|
+ // eslint-disable-next-line no-irregular-whitespace
|
|
|
+ this.postDataPramas.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.listAdd }}
|
|
|
+ this.postDataPramas.data[1].children = []
|
|
|
+ this.postDataPramas.data[1].children[0] = { 'name': 'insertPositionPart', 'type': 'e', 'parammaps': {
|
|
|
+ positionId: '@insertPart.LastInsertId',
|
|
|
+ note: '@insertSpotList.note',
|
|
|
+ partId: '@insertSpotList.partId',
|
|
|
+ amount: '@insertSpotList.amount'
|
|
|
+ }}
|
|
|
+ ExecDataByConfig(this.postDataPramas).then(response => {
|
|
|
+ console.log('新增保存发送参数', this.postDataPramas)
|
|
|
+ if (response.msg !== 'fail') {
|
|
|
+ this.resetCreateTemp()
|
|
|
+ this.$notify({
|
|
|
+ title: '成功',
|
|
|
+ message: '新增成功',
|
|
|
+ type: 'success',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ failproccess(response, this.$notify)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$notify({
|
|
|
+ title: '',
|
|
|
+ message: '请选择备件',
|
|
|
+ type: 'warning',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleCopy() {
|
|
|
+ if (this.assetTypeid != '') {
|
|
|
+ this.dialogFormVisibleCopy = true
|
|
|
+ this.dialogStatusCopy = 'copy'
|
|
|
+ this.defaultCheckedKeys = []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ createCopyData() {
|
|
|
+ console.log(this.dataform.selectType)
|
|
|
+ if (this.dataform.selectType.length === 0) {
|
|
|
+ this.$message({
|
|
|
+ message: '请选择设备',
|
|
|
+ type: 'warning',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ var selectedType = []
|
|
|
+ for (var i = 0; i < this.dataform.selectType.length; i++) {
|
|
|
+ var checkedIdsObj = {}
|
|
|
+ checkedIdsObj['newEqclassId'] = this.dataform.selectType[i]
|
|
|
+ selectedType.push(checkedIdsObj)
|
|
|
+ }
|
|
|
+ console.log('处理选中值', selectedType)
|
|
|
+ this.dialogStatusCopy = 'copy'
|
|
|
+ this.dialogFormVisibleCopy = true
|
|
|
+ this.postDataPramas.common = { 'returnmap': '0' }
|
|
|
+ this.postDataPramas.data = []
|
|
|
+ this.postDataPramas.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': selectedType }}
|
|
|
+ this.postDataPramas.data[0].children = []
|
|
|
+ this.postDataPramas.data[0].children[0] = { 'name': 'CopyPosition', 'type': 'e', 'parammaps': {
|
|
|
+ newEqclassId: '@insertSpotList.newEqclassId',
|
|
|
+ eqclassid: this.assetTypeid
|
|
|
+ }}
|
|
|
+ ExecDataByConfig(this.postDataPramas).then(response => {
|
|
|
+ console.log('复制保存发送参数', this.postDataPramas)
|
|
|
+ if (response.msg !== 'fail') {
|
|
|
+ this.dialogFormVisibleCopy = false
|
|
|
+ this.$notify({
|
|
|
+ title: '成功',
|
|
|
+ message: '复制成功',
|
|
|
+ type: 'success',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ failproccess(response, this.$notify)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ popoverHide(checkedIds, checkedData) {
|
|
|
+ console.log('选中值', checkedIds, checkedData)
|
|
|
+ this.dataform.selectType = checkedIds
|
|
|
+ this.UpdateDataRelationParam.values = checkedIds
|
|
|
+ // eslint-disable-next-line no-unreachable
|
|
|
+ },
|
|
|
+ getTypeList() {
|
|
|
+ GetDataByName(this.getParmType).then(response => {
|
|
|
+ if (response.data.list !== null) {
|
|
|
+ this.parentType = transData(response.data.list, 'id', 'pid', 'children')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleSee(row) {
|
|
|
+ console.log(row)
|
|
|
+ this.seeTemp = Object.assign({}, row)
|
|
|
+ this.dialogStatusSee = 'see'
|
|
|
+ this.dialogFormVisibleSee = true
|
|
|
+ this.getdataListParmSee.parammaps.positionId = row.id
|
|
|
+ this.getListSee()
|
|
|
+ },
|
|
|
+ getListSee() {
|
|
|
+ GetDataByName(this.getdataListParmSee).then(response => {
|
|
|
+ console.log('部位table数据', response.data.list)
|
|
|
+ this.listSee = response.data.list
|
|
|
+ if (response.data.total) {
|
|
|
+ this.totalSee = response.data.total
|
|
|
+ }
|
|
|
+ // Just to simulate the time of the request
|
|
|
+ setTimeout(() => {
|
|
|
+ this.listLoadingSee = false
|
|
|
+ }, 100)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleUpdate(row) {
|
|
|
+ this.dialogStatus = 'update'
|
|
|
+ this.dialogFormVisible = true
|
|
|
+ this.createTemp = Object.assign({}, row)
|
|
|
+ this.isUpdate = false
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs['createTemp'].clearValidate()
|
|
|
+ })
|
|
|
+ // this.getdataListParmSee.parammaps.positionId = row.id
|
|
|
+ // this.getListPart()
|
|
|
+ },
|
|
|
+ updateData() {
|
|
|
+ this.postUpdatePramas.name = 'updatePosition'
|
|
|
+ this.postUpdatePramas.parammaps = {}
|
|
|
+ this.postUpdatePramas.parammaps.positionName = this.createTemp.positionName
|
|
|
+ this.postUpdatePramas.parammaps.note = this.createTemp.note
|
|
|
+ this.postUpdatePramas.parammaps.id = this.createTemp.id
|
|
|
+ PostDataByName(this.postUpdatePramas).then(response => {
|
|
|
+ console.log('编辑保存发送参数', this.postDataPramas)
|
|
|
+ if (response.msg === 'fail') {
|
|
|
+ this.$notify({
|
|
|
+ title: '保存失败',
|
|
|
+ message: response.data,
|
|
|
+ type: 'warning',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$notify({
|
|
|
+ title: '',
|
|
|
+ message: '保存成功',
|
|
|
+ type: 'success',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ this.dialogFormVisible = false
|
|
|
+ this.getList()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleSparePart(row) {
|
|
|
+ this.dialogStatus = 'sparePart'
|
|
|
+ this.dialogFormVisible = true
|
|
|
+ this.createTemp = Object.assign({}, row)
|
|
|
+ this.isUpdate = true
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs['createTemp'].clearValidate()
|
|
|
+ })
|
|
|
+ this.getdataListParmSee.parammaps.positionId = row.id
|
|
|
+ this.getListPart()
|
|
|
+ },
|
|
|
+ getListPart() {
|
|
|
+ GetDataByName(this.getdataListParmSee).then(response => {
|
|
|
+ console.log('部位table数据', response.data.list)
|
|
|
+ this.listAdd = response.data.list
|
|
|
+ // Just to simulate the time of the request
|
|
|
+ setTimeout(() => {
|
|
|
+ this.listLoading = false
|
|
|
+ }, 100)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // partSave(row) {
|
|
|
+ // this.partTemp = Object.assign({}, row)
|
|
|
+ // if (row.amount !== '' && row.amount !== null && row.amount !== undefined) {
|
|
|
+ // this.postUpdatePramas.name = 'insertPositionPart'
|
|
|
+ // // this.postUpdatePramas.parammaps = row
|
|
|
+ // this.postUpdatePramas.parammaps = {}
|
|
|
+ // this.postUpdatePramas.parammaps.positionId = this.createTemp.id
|
|
|
+ // this.postUpdatePramas.parammaps.partId = this.partTemp.partId
|
|
|
+ // this.postUpdatePramas.parammaps.note = this.partTemp.note
|
|
|
+ // this.postUpdatePramas.parammaps.amount = this.partTemp.amount
|
|
|
+ // PostDataByName(this.postUpdatePramas).then(response => {
|
|
|
+ // console.log('新增保存发送参数', this.postDataPramas)
|
|
|
+ // if (response.msg === 'fail') {
|
|
|
+ // this.$notify({
|
|
|
+ // title: '保存失败',
|
|
|
+ // message: response.data,
|
|
|
+ // type: 'warning',
|
|
|
+ // duration: 2000
|
|
|
+ // })
|
|
|
+ // } else {
|
|
|
+ // this.getListPart()
|
|
|
+ // this.$notify({
|
|
|
+ // title: '',
|
|
|
+ // message: '保存成功',
|
|
|
+ // type: 'success',
|
|
|
+ // duration: 2000
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // } else {
|
|
|
+ // this.$message({
|
|
|
+ // message: '请完善保养内容',
|
|
|
+ // type: 'warning',
|
|
|
+ // duration: 2000
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+
|
|
|
+ // partUpdateDelete(row) {
|
|
|
+ // console.log(row)
|
|
|
+ // MessageBox.confirm('确认是否删除当前信息?', {
|
|
|
+ // confirmButtonText: '确认',
|
|
|
+ // cancelButtonText: '取消',
|
|
|
+ // type: 'warning'
|
|
|
+ // }).then(() => {
|
|
|
+ // this.postUpdatePramas.name = 'deletePositionPart'
|
|
|
+ // this.postUpdatePramas.parammaps = {}
|
|
|
+ // this.postUpdatePramas.parammaps.id = row.id
|
|
|
+ // PostDataByName(this.postUpdatePramas).then(response => {
|
|
|
+ // console.log('新增保存发送参数', this.postDataPramas)
|
|
|
+ // if (response.msg === 'fail') {
|
|
|
+ // this.$notify({
|
|
|
+ // title: '保存失败',
|
|
|
+ // message: response.data,
|
|
|
+ // type: 'warning',
|
|
|
+ // duration: 2000
|
|
|
+ // })
|
|
|
+ // } else {
|
|
|
+ // this.getListPart()
|
|
|
+ // this.$notify({
|
|
|
+ // title: '',
|
|
|
+ // message: '保存成功',
|
|
|
+ // type: 'success',
|
|
|
+ // duration: 2000
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // })
|
|
|
+ // },
|
|
|
+ partUpdateDelete(row) {
|
|
|
+ console.log(row)
|
|
|
+ MessageBox.confirm('名称:' + row.partName, '确认删除?', {
|
|
|
+ confirmButtonText: '确认',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ for (var i = 0; i < this.listAdd.length; i++) {
|
|
|
+ console.log(this.listAdd[i])
|
|
|
+ if (this.listAdd[i].myid == row.myid) {
|
|
|
+ var listAddIndex = this.listAdd.indexOf(this.listAdd[i])
|
|
|
+ }
|
|
|
+ if (listAddIndex > -1) {
|
|
|
+ this.listAdd.splice(listAddIndex, 1)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ sparePartData() {
|
|
|
+ this.isokDisable = true
|
|
|
+ setTimeout(() => {
|
|
|
+ this.isokDisable = false
|
|
|
+ }, 1000)
|
|
|
+ console.log(this.listAdd)
|
|
|
+ if (this.listAdd.length !== 0) {
|
|
|
+ for (var i = 0; i < this.listAdd.length; i++) {
|
|
|
+ if (this.listAdd[i].amount == '' || this.listAdd[i].amount == null) {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '请检查配备数量是否未填写',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ } else {
|
|
|
+ var rulesValue = /^\d+(\.\d{1,3})?$/
|
|
|
+ if (!rulesValue.test(parseFloat(this.listAdd[i].amount))) {
|
|
|
+ this.$message({ type: 'error', message: '配备数量请输入自然数,最多保留两位小数点', duration: 2000 })
|
|
|
+ return false
|
|
|
+ } else {
|
|
|
+ this.postDataPramas.common = { 'returnmap': '0' }
|
|
|
+ this.postDataPramas.data = []
|
|
|
+ this.postDataPramas.data[0] = { 'name': 'deletePositionpartByPid', 'type': 'e', 'parammaps': {
|
|
|
+ positionId: this.createTemp.id
|
|
|
+ }}
|
|
|
+ // eslint-disable-next-line no-irregular-whitespace
|
|
|
+ this.postDataPramas.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.listAdd }}
|
|
|
+ this.postDataPramas.data[1].children = []
|
|
|
+ this.postDataPramas.data[1].children[0] = { 'name': 'insertPositionPart', 'type': 'e', 'parammaps': {
|
|
|
+ positionId: this.createTemp.id,
|
|
|
+ note: '@insertSpotList.note',
|
|
|
+ partId: '@insertSpotList.partId',
|
|
|
+ amount: '@insertSpotList.amount'
|
|
|
+ }}
|
|
|
+ ExecDataByConfig(this.postDataPramas).then(response => {
|
|
|
+ console.log('备件保存发送参数', this.postDataPramas)
|
|
|
+ if (response.msg !== 'fail') {
|
|
|
+ this.dialogFormVisible = false
|
|
|
+ this.getList()
|
|
|
+ this.$notify({
|
|
|
+ title: '成功',
|
|
|
+ message: '新增成功',
|
|
|
+ type: 'success',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ failproccess(response, this.$notify)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$notify({
|
|
|
+ title: '',
|
|
|
+ message: '请选择备件',
|
|
|
+ type: 'warning',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleDelete(row) {
|
|
|
+ MessageBox.confirm('名称:' + row.positionName, '确认删除?', {
|
|
|
+ confirmButtonText: '确认',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.requestParam.name = 'deletePart'
|
|
|
+ this.requestParam.parammaps = {}
|
|
|
+ this.requestParam.parammaps.id = row.id
|
|
|
+ PostDataByName(this.requestParam).then(() => {
|
|
|
+ this.getList()
|
|
|
+ this.$notify({
|
|
|
+ title: '成功',
|
|
|
+ message: '删除成功',
|
|
|
+ type: 'success',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消删除'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // ------------------------------------------------------------------
|
|
|
+ jump() {
|
|
|
+ this.$router.push('/console/menu')
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+<style lang="scss">
|
|
|
+.note textarea{
|
|
|
+ height: 40px !important;
|
|
|
+ line-height: 27px;
|
|
|
+}
|
|
|
+</style>
|
|
|
+
|