-
-
-
+ handleChange(v,'protectionPlan',index)"
+ >
(item.point = ""));
- this.protectionPlan.forEach((item) => (item.point = ""));
+ // 获取设备类别-不区分站点
+ getDeviceCategoryList() {
+ this.loading += 1;
+ getAllDeviceCategory()
+ .then((response) => {
+ const data = (response?.data || []).filter(item => ['PCS','STACK'].includes(item.code));
+ this.childOptions=[]
+ data.forEach((item) => {
+ this.childOptions.push({
+ value: item.code,
+ label: item.name,
+ children:[]
+ })
+ })
+ console.log('获取设备类型',data,this.childOptions)
+ })
+ .finally(() => {
+ this.loading -= 1;
+ });
},
+ //获取设备列表-区分站点
+ getDeviceList(deviceCategory){
+ this.$nextTick(()=>{
+ getDeviceListBySiteAndCategory({siteId:this.formData.siteId,deviceCategory}).then((response) => {
+ const data = response?.data || []
+ console.log('设置设备列表',this.childOptions)
+ this.childOptions.find(item=>item.value === deviceCategory).children=data.map(item => {
+ return {
+ label: item.deviceName,
+ value: item.id,
+ }
+ })
+ })
+ })
+ },
+ //更新站点下面的设备列表
+ updateSiteDeviceList(){
+ this.childOptions.forEach(item => {
+ item.children = []
+ })
+ this.getDeviceList('PCS')
+ this.getDeviceList('STACK')
+ },
+ //选中设备类型、设备
+ handleChange([deviceCategory,deviceId],type,index){
+ this[type][index].deviceId = deviceId;
+ this[type][index].deviceCategory = deviceCategory;
+ this[type][index].categoryName = this.childOptions.find(i=>i.value === deviceCategory).label;
+ console.log('设置选中设备类型、设备',this[type][index])
+ },
+
//获取站点列表
getZdList() {
this.loading += 1;
@@ -451,17 +508,29 @@ export default {
this.loading -= 1;
});
},
- // 获取设备类别
- getDeviceCategoryList() {
- this.loading += 1;
- getAllDeviceCategory()
- .then((response) => {
- this.deviceCategoryList = response?.data || [];
- })
- .finally(() => {
- this.loading -= 1;
- });
+ // 切换站点
+ // 重新获取设备列表
+ // 清空选中的设备、点位信息
+ changeType() {
+ //获取当前站点下的pcs和bms
+ this.updateSiteDeviceList()
+ this.protectionSettings.forEach((item) => {
+ item.point = ""
+ item.pointName = ""
+ item.deviceId=''
+ item.categoryName=''
+ item.deviceCategory=''
+ });
+ this.protectionPlan.forEach((item) => {
+ item.point = ""
+ item.pointName = ""
+ item.deviceId=''
+ item.categoryName=''
+ item.deviceCategory=''
+ });
},
+
+
saveDialog() {
this.$refs.addTempForm.validate((valid) => {
if (!valid) return;
@@ -535,6 +604,9 @@ export default {
faultDelaySeconds: "", //故障延时
releaseDelaySeconds: "", //释放延时
};
+ for(let key in this.formData) {
+ this.formData[key] = key === 'isAlert' ? 0 : key === 'faultLevel' ? 1 : ''
+ }
this.$refs.addTempForm.resetFields();
this.dialogTableVisible = false;
},