|
|
|
@ -42,12 +42,21 @@ |
|
|
|
}}</el-button> |
|
|
|
</el-col> |
|
|
|
<el-col :span="1.5"> |
|
|
|
<el-button type="primary" plain>{{ |
|
|
|
$t("area_management.RegionalDistribution") |
|
|
|
}}</el-button> |
|
|
|
<el-button |
|
|
|
type="primary" |
|
|
|
plain |
|
|
|
:disabled="ids.length <= 0" |
|
|
|
@click="issueFn" |
|
|
|
>{{ $t("area_management.RegionalDistribution") }}</el-button |
|
|
|
> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
<el-table :data="tableData" border style="width: 100%; margin-top: 10px"> |
|
|
|
<el-table |
|
|
|
:data="tableData" |
|
|
|
border |
|
|
|
style="width: 100%; margin-top: 10px" |
|
|
|
@selection-change="handleSelectionChange" |
|
|
|
> |
|
|
|
<el-table-column type="selection" width="55" align="center" /> |
|
|
|
<el-table-column |
|
|
|
:label="$t('area_management.index')" |
|
|
|
@ -90,7 +99,11 @@ |
|
|
|
<!-- {{ $t("area_management.loseEfficacy") }} --> |
|
|
|
{{ scope.row.enable == 1 ? "无效" : "有效" }} |
|
|
|
</el-button> |
|
|
|
<el-button type="text" icon="el-icon-delete" @click="handleDelete(scope.row.lineId)"> |
|
|
|
<el-button |
|
|
|
type="text" |
|
|
|
icon="el-icon-delete" |
|
|
|
@click="handleDelete(scope.row.lineId)" |
|
|
|
> |
|
|
|
{{ $t("share.delete") }}</el-button |
|
|
|
> |
|
|
|
</template> |
|
|
|
@ -111,32 +124,43 @@ |
|
|
|
<el-row :gutter="10"> |
|
|
|
<el-col :span="9"> |
|
|
|
<el-input></el-input> |
|
|
|
<!-- :data="treeData" |
|
|
|
:props="defaultProps" |
|
|
|
@check-change="handleCheckChange" |
|
|
|
:render-after-expand="false" |
|
|
|
show-checkbox --> |
|
|
|
<el-tree |
|
|
|
:props="defaultProps" |
|
|
|
:load="loadNode" |
|
|
|
lazy |
|
|
|
show-checkbox |
|
|
|
></el-tree> |
|
|
|
:data="treeData" |
|
|
|
node-key="id" |
|
|
|
:render-content="renderContent" |
|
|
|
@check-change="handleCheckChange" |
|
|
|
ref="tree" |
|
|
|
> |
|
|
|
</el-tree> |
|
|
|
</el-col> |
|
|
|
<el-col :span="15"> |
|
|
|
<el-form :model="dialogForm" label-width="160px"> |
|
|
|
<el-form-item :label="$t('area_management.type')"> |
|
|
|
<el-form |
|
|
|
:model="dialogForm" |
|
|
|
label-width="160px" |
|
|
|
:rules="rules" |
|
|
|
ref="form" |
|
|
|
> |
|
|
|
<el-form-item |
|
|
|
:label="$t('area_management.type')" |
|
|
|
prop="deviceLevel" |
|
|
|
> |
|
|
|
<el-select |
|
|
|
v-model="dialogForm.deviceLevel" |
|
|
|
:placeholder=" |
|
|
|
$t('share.PleaseChoose') + $t('area_management.type') |
|
|
|
" |
|
|
|
@change="deviceLevelChange" |
|
|
|
> |
|
|
|
<el-option label="item.label" value="item.value"> </el-option> |
|
|
|
<el-option label="区域" value="area"></el-option> |
|
|
|
<el-option label="主设备" value="main"></el-option> |
|
|
|
<el-option label="部件" value="part"></el-option> |
|
|
|
<el-option label="点位" value="point"></el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item |
|
|
|
:label="$t('area_management.MaintenanceAreaConfigurationCode')" |
|
|
|
prop="configCode" |
|
|
|
> |
|
|
|
<el-input |
|
|
|
v-model="dialogForm.configCode" |
|
|
|
@ -146,7 +170,10 @@ |
|
|
|
" |
|
|
|
></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item :label="$t('area_management.TimeAndDate')"> |
|
|
|
<el-form-item |
|
|
|
:label="$t('area_management.TimeAndDate')" |
|
|
|
prop="dateRange" |
|
|
|
> |
|
|
|
<el-date-picker |
|
|
|
v-model="dateRange" |
|
|
|
type="daterange" |
|
|
|
@ -162,7 +189,9 @@ |
|
|
|
<el-button type="primary" @click="submitForm">{{ |
|
|
|
$t("share.confirm") |
|
|
|
}}</el-button> |
|
|
|
<el-button>{{ $t("share.cancel") }}</el-button> |
|
|
|
<el-button @click="handleClose">{{ |
|
|
|
$t("share.cancel") |
|
|
|
}}</el-button> |
|
|
|
</div> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
@ -179,6 +208,7 @@ import { |
|
|
|
postRemove, |
|
|
|
postAdd, |
|
|
|
edit, |
|
|
|
issue, |
|
|
|
} from "@/api/area/area_management"; |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
@ -197,10 +227,37 @@ export default { |
|
|
|
label: "label", |
|
|
|
isLeaf: "leaf", // 标识节点是否为叶子节点 |
|
|
|
}, |
|
|
|
dialogForm: {}, |
|
|
|
dialogForm: { |
|
|
|
deviceLevel: "area", |
|
|
|
}, |
|
|
|
dateRange: [], |
|
|
|
ids: [], |
|
|
|
rules: { |
|
|
|
deviceLevel: [ |
|
|
|
{ |
|
|
|
required: true, |
|
|
|
message: "请选择设备类型", |
|
|
|
trigger: "change", |
|
|
|
}, |
|
|
|
], |
|
|
|
configCode: [ |
|
|
|
{ |
|
|
|
required: true, |
|
|
|
message: "请输入检修区域配置编码", |
|
|
|
trigger: "blur", |
|
|
|
}, |
|
|
|
], |
|
|
|
// dateRange: [ |
|
|
|
// { |
|
|
|
// required: true, |
|
|
|
// message: "请选择时间", |
|
|
|
// trigger: "change", |
|
|
|
// }, |
|
|
|
// ], |
|
|
|
}, |
|
|
|
}; |
|
|
|
}, |
|
|
|
|
|
|
|
created() { |
|
|
|
this.init(); |
|
|
|
this.initTree(); |
|
|
|
@ -210,6 +267,21 @@ export default { |
|
|
|
submitForm() { |
|
|
|
this.dialogForm.startTime = this.dateRange[0]; |
|
|
|
this.dialogForm.endTime = this.dateRange[1]; |
|
|
|
this.$refs["form"].validate((valid) => { |
|
|
|
if (valid) { |
|
|
|
// return |
|
|
|
postAdd(this.dialogForm).then((res) => { |
|
|
|
if (res.code == 200) { |
|
|
|
this.dialogVisible = false; |
|
|
|
this.$message({ |
|
|
|
message: `新增成功`, |
|
|
|
type: "success", |
|
|
|
}); |
|
|
|
this.init(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
// 初始化 |
|
|
|
init() { |
|
|
|
@ -251,39 +323,11 @@ export default { |
|
|
|
}, |
|
|
|
handleClose() { |
|
|
|
this.dialogVisible = false; |
|
|
|
this.dialogForm.deviceLevel = "area"; |
|
|
|
this.$refs.form.resetFields(); |
|
|
|
}, |
|
|
|
// flattenTree(tree) { |
|
|
|
// return tree.reduce((acc, node) => { |
|
|
|
// acc.push(node); |
|
|
|
// if (node.children && node.children.length) { |
|
|
|
// acc.push(...this.flattenTree(node.children)); |
|
|
|
// } |
|
|
|
// return acc; |
|
|
|
// }, []); |
|
|
|
// }, |
|
|
|
// 树结构点击 |
|
|
|
handleCheckChange(data, checked, indeterminate) { |
|
|
|
console.log(data, checked, indeterminate); |
|
|
|
}, |
|
|
|
loadNode(node, resolve) { |
|
|
|
console.log(node); |
|
|
|
if (node.level === 0) { |
|
|
|
setTimeout(() => { |
|
|
|
resolve(this.treeData); |
|
|
|
}, 50); |
|
|
|
} else if (!node.data.children) { |
|
|
|
setTimeout(() => { |
|
|
|
resolve([]); |
|
|
|
}, 50); |
|
|
|
} else if (node.data.children) { |
|
|
|
setTimeout(() => { |
|
|
|
resolve(node.data.children); |
|
|
|
console.log(node.data.children); |
|
|
|
}, 50); |
|
|
|
} |
|
|
|
}, |
|
|
|
// 修改 |
|
|
|
|
|
|
|
// 修改 |
|
|
|
handleEdit(row) { |
|
|
|
// lineId |
|
|
|
let data = { |
|
|
|
@ -321,6 +365,62 @@ export default { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
// 树结构多选框处理 |
|
|
|
renderContent(h, { node, data, store }) { |
|
|
|
const showCheckbox = data.type == this.dialogForm.deviceLevel; |
|
|
|
return h("span", [ |
|
|
|
showCheckbox |
|
|
|
? h("el-checkbox", { |
|
|
|
style: { marginRight: "8px" }, |
|
|
|
on: { |
|
|
|
change: (checked) => { |
|
|
|
store.setChecked(node, checked, false); |
|
|
|
}, |
|
|
|
}, |
|
|
|
}) |
|
|
|
: null, |
|
|
|
h("span", node.label), |
|
|
|
]); |
|
|
|
}, |
|
|
|
handleCheckChange(data, checked, indeterminate) { |
|
|
|
this.dialogForm.deviceList = null; |
|
|
|
this.dialogForm.pointList = null; |
|
|
|
let deviceList = []; |
|
|
|
let pointList = []; |
|
|
|
let allCheckedNodes = this.$refs.tree.getCheckedNodes(); |
|
|
|
|
|
|
|
allCheckedNodes.forEach((item) => { |
|
|
|
deviceList.push(item.id); |
|
|
|
if (item.children && item.children.length > 0) { |
|
|
|
item.children.forEach((child) => { |
|
|
|
pointList.push(child.id); |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
this.dialogForm.deviceList = deviceList.toString(); |
|
|
|
this.dialogForm.pointList = pointList.toString(); |
|
|
|
console.log(this.dialogForm); |
|
|
|
// console.log(this.dialogForm, allCheckedNodes); |
|
|
|
}, |
|
|
|
deviceLevelChange() { |
|
|
|
this.dialogForm.deviceList = null; |
|
|
|
this.dialogForm.pointList = null; |
|
|
|
}, |
|
|
|
// 多选框选中数据 |
|
|
|
handleSelectionChange(selection) { |
|
|
|
this.ids = selection.map((item) => item.lineId); |
|
|
|
}, |
|
|
|
issueFn() { |
|
|
|
issue(this.ids.toString()).then((res) => { |
|
|
|
if (res.code == 200) { |
|
|
|
this.$message({ |
|
|
|
message: `下发成功`, |
|
|
|
type: "success", |
|
|
|
}); |
|
|
|
this.init(); |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
</script> |
|
|
|
|