|
|
@@ -195,133 +195,126 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- </el-form>
|
|
|
<!-- 设备分类 -->
|
|
|
- <div class="equipment_box">
|
|
|
- <div class="left_aside">
|
|
|
- <div class="equipment_list_title">设备列表</div>
|
|
|
- <div class="equipment_tree">
|
|
|
- <el-tree
|
|
|
- :data="planRuleEquiList"
|
|
|
- :props="defaultProps"
|
|
|
- ref="equiListTree"
|
|
|
- highlight-current
|
|
|
- node-key="id"
|
|
|
- @node-click="handleNodeClick"
|
|
|
- :disabled="isBindPlan"
|
|
|
- show-checkbox
|
|
|
- ></el-tree>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="right_aside">
|
|
|
- <div class="equipment_info">
|
|
|
- <div class="item_info">
|
|
|
- <span class="item_label">设备编码</span>
|
|
|
- <span class="item_value">{{ equipmentInfo.equiCode }}</span>
|
|
|
- </div>
|
|
|
- <div class="item_info">
|
|
|
- <span class="item_label">设备名称</span>
|
|
|
- <span class="item_value">{{ equipmentInfo.equiName }}</span>
|
|
|
- </div>
|
|
|
- <div class="item_info">
|
|
|
- <span class="item_label">设备型号</span>
|
|
|
- <span class="item_value">{{ equipmentInfo.equiModel }}</span>
|
|
|
- </div>
|
|
|
- <div class="item_info">
|
|
|
- <span class="item_label">设备位置</span>
|
|
|
- <span class="item_value">{{ equipmentInfo.equiLocation }}</span>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <!-- 添加操作事项 -->
|
|
|
- <div>
|
|
|
- <el-button type="text">操作事项</el-button>
|
|
|
- <el-table
|
|
|
- :data="matterRulesList"
|
|
|
- border
|
|
|
- >
|
|
|
- <el-table-column label="序号" align="center" width="60">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span>{{ scope.$index + 1 }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="事项" align="center" prop="name">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="内容" align="center" prop="content">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="标准" align="center" prop="norm">
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- </div>
|
|
|
+ <div class="equipment_box">
|
|
|
+ <div class="left_aside">
|
|
|
+ <div class="equipment_list_title">设备列表</div>
|
|
|
+ <div class="equipment_tree">
|
|
|
+ <el-tree
|
|
|
+ :data="planRuleEquiList"
|
|
|
+ :props="defaultProps"
|
|
|
+ ref="equiListTree"
|
|
|
+ highlight-current
|
|
|
+ node-key="id"
|
|
|
+ @node-click="handleNodeClick"
|
|
|
+ :disabled="isBindPlan"
|
|
|
+ show-checkbox
|
|
|
+ ></el-tree>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="right_aside">
|
|
|
+ <div class="equipment_info">
|
|
|
+ <div class="item_info">
|
|
|
+ <span class="item_label">设备编码</span>
|
|
|
+ <span class="item_value">{{ equipmentInfo.equiCode }}</span>
|
|
|
+ </div>
|
|
|
+ <div class="item_info">
|
|
|
+ <span class="item_label">设备名称</span>
|
|
|
+ <span class="item_value">{{ equipmentInfo.equiName }}</span>
|
|
|
+ </div>
|
|
|
+ <div class="item_info">
|
|
|
+ <span class="item_label">设备型号</span>
|
|
|
+ <span class="item_value">{{ equipmentInfo.equiModel }}</span>
|
|
|
+ </div>
|
|
|
+ <div class="item_info">
|
|
|
+ <span class="item_label">设备位置</span>
|
|
|
+ <span class="item_value">{{ equipmentInfo.equiLocation }}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 添加操作事项 -->
|
|
|
+ <div>
|
|
|
+ <el-button type="text">操作事项</el-button>
|
|
|
+ <el-table
|
|
|
+ :data="matterRulesList"
|
|
|
+ border
|
|
|
+ >
|
|
|
+ <el-table-column label="序号" align="center" width="60">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ scope.$index + 1 }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="事项" align="center" prop="name">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="内容" align="center" prop="content">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="标准" align="center" prop="norm">
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
|
|
|
- <!-- 添加备品备件 -->
|
|
|
- <div v-if="dialogTitle.includes('保养')">
|
|
|
- <el-button type="text" @click="addSpareItems" :disabled="isBindPlan"
|
|
|
- >添加备品备件</el-button
|
|
|
- >
|
|
|
- <el-table
|
|
|
- :data="planRuleEquiList[currentEquItemIndex]&&planRuleEquiList[currentEquItemIndex].partJson"
|
|
|
- height="300"
|
|
|
- :key='currentEquItemIndex'
|
|
|
- border
|
|
|
- >
|
|
|
- <el-table-column label="序号" align="center" width="60">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span>{{ scope.$index + 1 }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="备件名称" align="center" prop="name">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="规格型号" align="center" prop="model">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="所需数量" align="center" prop="num">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-input
|
|
|
- v-model.number="scope.row.num"
|
|
|
- size="small"
|
|
|
- oninput="value=value.replace(/[^\d]/g,'')"
|
|
|
- style="width: 100%"
|
|
|
- placeholder="输入数量"
|
|
|
- @input="changeNum"
|
|
|
- ></el-input>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="单位" align="center" prop="measuringUnit">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="费用" align="center">
|
|
|
- <template slot-scope="scope">
|
|
|
- {{scope.row.num*scope.row.amount}}{{scope.row.unit=='wanyuan'?'万元':'元'}}
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="操作" align="center" width="70">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-button
|
|
|
- type="text"
|
|
|
- @click="handleDeleteSpareItem(scope.$index)"
|
|
|
- :disabled="isBindPlan"
|
|
|
- >删除</el-button
|
|
|
- >
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- <div style="text-align: center">备件总费用:
|
|
|
- {{planRuleEquiList[currentEquItemIndex]&&planRuleEquiList[currentEquItemIndex].totalCost?planRuleEquiList[currentEquItemIndex].totalCost:'-'}}
|
|
|
- 元
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <!-- 添加备品备件 -->
|
|
|
+ <div v-if="dialogTitle.includes('保养')">
|
|
|
+ <el-button type="text" @click="addSpareItems" :disabled="isBindPlan"
|
|
|
+ >添加备品备件</el-button
|
|
|
+ >
|
|
|
+ <el-table
|
|
|
+ :data="planRuleEquiList[currentEquItemIndex]&&planRuleEquiList[currentEquItemIndex].sparePart"
|
|
|
+ height="300"
|
|
|
+ :key='currentEquItemIndex'
|
|
|
+ border
|
|
|
+ >
|
|
|
+ <el-table-column label="序号" align="center" width="60">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ scope.$index + 1 }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="备件名称" align="center" prop="name">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="规格型号" align="center" prop="model">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="所需数量" align="center" prop="num">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input
|
|
|
+ v-model.number="scope.row.num"
|
|
|
+ size="small"
|
|
|
+ oninput="value=value.replace(/[^\d]/g,'')"
|
|
|
+ style="width: 100%"
|
|
|
+ placeholder="输入数量"
|
|
|
+ @input="changeNum"
|
|
|
+ ></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="单位" align="center" prop="measuringUnit">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="费用" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{scope.row.num*scope.row.univalence?scope.row.num*scope.row.univalence:'0'}}{{scope.row.univalenceUnit=='wanyuan'?'万元':'元'}}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" align="center" width="70">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ @click="handleDeleteSpareItem(scope.$index)"
|
|
|
+ :disabled="isBindPlan"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <div style="text-align: center">备件总费用:
|
|
|
+ {{planRuleEquiList[currentEquItemIndex]&&planRuleEquiList[currentEquItemIndex].totalCost?planRuleEquiList[currentEquItemIndex].totalCost:'-'}}
|
|
|
+ 元
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-form>
|
|
|
</div>
|
|
|
<div slot="footer" class="dialog_footer">
|
|
|
<el-button size="small" type="primary" @click="submit">提交</el-button>
|
|
|
<el-button size="small" @click="handleClose">关闭</el-button>
|
|
|
</div>
|
|
|
-<!-- <RuleItemSelection
|
|
|
- ref="ruleItemSelectionRef"
|
|
|
- :ruleItem="matterRulesList"
|
|
|
- :selectedMatter="selectedMatter"
|
|
|
- :labelTitle="formLabel"
|
|
|
- @submit="ruleItemSelectionSubmit"
|
|
|
- /> -->
|
|
|
<AddSpareDialog
|
|
|
ref="addSpareDialogRef"
|
|
|
:selectedSpare="selectedSpare"
|
|
|
@@ -331,16 +324,8 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-// import planRules from '@/api/planRules/patrolConfig'
|
|
|
-// import contentConfig from '@/api/maintenance/patrol/ruleConfig'
|
|
|
-// import { getAssetsList } from '@/api/ledgerAssets/booksList'
|
|
|
-// import user from '@/api/main/user'
|
|
|
-// import dept from '@/api/main/dept'
|
|
|
-// import SelectTree from '@/components/selectTree'
|
|
|
import RuleItemSelection from '@/components/ruleItemSelection'
|
|
|
import AddSpareDialog from '@/components/addSpareDialog'
|
|
|
-// import { mapGetters } from 'vuex'
|
|
|
-// import { getRuleNameList } from '@/api/stockManagement/stocking'
|
|
|
import {deepClone} from "@/utils"
|
|
|
import { getRule , getCategory , getAssetList , saveOrUpdate , getInfoById } from '@/api/ruleManagement/plan';
|
|
|
import { getDetail , getCode } from '@/api/ruleManagement/matter';
|
|
|
@@ -379,11 +364,6 @@ export default {
|
|
|
executorList: [],
|
|
|
currentEquItemIndex: 0,
|
|
|
formLabel: '',
|
|
|
- planRuleTypeObj: {
|
|
|
- 1: 'PATROL',
|
|
|
- 2: 'MAINTAIN',
|
|
|
- 4: 'INVENTORY'
|
|
|
- },
|
|
|
treeData:[],
|
|
|
addForm: {
|
|
|
code:'', // 计划配置单号
|
|
|
@@ -413,7 +393,7 @@ export default {
|
|
|
equiLocation: '', // 设备位置
|
|
|
equiLocationCode: '', // 设备位置code
|
|
|
// 设备备品备件 - 巡点检不需要备品备件,保养需要
|
|
|
- partJson: [ ],
|
|
|
+ sparePart: [ ],
|
|
|
totalCost:0,
|
|
|
}
|
|
|
],
|
|
|
@@ -455,12 +435,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
- // ...mapGetters([
|
|
|
- // 'equipmentList',
|
|
|
- // // 'ruleNameList',
|
|
|
- // 'planRulesDetails',
|
|
|
- // 'addDialogLoading'
|
|
|
- // ])
|
|
|
+
|
|
|
},
|
|
|
watch: {
|
|
|
addPatrolConfigDialog (val) {
|
|
|
@@ -477,69 +452,19 @@ export default {
|
|
|
// 获取规则名称
|
|
|
this._getRuleNameList()
|
|
|
// 获取设备分类树
|
|
|
- this.getClassifyTree()
|
|
|
-
|
|
|
+ this.getClassifyTree()
|
|
|
}
|
|
|
},
|
|
|
- async planRulesDetails (val) {
|
|
|
- if (!this.addPatrolConfigDialog) return
|
|
|
- const tempPlanRuleEquiList = val.planRuleEquiList
|
|
|
- this.addForm = val
|
|
|
- delete this.addForm.createTime
|
|
|
- delete this.addForm.updateTime
|
|
|
- this.clickedTreeNode = true
|
|
|
- // 编辑弹窗需要重新获取规则下面的事项
|
|
|
- this._getMatterRulesDetails(val.ruleId)
|
|
|
- // 设备分类回显需要将id转成string
|
|
|
- this.addForm.categoryId = String(val.categoryId)
|
|
|
- // 根据部门回显人员
|
|
|
- const params = { deptCode: val.groupId, status: 1 }
|
|
|
- this.getUserList(params)
|
|
|
- // 回显设备事项
|
|
|
- await this._getEquipmentList(val.categoryId)
|
|
|
- const item = this.planRuleEquiList[0]
|
|
|
- console.log('item',item)
|
|
|
- // 默认选中列表第一条树节点
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs.equiListTree.setCurrentKey(item.id)
|
|
|
- })
|
|
|
- const { equiLocation, equiLocationCode } = this.getEquiLocation(item)
|
|
|
- this.equipmentInfo = {
|
|
|
- equiCode: item.code,
|
|
|
- equiName: item.name,
|
|
|
- equiModel: item.category.modelType,
|
|
|
- equiLocation: equiLocation,
|
|
|
- equiLocationCode: equiLocationCode
|
|
|
- }
|
|
|
- this.currentEquItemIndex = 0
|
|
|
- this.planRuleEquiList[0]['equiLocation'] = equiLocation
|
|
|
- this.planRuleEquiList[0]['equiLocationCode'] = equiLocationCode
|
|
|
- // 对比详情返回的数据和设备分类下面所有的设备列表,将itemJson同步过去
|
|
|
- // for (let i = 0; i < this.planRuleEquiList.length; i++) {
|
|
|
- // for (let j = 0; j < tempPlanRuleEquiList.length; j++) {
|
|
|
- // if (
|
|
|
- // this.planRuleEquiList[i].code ===
|
|
|
- // tempPlanRuleEquiList[j].equiCode
|
|
|
- // ) {
|
|
|
- // this.planRuleEquiList[i]['itemJson'] =
|
|
|
- // tempPlanRuleEquiList[j]['itemJson']
|
|
|
- // this.planRuleEquiList[i]['partJson'] =
|
|
|
- // tempPlanRuleEquiList[j]['partJson']
|
|
|
- // break
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- }
|
|
|
},
|
|
|
created(){
|
|
|
},
|
|
|
methods: {
|
|
|
- async init(row){
|
|
|
+ async init(row,tips){
|
|
|
if(row){
|
|
|
this.getInfo(row.id)
|
|
|
}else{
|
|
|
// 获取计划配置单号
|
|
|
- this.getOrderCode()
|
|
|
+ this.getOrderCode(tips)
|
|
|
this.planRuleEquiList = []
|
|
|
this.matterRulesList = []
|
|
|
}
|
|
|
@@ -547,7 +472,6 @@ export default {
|
|
|
|
|
|
async getInfo(id){
|
|
|
const res = await getInfoById(id)
|
|
|
- console.log('ree',res)
|
|
|
this.addForm = res
|
|
|
this.categoryEquipment(res.categoryLevelId)
|
|
|
const params = { groupId: res.groupId }
|
|
|
@@ -565,6 +489,7 @@ export default {
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs.equiListTree.setCheckedKeys(keys)
|
|
|
})
|
|
|
+ this.clickedTreeNode = true
|
|
|
},
|
|
|
|
|
|
|
|
|
@@ -590,12 +515,9 @@ export default {
|
|
|
status: 1, // 状态
|
|
|
remark: '', // 备注
|
|
|
urgent:'',
|
|
|
- bizType:0,
|
|
|
+ bizType:0
|
|
|
}
|
|
|
- this.equipmentList = []
|
|
|
- // deptData:[], //部门树
|
|
|
- // classifyTree:[], //设备分类树
|
|
|
-
|
|
|
+ this.equipmentList = []
|
|
|
},
|
|
|
// 设备分类选择
|
|
|
async handleEquipmentClassChange (item) {
|
|
|
@@ -628,11 +550,16 @@ export default {
|
|
|
this.currentEquItemIndex = 0
|
|
|
this.planRuleEquiList[0]['equiLocation'] = equiLocation
|
|
|
this.planRuleEquiList[0]['equiLocationCode'] = equiLocationCode
|
|
|
- // if(this.addForm.planRuleEquiList[this.currentEquItemIndex].partJson){
|
|
|
- // this.tableList = this.addForm.planRuleEquiList[this.currentEquItemIndex].partJson
|
|
|
- // }else{
|
|
|
- // this.tableList = []
|
|
|
- // }
|
|
|
+
|
|
|
+ // 对比详情返回的数据和设备分类下面所有的设备列表,将sparePart同步过去
|
|
|
+ for (let i = 0; i < this.planRuleEquiList.length; i++) {
|
|
|
+ for (let j = 0; j < this.addForm.deviceInfo.length; j++) {
|
|
|
+ if ( this.planRuleEquiList[i].code === this.addForm.deviceInfo[j].substanceCode ) {
|
|
|
+ this.planRuleEquiList[i]['sparePart'] = this.addForm.deviceInfo[j]['sparePart']
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
})
|
|
|
} catch (error) {
|
|
|
this.planRuleEquiList = []
|
|
|
@@ -697,9 +624,15 @@ export default {
|
|
|
},
|
|
|
|
|
|
// 获取计划配置单号
|
|
|
- async getOrderCode () {
|
|
|
- const data = await getCode('patrolconfig_code');
|
|
|
- this.$set(this.addForm, 'code', data);
|
|
|
+ async getOrderCode (tips) {
|
|
|
+ if(tips.includes('巡点检')){
|
|
|
+ const data = await getCode('patrolconfig_code');
|
|
|
+ this.$set(this.addForm, 'code', data);
|
|
|
+ }
|
|
|
+ if(tips.includes('保养')){
|
|
|
+ const code = await getCode('maintainconfig_code');
|
|
|
+ this.$set(this.addForm, 'code', code);
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
// 封装 - 获取设备位置名称和code方法
|
|
|
@@ -737,14 +670,12 @@ export default {
|
|
|
// 获取规则名列表
|
|
|
async _getRuleNameList () {
|
|
|
if(this.dialogTitle==='新增保养计划配置'||this.dialogTitle==='编辑保养计划配置'){
|
|
|
- // console.log('保养计划')
|
|
|
const res = await getRule({type:2,pageNum:1,size:-1})
|
|
|
if (res.list) {
|
|
|
this.ruleNameList = res.list || []
|
|
|
}
|
|
|
}
|
|
|
if (this.dialogTitle==='新增巡点检计划配置'||this.dialogTitle==='编辑巡点检计划配置'){
|
|
|
- console.log('巡点检计划')
|
|
|
const res = await getRule({type:1,pageNum:1,size:-1})
|
|
|
if (res.list) {
|
|
|
this.ruleNameList = res.list || []
|
|
|
@@ -761,80 +692,52 @@ export default {
|
|
|
this.matterRulesList = res.ruleItems
|
|
|
},
|
|
|
|
|
|
- // 从事项弹窗将数据丢到事项配置
|
|
|
- // ruleItemSelectionSubmit (list) {
|
|
|
- // if (
|
|
|
- // !this.planRuleEquiList[this.currentEquItemIndex]['itemJson']
|
|
|
- // ) {
|
|
|
- // this.planRuleEquiList[this.currentEquItemIndex]['itemJson'] = []
|
|
|
- // }
|
|
|
- // this.planRuleEquiList[this.currentEquItemIndex]['itemJson'] =
|
|
|
- // list.map(item => {
|
|
|
- // return {
|
|
|
- // id: item.id,
|
|
|
- // name: item.name,
|
|
|
- // content: item.content,
|
|
|
- // norm: item.norm
|
|
|
- // }
|
|
|
- // })
|
|
|
- // this.$forceUpdate()
|
|
|
- // },
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
// 添加备品备件
|
|
|
addSpareItems () {
|
|
|
if (!this.clickedTreeNode) {
|
|
|
return this.$message.warning('请选择设备分类!')
|
|
|
}
|
|
|
- if (!this.addForm.ruleId) {
|
|
|
- return this.$message.warning('请选择规则名称!')
|
|
|
- }
|
|
|
this.$refs.addSpareDialogRef.open()
|
|
|
- if (this.planRuleEquiList[this.currentEquItemIndex]['partJson']) {
|
|
|
- this.selectedSpare =
|
|
|
- this.planRuleEquiList[this.currentEquItemIndex]['partJson']
|
|
|
+ if (this.planRuleEquiList[this.currentEquItemIndex]['sparePart']) {
|
|
|
+ this.selectedSpare = this.planRuleEquiList[this.currentEquItemIndex]['sparePart']
|
|
|
} else {
|
|
|
this.selectedSpare = []
|
|
|
}
|
|
|
+ console.log('this.selectedSpare',this.selectedSpare)
|
|
|
},
|
|
|
|
|
|
// 从备品备件弹窗将数据丢到备品备件配置
|
|
|
spareItemSelectSubmit (list) {
|
|
|
- console.log('list',list)
|
|
|
- this.planRuleEquiList[this.currentEquItemIndex]['partJson'] = list.map(item => {
|
|
|
+ this.planRuleEquiList[this.currentEquItemIndex]['sparePart'] = list.map(item => {
|
|
|
return {
|
|
|
- name: item.informationName,
|
|
|
- model: item.modelType,
|
|
|
+ name: item.name,
|
|
|
+ model: item.category.modelType,
|
|
|
num: item.num,
|
|
|
- unit: item.univalenceUnit,
|
|
|
- amount: item.univalence,
|
|
|
- measuringUnit:item.measuringUnit,
|
|
|
- informationCode:item.informationCode
|
|
|
+ univalenceUnit: item.category.univalenceUnit,
|
|
|
+ univalence: item.category.univalence,
|
|
|
+ measuringUnit:item.category.measuringUnit,
|
|
|
+ code:item.code,
|
|
|
+ id:item.id
|
|
|
}
|
|
|
})
|
|
|
- // this.addForm.planRuleEquiList[this.currentEquItemIndex]['partJson'] = [
|
|
|
- // ...deepClone(list)
|
|
|
- // ]
|
|
|
- // this.tableList = this.addForm.planRuleEquiList[this.currentEquItemIndex]['partJson']
|
|
|
this.$forceUpdate()
|
|
|
},
|
|
|
|
|
|
// 删除备品备件
|
|
|
handleDeleteSpareItem (index) {
|
|
|
this.planRuleEquiList[this.currentEquItemIndex][
|
|
|
- 'partJson'
|
|
|
+ 'sparePart'
|
|
|
].splice(index, 1)
|
|
|
this.changeNum()
|
|
|
},
|
|
|
|
|
|
// 改变input数据重新计算总费用
|
|
|
changeNum(){
|
|
|
- let applayList = this.planRuleEquiList[this.currentEquItemIndex].partJson
|
|
|
+ let applayList = this.planRuleEquiList[this.currentEquItemIndex].sparePart
|
|
|
let total = 0
|
|
|
applayList.map(item=>{
|
|
|
if(item.hasOwnProperty('num')&&item.num!=''){
|
|
|
- switch (item.unit) {
|
|
|
+ switch (item.univalenceUnit) {
|
|
|
case 'wanyuan': {
|
|
|
item.chengs = 10000
|
|
|
break;
|
|
|
@@ -846,7 +749,7 @@ export default {
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
- total = total + item.num*item.amount*item.chengs
|
|
|
+ total = total + item.num*item.univalence*item.chengs
|
|
|
}
|
|
|
})
|
|
|
this.$set(this.planRuleEquiList[this.currentEquItemIndex],'totalCost',total)
|
|
|
@@ -858,48 +761,25 @@ export default {
|
|
|
if (valid) {
|
|
|
try {
|
|
|
const selectList = this.$refs.equiListTree.getCheckedNodes();
|
|
|
- // console.log('selectList',selectList)
|
|
|
this.addForm.deviceInfo = selectList.map(
|
|
|
item => {
|
|
|
const { equiLocation, equiLocationCode } = this.getEquiLocation(item)
|
|
|
return {
|
|
|
substanceName: item.name,
|
|
|
substanceId: item.id,
|
|
|
- sparePart: item.partJson?item.partJson:[],
|
|
|
+ sparePart: item.sparePart?item.sparePart:[],
|
|
|
substanceCode: item.code,
|
|
|
mode: item.category.modelType,
|
|
|
position: equiLocation
|
|
|
}
|
|
|
}
|
|
|
)
|
|
|
- // this.planRuleEquiList = this.planRuleEquiList.map(
|
|
|
- // item => {
|
|
|
- // return {
|
|
|
- // substanceName: item.name,
|
|
|
- // substanceId: item.id,
|
|
|
- // sparePart: item.partJson?item.partJson:[],
|
|
|
- // }
|
|
|
- // }
|
|
|
- // )
|
|
|
- // if (this.addForm.planRuleType instanceof Object) {
|
|
|
- // this.addForm.planRuleType =
|
|
|
- // this.planRuleTypeObj[this.addForm.planRuleType.code]
|
|
|
- // }
|
|
|
- // let arr = []
|
|
|
- // this.planRuleEquiList.map((item)=>{
|
|
|
- // if(item.partJson.length){
|
|
|
- // arr.push(item)
|
|
|
- // }
|
|
|
- // })
|
|
|
- // this.planRuleEquiList = arr
|
|
|
- // let newArr = JSON.parse(JSON.stringify(this.planRuleEquiList))
|
|
|
- // for (let i = 0; i < newArr.length; i++) {
|
|
|
- // for (let j = 0; j < newArr[i].partJson.length; j++) {
|
|
|
- // newArr[i].partJson[j].equipmentCode = newArr[i].equiCode
|
|
|
- // }
|
|
|
- // }
|
|
|
- // this.planRuleEquiList = newArr
|
|
|
this.addForm.executeId = this.addForm.executeIdList.join(',')
|
|
|
+ this.addForm.ruleType = this.dialogTitle.includes('巡点检')
|
|
|
+ ? 1
|
|
|
+ : this.dialogTitle.includes('保养')
|
|
|
+ ? 2
|
|
|
+ : 3
|
|
|
const res = await saveOrUpdate(this.addForm)
|
|
|
if (res) {
|
|
|
const type = this.dialogTitle.includes('新增') ? '新增' : '编辑'
|