Commit 111d7e1c by 无尘

fix: 修改禁用

parent ede5cb0b
......@@ -4,7 +4,7 @@
* @Author: 无尘
* @Date: 2019-12-05 09:56:10
* @LastEditors: 无尘
* @LastEditTime: 2020-10-22 17:07:44
* @LastEditTime: 2020-11-24 15:27:59
*/
/**
......@@ -123,3 +123,21 @@ export function emojiToStr(str) {
str = String(str).replace(/\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F]|[\uD800-\uDBFF]|[\uDC00-\uDFFF]|[^\u0020-\u007E\u00A0-\u00BE\u2E80-\uA4CF\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFFEF\u0080-\u009F\u2000-\u201f\u2026\u2022\u20ac\r\n]/g, '');
return unescape(escape(str).replace(/\%uD.{3}/g, ''));
}
/**
* @description: 判断是否禁用编辑(可编辑当月及未来的指标, 当月之前及当月月末三天不可编辑)
* @param {String} yearMonth
* @returns {Boolean}
* @author: 无尘
*/
export function checkDisEdit(yearMonth) {
const arr = yearMonth.split('-');
const monthDays = new Date(arr[0], arr[1], 0).getDate();
const editTime = new Date(yearMonth).getTime() + (monthDays - 3) * 24 * 60 * 60 * 1000;
const nowTime = new Date().getTime();
if (nowTime < editTime) {
return false; // 可编辑,不禁用
} else {
return true; // 禁用
}
}
......@@ -4,7 +4,7 @@
* @Author: 无尘
* @Date: 2020-11-08 10:27:21
* @LastEditors: 无尘
* @LastEditTime: 2020-11-24 09:18:42
* @LastEditTime: 2020-11-24 15:40:21
-->
<!--
<gic-select-group-mult
......@@ -27,8 +27,8 @@
<div class="select-tree-wrap m-t-10">
<!--:load="loadNode"-->
<el-tree :filter-node-method="filterNode" :data="groupData" check-strictly :default-checked-keys="checkedKeys" node-key="storeGroupId" ref="groupTree" show-checkbox default-expand-all :props="defaultProps" :expand-on-click-node="false" @check="checkGroup">
<span class="custom-tree-node" slot-scope="{ node, data }">
<span :class="['font-14 p-r-10 iconfont', data.isStore == 1 ? 'icondianpu-kuai' : 'iconqiye-tianchong', data.bindFlag == 1 ? 'color-2f54eb' : 'color-dedfe6']"></span><span class="font-14 color-606266">{{ node.label }}</span>
<span class="custom-tree-node" slot-scope="{ node }">
<span :class="['font-14 p-r-10 iconfont iconqiye-tianchong', 'color-dedfe6']"></span><span class="font-14 color-606266">{{ node.label }}</span>
</span>
</el-tree>
</div>
......
......@@ -4,7 +4,7 @@
* @Author: 无尘
* @Date: 2020-07-16 16:37:05
* @LastEditors: 无尘
* @LastEditTime: 2020-09-15 10:12:49
* @LastEditTime: 2020-11-24 15:27:25
*/
'use strict';
/**
......
......@@ -4,7 +4,7 @@
* @Author: 无尘
* @Date: 2020-11-12 10:47:17
* @LastEditors: 无尘
* @LastEditTime: 2020-11-24 14:34:13
* @LastEditTime: 2020-11-24 15:37:01
-->
<template>
<div class="common-app-right" style="padding: 20px 0;color: #303133">
......@@ -12,7 +12,7 @@
<el-form-item label="门店名称">{{ form.storeName || '--' }}</el-form-item>
<el-form-item v-if="!form.multOpt" label="指标额">
{{ parseFloat(form.performanceValue).toFixed(2) }}
<el-button type="text" @click="modMonthTarget">修改</el-button>
<el-button :disabled="disableSetting" type="text" @click="modMonthTarget">修改</el-button>
</el-form-item>
<el-form-item label="指标类型">{{ [ '业绩指标日权重', '业绩指标日指标' ][form.performanceSubType - 1] }}</el-form-item>
<el-form-item v-if="!form.multOpt" label="">
......@@ -27,7 +27,7 @@
<div class="target-title">
<span>{{ form.date[0] }}{{ form.date[1] }}</span>
<el-button type="text" @click="setDefault" v-if="form.flag == false && form.performanceSubType == 1">设置默认日权重</el-button>
<el-button v-if="form.flag == false && form.performanceSubType == 1" type="text" @click="setDefault" :disabled="disableSetting">设置默认日权重</el-button>
</div>
<div class="target-table">
......@@ -46,7 +46,7 @@
<li v-for="(item, i) in tableData" :key="i">
<div>{{ item.performanceDay }}</div>
<el-input-number v-model="item.performanceValue" :precision="2" :controls="false" :max="999999999" style="width: 80px;margin-left:40px;margin-top:5px"></el-input-number>
<el-input-number v-model="item.performanceValue" :disabled="disableSetting" :precision="2" :controls="false" :max="999999999" style="width: 80px;margin-left:40px;margin-top:5px"></el-input-number>
</li>
<!-- 补充空白 -->
......@@ -54,7 +54,7 @@
</ul>
</div>
<el-button type="primary" :loading="loading" :disabled="$route.query.performanceSubType == 2 && totalDayTarget != form.performanceValue" style="margin-left:20px" @click="confirm">保存</el-button>
<el-button type="primary" :loading="loading" :disabled="$route.query.performanceSubType == 2 && totalDayTarget != form.performanceValue || disableSetting" style="margin-left:20px" @click="confirm">保存</el-button>
<el-dialog
title="修改指标"
......@@ -95,6 +95,7 @@
<script>
// import errMsg from '@/common/js/error';
// import showMsg from '@/common/js/showmsg';
import { checkDisEdit } from '@/common/js/public';
import fetch from '@/api/target-manage-app.js';
const { changeStorePerformanceDay, getStorePerformanceDay, changeStorePerformanceMonth } = fetch;
export default {
......@@ -135,27 +136,32 @@ export default {
},
dialogVisible: false,
haoban: {},
disableSetting: false // 是否禁用设置(false:不禁用设置,true:禁用设置)
};
},
created() {
this.form = JSON.parse(JSON.stringify(this.$route.query));
const that = this;
that.form = JSON.parse(JSON.stringify(that.$route.query));
// 批量操作判断
if (!!this.$route.query.multOpt && this.$route.query.multOpt == 1) {
this.form.multOpt = 1;
if (!!that.$route.query.multOpt && that.$route.query.multOpt == 1) {
that.form.multOpt = 1;
}else {
this.form.multOpt = '';
that.form.multOpt = '';
}
// 禁用判断
that.disableSetting = checkDisEdit(that.$route.query.performanceYm);
const { staffName, staffId, wxEnterpriseId } = JSON.parse(localStorage.getItem('haoBanUser'));
this.haoban = { staffName, staffId, wxEnterpriseId };
that.haoban = { staffName, staffId, wxEnterpriseId };
let bread = [ { name: '指标管理', path: '/target-list' }, { name: '查看门店', path: '/target-store' }, { name: '完善日指标' } ];
// 修改面包屑
const { tab, applicationId, performanceYm } = this.$route.query;
this.form.date = performanceYm.split('-');
const { tab, applicationId, performanceYm } = that.$route.query;
that.form.date = performanceYm.split('-');
bread[0].path += `?applicationId=${applicationId}&tab=${tab}`;
bread[1].path += `?applicationId=${applicationId}&tab=${tab}&performanceYm=${performanceYm}`;
this.$emit('change-nav', bread);
this.init();
that.$emit('change-nav', bread);
that.init();
},
mounted() {
this.$emit('showTab', '/target-list');
......
......@@ -4,7 +4,7 @@
* @Author: 无尘
* @Date: 2020-11-12 10:48:40
* @LastEditors: 无尘
* @LastEditTime: 2020-11-23 18:15:41
* @LastEditTime: 2020-11-24 15:39:27
-->
<template>
<div class="common-app-right">
......@@ -30,7 +30,7 @@
<el-table-column label="月指标">
<template slot-scope="scope">
<div>
<el-input class="w-120 p-l-8" maxlength="50" v-model="scope.row.performanceValue" placeholder="请输入" @blur="value => inputPerformance(value, scope.$index, scope.row)">
<el-input class="w-120 p-l-8" maxlength="50" v-model="scope.row.performanceValue" placeholder="请输入" :disabled="disableSetting" @blur="value => inputPerformance(value, scope.$index, scope.row)">
<i slot="prefix" style="font-style: normal;position: absolute;top: 4px;left: 12px;"></i>
</el-input>
</div>
......@@ -59,7 +59,7 @@
</div>
</template>
<script>
import { _debounce } from '@/common/js/public';
import { _debounce, checkDisEdit } from '@/common/js/public';
import errMsg from '@/common/js/error';
import showMsg from '@/common/js/showmsg';
import fetch from '@/api/target-manage-app.js';
......@@ -88,7 +88,8 @@ export default {
settingAble: 1,
storePerformance: 0
},
equalFlag: false // 相等标志
equalFlag: false, // 相等标志
disableSetting: false // 是否禁用设置(false:不禁用设置,true:禁用设置)
};
},
mounted() {
......@@ -98,6 +99,8 @@ export default {
let bread = [ { name: '指标管理', path: `/target-list?tab=${tab}&applicationId=${applicationId}` }, { name: '查看门店', path: `/target-store?tab=${tab}&applicationId=${applicationId}&performanceYm=${performanceYm}` }, { name: '完善导购指标' } ];
// 修改面包屑
that.$emit('change-nav', bread);
// 禁用判断
that.disableSetting = checkDisEdit(performanceYm);
if (!!that.brandId) {
that.clerkObj.performanceYm = performanceYm;
that.clerkObj.storeInfoId = storeInfoId;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment