|
|
@@ -51,7 +51,7 @@
|
|
|
:key="item.id"
|
|
|
:value="item.id"
|
|
|
:label="item.name"
|
|
|
- @click.native="addForm.ruleName = item.name"
|
|
|
+ @click.native="handleClickRule(item)"
|
|
|
></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
@@ -144,6 +144,7 @@
|
|
|
highlight-current
|
|
|
node-key="id"
|
|
|
@node-click="handleNodeClick"
|
|
|
+ @check="handleCheck"
|
|
|
show-checkbox
|
|
|
></el-tree>
|
|
|
</div>
|
|
|
@@ -306,6 +307,7 @@
|
|
|
import { deepClone } from '@/utils';
|
|
|
import { getById } from '@/api/maintenance/patrol_maintenance';
|
|
|
import { getList } from '@/api/classifyManage/itemInformation';
|
|
|
+ import { planConfigPage } from '@/api/ruleManagement/plan';
|
|
|
export default {
|
|
|
name: 'addPatrolPlanDialog',
|
|
|
components: {
|
|
|
@@ -319,6 +321,7 @@
|
|
|
props: {},
|
|
|
data() {
|
|
|
return {
|
|
|
+ planCheckNodes: [],
|
|
|
defaultProps: {
|
|
|
label: 'showName'
|
|
|
},
|
|
|
@@ -480,7 +483,12 @@
|
|
|
this.dialogTitle == '编辑保养计划'
|
|
|
) {
|
|
|
console.log('保养计划');
|
|
|
- const res = await getRule({ type: 2, pageNum: 1, size: -1 });
|
|
|
+ // const res = await getRule({ type: 2, pageNum: 1, size: -1 });
|
|
|
+ const res = await planConfigPage({
|
|
|
+ pageNum: 1,
|
|
|
+ size: -1,
|
|
|
+ ruleType: 2
|
|
|
+ });
|
|
|
this.ruleNameList = res.list || [];
|
|
|
}
|
|
|
},
|
|
|
@@ -588,6 +596,7 @@
|
|
|
console.log('1', params);
|
|
|
const res = await getAssetList(params);
|
|
|
this.addForm.categoryId = res.list[0]?.categoryId;
|
|
|
+ console.log('res====', res);
|
|
|
this.planDeviceList = res.list;
|
|
|
this.planDeviceList.map((item) => {
|
|
|
item.showName = item.name + '(' + item.code + ')';
|
|
|
@@ -677,6 +686,7 @@
|
|
|
equiLocation;
|
|
|
this.planDeviceList[this.currentEquItemIndex]['equiLocationCode'] =
|
|
|
equiLocationCode;
|
|
|
+ console.log(this.planDeviceList);
|
|
|
},
|
|
|
// 规则名称下拉触发
|
|
|
handleRuleNameChange(val) {
|
|
|
@@ -690,6 +700,7 @@
|
|
|
if (!this.planDeviceList[this.currentEquItemIndex]['workItems']) {
|
|
|
this.planDeviceList[this.currentEquItemIndex]['workItems'] = [];
|
|
|
}
|
|
|
+ console.log('===', this.currentEquItemIndex);
|
|
|
this.planDeviceList[this.currentEquItemIndex]['workItems'] = list.map(
|
|
|
(item) => {
|
|
|
return {
|
|
|
@@ -700,13 +711,13 @@
|
|
|
};
|
|
|
}
|
|
|
);
|
|
|
+ console.log('submit', this.planDeviceList);
|
|
|
this.$forceUpdate();
|
|
|
}
|
|
|
},
|
|
|
|
|
|
// 添加操作事项
|
|
|
addOperationItems() {
|
|
|
- console.log(this.clickedTreeNode);
|
|
|
if (!this.clickedTreeNode) {
|
|
|
return this.$message.warning('请选择设备分类!');
|
|
|
}
|
|
|
@@ -781,7 +792,10 @@
|
|
|
);
|
|
|
this.changeNum();
|
|
|
},
|
|
|
-
|
|
|
+ handleClickRule(item) {
|
|
|
+ this.addForm.ruleName = item.name;
|
|
|
+ this.addForm.planConfigId = item.id;
|
|
|
+ },
|
|
|
// 改变input数据重新计算总费用
|
|
|
changeNum() {
|
|
|
let applayList =
|
|
|
@@ -818,9 +832,16 @@
|
|
|
total
|
|
|
);
|
|
|
},
|
|
|
+ handleCheck(val, row) {
|
|
|
+ console.log(val);
|
|
|
+ console.log(row);
|
|
|
+ // this.planDeviceList = row.checkedNodes;
|
|
|
+ this.planCheckNodes = row.checkedNodes;
|
|
|
+ },
|
|
|
// 提交
|
|
|
submit() {
|
|
|
console.log(this.planDeviceList);
|
|
|
+ console.log('thi', this.planCheckNodes);
|
|
|
this.planDeviceList.forEach((item) => {
|
|
|
// 判断是否存在 workItems 属性,如果不存在则添加一个空数组
|
|
|
if (!item.workItems) {
|
|
|
@@ -832,6 +853,7 @@
|
|
|
item.workItems.push(/* 添加有数据的 workItems,可以根据需求添加具体的数据 */);
|
|
|
}
|
|
|
});
|
|
|
+ console.log('x修改', this.planDeviceList);
|
|
|
this.$refs.addFormRef.validate(async (valid) => {
|
|
|
if (valid) {
|
|
|
try {
|
|
|
@@ -842,9 +864,10 @@
|
|
|
return;
|
|
|
}
|
|
|
const planDeviceList = selectList.map((item) => {
|
|
|
- const obj = this.planDeviceList.find(
|
|
|
+ const obj = this.planCheckNodes.find(
|
|
|
(itm) => itm.id === item.id
|
|
|
);
|
|
|
+
|
|
|
console.log('obj.workItems:', obj);
|
|
|
if (!obj.workItems?.length) {
|
|
|
console.log(111);
|
|
|
@@ -898,6 +921,7 @@
|
|
|
: this.dialogTitle.includes('保养')
|
|
|
? 2
|
|
|
: 3;
|
|
|
+ console.log('params', params);
|
|
|
await saveOrUpdate(params);
|
|
|
const type = this.dialogTitle.includes('新增') ? '新增' : '编辑';
|
|
|
this.handleClose();
|