Эх сурвалжийг харах

【年度销售目标填报】UI与数据结构优化

002390 1 жил өмнө
parent
commit
88c498287e

+ 1234 - 0
src/views/business/spd/target/AnnualSaleGoal copy.vue

@@ -0,0 +1,1234 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" size="mini" :inline="true" label-width="100px">
+      <el-row :gutter="20">
+        <el-col :span="6">``
+          <el-form-item label="编码" prop="code">
+            <el-input v-model="queryParams.code" placeholder="请输入编码" clearable @keyup.enter.native="handleQuery" />
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="目标名称" prop="goalName">
+            <el-input v-model="queryParams.goalName" placeholder="请输入年度销售目标名称" clearable
+              @keyup.enter.native="handleQuery" />
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="单据日期" prop="documentDate">
+            <el-date-picker v-model="queryParams.documentDateRange" type="daterange" value-format="yyyy-MM-dd"
+              align="right" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" placeholder="请选择单据日期"
+              :picker-options="pickerOptions">
+            </el-date-picker>
+          </el-form-item>
+        </el-col>
+        <el-col :span="4">
+          <el-form-item>
+            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+            <el-tooltip class="item" effect="dark" :content="showSearch?'隐藏搜索':'显示搜索'" placement="top">
+              <el-button type="warning" :icon="showSearch?'el-icon-caret-top':'el-icon-caret-bottom'" circle
+                @click="showSearch = !showSearch"></el-button>
+            </el-tooltip>
+          </el-form-item>
+        </el-col>
+      </el-row>
+
+    </el-form>
+    <el-form :model="queryParams" ref="queryForm" size="mini" :inline="true" v-show="showSearch" label-width="100px">
+      <el-row :gutter="20">
+        <el-col :span="6">
+          <el-form-item label="年度" prop="annual">
+            <el-date-picker v-model="queryParams.annual" type="year" value-format="yyyy" placeholder="选择年度" clearable
+              @keyup.enter.native="handleQuery">
+            </el-date-picker>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="客户" prop="custom">
+            <el-popover-select-v2 v-model="queryParams.custom" title="客户" valueKey="name" referName="CUSTOMER_PARAM"
+              :dataMapping="{ customCode: 'code', custom: 'name'}" :source.sync="queryParams" placeholder="请输入客户"
+              @keyup.enter.native="handleQuery">
+            </el-popover-select-v2>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="销售区域" prop="saleZone">
+            <el-popover-select-v2 v-model="queryParams.saleZone" title="销售区域" valueKey="name"
+              referName="MK_SALESAREA_PARAM" :dataMapping="{ saleZoneCode: 'code', saleZone: 'name'}"
+              :source.sync="queryParams" placeholder="请输入销售区域" @keyup.enter.native="handleQuery">
+            </el-popover-select-v2>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="制单人" prop="creator">
+            <el-popover-select-v2 v-model="queryParams.creator" title="制单人" valueKey="name" referName="CONTACTS_PARAM"
+              :dataMapping="{ creatorCode: 'code', creator: 'name'}" :source.sync="queryParams" placeholder="请输入制单人"
+              @keyup.enter.native="handleQuery">
+            </el-popover-select-v2>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row :gutter="20">
+        <el-col :span="6">
+          <el-form-item label="部门" prop="dept">
+            <el-popover-select-v2 v-model="queryParams.dept" title="部门" valueKey="name" referName="DEPT_PARAM"
+              :dataMapping="{ deptId: 'id', dept: 'name'}" :source.sync="queryParams" placeholder="请输入部门"
+              @keyup.enter.native="handleQuery">
+            </el-popover-select-v2>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="单据状态" prop="status">
+            <el-select size="mini" v-model="queryParams.status" clearable>
+              <el-option v-for="dict in dict.type.sys_status" :key="dict.value" :label="dict.label" :value="dict.value">
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8" style="float: right">
+      <el-col :span="1.5">
+        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增
+        </el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-dropdown @command="handleCommand">
+          <el-button type="warning" plain icon="el-icon-download" size="mini">
+            导出<i class="el-icon-arrow-down el-icon--right"></i>
+          </el-button>
+          <el-dropdown-menu slot="dropdown">
+            <el-dropdown-item command="export">导出</el-dropdown-item>
+            <el-dropdown-item command="exportDetails">导出明细</el-dropdown-item>
+          </el-dropdown-menu>
+        </el-dropdown>
+      </el-col>
+    </el-row>
+
+    <el-table v-loading="loading" :data="annualSaleGoalList" @selection-change="handleSelectionChange"
+      @row-dblclick="useDoubleClick" v-horizontal-scroll max-height="560">
+      <el-table-column label="编码" align="center" prop="code" width="180" />
+      <el-table-column label="目标名称" align="center" prop="goalName" width="240" />
+      <el-table-column label="单据日期" align="center" prop="documentDate" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.documentDate, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="年度" align="center" prop="annual" width="100" />
+      <el-table-column label="客户" align="center" prop="custom" width="180" />
+      <el-table-column label="销售区域" align="center" prop="saleZone" width="180" />
+      <el-table-column label="制单人" align="center" prop="creator" width="180" />
+      <el-table-column label="部门" align="center" prop="dept" width="180" />
+      <el-table-column label="目标合计(元)" align="center" prop="goalTotal" width="180" />
+      <el-table-column label="备注" align="center" prop="notes" width="180" />
+      <el-table-column show-overflow-tooltip label="状态" align="center" width="100" prop="status">
+        <template slot-scope="scope">
+          <dict-tag :options="dict.type.sys_status" :value="scope.row.status" />
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" class-name="small-padding" width="180" fixed="right">
+        <template slot-scope="scope">
+          <el-button size="mini" type="text" @click="useDoubleClick(scope.row)">查看
+          </el-button>
+          <el-button v-if="scope.row.status == '0' || scope.row.status == '3'" size="mini" type="text"
+            @click="handleUpdate(scope.row)">修改
+          </el-button>
+          <el-button v-if="scope.row.status == '0' || scope.row.status == '3'" size="mini" type="text"
+            @click="handleDelete(scope.row)">删除
+          </el-button>
+          <el-button v-if="scope.row.status == '0' || scope.row.status == '3'" size="mini" type="text"
+            @click="handleSubmit(scope.row)">提交
+          </el-button>
+          <el-button v-if="scope.row.status == '1'" size="mini" type="text" @click="handleReback(scope.row)">收回
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
+      :page-sizes="[10, 20, 50, 100]" @pagination="getList" />
+
+    <el-drawer :title="title" :visible.sync="open" direction="rtl" :before-close="handleClose" size="100%"
+      v-horizontal-scroll disabled>
+      <el-form ref="form" :model="form" :rules="rules" label-width="100px" :disabled="openStatus == 'see'" size="mini">
+        <el-row :gutter="20">
+          <el-col :span="6">
+            <el-form-item label="编码" prop="code">
+              <el-input v-model="form.code" placeholder="编码后端自动生成" clearable disabled />
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label="目标名称" prop="goalName">
+              <el-input v-model="form.goalName" placeholder="目标名称后端自动生成" clearable disabled />
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label="单据日期" prop="documentDate">
+              <el-date-picker v-model="form.documentDate" type="date" format="yyyy-MM-dd" placeholder="选择日期">
+              </el-date-picker>
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label="年度" prop="annual">
+              <el-date-picker v-model="form.annual" type="year" format="yyyy" placeholder="选择年度"></el-date-picker>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="20">
+          <el-col :span="6">
+            <el-form-item label="客户" prop="custom">
+              <el-popover-select-v2 v-model="form.custom" title="客户" valueKey="name" referName="CUSTOMER_PARAM"
+                :dataMapping="{ customCode: 'code', custom: 'name'}" :source.sync="form" placeholder="请输入客户">
+              </el-popover-select-v2>
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label="销售区域" prop="saleZone">
+              <el-popover-select-v2 v-model="form.saleZone" title="销售区域" valueKey="name" referName="MK_SALESAREA_PARAM"
+                :dataMapping="{ saleZoneCode: 'code', saleZone: 'name'}" :source.sync="form" placeholder="请输入销售区域">
+              </el-popover-select-v2>
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label="制单人" prop="creator">
+              <el-popover-select-v2 v-model="form.creator" title="制单人" valueKey="name" referName="CONTACTS_PARAM"
+                :dataMapping="{ creatorCode: 'code', creator: 'name'}" :source.sync="form" placeholder="请输入制单人">
+              </el-popover-select-v2>
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label="部门" prop="dept">
+              <el-popover-select-v2 v-model="form.dept" title="部门" valueKey="name" referName="DEPT_PARAM"
+                :dataMapping="{ deptId: 'id', dept: 'name'}" :source.sync="form" placeholder="请输入部门">
+              </el-popover-select-v2>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="20">
+          <el-col :span="6">
+            <el-form-item label="目标合计(元)" prop="goalTotal" label-width="120px">
+              <el-input v-model="form.goalTotal" placeholder="目标合计自动计算" clearable disabled />
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label="备注" prop="notes">
+              <el-input v-model="form.notes" placeholder="请输入备注" clearable />
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label="单据状态" prop="type">
+              <el-select v-model="form.status" placeholder="" disabled>
+                <el-option v-for="dict in dict.type.sys_status" :key="dict.value" :label="dict.label"
+                  :value="dict.value"></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+        </el-row>
+
+        <div id="addDetails">
+          <el-row :gutter="10" class="mb8" style="margin-left: 75%">
+            <el-col :span="1.5">
+              <el-button type="info" plain icon="el-icon-upload2" size="mini" @click="handleTemplateDownload">模板下载
+              </el-button>
+            </el-col>
+            <el-col :span="1.5">
+              <el-upload ref="upload" action="" :http-request="handleImport">
+                <el-button size="mini" type="primary">导入明细</el-button>
+              </el-upload>
+            </el-col>
+            <el-col :span="1.5">
+              <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAddDetails">增行</el-button>
+            </el-col>
+            <el-col :span="1.5">
+              <el-button type="primary" plain icon="el-icon-edit-outline" size="mini"
+                @click="dialogUpdateMore.dialogFormVisible = true">批量修改</el-button>
+            </el-col>
+          </el-row>
+          <el-tabs v-model="activeName">
+            <el-tab-pane label="年销售目标填报明细" name="annualSaleGoalDetails">
+
+              <el-table max-height="560" show-summary :summary-method="getSummaries" v-loading="loading" size="mini"
+                :data="annualSaleGoalDetailsList" @selection-change="handleSelectionChange" v-horizontal-scroll>
+                <el-table-column label="序号" type="index" width="70" align="center" fixed />
+                <!-- <el-table-column label="销售组织" align="center" width="180"
+                  :render-header="(h, obj) => addRedStar(h, obj, '0')">
+                  <template slot-scope="scope">
+                    <el-popover-select-v2 v-model="annualSaleGoalDetailsList[scope.$index].saleOrg" title="销售组织"
+                      valueKey="name" referName="ORG_PARAM" :dataMapping="{ saleOrgCode: 'code', saleOrg: 'name'}"
+                      :source.sync="annualSaleGoalDetailsList[scope.$index]" placeholder="请输入销售组织">
+                    </el-popover-select-v2>
+                  </template>
+                </el-table-column>
+                <el-table-column label="销售区域" align="center" width="180"
+                  :render-header="(h, obj) => addRedStar(h, obj, '0')">
+                  <template slot-scope="scope">
+                    <el-popover-select-v2 v-model="annualSaleGoalDetailsList[scope.$index].saleZone" title="销售区域"
+                      valueKey="name" referName="MK_SALESAREA_PARAM"
+                      :dataMapping="{ saleZoneCode: 'code', saleZone: 'name'}"
+                      :source.sync="annualSaleGoalDetailsList[scope.$index]" placeholder="请输入销售区域">
+                    </el-popover-select-v2>
+                  </template>
+                </el-table-column>
+                <el-table-column label="客户" align="center" width="180"
+                  :render-header="(h, obj) => addRedStar(h, obj, '0')">
+                  <template slot-scope="scope">
+                    <el-popover-select-v2 v-model="annualSaleGoalDetailsList[scope.$index].custom" title="客户"
+                      valueKey="name" referName="CUSTOMER_PARAM" :dataMapping="{ customCode: 'code', custom: 'name'}"
+                      :source.sync="annualSaleGoalDetailsList[scope.$index]" placeholder="请输入客户">
+                    </el-popover-select-v2>
+                  </template>
+                </el-table-column>
+                <el-table-column label="负责人" align="center" width="180"
+                  :render-header="(h, obj) => addRedStar(h, obj, '0')">
+                  <template slot-scope="scope">
+                    <el-popover-select-v2 v-model="annualSaleGoalDetailsList[scope.$index].creator" title="负责人"
+                      valueKey="name" referName="CONTACTS_PARAM" :dataMapping="{ creatorCode: 'code', creator: 'name'}"
+                      :source.sync="annualSaleGoalDetailsList[scope.$index]" placeholder="请输入负责人">
+                    </el-popover-select-v2>
+                  </template>
+                </el-table-column> -->
+                <el-table-column label="一级分类" align="center" width="180">
+                  <template slot-scope="scope">
+                    <el-input v-model="annualSaleGoalDetailsList[scope.$index].oneLevelClassify" placeholder="请输入一级分类"
+                      disabled></el-input>
+                  </template>
+                </el-table-column>
+                <el-table-column label="二级分类" align="center" width="180">
+                  <template slot-scope="scope">
+                    <el-input v-model="annualSaleGoalDetailsList[scope.$index].twoLevelClassify" placeholder="请输入二级分类"
+                      disabled></el-input>
+                  </template>
+                </el-table-column>
+                <el-table-column label="物料" align="center" width="220">
+                  <template slot-scope="scope">
+                    <el-popover-select-v2 v-model="annualSaleGoalDetailsList[scope.$index].material" title="物料"
+                      valueKey="name" referName="MATERIAL_PARAM"
+                      @change="setClassify(scope.row.oneLevelClassify, scope.row.twoLevelClassify, annualSaleGoalDetailsList[scope.$index])"
+                      :dataMapping="{ materialCode: 'code', material: 'name', oneLevelClassify: 'oneClass', twoLevelClassify: 'twoClass'}"
+                      :source.sync="annualSaleGoalDetailsList[scope.$index]" placeholder="请输入物料">
+                    </el-popover-select-v2>
+                  </template>
+                </el-table-column>
+                <el-table-column label="合计(元)" align="center" prop="totalGoal" width="180">
+                  <template slot-scope="scope">
+                    <el-input v-model="annualSaleGoalDetailsList[scope.$index].totalGoal" disabled></el-input>
+                  </template>
+                </el-table-column>
+                <el-table-column label="一月(元)" align="center" prop="januaryGoal" width="220">
+                  <template slot-scope="scope">
+                    <el-input-number
+                      @change="computeTotalDetails(scope.$index, annualSaleGoalDetailsList[scope.$index])"
+                      v-model="annualSaleGoalDetailsList[scope.$index].januaryGoal" :precision="2" :step="0.1" :min="0">
+                    </el-input-number>
+                  </template>
+                </el-table-column>
+                <el-table-column label="二月(元)" align="center" prop="februaryGoal" width="220">
+                  <template slot-scope="scope">
+                    <el-input-number
+                      @change="computeTotalDetails(scope.$index, annualSaleGoalDetailsList[scope.$index])"
+                      v-model="annualSaleGoalDetailsList[scope.$index].februaryGoal" :precision="2" :step="0.1"
+                      :min="0">
+                    </el-input-number>
+                  </template>
+                </el-table-column>
+                <el-table-column label="三月(元)" align="center" prop="marchGoal" width="220">
+                  <template slot-scope="scope">
+                    <el-input-number
+                      @change="computeTotalDetails(scope.$index, annualSaleGoalDetailsList[scope.$index])"
+                      v-model="annualSaleGoalDetailsList[scope.$index].marchGoal" :precision="2" :step="0.1" :min="0">
+                    </el-input-number>
+                  </template>
+                </el-table-column>
+                <el-table-column label="四月(元)" align="center" prop="aprilGoal" width="220">
+                  <template slot-scope="scope">
+                    <el-input-number
+                      @change="computeTotalDetails(scope.$index, annualSaleGoalDetailsList[scope.$index])"
+                      v-model="annualSaleGoalDetailsList[scope.$index].aprilGoal" :precision="2" :step="0.1" :min="0">
+                    </el-input-number>
+                  </template>
+                </el-table-column>
+                <el-table-column label="五月(元)" align="center" prop="mayGoal" width="220">
+                  <template slot-scope="scope">
+                    <el-input-number
+                      @change="computeTotalDetails(scope.$index, annualSaleGoalDetailsList[scope.$index])"
+                      v-model="annualSaleGoalDetailsList[scope.$index].mayGoal" :precision="2" :step="0.1" :min="0">
+                    </el-input-number>
+                  </template>
+                </el-table-column>
+                <el-table-column label="六月(元)" align="center" prop="juneGoal" width="220">
+                  <template slot-scope="scope">
+                    <el-input-number
+                      @change="computeTotalDetails(scope.$index, annualSaleGoalDetailsList[scope.$index])"
+                      v-model="annualSaleGoalDetailsList[scope.$index].juneGoal" :precision="2" :step="0.1" :min="0">
+                    </el-input-number>
+                  </template>
+                </el-table-column>
+                <el-table-column label="七月(元)" align="center" prop="julyGoal" width="220">
+                  <template slot-scope="scope">
+                    <el-input-number
+                      @change="computeTotalDetails(scope.$index, annualSaleGoalDetailsList[scope.$index])"
+                      v-model="annualSaleGoalDetailsList[scope.$index].julyGoal" :precision="2" :step="0.1" :min="0">
+                    </el-input-number>
+                  </template>
+                </el-table-column>
+                <el-table-column label="八月(元)" align="center" prop="augustGoal" width="220">
+                  <template slot-scope="scope">
+                    <el-input-number
+                      @change="computeTotalDetails(scope.$index, annualSaleGoalDetailsList[scope.$index])"
+                      v-model="annualSaleGoalDetailsList[scope.$index].augustGoal" :precision="2" :step="0.1" :min="0">
+                    </el-input-number>
+                  </template>
+                </el-table-column>
+                <el-table-column label="九月(元)" align="center" prop="septemberGoal" width="220">
+                  <template slot-scope="scope">
+                    <el-input-number
+                      @change="computeTotalDetails(scope.$index, annualSaleGoalDetailsList[scope.$index])"
+                      v-model="annualSaleGoalDetailsList[scope.$index].septemberGoal" :precision="2" :step="0.1"
+                      :min="0">
+                    </el-input-number>
+                  </template>
+                </el-table-column>
+                <el-table-column label="十月(元)" align="center" prop="octoberGoal" width="220">
+                  <template slot-scope="scope">
+                    <el-input-number
+                      @change="computeTotalDetails(scope.$index, annualSaleGoalDetailsList[scope.$index])"
+                      v-model="annualSaleGoalDetailsList[scope.$index].octoberGoal" :precision="2" :step="0.1" :min="0">
+                    </el-input-number>
+                  </template>
+                </el-table-column>
+                <el-table-column label="十一月(元)" align="center" prop="novemberGoal" width="220">
+                  <template slot-scope="scope">
+                    <el-input-number
+                      @change="computeTotalDetails(scope.$index, annualSaleGoalDetailsList[scope.$index])"
+                      v-model="annualSaleGoalDetailsList[scope.$index].novemberGoal" :precision="2" :step="0.1"
+                      :min="0">
+                    </el-input-number>
+                  </template>
+                </el-table-column>
+                <el-table-column label="十二月(元)" align="center" prop="decemberGoal" width="220">
+                  <template slot-scope="scope">
+                    <el-input-number
+                      @change="computeTotalDetails(scope.$index, annualSaleGoalDetailsList[scope.$index])"
+                      v-model="annualSaleGoalDetailsList[scope.$index].decemberGoal" :precision="2" :step="0.1"
+                      :min="0">
+                    </el-input-number>
+                  </template>
+                </el-table-column>
+                <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120px"
+                  fixed="right">
+                  <template slot-scope="scope">
+                    <el-button size="mini" type="text" icon="el-icon-delete"
+                      @click="handleDeleteDetails(scope.$index, scope.row)">删除</el-button>
+                    <el-button size="mini" type="text" icon="el-icon-delete" @click="handleCopyDetails(scope.row)">复制
+                    </el-button>
+                  </template>
+                </el-table-column>
+              </el-table>
+
+            </el-tab-pane>
+          </el-tabs>
+          <div slot="footer" class="dialog-footer" style="margin-left: 88%; margin-top: 1%">
+            <el-button type="primary" @click="submitForm" size="medium">确 定</el-button>
+            <el-button @click="cancel" size="medium">返 回</el-button>
+          </div>
+        </div>
+      </el-form>
+    </el-drawer>
+    <!-- 批量修改对话框-->
+    <el-dialog title="批量修改" width="30%" :visible.sync="dialogUpdateMore.dialogFormVisible" append-to-body
+      @closed="resetDialogUpdateMore">
+      <el-form>
+        <el-form-item label="修改项" label-width="100px">
+          <el-select @change="changeDialogData" v-model="dialogUpdateMore.updateName" placeholder="请选择需要批量修改的字段">
+            <el-option v-for="item in dialogUpdateMore.optionList" :key="item.value" :label="item.label"
+              :value="item.value"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="修改值" label-width="100px">
+          <el-popover-select-v2 v-if="dialogUpdateMore.updateName === 1" v-model="dialogUpdateMore.updateData"
+            title="销售组织" valueKey="name" referName="ORG_PARAM" :dataMapping="{updateData: 'name'}"
+            :source.sync="dialogUpdateMore" placeholder="请输入销售组织">
+          </el-popover-select-v2>
+          <el-popover-select-v2 v-else-if="dialogUpdateMore.updateName === 2" v-model="dialogUpdateMore.updateData"
+            title="销售区域" valueKey="name" referName="MK_SALESAREA_PARAM" :dataMapping="{updateData: 'name'}"
+            :source.sync="dialogUpdateMore" placeholder="请输入销售区域">
+          </el-popover-select-v2>
+          <el-popover-select-v2 v-else-if="dialogUpdateMore.updateName === 3" v-model="dialogUpdateMore.updateData"
+            title="客户" valueKey="name" referName="CUSTOMER_PARAM" :dataMapping="{updateData: 'name'}"
+            :source.sync="dialogUpdateMore" placeholder="请输入客户">
+          </el-popover-select-v2>
+          <el-popover-select-v2 v-else-if="dialogUpdateMore.updateName === 4" v-model="dialogUpdateMore.updateData"
+            title="制单人" valueKey="name" referName="CONTACTS_PARAM" :dataMapping="{updateData: 'name'}"
+            :source.sync="dialogUpdateMore" placeholder="请输入制单人">
+          </el-popover-select-v2>
+          <el-input v-else placeholder="请输入修改项" disabled></el-input>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="dialogUpdateMoreSave">确 定</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import {
+    listAnnualSaleGoal,
+    getAnnualSaleGoal,
+    delAnnualSaleGoal,
+    addAnnualSaleGoal,
+    updateAnnualSaleGoal,
+    submit,
+    resubmit,
+  } from "@/api/business/spd/goal_management/annualSaleGoal";
+  import {
+    delAnnualSaleGoalDetails,
+    getAnnualSaleGoalDetails,
+    importData
+  } from "@/api/business/spd/goal_management/annualSaleGoalDetails"
+  import {
+    getToken
+  } from "@/utils/auth";
+  import {
+    getSummary
+  } from "@/api/business/spd/goal_management/commonWays";
+  import {
+    rollBack
+  } from "@/api/business/spd/goal_management/publicInterface";
+
+  // 树形参照
+  import TreeRefers from '@/components/Refers/treeRefer.vue'
+  import ElPopoverSelectV2 from "@/components/popover-select-v2"
+
+  export default {
+    name: "AnnualSaleGoal",
+    dicts: ["sys_status", "oa_templete_id"],
+    components: {
+      TreeRefers,
+      ElPopoverSelectV2
+    },
+    data() {
+      return {
+        // 遮罩层
+        loading: true,
+        // 选中数组
+        ids: [],
+        // 非单个禁用
+        single: true,
+        // 非多个禁用
+        multiple: true,
+        // 显示搜索条件
+        showSearch: false,
+        // 总条数
+        total: 0,
+        // 年度销售目标表格数据
+        annualSaleGoalList: [],
+        // 弹出层标题
+        title: "",
+        // 是否显示弹出层
+        open: false,
+        // 查询参数
+        queryParams: {
+          pageNum: 1,
+          pageSize: 10,
+          code: null,
+          goalName: null,
+          documentDate: null,
+          annual: null,
+          customCode: null,
+          custom: null,
+          saleZoneCode: null,
+          saleZone: null,
+          creatorCode: null,
+          creator: null,
+          deptId: null,
+          dept: null,
+          goalTotal: null,
+          notes: null,
+          status: null,
+          delFlag: null,
+          documentDateRange: null
+        },
+        pickerOptions: {
+          shortcuts: [{
+            text: '最近一周',
+            onClick(picker) {
+              const end = new Date();
+              const start = new Date();
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
+              picker.$emit('pick', [start, end]);
+            }
+          }, {
+            text: '最近一个月',
+            onClick(picker) {
+              const end = new Date();
+              const start = new Date();
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
+              picker.$emit('pick', [start, end]);
+            }
+          }, {
+            text: '最近三个月',
+            onClick(picker) {
+              const end = new Date();
+              const start = new Date();
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
+              picker.$emit('pick', [start, end]);
+            }
+          }]
+        },
+        // 表单参数
+        form: {
+          id: null,
+          code: null,
+          goalName: null,
+          documentDate: null,
+          annual: null,
+          customCode: null,
+          custom: null,
+          saleZoneCode: null,
+          saleZone: null,
+          creatorCode: null,
+          creator: null,
+          deptId: null,
+          dept: null,
+          goalTotal: null,
+          notes: null,
+          status: '开立态',
+          deleteStatus: 0,
+          annualGoalMergeDetails: []
+        },
+        formDetails: {
+          id: null,
+          code: null,
+          saleOrg: null,
+          saleZone: null,
+          custom: null,
+          creator: null,
+          oneLevelClassifyCode: null,
+          oneLevelClassify: null,
+          twoLevelClassifyCode: null,
+          twoLevelClassify: null,
+          materialCode: null,
+          material: null,
+          totalGoal: null,
+          januaryGoal: null,
+          februaryGoal: null,
+          marchGoal: null,
+          aprilGoal: null,
+          mayGoal: null,
+          juneGoal: null,
+          julyGoal: null,
+          augustGoal: null,
+          septemberGoal: null,
+          octoberGoal: null,
+          novemberGoal: null,
+          decemberGoal: null
+        },
+        // 表单校验
+        rules: {
+          documentDate: [{
+            required: true,
+            message: '单据日期不能为空',
+            trigger: 'blur'
+          }],
+          annual: [{
+            required: true,
+            message: '年度不能为空',
+            trigger: 'blur'
+          }],
+          custom: [{
+            required: true,
+            message: '客户不能为空',
+            trigger: 'blur'
+          }],
+          saleZone: [{
+            required: true,
+            message: '销售区域不能为空',
+            trigger: 'blur'
+          }],
+          creator: [{
+            required: true,
+            message: '制单人不能为空',
+            trigger: 'blur'
+          }],
+          dept: [{
+            required: true,
+            message: '部门不能为空',
+            trigger: 'blur'
+          }]
+        },
+        // 子表数组
+        annualSaleGoalDetailsList: [],
+        // 用户导入参数
+        upload: {
+          // 是否显示弹出层(用户导入)
+          open: false,
+          // 弹出层标题(用户导入)
+          title: "",
+          // 是否禁用上传
+          isUploading: false,
+          // 是否更新已经存在的用户数据
+          updateSupport: 0,
+          // 设置上传的请求头部
+          headers: {
+            Authorization: "Bearer " + getToken()
+          },
+          // 上传的地址
+          url: process.env.VUE_APP_BASE_API + "/goal_management/annualSaleGoal/importData"
+        },
+        activeName: 'annualSaleGoalDetails',
+        dialogUpdateMore: {
+          updateName: null,
+          dialogFormVisible: false,
+          updateData: null,
+          optionList: [{
+            value: 1,
+            label: '销售组织'
+          }, {
+            value: 2,
+            label: '销售区域'
+          }, {
+            value: 3,
+            label: '客户'
+          }, {
+            value: 4,
+            label: '制单人'
+          }, ]
+        },
+        //打开状态
+        openStatus: null,
+      };
+    },
+    created() {
+      console.log(this.$store.state.user, 'this.$store.state.user')
+      this.getList();
+    },
+    methods: {
+      /** 查询年度销售目标列表 */
+      getList() {
+        this.loading = true;
+        listAnnualSaleGoal(this.queryParams).then(response => {
+          this.annualSaleGoalList = response.rows;
+          this.total = response.total;
+          this.loading = false;
+          this.annualSaleGoalList.forEach(item => {
+            item.goalTotal = item.goalTotal.toFixed(2);
+          })
+          console.log(this.annualSaleGoalList);
+        });
+      },
+      getListDetails() {
+        this.loading = true
+        getAnnualSaleGoalDetails(this.form.id).then(response => {
+          this.annualSaleGoalDetailsList = response.data
+          this.computeTotal()
+          this.form.annualGoalMergeDetails = this.annualSaleGoalDetailsList
+          updateAnnualSaleGoal(this.form).then(response => {})
+          this.loading = false
+        })
+      },
+      // 取消按钮
+      cancel() {
+        this.open = false;
+        this.reset();
+      },
+      // 表单重置
+      reset() {
+        this.form = {
+          id: null,
+          code: null,
+          goalName: null,
+          documentDate: null,
+          annual: null,
+          customCode: null,
+          custom: null,
+          saleZoneCode: null,
+          saleZone: null,
+          creatorCode: null,
+          creator: null,
+          deptId: null,
+          dept: null,
+          goalTotal: null,
+          notes: null,
+          status: null,
+          deleteStatus: null
+        };
+        this.resetForm("form");
+      },
+      /** 搜索按钮操作 */
+      handleQuery() {
+        this.queryParams.pageNum = 1;
+        this.getList();
+      },
+      /** 重置按钮操作 */
+      resetQuery() {
+        this.queryParams = {
+          pageNum: 1,
+          pageSize: 10,
+          code: null,
+          goalName: null,
+          documentDate: null,
+          annual: null,
+          customCode: null,
+          custom: null,
+          saleZoneCode: null,
+          saleZone: null,
+          creatorCode: null,
+          creator: null,
+          deptId: null,
+          dept: null,
+          goalTotal: null,
+          notes: null,
+          status: null,
+          delFlag: null,
+          documentDateRange: null
+        }
+        this.resetForm("queryForm");
+        this.handleQuery();
+      },
+      // 多选框选中数据
+      handleSelectionChange(selection) {
+        this.ids = selection.map(item => item.id)
+        this.single = selection.length !== 1
+        this.multiple = !selection.length
+      },
+      /** 新增按钮操作 */
+      handleAdd() {
+        this.openStatus = 'edit';
+        this.reset();
+        this.title = "添加--年度销售目标";
+        this.annualSaleGoalDetailsList = []
+        this.open = true;
+        this.form.documentDate = new Date().getFullYear().toString() + '-' + (new Date().getMonth() + 1).toString()
+          .padStart(2, '0') + '-' + new Date().getDate().toString().padStart(2, '0')
+        this.form.annual = new Date().getFullYear().toString()
+        this.form.creatorCode = this.$store.state.user.name
+        this.form.creator = this.$store.state.user.nickName
+        this.form.deptId = this.$store.state.user.deptId
+        this.form.dept = this.$store.state.user.deptName
+      },
+      handleAddDetails() {
+        let list = {
+          id: null,
+          code: null,
+          saleOrg: this.$store.state.user.orgName,
+          saleZone: this.form.saleZone,
+          custom: this.form.custom,
+          creator: this.form.creator,
+          oneLevelClassifyCode: null,
+          oneLevelClassify: null,
+          twoLevelClassifyCode: null,
+          twoLevelClassify: null,
+          materialCode: null,
+          material: null,
+          totalGoal: '0.00',
+          januaryGoal: null,
+          februaryGoal: null,
+          marchGoal: null,
+          aprilGoal: null,
+          mayGoal: null,
+          juneGoal: null,
+          julyGoal: null,
+          augustGoal: null,
+          septemberGoal: null,
+          octoberGoal: null,
+          novemberGoal: null,
+          decemberGoal: null
+        }
+        this.annualSaleGoalDetailsList.push(list)
+        this.computeTotal()
+      },
+      /** 修改按钮操作 */
+      handleUpdate(row) {
+        this.openStatus = 'edit';
+        this.reset();
+        const id = row.id || this.ids
+        getAnnualSaleGoal(id).then(response => {
+          this.form = response.data;
+          this.saveFormTwoPoint(this.form)
+          this.annualSaleGoalDetailsList = this.form.annualGoalMergeDetails
+          this.open = true;
+          this.title = "修改--年销售目标填报";
+        });
+      },
+      // 复制按钮
+      handleCopy(id) {
+        this.openStatus = 'edit';
+        this.reset();
+        getAnnualSaleGoal(id).then(response => {
+          console.log(response);
+          this.form = response.data;
+          this.form.id = null
+          this.form.code = null
+          this.form.documentDate = new Date().getFullYear().toString() + '-' + (new Date().getMonth() + 1)
+            .toString().padStart(2, '0') + '-' + new Date().getDate().toString().padStart(2, '0')
+          this.form.annual = new Date().getFullYear().toString()
+          this.saveFormTwoPoint(this.form)
+          this.annualSaleGoalDetailsList = JSON.parse(JSON.stringify(this.form.annualGoalMergeDetails))
+          for (const element of this.annualSaleGoalDetailsList) {
+            element.id = null
+            element.code = null
+          }
+          this.open = true;
+          this.title = "新增--年度销售目标";
+          console.log(this.form);
+        })
+      },
+      // 进入修改复制界面保留两位小数
+      saveFormTwoPoint(form) {
+        form.goalTotal = form.goalTotal.toFixed(2)
+        for (const element of form.annualGoalMergeDetails) {
+          element.totalGoal = element.totalGoal.toFixed(2)
+        }
+      },
+      /** 提交按钮 */
+      submitForm() {
+        // 明细行赋值
+        for (let i = 0; i < this.annualSaleGoalDetailsList.length; i++) {
+          this.annualSaleGoalDetailsList[i].saleOrg = this.$store.state.user.orgName;
+          this.annualSaleGoalDetailsList[i].saleZone = this.form.saleZone;
+          this.annualSaleGoalDetailsList[i].custom = this.form.custom;
+          this.annualSaleGoalDetailsList[i].creator = this.form.creator;
+        }
+        if (this.justiceDetailsList()) {
+          return this.$message.error('子表有必填字段未填,或者目标值为0')
+        }
+        for (let i = 0; i < this.annualSaleGoalDetailsList.length; i++) {
+          for (let j = i + 1; j < this.annualSaleGoalDetailsList.length; j++) {
+            if (this.annualSaleGoalDetailsList[i].materialCode == this.annualSaleGoalDetailsList[j].materialCode &&
+              this.annualSaleGoalDetailsList[i].materialCode != null &&
+              this.annualSaleGoalDetailsList[j].materialCode != null &&
+              this.annualSaleGoalDetailsList[i].materialCode != "" &&
+              this.annualSaleGoalDetailsList[j].materialCode != "") {
+              return this.$message.error('子表存在重复物料');
+            }
+          }
+        }
+        this.annualSaleGoalDetailsList.forEach(item => {
+          if (item.oneLevelClassify == null || item.oneLevelClassify == "") {
+            item.oneLevelClassifyCode = null;
+          }
+          if (item.twoLevelClassify == null || item.twoLevelClassify == "") {
+            item.twoLevelClassifyCode = null;
+          }
+        })
+        this.$refs["form"].validate(valid => {
+          if (valid) {
+            if (this.form.id != null) {
+              this.form.annualGoalMergeDetails = JSON.parse(JSON.stringify(this.annualSaleGoalDetailsList))
+              updateAnnualSaleGoal(this.form).then(response => {
+                this.$modal.msgSuccess("修改成功");
+                this.open = false;
+                this.getList();
+              });
+            } else {
+              this.form.status = '0'
+              this.form.annualGoalMergeDetails = JSON.parse(JSON.stringify(this.annualSaleGoalDetailsList))
+              console.log(this.form);
+              addAnnualSaleGoal(this.form).then(response => {
+                this.$modal.msgSuccess("新增成功");
+                this.open = false;
+                this.getList();
+              });
+            }
+          }
+        });
+      },
+      /** 删除按钮操作 */
+      handleDelete(row) {
+        const ids = row.id || this.ids;
+        this.$modal.confirm('是否确认删除年销售目标填报单据编号为"' + row.code + '"的数据项?').then(function () {
+          return delAnnualSaleGoal(ids);
+        }).then(() => {
+          this.getList();
+          this.$modal.msgSuccess("删除成功");
+        }).catch(() => {});
+      },
+      handleDeleteDetails(index, row) {
+        if (this.form.id === null) {
+          this.annualSaleGoalDetailsList.splice(index, 1)
+          this.computeTotal()
+        } else {
+          if (row.id !== null) {
+            this.$modal.confirm('是否确认删除年度销售目标明细序号为"' + (index + 1) + '"的数据项?').then(function () {
+              return delAnnualSaleGoalDetails(row.id)
+            }).then(() => {
+              this.getListDetails()
+              this.$modal.msgSuccess('删除成功')
+            }).catch(() => {})
+          } else {
+            this.annualSaleGoalDetailsList.splice(index, 1)
+            this.$message.success('删除成功')
+            this.computeTotal()
+          }
+        }
+      },
+      /** 导出按钮操作 */
+      handleExport() {
+        this.download('goal_management/annualSaleGoal/export', {
+          ...this.queryParams
+        }, `annualSaleGoal_${new Date().getTime()}.xlsx`)
+      },
+      handleExportDetails() {
+        this.download('goal_management/annualSaleGoalDetails/export', {
+          ...this.queryParams
+        }, `annualSaleGoalMerge_${new Date().getTime()}.xlsx`)
+      },
+      handleClose(done) {
+        this.$confirm('确认关闭?')
+          .then(_ => {
+            done();
+            this.reset()
+          })
+          .catch(_ => {});
+      },
+      // 复制明细
+      handleCopyDetails(row) {
+        let list = {
+          id: null,
+          code: row.code,
+          saleOrg: row.saleOrg,
+          saleZone: row.saleZone,
+          custom: row.custom,
+          creator: row.creator,
+          oneLevelClassifyCode: row.oneLevelClassifyCode,
+          oneLevelClassify: row.oneLevelClassify,
+          twoLevelClassifyCode: row.oneLevelClassifyCode,
+          twoLevelClassify: row.twoLevelClassify,
+          materialCode: row.materialCode,
+          material: row.material,
+          totalGoal: row.totalGoal,
+          januaryGoal: row.januaryGoal,
+          februaryGoal: row.februaryGoal,
+          marchGoal: row.marchGoal,
+          aprilGoal: row.aprilGoal,
+          mayGoal: row.mayGoal,
+          juneGoal: row.juneGoal,
+          julyGoal: row.julyGoal,
+          augustGoal: row.augustGoal,
+          septemberGoal: row.septemberGoal,
+          octoberGoal: row.octoberGoal,
+          novemberGoal: row.novemberGoal,
+          decemberGoal: row.decemberGoal
+        }
+        this.annualSaleGoalDetailsList.push(list)
+        this.computeTotal()
+      },
+      // 计算子表合计
+      computeTotalDetails(index, row) {
+        let array = [row.januaryGoal, row.februaryGoal, row.marchGoal, row.aprilGoal, row.mayGoal, row.juneGoal, row
+          .julyGoal, row.augustGoal, row.septemberGoal, row.octoberGoal, row.novemberGoal, row.decemberGoal
+        ]
+        let sum = 0
+        for (const element of array) {
+          sum = (sum * 1000000 + element * 1000000) / 1000000
+        }
+        this.annualSaleGoalDetailsList[index].totalGoal = sum.toFixed(2)
+        this.computeTotal()
+      },
+      // 计算主表合计
+      computeTotal() {
+        let list = this.annualSaleGoalDetailsList
+        let sum = 0
+        for (const listElement of list) {
+          sum = (sum * 1000000 + listElement.totalGoal * 1000000) / 1000000
+        }
+        this.form.goalTotal = sum.toFixed(2)
+      },
+      getSummaries(param) {
+        return getSummary(param)
+      },
+      // 给table添加必填项
+      addRedStar(h, {
+        column
+      }, required) {
+        if (required === '0') {
+          return [
+            h('span', {
+              style: 'color: #F56C6C'
+            }, '*'),
+            h('span', '' + column.label)
+          ]
+        } else {
+          return [
+            // h('span', { style: 'color: #F56C6C' }, '*'),
+            h('span', '' + column.label)
+          ]
+        }
+      },
+      // 判断子表的字段是否都填了
+      justiceDetailsList() {
+        let isFlag = [];
+        const arr = JSON.parse(JSON.stringify(this.annualSaleGoalDetailsList))
+        for (const element of arr) {
+          const flag1 = (element.saleZone !== null) && (element.saleOrg !== null) && (element.custom !== null) && (
+            element.creator !== null) && (element.goalValue !== 0)
+          const flag2 = (element.saleOrg !== undefined) && (element.saleZone !== undefined) && (element.custom !==
+            undefined) && (element.creator !== undefined)
+          if (flag1 && flag2) {
+            isFlag.push(true);
+          } else {
+            isFlag.push(false);
+          }
+        }
+        for (const flag of isFlag) {
+          if (!flag) {
+            return true;
+          }
+        }
+      },
+      handleCommand(command) {
+        // 执行对应的功能
+        if (command === 'export') {
+          console.log('导出主表');
+          this.handleExport()
+        } else if (command === 'exportDetails') {
+          console.log('导出明细');
+          this.handleExportDetails()
+        }
+      },
+      // 选择物料后,给一级分类和二级分类复赋值
+      setClassify(one, two, obj) {
+        const oneArray = one.split("&")
+        const twoArray = two.split("&")
+        obj.oneLevelClassifyCode = oneArray[1]
+        obj.oneLevelClassify = oneArray[0]
+        obj.twoLevelClassifyCode = twoArray[1]
+        obj.twoLevelClassify = twoArray[0]
+        console.log(obj, 'obj');
+      },
+      // 批量修改对话框的方法
+      dialogUpdateMoreSave() {
+        console.log(this.dialogUpdateMore);
+        if (this.dialogUpdateMore.updateData === null) {
+          return this.$message.error('请输入修改值')
+        }
+        const array = JSON.parse(JSON.stringify(this.annualSaleGoalDetailsList))
+        if (array.length !== 0) {
+          let condition = this.dialogUpdateMore.updateName
+          for (const element of array) {
+            if (condition === 1) {
+              element.saleOrg = JSON.parse(JSON.stringify(this.dialogUpdateMore.updateData))
+            } else if (condition === 2) {
+              element.saleZone = JSON.parse(JSON.stringify(this.dialogUpdateMore.updateData))
+            } else if (condition === 3) {
+              element.custom = JSON.parse(JSON.stringify(this.dialogUpdateMore.updateData))
+            } else if (condition === 4) {
+              element.creator = JSON.parse(JSON.stringify(this.dialogUpdateMore.updateData))
+            }
+          }
+        }
+        this.annualSaleGoalDetailsList = array
+        this.dialogUpdateMore.dialogFormVisible = !this.dialogUpdateMore.dialogFormVisible
+        this.dialogUpdateMore.updateData = null
+        this.dialogUpdateMore.updateName = null
+      },
+      changeDialogData() {
+        this.dialogUpdateMore.updateData = null
+      },
+      resetDialogUpdateMore() {
+        this.dialogUpdateMore.updateName = null
+        this.dialogUpdateMore.updateData = null
+      },
+      //提交
+      async handleSubmit(row) {
+        this.$modal.loading("提交中...");
+        try {
+          const {
+            msg,
+            code
+          } = await submit(row.id);
+          if (code === 200) {
+            this.$modal.notifySuccess("提交成功");
+            this.$modal.closeLoading();
+            row.status = '1';
+          }
+        } catch (err) {
+          console.error(err);
+          this.$modal.closeLoading();
+        }
+      },
+      //重新提交
+      async handleResubmit(row) {
+        this.$modal.loading("提交中...");
+        try {
+          const {
+            msg,
+            code
+          } = await resubmit(row.id);
+          if (code === 200) {
+            this.$modal.notifySuccess("提交成功");
+            this.$modal.closeLoading();
+          }
+        } catch (err) {
+          console.error(err);
+          this.$modal.closeLoading();
+        }
+      },
+      //收回
+      handleReback(row) {
+        this.$modal.loading("收回中...");
+        let params = {
+          billCode: row.code,
+          fdId: row.flowId,
+          fdTemplateId: this.dict.type.oa_templete_id.find(item => {
+            return item.label == "销售目标"
+          }).value,
+          billMaker: row.createBy,
+          type: "1"
+        }
+        rollBack(params).then(res => {
+          if (res.code === 200) {
+            this.$modal.notifySuccess("收回成功");
+            this.$modal.closeLoading();
+            this.getList(this.queryParams)
+          }
+        }).catch(err => {
+          this.$message.error(err);
+          this.$modal.closeLoading();
+        })
+      },
+      //模板下载
+      handleTemplateDownload() {
+        this.download('/goal_management/annualSaleGoalDetails/importTemplate', {},
+          `年销售目标填报明细导入模板_${new Date().getTime()}.xlsx`)
+      },
+      //导入
+      handleImport(file) {
+        this.loading = true;
+        let formData = new FormData()
+        formData.append('file', file.file)
+        importData(formData).then((res) => {
+          console.log('res', res);
+          if (res.code == '200') {
+            this.annualSaleGoalDetailsList.push.apply(this.annualSaleGoalDetailsList, res.data);
+            this.$message.success(res.msg);
+          } else {
+            this.$message.success(res.msg);
+          }
+          this.loading = false;
+        }).catch((e) => {
+          this.$message.error(e.message)
+        }).finally((e) => {
+          this.$refs['upload'].clearFiles();
+          this.loading = false;
+        })
+      },
+      //双击行
+      useDoubleClick(row) {
+        this.openStatus = 'see';
+        this.reset();
+        const id = row.id || this.ids
+        getAnnualSaleGoal(id).then(response => {
+          this.form = response.data;
+          this.saveFormTwoPoint(this.form)
+          this.annualSaleGoalDetailsList = this.form.annualGoalMergeDetails
+          this.open = true;
+          this.title = "查看--年度销售目标";
+        });
+      },
+    },
+  }
+
+</script>

+ 245 - 1192
src/views/business/spd/target/AnnualSaleGoal.vue

@@ -1,1234 +1,287 @@
+<!-- 年度销售目标填报 -->
 <template>
-  <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" size="mini" :inline="true" label-width="100px">
-      <el-row :gutter="20">
-        <el-col :span="6">
-          <el-form-item label="编码" prop="code">
-            <el-input v-model="queryParams.code" placeholder="请输入编码" clearable @keyup.enter.native="handleQuery" />
-          </el-form-item>
-        </el-col>
-        <el-col :span="6">
-          <el-form-item label="目标名称" prop="goalName">
-            <el-input v-model="queryParams.goalName" placeholder="请输入年度销售目标名称" clearable
-              @keyup.enter.native="handleQuery" />
-          </el-form-item>
-        </el-col>
-        <el-col :span="8">
-          <el-form-item label="单据日期" prop="documentDate">
-            <el-date-picker v-model="queryParams.documentDateRange" type="daterange" value-format="yyyy-MM-dd"
-              align="right" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" placeholder="请选择单据日期"
-              :picker-options="pickerOptions">
-            </el-date-picker>
-          </el-form-item>
-        </el-col>
-        <el-col :span="4">
-          <el-form-item>
-            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
-            <el-tooltip class="item" effect="dark" :content="showSearch?'隐藏搜索':'显示搜索'" placement="top">
-              <el-button type="warning" :icon="showSearch?'el-icon-caret-top':'el-icon-caret-bottom'" circle
-                @click="showSearch = !showSearch"></el-button>
-            </el-tooltip>
-          </el-form-item>
-        </el-col>
-      </el-row>
+  <el-card
+    v-loading="loading"
+    :body-style="{
+      height: '100%',
+      padding: 0,
+      display: 'flex',
+      'flex-direction': 'column',
+    }"
+  >
+    <el-super-search
+      v-model="params"
+      :size="size"
+      :dict="dict"
+      :columns="SearchColumns"
+      @reset="useReset"
+      @submit="getList(params, page)"
+    ></el-super-search>
 
-    </el-form>
-    <el-form :model="queryParams" ref="queryForm" size="mini" :inline="true" v-show="showSearch" label-width="100px">
-      <el-row :gutter="20">
-        <el-col :span="6">
-          <el-form-item label="年度" prop="annual">
-            <el-date-picker v-model="queryParams.annual" type="year" value-format="yyyy" placeholder="选择年度" clearable
-              @keyup.enter.native="handleQuery">
-            </el-date-picker>
-          </el-form-item>
-        </el-col>
-        <el-col :span="6">
-          <el-form-item label="客户" prop="custom">
-            <el-popover-select-v2 v-model="queryParams.custom" title="客户" valueKey="name" referName="CUSTOMER_PARAM"
-              :dataMapping="{ customCode: 'code', custom: 'name'}" :source.sync="queryParams" placeholder="请输入客户"
-              @keyup.enter.native="handleQuery">
-            </el-popover-select-v2>
-          </el-form-item>
-        </el-col>
-        <el-col :span="6">
-          <el-form-item label="销售区域" prop="saleZone">
-            <el-popover-select-v2 v-model="queryParams.saleZone" title="销售区域" valueKey="name"
-              referName="MK_SALESAREA_PARAM" :dataMapping="{ saleZoneCode: 'code', saleZone: 'name'}"
-              :source.sync="queryParams" placeholder="请输入销售区域" @keyup.enter.native="handleQuery">
-            </el-popover-select-v2>
-          </el-form-item>
-        </el-col>
-        <el-col :span="6">
-          <el-form-item label="制单人" prop="creator">
-            <el-popover-select-v2 v-model="queryParams.creator" title="制单人" valueKey="name" referName="CONTACTS_PARAM"
-              :dataMapping="{ creatorCode: 'code', creator: 'name'}" :source.sync="queryParams" placeholder="请输入制单人"
-              @keyup.enter.native="handleQuery">
-            </el-popover-select-v2>
-          </el-form-item>
-        </el-col>
-      </el-row>
-      <el-row :gutter="20">
-        <el-col :span="6">
-          <el-form-item label="部门" prop="dept">
-            <el-popover-select-v2 v-model="queryParams.dept" title="部门" valueKey="name" referName="DEPT_PARAM"
-              :dataMapping="{ deptId: 'id', dept: 'name'}" :source.sync="queryParams" placeholder="请输入部门"
-              @keyup.enter.native="handleQuery">
-            </el-popover-select-v2>
-          </el-form-item>
-        </el-col>
-        <el-col :span="6">
-          <el-form-item label="单据状态" prop="status">
-            <el-select size="mini" v-model="queryParams.status" clearable>
-              <el-option v-for="dict in dict.type.sys_status" :key="dict.value" :label="dict.label" :value="dict.value">
-              </el-option>
-            </el-select>
-          </el-form-item>
-        </el-col>
-      </el-row>
-    </el-form>
-
-    <el-row :gutter="10" class="mb8" style="float: right">
+    <el-row
+      :gutter="10"
+      class="mb10"
+      type="flex"
+      justify="end"
+      style="margin-top: 20px"
+    >
       <el-col :span="1.5">
-        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增
+        <el-button type="primary" :size="size" @click="handleAdd"
+          >新 增
         </el-button>
       </el-col>
       <el-col :span="1.5">
         <el-dropdown @command="handleCommand">
-          <el-button type="warning" plain icon="el-icon-download" size="mini">
-            导出<i class="el-icon-arrow-down el-icon--right"></i>
+          <el-button :size="size">
+            导 出<i class="el-icon-arrow-down el-icon--right"></i>
           </el-button>
           <el-dropdown-menu slot="dropdown">
             <el-dropdown-item command="export">导出</el-dropdown-item>
-            <el-dropdown-item command="exportDetails">导出明细</el-dropdown-item>
+            <el-dropdown-item command="exportDetails"
+              >导出明细</el-dropdown-item
+            >
           </el-dropdown-menu>
         </el-dropdown>
       </el-col>
     </el-row>
 
-    <el-table v-loading="loading" :data="annualSaleGoalList" @selection-change="handleSelectionChange"
-      @row-dblclick="useDoubleClick" v-horizontal-scroll max-height="560">
-      <el-table-column label="编码" align="center" prop="code" width="180" />
-      <el-table-column label="目标名称" align="center" prop="goalName" width="240" />
-      <el-table-column label="单据日期" align="center" prop="documentDate" width="180">
-        <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.documentDate, '{y}-{m}-{d}') }}</span>
-        </template>
-      </el-table-column>
-      <el-table-column label="年度" align="center" prop="annual" width="100" />
-      <el-table-column label="客户" align="center" prop="custom" width="180" />
-      <el-table-column label="销售区域" align="center" prop="saleZone" width="180" />
-      <el-table-column label="制单人" align="center" prop="creator" width="180" />
-      <el-table-column label="部门" align="center" prop="dept" width="180" />
-      <el-table-column label="目标合计(元)" align="center" prop="goalTotal" width="180" />
-      <el-table-column label="备注" align="center" prop="notes" width="180" />
-      <el-table-column show-overflow-tooltip label="状态" align="center" width="100" prop="status">
+    <el-super-ux-table
+      v-model="tableData"
+      :size="size"
+      :dict="dict"
+      :page="page"
+      :columns="TableColumns"
+      index
+      pagination
+      convenitentOperation
+      highlight-current-row
+      storage-key="AnnualSaleGoalSuperTable"
+      @row-dblclick="useSee"
+      @pagination="getList(params, page)"
+      style="margin: 16px 0 0"
+    >
+      <ux-table-column fixed="right" title="操作" align="center" width="160">
         <template slot-scope="scope">
-          <dict-tag :options="dict.type.sys_status" :value="scope.row.status" />
-        </template>
-      </el-table-column>
-      <el-table-column label="操作" align="center" class-name="small-padding" width="180" fixed="right">
-        <template slot-scope="scope">
-          <el-button size="mini" type="text" @click="useDoubleClick(scope.row)">查看
+          <el-button size="mini" type="text" @click="useSee(scope.row)"
+            >查看
           </el-button>
-          <el-button v-if="scope.row.status == '0' || scope.row.status == '3'" size="mini" type="text"
-            @click="handleUpdate(scope.row)">修改
+          <el-button
+            v-if="scope.row.status == '0' || scope.row.status == '3'"
+            size="mini"
+            type="text"
+            @click="useEdit(scope.row)"
+            >修改
           </el-button>
-          <el-button v-if="scope.row.status == '0' || scope.row.status == '3'" size="mini" type="text"
-            @click="handleDelete(scope.row)">删除
+          <el-button
+            v-if="scope.row.status == '0' || scope.row.status == '3'"
+            size="mini"
+            type="text"
+            @click="useDelete(scope.row)"
+            >删除
           </el-button>
-          <el-button v-if="scope.row.status == '0' || scope.row.status == '3'" size="mini" type="text"
-            @click="handleSubmit(scope.row)">提交
+          <el-button
+            v-if="scope.row.status == '0' || scope.row.status == '3'"
+            size="mini"
+            type="text"
+            @click="useSubmit(scope.row)"
+            >提交
           </el-button>
-          <el-button v-if="scope.row.status == '1'" size="mini" type="text" @click="handleReback(scope.row)">收回
+          <el-button
+            v-if="scope.row.status == '1'"
+            size="mini"
+            type="text"
+            @click="useReback(scope.row)"
+            >收回
           </el-button>
         </template>
-      </el-table-column>
-    </el-table>
-
-    <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
-      :page-sizes="[10, 20, 50, 100]" @pagination="getList" />
-
-    <el-drawer :title="title" :visible.sync="open" direction="rtl" :before-close="handleClose" size="100%"
-      v-horizontal-scroll disabled>
-      <el-form ref="form" :model="form" :rules="rules" label-width="100px" :disabled="openStatus == 'see'" size="mini">
-        <el-row :gutter="20">
-          <el-col :span="6">
-            <el-form-item label="编码" prop="code">
-              <el-input v-model="form.code" placeholder="编码后端自动生成" clearable disabled />
-            </el-form-item>
-          </el-col>
-          <el-col :span="6">
-            <el-form-item label="目标名称" prop="goalName">
-              <el-input v-model="form.goalName" placeholder="目标名称后端自动生成" clearable disabled />
-            </el-form-item>
-          </el-col>
-          <el-col :span="6">
-            <el-form-item label="单据日期" prop="documentDate">
-              <el-date-picker v-model="form.documentDate" type="date" format="yyyy-MM-dd" placeholder="选择日期">
-              </el-date-picker>
-            </el-form-item>
-          </el-col>
-          <el-col :span="6">
-            <el-form-item label="年度" prop="annual">
-              <el-date-picker v-model="form.annual" type="year" format="yyyy" placeholder="选择年度"></el-date-picker>
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row :gutter="20">
-          <el-col :span="6">
-            <el-form-item label="客户" prop="custom">
-              <el-popover-select-v2 v-model="form.custom" title="客户" valueKey="name" referName="CUSTOMER_PARAM"
-                :dataMapping="{ customCode: 'code', custom: 'name'}" :source.sync="form" placeholder="请输入客户">
-              </el-popover-select-v2>
-            </el-form-item>
-          </el-col>
-          <el-col :span="6">
-            <el-form-item label="销售区域" prop="saleZone">
-              <el-popover-select-v2 v-model="form.saleZone" title="销售区域" valueKey="name" referName="MK_SALESAREA_PARAM"
-                :dataMapping="{ saleZoneCode: 'code', saleZone: 'name'}" :source.sync="form" placeholder="请输入销售区域">
-              </el-popover-select-v2>
-            </el-form-item>
-          </el-col>
-          <el-col :span="6">
-            <el-form-item label="制单人" prop="creator">
-              <el-popover-select-v2 v-model="form.creator" title="制单人" valueKey="name" referName="CONTACTS_PARAM"
-                :dataMapping="{ creatorCode: 'code', creator: 'name'}" :source.sync="form" placeholder="请输入制单人">
-              </el-popover-select-v2>
-            </el-form-item>
-          </el-col>
-          <el-col :span="6">
-            <el-form-item label="部门" prop="dept">
-              <el-popover-select-v2 v-model="form.dept" title="部门" valueKey="name" referName="DEPT_PARAM"
-                :dataMapping="{ deptId: 'id', dept: 'name'}" :source.sync="form" placeholder="请输入部门">
-              </el-popover-select-v2>
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row :gutter="20">
-          <el-col :span="6">
-            <el-form-item label="目标合计(元)" prop="goalTotal" label-width="120px">
-              <el-input v-model="form.goalTotal" placeholder="目标合计自动计算" clearable disabled />
-            </el-form-item>
-          </el-col>
-          <el-col :span="6">
-            <el-form-item label="备注" prop="notes">
-              <el-input v-model="form.notes" placeholder="请输入备注" clearable />
-            </el-form-item>
-          </el-col>
-          <el-col :span="6">
-            <el-form-item label="单据状态" prop="type">
-              <el-select v-model="form.status" placeholder="" disabled>
-                <el-option v-for="dict in dict.type.sys_status" :key="dict.value" :label="dict.label"
-                  :value="dict.value"></el-option>
-              </el-select>
-            </el-form-item>
-          </el-col>
-        </el-row>
+      </ux-table-column>
+    </el-super-ux-table>
 
-        <div id="addDetails">
-          <el-row :gutter="10" class="mb8" style="margin-left: 75%">
-            <el-col :span="1.5">
-              <el-button type="info" plain icon="el-icon-upload2" size="mini" @click="handleTemplateDownload">模板下载
-              </el-button>
-            </el-col>
-            <el-col :span="1.5">
-              <el-upload ref="upload" action="" :http-request="handleImport">
-                <el-button size="mini" type="primary">导入明细</el-button>
-              </el-upload>
-            </el-col>
-            <el-col :span="1.5">
-              <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAddDetails">增行</el-button>
-            </el-col>
-            <el-col :span="1.5">
-              <el-button type="primary" plain icon="el-icon-edit-outline" size="mini"
-                @click="dialogUpdateMore.dialogFormVisible = true">批量修改</el-button>
-            </el-col>
-          </el-row>
-          <el-tabs v-model="activeName">
-            <el-tab-pane label="年销售目标填报明细" name="annualSaleGoalDetails">
-
-              <el-table max-height="560" show-summary :summary-method="getSummaries" v-loading="loading" size="mini"
-                :data="annualSaleGoalDetailsList" @selection-change="handleSelectionChange" v-horizontal-scroll>
-                <el-table-column label="序号" type="index" width="70" align="center" fixed />
-                <!-- <el-table-column label="销售组织" align="center" width="180"
-                  :render-header="(h, obj) => addRedStar(h, obj, '0')">
-                  <template slot-scope="scope">
-                    <el-popover-select-v2 v-model="annualSaleGoalDetailsList[scope.$index].saleOrg" title="销售组织"
-                      valueKey="name" referName="ORG_PARAM" :dataMapping="{ saleOrgCode: 'code', saleOrg: 'name'}"
-                      :source.sync="annualSaleGoalDetailsList[scope.$index]" placeholder="请输入销售组织">
-                    </el-popover-select-v2>
-                  </template>
-                </el-table-column>
-                <el-table-column label="销售区域" align="center" width="180"
-                  :render-header="(h, obj) => addRedStar(h, obj, '0')">
-                  <template slot-scope="scope">
-                    <el-popover-select-v2 v-model="annualSaleGoalDetailsList[scope.$index].saleZone" title="销售区域"
-                      valueKey="name" referName="MK_SALESAREA_PARAM"
-                      :dataMapping="{ saleZoneCode: 'code', saleZone: 'name'}"
-                      :source.sync="annualSaleGoalDetailsList[scope.$index]" placeholder="请输入销售区域">
-                    </el-popover-select-v2>
-                  </template>
-                </el-table-column>
-                <el-table-column label="客户" align="center" width="180"
-                  :render-header="(h, obj) => addRedStar(h, obj, '0')">
-                  <template slot-scope="scope">
-                    <el-popover-select-v2 v-model="annualSaleGoalDetailsList[scope.$index].custom" title="客户"
-                      valueKey="name" referName="CUSTOMER_PARAM" :dataMapping="{ customCode: 'code', custom: 'name'}"
-                      :source.sync="annualSaleGoalDetailsList[scope.$index]" placeholder="请输入客户">
-                    </el-popover-select-v2>
-                  </template>
-                </el-table-column>
-                <el-table-column label="负责人" align="center" width="180"
-                  :render-header="(h, obj) => addRedStar(h, obj, '0')">
-                  <template slot-scope="scope">
-                    <el-popover-select-v2 v-model="annualSaleGoalDetailsList[scope.$index].creator" title="负责人"
-                      valueKey="name" referName="CONTACTS_PARAM" :dataMapping="{ creatorCode: 'code', creator: 'name'}"
-                      :source.sync="annualSaleGoalDetailsList[scope.$index]" placeholder="请输入负责人">
-                    </el-popover-select-v2>
-                  </template>
-                </el-table-column> -->
-                <el-table-column label="一级分类" align="center" width="180">
-                  <template slot-scope="scope">
-                    <el-input v-model="annualSaleGoalDetailsList[scope.$index].oneLevelClassify" placeholder="请输入一级分类"
-                      disabled></el-input>
-                  </template>
-                </el-table-column>
-                <el-table-column label="二级分类" align="center" width="180">
-                  <template slot-scope="scope">
-                    <el-input v-model="annualSaleGoalDetailsList[scope.$index].twoLevelClassify" placeholder="请输入二级分类"
-                      disabled></el-input>
-                  </template>
-                </el-table-column>
-                <el-table-column label="物料" align="center" width="220">
-                  <template slot-scope="scope">
-                    <el-popover-select-v2 v-model="annualSaleGoalDetailsList[scope.$index].material" title="物料"
-                      valueKey="name" referName="MATERIAL_PARAM"
-                      @change="setClassify(scope.row.oneLevelClassify, scope.row.twoLevelClassify, annualSaleGoalDetailsList[scope.$index])"
-                      :dataMapping="{ materialCode: 'code', material: 'name', oneLevelClassify: 'oneClass', twoLevelClassify: 'twoClass'}"
-                      :source.sync="annualSaleGoalDetailsList[scope.$index]" placeholder="请输入物料">
-                    </el-popover-select-v2>
-                  </template>
-                </el-table-column>
-                <el-table-column label="合计(元)" align="center" prop="totalGoal" width="180">
-                  <template slot-scope="scope">
-                    <el-input v-model="annualSaleGoalDetailsList[scope.$index].totalGoal" disabled></el-input>
-                  </template>
-                </el-table-column>
-                <el-table-column label="一月(元)" align="center" prop="januaryGoal" width="220">
-                  <template slot-scope="scope">
-                    <el-input-number
-                      @change="computeTotalDetails(scope.$index, annualSaleGoalDetailsList[scope.$index])"
-                      v-model="annualSaleGoalDetailsList[scope.$index].januaryGoal" :precision="2" :step="0.1" :min="0">
-                    </el-input-number>
-                  </template>
-                </el-table-column>
-                <el-table-column label="二月(元)" align="center" prop="februaryGoal" width="220">
-                  <template slot-scope="scope">
-                    <el-input-number
-                      @change="computeTotalDetails(scope.$index, annualSaleGoalDetailsList[scope.$index])"
-                      v-model="annualSaleGoalDetailsList[scope.$index].februaryGoal" :precision="2" :step="0.1"
-                      :min="0">
-                    </el-input-number>
-                  </template>
-                </el-table-column>
-                <el-table-column label="三月(元)" align="center" prop="marchGoal" width="220">
-                  <template slot-scope="scope">
-                    <el-input-number
-                      @change="computeTotalDetails(scope.$index, annualSaleGoalDetailsList[scope.$index])"
-                      v-model="annualSaleGoalDetailsList[scope.$index].marchGoal" :precision="2" :step="0.1" :min="0">
-                    </el-input-number>
-                  </template>
-                </el-table-column>
-                <el-table-column label="四月(元)" align="center" prop="aprilGoal" width="220">
-                  <template slot-scope="scope">
-                    <el-input-number
-                      @change="computeTotalDetails(scope.$index, annualSaleGoalDetailsList[scope.$index])"
-                      v-model="annualSaleGoalDetailsList[scope.$index].aprilGoal" :precision="2" :step="0.1" :min="0">
-                    </el-input-number>
-                  </template>
-                </el-table-column>
-                <el-table-column label="五月(元)" align="center" prop="mayGoal" width="220">
-                  <template slot-scope="scope">
-                    <el-input-number
-                      @change="computeTotalDetails(scope.$index, annualSaleGoalDetailsList[scope.$index])"
-                      v-model="annualSaleGoalDetailsList[scope.$index].mayGoal" :precision="2" :step="0.1" :min="0">
-                    </el-input-number>
-                  </template>
-                </el-table-column>
-                <el-table-column label="六月(元)" align="center" prop="juneGoal" width="220">
-                  <template slot-scope="scope">
-                    <el-input-number
-                      @change="computeTotalDetails(scope.$index, annualSaleGoalDetailsList[scope.$index])"
-                      v-model="annualSaleGoalDetailsList[scope.$index].juneGoal" :precision="2" :step="0.1" :min="0">
-                    </el-input-number>
-                  </template>
-                </el-table-column>
-                <el-table-column label="七月(元)" align="center" prop="julyGoal" width="220">
-                  <template slot-scope="scope">
-                    <el-input-number
-                      @change="computeTotalDetails(scope.$index, annualSaleGoalDetailsList[scope.$index])"
-                      v-model="annualSaleGoalDetailsList[scope.$index].julyGoal" :precision="2" :step="0.1" :min="0">
-                    </el-input-number>
-                  </template>
-                </el-table-column>
-                <el-table-column label="八月(元)" align="center" prop="augustGoal" width="220">
-                  <template slot-scope="scope">
-                    <el-input-number
-                      @change="computeTotalDetails(scope.$index, annualSaleGoalDetailsList[scope.$index])"
-                      v-model="annualSaleGoalDetailsList[scope.$index].augustGoal" :precision="2" :step="0.1" :min="0">
-                    </el-input-number>
-                  </template>
-                </el-table-column>
-                <el-table-column label="九月(元)" align="center" prop="septemberGoal" width="220">
-                  <template slot-scope="scope">
-                    <el-input-number
-                      @change="computeTotalDetails(scope.$index, annualSaleGoalDetailsList[scope.$index])"
-                      v-model="annualSaleGoalDetailsList[scope.$index].septemberGoal" :precision="2" :step="0.1"
-                      :min="0">
-                    </el-input-number>
-                  </template>
-                </el-table-column>
-                <el-table-column label="十月(元)" align="center" prop="octoberGoal" width="220">
-                  <template slot-scope="scope">
-                    <el-input-number
-                      @change="computeTotalDetails(scope.$index, annualSaleGoalDetailsList[scope.$index])"
-                      v-model="annualSaleGoalDetailsList[scope.$index].octoberGoal" :precision="2" :step="0.1" :min="0">
-                    </el-input-number>
-                  </template>
-                </el-table-column>
-                <el-table-column label="十一月(元)" align="center" prop="novemberGoal" width="220">
-                  <template slot-scope="scope">
-                    <el-input-number
-                      @change="computeTotalDetails(scope.$index, annualSaleGoalDetailsList[scope.$index])"
-                      v-model="annualSaleGoalDetailsList[scope.$index].novemberGoal" :precision="2" :step="0.1"
-                      :min="0">
-                    </el-input-number>
-                  </template>
-                </el-table-column>
-                <el-table-column label="十二月(元)" align="center" prop="decemberGoal" width="220">
-                  <template slot-scope="scope">
-                    <el-input-number
-                      @change="computeTotalDetails(scope.$index, annualSaleGoalDetailsList[scope.$index])"
-                      v-model="annualSaleGoalDetailsList[scope.$index].decemberGoal" :precision="2" :step="0.1"
-                      :min="0">
-                    </el-input-number>
-                  </template>
-                </el-table-column>
-                <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120px"
-                  fixed="right">
-                  <template slot-scope="scope">
-                    <el-button size="mini" type="text" icon="el-icon-delete"
-                      @click="handleDeleteDetails(scope.$index, scope.row)">删除</el-button>
-                    <el-button size="mini" type="text" icon="el-icon-delete" @click="handleCopyDetails(scope.row)">复制
-                    </el-button>
-                  </template>
-                </el-table-column>
-              </el-table>
-
-            </el-tab-pane>
-          </el-tabs>
-          <div slot="footer" class="dialog-footer" style="margin-left: 88%; margin-top: 1%">
-            <el-button type="primary" @click="submitForm" size="medium">确 定</el-button>
-            <el-button @click="cancel" size="medium">返 回</el-button>
-          </div>
-        </div>
-      </el-form>
-    </el-drawer>
-    <!-- 批量修改对话框-->
-    <el-dialog title="批量修改" width="30%" :visible.sync="dialogUpdateMore.dialogFormVisible" append-to-body
-      @closed="resetDialogUpdateMore">
-      <el-form>
-        <el-form-item label="修改项" label-width="100px">
-          <el-select @change="changeDialogData" v-model="dialogUpdateMore.updateName" placeholder="请选择需要批量修改的字段">
-            <el-option v-for="item in dialogUpdateMore.optionList" :key="item.value" :label="item.label"
-              :value="item.value"></el-option>
-          </el-select>
-        </el-form-item>
-        <el-form-item label="修改值" label-width="100px">
-          <el-popover-select-v2 v-if="dialogUpdateMore.updateName === 1" v-model="dialogUpdateMore.updateData"
-            title="销售组织" valueKey="name" referName="ORG_PARAM" :dataMapping="{updateData: 'name'}"
-            :source.sync="dialogUpdateMore" placeholder="请输入销售组织">
-          </el-popover-select-v2>
-          <el-popover-select-v2 v-else-if="dialogUpdateMore.updateName === 2" v-model="dialogUpdateMore.updateData"
-            title="销售区域" valueKey="name" referName="MK_SALESAREA_PARAM" :dataMapping="{updateData: 'name'}"
-            :source.sync="dialogUpdateMore" placeholder="请输入销售区域">
-          </el-popover-select-v2>
-          <el-popover-select-v2 v-else-if="dialogUpdateMore.updateName === 3" v-model="dialogUpdateMore.updateData"
-            title="客户" valueKey="name" referName="CUSTOMER_PARAM" :dataMapping="{updateData: 'name'}"
-            :source.sync="dialogUpdateMore" placeholder="请输入客户">
-          </el-popover-select-v2>
-          <el-popover-select-v2 v-else-if="dialogUpdateMore.updateName === 4" v-model="dialogUpdateMore.updateData"
-            title="制单人" valueKey="name" referName="CONTACTS_PARAM" :dataMapping="{updateData: 'name'}"
-            :source.sync="dialogUpdateMore" placeholder="请输入制单人">
-          </el-popover-select-v2>
-          <el-input v-else placeholder="请输入修改项" disabled></el-input>
-        </el-form-item>
-      </el-form>
-      <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="dialogUpdateMoreSave">确 定</el-button>
-      </div>
-    </el-dialog>
-  </div>
+    <annualSaleGoal-details
+      ref="AnnualSaleGoalDetails"
+      :dict="dict"
+      :size="size"
+      :addType="addType"
+      :data="rowDetails"
+      @refresh="getList(params, page)"
+    ></annualSaleGoal-details>
+  </el-card>
 </template>
 
 <script>
-  import {
-    listAnnualSaleGoal,
-    getAnnualSaleGoal,
-    delAnnualSaleGoal,
-    addAnnualSaleGoal,
-    updateAnnualSaleGoal,
-    submit,
-    resubmit,
-  } from "@/api/business/spd/goal_management/annualSaleGoal";
-  import {
-    delAnnualSaleGoalDetails,
-    getAnnualSaleGoalDetails,
-    importData
-  } from "@/api/business/spd/goal_management/annualSaleGoalDetails"
-  import {
-    getToken
-  } from "@/utils/auth";
-  import {
-    getSummary
-  } from "@/api/business/spd/goal_management/commonWays";
-  import {
-    rollBack
-  } from "@/api/business/spd/goal_management/publicInterface";
+import { dicts } from "./common/dicts";
+import useColumns from "./common/AnnualSaleGoal/columns";
+import {
+  listAnnualSaleGoal,
+  delAnnualSaleGoal,
+  submit,
+} from "@/api/business/spd/goal_management/annualSaleGoal";
 
-  // 树形参照
-  import TreeRefers from '@/components/Refers/treeRefer.vue'
-  import ElPopoverSelectV2 from "@/components/popover-select-v2"
+import { rollBack } from "@/api/business/spd/goal_management/publicInterface";
 
-  export default {
-    name: "AnnualSaleGoal",
-    dicts: ["sys_status", "oa_templete_id"],
-    components: {
-      TreeRefers,
-      ElPopoverSelectV2
-    },
-    data() {
-      return {
-        // 遮罩层
-        loading: true,
-        // 选中数组
-        ids: [],
-        // 非单个禁用
-        single: true,
-        // 非多个禁用
-        multiple: true,
-        // 显示搜索条件
-        showSearch: false,
-        // 总条数
-        total: 0,
-        // 年度销售目标表格数据
-        annualSaleGoalList: [],
-        // 弹出层标题
-        title: "",
-        // 是否显示弹出层
-        open: false,
-        // 查询参数
-        queryParams: {
-          pageNum: 1,
-          pageSize: 10,
-          code: null,
-          goalName: null,
-          documentDate: null,
-          annual: null,
-          customCode: null,
-          custom: null,
-          saleZoneCode: null,
-          saleZone: null,
-          creatorCode: null,
-          creator: null,
-          deptId: null,
-          dept: null,
-          goalTotal: null,
-          notes: null,
-          status: null,
-          delFlag: null,
-          documentDateRange: null
-        },
-        pickerOptions: {
-          shortcuts: [{
-            text: '最近一周',
-            onClick(picker) {
-              const end = new Date();
-              const start = new Date();
-              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
-              picker.$emit('pick', [start, end]);
-            }
-          }, {
-            text: '最近一个月',
-            onClick(picker) {
-              const end = new Date();
-              const start = new Date();
-              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
-              picker.$emit('pick', [start, end]);
-            }
-          }, {
-            text: '最近三个月',
-            onClick(picker) {
-              const end = new Date();
-              const start = new Date();
-              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
-              picker.$emit('pick', [start, end]);
-            }
-          }]
-        },
-        // 表单参数
-        form: {
-          id: null,
-          code: null,
-          goalName: null,
-          documentDate: null,
-          annual: null,
-          customCode: null,
-          custom: null,
-          saleZoneCode: null,
-          saleZone: null,
-          creatorCode: null,
-          creator: null,
-          deptId: null,
-          dept: null,
-          goalTotal: null,
-          notes: null,
-          status: '开立态',
-          deleteStatus: 0,
-          annualGoalMergeDetails: []
-        },
-        formDetails: {
-          id: null,
-          code: null,
-          saleOrg: null,
-          saleZone: null,
-          custom: null,
-          creator: null,
-          oneLevelClassifyCode: null,
-          oneLevelClassify: null,
-          twoLevelClassifyCode: null,
-          twoLevelClassify: null,
-          materialCode: null,
-          material: null,
-          totalGoal: null,
-          januaryGoal: null,
-          februaryGoal: null,
-          marchGoal: null,
-          aprilGoal: null,
-          mayGoal: null,
-          juneGoal: null,
-          julyGoal: null,
-          augustGoal: null,
-          septemberGoal: null,
-          octoberGoal: null,
-          novemberGoal: null,
-          decemberGoal: null
-        },
-        // 表单校验
-        rules: {
-          documentDate: [{
-            required: true,
-            message: '单据日期不能为空',
-            trigger: 'blur'
-          }],
-          annual: [{
-            required: true,
-            message: '年度不能为空',
-            trigger: 'blur'
-          }],
-          custom: [{
-            required: true,
-            message: '客户不能为空',
-            trigger: 'blur'
-          }],
-          saleZone: [{
-            required: true,
-            message: '销售区域不能为空',
-            trigger: 'blur'
-          }],
-          creator: [{
-            required: true,
-            message: '制单人不能为空',
-            trigger: 'blur'
-          }],
-          dept: [{
-            required: true,
-            message: '部门不能为空',
-            trigger: 'blur'
-          }]
-        },
-        // 子表数组
-        annualSaleGoalDetailsList: [],
-        // 用户导入参数
-        upload: {
-          // 是否显示弹出层(用户导入)
-          open: false,
-          // 弹出层标题(用户导入)
-          title: "",
-          // 是否禁用上传
-          isUploading: false,
-          // 是否更新已经存在的用户数据
-          updateSupport: 0,
-          // 设置上传的请求头部
-          headers: {
-            Authorization: "Bearer " + getToken()
-          },
-          // 上传的地址
-          url: process.env.VUE_APP_BASE_API + "/goal_management/annualSaleGoal/importData"
-        },
-        activeName: 'annualSaleGoalDetails',
-        dialogUpdateMore: {
-          updateName: null,
-          dialogFormVisible: false,
-          updateData: null,
-          optionList: [{
-            value: 1,
-            label: '销售组织'
-          }, {
-            value: 2,
-            label: '销售区域'
-          }, {
-            value: 3,
-            label: '客户'
-          }, {
-            value: 4,
-            label: '制单人'
-          }, ]
-        },
-        //打开状态
-        openStatus: null,
-      };
-    },
-    created() {
-      console.log(this.$store.state.user, 'this.$store.state.user')
-      this.getList();
-    },
-    methods: {
-      /** 查询年度销售目标列表 */
-      getList() {
+export default {
+  name: "AnnualSaleGoal",
+  dicts: [...dicts, "oa_templete_id"],
+  components: {
+    ElSuperSearch: () => import("@/components/super-search/index.vue"),
+    ElSuperUxTable: () => import("@/components/super-ux-table/index.vue"),
+    AnnualSaleGoalDetails: () =>
+      import("./common/AnnualSaleGoal/details/index.vue"),
+  },
+  data() {
+    const { SearchColumns, TableColumns } = useColumns();
+    const params = this.$init.params(SearchColumns);
+    const page = this.$init.page();
+    return {
+      page,
+      params,
+      TableColumns,
+      SearchColumns,
+      size: "mini",
+      // 遮罩层
+      loading: false,
+      tableData: [],
+      rowDetails: {},
+      addType: "add",
+    };
+  },
+  created() {
+    this.getList(this.params, this.page);
+  },
+  methods: {
+    /** 查询年度销售目标列表 */
+    async getList(params, page) {
+      try {
         this.loading = true;
-        listAnnualSaleGoal(this.queryParams).then(response => {
-          this.annualSaleGoalList = response.rows;
-          this.total = response.total;
-          this.loading = false;
-          this.annualSaleGoalList.forEach(item => {
-            item.goalTotal = item.goalTotal.toFixed(2);
-          })
-          console.log(this.annualSaleGoalList);
-        });
-      },
-      getListDetails() {
-        this.loading = true
-        getAnnualSaleGoalDetails(this.form.id).then(response => {
-          this.annualSaleGoalDetailsList = response.data
-          this.computeTotal()
-          this.form.annualGoalMergeDetails = this.annualSaleGoalDetailsList
-          updateAnnualSaleGoal(this.form).then(response => {})
-          this.loading = false
-        })
-      },
-      // 取消按钮
-      cancel() {
-        this.open = false;
-        this.reset();
-      },
-      // 表单重置
-      reset() {
-        this.form = {
-          id: null,
-          code: null,
-          goalName: null,
-          documentDate: null,
-          annual: null,
-          customCode: null,
-          custom: null,
-          saleZoneCode: null,
-          saleZone: null,
-          creatorCode: null,
-          creator: null,
-          deptId: null,
-          dept: null,
-          goalTotal: null,
-          notes: null,
-          status: null,
-          deleteStatus: null
-        };
-        this.resetForm("form");
-      },
-      /** 搜索按钮操作 */
-      handleQuery() {
-        this.queryParams.pageNum = 1;
-        this.getList();
-      },
-      /** 重置按钮操作 */
-      resetQuery() {
-        this.queryParams = {
-          pageNum: 1,
-          pageSize: 10,
-          code: null,
-          goalName: null,
-          documentDate: null,
-          annual: null,
-          customCode: null,
-          custom: null,
-          saleZoneCode: null,
-          saleZone: null,
-          creatorCode: null,
-          creator: null,
-          deptId: null,
-          dept: null,
-          goalTotal: null,
-          notes: null,
-          status: null,
-          delFlag: null,
-          documentDateRange: null
-        }
-        this.resetForm("queryForm");
-        this.handleQuery();
-      },
-      // 多选框选中数据
-      handleSelectionChange(selection) {
-        this.ids = selection.map(item => item.id)
-        this.single = selection.length !== 1
-        this.multiple = !selection.length
-      },
-      /** 新增按钮操作 */
-      handleAdd() {
-        this.openStatus = 'edit';
-        this.reset();
-        this.title = "添加--年度销售目标";
-        this.annualSaleGoalDetailsList = []
-        this.open = true;
-        this.form.documentDate = new Date().getFullYear().toString() + '-' + (new Date().getMonth() + 1).toString()
-          .padStart(2, '0') + '-' + new Date().getDate().toString().padStart(2, '0')
-        this.form.annual = new Date().getFullYear().toString()
-        this.form.creatorCode = this.$store.state.user.name
-        this.form.creator = this.$store.state.user.nickName
-        this.form.deptId = this.$store.state.user.deptId
-        this.form.dept = this.$store.state.user.deptName
-      },
-      handleAddDetails() {
-        let list = {
-          id: null,
-          code: null,
-          saleOrg: this.$store.state.user.orgName,
-          saleZone: this.form.saleZone,
-          custom: this.form.custom,
-          creator: this.form.creator,
-          oneLevelClassifyCode: null,
-          oneLevelClassify: null,
-          twoLevelClassifyCode: null,
-          twoLevelClassify: null,
-          materialCode: null,
-          material: null,
-          totalGoal: '0.00',
-          januaryGoal: null,
-          februaryGoal: null,
-          marchGoal: null,
-          aprilGoal: null,
-          mayGoal: null,
-          juneGoal: null,
-          julyGoal: null,
-          augustGoal: null,
-          septemberGoal: null,
-          octoberGoal: null,
-          novemberGoal: null,
-          decemberGoal: null
-        }
-        this.annualSaleGoalDetailsList.push(list)
-        this.computeTotal()
-      },
-      /** 修改按钮操作 */
-      handleUpdate(row) {
-        this.openStatus = 'edit';
-        this.reset();
-        const id = row.id || this.ids
-        getAnnualSaleGoal(id).then(response => {
-          this.form = response.data;
-          this.saveFormTwoPoint(this.form)
-          this.annualSaleGoalDetailsList = this.form.annualGoalMergeDetails
-          this.open = true;
-          this.title = "修改--年销售目标填报";
+        let { code, rows, total } = await listAnnualSaleGoal({
+          ...params,
+          ...page,
         });
-      },
-      // 复制按钮
-      handleCopy(id) {
-        this.openStatus = 'edit';
-        this.reset();
-        getAnnualSaleGoal(id).then(response => {
-          console.log(response);
-          this.form = response.data;
-          this.form.id = null
-          this.form.code = null
-          this.form.documentDate = new Date().getFullYear().toString() + '-' + (new Date().getMonth() + 1)
-            .toString().padStart(2, '0') + '-' + new Date().getDate().toString().padStart(2, '0')
-          this.form.annual = new Date().getFullYear().toString()
-          this.saveFormTwoPoint(this.form)
-          this.annualSaleGoalDetailsList = JSON.parse(JSON.stringify(this.form.annualGoalMergeDetails))
-          for (const element of this.annualSaleGoalDetailsList) {
-            element.id = null
-            element.code = null
-          }
-          this.open = true;
-          this.title = "新增--年度销售目标";
-          console.log(this.form);
-        })
-      },
-      // 进入修改复制界面保留两位小数
-      saveFormTwoPoint(form) {
-        form.goalTotal = form.goalTotal.toFixed(2)
-        for (const element of form.annualGoalMergeDetails) {
-          element.totalGoal = element.totalGoal.toFixed(2)
-        }
-      },
-      /** 提交按钮 */
-      submitForm() {
-        // 明细行赋值
-        for (let i = 0; i < this.annualSaleGoalDetailsList.length; i++) {
-          this.annualSaleGoalDetailsList[i].saleOrg = this.$store.state.user.orgName;
-          this.annualSaleGoalDetailsList[i].saleZone = this.form.saleZone;
-          this.annualSaleGoalDetailsList[i].custom = this.form.custom;
-          this.annualSaleGoalDetailsList[i].creator = this.form.creator;
+        if (code == 200) {
+          this.tableData = rows;
+          this.page.total = total;
         }
-        if (this.justiceDetailsList()) {
-          return this.$message.error('子表有必填字段未填,或者目标值为0')
-        }
-        for (let i = 0; i < this.annualSaleGoalDetailsList.length; i++) {
-          for (let j = i + 1; j < this.annualSaleGoalDetailsList.length; j++) {
-            if (this.annualSaleGoalDetailsList[i].materialCode == this.annualSaleGoalDetailsList[j].materialCode &&
-              this.annualSaleGoalDetailsList[i].materialCode != null &&
-              this.annualSaleGoalDetailsList[j].materialCode != null &&
-              this.annualSaleGoalDetailsList[i].materialCode != "" &&
-              this.annualSaleGoalDetailsList[j].materialCode != "") {
-              return this.$message.error('子表存在重复物料');
+      } catch (error) {
+      } finally {
+        this.loading = false;
+      }
+    },
+    //
+    useReset() {
+      this.params = this.$init.params(this.SearchColumns);
+      this.page = this.$init.page();
+      this.getList(this.params, this.page);
+    },
+    //
+    useSee(row) {
+      this.addType = "see";
+      this.rowDetails = row;
+      const { setVisible } = this.$refs.AnnualSaleGoalDetails;
+      setVisible(true);
+    },
+    // 新增
+    handleAdd() {
+      this.addType = "add";
+      this.rowDetails = {};
+      const { setVisible } = this.$refs.AnnualSaleGoalDetails;
+      setVisible(true);
+    },
+    // 编辑
+    useEdit(row) {
+      this.addType = "edit";
+      this.rowDetails = row;
+      const { setVisible } = this.$refs.AnnualSaleGoalDetails;
+      setVisible(true);
+    },
+    // 删除
+    useDelete(row) {
+      const { id, code } = row;
+      this.$modal
+        .confirm('是否确认删除年销售目标填报单据编号为"' + code + '"的数据项?')
+        .then(async () => {
+          try {
+            let { code, msg } = await delAnnualSaleGoal(id);
+            if (code == 200) {
+              this.$notify.success(msg);
+              this.getList(this.params, this.page);
             }
-          }
-        }
-        this.annualSaleGoalDetailsList.forEach(item => {
-          if (item.oneLevelClassify == null || item.oneLevelClassify == "") {
-            item.oneLevelClassifyCode = null;
-          }
-          if (item.twoLevelClassify == null || item.twoLevelClassify == "") {
-            item.twoLevelClassifyCode = null;
-          }
+          } catch (error) {}
         })
-        this.$refs["form"].validate(valid => {
-          if (valid) {
-            if (this.form.id != null) {
-              this.form.annualGoalMergeDetails = JSON.parse(JSON.stringify(this.annualSaleGoalDetailsList))
-              updateAnnualSaleGoal(this.form).then(response => {
-                this.$modal.msgSuccess("修改成功");
-                this.open = false;
-                this.getList();
-              });
-            } else {
-              this.form.status = '0'
-              this.form.annualGoalMergeDetails = JSON.parse(JSON.stringify(this.annualSaleGoalDetailsList))
-              console.log(this.form);
-              addAnnualSaleGoal(this.form).then(response => {
-                this.$modal.msgSuccess("新增成功");
-                this.open = false;
-                this.getList();
-              });
-            }
-          }
-        });
-      },
-      /** 删除按钮操作 */
-      handleDelete(row) {
-        const ids = row.id || this.ids;
-        this.$modal.confirm('是否确认删除年销售目标填报单据编号为"' + row.code + '"的数据项?').then(function () {
-          return delAnnualSaleGoal(ids);
-        }).then(() => {
-          this.getList();
-          this.$modal.msgSuccess("删除成功");
-        }).catch(() => {});
-      },
-      handleDeleteDetails(index, row) {
-        if (this.form.id === null) {
-          this.annualSaleGoalDetailsList.splice(index, 1)
-          this.computeTotal()
-        } else {
-          if (row.id !== null) {
-            this.$modal.confirm('是否确认删除年度销售目标明细序号为"' + (index + 1) + '"的数据项?').then(function () {
-              return delAnnualSaleGoalDetails(row.id)
-            }).then(() => {
-              this.getListDetails()
-              this.$modal.msgSuccess('删除成功')
-            }).catch(() => {})
-          } else {
-            this.annualSaleGoalDetailsList.splice(index, 1)
-            this.$message.success('删除成功')
-            this.computeTotal()
-          }
-        }
-      },
-      /** 导出按钮操作 */
-      handleExport() {
-        this.download('goal_management/annualSaleGoal/export', {
-          ...this.queryParams
-        }, `annualSaleGoal_${new Date().getTime()}.xlsx`)
-      },
-      handleExportDetails() {
-        this.download('goal_management/annualSaleGoalDetails/export', {
-          ...this.queryParams
-        }, `annualSaleGoalMerge_${new Date().getTime()}.xlsx`)
-      },
-      handleClose(done) {
-        this.$confirm('确认关闭?')
-          .then(_ => {
-            done();
-            this.reset()
-          })
-          .catch(_ => {});
-      },
-      // 复制明细
-      handleCopyDetails(row) {
-        let list = {
-          id: null,
-          code: row.code,
-          saleOrg: row.saleOrg,
-          saleZone: row.saleZone,
-          custom: row.custom,
-          creator: row.creator,
-          oneLevelClassifyCode: row.oneLevelClassifyCode,
-          oneLevelClassify: row.oneLevelClassify,
-          twoLevelClassifyCode: row.oneLevelClassifyCode,
-          twoLevelClassify: row.twoLevelClassify,
-          materialCode: row.materialCode,
-          material: row.material,
-          totalGoal: row.totalGoal,
-          januaryGoal: row.januaryGoal,
-          februaryGoal: row.februaryGoal,
-          marchGoal: row.marchGoal,
-          aprilGoal: row.aprilGoal,
-          mayGoal: row.mayGoal,
-          juneGoal: row.juneGoal,
-          julyGoal: row.julyGoal,
-          augustGoal: row.augustGoal,
-          septemberGoal: row.septemberGoal,
-          octoberGoal: row.octoberGoal,
-          novemberGoal: row.novemberGoal,
-          decemberGoal: row.decemberGoal
-        }
-        this.annualSaleGoalDetailsList.push(list)
-        this.computeTotal()
-      },
-      // 计算子表合计
-      computeTotalDetails(index, row) {
-        let array = [row.januaryGoal, row.februaryGoal, row.marchGoal, row.aprilGoal, row.mayGoal, row.juneGoal, row
-          .julyGoal, row.augustGoal, row.septemberGoal, row.octoberGoal, row.novemberGoal, row.decemberGoal
-        ]
-        let sum = 0
-        for (const element of array) {
-          sum = (sum * 1000000 + element * 1000000) / 1000000
-        }
-        this.annualSaleGoalDetailsList[index].totalGoal = sum.toFixed(2)
-        this.computeTotal()
-      },
-      // 计算主表合计
-      computeTotal() {
-        let list = this.annualSaleGoalDetailsList
-        let sum = 0
-        for (const listElement of list) {
-          sum = (sum * 1000000 + listElement.totalGoal * 1000000) / 1000000
-        }
-        this.form.goalTotal = sum.toFixed(2)
-      },
-      getSummaries(param) {
-        return getSummary(param)
-      },
-      // 给table添加必填项
-      addRedStar(h, {
-        column
-      }, required) {
-        if (required === '0') {
-          return [
-            h('span', {
-              style: 'color: #F56C6C'
-            }, '*'),
-            h('span', '' + column.label)
-          ]
-        } else {
-          return [
-            // h('span', { style: 'color: #F56C6C' }, '*'),
-            h('span', '' + column.label)
-          ]
-        }
-      },
-      // 判断子表的字段是否都填了
-      justiceDetailsList() {
-        let isFlag = [];
-        const arr = JSON.parse(JSON.stringify(this.annualSaleGoalDetailsList))
-        for (const element of arr) {
-          const flag1 = (element.saleZone !== null) && (element.saleOrg !== null) && (element.custom !== null) && (
-            element.creator !== null) && (element.goalValue !== 0)
-          const flag2 = (element.saleOrg !== undefined) && (element.saleZone !== undefined) && (element.custom !==
-            undefined) && (element.creator !== undefined)
-          if (flag1 && flag2) {
-            isFlag.push(true);
-          } else {
-            isFlag.push(false);
-          }
-        }
-        for (const flag of isFlag) {
-          if (!flag) {
-            return true;
-          }
-        }
-      },
-      handleCommand(command) {
-        // 执行对应的功能
-        if (command === 'export') {
-          console.log('导出主表');
-          this.handleExport()
-        } else if (command === 'exportDetails') {
-          console.log('导出明细');
-          this.handleExportDetails()
-        }
-      },
-      // 选择物料后,给一级分类和二级分类复赋值
-      setClassify(one, two, obj) {
-        const oneArray = one.split("&")
-        const twoArray = two.split("&")
-        obj.oneLevelClassifyCode = oneArray[1]
-        obj.oneLevelClassify = oneArray[0]
-        obj.twoLevelClassifyCode = twoArray[1]
-        obj.twoLevelClassify = twoArray[0]
-        console.log(obj, 'obj');
-      },
-      // 批量修改对话框的方法
-      dialogUpdateMoreSave() {
-        console.log(this.dialogUpdateMore);
-        if (this.dialogUpdateMore.updateData === null) {
-          return this.$message.error('请输入修改值')
-        }
-        const array = JSON.parse(JSON.stringify(this.annualSaleGoalDetailsList))
-        if (array.length !== 0) {
-          let condition = this.dialogUpdateMore.updateName
-          for (const element of array) {
-            if (condition === 1) {
-              element.saleOrg = JSON.parse(JSON.stringify(this.dialogUpdateMore.updateData))
-            } else if (condition === 2) {
-              element.saleZone = JSON.parse(JSON.stringify(this.dialogUpdateMore.updateData))
-            } else if (condition === 3) {
-              element.custom = JSON.parse(JSON.stringify(this.dialogUpdateMore.updateData))
-            } else if (condition === 4) {
-              element.creator = JSON.parse(JSON.stringify(this.dialogUpdateMore.updateData))
-            }
-          }
-        }
-        this.annualSaleGoalDetailsList = array
-        this.dialogUpdateMore.dialogFormVisible = !this.dialogUpdateMore.dialogFormVisible
-        this.dialogUpdateMore.updateData = null
-        this.dialogUpdateMore.updateName = null
-      },
-      changeDialogData() {
-        this.dialogUpdateMore.updateData = null
-      },
-      resetDialogUpdateMore() {
-        this.dialogUpdateMore.updateName = null
-        this.dialogUpdateMore.updateData = null
-      },
-      //提交
-      async handleSubmit(row) {
-        this.$modal.loading("提交中...");
-        try {
-          const {
-            msg,
-            code
-          } = await submit(row.id);
-          if (code === 200) {
-            this.$modal.notifySuccess("提交成功");
-            this.$modal.closeLoading();
-            row.status = '1';
-          }
-        } catch (err) {
-          console.error(err);
-          this.$modal.closeLoading();
-        }
-      },
-      //重新提交
-      async handleResubmit(row) {
-        this.$modal.loading("提交中...");
-        try {
-          const {
-            msg,
-            code
-          } = await resubmit(row.id);
-          if (code === 200) {
-            this.$modal.notifySuccess("提交成功");
-            this.$modal.closeLoading();
-          }
-        } catch (err) {
-          console.error(err);
-          this.$modal.closeLoading();
+        .catch(() => {});
+    },
+    // 提交
+    async useSubmit(row) {
+      try {
+        this.$modal.loading("处理中,请稍后...");
+        const { msg, code } = await submit(row.id);
+        if (code === 200) {
+          this.$modal.notifySuccess(msg);
+          row.status = "1";
         }
-      },
-      //收回
-      handleReback(row) {
-        this.$modal.loading("收回中...");
+      } catch (err) {
+        console.error(err);
+      } finally {
+        this.$modal.closeLoading();
+      }
+    },
+    // 收回
+    async useReback(row) {
+      try {
+        this.$modal.loading("处理中,请稍后...");
         let params = {
           billCode: row.code,
           fdId: row.flowId,
-          fdTemplateId: this.dict.type.oa_templete_id.find(item => {
-            return item.label == "销售目标"
+          fdTemplateId: this.dict.type.oa_templete_id.find((item) => {
+            return item.label == "销售目标";
           }).value,
           billMaker: row.createBy,
-          type: "1"
+          type: "1",
+        };
+        let { code, msg } = await rollBack(params);
+        if (code == 200) {
+          this.$modal.notifySuccess(msg);
+          this.getList(this.params, this.page);
         }
-        rollBack(params).then(res => {
-          if (res.code === 200) {
-            this.$modal.notifySuccess("收回成功");
-            this.$modal.closeLoading();
-            this.getList(this.queryParams)
-          }
-        }).catch(err => {
-          this.$message.error(err);
-          this.$modal.closeLoading();
-        })
-      },
-      //模板下载
-      handleTemplateDownload() {
-        this.download('/goal_management/annualSaleGoalDetails/importTemplate', {},
-          `年销售目标填报明细导入模板_${new Date().getTime()}.xlsx`)
-      },
-      //导入
-      handleImport(file) {
-        this.loading = true;
-        let formData = new FormData()
-        formData.append('file', file.file)
-        importData(formData).then((res) => {
-          console.log('res', res);
-          if (res.code == '200') {
-            this.annualSaleGoalDetailsList.push.apply(this.annualSaleGoalDetailsList, res.data);
-            this.$message.success(res.msg);
-          } else {
-            this.$message.success(res.msg);
-          }
-          this.loading = false;
-        }).catch((e) => {
-          this.$message.error(e.message)
-        }).finally((e) => {
-          this.$refs['upload'].clearFiles();
-          this.loading = false;
-        })
-      },
-      //双击行
-      useDoubleClick(row) {
-        this.openStatus = 'see';
-        this.reset();
-        const id = row.id || this.ids
-        getAnnualSaleGoal(id).then(response => {
-          this.form = response.data;
-          this.saveFormTwoPoint(this.form)
-          this.annualSaleGoalDetailsList = this.form.annualGoalMergeDetails
-          this.open = true;
-          this.title = "查看--年度销售目标";
-        });
-      },
+      } catch (error) {
+      } finally {
+        this.$modal.closeLoading();
+      }
     },
-  }
-
+    // 导出
+    handleCommand(command) {
+      if (command === "export") {
+        // 导出主表
+        this.download(
+          "goal_management/annualSaleGoal/export",
+          {
+            ...this.params,
+          },
+          `年度销售目标填报_${new Date().getTime()}.xlsx`
+        );
+      }
+      if (command === "exportDetails") {
+        // 导出明细
+        this.download(
+          "goal_management/annualSaleGoalDetails/export",
+          {
+            ...this.params,
+          },
+          `年度销售目标填报明细_${new Date().getTime()}.xlsx`
+        );
+      }
+    },
+  },
+};
 </script>
+
+<style scoped lang="scss">
+.el-card {
+  width: calc(100% - 32px);
+  height: calc(100vh - 32px);
+  margin: 16px;
+  padding: 16px;
+  border-radius: 8px;
+  overflow-y: auto;
+  overflow-x: hidden;
+}
+</style>

+ 42 - 0
src/views/business/spd/target/common/AnnualSaleGoal/batchUpdate/column.js

@@ -0,0 +1,42 @@
+export const Columns = [
+  {
+    item: { key: "saleOrg", title: "销售组织" },
+    attr: {
+      is: "el-popover-select-v2",
+      valueKey: "name",
+      referName: "ORG_PARAM",
+      // dataMapping: { updateData: 'name' },
+      placeholder: "请输入销售组织",
+    },
+  },
+  {
+    item: { key: "saleZone", title: "销售区域" },
+    attr: {
+      is: "el-popover-select-v2",
+      valueKey: "name",
+      referName: "MK_SALESAREA_PARAM",
+      // dataMapping: { updateData: 'name' },
+      placeholder: "请输入销售区域",
+    },
+  },
+  {
+    item: { key: "custom", title: "客户" },
+    attr: {
+      is: "el-popover-select-v2",
+      valueKey: "name",
+      referName: "CUSTOMER_PARAM",
+      // dataMapping: { updateData: 'name' },
+      placeholder: "请输入客户",
+    },
+  },
+  {
+    item: { key: "creator", title: "制单人" },
+    attr: {
+      is: "el-popover-select-v2",
+      valueKey: "name",
+      referName: "CONTACTS_PARAM",
+      // dataMapping: { updateData: 'name' },
+      placeholder: "请输入制单人",
+    },
+  },
+];

+ 115 - 0
src/views/business/spd/target/common/AnnualSaleGoal/batchUpdate/index.vue

@@ -0,0 +1,115 @@
+<script>
+import { Columns } from "./column";
+export default {
+  name: "BatchUpdate",
+  props: {},
+  components: {
+    ElPopoverSelectV2: () => import("@/components/popover-select-v2/index.vue"),
+  },
+  data() {
+    return {
+      title: "批量修改",
+      visible: false,
+      params: {
+        key: null,
+        value: null,
+      },
+      Columns,
+      rules: {
+        key: [{ required: true, message: "修改项不能为空", trigger: "blur" }],
+        value: [{ required: true, message: "修改值不能为空", trigger: "blur" }],
+      },
+    };
+  },
+  computed: {
+    innerValue: {
+      get() {
+        const { Columns, params } = this;
+        return Columns.filter(({ item, attr }) => item.key === params.key)[0];
+      },
+      set() {},
+    },
+  },
+  methods: {
+    open() {
+      this.visible = true;
+    },
+    useConfirm(prop) {
+      this.$refs[prop].validate((valid, obj) => {
+        if (valid) {
+          const { params } = this;
+          if (params.key && params.key != "") {
+            this.$emit("confirm", this.params);
+            this.hide();
+          }
+        } else {
+        }
+      });
+    },
+    hide() {
+      this.params = {
+        key: null,
+        value: null,
+      };
+      this.visible = false;
+    },
+  },
+  created() {},
+};
+</script>
+
+<template>
+  <el-button v-on="$listeners" v-bind="$attrs" @click="open">
+    {{ title }}
+    <el-dialog
+      :title="title"
+      :show-close="false"
+      :visible.sync="visible"
+      width="50%"
+      append-to-body
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+    >
+      <el-form
+        inline
+        ref="form"
+        :rules="rules"
+        :model="params"
+        label-width="80px"
+        :size="$attrs.size"
+      >
+        <el-form-item label="修改项" prop="key">
+          <el-select
+            v-model="params.key"
+            placeholder="请选择"
+          >
+            <el-option
+              v-for="({ item, attr }, index) in Columns"
+              :label="item.title"
+              :value="item.key"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="修改值" prop="value">
+          <component
+            v-if="innerValue"
+            v-bind="innerValue.attr"
+            v-model="params.value"
+            :size="$attrs.size"
+          >
+          </component>
+          <el-input v-else placeholder="请输入修改项" disabled></el-input>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button
+          type="primary"
+          :size="$attrs.size"
+          @click="useConfirm('form')"
+          >确 定</el-button
+        >
+        <el-button :size="$attrs.size" @click="hide">取 消</el-button>
+      </div>
+    </el-dialog>
+  </el-button>
+</template>

+ 198 - 0
src/views/business/spd/target/common/AnnualSaleGoal/columns.js

@@ -0,0 +1,198 @@
+// 年度销售目标填报
+export default function useColumns() {
+  const SearchColumns = [
+    {
+      item: { key: "code", title: "编码" },
+      attr: {
+        is: "el-input",
+        placeholder: "请输入编码",
+        clearable: true,
+      }
+    },
+    {
+      item: { key: "goalName", title: "目标名称" },
+      attr: {
+        is: "el-input",
+        placeholder: "请输入年度销售目标名称",
+        clearable: true,
+      }
+    },
+    {
+      item: { key: "documentDateRange", title: "单据日期" },
+      attr: {
+        is: "el-date-picker",
+        type: "daterange",
+        valueFormat: "yyyy-MM-dd",
+        align: "right",
+        rangeSeparator: "至",
+        startPlaceholder: "开始日期",
+        endPlaceholder: "结束日期",
+        placeholder: "请选择单据日期",
+        pickerOptions: pickerOptions,
+      }
+    },
+    {
+      item: { key: "annual", title: "年度" },
+      attr: {
+        is: "el-date-picker",
+        type: "year",
+        valueFormat: "yyyy",
+        placeholder: "选择年度",
+        clearable: true,
+      }
+    },
+    {
+      item: { key: "custom", title: "客户" },
+      attr: {
+        is: "el-popover-select-v2",
+        valueKey: "name",
+        referName: "CUSTOMER_PARAM",
+        dataMapping: {
+          customCode: 'code',
+        },
+        placeholder: "请输入客户",
+      }
+    },
+    {
+      item: { key: "saleZone", title: "销售区域" },
+      attr: {
+        is: "el-popover-select-v2",
+        valueKey: "name",
+        referName: "MK_SALESAREA_PARAM",
+        dataMapping: {
+          saleZoneCode: 'code',
+        },
+        placeholder: "请输入销售区域",
+      }
+    },
+    {
+      item: { key: "creator", title: "制单人" },
+      attr: {
+        is: "el-popover-select-v2",
+        valueKey: "name",
+        referName: "CONTACTS_PARAM",
+        dataMapping: {
+          creatorCode: 'code',
+        },
+        placeholder: "请输入制单人",
+      }
+    },
+    {
+      item: { key: "dept", title: "部门" },
+      attr: {
+        is: "el-popover-select-v2",
+        valueKey: "name",
+        referName: "DEPT_PARAM",
+        dataMapping: {
+          deptId: 'id',
+        },
+        placeholder: "请输入部门",
+      }
+    },
+    {
+      item: { key: "status", title: "单据状态" },
+      attr: {
+        is: "el-select",
+        dictName: "sys_status",
+        clearable: true,
+      }
+    },
+  ];
+
+  const TableColumns = [
+    {
+      item: { key: "status", title: "状态", width: 100, },
+      attr: {
+        is: "el-dict-tag",
+        dictName: "sys_status",
+      }
+    },
+    {
+      item: { key: "code", title: "编码", },
+      attr: {}
+    },
+    {
+      item: { key: "goalName", title: "目标名称", },
+      attr: {}
+    },
+    {
+      item: { key: "documentDate", title: "单据日期", width: 100, },
+      attr: {}
+    },
+    {
+      item: { key: "annual", title: "年度", width: 100, },
+      attr: {}
+    },
+    {
+      item: { key: "custom", title: "客户", },
+      attr: {}
+    },
+    {
+      item: { key: "saleZone", title: "销售区域", },
+      attr: {}
+    },
+    {
+      item: { key: "creator", title: "制单人", width: 100, },
+      attr: {}
+    },
+    {
+      item: { key: "dept", title: "部门", },
+      attr: {}
+    },
+    {
+      item: { key: "goalTotal", title: "目标合计(元)", },
+      attr: {
+        formatter: (prop) => {
+          return prop.goalTotal ? (prop.goalTotal * 1).toFixed(2) : prop.goalTotal;
+        },
+      }
+    },
+    {
+      item: { key: "notes", title: "备注", },
+      attr: {}
+    },
+
+  ].map(({ item, attr }) => ({
+    attr,
+    item: {
+      ...item,
+      sortabled: true,
+      fixedabled: true,
+      filterabled: true,
+      hiddenabled: true,
+    },
+  }));
+
+  const pickerOptions = {
+    shortcuts: [
+      {
+        text: "最近一周",
+        onClick(picker) {
+          const end = new Date();
+          const start = new Date();
+          start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
+          picker.$emit("pick", [start, end]);
+        },
+      },
+      {
+        text: "最近一个月",
+        onClick(picker) {
+          const end = new Date();
+          const start = new Date();
+          start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
+          picker.$emit("pick", [start, end]);
+        },
+      },
+      {
+        text: "最近三个月",
+        onClick(picker) {
+          const end = new Date();
+          const start = new Date();
+          start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
+          picker.$emit("pick", [start, end]);
+        },
+      },
+    ],
+  }
+  return { SearchColumns, TableColumns }
+}

+ 306 - 0
src/views/business/spd/target/common/AnnualSaleGoal/details/columns.js

@@ -0,0 +1,306 @@
+export default function useColumns() {
+  const FormColumns = [
+    {
+      item: { key: "code", title: "编码", },
+      attr: {
+        is: "el-input",
+        clearable: true,
+        disabled: true,
+        placeholder: "编码后端自动生成",
+      },
+    },
+    {
+      item: { key: "goalName", title: "目标名称", },
+      attr: {
+        is: "el-input",
+        clearable: true,
+        disabled: true,
+        placeholder: "目标名称后端自动生成",
+      },
+    },
+    {
+      item: { key: "documentDate", title: "单据日期", required: true, },
+      attr: {
+        is: "el-date-picker",
+        type: "date",
+        format: "yyyy-MM-dd",
+        placeholder: "选择日期",
+      },
+    },
+    {
+      item: { key: "annual", title: "年度", required: true, },
+      attr: {
+        is: "el-date-picker",
+        type: "year",
+        format: "yyyy",
+        placeholder: "选择年度",
+      },
+    },
+    {
+      item: { key: "custom", title: "客户", required: true, },
+      attr: {
+        is: "el-popover-select-v2",
+        valueKey: "name",
+        referName: "CUSTOMER_PARAM",
+        dataMapping: {
+          customCode: 'code',
+        },
+        placeholder: "请输入客户",
+      },
+    },
+    {
+      item: { key: "saleZone", title: "销售区域", required: true, },
+      attr: {
+        is: "el-popover-select-v2",
+        valueKey: "name",
+        referName: "MK_SALESAREA_PARAM",
+        dataMapping: {
+          saleZoneCode: 'code',
+        },
+        placeholder: "请输入销售区域",
+      },
+    },
+    {
+      item: { key: "creator", title: "制单人", required: true, },
+      attr: {
+        is: "el-popover-select-v2",
+        valueKey: "name",
+        referName: "CONTACTS_PARAM",
+        dataMapping: {
+          creatorCode: 'code',
+        },
+        placeholder: "请输入制单人",
+      },
+    },
+    {
+      item: { key: "dept", title: "部门", required: true, },
+      attr: {
+        is: "el-popover-select-v2",
+        valueKey: "name",
+        referName: "DEPT_PARAM",
+        dataMapping: {
+          deptId: 'id',
+        },
+        placeholder: "请输入部门",
+      },
+    },
+    {
+      item: { key: "goalTotal", title: "目标合计(元)", },
+      attr: {
+        is: "el-input-number",
+        placeholder: "目标合计自动计算",
+        disabled: true,
+        precision: 2,
+        controlsPosition: "right",
+      },
+    },
+    {
+      item: { key: "notes", title: "备注", },
+      attr: {
+        is: "el-input",
+        placeholder: "请输入备注",
+        clearable: true,
+      },
+    },
+    {
+      item: { key: "status", title: "单据状态", },
+      attr: {
+        is: "el-select",
+        dictName: "sys_status",
+        disabled: true,
+      },
+    },
+  ].map(({ item, attr }) => ({
+    attr,
+    item: {
+      ...item,
+      span: item.span || 6
+    },
+  }));
+
+  const TabColumns = [
+    {
+      item: { key: "annualGoalMergeDetails", title: "年销售目标填报明细", },
+      attr: { value: [] },
+      TableColumns: [
+        {
+          item: { key: "oneLevelClassify", title: "一级分类", },
+          attr: {},
+        },
+        {
+          item: { key: "twoLevelClassify", title: "二级分类", },
+          attr: {},
+        },
+        {
+          item: { key: "material", title: "物料", },
+          attr: {
+            is: "el-popover-select-v2",
+            valueKey: "name",
+            referName: "MATERIAL_PARAM",
+            dataMapping: {
+              materialCode: 'code',
+              oneLevelClassify: 'oneClass',
+              // oneLevelClassifyCode: 'oneClass',
+              twoLevelClassify: 'twoClass',
+              // twoLevelClassifyCode: 'twoClass',
+            },
+            placeholder: "请输入物料",
+          },
+        },
+        {
+          item: { key: "totalGoal", title: "合计(元)", },
+          attr: {
+            is: "el-input-number",
+            min: 0,
+            step: 0.1,
+            precision: 2,
+            disabled: true,
+            isSummary: true,
+            // formatter: (prop) => {
+            //   const month = ['januaryGoal', 'februaryGoal', 'marchGoal', 'aprilGoal', 'mayGoal', 'juneGoal',
+            //     'julyGoal', 'augustGoal', 'septemberGoal', 'octoberGoal', 'novemberGoal', 'decemberGoal'];
+
+            //   return month.reduce((sum, item) => {
+            //     return sum += (prop[item] ? prop[item] : 0) * 1
+            //   }, 0).toFixed(2);
+            // },
+          },
+        },
+        {
+          item: { key: "januaryGoal", title: "一月(元)", },
+          attr: {
+            is: "el-input-number",
+            min: 0,
+            step: 0.1,
+            precision: 2,
+            isSummary: true,
+            controlsPosition: "right",
+          },
+        },
+        {
+          item: { key: "februaryGoal", title: "二月(元)", },
+          attr: {
+            is: "el-input-number",
+            min: 0,
+            step: 0.1,
+            precision: 2,
+            isSummary: true,
+            controlsPosition: "right",
+          },
+        },
+        {
+          item: { key: "marchGoal", title: "三月(元)", },
+          attr: {
+            is: "el-input-number",
+            min: 0,
+            step: 0.1,
+            precision: 2,
+            isSummary: true,
+            controlsPosition: "right",
+          },
+        },
+        {
+          item: { key: "aprilGoal", title: "四月(元)", },
+          attr: {
+            is: "el-input-number",
+            min: 0,
+            step: 0.1,
+            precision: 2,
+            isSummary: true,
+            controlsPosition: "right",
+          },
+        },
+        {
+          item: { key: "mayGoal", title: "五月(元)", },
+          attr: {
+            is: "el-input-number",
+            min: 0,
+            step: 0.1,
+            precision: 2,
+            isSummary: true,
+            controlsPosition: "right",
+          },
+        },
+        {
+          item: { key: "juneGoal", title: "六月(元)", },
+          attr: {
+            is: "el-input-number",
+            min: 0,
+            step: 0.1,
+            precision: 2,
+            isSummary: true,
+            controlsPosition: "right",
+          },
+        },
+        {
+          item: { key: "julyGoal", title: "七月(元)", },
+          attr: {
+            is: "el-input-number",
+            min: 0,
+            step: 0.1,
+            precision: 2,
+            isSummary: true,
+            controlsPosition: "right",
+          },
+        },
+        {
+          item: { key: "augustGoal", title: "八月(元)", },
+          attr: {
+            is: "el-input-number",
+            min: 0,
+            step: 0.1,
+            precision: 2,
+            isSummary: true,
+            controlsPosition: "right",
+          },
+        },
+        {
+          item: { key: "septemberGoal", title: "九月(元)", },
+          attr: {
+            is: "el-input-number",
+            min: 0,
+            step: 0.1,
+            precision: 2,
+            isSummary: true,
+            controlsPosition: "right",
+          },
+        },
+        {
+          item: { key: "octoberGoal", title: "十月(元)", },
+          attr: {
+            is: "el-input-number",
+            min: 0,
+            step: 0.1,
+            precision: 2,
+            isSummary: true,
+            controlsPosition: "right",
+          },
+        },
+        {
+          item: { key: "novemberGoal", title: "十一月(元)", },
+          attr: {
+            is: "el-input-number",
+            min: 0,
+            step: 0.1,
+            precision: 2,
+            isSummary: true,
+            controlsPosition: "right",
+          },
+        },
+        {
+          item: { key: "decemberGoal", title: "十二月(元)", },
+          attr: {
+            is: "el-input-number",
+            min: 0,
+            step: 0.1,
+            precision: 2,
+            isSummary: true,
+            controlsPosition: "right",
+          },
+        },
+
+      ],
+    },
+  ];
+  return { FormColumns, TabColumns }
+}

+ 546 - 0
src/views/business/spd/target/common/AnnualSaleGoal/details/index.vue

@@ -0,0 +1,546 @@
+<!-- 年度销售目标填报-详情 -->
+<script>
+import useColumns from "./columns";
+import { importData } from "@/api/business/spd/goal_management/annualSaleGoalDetails";
+import {
+  getAnnualSaleGoal,
+  addAnnualSaleGoal,
+  updateAnnualSaleGoal,
+} from "@/api/business/spd/goal_management/annualSaleGoal";
+
+export default {
+  name: "annualSaleGoalDetails",
+  props: {
+    dict: {
+      type: Object,
+    },
+    data: {
+      type: Object,
+    },
+    addType: {
+      type: String,
+      default: "add",
+    },
+  },
+  components: {
+    BatchUpdate: () => import("../batchUpdate/index.vue"),
+    ElSuperForm: () => import("@/components/super-form/index.vue"),
+    BatchImport: () => import("@/components/BatchImport/index.vue"),
+    ElSuperUxTable: () => import("@/components/super-ux-table/index.vue"),
+    ElPopoverSelectV2: () => import("@/components/popover-select-v2/index.vue"),
+  },
+  data() {
+    const {
+      FormColumns,
+      TabColumns,
+      TabColumns: [
+        {
+          item: { key: tabName },
+        },
+      ],
+    } = useColumns();
+    const params = this.$init.params(FormColumns);
+    const rules = this.$init.rules(FormColumns);
+    return {
+      width: "100%",
+      visible: false,
+      loading: false,
+      params: {
+        ...params,
+        annualGoalMergeDetails: [],
+      },
+      rules,
+      tabName,
+      TabColumns,
+      FormColumns,
+    };
+  },
+  computed: {
+    title: {
+      get() {
+        const { addType } = this.$props;
+        if (addType === "see") {
+          return "查 看";
+        } else if (addType === "edit") {
+          return "编 辑";
+        } else {
+          return "新 增";
+        }
+      },
+      sest() {},
+    },
+    tableHeight: {
+      get() {
+        return window.innerHeight - 320;
+      },
+      set() {},
+    },
+  },
+  methods: {
+    setVisible(prop) {
+      this.visible = prop;
+    },
+    // 关闭
+    hide() {
+      this.visible = false;
+      const {
+        FormColumns,
+        TabColumns: [
+          {
+            item: { key: tabName },
+          },
+        ],
+      } = useColumns();
+      this.params = {
+        ...this.$init.params(FormColumns),
+        annualGoalMergeDetails: [],
+      };
+      this.tabName = tabName;
+      this.$emit("refresh");
+    },
+    //
+    beforeOpen() {
+      const { addType, data } = this.$props;
+      const { name, nickName, deptId, deptName } = this.$store.state.user;
+      if (addType === "add") {
+        this.params = {
+          ...this.params,
+          creator: nickName,
+          creatorCode: name,
+          dept: deptName,
+          deptId,
+          annual: new Date().Format("yyyy"),
+          documentDate: new Date().Format("yyyy-MM-dd"),
+          goalTotal: 0,
+        };
+        this.addRow(this.tabName);
+      } else {
+        this.fetchItem(data);
+      }
+    },
+    //
+    async fetchItem(prop) {
+      try {
+        this.loading = true;
+        const { id } = prop;
+        let { code, data } = await getAnnualSaleGoal(id);
+        if (code == 200) {
+          this.params = data;
+        }
+      } catch (error) {
+      } finally {
+        this.loading = false;
+      }
+    },
+    // 保存
+    useSave(prop) {
+      console.log(this.params, "params");
+      this.$refs[prop].validate(async (valid, obj) => {
+        if (valid) {
+          try {
+            const {
+              params,
+              params: { saleZone, custom, creator },
+              $props: { addType },
+            } = this;
+            const { orgName: saleOrg } = this.$store.state.user;
+            const data = {
+              ...params,
+              annualGoalMergeDetails: params.annualGoalMergeDetails.map(
+                (item) => ({
+                  ...item,
+                  saleOrg: item.saleOrg ? item.saleOrg : orgName,
+                  saleZone: item.saleZone ? item.saleZone : saleZone,
+                  custom: item.custom ? item.custom : custom,
+                  creator: item.creator ? item.creator : creator,
+                })
+              ),
+            };
+            let { code, msg } =
+              addType === "add"
+                ? await addAnnualSaleGoal(data)
+                : await updateAnnualSaleGoal(data);
+            if (code == 200) {
+              this.$notify.success(msg);
+              this.hide();
+            }
+          } catch (error) {}
+        } else {
+          var fail = [];
+          for (let key in obj) {
+            fail.push(obj[key][0].message);
+          }
+          this.$notify({
+            title: "警告",
+            message: fail[0],
+            type: "warning",
+          });
+          return false;
+        }
+      });
+    },
+    // 增行
+    addRow(tabName) {
+      const { orgName } = this.$store.state.user;
+      const { saleZone, custom, creator } = this.params;
+      const { TableColumns } = this.TabColumns.find(
+        ({ item: { key } }) => key === tabName
+      );
+      this.params[tabName].push({
+        ...this.$init.params(TableColumns),
+        delFlag: "0",
+        saleOrg: orgName,
+        saleZone,
+        custom,
+        creator,
+      });
+    },
+    // 删行
+    delRow(prop, tabName) {
+      const { row, $rowIndex } = prop;
+      this.params[tabName] = this.params[tabName].filter(
+        (item, index) => index !== $rowIndex
+      );
+    },
+    changeMaterial({ row, selectData: { oneClass, twoClass } }) {
+      row.oneLevelClassifyCode = oneClass && oneClass.split("&")[1];
+      row.twoLevelClassifyCode = twoClass && twoClass.split("&")[1];
+    },
+    // 改变一至十二月份(元)
+    changeMonth(prop) {
+      const month = [
+        "januaryGoal",
+        "februaryGoal",
+        "marchGoal",
+        "aprilGoal",
+        "mayGoal",
+        "juneGoal",
+        "julyGoal",
+        "augustGoal",
+        "septemberGoal",
+        "octoberGoal",
+        "novemberGoal",
+        "decemberGoal",
+      ];
+      this.params.goalTotal = this.params["annualGoalMergeDetails"].reduce(
+        (sum, item) => {
+          const rowSum = month.reduce((sum, m) => {
+            return (sum += (item[m] ? item[m] : 0) * 1);
+          }, 0);
+          return (sum += rowSum);
+        },
+        0
+      );
+      if (prop) {
+        let { row } = prop;
+        row["totalGoal"] = month.reduce((sum, item) => {
+          return (sum += (row[item] ? row[item] : 0) * 1);
+        }, 0);
+      }
+      // 实时统计
+      this.$refs.annualGoalMergeDetails[0].updateFooter();
+    },
+    // 导入
+    async handelImport(fileList) {
+      try {
+        this.$modal.loading("正在上传文件,请稍候...");
+
+        let formData = new FormData();
+        formData.append("file", fileList[0].raw);
+        let { code, msg, data } = await importData(formData);
+        if (code == 200) {
+          this.params["annualGoalMergeDetails"] = [
+            ...this.params["annualGoalMergeDetails"],
+            ...data,
+          ];
+
+          let { setVisible } = this.$refs.batchImport;
+          setVisible(false);
+          this.changeMonth();
+          this.$notify.success(msg);
+        }
+      } catch (error) {
+      } finally {
+        this.$modal.closeLoading();
+      }
+    },
+    // 模板下载
+    handleTemDownload() {
+      this.download(
+        "/goal_management/annualSaleGoalDetails/importTemplate",
+        {},
+        `年销售目标填报明细导入模板_${new Date().getTime()}.xlsx`
+      );
+    },
+    // 批量更新
+    useUpdate(prop) {
+      const { key, value } = prop;
+      this.params["annualGoalMergeDetails"].forEach((item) => {
+        item[key] = value;
+      });
+    },
+  },
+  created() {},
+};
+</script>
+<template>
+  <el-drawer
+    v-bind="$attrs"
+    v-on="$listeners"
+    v-loading="loading"
+    :size="width"
+    :visible.sync="visible"
+    destroy-on-close
+    :show-close="false"
+    @close="hide"
+    @open="beforeOpen"
+  >
+    <div
+      slot="title"
+      style="display: flex; justify-content: space-between; align-items: center"
+    >
+      <h3>{{ title }}</h3>
+      <div>
+        <el-button
+          type="primary"
+          :size="$attrs.size"
+          @click="useSave('superForm')"
+          v-if="addType == 'add' || addType == 'edit'"
+          >保存</el-button
+        >
+        <el-button :size="$attrs.size" @click="hide">取消</el-button>
+      </div>
+    </div>
+
+    <el-super-form
+      v-model="params"
+      :dict="dict"
+      :rules="rules"
+      :size="$attrs.size"
+      :columns="FormColumns"
+      ref="superForm"
+      label-width="auto"
+      label-position="right"
+      style="padding: 20px"
+      :disabled="addType == 'see'"
+    >
+    </el-super-form>
+
+    <el-row
+      type="flex"
+      justify="end"
+      style="margin: 0 20px"
+      v-show="addType !== 'see'"
+    >
+      <batch-import
+        ref="batchImport"
+        :fileSize="2"
+        :size="$attrs.size"
+        @import="handelImport"
+        @temDownload="handleTemDownload"
+      ></batch-import>
+      <batch-update
+        :size="$attrs.size"
+        type="primary"
+        @confirm="useUpdate"
+      ></batch-update>
+    </el-row>
+
+    <el-tabs v-model="tabName" style="margin: 0 20px">
+      <el-tab-pane
+        v-for="({ item, TableColumns: columns }, index) in TabColumns"
+        :key="index"
+        :label="item.title"
+        :name="tabName"
+      >
+        <el-super-ux-table
+          v-model="params[item.key]"
+          :dict="dict"
+          index
+          showSummary
+          :ref="tabName"
+          :columns="columns"
+          :size="$attrs.size"
+          :height="tableHeight"
+        >
+          <!-- 物料 -->
+          <template slot="material" slot-scope="scope">
+            <component
+              v-bind="scope.attr"
+              v-model="scope.row[scope.item.key]"
+              :size="$attrs.size"
+              :source.sync="scope.row"
+              :disabled="addType == 'see'"
+              @change="changeMaterial({ ...scope, selectData: $event })"
+            >
+            </component>
+          </template>
+          <!-- 一至十二月 -->
+          <template slot="januaryGoal" slot-scope="scope">
+            <component
+              v-bind="scope.attr"
+              v-model="scope.row[scope.item.key]"
+              :size="$attrs.size"
+              :source.sync="scope.row"
+              :disabled="addType == 'see'"
+              @change="changeMonth(scope)"
+            >
+            </component>
+          </template>
+          <template slot="februaryGoal" slot-scope="scope">
+            <component
+              v-bind="scope.attr"
+              v-model="scope.row[scope.item.key]"
+              :size="$attrs.size"
+              :source.sync="scope.row"
+              :disabled="addType == 'see'"
+              @change="changeMonth(scope)"
+            >
+            </component>
+          </template>
+          <template slot="marchGoal" slot-scope="scope">
+            <component
+              v-bind="scope.attr"
+              v-model="scope.row[scope.item.key]"
+              :size="$attrs.size"
+              :source.sync="scope.row"
+              :disabled="addType == 'see'"
+              @change="changeMonth(scope)"
+            >
+            </component>
+          </template>
+          <template slot="aprilGoal" slot-scope="scope">
+            <component
+              v-bind="scope.attr"
+              v-model="scope.row[scope.item.key]"
+              :size="$attrs.size"
+              :source.sync="scope.row"
+              :disabled="addType == 'see'"
+              @change="changeMonth(scope)"
+            >
+            </component>
+          </template>
+          <template slot="mayGoal" slot-scope="scope">
+            <component
+              v-bind="scope.attr"
+              v-model="scope.row[scope.item.key]"
+              :size="$attrs.size"
+              :source.sync="scope.row"
+              :disabled="addType == 'see'"
+              @change="changeMonth(scope)"
+            >
+            </component>
+          </template>
+          <template slot="juneGoal" slot-scope="scope">
+            <component
+              v-bind="scope.attr"
+              v-model="scope.row[scope.item.key]"
+              :size="$attrs.size"
+              :source.sync="scope.row"
+              :disabled="addType == 'see'"
+              @change="changeMonth(scope)"
+            >
+            </component>
+          </template>
+          <template slot="julyGoal" slot-scope="scope">
+            <component
+              v-bind="scope.attr"
+              v-model="scope.row[scope.item.key]"
+              :size="$attrs.size"
+              :source.sync="scope.row"
+              :disabled="addType == 'see'"
+              @change="changeMonth(scope)"
+            >
+            </component>
+          </template>
+          <template slot="augustGoal" slot-scope="scope">
+            <component
+              v-bind="scope.attr"
+              v-model="scope.row[scope.item.key]"
+              :size="$attrs.size"
+              :source.sync="scope.row"
+              :disabled="addType == 'see'"
+              @change="changeMonth(scope)"
+            >
+            </component>
+          </template>
+          <template slot="septemberGoal" slot-scope="scope">
+            <component
+              v-bind="scope.attr"
+              v-model="scope.row[scope.item.key]"
+              :size="$attrs.size"
+              :source.sync="scope.row"
+              :disabled="addType == 'see'"
+              @change="changeMonth(scope)"
+            >
+            </component>
+          </template>
+          <template slot="octoberGoal" slot-scope="scope">
+            <component
+              v-bind="scope.attr"
+              v-model="scope.row[scope.item.key]"
+              :size="$attrs.size"
+              :source.sync="scope.row"
+              :disabled="addType == 'see'"
+              @change="changeMonth(scope)"
+            >
+            </component>
+          </template>
+          <template slot="novemberGoal" slot-scope="scope">
+            <component
+              v-bind="scope.attr"
+              v-model="scope.row[scope.item.key]"
+              :size="$attrs.size"
+              :source.sync="scope.row"
+              :disabled="addType == 'see'"
+              @change="changeMonth(scope)"
+            >
+            </component>
+          </template>
+          <template slot="decemberGoal" slot-scope="scope">
+            <component
+              v-bind="scope.attr"
+              v-model="scope.row[scope.item.key]"
+              :size="$attrs.size"
+              :source.sync="scope.row"
+              :disabled="addType == 'see'"
+              @change="changeMonth(scope)"
+            >
+            </component>
+          </template>
+          <ux-table-column
+            v-if="addType !== 'see'"
+            fixed="right"
+            title="操作"
+            width="120"
+            align="center"
+          >
+            <template slot="header" slot-scope="scope">
+              <el-button
+                type="text"
+                :size="$attrs.size"
+                @click="addRow(tabName)"
+                >增 行</el-button
+              >
+            </template>
+            <template slot-scope="scope">
+              <el-button
+                type="text"
+                :size="$attrs.size"
+                @click.native.prevent="delRow(scope, tabName)"
+                >删 行</el-button
+              >
+            </template>
+          </ux-table-column>
+        </el-super-ux-table>
+      </el-tab-pane>
+    </el-tabs>
+  </el-drawer>
+</template>
+
+<style scoped>
+>>> .el-drawer__header {
+  margin-bottom: 0;
+  padding: 5px 20px;
+}
+</style>

+ 3 - 0
src/views/business/spd/target/common/AnnualSaleGoalMerge/columns.js

@@ -0,0 +1,3 @@
+export default function useColumns() {
+  return {}
+}

+ 3 - 0
src/views/business/spd/target/common/MonthGoalMerge/columns.js

@@ -0,0 +1,3 @@
+export default function useColumns() {
+  return {}
+}

+ 3 - 0
src/views/business/spd/target/common/MonthReturnGoal/columns.js

@@ -0,0 +1,3 @@
+export default function useColumns() {
+  return {}
+}

+ 3 - 0
src/views/business/spd/target/common/MonthReturnMerge/columns.js

@@ -0,0 +1,3 @@
+export default function useColumns() {
+  return {}
+}

+ 3 - 0
src/views/business/spd/target/common/MonthSaleGoal/columns.js

@@ -0,0 +1,3 @@
+export default function useColumns() {
+  return {}
+}

+ 14 - 0
src/views/business/spd/target/common/dicts.js

@@ -0,0 +1,14 @@
+import { initDicts } from "@/utils/init.js";
+const modules = require.context("./", true, /columns.js$/);
+const columns = [];
+modules.keys().forEach((fileName) => {
+  const data = modules(fileName).default();
+  for (const key in data) {
+    if (key === "TabColumns") {
+      columns.push(...data[key].map((item) => item.TableColumns).flat());
+    } else {
+      columns.push(...data[key]);
+    }
+  }
+});
+export const dicts = initDicts(columns);