|
|
@@ -18,66 +18,91 @@
|
|
|
:rules="contentConfigFormRules"
|
|
|
>
|
|
|
<el-row>
|
|
|
- <el-col :span="7">
|
|
|
- <el-form-item label="规则编码" prop="name">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="规则编码" prop="ruleCode">
|
|
|
<el-input
|
|
|
- v-model="formData.code"
|
|
|
+ v-model="formData.ruleCode"
|
|
|
size="small"
|
|
|
:disabled="true"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="6">
|
|
|
- <el-form-item label="规则名称" prop="name">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="规则名称" prop="ruleName">
|
|
|
<el-input
|
|
|
- v-model="formData.name"
|
|
|
+ v-model="formData.ruleName"
|
|
|
placeholder="请输入"
|
|
|
size="small"
|
|
|
- :disabled="isBindPlan"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="6">
|
|
|
- <el-form-item label="预警类型" prop="ruleType">
|
|
|
- <DictSelection
|
|
|
- dictName="预警类型"
|
|
|
- clearable
|
|
|
- v-model="formData.ruleType"
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="预警对象" prop="ruleObjCode">
|
|
|
+ <el-select
|
|
|
+ v-model="formData.ruleObjCode"
|
|
|
+ size="small"
|
|
|
+ :disabled="isBindPlan == 'edit'"
|
|
|
+ style="width: 100%"
|
|
|
>
|
|
|
- </DictSelection>
|
|
|
+ <el-option
|
|
|
+ v-for="(value, key) in allRulesData"
|
|
|
+ :key="key"
|
|
|
+ :label="value"
|
|
|
+ :value="key"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="周期" prop="alertCycleValue">
|
|
|
+ <el-col :span="16">
|
|
|
+ <el-input-number
|
|
|
+ v-model="formData.alertCycleValue"
|
|
|
+ placeholder="请输入"
|
|
|
+ size="small"
|
|
|
+ :min="0"
|
|
|
+ :precision="1"
|
|
|
+ :controls="false"
|
|
|
+ style="width: 100%"
|
|
|
+ />
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-select v-model="formData.alertCycleUnit" size="small">
|
|
|
+ <el-option
|
|
|
+ v-for="(value, key) in cycleUnitOpt"
|
|
|
+ :key="key"
|
|
|
+ :label="value"
|
|
|
+ :value="key"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-col>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="5">
|
|
|
- <el-form-item label="状态" prop="status" label-width="70px">
|
|
|
- <el-switch
|
|
|
- v-model="formData.status"
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="状态" prop="enabled">
|
|
|
+ <el-select
|
|
|
+ v-model="formData.enabled"
|
|
|
+ size="small"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option label="生效" :value="1">生效</el-option>
|
|
|
+ <el-option label="失效" :value="0">失效</el-option>
|
|
|
+ </el-select>
|
|
|
+ <!-- <el-switch
|
|
|
+ v-model="formData.enabled"
|
|
|
active-text="生效"
|
|
|
inactive-text="失效"
|
|
|
:active-value="1"
|
|
|
:inactive-value="0"
|
|
|
>
|
|
|
- </el-switch>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
-
|
|
|
- <el-row>
|
|
|
- <el-col :span="24">
|
|
|
- <el-form-item label="周期" prop="cycleValue">
|
|
|
- <rule-cycle
|
|
|
- ref="cycleMultipleRef"
|
|
|
- :formData="formData"
|
|
|
- :pageType="pageType"
|
|
|
- :isBindPlan="isBindPlan"
|
|
|
- />
|
|
|
+ </el-switch> -->
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
|
|
|
<el-table
|
|
|
ref="multipleTable"
|
|
|
- v-if="formData.ruleType !== 4"
|
|
|
- :data="formData.ruleItems"
|
|
|
+ :data="formData.actionList"
|
|
|
tooltip-effect="dark"
|
|
|
style="width: 95%; margin: auto"
|
|
|
border
|
|
|
@@ -85,81 +110,63 @@
|
|
|
>
|
|
|
<el-table-column type="index" width="100" align="center">
|
|
|
<template slot="header">
|
|
|
- <el-button
|
|
|
- type="text"
|
|
|
- @click="addItem"
|
|
|
- icon="el-icon-plus"
|
|
|
- :disabled="isBindPlan"
|
|
|
+ <el-button type="text" @click="addItem" icon="el-icon-plus"
|
|
|
>新增</el-button
|
|
|
>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
-
|
|
|
- <el-table-column prop="minWarningValue" label="预警值" width="240">
|
|
|
- <template
|
|
|
- slot-scope="scope"
|
|
|
- style="display: flex; flex-direction: row"
|
|
|
- >
|
|
|
- <el-form-item
|
|
|
- style="width: 100px"
|
|
|
- :prop="'ruleItems.' + scope.$index + '.minWarningValue'"
|
|
|
- label-width="0"
|
|
|
- :rules="contentConfigFormRules.minWarningValue"
|
|
|
- >
|
|
|
- <span v-if="scope.row.readonly">{{
|
|
|
- scope.row.minWarningValue
|
|
|
- }}</span>
|
|
|
- <el-input
|
|
|
- v-if="!scope.row.readonly"
|
|
|
- size="small"
|
|
|
- placeholder="最小"
|
|
|
- v-model="scope.row.minWarningValue"
|
|
|
- :disabled="isBindPlan"
|
|
|
- ></el-input>
|
|
|
- </el-form-item>
|
|
|
- <span> - </span>
|
|
|
-
|
|
|
+ <el-table-column prop="targetAddressName" label="通知人" width="240">
|
|
|
+ <template slot-scope="scope">
|
|
|
<el-form-item
|
|
|
- style="width: 100px"
|
|
|
- :prop="'ruleItems.' + scope.$index + '.maxWarningValue'"
|
|
|
+ :prop="'actionList.' + scope.$index + '.targetAddressName'"
|
|
|
label-width="0"
|
|
|
- :rules="contentConfigFormRules.maxWarningValue"
|
|
|
+ :rules="contentConfigFormRules.targetAddressName"
|
|
|
>
|
|
|
- <span v-if="scope.row.readonly">{{
|
|
|
- scope.row.maxWarningValue
|
|
|
- }}</span>
|
|
|
<el-input
|
|
|
- v-if="!scope.row.readonly"
|
|
|
- size="small"
|
|
|
- placeholder="最大"
|
|
|
- v-model="scope.row.maxWarningValue"
|
|
|
- :disabled="isBindPlan"
|
|
|
+ v-model="scope.row.targetAddressName"
|
|
|
+ @focus="handleAddInfo(scope.row, scope.$index)"
|
|
|
></el-input>
|
|
|
+ <!-- <el-select
|
|
|
+ v-model="scope.row.manager"
|
|
|
+ placeholder="请选择"
|
|
|
+ style="width: 100%"
|
|
|
+ filterable
|
|
|
+ multiple
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in managerData"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select> -->
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
-
|
|
|
- <el-table-column prop="warningUnit" label="预警时间单位" width="120">
|
|
|
+ <el-table-column prop="actionType" label="操作类型" width="240">
|
|
|
<template slot-scope="scope">
|
|
|
<el-form-item
|
|
|
- :prop="'ruleItems.' + scope.$index + '.warningUnit'"
|
|
|
+ :prop="'actionList.' + scope.$index + '.actionType'"
|
|
|
label-width="0"
|
|
|
- :rules="contentConfigFormRules.warningUnit"
|
|
|
+ :rules="contentConfigFormRules.actionType"
|
|
|
>
|
|
|
- <DictSelection
|
|
|
- dictName="时间单位"
|
|
|
- v-model="scope.row.warningUnit"
|
|
|
- :disabled="isBindPlan"
|
|
|
- >
|
|
|
- </DictSelection>
|
|
|
+ <el-select size="small" v-model="scope.row.actionType">
|
|
|
+ <el-option
|
|
|
+ v-for="(value, key) in operationTypeData"
|
|
|
+ :key="key"
|
|
|
+ :label="value"
|
|
|
+ :value="key"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
- <el-table-column prop="urgent" label="紧急程度" width="120">
|
|
|
+ <!-- <el-table-column prop="urgent" label="紧急程度" width="120">
|
|
|
<template slot-scope="scope">
|
|
|
<el-form-item
|
|
|
- :prop="'ruleItems.' + scope.$index + '.urgent'"
|
|
|
+ :prop="'actionList.' + scope.$index + '.urgent'"
|
|
|
label-width="0"
|
|
|
:rules="contentConfigFormRules.urgent"
|
|
|
>
|
|
|
@@ -171,71 +178,46 @@
|
|
|
</DictSelection>
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <el-table-column prop="name" label="事项" width="300">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-form-item
|
|
|
- :prop="'ruleItems.' + scope.$index + '.name'"
|
|
|
- label-width="0"
|
|
|
- :rules="contentConfigFormRules.name"
|
|
|
- >
|
|
|
- <span v-if="scope.row.readonly">{{ scope.row.name }}</span>
|
|
|
- <el-input
|
|
|
- v-if="!scope.row.readonly"
|
|
|
- size="small"
|
|
|
- placeholder="请输入"
|
|
|
- v-model="scope.row.name"
|
|
|
- :disabled="isBindPlan"
|
|
|
- ></el-input>
|
|
|
- </el-form-item>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="content" label="内容" width="300">
|
|
|
+ </el-table-column> -->
|
|
|
+ <el-table-column
|
|
|
+ prop="alertMessageTempateCode"
|
|
|
+ label="模板编码"
|
|
|
+ width="240"
|
|
|
+ >
|
|
|
<template slot-scope="scope">
|
|
|
- <el-form-item
|
|
|
- :prop="'ruleItems.' + scope.$index + '.content'"
|
|
|
- label-width="0"
|
|
|
- :rules="contentConfigFormRules.content"
|
|
|
+ <el-select
|
|
|
+ placeholder="请选择"
|
|
|
+ v-model="scope.row.alertMessageTempateCode"
|
|
|
+ @change="changeTemplate(scope.row, scope.$index)"
|
|
|
>
|
|
|
- <span v-if="scope.row.readonly">{{ scope.row.content }}</span>
|
|
|
- <el-input
|
|
|
- v-if="!scope.row.readonly"
|
|
|
- size="small"
|
|
|
- placeholder="请输入"
|
|
|
- v-model="scope.row.content"
|
|
|
- :disabled="isBindPlan"
|
|
|
- ></el-input>
|
|
|
- </el-form-item>
|
|
|
+ <el-option
|
|
|
+ v-for="item in templateData"
|
|
|
+ :key="item.code"
|
|
|
+ :label="item.name + '-' + item.code"
|
|
|
+ :value="item.code"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
-
|
|
|
- <el-table-column prop="norm" label="标准">
|
|
|
+ <el-table-column prop="content" label="内容" width="240">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-form-item
|
|
|
- :prop="'ruleItems.' + scope.$index + '.norm'"
|
|
|
- label-width="0"
|
|
|
- :rules="contentConfigFormRules.norm"
|
|
|
- >
|
|
|
- <span v-if="scope.row.readonly">{{ scope.row.norm }}</span>
|
|
|
- <el-input
|
|
|
- v-if="!scope.row.readonly"
|
|
|
- size="small"
|
|
|
- placeholder="请输入"
|
|
|
- v-model="scope.row.norm"
|
|
|
- :disabled="isBindPlan"
|
|
|
- ></el-input>
|
|
|
- </el-form-item>
|
|
|
+ <el-input
|
|
|
+ type="textarea"
|
|
|
+ size="small"
|
|
|
+ placeholder="请输入"
|
|
|
+ v-model="scope.row.content"
|
|
|
+ disabled
|
|
|
+ ></el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
-
|
|
|
<el-table-column label="操作">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
|
type="text"
|
|
|
@click="delItem(scope.$index)"
|
|
|
size="small"
|
|
|
- :disabled="isBindPlan"
|
|
|
+ :disabled="isBindPlan == 'clone'"
|
|
|
>删除</el-button
|
|
|
>
|
|
|
</template>
|
|
|
@@ -247,30 +229,29 @@
|
|
|
<el-button type="primary" @click="dataKeep"> 保存 </el-button>
|
|
|
</template>
|
|
|
</ele-modal>
|
|
|
+ <select-person-dialog
|
|
|
+ ref="selectPersonDialogRef"
|
|
|
+ @changeParent="changeParent"
|
|
|
+ ></select-person-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
- import RuleCycle from './rule-cycle';
|
|
|
import { deepClone } from '@/utils/index';
|
|
|
import {
|
|
|
saveOrUpdate,
|
|
|
getCode,
|
|
|
- getDetail
|
|
|
+ getDetail,
|
|
|
+ listAllRulesObj,
|
|
|
+ listAllDateUnit,
|
|
|
+ listAllActionType
|
|
|
} from '@/api/ruleManagement/earlyWarning';
|
|
|
+ import { notifyTemplatePageAPI } from '@/api/notifyManage';
|
|
|
+ import { getUserPage } from '@/api/system/organization';
|
|
|
+ import selectPersonDialog from './user-select/user-select.vue';
|
|
|
|
|
|
export default {
|
|
|
- components: { RuleCycle },
|
|
|
+ components: { selectPersonDialog },
|
|
|
props: {
|
|
|
- pageType: {
|
|
|
- type: String,
|
|
|
- default: ''
|
|
|
- },
|
|
|
- infoData: {
|
|
|
- type: Object,
|
|
|
- default: () => {
|
|
|
- return {};
|
|
|
- }
|
|
|
- },
|
|
|
dialogTitle: {
|
|
|
type: String,
|
|
|
default: '新建规则'
|
|
|
@@ -283,78 +264,122 @@
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
|
- // 默认表单数据
|
|
|
- const defaultForm = {
|
|
|
- code: '',
|
|
|
- name: '',
|
|
|
- ruleType: '1',
|
|
|
- status: 1,
|
|
|
- warningValue: null,
|
|
|
- cycleValue: undefined,
|
|
|
- cycleType: 1,
|
|
|
- contentImage: {},
|
|
|
- ruleCycleList: [], // 规则周期日期值
|
|
|
- ruleItems: [
|
|
|
- {
|
|
|
- name: '', // 巡点检事项
|
|
|
- content: '', // 巡点检内容
|
|
|
- norm: '' // 巡点检标准
|
|
|
- }
|
|
|
- ]
|
|
|
- };
|
|
|
return {
|
|
|
addMatterDialog: false,
|
|
|
- cycleValue: '',
|
|
|
- uploadList: [],
|
|
|
- formData: {},
|
|
|
+ formData: {
|
|
|
+ ruleCode: '',
|
|
|
+ ruleName: '',
|
|
|
+ ruleObjCode: '',
|
|
|
+ alertCycleValue: '',
|
|
|
+ alertCycleUnit: '',
|
|
|
+ enabled: 1,
|
|
|
+ actionList: [
|
|
|
+ {
|
|
|
+ targetAddress: '',
|
|
|
+ targetAddressName: '',
|
|
|
+ actionType: '',
|
|
|
+ // urgent: '',
|
|
|
+ alertMessageTempateCode: '',
|
|
|
+ content: ''
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
contentConfigFormRules: {
|
|
|
- maxWarningValue: [
|
|
|
- { required: true, message: '请输入预警值', trigger: 'blur' }
|
|
|
- ],
|
|
|
- minWarningValue: [
|
|
|
- { required: true, message: '请输入预警值', trigger: 'blur' }
|
|
|
- ],
|
|
|
- warningUnit: [
|
|
|
- { required: true, message: '请输入预警时间单位', trigger: 'blur' }
|
|
|
- ],
|
|
|
- urgent: [
|
|
|
- { required: true, message: '请选择紧急程度', trigger: 'blur' }
|
|
|
+ targetAddressName: [
|
|
|
+ { required: true, message: '请选择通知人', trigger: 'blur' }
|
|
|
],
|
|
|
- name: [
|
|
|
- { required: true, message: '请输入规则名称', trigger: 'blur' }
|
|
|
+ actionType: [
|
|
|
+ { required: true, message: '请选择操作类型', trigger: 'blur' }
|
|
|
],
|
|
|
- ruleType: [
|
|
|
- { required: true, message: '请选择预警类型', trigger: 'change' }
|
|
|
- ],
|
|
|
-
|
|
|
- // contentImage: [
|
|
|
- // { required: false, message: '请上传图片', trigger: 'blur' }
|
|
|
+ // urgent: [
|
|
|
+ // { required: true, message: '请选择紧急程度', trigger: 'blur' }
|
|
|
// ],
|
|
|
- status: [{ required: true }],
|
|
|
- name: [
|
|
|
- { required: true, message: '请输入巡点检事项', trigger: 'blur' }
|
|
|
- ],
|
|
|
- content: [
|
|
|
- { required: true, message: '请输入巡点检内容', trigger: 'blur' }
|
|
|
- ],
|
|
|
- norm: [
|
|
|
- { required: true, message: '请输入巡点检标准', trigger: 'blur' }
|
|
|
+ alertMessageTempateCode: [
|
|
|
+ { required: true, message: '请选择模板编码', trigger: 'blur' }
|
|
|
]
|
|
|
},
|
|
|
- isBindPlan: false
|
|
|
+ isBindPlan: '',
|
|
|
+ managerData: [],
|
|
|
+ templateData: [],
|
|
|
+ allRulesData: {},
|
|
|
+ cycleUnitOpt: {},
|
|
|
+ operationTypeData: {}
|
|
|
};
|
|
|
},
|
|
|
watch: {},
|
|
|
+ created() {
|
|
|
+ this.gettemplateList();
|
|
|
+ this.getInfo();
|
|
|
+ },
|
|
|
+
|
|
|
methods: {
|
|
|
- openDialog(row, type) {
|
|
|
+ async getAllRulesObj() {
|
|
|
+ const res = await listAllRulesObj();
|
|
|
+ this.allRulesData = res;
|
|
|
+ },
|
|
|
+ async getAllDateUnit() {
|
|
|
+ const res = await listAllDateUnit();
|
|
|
+ this.cycleUnitOpt = res;
|
|
|
+ },
|
|
|
+ async getAllActionType() {
|
|
|
+ const res = await listAllActionType();
|
|
|
+ this.operationTypeData = res;
|
|
|
+ },
|
|
|
+ handleAddInfo(row, index) {
|
|
|
+ this.formData.actionList[index].targetAddress = '';
|
|
|
+ this.formData.actionList[index].targetAddressName = '';
|
|
|
+ this.$refs.selectPersonDialogRef.open(row, index);
|
|
|
+ },
|
|
|
+ changeParent(list, index) {
|
|
|
+ console.log(list, 'list', this.isBindPlan);
|
|
|
+ let ids = list
|
|
|
+ .map((item) => {
|
|
|
+ return item.id;
|
|
|
+ })
|
|
|
+ .join(',');
|
|
|
+ let names = list
|
|
|
+ .map((item) => {
|
|
|
+ return item.name;
|
|
|
+ })
|
|
|
+ .join(',');
|
|
|
+ this.formData.actionList[index].targetAddress = ids;
|
|
|
+ this.formData.actionList[index].targetAddressName = names;
|
|
|
+ },
|
|
|
+ changeTemplate(row, index) {
|
|
|
+ console.log(row, index);
|
|
|
+ this.formData.actionList[index].alertMessageTempateCode =
|
|
|
+ row.alertMessageTempateCode;
|
|
|
+ this.templateData.filter((item) => {
|
|
|
+ if (item.code == row.alertMessageTempateCode) {
|
|
|
+ this.formData.actionList[index].content = item.content;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ async gettemplateList() {
|
|
|
+ const res = await notifyTemplatePageAPI({
|
|
|
+ pageNum: 1,
|
|
|
+ size: 999
|
|
|
+ });
|
|
|
+ this.templateData = res?.list;
|
|
|
+ },
|
|
|
+ async getInfo() {
|
|
|
+ getUserPage({
|
|
|
+ size: 999
|
|
|
+ }).then((res) => {
|
|
|
+ this.managerData = res.list;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ async openDialog(row, type) {
|
|
|
this.addMatterDialog = true;
|
|
|
+ this.isBindPlan = type;
|
|
|
+
|
|
|
+ await this.getAllRulesObj();
|
|
|
+ await this.getAllDateUnit();
|
|
|
+ await this.getAllActionType();
|
|
|
if (type != 'add') {
|
|
|
this.getRuleInfo(row.id, type);
|
|
|
} else {
|
|
|
- this.formData = { ...this.defaultForm };
|
|
|
- this.$set(this.formData, 'status', 1);
|
|
|
- this.$set(this.formData, 'ruleType', '1');
|
|
|
- console.log('this.formData---------', this.formData);
|
|
|
+ this.$set(this.formData, 'enabled', 1);
|
|
|
this.$refs.contentConfigForm &&
|
|
|
this.$refs.contentConfigForm.resetFields();
|
|
|
}
|
|
|
@@ -365,17 +390,24 @@
|
|
|
|
|
|
async getRuleInfo(id, type) {
|
|
|
const data = await getDetail(id);
|
|
|
- this.formData = data;
|
|
|
- console.log(
|
|
|
- '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!',
|
|
|
- this.formData
|
|
|
- );
|
|
|
- this.formData.ruleType = JSON.stringify(this.formData.ruleType);
|
|
|
- this.$set(
|
|
|
- this.formData,
|
|
|
- 'urgent',
|
|
|
- JSON.stringify(this.formData.urgent)
|
|
|
- );
|
|
|
+ this.formData = deepClone(data);
|
|
|
+
|
|
|
+ if (data.actionList && data.actionList.length > 0) {
|
|
|
+ for (let i = 0; i < data.actionList.length; i++) {
|
|
|
+ const ele = data.actionList[i].alertMessageTempateCode;
|
|
|
+ const template = this.templateData.find(
|
|
|
+ (item) => item.code === ele
|
|
|
+ );
|
|
|
+ if (template) {
|
|
|
+ data.actionList[i].content = template.content + '';
|
|
|
+ }
|
|
|
+ data.actionList.map((item) => {
|
|
|
+ item.actionType = item.actionType + '';
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.formData.actionList = data.actionList;
|
|
|
+ }
|
|
|
+
|
|
|
if (type == 'clone') {
|
|
|
delete this.formData.id;
|
|
|
}
|
|
|
@@ -383,155 +415,48 @@
|
|
|
|
|
|
async getOrderCode() {
|
|
|
const data = await getCode('warn_rule_code');
|
|
|
- this.$set(this.formData, 'code', data);
|
|
|
+ this.$set(this.formData, 'ruleCode', data);
|
|
|
},
|
|
|
|
|
|
handleClose() {
|
|
|
+ this.formData = {};
|
|
|
+ this.formData.actionList = [];
|
|
|
this.addMatterDialog = false;
|
|
|
this.$emit('handleClose');
|
|
|
},
|
|
|
addItem() {
|
|
|
- if (this.formData.ruleItems) {
|
|
|
- this.formData.ruleItems.push({
|
|
|
- name: '', // 巡点检事项
|
|
|
- content: '', // 巡点检内容
|
|
|
- norm: '', // 巡点检标准
|
|
|
-
|
|
|
- readonly: false
|
|
|
+ if (this.formData.actionList) {
|
|
|
+ this.formData.actionList.push({
|
|
|
+ targetAddress: '',
|
|
|
+ actionType: '',
|
|
|
+ // urgent: '',
|
|
|
+ alertMessageTempateCode: '',
|
|
|
+ content: ''
|
|
|
});
|
|
|
} else {
|
|
|
let arr = [
|
|
|
{
|
|
|
- name: '', // 巡点检事项
|
|
|
- content: '', // 巡点检内容
|
|
|
- norm: '' // 巡点检标准
|
|
|
+ targetAddress: '',
|
|
|
+ actionType: '',
|
|
|
+ // urgent: '',
|
|
|
+ alertMessageTempateCode: '',
|
|
|
+ content: ''
|
|
|
}
|
|
|
];
|
|
|
- this.$set(this.formData, 'ruleItems', arr);
|
|
|
- // this.formData.ruleItems =
|
|
|
+ this.$set(this.formData, 'actionList', arr);
|
|
|
}
|
|
|
},
|
|
|
- saveItem(index, row) {
|
|
|
- this.$nextTick(() => {
|
|
|
- let flag = false;
|
|
|
- let name = row.name;
|
|
|
- let content = row.content;
|
|
|
- let norm = row.norm;
|
|
|
- flag = name && content && norm;
|
|
|
- this.$refs.contentConfigForm.validate((valid) => {
|
|
|
- if (valid || flag) {
|
|
|
- this.$set(this.formData.ruleItems[index], 'readonly', true);
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- },
|
|
|
- upload(data) {
|
|
|
- if (data && data[0]?.accessUrl) {
|
|
|
- this.formData.contentImage = data;
|
|
|
- } else {
|
|
|
- this.formData.contentImage = {};
|
|
|
- }
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs.contentConfigForm.validateField('contentImage');
|
|
|
- });
|
|
|
- console.log(this.formData.contentImage);
|
|
|
- },
|
|
|
- editItem(index) {
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$set(this.formData.ruleItems[index], 'readonly', false);
|
|
|
- });
|
|
|
- },
|
|
|
delItem(index) {
|
|
|
- this.formData.ruleItems.splice(index, 1);
|
|
|
+ this.formData.actionList.splice(index, 1);
|
|
|
},
|
|
|
|
|
|
// 保存
|
|
|
dataKeep() {
|
|
|
let form = deepClone(this.formData);
|
|
|
- console.log(this.$refs.cycleMultipleRef);
|
|
|
- form.cycle = this.$refs.cycleMultipleRef.ruleCycleList;
|
|
|
- console.log(form);
|
|
|
- switch (form.cycleType) {
|
|
|
- case 1:
|
|
|
- if (form.cycle[0].minute === '') {
|
|
|
- this.$message.warning('周期信息需补充完整!');
|
|
|
- return;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- if (form.cycle[0].hour === '' || form.cycle[0].minute === '') {
|
|
|
- this.$message.warning('周期信息需补充完整!');
|
|
|
- return;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 4:
|
|
|
- if (
|
|
|
- form.cycle[0].day === '' ||
|
|
|
- form.cycle[0].hour === '' ||
|
|
|
- form.cycle[0].minute === ''
|
|
|
- ) {
|
|
|
- this.$message.warning('周期信息需补充完整!');
|
|
|
- return;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 5:
|
|
|
- if (
|
|
|
- form.cycle[0].month === '' ||
|
|
|
- form.cycle[0].day === '' ||
|
|
|
- form.cycle[0].hour === '' ||
|
|
|
- form.cycle[0].minute === ''
|
|
|
- ) {
|
|
|
- this.$message.warning('周期信息需补充完整!');
|
|
|
- return;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 11:
|
|
|
- let flg = false;
|
|
|
- form.cycle.map((item, index) => {
|
|
|
- if (item.hour === '' || item.minute === '') {
|
|
|
- flg = true;
|
|
|
- }
|
|
|
- });
|
|
|
- if (flg) {
|
|
|
- this.$message.warning('周期信息需补充完整!');
|
|
|
- return;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 13:
|
|
|
- let flag = false;
|
|
|
- form.cycle.map((item, index) => {
|
|
|
- if (item.day === '' || item.hour === '') {
|
|
|
- flag = true;
|
|
|
- }
|
|
|
- });
|
|
|
- if (flag) {
|
|
|
- this.$message.warning('周期信息需补充完整!');
|
|
|
- return;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 14:
|
|
|
- let fla = false;
|
|
|
- form.cycle.map((item, index) => {
|
|
|
- if (item.month === '' || item.day === '' || item.hour === '') {
|
|
|
- fla = true;
|
|
|
- }
|
|
|
- });
|
|
|
- if (fla) {
|
|
|
- this.$message.warning('周期信息需补充完整!');
|
|
|
- return;
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- if (form.ruleItems && form.ruleItems.length > 0) {
|
|
|
+ console.log(form, 'form');
|
|
|
+ if (form.actionList && form.actionList.length > 0) {
|
|
|
this.$refs.contentConfigForm.validate(async (valid) => {
|
|
|
if (valid) {
|
|
|
- // let form = deepClone(this.formData)
|
|
|
- // form.ruleCycleList = this.$refs.cycleMultipleRef.ruleCycleList
|
|
|
- // form.ruleItems.forEach(item => {
|
|
|
- // if (item.ruleType) {
|
|
|
- // item.ruleType = this.ruleTypeObj[item.ruleType.code]
|
|
|
- // }
|
|
|
- // })
|
|
|
let res = await saveOrUpdate(form);
|
|
|
if (res) {
|
|
|
this.$message.success('操作成功!');
|
|
|
@@ -628,4 +553,7 @@
|
|
|
::v-deep .el-table .cell {
|
|
|
display: flex;
|
|
|
}
|
|
|
+ ::v-deep .el-input-number .el-input__inner {
|
|
|
+ text-align: left !important;
|
|
|
+ }
|
|
|
</style>
|