AnnualSaleGoal.vue 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
  4. <el-row :gutter="20">
  5. <el-col :span="6">
  6. <el-form-item label="编码" prop="code">
  7. <el-input
  8. v-model="queryParams.code"
  9. placeholder="请输入编码"
  10. clearable
  11. @keyup.enter.native="handleQuery"
  12. />
  13. </el-form-item>
  14. </el-col>
  15. <el-col :span="6">
  16. <el-form-item label="目标名称" prop="goalName">
  17. <el-input
  18. v-model="queryParams.goalName"
  19. placeholder="请输入年度销售目标名称"
  20. clearable
  21. @keyup.enter.native="handleQuery"
  22. />
  23. </el-form-item>
  24. </el-col>
  25. <el-col :span="8">
  26. <el-form-item label="单据日期" prop="documentDate">
  27. <el-date-picker
  28. v-model="queryParams.documentDateRange"
  29. type="daterange"
  30. value-format="yyyy-MM-dd"
  31. align="right"
  32. range-separator="至"
  33. start-placeholder="开始日期"
  34. end-placeholder="结束日期"
  35. placeholder="请选择单据日期"
  36. :picker-options="pickerOptions">
  37. </el-date-picker>
  38. </el-form-item>
  39. </el-col>
  40. <el-col :span="4">
  41. <el-form-item>
  42. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  43. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  44. <el-tooltip class="item" effect="dark" :content="showSearch?'隐藏搜索':'显示搜索'" placement="top">
  45. <el-button type="warning" :icon="showSearch?'el-icon-caret-top':'el-icon-caret-bottom'" circle @click="showSearch = !showSearch"></el-button>
  46. </el-tooltip>
  47. </el-form-item>
  48. </el-col>
  49. </el-row>
  50. </el-form>
  51. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  52. <el-row :gutter="20">
  53. <el-col :span="6">
  54. <el-form-item label="年度" prop="annual">
  55. <el-date-picker
  56. v-model="queryParams.annual"
  57. type="year"
  58. value-format="yyyy"
  59. placeholder="选择年度"
  60. clearable
  61. @keyup.enter.native="handleQuery">
  62. </el-date-picker>
  63. </el-form-item>
  64. </el-col>
  65. <el-col :span="6">
  66. <el-form-item label="客户" prop="custom">
  67. <el-popover-select-v2 v-model="queryParams.custom" title="客户" valueKey="name"
  68. referName="CUSTOMER_PARAM"
  69. :dataMapping="{ customCode: 'code', custom: 'name'}"
  70. :source.sync="queryParams" placeholder="请输入客户" @keyup.enter.native="handleQuery">
  71. </el-popover-select-v2>
  72. </el-form-item>
  73. </el-col>
  74. <el-col :span="6">
  75. <el-form-item label="销售区域" prop="saleZone">
  76. <el-popover-select-v2 v-model="queryParams.saleZone" title="销售区域" valueKey="name"
  77. referName="MK_SALESAREA_PARAM"
  78. :dataMapping="{ saleZoneCode: 'code', saleZone: 'name'}"
  79. :source.sync="queryParams" placeholder="请输入销售区域" @keyup.enter.native="handleQuery">
  80. </el-popover-select-v2>
  81. </el-form-item>
  82. </el-col>
  83. <el-col :span="6">
  84. <el-form-item label="制单人" prop="creator">
  85. <el-popover-select-v2 v-model="queryParams.creator" title="制单人" valueKey="name"
  86. referName="CONTACTS_PARAM"
  87. :dataMapping="{ creatorCode: 'code', creator: 'name'}"
  88. :source.sync="queryParams" placeholder="请输入制单人" @keyup.enter.native="handleQuery">
  89. </el-popover-select-v2>
  90. </el-form-item>
  91. </el-col>
  92. </el-row>
  93. <el-row :gutter="20">
  94. <el-col :span="6">
  95. <el-form-item label="部门" prop="dept">
  96. <el-popover-select-v2 v-model="queryParams.dept" title="部门" valueKey="name"
  97. referName="DEPT_PARAM"
  98. :dataMapping="{ deptCode: 'code', dept: 'name'}"
  99. :source.sync="queryParams" placeholder="请输入部门" @keyup.enter.native="handleQuery">
  100. </el-popover-select-v2>
  101. </el-form-item>
  102. </el-col>
  103. <el-col :span="6">
  104. <el-form-item label="单据状态" prop="documentStatus">
  105. <el-select v-model="queryParams.documentStatus" placeholder="请选择">
  106. <el-option
  107. v-for="item in [{value: '未提交', label: '未提交'}, {value: '审核中', label: '审核中'}, {value: '已审核', label: '已审核'}]"
  108. :key="item.value"
  109. :label="item.label"
  110. :value="item.value">
  111. </el-option>
  112. </el-select>
  113. </el-form-item>
  114. </el-col>
  115. </el-row>
  116. </el-form>
  117. <el-row :gutter="10" class="mb8" style="float: right">
  118. <el-col :span="1.5">
  119. <el-button
  120. type="primary"
  121. plain
  122. icon="el-icon-plus"
  123. size="mini"
  124. @click="handleAdd"
  125. >新增
  126. </el-button>
  127. </el-col>
  128. <el-col :span="1.5">
  129. <el-button
  130. type="danger"
  131. plain
  132. icon="el-icon-delete"
  133. size="mini"
  134. :disabled="multiple"
  135. @click="handleDelete"
  136. >删除
  137. </el-button>
  138. </el-col>
  139. <el-col :span="1.5">
  140. <el-button
  141. type="primary"
  142. plain
  143. icon="el-icon-grape"
  144. size="mini"
  145. :disabled="multiple"
  146. >提交
  147. </el-button>
  148. </el-col>
  149. <el-col :span="1.5">
  150. <el-button
  151. type="info"
  152. plain
  153. icon="el-icon-upload2"
  154. size="mini"
  155. @click="handleImport"
  156. >导入</el-button>
  157. </el-col>
  158. <el-col :span="1.5">
  159. <el-dropdown @command="handleCommand">
  160. <el-button type="warning" plain icon="el-icon-download" size="mini">
  161. 导出<i class="el-icon-arrow-down el-icon--right"></i>
  162. </el-button>
  163. <el-dropdown-menu slot="dropdown">
  164. <el-dropdown-item command="export">导出</el-dropdown-item>
  165. <el-dropdown-item command="exportDetails">导出明细</el-dropdown-item>
  166. </el-dropdown-menu>
  167. </el-dropdown>
  168. </el-col>
  169. </el-row>
  170. <el-table v-loading="loading" :data="annualSaleGoalList" @selection-change="handleSelectionChange">
  171. <el-table-column type="selection" width="55" align="center" fixed/>
  172. <el-table-column label="编码" align="center" prop="code" width="180"/>
  173. <el-table-column label="目标名称" align="center" prop="goalName" width="180"/>
  174. <el-table-column label="单据日期" align="center" prop="documentDate" width="180">
  175. <template slot-scope="scope">
  176. <span>{{ parseTime(scope.row.documentDate, '{y}-{m}-{d}') }}</span>
  177. </template>
  178. </el-table-column>
  179. <el-table-column label="年度" align="center" prop="annual"/>
  180. <el-table-column label="客户" align="center" prop="custom" width="180"/>
  181. <el-table-column label="销售区域" align="center" prop="saleZone" width="180"/>
  182. <el-table-column label="制单人" align="center" prop="creator"/>
  183. <el-table-column label="部门" align="center" prop="dept" width="180"/>
  184. <el-table-column label="目标合计" align="center" prop="goalTotal"/>
  185. <el-table-column label="备注" align="center" prop="notes" width="180"/>
  186. <el-table-column label="单据状态" align="center" prop="documentStatus"/>
  187. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180" fixed="right">
  188. <template slot-scope="scope">
  189. <el-button
  190. size="mini"
  191. type="text"
  192. icon="el-icon-document-copy"
  193. @click="handleCopy(scope.row.id)"
  194. >复制
  195. </el-button>
  196. <el-button
  197. size="mini"
  198. type="text"
  199. icon="el-icon-edit"
  200. @click="handleUpdate(scope.row)"
  201. >修改
  202. </el-button>
  203. <el-button
  204. size="mini"
  205. type="text"
  206. icon="el-icon-delete"
  207. @click="handleDelete(scope.row)"
  208. >删除
  209. </el-button>
  210. </template>
  211. </el-table-column>
  212. </el-table>
  213. <pagination
  214. v-show="total>0"
  215. :total="total"
  216. :page.sync="queryParams.pageNum"
  217. :limit.sync="queryParams.pageSize"
  218. @pagination="getList"
  219. />
  220. <el-drawer :title="title" :visible.sync="open" direction="rtl" :before-close="handleClose" size="100%">
  221. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  222. <el-row :gutter="20">
  223. <el-col :span="6">
  224. <el-form-item label="编码" prop="code">
  225. <el-input v-model="form.code" placeholder="编码后端自动生成" clearable disabled/>
  226. </el-form-item>
  227. </el-col>
  228. <el-col :span="6">
  229. <el-form-item label="目标名称" prop="goalName">
  230. <el-input v-model="form.goalName" placeholder="目标名称后端自动生成" clearable disabled/>
  231. </el-form-item>
  232. </el-col>
  233. <el-col :span="6">
  234. <el-form-item label="单据日期" prop="documentDate">
  235. <el-date-picker v-model="form.documentDate" type="date" format="yyyy-MM-dd"
  236. placeholder="选择日期"></el-date-picker>
  237. </el-form-item>
  238. </el-col>
  239. <el-col :span="6">
  240. <el-form-item label="年度" prop="annual">
  241. <el-date-picker v-model="form.annual" type="year" format="yyyy" placeholder="选择年度"></el-date-picker>
  242. </el-form-item>
  243. </el-col>
  244. </el-row>
  245. <el-row :gutter="20">
  246. <el-col :span="6">
  247. <el-form-item label="客户" prop="custom">
  248. <el-popover-select-v2 v-model="form.custom" title="客户" valueKey="name"
  249. referName="CUSTOMER_PARAM"
  250. :dataMapping="{ customCode: 'code', custom: 'name'}"
  251. :source.sync="form" placeholder="请输入客户">
  252. </el-popover-select-v2>
  253. </el-form-item>
  254. </el-col>
  255. <el-col :span="6">
  256. <el-form-item label="销售区域" prop="saleZone">
  257. <el-popover-select-v2 v-model="form.saleZone" title="销售区域" valueKey="name"
  258. referName="MK_SALESAREA_PARAM"
  259. :dataMapping="{ saleZoneCode: 'code', saleZone: 'name'}"
  260. :source.sync="form" placeholder="请输入销售区域">
  261. </el-popover-select-v2>
  262. </el-form-item>
  263. </el-col>
  264. <el-col :span="6">
  265. <el-form-item label="制单人" prop="creator">
  266. <el-popover-select-v2 v-model="form.creator" title="制单人" valueKey="name"
  267. referName="CONTACTS_PARAM"
  268. :dataMapping="{ creatorCode: 'code', creator: 'name'}"
  269. :source.sync="form" placeholder="请输入制单人">
  270. </el-popover-select-v2>
  271. </el-form-item>
  272. </el-col>
  273. <el-col :span="6">
  274. <el-form-item label="部门" prop="dept">
  275. <el-popover-select-v2 v-model="form.dept" title="部门" valueKey="name"
  276. referName="DEPT_PARAM"
  277. :dataMapping="{ deptCode: 'code', dept: 'name'}"
  278. :source.sync="form" placeholder="请输入部门">
  279. </el-popover-select-v2>
  280. </el-form-item>
  281. </el-col>
  282. </el-row>
  283. <el-row :gutter="20">
  284. <el-col :span="6">
  285. <el-form-item label="目标合计" prop="goalTotal">
  286. <el-input v-model="form.goalTotal" placeholder="目标合计自动计算" clearable disabled/>
  287. </el-form-item>
  288. </el-col>
  289. <el-col :span="6">
  290. <el-form-item label="备注" prop="notes">
  291. <el-input v-model="form.notes" placeholder="请输入备注" clearable/>
  292. </el-form-item>
  293. </el-col>
  294. <el-col :span="6">
  295. <el-form-item label="单据状态" prop="documentStatus">
  296. <el-input v-model="form.documentStatus" placeholder="未提交" clearable disabled/>
  297. </el-form-item>
  298. </el-col>
  299. </el-row>
  300. </el-form>
  301. <div id="addDetails">
  302. <el-row :gutter="10" class="mb8" style="margin-left: 80%">
  303. <el-col :span="1.5">
  304. <el-button type="info" plain icon="el-icon-upload2" size="mini" @click="handleImport">导入明细</el-button>
  305. </el-col>
  306. <el-col :span="1.5">
  307. <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAddDetails">增行</el-button>
  308. </el-col>
  309. <el-col :span="1.5">
  310. <el-button type="primary" plain icon="el-icon-edit-outline" size="mini" @click="dialogUpdateMore.dialogFormVisible = true">批量修改</el-button>
  311. </el-col>
  312. </el-row>
  313. <el-tabs v-model="activeName">
  314. <el-tab-pane label="年销售目标填报明细" name="annualSaleGoalDetails">
  315. <el-table max-height="300" show-summary sum-text="小计" v-loading="loading" :data="annualSaleGoalDetailsList" @selection-change="handleSelectionChange">
  316. <el-table-column label="序号" type="index" width="70" align="center" fixed />
  317. <el-table-column label="销售组织" align="center" width="180" :render-header="addRedStar">
  318. <template slot-scope="scope">
  319. <el-popover-select-v2 v-model="annualSaleGoalDetailsList[scope.$index].saleOrg" title="销售组织" valueKey="name"
  320. referName="ORG_PARAM"
  321. :dataMapping="{ saleOrgCode: 'code', saleOrg: 'name'}"
  322. :source.sync="annualSaleGoalDetailsList[scope.$index]" placeholder="请输入销售组织">
  323. </el-popover-select-v2>
  324. </template>
  325. </el-table-column>
  326. <el-table-column label="销售区域" align="center" width="180" :render-header="addRedStar">
  327. <template slot-scope="scope">
  328. <el-popover-select-v2 v-model="annualSaleGoalDetailsList[scope.$index].saleZone" title="销售区域" valueKey="name"
  329. referName="MK_SALESAREA_PARAM"
  330. :dataMapping="{ saleZoneCode: 'code', saleZone: 'name'}"
  331. :source.sync="annualSaleGoalDetailsList[scope.$index]" placeholder="请输入销售区域">
  332. </el-popover-select-v2>
  333. </template>
  334. </el-table-column>
  335. <el-table-column label="客户" align="center" width="180" :render-header="addRedStar">
  336. <template slot-scope="scope">
  337. <el-popover-select-v2 v-model="annualSaleGoalDetailsList[scope.$index].custom" title="客户" valueKey="name"
  338. referName="CUSTOMER_PARAM"
  339. :dataMapping="{ customCode: 'code', custom: 'name'}"
  340. :source.sync="annualSaleGoalDetailsList[scope.$index]" placeholder="请输入客户">
  341. </el-popover-select-v2>
  342. </template>
  343. </el-table-column>
  344. <el-table-column label="负责人" align="center" width="180" :render-header="addRedStar">
  345. <template slot-scope="scope">
  346. <el-popover-select-v2 v-model="annualSaleGoalDetailsList[scope.$index].creator" title="负责人" valueKey="name"
  347. referName="CONTACTS_PARAM"
  348. :dataMapping="{ creatorCode: 'code', creator: 'name'}"
  349. :source.sync="annualSaleGoalDetailsList[scope.$index]" placeholder="请输入负责人">
  350. </el-popover-select-v2>
  351. </template>
  352. </el-table-column>
  353. <el-table-column label="一级分类" align="center" width="180" :render-header="addRedStar">
  354. <template slot-scope="scope">
  355. <el-input v-model="annualSaleGoalDetailsList[scope.$index].oneLevelClassify" placeholder="请输入一级分类" disabled></el-input>
  356. </template>
  357. </el-table-column>
  358. <el-table-column label="二级分类" align="center" width="180" :render-header="addRedStar">
  359. <template slot-scope="scope">
  360. <el-input v-model="annualSaleGoalDetailsList[scope.$index].twoLevelClassify" placeholder="请输入二级分类" disabled></el-input>
  361. </template>
  362. </el-table-column>
  363. <el-table-column label="物料" align="center" width="220" :render-header="addRedStar">
  364. <template slot-scope="scope">
  365. <el-popover-select-v2 v-model="annualSaleGoalDetailsList[scope.$index].material" title="物料" valueKey="name"
  366. referName="MATERIAL_PARAM"
  367. @change="setClassify(scope.row.oneLevelClassify, scope.row.twoLevelClassify, annualSaleGoalDetailsList[scope.$index])"
  368. :dataMapping="{ materialCode: 'code', material: 'name', oneLevelClassify: 'oneClass', twoLevelClassify: 'twoClass'}"
  369. :source.sync="annualSaleGoalDetailsList[scope.$index]" placeholder="请输入物料">
  370. </el-popover-select-v2>
  371. </template>
  372. </el-table-column>
  373. <el-table-column label="合计" align="center" prop="totalGoal" width="180">
  374. <template slot-scope="scope">
  375. <el-input v-model="annualSaleGoalDetailsList[scope.$index].totalGoal" disabled></el-input>
  376. </template>
  377. </el-table-column>
  378. <el-table-column label="一月" align="center" prop="januaryGoal" width="220">
  379. <template slot-scope="scope">
  380. <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>
  381. </template>
  382. </el-table-column>
  383. <el-table-column label="二月" align="center" prop="februaryGoal" width="220">
  384. <template slot-scope="scope">
  385. <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>
  386. </template>
  387. </el-table-column>
  388. <el-table-column label="三月" align="center" prop="marchGoal" width="220">
  389. <template slot-scope="scope">
  390. <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>
  391. </template>
  392. </el-table-column>
  393. <el-table-column label="四月" align="center" prop="aprilGoal" width="220">
  394. <template slot-scope="scope">
  395. <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>
  396. </template>
  397. </el-table-column>
  398. <el-table-column label="五月" align="center" prop="mayGoal" width="220">
  399. <template slot-scope="scope">
  400. <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>
  401. </template>
  402. </el-table-column>
  403. <el-table-column label="六月" align="center" prop="juneGoal" width="220">
  404. <template slot-scope="scope">
  405. <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>
  406. </template>
  407. </el-table-column>
  408. <el-table-column label="七月" align="center" prop="julyGoal" width="220">
  409. <template slot-scope="scope">
  410. <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>
  411. </template>
  412. </el-table-column>
  413. <el-table-column label="八月" align="center" prop="augustGoal" width="220">
  414. <template slot-scope="scope">
  415. <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>
  416. </template>
  417. </el-table-column>
  418. <el-table-column label="九月" align="center" prop="septemberGoal" width="220">
  419. <template slot-scope="scope">
  420. <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>
  421. </template>
  422. </el-table-column>
  423. <el-table-column label="十月" align="center" prop="octoberGoal" width="220">
  424. <template slot-scope="scope">
  425. <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>
  426. </template>
  427. </el-table-column>
  428. <el-table-column label="十一月" align="center" prop="novemberGoal" width="220">
  429. <template slot-scope="scope">
  430. <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>
  431. </template>
  432. </el-table-column>
  433. <el-table-column label="十二月" align="center" prop="decemberGoal" width="220">
  434. <template slot-scope="scope">
  435. <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>
  436. </template>
  437. </el-table-column>
  438. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120px" fixed="right">
  439. <template slot-scope="scope">
  440. <el-button
  441. size="mini"
  442. type="text"
  443. icon="el-icon-delete"
  444. @click="handleDeleteDetails(scope.$index, scope.row)"
  445. >删除</el-button>
  446. <el-button
  447. size="mini"
  448. type="text"
  449. icon="el-icon-delete"
  450. @click="handleCopyDetails(scope.row)"
  451. >复制</el-button>
  452. </template>
  453. </el-table-column>
  454. </el-table>
  455. </el-tab-pane>
  456. </el-tabs>
  457. <div slot="footer" class="dialog-footer" style="margin-left: 88%; margin-top: 1%">
  458. <el-button type="primary" @click="submitForm" size="medium">确 定</el-button>
  459. <el-button @click="cancel" size="medium">返 回</el-button>
  460. </div>
  461. </div>
  462. </el-drawer>
  463. <!-- 用户导入对话框 -->
  464. <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  465. <el-upload
  466. ref="upload"
  467. :limit="1"
  468. accept=".xlsx, .xls"
  469. :headers="upload.headers"
  470. :action="upload.url + '?updateSupport=' + upload.updateSupport"
  471. :disabled="upload.isUploading"
  472. :on-progress="handleFileUploadProgress"
  473. :on-success="handleFileSuccess"
  474. :auto-upload="false"
  475. drag
  476. >
  477. <i class="el-icon-upload"></i>
  478. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  479. <div class="el-upload__tip text-center" slot="tip">
  480. <div class="el-upload__tip" slot="tip">
  481. <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的用户数据
  482. </div>
  483. <span>仅允许导入xls、xlsx格式文件。</span>
  484. <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>
  485. </div>
  486. </el-upload>
  487. <div slot="footer">
  488. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  489. <el-button @click="upload.open = false">取 消</el-button>
  490. </div>
  491. </el-dialog>
  492. <!-- 批量修改对话框-->
  493. <el-dialog title="批量修改" width="30%" :visible.sync="dialogUpdateMore.dialogFormVisible" append-to-body @closed="resetDialogUpdateMore">
  494. <el-form>
  495. <el-form-item label="修改项" label-width="100px">
  496. <el-select @change="changeDialogData" v-model="dialogUpdateMore.updateName" placeholder="请选择需要批量修改的字段">
  497. <el-option v-for="item in dialogUpdateMore.optionList" :key="item.value" :label="item.label" :value="item.value"></el-option>
  498. </el-select>
  499. </el-form-item>
  500. <el-form-item label="修改值" label-width="100px">
  501. <el-popover-select-v2 v-if="dialogUpdateMore.updateName === 1"
  502. v-model="dialogUpdateMore.updateData" title="销售组织" valueKey="name"
  503. referName="ORG_PARAM"
  504. :dataMapping="{updateData: 'name'}"
  505. :source.sync="dialogUpdateMore" placeholder="请输入销售组织">
  506. </el-popover-select-v2>
  507. <el-popover-select-v2 v-else-if="dialogUpdateMore.updateName === 2"
  508. v-model="dialogUpdateMore.updateData" title="销售区域" valueKey="name"
  509. referName="MK_SALESAREA_PARAM"
  510. :dataMapping="{updateData: 'name'}"
  511. :source.sync="dialogUpdateMore" placeholder="请输入销售区域">
  512. </el-popover-select-v2>
  513. <el-popover-select-v2 v-else-if="dialogUpdateMore.updateName === 3"
  514. v-model="dialogUpdateMore.updateData" title="客户" valueKey="name"
  515. referName="CUSTOMER_PARAM"
  516. :dataMapping="{updateData: 'name'}"
  517. :source.sync="dialogUpdateMore" placeholder="请输入客户">
  518. </el-popover-select-v2>
  519. <el-popover-select-v2 v-else-if="dialogUpdateMore.updateName === 4"
  520. v-model="dialogUpdateMore.updateData" title="制单人" valueKey="name"
  521. referName="CONTACTS_PARAM"
  522. :dataMapping="{updateData: 'name'}"
  523. :source.sync="dialogUpdateMore" placeholder="请输入制单人">
  524. </el-popover-select-v2>
  525. <el-input v-else placeholder="请输入修改项" disabled></el-input>
  526. </el-form-item>
  527. </el-form>
  528. <div slot="footer" class="dialog-footer">
  529. <el-button type="primary" @click="dialogUpdateMoreSave">确 定</el-button>
  530. </div>
  531. </el-dialog>
  532. </div>
  533. </template>
  534. <script>
  535. import {
  536. listAnnualSaleGoal,
  537. getAnnualSaleGoal,
  538. delAnnualSaleGoal,
  539. addAnnualSaleGoal,
  540. updateAnnualSaleGoal
  541. } from "@/api/business/spd/goal_management/annualSaleGoal";
  542. import {
  543. delAnnualSaleGoalDetails,
  544. getAnnualSaleGoalDetails
  545. } from "@/api/business/spd/goal_management/annualSaleGoalDetails"
  546. import { getToken } from "@/utils/auth";
  547. // 树形参照
  548. import TreeRefers from '@/components/Refers/treeRefer.vue'
  549. import ElPopoverSelectV2 from "@/components/popover-select-v2"
  550. export default {
  551. name: "AnnualSaleGoal",
  552. components: {
  553. TreeRefers, ElPopoverSelectV2
  554. },
  555. data() {
  556. return {
  557. // 遮罩层
  558. loading: true,
  559. // 选中数组
  560. ids: [],
  561. // 非单个禁用
  562. single: true,
  563. // 非多个禁用
  564. multiple: true,
  565. // 显示搜索条件
  566. showSearch: false,
  567. // 总条数
  568. total: 0,
  569. // 年度销售目标表格数据
  570. annualSaleGoalList: [],
  571. // 弹出层标题
  572. title: "",
  573. // 是否显示弹出层
  574. open: false,
  575. // 查询参数
  576. queryParams: {
  577. pageNum: 1,
  578. pageSize: 10,
  579. code: null,
  580. goalName: null,
  581. documentDate: null,
  582. annual: null,
  583. customCode: null,
  584. custom: null,
  585. saleZoneCode: null,
  586. saleZone: null,
  587. creatorCode: null,
  588. creator: null,
  589. deptCode: null,
  590. dept: null,
  591. goalTotal: null,
  592. notes: null,
  593. documentStatus: null,
  594. delFlag: null,
  595. documentDateRange: null
  596. },
  597. pickerOptions: {
  598. shortcuts: [{
  599. text: '最近一周',
  600. onClick(picker) {
  601. const end = new Date();
  602. const start = new Date();
  603. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  604. picker.$emit('pick', [start, end]);
  605. }
  606. }, {
  607. text: '最近一个月',
  608. onClick(picker) {
  609. const end = new Date();
  610. const start = new Date();
  611. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  612. picker.$emit('pick', [start, end]);
  613. }
  614. }, {
  615. text: '最近三个月',
  616. onClick(picker) {
  617. const end = new Date();
  618. const start = new Date();
  619. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  620. picker.$emit('pick', [start, end]);
  621. }
  622. }]
  623. },
  624. // 表单参数
  625. form: {
  626. id: null,
  627. code: null,
  628. goalName: null,
  629. documentDate: null,
  630. annual: null,
  631. customCode: null,
  632. custom: null,
  633. saleZoneCode: null,
  634. saleZone: null,
  635. creatorCode: null,
  636. creator: null,
  637. deptCode: null,
  638. dept: null,
  639. goalTotal: null,
  640. notes: null,
  641. documentStatus: '开立态',
  642. deleteStatus: 0,
  643. annualGoalMergeDetails: []
  644. },
  645. formDetails: {
  646. id: null,
  647. code: null,
  648. saleOrg: null,
  649. saleZone: null,
  650. custom: null,
  651. creator: null,
  652. oneLevelClassifyCode: null,
  653. oneLevelClassify: null,
  654. twoLevelClassifyCode: null,
  655. twoLevelClassify: null,
  656. materialCode: null,
  657. material: null,
  658. totalGoal: null,
  659. januaryGoal: null,
  660. februaryGoal: null,
  661. marchGoal: null,
  662. aprilGoal: null,
  663. mayGoal: null,
  664. juneGoal: null,
  665. julyGoal: null,
  666. augustGoal: null,
  667. septemberGoal: null,
  668. octoberGoal: null,
  669. novemberGoal: null,
  670. decemberGoal: null
  671. },
  672. // 表单校验
  673. rules: {
  674. documentDate: [{required: true, message: '单据日期不能为空', trigger: 'blur'}],
  675. annual: [{required: true, message: '年度不能为空', trigger: 'blur'}],
  676. custom: [{required: true, message: '客户不能为空', trigger: 'blur'}],
  677. saleZone: [{required: true, message: '销售区域不能为空', trigger: 'blur'}],
  678. creator: [{required: true, message: '制单人不能为空', trigger: 'blur'}],
  679. dept: [{required: true, message: '部门不能为空', trigger: 'blur'}]
  680. },
  681. // 子表数组
  682. annualSaleGoalDetailsList: [],
  683. // 用户导入参数
  684. upload: {
  685. // 是否显示弹出层(用户导入)
  686. open: false,
  687. // 弹出层标题(用户导入)
  688. title: "",
  689. // 是否禁用上传
  690. isUploading: false,
  691. // 是否更新已经存在的用户数据
  692. updateSupport: 0,
  693. // 设置上传的请求头部
  694. headers: { Authorization: "Bearer " + getToken() },
  695. // 上传的地址
  696. url: process.env.VUE_APP_BASE_API + "/goal_management/annualSaleGoal/importData"
  697. },
  698. activeName: 'annualSaleGoalDetails',
  699. dialogUpdateMore: {
  700. updateName: null,
  701. dialogFormVisible: false,
  702. updateData: null,
  703. optionList:[{value: 1, label: '销售组织'}, {value: 2, label: '销售区域'}, {value: 3, label: '客户'}, {value: 4, label: '制单人'},]
  704. }
  705. };
  706. },
  707. created() {
  708. this.getList();
  709. },
  710. methods: {
  711. /** 查询年度销售目标列表 */
  712. getList() {
  713. this.loading = true;
  714. listAnnualSaleGoal(this.queryParams).then(response => {
  715. this.annualSaleGoalList = response.rows;
  716. this.total = response.total;
  717. this.loading = false;
  718. console.log(this.annualSaleGoalList);
  719. });
  720. },
  721. getListDetails() {
  722. this.loading = true
  723. getAnnualSaleGoalDetails(this.form.id).then(response => {
  724. this.annualSaleGoalDetailsList = response.data
  725. this.computeTotal()
  726. this.form.annualGoalMergeDetails = this.annualSaleGoalDetailsList
  727. updateAnnualSaleGoal(this.form).then(response => {})
  728. this.loading = false
  729. })
  730. },
  731. // 取消按钮
  732. cancel() {
  733. this.open = false;
  734. this.reset();
  735. },
  736. // 表单重置
  737. reset() {
  738. this.form = {
  739. id: null,
  740. code: null,
  741. goalName: null,
  742. documentDate: null,
  743. annual: null,
  744. customCode: null,
  745. custom: null,
  746. saleZoneCode: null,
  747. saleZone: null,
  748. creatorCode: null,
  749. creator: null,
  750. deptCode: null,
  751. dept: null,
  752. goalTotal: null,
  753. notes: null,
  754. documentStatus: null,
  755. deleteStatus: null
  756. };
  757. this.resetForm("form");
  758. },
  759. /** 搜索按钮操作 */
  760. handleQuery() {
  761. this.queryParams.pageNum = 1;
  762. this.getList();
  763. },
  764. /** 重置按钮操作 */
  765. resetQuery() {
  766. this.queryParams = {
  767. pageNum: 1,
  768. pageSize: 10,
  769. code: null,
  770. goalName: null,
  771. documentDate: null,
  772. annual: null,
  773. customCode: null,
  774. custom: null,
  775. saleZoneCode: null,
  776. saleZone: null,
  777. creatorCode: null,
  778. creator: null,
  779. deptCode: null,
  780. dept: null,
  781. goalTotal: null,
  782. notes: null,
  783. documentStatus: null,
  784. delFlag: null,
  785. documentDateRange: null
  786. }
  787. this.resetForm("queryForm");
  788. this.handleQuery();
  789. },
  790. // 多选框选中数据
  791. handleSelectionChange(selection) {
  792. this.ids = selection.map(item => item.id)
  793. this.single = selection.length !== 1
  794. this.multiple = !selection.length
  795. },
  796. /** 新增按钮操作 */
  797. handleAdd() {
  798. this.reset();
  799. this.title = "添加--年度销售目标";
  800. this.annualSaleGoalDetailsList = []
  801. this.open = true;
  802. this.form.documentDate = new Date().getFullYear().toString() + '-' + (new Date().getMonth() + 1).toString().padStart(2, '0') + '-' + new Date().getDate().toString().padStart(2, '0')
  803. this.form.annual = new Date().getFullYear().toString()
  804. this.form.creator = this.$store.state.user.nickName
  805. this.form.dept = this.$store.state.user.deptName
  806. },
  807. handleAddDetails() {
  808. let list = {
  809. id: null,
  810. code: null,
  811. saleOrg: this.$store.state.user.orgName,
  812. saleZone: this.form.saleZone,
  813. custom: this.form.custom,
  814. creator: this.form.creator,
  815. oneLevelClassifyCode: null,
  816. oneLevelClassify: null,
  817. twoLevelClassifyCode: null,
  818. twoLevelClassify: null,
  819. materialCode: null,
  820. material: null,
  821. totalGoal: 0,
  822. januaryGoal: null,
  823. februaryGoal: null,
  824. marchGoal: null,
  825. aprilGoal: null,
  826. mayGoal: null,
  827. juneGoal: null,
  828. julyGoal: null,
  829. augustGoal: null,
  830. septemberGoal: null,
  831. octoberGoal: null,
  832. novemberGoal: null,
  833. decemberGoal: null
  834. }
  835. this.annualSaleGoalDetailsList.push(list)
  836. this.computeTotal()
  837. },
  838. /** 修改按钮操作 */
  839. handleUpdate(row) {
  840. this.reset();
  841. const id = row.id || this.ids
  842. getAnnualSaleGoal(id).then(response => {
  843. this.form = response.data;
  844. this.annualSaleGoalDetailsList = this.form.annualGoalMergeDetails
  845. this.open = true;
  846. this.title = "修改--年度销售目标";
  847. });
  848. },
  849. // 复制按钮
  850. handleCopy(id) {
  851. this.reset();
  852. getAnnualSaleGoal(id).then(response => {
  853. this.form = response.data;
  854. this.form.id = null
  855. this.form.code = null
  856. this.form.documentDate = new Date().getFullYear().toString() + '-' + (new Date().getMonth() + 1).toString().padStart(2, '0') + '-' + new Date().getDate().toString().padStart(2, '0')
  857. this.form.annual = new Date().getFullYear().toString()
  858. this.annualSaleGoalDetailsList = JSON.parse(JSON.stringify(this.form.annualGoalMergeDetails))
  859. for (const element of this.annualSaleGoalDetailsList) {
  860. element.id = null
  861. element.code = null
  862. }
  863. this.open = true;
  864. this.title = "新增--年度销售目标";
  865. console.log(this.form);
  866. })
  867. },
  868. /** 提交按钮 */
  869. submitForm() {
  870. if (!this.justiceDetailsList()) {
  871. return this.$message.error('子表有必填字段没有赋值')
  872. }
  873. this.$refs["form"].validate(valid => {
  874. if (valid) {
  875. if (this.form.id != null) {
  876. this.form.annualGoalMergeDetails = JSON.parse(JSON.stringify(this.annualSaleGoalDetailsList))
  877. updateAnnualSaleGoal(this.form).then(response => {
  878. this.$modal.msgSuccess("修改成功");
  879. this.open = false;
  880. this.getList();
  881. });
  882. } else {
  883. this.form.documentStatus = '未提交'
  884. this.form.annualGoalMergeDetails = JSON.parse(JSON.stringify(this.annualSaleGoalDetailsList))
  885. addAnnualSaleGoal(this.form).then(response => {
  886. this.$modal.msgSuccess("新增成功");
  887. this.open = false;
  888. this.getList();
  889. });
  890. }
  891. }
  892. });
  893. },
  894. /** 删除按钮操作 */
  895. handleDelete(row) {
  896. const ids = row.id || this.ids;
  897. this.$modal.confirm('是否确认删除年度销售目标编号为"' + ids + '"的数据项?').then(function () {
  898. return delAnnualSaleGoal(ids);
  899. }).then(() => {
  900. this.getList();
  901. this.$modal.msgSuccess("删除成功");
  902. }).catch(() => {
  903. });
  904. },
  905. handleDeleteDetails(index, row) {
  906. if (this.form.id === null) {
  907. this.annualSaleGoalDetailsList.splice(index, 1)
  908. this.computeTotal()
  909. } else {
  910. if (row.id !== null) {
  911. this.$modal.confirm('是否确认删除年度销售目标明细编号为"' + row.id + '"的数据项?').then(function () {
  912. return delAnnualSaleGoalDetails(row.id)
  913. }).then(() => {
  914. this.getListDetails()
  915. this.$modal.msgSuccess('删除成功')
  916. }).catch(() => {})
  917. } else {
  918. this.annualSaleGoalDetailsList.splice(index, 1)
  919. this.$message.success('删除成功')
  920. this.computeTotal()
  921. }
  922. }
  923. },
  924. /** 导出按钮操作 */
  925. handleExport() {
  926. this.download('goal_management/annualSaleGoal/export', {
  927. ...this.queryParams
  928. }, `annualSaleGoal_${new Date().getTime()}.xlsx`)
  929. },
  930. handleExportDetails() {
  931. this.download('goal_management/annualSaleGoalDetails/export', {
  932. ...this.queryParams
  933. }, `annualSaleGoalMerge_${new Date().getTime()}.xlsx`)
  934. },
  935. handleClose(done) {
  936. this.$confirm('确认关闭?')
  937. .then(_ => {
  938. done();
  939. this.reset()
  940. })
  941. .catch(_ => {
  942. });
  943. },
  944. // 复制明细
  945. handleCopyDetails(row) {
  946. let list = {
  947. id: null,
  948. code: row.code,
  949. saleOrg: row.saleOrg,
  950. saleZone: row.saleZone,
  951. custom: row.custom,
  952. creator: row.creator,
  953. oneLevelClassifyCode: row.oneLevelClassifyCode,
  954. oneLevelClassify: row.oneLevelClassify,
  955. twoLevelClassifyCode: row.oneLevelClassifyCode,
  956. twoLevelClassify: row.twoLevelClassify,
  957. materialCode: row.materialCode,
  958. material: row.material,
  959. totalGoal: row.totalGoal,
  960. januaryGoal: row.januaryGoal,
  961. februaryGoal: row.februaryGoal,
  962. marchGoal: row.marchGoal,
  963. aprilGoal: row.aprilGoal,
  964. mayGoal: row.mayGoal,
  965. juneGoal: row.juneGoal,
  966. julyGoal: row.julyGoal,
  967. augustGoal: row.augustGoal,
  968. septemberGoal: row.septemberGoal,
  969. octoberGoal: row.octoberGoal,
  970. novemberGoal: row.novemberGoal,
  971. decemberGoal: row.decemberGoal
  972. }
  973. this.annualSaleGoalDetailsList.push(list)
  974. this.computeTotal()
  975. },
  976. // 计算子表合计
  977. computeTotalDetails(index, row) {
  978. 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]
  979. let sum = 0
  980. for (const element of array) {
  981. sum = (sum * 1000000 + element * 1000000) / 1000000
  982. }
  983. this.annualSaleGoalDetailsList[index].totalGoal = sum
  984. this.computeTotal()
  985. },
  986. // 计算主表合计
  987. computeTotal() {
  988. let list = this.annualSaleGoalDetailsList
  989. let sum = 0
  990. for (const listElement of list) {
  991. sum = (sum * 1000000 + listElement.totalGoal * 1000000) / 1000000
  992. }
  993. this.form.goalTotal = sum
  994. },
  995. // 给table添加必填项
  996. addRedStar(h, { column }) {
  997. return [
  998. h('span', { style: 'color: #F56C6C' }, '*'),
  999. h('span', '' + column.label)
  1000. ]
  1001. },
  1002. // 判断子表的字段是否都填了
  1003. justiceDetailsList() {
  1004. const arr = JSON.parse(JSON.stringify(this.annualSaleGoalDetailsList))
  1005. for (const element of arr) {
  1006. const flag1 = (element.saleZone !== null) && (element.saleOrg !== null) && (element.custom !== null) && (element.creator !== null) && (element.materialCode !== null) && (element.material !== null)
  1007. const flag2 = (element.saleOrg !== undefined) && (element.saleZone !== undefined) && (element.custom !== undefined) && (element.creator !== undefined) && (element.materialCode != undefined) && (element.material !== undefined)
  1008. if (flag1 && flag2) {
  1009. return true
  1010. }
  1011. }
  1012. return false
  1013. },
  1014. handleCommand(command) {
  1015. // 执行对应的功能
  1016. if (command === 'export') {
  1017. console.log('导出主表');
  1018. this.handleExport()
  1019. } else if (command === 'exportDetails') {
  1020. console.log('导出明细');
  1021. this.handleExportDetails()
  1022. }
  1023. },
  1024. /** 导入按钮操作 */
  1025. handleImport() {
  1026. this.upload.open = true;
  1027. if (this.open) {
  1028. this.upload.title = "年销售目标填报明细导入"
  1029. this.upload.url = process.env.VUE_APP_BASE_API + "goal_management/annualSaleGoalDetails/importData/" + this.form.id
  1030. } else {
  1031. this.upload.title = "年销售目标填报导入";
  1032. this.upload.url = process.env.VUE_APP_BASE_API + "goal_management/annualSaleGoal/importData"
  1033. }
  1034. },
  1035. /** 下载模板操作 */
  1036. importTemplate() {
  1037. if (this.open) {
  1038. this.download('goal_management/annualSaleGoalDetails/importTemplate', {
  1039. }, `annualSaleGoalDetails_${new Date().getTime()}.xlsx`)
  1040. } else {
  1041. this.download('goal_management/annualSaleGoal/importTemplate', {
  1042. }, `annualSaleGoal_${new Date().getTime()}.xlsx`)
  1043. }
  1044. },
  1045. // 文件上传中处理
  1046. handleFileUploadProgress(event, file, fileList) {
  1047. this.upload.isUploading = true;
  1048. },
  1049. // 文件上传成功处理
  1050. handleFileSuccess(response, file, fileList) {
  1051. console.log(response);
  1052. this.upload.open = false;
  1053. this.upload.isUploading = false;
  1054. this.$refs.upload.clearFiles();
  1055. this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
  1056. if (this.open) {
  1057. const array = response.data
  1058. for (const arrayElement of array) {
  1059. arrayElement.id = null
  1060. this.annualSaleGoalDetailsList.push(arrayElement)
  1061. }
  1062. this.computeTotal()
  1063. } else {
  1064. this.getList();
  1065. }
  1066. },
  1067. // 提交上传文件
  1068. submitFileForm() {
  1069. this.$refs.upload.submit();
  1070. },
  1071. // 选择物料后,给一级分类和二级分类复赋值
  1072. setClassify(one, two, obj) {
  1073. const oneArray = one.split("&")
  1074. const twoArray = two.split("&")
  1075. obj.oneLevelClassifyCode = oneArray[1]
  1076. obj.oneLevelClassify = oneArray[0]
  1077. obj.twoLevelClassifyCode = twoArray[1]
  1078. obj.twoLevelClassify = twoArray[0]
  1079. console.log(obj);
  1080. },
  1081. // 批量修改对话框的方法
  1082. dialogUpdateMoreSave() {
  1083. console.log(this.dialogUpdateMore);
  1084. if (this.dialogUpdateMore.updateData === null) {
  1085. return this.$message.error('请输入修改值')
  1086. }
  1087. const array = JSON.parse(JSON.stringify(this.annualSaleGoalDetailsList))
  1088. if (array.length !== 0) {
  1089. let condition = this.dialogUpdateMore.updateName
  1090. for (const element of array) {
  1091. if (condition === 1) {
  1092. element.saleOrg = JSON.parse(JSON.stringify(this.dialogUpdateMore.updateData))
  1093. } else if (condition === 2) {
  1094. element.saleZone = JSON.parse(JSON.stringify(this.dialogUpdateMore.updateData))
  1095. } else if (condition === 3) {
  1096. element.custom = JSON.parse(JSON.stringify(this.dialogUpdateMore.updateData))
  1097. } else if (condition === 4) {
  1098. element.creator = JSON.parse(JSON.stringify(this.dialogUpdateMore.updateData))
  1099. }
  1100. }
  1101. }
  1102. this.annualSaleGoalDetailsList = array
  1103. this.dialogUpdateMore.dialogFormVisible = !this.dialogUpdateMore.dialogFormVisible
  1104. this.dialogUpdateMore.updateData = null
  1105. this.dialogUpdateMore.updateName = null
  1106. },
  1107. changeDialogData() {
  1108. this.dialogUpdateMore.updateData = null
  1109. },
  1110. resetDialogUpdateMore() {
  1111. this.dialogUpdateMore.updateName = null
  1112. this.dialogUpdateMore.updateData = null
  1113. }
  1114. }
  1115. };
  1116. </script>