peng
2026-03-24 e46f783a80c0111053b88e2814c78e1a8fc1290e
调整
3个文件已修改
199 ■■■■■ 已修改文件
src/views/dataAnalysis/CarInfoList.vue 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dataAnalysis/components/CustTypeConfig.vue 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dataAnalysis/components/CustTypeModal.vue 147 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dataAnalysis/CarInfoList.vue
@@ -44,12 +44,17 @@
          />
        </a-form-item>
        <a-form-item label="客户类型">
          <j-dict-select-tag
          <a-select
            style="width: 180px"
            v-model="queryParam.clientType"
            placeholder="请选择"
            dictCode="client_type"
          />
            allowClear
          >
            <a-select-option v-for="item in clientTypeOptions" :key="item.id" :value="item.id">
              {{ item.clientName }}
            </a-select-option>
          </a-select>
        </a-form-item>
          <!-- <a-select style="width: 180px" allowClear v-model="queryParam.clientType" placeholder="请选择客户类型">
            <a-select-option :value="1"> 普通客户 </a-select-option>
            <a-select-option :value="2"> 潜在客户 </a-select-option>
@@ -158,6 +163,7 @@
      description: 'CarInfo列表',
      queryParam: {},
      tagList: [], //所有标签集合
      clientTypeOptions: [], //客户类型列表
      // 表头
      columns: [
        {
@@ -244,6 +250,14 @@
  },
  methods: {
    // 获取客户类型列表
    getClientTypeOptions() {
      getAction('/jyz/client/listClientType').then((res) => {
        if (res.code === 200) {
          this.clientTypeOptions = res.result
        }
      })
    },
    delSlectTag(item) {
      console.log(item)
      let index = this.selectTagList.findIndex((el) => el == item)
@@ -321,10 +335,19 @@
      this.queryParam.orgCode = node.node.dataRef.orgCode
      this.loadData()
    },
    // 获取客户类型列表
    getClientTypeOptions() {
      getAction('/jyz/client/listClientType').then((res) => {
        if (res.code === 200) {
          this.clientTypeOptions = res.result
        }
      })
    },
  },
  created() {
    this.getTagInfo(true)
    this.getClientTypeOptions()
  },
}
</script>
src/views/dataAnalysis/components/CustTypeConfig.vue
@@ -46,6 +46,9 @@
<script>
import CustTypeModal from './CustTypeModal'
import { JeecgListMixin } from '@tievd/cube-block/lib/mixins/JeecgListMixin'
import { UI_CACHE_DB_DICT_DATA } from '@tievd/cube-block/lib/store/mutation-types'
import { deleteAction } from '@tievd/cube-block/lib/api/manage'
import Vue from 'vue'
export default {
  name: 'ActivityList',
@@ -123,6 +126,26 @@
  },
  methods: {
    modalFormOk() {
      // 添加/编辑成功后刷新页面以更新字典缓存
      window.location.reload()
    },
    handleDelete(id) {
      // 删除前清除前端字典缓存
      // 删除后刷新页面以更新字典缓存
      deleteAction(this.url.delete, { id: id })
        .then((res) => {
          if (res.success) {
            this.$message.success(res.message)
            window.location.reload()
          } else {
            this.$message.warning(res.message)
          }
        })
        .finally(() => {
          this.loading = false
        })
    },
    transformConfigText(obj) {
      var text = ''
      if (obj.timeStr == '1,YEARS') {
src/views/dataAnalysis/components/CustTypeModal.vue
@@ -44,6 +44,20 @@
              <a-select-option value="1,YEARS"> 近1年 </a-select-option>
            </a-select>
          </a-form-item>
          <!-- 规则类型选择:加油频次 OR 加油趋势 -->
          <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="规则类型">
            <a-select
              style="width: 300px"
              v-model="subItem.ruleType"
              placeholder="请选择"
              @change="ruleTypeChange($event, subIndex)"
            >
              <a-select-option :value="1"> 加油频次 </a-select-option>
              <a-select-option :value="2"> 加油趋势 </a-select-option>
            </a-select>
          </a-form-item>
          <!-- 加油频次配置(ruleType=1时显示) -->
          <div v-show="subItem.ruleType == 1">
          <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="加油频次">
            <a-select
              :disabled="subItem.timeStr == '7,DAYS' || subItem.timeStr == '30,DAYS'"
@@ -70,8 +84,60 @@
            </div>
          </a-form-item>
        </div>
          <!-- 加油趋势配置(ruleType=2时显示) -->
          <div v-show="subItem.ruleType == 2">
            <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="加油趋势">
              <a-select
                style="width: 300px"
                v-model="subItem.countTrend"
                placeholder="请选择"
              >
                <a-select-option :value="1"> 稳定 </a-select-option>
                <a-select-option :value="2"> 减少 </a-select-option>
              </a-select>
              <div v-if="subItem.countTrend == 1" style="color: #999; font-size: 12px; margin-top: 5px;">
                稳定:历史月加油次数≥次数 且 近期月加油次数≥次数
              </div>
              <div v-if="subItem.countTrend == 2" style="color: #999; font-size: 12px; margin-top: 5px;">
                减少:历史月加油次数≥次数 但 近期月加油次数<次数
              </div>
            </a-form-item>
            <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="历史月数">
              <a-select
                style="width: 140px"
                v-model="subItem.historyMonths"
                placeholder="历史月数"
              >
                <a-select-option :value="3"> 3个月 </a-select-option>
                <a-select-option :value="6"> 6个月 </a-select-option>
                <a-select-option :value="9"> 9个月 </a-select-option>
                <a-select-option :value="12"> 12个月 </a-select-option>
              </a-select>
            </a-form-item>
            <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="近期月数">
              <a-select
                style="width: 140px"
                v-model="subItem.recentMonths"
                placeholder="近期月数"
              >
                <a-select-option :value="1"> 1个月 </a-select-option>
                <a-select-option :value="2"> 2个月 </a-select-option>
                <a-select-option :value="3"> 3个月 </a-select-option>
              </a-select>
            </a-form-item>
            <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="固定加油次数">
              <a-input
                style="width: 150px"
                placeholder="每月固定次数"
                onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"
                onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'0')}else{this.value=this.value.replace(/\D/g,'')}"
                v-model="subItem.countNum"
              ></a-input>
            </a-form-item>
          </div>
        <div style="text-align: center">
          <a-button type="primary" @click="addConditions"> 增加条件 </a-button>
          </div>
        </div>
      </div>
    </a-spin>
@@ -119,6 +185,21 @@
  methods: {
    moment,
    buildCondition(condition = {}) {
      return Object.assign(
        {
          ruleType: 1,
          timeStr: '3,MONTHS',
          countType: 2,
          countRef: 1,
          countNum: 3,
          countTrend: null,
          historyMonths: null,
          recentMonths: null,
        },
        condition
      )
    },
    //删除条件
    delConditions(index) {
      console.log(index)
@@ -129,10 +210,46 @@
        this.clientConfigsList.clientConfigs[index].countType = 1
      }
    },
    trendChange(e, index) {
      // 选择趋势时,设置默认值
      if (e > 0) {
        this.clientConfigsList.clientConfigs[index].historyMonths = 3
        this.clientConfigsList.clientConfigs[index].recentMonths = 3
      } else {
        // 清除趋势配置
        this.clientConfigsList.clientConfigs[index].historyMonths = null
        this.clientConfigsList.clientConfigs[index].recentMonths = null
      }
    },
    ruleTypeChange(e, index) {
      let target = this.clientConfigsList.clientConfigs[index]
      // 切换规则类型时,清空对应的配置
      if (e == 1) {
        // 加油频次:清除趋势配置
        Object.assign(target, {
          ruleType: 1,
          countTrend: null,
          historyMonths: null,
          recentMonths: null,
          countType: target.countType || 2,
          countRef: target.countRef || 1,
        })
      } else if (e == 2) {
        // 加油趋势:清除频次配置,设置默认值
        Object.assign(target, {
          ruleType: 2,
          countType: null,
          countRef: null,
          countTrend: target.countTrend || 1,
          historyMonths: target.historyMonths || 3,
          recentMonths: target.recentMonths || 3,
        })
      }
    },
    //新增条件
    addConditions(index) {
      console.log(index)
      this.clientConfigsList.clientConfigs.push({})
      this.clientConfigsList.clientConfigs.push(this.buildCondition())
    },
    disabledDate(current) {
      // Can not select days before today and today
@@ -151,7 +268,7 @@
    add() {
      this.edit({
        clientName: '',
        clientConfigs: [{}],
        clientConfigs: [this.buildCondition()],
      })
    },
    edit(record) {
@@ -163,7 +280,11 @@
      // }
      this.visible = true
      this.model = Object.assign({}, record)
      this.clientConfigsList = record
      this.clientConfigsList = Object.assign({}, record, {
        clientConfigs: (record.clientConfigs || []).length
          ? record.clientConfigs.map((item) => this.buildCondition(item))
          : [this.buildCondition()],
      })
    },
    close() {
      this.$emit('close')
@@ -183,16 +304,20 @@
        if (JSON.stringify(el) == '{}') {
          isEmpty = true
        }
        for (let k in el) {
          if (el[k] == '' || el[k].length == '0') {
            isEmpty = true
          }
        }
        // 根据规则类型校验
        if (el.ruleType == 1) {
          // 加油频次:检查时间范围、次数类型、关系、次数
        if (!el.timeStr || !el.countRef || !el.countType || !el.countNum) {
          isEmpty = true
          if (el.countRef == 0 || el.countNum == 0) {
            isEmpty = false
          }
        } else if (el.ruleType == 2) {
          // 加油趋势:检查时间范围、趋势、历史月数、近期月数、次数
          if (!el.timeStr || !el.countTrend || !el.historyMonths || !el.recentMonths || !el.countNum) {
            isEmpty = true
          }
        } else {
          // 未选择规则类型
          isEmpty = true
        }
      })
      if (isEmpty) {
@@ -216,6 +341,8 @@
            }
            if (res.success) {
              this.$message.success(res.message)
              // 添加/编辑成功后刷新页面以更新字典缓存
              window.location.reload()
              this.$emit('ok')
            }
          } catch (err) {