Selaa lähdekoodia

考核指标option的value类型

lucw 8 kuukautta sitten
vanhempi
commit
dbbb71370d

+ 182 - 180
src/views/targetManage/salesRegulation/components/addOrEditDialog.vue

@@ -182,216 +182,218 @@
       </el-row>
     </el-form>
     <div slot="footer">
-      <el-button type="primary" @click="handleSave(0)" v-click-once>保存</el-button>
+      <el-button type="primary" @click="handleSave(0)" v-click-once
+        >保存</el-button
+      >
       <el-button @click="cancel">返回</el-button>
     </div>
   </ele-modal>
 </template>
 <script>
-import { mapGetters } from 'vuex';
-import { targetDefinitionSave } from '@/api/targetManage/index.js';
-import {
-  salesRegulationOption,
-  assessmentIndicatorsOptions
-} from '@/views/targetManage/util.js';
+  import { mapGetters } from 'vuex';
+  import { targetDefinitionSave } from '@/api/targetManage/index.js';
+  import {
+    salesRegulationOption,
+    assessmentIndicatorsOptions
+  } from '@/views/targetManage/util.js';
 
-const defForm = {
-  name: '',
-  assessmentIndicators: '',
-  assessmentCriteria: [], //条件
-  status: '',
-  type: '',
-  describes: ''
-};
-export default {
-  components: {},
+  const defForm = {
+    name: '',
+    assessmentIndicators: '',
+    assessmentCriteria: [], //条件
+    status: '',
+    type: '',
+    describes: ''
+  };
+  export default {
+    components: {},
 
-  computed: {
-    ...mapGetters(['user'])
-  },
-  data() {
-    return {
-      addOrEditDialogFlag: false,
-      dialogType: '',
-      title: '',
-      form: {
-        ...defForm
-      },
-      tableList: [],
-      valueOptions: [],
-      operatorOptions: [
-        {
-          name: '属于',
-          value: '1'
+    computed: {
+      ...mapGetters(['user'])
+    },
+    data() {
+      return {
+        addOrEditDialogFlag: false,
+        dialogType: '',
+        title: '',
+        form: {
+          ...defForm
         },
-        {
-          name: '不属于',
-          value: '2'
+        tableList: [],
+        valueOptions: [],
+        operatorOptions: [
+          {
+            name: '属于',
+            value: '1'
+          },
+          {
+            name: '不属于',
+            value: '2'
+          }
+        ],
+        options: assessmentIndicatorsOptions,
+        rules: {
+          name: { required: true, message: '请输入', trigger: 'change' },
+          assessmentIndicators: {
+            required: true,
+            message: '请选择',
+            trigger: 'change'
+          }
         }
-      ],
-      options: assessmentIndicatorsOptions,
-      rules: {
-        name: { required: true, message: '请输入', trigger: 'change' },
-        assessmentIndicators: {
-          required: true,
-          message: '请选择',
-          trigger: 'change'
-        }
-      }
-    };
-  },
-  created() {},
-  methods: {
-    //初始化
-    async open(row = {}, type) {
-      this.addOrEditDialogFlag = true;
-      this.title = type == 'add' ? '新增' : '修改';
-      this.dialogType = type;
-      if (type !== 'add') {
-        this.form = JSON.parse(JSON.stringify(row));
-        this.tableList = this.form.assessmentCriteria;
-        const { valueOption } = salesRegulationOption(
-          this.form.assessmentIndicators
-        );
-        this.valueOptions = valueOption;
-      } else {
-        this.add();
-      }
-    },
-    addItem(item) {
-      item.push({
-        value: '',
-        operator: '1',
-        status: [],
-        statusOptions: []
-      });
-    },
-    delItem(item, i) {
-      item.splice(i, 1);
-    },
-    del(i) {
-      this.tableList.splice(i, 1);
+      };
     },
-
-    add() {
-      this.tableList.push([
-        {
+    created() {},
+    methods: {
+      //初始化
+      async open(row = {}, type) {
+        this.addOrEditDialogFlag = true;
+        this.title = type == 'add' ? '新增' : '修改';
+        this.dialogType = type;
+        if (type !== 'add') {
+          this.form = JSON.parse(JSON.stringify(row));
+          this.tableList = this.form.assessmentCriteria;
+          const { valueOption } = salesRegulationOption(
+            this.form.assessmentIndicators
+          );
+          this.valueOptions = valueOption;
+        } else {
+          this.add();
+        }
+      },
+      addItem(item) {
+        item.push({
           value: '',
           operator: '1',
           status: [],
           statusOptions: []
-        }
-      ]);
-    },
-
-    salesChange(val) {
-      const { valueOption, statusOption } = salesRegulationOption(val);
-      this.valueOptions = valueOption;
-      this.statusOptions = statusOption;
-      this.tableList.forEach((item) => {
-        item.forEach((_item) => {
-          _item.status = [];
-          _item.statusOptions = [];
-          _item.value = '';
         });
-      });
-    },
-    valChange(item, val) {
-      const { statusOption } = salesRegulationOption(
-        this.form.assessmentIndicators,
-        item.value
-      );
-      val.statusOptions = statusOption;
-      val.status = [];
-    },
-    //获取详情
-    async getFeeApplyInfoInfo(id) {
-      this.form = await getSettlementAccountInfoAPI(id);
-    },
-    handleSave(flag) {
-      this.$refs.form.validate(async (valid) => {
-        if (!valid) return this.$message.warning('有必填项未填,请检查');
-        let isTrue = true;
+      },
+      delItem(item, i) {
+        item.splice(i, 1);
+      },
+      del(i) {
+        this.tableList.splice(i, 1);
+      },
+
+      add() {
+        this.tableList.push([
+          {
+            value: '',
+            operator: '1',
+            status: [],
+            statusOptions: []
+          }
+        ]);
+      },
+
+      salesChange(val) {
+        const { valueOption, statusOption } = salesRegulationOption(val);
+        this.valueOptions = valueOption;
+        this.statusOptions = statusOption;
         this.tableList.forEach((item) => {
-          item.forEach((val) => {
-            if (!val.value || val.status.length == 0) {
-              isTrue = false;
-            }
+          item.forEach((_item) => {
+            _item.status = [];
+            _item.statusOptions = [];
+            _item.value = '';
           });
         });
-        if (!isTrue) {
-          return this.$message.warning('请完善考核指标限制条件');
-        }
-        this.form.assessmentCriteria = this.tableList;
-        const id = await targetDefinitionSave(this.form);
-        if (flag) {
-          await this.handleSub(id);
-        }
-        this.$message.success('操作成功');
-        this.done();
-        this.cancel();
-      });
-    },
+      },
+      valChange(item, val) {
+        const { statusOption } = salesRegulationOption(
+          this.form.assessmentIndicators,
+          item.value
+        );
+        val.statusOptions = statusOption;
+        val.status = [];
+      },
+      //获取详情
+      async getFeeApplyInfoInfo(id) {
+        this.form = await getSettlementAccountInfoAPI(id);
+      },
+      handleSave(flag) {
+        this.$refs.form.validate(async (valid) => {
+          if (!valid) return this.$message.warning('有必填项未填,请检查');
+          let isTrue = true;
+          this.tableList.forEach((item) => {
+            item.forEach((val) => {
+              if (!val.value || val.status.length == 0) {
+                isTrue = false;
+              }
+            });
+          });
+          if (!isTrue) {
+            return this.$message.warning('请完善考核指标限制条件');
+          }
+          this.form.assessmentCriteria = this.tableList;
+          const id = await targetDefinitionSave(this.form);
+          if (flag) {
+            await this.handleSub(id);
+          }
+          this.$message.success('操作成功');
+          this.done();
+          this.cancel();
+        });
+      },
 
-    //刷新主列表数据
-    done() {
-      this.$emit('reload');
-    },
-    //关闭弹窗
-    cancel() {
-      this.form = {
-        ...defForm
-      };
-      this.tableList = [];
-      this.addOrEditDialogFlag = false;
+      //刷新主列表数据
+      done() {
+        this.$emit('reload');
+      },
+      //关闭弹窗
+      cancel() {
+        this.form = {
+          ...defForm
+        };
+        this.tableList = [];
+        this.addOrEditDialogFlag = false;
+      }
     }
-  }
-};
+  };
 </script>
 <style scoped lang="scss">
-.itemDiv {
-  display: flex;
-  .left {
+  .itemDiv {
     display: flex;
-    align-items: center;
-    span {
-      height: 100%;
+    .left {
       display: flex;
       align-items: center;
+      span {
+        height: 100%;
+        display: flex;
+        align-items: center;
+      }
+      .leftLine {
+        height: calc(100% - 30px);
+        width: 1px;
+        background: #dddddd;
+        margin-left: 10px;
+      }
+      .rightLine {
+        display: flex;
+        flex-direction: column;
+        justify-content: space-between;
+        height: calc(100% - 30px);
+
+        i {
+          height: 1px;
+          width: 20px;
+          background: #dddddd;
+        }
+      }
     }
-    .leftLine {
-      height: calc(100% - 30px);
-      width: 1px;
-      background: #dddddd;
-      margin-left: 10px;
-    }
-    .rightLine {
+    .right {
       display: flex;
       flex-direction: column;
-      justify-content: space-between;
-      height: calc(100% - 30px);
-
+      width: calc(100% - 150px);
+    }
+    .rightItem {
+      height: 45px;
+      display: flex;
+      align-items: center;
       i {
-        height: 1px;
-        width: 20px;
-        background: #dddddd;
+        font-size: 28px;
+        color: #ddd;
+        cursor: pointer;
       }
     }
   }
-  .right {
-    display: flex;
-    flex-direction: column;
-    width: calc(100% - 150px);
-  }
-  .rightItem {
-    height: 45px;
-    display: flex;
-    align-items: center;
-    i {
-      font-size: 28px;
-      color: #ddd;
-      cursor: pointer;
-    }
-  }
-}
 </style>

+ 7 - 7
src/views/targetManage/util.js

@@ -203,31 +203,31 @@ export function salesRegulationOption(assessmentIndicators, value) {
 export const assessmentIndicatorsOptions = [
   {
     label: '回款额',
-    value: '1'
+    value: 1
   },
   {
     label: '合同额',
-    value: '2'
+    value: 2
   },
   {
     label: '客户数',
-    value: '3'
+    value: 3
   },
   {
     label: '拜访客户数',
-    value: '4'
+    value: 4
   },
   {
     label: '商机数',
-    value: '5'
+    value: 5
   },
   {
     label: '来司接待次数',
-    value: '6'
+    value: 6
   },
   {
     label: '发货额',
-    value: '7'
+    value: 7
   }
 ];
 

+ 2 - 2
vue.config.js

@@ -36,8 +36,8 @@ module.exports = {
     proxy: {
       // 当我们的本地的请求 有/api的时候,就会代理我们的请求地址向另外一个服务器发出请求
       '/api': {
-        // target: 'http://192.168.1.25:18086',//开发
-        target: 'http://192.168.1.251:18186', //测试
+        target: 'http://192.168.1.251:18086', //开发
+        // target: 'http://192.168.1.251:18186', //测试
         // target: 'http://192.168.1.23:18086',//罗
         // target: 'http://192.168.1.144:18086',//付