Browse Source

Merge branch 'master' of http://106.55.241.82:3000/lzf/zhbsq-vue-web

Sanmu8 1 year ago
parent
commit
c8e70cfa91
2 changed files with 278 additions and 86 deletions
  1. 277 86
      src/views/norm/feeindex.vue
  2. 1 0
      src/views/norm/index.vue

+ 277 - 86
src/views/norm/feeindex.vue

@@ -1,64 +1,189 @@
 <template>
-  <el-dialog title="指标权重明细" :visible.sync="isShowNormDialog" :width="'80%'" :close-on-click-modal="false" :before-close="closeHandler">
+  <el-dialog
+    title="指标权重明细"
+    :visible.sync="isShowNormDialog"
+    :width="'80%'"
+    :close-on-click-modal="false"
+    :before-close="closeHandler"
+  >
     <div class="app-container" style="margin: 0px">
-      <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch">
+      <el-form
+        :model="queryParams"
+        ref="queryForm"
+        :inline="true"
+        v-show="showSearch"
+      >
         <el-form-item label="是否启用" prop="status">
-          <el-select v-model="queryParams.status" placeholder="请选择是否启用" clearable filterable>
-            <el-option v-for="(item, index) in 2" :key="index" :label="item == 1 ? '启用' : '不启用'" :value="item == 1 ? 1 : 0" />
+          <el-select
+            v-model="queryParams.status"
+            placeholder="请选择是否启用"
+            clearable
+            filterable
+          >
+            <el-option
+              v-for="(item, index) in 2"
+              :key="index"
+              :label="item == 1 ? '启用' : '不启用'"
+              :value="item == 1 ? 1 : 0"
+            />
           </el-select>
         </el-form-item>
         <el-form-item>
-          <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
+          <el-button type="primary" icon="el-icon-search" @click="handleQuery"
+            >搜索</el-button
+          >
           <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
         </el-form-item>
       </el-form>
       <el-row :gutter="10" class="mb8">
         <el-col :span="1.5">
-          <el-button type="primary" icon="el-icon-plus" @click="handleAdd" v-hasPermi="['business:NORMFEE:add']">新增</el-button>
+          <el-button
+            type="primary"
+            icon="el-icon-plus"
+            @click="handleAdd"
+            v-hasPermi="['business:NORMFEE:add']"
+            >新增</el-button
+          >
         </el-col>
         <el-col :span="1.5">
-          <el-button type="success" icon="el-icon-edit" :disabled="single" @click="handleUpdate" v-hasPermi="['business:NORMFEE:edit']">修改</el-button>
+          <el-button
+            type="success"
+            icon="el-icon-edit"
+            :disabled="single"
+            @click="handleUpdate"
+            v-hasPermi="['business:NORMFEE:edit']"
+            >修改</el-button
+          >
         </el-col>
         <el-col :span="1.5">
-          <el-button type="danger" icon="el-icon-delete" :disabled="multiple" @click="handleDelete" v-hasPermi="['business:NORMFEE:remove']">删除</el-button>
+          <el-button
+            type="danger"
+            icon="el-icon-delete"
+            :disabled="multiple"
+            @click="handleDelete"
+            v-hasPermi="['business:NORMFEE:remove']"
+            >删除</el-button
+          >
         </el-col>
-        <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+        <right-toolbar
+          :showSearch.sync="showSearch"
+          @queryTable="getList"
+        ></right-toolbar>
       </el-row>
 
-      <el-table  :data="normData" @selection-change="handleSelectionChange">
+      <el-table :data="normData" @selection-change="handleSelectionChange">
         <el-table-column type="selection" width="55" align="center" />
         <el-table-column label="分类占比" align="center" prop="normRatio" />
-        <el-table-column label="指标参数名称" align="center" prop="fname" width="150" />
-        <el-table-column label="计量单位" align="center" prop="funit_dictText" width="100" />
-        <el-table-column label="权数" align="center" prop="fnumber" width="90" />
-        <el-table-column label="绩效公差上下公差占比" align="center" prop="msRetio" width="130" />
-        <el-table-column label="采集公差上下公差占比" align="center" prop="dfRetio" width="130" />
-        <el-table-column label="采集参考值" align="center" prop="collValue" width="130" />
-        <el-table-column label="绩效参考值" align="center" prop="meritsValue" width="130" />
+        <el-table-column
+          label="指标参数名称"
+          align="center"
+          prop="fname"
+          width="150"
+        />
+        <el-table-column
+          label="计量单位"
+          align="center"
+          prop="funit_dictText"
+          width="100"
+        />
+        <el-table-column
+          label="权数"
+          align="center"
+          prop="fnumber"
+          width="90"
+        />
+        <el-table-column
+          label="绩效公差上下公差占比"
+          align="center"
+          prop="msRetio"
+          width="130"
+        />
+        <el-table-column
+          label="采集公差上下公差占比"
+          align="center"
+          prop="dfRetio"
+          width="130"
+        />
+        <el-table-column
+          label="采集参考值"
+          align="center"
+          prop="collValue"
+          width="130"
+        />
+        <el-table-column
+          label="绩效参考值"
+          align="center"
+          prop="meritsValue"
+          width="130"
+        />
 
-        <el-table-column label="是否启用" align="center" prop="status" width="100">
+        <el-table-column
+          label="是否启用"
+          align="center"
+          prop="status"
+          width="100"
+        >
           <template slot-scope="scope">
-            <el-switch v-model="scope.row.status" @change="changeSwitchHandler(scope.row)" active-color="#13ce66" inactive-color="#ff4949"></el-switch>
+            <el-switch
+              v-model="scope.row.status"
+              @change="changeSwitchHandler(scope.row)"
+              active-color="#13ce66"
+              inactive-color="#ff4949"
+            ></el-switch>
           </template>
         </el-table-column>
         <!-- <el-table-column label="启用时间" align="center" prop="startTime" />
         <el-table-column label="停用时间" align="center" prop="stopTime" /> -->
-        <el-table-column label="备注" align="center" prop="remark" width="150" />
+        <el-table-column
+          label="备注"
+          align="center"
+          prop="remark"
+          width="150"
+        />
         <el-table-column label="操作" align="center" fixed="right" width="150">
           <template slot-scope="scope">
-            <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['business:NORMFEE:edit']">修改</el-button>
-            <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['business:NORMFEE:remove']">删除</el-button>
+            <el-button
+              size="mini"
+              type="text"
+              icon="el-icon-edit"
+              @click="handleUpdate(scope.row)"
+              v-hasPermi="['business:NORMFEE:edit']"
+              >修改</el-button
+            >
+            <el-button
+              size="mini"
+              type="text"
+              icon="el-icon-delete"
+              @click="handleDelete(scope.row)"
+              v-hasPermi="['business:NORMFEE:remove']"
+              >删除</el-button
+            >
           </template>
         </el-table-column>
       </el-table>
 
-      <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
+      <pagination
+        v-show="total > 0"
+        :total="total"
+        :page.sync="queryParams.pageNum"
+        :limit.sync="queryParams.pageSize"
+        @pagination="getList"
+      />
 
       <!-- 添加或修改指标权重明细对话框 -->
-      <el-dialog :title="title" :visible.sync="open" width="600px" :close-on-click-modal="false" append-to-body>
+      <el-dialog
+        :title="title"
+        :visible.sync="open"
+        width="600px"
+        :close-on-click-modal="false"
+        append-to-body
+      >
         <el-form ref="form" :model="form" :rules="rules" label-width="170px">
           <el-form-item label="权数" prop="fnumber">
-            <el-input v-model="form.fnumber" aria-placeholder="请输入数值"></el-input>
+            <el-input
+              v-model="form.fnumber"
+              aria-placeholder="请输入数值"
+            ></el-input>
           </el-form-item>
 
           <el-form-item label="分类占比" prop="normRatio">
@@ -66,8 +191,18 @@
           </el-form-item>
 
           <el-form-item label="计量单位" prop="funit">
-            <el-select v-model="form.funit" @change="selUnitHandler" placeholder="请选择" style="width: 100%">
-              <el-option v-for="dict in unitSel" :key="dict.dictCode" :label="dict.dictLabel" :value="dict.dictValue"></el-option>
+            <el-select
+              v-model="form.funit"
+              @change="selUnitHandler"
+              placeholder="请选择"
+              style="width: 100%"
+            >
+              <el-option
+                v-for="dict in unitSel"
+                :key="dict.dictCode"
+                :label="dict.dictLabel"
+                :value="dict.dictValue"
+              ></el-option>
             </el-select>
           </el-form-item>
 
@@ -105,40 +240,46 @@
 </template>
 
 <script>
-import { listNORMFEE, getNORMFEE, delNORMFEE, addNORMFEE, updateNORMFEE } from '@/api/norm/NORMFEE';
+import {
+  listNORMFEE,
+  getNORMFEE,
+  delNORMFEE,
+  addNORMFEE,
+  updateNORMFEE,
+} from "@/api/norm/NORMFEE";
 
-import { listData } from '@/api/system/dict/data';
+import { listData } from "@/api/system/dict/data";
 
-import { formatDate } from '@/utils/index';
+import { formatDate } from "@/utils/index";
 
 export default {
-  name: 'NORMFEE',
+  name: "NORMFEE",
   props: {
     isShowNormDialog: {
       type: Boolean,
       default: () => {
         return false;
-      }
+      },
     },
     normId: {
       type: String,
       default: () => {
         return null;
-      }
+      },
     },
     normData: {
       type: Array,
       defaultL: () => {
         return [];
-      }
-    }
+      },
+    },
   },
   data() {
     return {
       dict: {
         type: {
-          dictType: ''
-        }
+          dictType: "",
+        },
       },
       // 根路径
       baseURL: process.env.VUE_APP_BASE_API,
@@ -156,14 +297,14 @@ export default {
       total: 0,
 
       // 弹出层标题
-      title: '',
+      title: "",
       // 是否显示弹出层
       open: false,
       // 查询参数
       queryParams: {
         pageNum: 1,
         pageSize: 10,
-        id: null
+        id: null,
         // createTime: null,
         // createBy: null,
         // updateTime: null,
@@ -185,17 +326,37 @@ export default {
       form: {},
       // 表单校验
       rules: {
-        fnumber: [{ required: true, message: '权数为数值', trigger: 'blur' }],
-        normRatio: [{ required: true, message: '分类占比不能为空', trigger: 'blur' }],
-        fname: [{ required: true, message: '指标参数名称不能为空', trigger: 'blur' }],
-        funit: [{ required: true, message: '计量单位不能为空', trigger: 'blur' }],
-        dfRetio: [{ required: true, message: '公差占比不能为空', trigger: 'blur' }],
-        type: [{ required: true, message: '明细类型不能为空', trigger: 'blur' }],
-        msRetio: [{ required: true, message: '绩效公差上下公差占比不能为空', trigger: 'blur' }],
-        collValue: [{ required: true, message: '采集参考值不能为空', trigger: 'blur' }],
-        meritsValue: [{ required: true, message: '绩效参考值不能为空', trigger: 'blur' }]
+        fnumber: [{ required: true, message: "权数为数值", trigger: "blur" }],
+        normRatio: [
+          { required: true, message: "分类占比不能为空", trigger: "blur" },
+        ],
+        fname: [
+          { required: true, message: "指标参数名称不能为空", trigger: "blur" },
+        ],
+        funit: [
+          { required: true, message: "计量单位不能为空", trigger: "blur" },
+        ],
+        dfRetio: [
+          { required: true, message: "公差占比不能为空", trigger: "blur" },
+        ],
+        type: [
+          { required: true, message: "明细类型不能为空", trigger: "blur" },
+        ],
+        msRetio: [
+          {
+            required: true,
+            message: "绩效公差上下公差占比不能为空",
+            trigger: "blur",
+          },
+        ],
+        collValue: [
+          { required: true, message: "采集参考值不能为空", trigger: "blur" },
+        ],
+        meritsValue: [
+          { required: true, message: "绩效参考值不能为空", trigger: "blur" },
+        ],
       },
-      unitSel: null
+      unitSel: null,
     };
   },
 
@@ -203,11 +364,10 @@ export default {
     listData({
       pageNum: 1,
       pageSize: 10,
-      dictType: 'norm_uint'
-    }).then(res => {
+      dictType: "norm_uint",
+    }).then((res) => {
       this.unitSel = res.rows;
       this.total = res.total;
-
     });
     this.getList();
   },
@@ -216,13 +376,13 @@ export default {
     getList() {
       this.loading = true;
       this.queryParams.normId = this.normId;
-      listNORMFEE(this.queryParams).then(response => {
+      listNORMFEE(this.queryParams).then((response) => {
         response.rows.forEach((item, index) => {
           response.rows[index].status = item.status == 0 ? false : true;
         });
         this.NORMFEEList = response.rows;
         this.loading = false;
-        this.$emit('dataHandler', response.rows);
+        this.$emit("dataHandler", response.rows);
       });
     },
     // 取消按钮
@@ -242,12 +402,12 @@ export default {
         funit: null,
         fnumber: null,
         fvalue: null,
-        status: '0',
+        status: "0",
         startTime: null,
         stopTime: null,
-        remark: null
+        remark: null,
       };
-      this.resetForm('form');
+      this.resetForm("form");
     },
     /** 搜索按钮操作 */
     handleQuery() {
@@ -256,12 +416,13 @@ export default {
     },
     /** 重置按钮操作 */
     resetQuery() {
-      this.resetForm('queryForm');
+      this.resetForm("queryForm");
       this.handleQuery();
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.id);
+      // this.form = selection[0];
+      this.ids = selection.map((item) => item.id);
       this.single = selection.length !== 1;
       this.multiple = !selection.length;
     },
@@ -269,46 +430,76 @@ export default {
     handleAdd() {
       this.open = true;
       this.reset();
-      this.title = '添加指标权重明细';
+      this.title = "添加指标权重明细";
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
       this.reset();
       const id = row.id || this.ids;
-      getNORMFEE(id).then(response => {
+      getNORMFEE(id).then((response) => {
         this.form = response.data;
         this.open = true;
-        this.form = row;
-        this.title = '修改指标权重明细';
+        // this.form = row;
+        this.title = "修改指标权重明细";
       });
     },
     /** 提交按钮 */
     submitForm() {
-      this.$refs['form'].validate(valid => {
+      this.$refs["form"].validate((valid) => {
         this.form.status = 1;
         if (valid) {
-          if (!(parseInt(this.form.fnumber) == this.form.fnumber || parseFloat(this.form.fnumber) == this.form.fnumber)) {
-            this.$message.error('权数必须为整数或小数');
+          if (
+            !(
+              parseInt(this.form.fnumber) == this.form.fnumber ||
+              parseFloat(this.form.fnumber) == this.form.fnumber
+            )
+          ) {
+            this.$message.error("权数必须为整数或小数");
             return;
           }
-          if (!(parseInt(this.form.normRatio) == this.form.normRatio || parseFloat(this.form.normRatio) == this.form.normRatio)) {
-            this.$message.error('分类占比必须为整数或小数');
+          if (
+            !(
+              parseInt(this.form.normRatio) == this.form.normRatio ||
+              parseFloat(this.form.normRatio) == this.form.normRatio
+            )
+          ) {
+            this.$message.error("分类占比必须为整数或小数");
             return;
           }
-          if (!(parseInt(this.form.meritsValue) == this.form.meritsValue || parseFloat(this.form.meritsValue) == this.form.meritsValue)) {
-            this.$message.error('绩效参考值必须为整数或小数');
+          if (
+            !(
+              parseInt(this.form.meritsValue) == this.form.meritsValue ||
+              parseFloat(this.form.meritsValue) == this.form.meritsValue
+            )
+          ) {
+            this.$message.error("绩效参考值必须为整数或小数");
             return;
           }
-          if (!(parseInt(this.form.collValue) == this.form.collValue || parseFloat(this.form.collValue) == this.form.collValue)) {
-            this.$message.error('采集参考值必须为整数或小数');
+          if (
+            !(
+              parseInt(this.form.collValue) == this.form.collValue ||
+              parseFloat(this.form.collValue) == this.form.collValue
+            )
+          ) {
+            this.$message.error("采集参考值必须为整数或小数");
             return;
           }
-          if (!(parseInt(this.form.dfRetio) == this.form.dfRetio || parseFloat(this.form.dfRetio) == this.form.dfRetio)) {
-            this.$message.error('采集公差上下公差占比必须为整数或小数');
+          if (
+            !(
+              parseInt(this.form.dfRetio) == this.form.dfRetio ||
+              parseFloat(this.form.dfRetio) == this.form.dfRetio
+            )
+          ) {
+            this.$message.error("采集公差上下公差占比必须为整数或小数");
             return;
           }
-          if (!(parseInt(this.form.msRetio) == this.form.msRetio || parseFloat(this.form.msRetio) == this.form.msRetio)) {
-            this.$message.error('绩效公差上下公差占比必须为整数或小数');
+          if (
+            !(
+              parseInt(this.form.msRetio) == this.form.msRetio ||
+              parseFloat(this.form.msRetio) == this.form.msRetio
+            )
+          ) {
+            this.$message.error("绩效公差上下公差占比必须为整数或小数");
             return;
           }
 
@@ -321,8 +512,8 @@ export default {
           //     this.getList();
           //   });
           // } else {
-          addNORMFEE(this.form).then(response => {
-            this.$modal.msgSuccess('新增成功');
+          updateNORMFEE(this.form).then((response) => {
+            this.$modal.msgSuccess("新增成功");
             this.open = false;
             this.getList();
           });
@@ -340,16 +531,16 @@ export default {
         })
         .then(() => {
           this.getList();
-          this.$modal.msgSuccess('删除成功');
+          this.$modal.msgSuccess("删除成功");
         })
         .catch(() => {});
     },
     /** 导出按钮操作 */
     handleExport() {
       this.download(
-        '/normFee/export',
+        "/normFee/export",
         {
-          ...this.queryParams
+          ...this.queryParams,
         },
         `NORMFEE_${new Date().getTime()}.xlsx`
       );
@@ -357,7 +548,7 @@ export default {
 
     // 关闭Dialog窗口
     closeHandler() {
-      this.$emit('closeHandler');
+      this.$emit("closeHandler");
     },
 
     // 选择单位处理
@@ -371,16 +562,16 @@ export default {
         updateNORMFEE({
           id,
           startTime: formatDate(new Date()),
-          status: 1
+          status: 1,
         });
       } else {
         updateNORMFEE({
           id,
           stopTime: formatDate(new Date()),
-          status: 0
+          status: 0,
         });
       }
-    }
-  }
+    },
+  },
 };
 </script>

+ 1 - 0
src/views/norm/index.vue

@@ -218,6 +218,7 @@ export default {
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
+      console.log(row);
       this.reset();
       const id = row.id || this.ids;
       getNORM(id).then(response => {