|
@@ -34,11 +34,15 @@
|
|
|
align="center"
|
|
|
prop="ruleContent"
|
|
|
/>
|
|
|
-<!-- <el-table-column
|
|
|
- label="单位"
|
|
|
+ <el-table-column
|
|
|
+ label="操作"
|
|
|
align="center"
|
|
|
prop="unit"
|
|
|
- />-->
|
|
|
+ >
|
|
|
+ <template v-slot="{ row}">
|
|
|
+ <el-button type="danger" @click="minusItem2(row)" icon="el-icon-minus" style="margin-left:15px;width:25px;height:25px;" circle />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
|
<!-- <pagination
|
|
|
v-if="total > 0"
|
|
@@ -123,8 +127,9 @@ defineOptions({
|
|
|
});
|
|
|
|
|
|
import {
|
|
|
- rulePage,aliasList,ruleAdd
|
|
|
+ rulePage,aliasList,ruleAdd,ruleRemove
|
|
|
} from "@/api/device/rule";
|
|
|
+import {deleteDict} from "@/api/system/dict";
|
|
|
const deviceInfo =(value)=>{
|
|
|
queryParams.deviceNo = value.deviceNo
|
|
|
queryParams.deviceType = value.deviceType
|
|
@@ -132,7 +137,6 @@ const deviceInfo =(value)=>{
|
|
|
queryAliasField(value.deviceType)
|
|
|
}
|
|
|
|
|
|
-const queryFormRef = ref(ElForm); // 查询表单
|
|
|
const ruleListRef = ref(ElTable);
|
|
|
const loading = ref(false); // 加载状态
|
|
|
const queryParams = reactive({
|
|
@@ -157,6 +161,18 @@ const change1 =(val0,item) =>{
|
|
|
const minusItem =(index)=>{
|
|
|
formDataList.value.splice(index,1)
|
|
|
}
|
|
|
+const minusItem2 = (row) =>{
|
|
|
+ ElMessageBox.confirm("确认删除已选中的数据项?", "警告", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ }).then(() => {
|
|
|
+ ruleRemove({id: row.id}).then(() => {
|
|
|
+ ElMessage.success("删除成功");
|
|
|
+ handleQuery();
|
|
|
+ });
|
|
|
+ });
|
|
|
+}
|
|
|
// 用户表单数据
|
|
|
const formData = reactive({
|
|
|
state: 0,
|
|
@@ -169,7 +185,7 @@ const queryAliasField = (deviceType)=>{
|
|
|
})
|
|
|
}
|
|
|
const fieldOptions = ref([])
|
|
|
-
|
|
|
+const clickId = ref([])
|
|
|
/** 查询 */
|
|
|
function handleQuery() {
|
|
|
loading.value = true;
|
|
@@ -192,9 +208,11 @@ function handleSelectionChange(selection: any) {
|
|
|
const preVal = selection.shift()
|
|
|
ruleListRef.value.toggleRowSelection(preVal, false);
|
|
|
}
|
|
|
+ clickId.value = null
|
|
|
if(selection.length === 0){
|
|
|
formDataList.value = []
|
|
|
}else{
|
|
|
+ clickId.value = selection[0].id
|
|
|
formDataList.value = JSON.parse(selection[0].ruleExpression)
|
|
|
}
|
|
|
}
|
|
@@ -236,7 +254,7 @@ const handleSubmit = useThrottleFn(() => {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
- const params = {field: field,label: label,deviceNo: queryParams.deviceNo,ruleContent: constStr,ruleExpression: JSON.stringify(formDataList.value)}
|
|
|
+ const params = {id: clickId.value,field: field,label: label,deviceNo: queryParams.deviceNo,ruleContent: constStr,ruleExpression: JSON.stringify(formDataList.value)}
|
|
|
ruleAdd(params).then((data)=>{
|
|
|
ElMessage.success(data.msg);
|
|
|
formDataList.value = []
|