12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166 |
- <template>
- <div class="app-container">
- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
- <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="small" :inline="true" v-show="showSearch" label-width="68px">
- <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>
- <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">
- <div v-if="scope.row.status == '0' || scope.row.status == '3'">
- <el-button size="mini" type="text" @click="handleUpdate(scope.row)">修改
- </el-button>
- <el-button size="mini" type="text" @click="handleDelete(scope.row)">删除
- </el-button>
- <el-button size="mini" type="text" @click="handleSubmit(scope.row)">提交</el-button>
- </div>
- <div v-if="scope.row.status == '1'">
- <el-button size="mini" type="text" @click="handleReback(scope.row)">收回</el-button>
- </div>
- </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'">
- <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">
- <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: 80%">
- <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="300" show-summary :summary-method="getSummaries" v-loading="loading"
- :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"
- :render-header="(h, obj) => addRedStar(h, obj, '0')">
- <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"
- :render-header="(h, obj) => addRedStar(h, obj, '0')">
- <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"
- :render-header="(h, obj) => addRedStar(h, obj, '0')">
- <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,
- } 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() {
- if (!this.justiceDetailsList()) {
- return this.$message.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() {
- 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.materialCode !== null) && (element.material !== null)
- const flag2 = (element.saleOrg !== undefined) && (element.saleZone !== undefined) && (element.custom !==
- undefined) && (element.creator !== undefined) && (element.materialCode != undefined) && (element
- .material !== undefined)
- if (flag1 && flag2) {
- return true
- }
- }
- return false
- },
- 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);
- },
- // 批量修改对话框的方法
- 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'
- // this.getList(this.queryParams)
- }
- } 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.$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>
|