龚焕茏
2024-03-05 1c391db321fae77ddcd297e14fbe1429960ead49
src/views/ti/trafficIndex/index.vue
@@ -9,7 +9,7 @@
      <div class="search" v-show="showSearch">
        <el-form :model="queryParams" ref="queryFormRef" :inline="true" label-width="68px">
          <el-form-item label="统计周期" prop="periodDate">
            <el-input v-model="queryParams.periodValue" placeholder="请输入统计周期" clearable style="width: 240px" @keyup.enter="handleQuery" />
            <el-input v-model="queryParams.periodDate" placeholder="请输入统计周期" clearable style="width: 240px" @keyup.enter="handleQuery" />
          </el-form-item>
          <el-form-item label="状态" prop="status">
            <el-select v-model="queryParams.status" placeholder="请选择" clearable style="width: 240px" @keyup.enter="handleQuery" >
@@ -97,62 +97,87 @@
        <el-form-item label="模块名称" prop="modeName">
          <el-input v-model="form.modeName" placeholder="请输入模块名称" />
        </el-form-item>
        <el-form-item label="指标1名称" prop="targetOneName">
        <el-form-item label="统计周期" prop="periodDate" @change="clearPeriod">
          <el-select v-model="form.period" placeholder="请选择" style="width: 100px;">
            <el-option key="1" label="年度" :value="1" />
            <el-option key="2" label="月度" :value="2" />
          </el-select>
          &emsp;
          <el-date-picker v-model="form.periodDate" :type="pickerType" :value-format="pickerFormat" placeholder="请选择统计周期" />
        </el-form-item>
        <el-form-item label="指标1" prop="targetOneName">
          <el-input v-model="form.targetOneName" placeholder="请输入指标1名称" />
        </el-form-item>
        <el-form-item label="指标1值" prop="targetOneValue">
        <el-form-item label="数值" prop="targetOneValue">
          <el-input v-model="form.targetOneValue" placeholder="请输入指标1值" />
        </el-form-item>
        <el-form-item label="指标1单位" prop="targetOneUnit">
        <el-form-item label="单位" prop="targetOneUnit">
          <el-input v-model="form.targetOneUnit" placeholder="请输入指标1单位" />
        </el-form-item>
        <el-form-item label="指标1上浮或下降值" prop="targetOneCompareValue">
          <el-input v-model="form.targetOneCompareValue" placeholder="请输入指标1上浮或下降值" />
        <el-form-item label="涨幅" prop="targetOneCompareValue">
          <el-select v-model="form.targetOneStatus" placeholder="请选择" style="width: 100px;">
            <el-option key="1" label="上升" :value="1" />
            <el-option key="2" label="下降" :value="2" />
          </el-select>
          &emsp;
          <el-input v-model="form.targetOneCompareValue" placeholder="请输入指标1上浮或下降值" style="width: 200px;"/>
        </el-form-item>
        <el-form-item label="指标2名称" prop="targetTwoName">
        <el-form-item label="指标2" prop="targetTwoName">
          <el-input v-model="form.targetTwoName" placeholder="请输入指标2名称" />
        </el-form-item>
        <el-form-item label="指标2值" prop="targetTwoValue">
        <el-form-item label="数值" prop="targetTwoValue">
          <el-input v-model="form.targetTwoValue" placeholder="请输入指标2值" />
        </el-form-item>
        <el-form-item label="指标2单位" prop="targetTwoUnit">
        <el-form-item label="单位" prop="targetTwoUnit">
          <el-input v-model="form.targetTwoUnit" placeholder="请输入指标2单位" />
        </el-form-item>
        <el-form-item label="指标2上浮或下降值" prop="targetTwoCompareValue">
          <el-input v-model="form.targetTwoCompareValue" placeholder="请输入指标2上浮或下降值" />
        <el-form-item label="涨幅" prop="targetTwoCompareValue">
          <el-select v-model="form.targetTwoStatus" placeholder="请选择" style="width: 100px;">
            <el-option key="1" label="上升" :value="1" />
            <el-option key="2" label="下降" :value="2" />
          </el-select>
          &emsp;
          <el-input v-model="form.targetTwoCompareValue" placeholder="请输入指标2上浮或下降值" style="width: 200px;" />
        </el-form-item>
        <el-form-item label="指标3名称" prop="targetThreeName">
        <el-form-item label="指标3" prop="targetThreeName">
          <el-input v-model="form.targetThreeName" placeholder="请输入指标3名称" />
        </el-form-item>
        <el-form-item label="指标3值" prop="targetThreeValue">
        <el-form-item label="数值" prop="targetThreeValue">
          <el-input v-model="form.targetThreeValue" placeholder="请输入指标3值" />
        </el-form-item>
        <el-form-item label="指标3单位" prop="targetThreeUnit">
        <el-form-item label="单位" prop="targetThreeUnit">
          <el-input v-model="form.targetThreeUnit" placeholder="请输入指标3单位" />
        </el-form-item>
        <el-form-item label="指标3上浮或下降值" prop="targetThreeCompareValue">
          <el-input v-model="form.targetThreeCompareValue" placeholder="请输入指标3上浮或下降值" />
        <el-form-item label="涨幅" prop="targetThreeCompareValue">
          <el-select v-model="form.targetThreeStatus" placeholder="请选择" style="width: 100px;">
            <el-option key="1" label="上升" :value="1" />
            <el-option key="2" label="下降" :value="2" />
          </el-select>
          &emsp;
          <el-input v-model="form.targetThreeCompareValue" placeholder="请输入指标3上浮或下降值" style="width: 200px;" />
        </el-form-item>
        <el-form-item label="指标4名称" prop="targetFourName">
        <el-form-item label="指标4" prop="targetFourName">
          <el-input v-model="form.targetFourName" placeholder="请输入指标4名称" />
        </el-form-item>
        <el-form-item label="指标4值" prop="targetFourValue">
        <el-form-item label="数值" prop="targetFourValue">
          <el-input v-model="form.targetFourValue" placeholder="请输入指标4值" />
        </el-form-item>
        <el-form-item label="指标4单位" prop="targetFourUnit">
        <el-form-item label="单位" prop="targetFourUnit">
          <el-input v-model="form.targetFourUnit" placeholder="请输入指标4单位" />
        </el-form-item>
        <el-form-item label="指标4上浮或下降值" prop="targetFourCompareValue">
          <el-input v-model="form.targetFourCompareValue" placeholder="请输入指标4上浮或下降值" />
        <el-form-item label="涨幅" prop="targetFourCompareValue">
          <el-select v-model="form.targetFourStatus" placeholder="请选择" style="width: 100px;">
            <el-option key="1" label="上升" :value="1" />
            <el-option key="2" label="下降" :value="2" />
          </el-select>
          &emsp;
          <el-input v-model="form.targetFourCompareValue" placeholder="请输入指标4上浮或下降值" style="width: 200px;" />
        </el-form-item>
        <el-form-item label="周期 1 月  2年" prop="periodName">
          <el-input v-model="form.periodName" placeholder="请输入周期 1 月  2年" />
        </el-form-item>
        <el-form-item label="周期值" prop="periodValue">
          <el-input v-model="form.periodValue" placeholder="请输入周期值" />
        </el-form-item>
        <el-form-item label="0未删除   1已删除" prop="del">
          <el-input v-model="form.del" placeholder="请输入0未删除   1已删除" />
        <el-form-item label="状态" prop="status">
          <el-select v-model="form.status" placeholder="请选择">
            <el-option key="1" label="已启用" :value="1" />
            <el-option key="2" label="已禁用" :value="2" />
          </el-select>
        </el-form-item>
      </el-form>
      <template #footer>
@@ -196,29 +221,29 @@
const initFormData: TrafficIndexForm = {
  id: undefined,
  modeName: undefined,
  periodDate: undefined,
  period: 2,
  targetOneName: undefined,
  targetOneValue: undefined,
  targetOneUnit: undefined,
  targetOneStatus: undefined,
  targetOneStatus: 1,
  targetOneCompareValue: undefined,
  targetTwoName: undefined,
  targetTwoValue: undefined,
  targetTwoUnit: undefined,
  targetTwoStatus: undefined,
  targetTwoStatus: 1,
  targetTwoCompareValue: undefined,
  targetThreeName: undefined,
  targetThreeValue: undefined,
  targetThreeUnit: undefined,
  targetThreeStatus: undefined,
  targetThreeStatus: 1,
  targetThreeCompareValue: undefined,
  targetFourName: undefined,
  targetFourValue: undefined,
  targetFourUnit: undefined,
  targetFourStatus: undefined,
  targetFourStatus: 1,
  targetFourCompareValue: undefined,
  status: undefined,
  periodName: undefined,
  periodValue: undefined,
  status: 1,
  del: undefined
}
const data = reactive<PageData<TrafficIndexForm, TrafficIndexQuery>>({
@@ -248,8 +273,8 @@
    targetFourStatus: undefined,
    targetFourCompareValue: undefined,
    status: undefined,
    periodName: undefined,
    periodValue: undefined,
    period: undefined,
    periodDate: undefined,
    del: undefined,
    params: {
    }
@@ -324,10 +349,10 @@
    status: [
      { required: true, message: "启用状态 1启用 2未启用不能为空", trigger: "change" }
    ],
    periodName: [
    period: [
      { required: true, message: "周期 1 月  2年不能为空", trigger: "blur" }
    ],
    periodValue: [
    periodDate: [
      { required: true, message: "周期值不能为空", trigger: "blur" }
    ],
    del: [
@@ -416,6 +441,7 @@
/** 删除按钮操作 */
const handleDelete = async (row?: TrafficIndexVO) => {
  if(row?.status == 1) { proxy?.$modal.msgWarning("当前为已启用状态,不支持删除"); return; }
  const _ids = row?.id || ids.value;
  await proxy?.$modal.confirm('是否确认删除交通指数编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
  await delTrafficIndex(_ids);
@@ -430,21 +456,21 @@
  }, `trafficIndex_${new Date().getTime()}.xlsx`)
}
/** 周期年或月 */
const pickerType = computed(() => {
  return form.value.period === 1 ? 'year' : 'month';
});
const pickerFormat = computed(() => {
  return form.value.period === 1 ? 'YYYY' : 'YYYY-MM';
});
onMounted(() => {
  getList();
});
function handleRemove(file:string) {
        console.log(file);
      };
type files = {    //自定义类型
    url: string;
  };
function  handlePictureCardPreview(file:files) {
        dialogImageUrl.value = file.url;
        dialogVisible.value = true;
      };
function handleDownload(file:string) {
        console.log(file);
      };
/** 清空周期 */
const clearPeriod = () => {
  form.value.periodDate = undefined;
};
</script>