zhaoyun 6 maanden geleden
bovenliggende
commit
84d228f53f

+ 118 - 0
src/views/distributionnetwork/config/setting/deduct-points.vue

@@ -0,0 +1,118 @@
+<template>
+	<el-dialog :title="titleMap[mode]" :visible.sync="visible" width="500px" destroy-on-close @closed="$emit('closed')">
+		<el-form ref="dialogForm" :model="form"  :rules="rules" label-width="80px">
+				<el-form-item label="规则编码" prop="parCode">
+				  <el-input v-model="form.parCode" placeholder="请输入编码" />
+				</el-form-item>
+				<el-form-item label="扣分项目" prop="parName">
+				  <el-input v-model="form.parName" placeholder="请输入名称" />
+				</el-form-item>
+				  <el-form-item label="扣分" prop="parValue">
+				    <el-input-number
+				      v-model="form.parValue"
+				      controls-position="left"
+				      :min="0"
+				    />
+		        </el-form-item>
+				<el-form-item label="状态" prop="status" >
+					 <template>
+						<el-switch v-model="form.status"  active-value="1" inactive-value="0"></el-switch>
+					 </template>
+				</el-form-item>
+		        <el-form-item label="备注" prop="remark">
+		          <el-input  type="textarea" v-model="form.remark" placeholder="请输入备注" />
+		        </el-form-item>
+		      </el-form>
+		      <div slot="footer" class="dialog-footer">
+		        <el-button type="primary" @click="submit" :loading="isSaveing">确 定</el-button>
+		        <el-button  @click="visible=false" >取 消</el-button>
+		      </div>
+	</el-dialog>
+</template>
+
+<script>
+import { addPar, updatePar } from "@/api/powerdistribution/par";	 
+	export default {
+		emits: ['success', 'closed'],
+		data() {
+			return {
+				mode: "add",
+				titleMap: {
+					add: '新增配置',
+					edit: '编辑配置'
+				},
+				visible: false,
+				isSaveing: false,
+				form: {
+					id:'',
+					parCode:"",
+					parName: "",
+					parValue: "",
+					parUnit: "",
+					parType: "3",
+					remark: "",
+					parField: null,
+					status: ""
+				},
+				rules: {
+					parValue: [
+						{required: true, message: '请输入值'}
+					],
+					parUnit: [
+						{required: true, message: '请选择计量单位'}
+					],
+					parCode: [
+						{required: true, message: '请输入编码'}
+					],
+					parName: [
+						{required: true, message: '请输入名称'}
+					],
+				},
+			}
+		},
+		mounted() {
+		},
+		methods: {
+			//显示
+			open(mode='add'){
+				this.mode = mode;
+				this.visible = true;
+				return this;
+			},
+			//表单提交方法
+			submit(){
+				this.$refs.dialogForm.validate(async (valid) => {
+					if (valid) {
+						this.isSaveing = true;
+						var res
+						
+						if(this.mode=="add")
+						{
+							addPar(this.form).then(response => {
+						      this.$emit('success', this.form, this.mode)
+							  this.$message.success("操作成功")
+							  this.visible = false;
+							});
+						}else
+						{
+							updatePar(this.form).then(response => {
+							   this.$message.success("操作成功")
+							   this.$emit('success', this.form, this.mode)
+							   this.visible = false;
+							});
+						}
+						this.isSaveing = false;
+						
+					}
+				})
+			},
+			//表单注入数据
+			setData(data){
+				Object.assign(this.form, data)
+			}
+		}
+	}
+</script>
+
+<style>
+</style>

+ 65 - 18
src/views/distributionnetwork/config/setting/index.vue

@@ -198,7 +198,7 @@
                   <el-tag type="info" effect="dark" v-else>禁用</el-tag>
                 </template>
               </el-table-column>
-              <el-table-column label="备注" prop="remark"> </el-table-column>
+              <!--el-table-column label="备注" prop="remark"> </el-table-column-->
               <el-table-column
                 label="操作"
                 align="center"
@@ -224,11 +224,11 @@
               </el-table-column>
             </el-table>
           </el-card>
-          <el-card header="违章扣分规则设置">
+          <el-card header="扣分规则设置">
             <el-table
               ref="table3"
               :data="tableData4"
-              row-key="contractId"
+              row-key="id"
               stripe
               height="300px"
             >
@@ -237,18 +237,15 @@
               </el-table-column>
               <el-table-column
                 label="规则编号"
-                prop="contractCode"
-                :show-overflow-tooltip="true"
+                prop="parCode"
               ></el-table-column>
               <el-table-column
-                label="违章项目"
-                prop="title"
-                :show-overflow-tooltip="true"
+                label="扣分项目"
+                prop="parName"
               ></el-table-column>
               <el-table-column
                 label="扣分"
-                prop="customerName"
-                :show-overflow-tooltip="true"
+                prop="parValue"
               ></el-table-column>
               <el-table-column label="状态" prop="status">
                 <template slot-scope="scope">
@@ -265,7 +262,7 @@
                 label="操作"
                 align="center"
                 class-name="small-padding fixed-width"
-                :render-header="renderHeader2"
+                :render-header="renderHeader4"
               >
                 <template slot-scope="scope">
                   <el-button
@@ -273,7 +270,6 @@
                     type="text"
                     icon="el-icon-edit"
                     @click="handleUpdate(scope.row)"
-                    v-hasPermi="['powerdistribution:par:edit']"
                     >修改</el-button
                   >
                   <el-button
@@ -281,7 +277,6 @@
                     type="text"
                     icon="el-icon-delete"
                     @click="handleDelete(scope.row)"
-                    v-hasPermi="['powerdistribution:par:remove']"
                     >删除</el-button
                   >
                 </template>
@@ -303,6 +298,12 @@
       @success="handleDicSuccess"
       @closed="dialog.info = false"
     ></fault-free-duration-dic-dialog>
+	<deduct-points-dialog
+	  v-if="dialog.info"
+	  ref="deductPointsDialog"
+	  @success="handleDicSuccess"
+	  @closed="dialog.deduct = false"
+	></deduct-points-dialog>
   </div>
 </template>
 
@@ -315,12 +316,14 @@ import {
 } from "@/api/powerdistribution/par";
 import dicDialog from "./dic";
 import faultFreeDurationDicDialog from "./fault-free-duration-dic";
+import deductPointsDialog from "./deduct-points";
 export default {
   name: "Par",
   dicts: ["pdm_maintenance_time", "repeat_power_failure"],
   components: {
     dicDialog,
     faultFreeDurationDicDialog,
+	deductPointsDialog
   },
   data() {
     return {
@@ -362,6 +365,7 @@ export default {
       dialog: {
         dic: false,
         info: false,
+		deduct:false
       },
     };
   },
@@ -440,25 +444,45 @@ export default {
       });
     },
     /** 新增按钮操作 */
-    handleAddFaultFreeDuration() {
+    handleAddDeductPoints() {
       this.dialog.info = true;
       this.$nextTick(() => {
         this.form = {
           id: null,
           parCode: null,
-          parName: "无故障持续时间",
+          parName: null,
           parValue: null,
           parUnit: null,
-          parType: 2,
+          parType: 3,
           remark: null,
           createBy: null,
           createTime: null,
           updateBy: null,
           updateTime: null,
         };
-        this.$refs.faultFreeDurationDicDialog.open().setData(this.form);
+        this.$refs.deductPointsDialog.open().setData(this.form);
       });
     },
+	/** 新增按钮操作 */
+	handleAddFaultFreeDuration() {
+	  this.dialog.info = true;
+	  this.$nextTick(() => {
+	    this.form = {
+	      id: null,
+	      parCode: null,
+	      parName: "无故障持续时间",
+	      parValue: null,
+	      parUnit: null,
+	      parType: 2,
+	      remark: null,
+	      createBy: null,
+	      createTime: null,
+	      updateBy: null,
+	      updateTime: null,
+	    };
+	    this.$refs.faultFreeDurationDicDialog.open().setData(this.form);
+	  });
+	},
     /** 修改按钮操作 */
     handleUpdate(row) {
       this.reset();
@@ -471,7 +495,16 @@ export default {
               .open("edit")
               .setData(response.data);
           });
-        } else {
+        }
+		 else if (row.parType == 3) {
+		   this.dialog.deduct = true;
+		   this.$nextTick(() => {
+		     this.$refs.deductPointsDialog
+		       .open("edit")
+		       .setData(response.data);
+		   });
+		 }
+		 else {
           this.dialog.dic = true;
           this.$nextTick(() => {
             this.$refs.dicDialog.open("edit").setData(response.data);
@@ -580,6 +613,20 @@ export default {
         </div>
       );
     },
+	renderHeader4() {
+	  return (
+	    <div>
+	      <span>操作</span>
+	      <el-button
+	        type="primary"
+	        icon="el-icon-plus"
+	        class="table-icon"
+	        size="mini"
+	        onClick={() => this.handleAddDeductPoints()}
+	      ></el-button>
+	    </div>
+	  );
+	  },
     //本地更新数据
     async handleDicSuccess(data, mode) {
       this.getParList(data.parType);