TabelTransfer.vue 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051
  1. <template>
  2. <div class="mymain-container">
  3. <!-- 经销商信息 -->
  4. <slot name="header">
  5. <el-row class="radio">
  6. <el-radio-group v-model="region">
  7. <el-radio label="0">指定经销商</el-radio>
  8. <el-radio
  9. v-if="!adminWebsit || !adminWebsit.websitNumber || (adminWebsit && adminWebsit.websitNumber === 'GZ')"
  10. label="1"
  11. >广州经销商</el-radio>
  12. <el-radio
  13. v-if="!adminWebsit || !adminWebsit.websitNumber || (adminWebsit && adminWebsit.websitNumber === 'FS')"
  14. label="2"
  15. >佛山经销商</el-radio>
  16. </el-radio-group>
  17. <template v-if="region == 0">
  18. <el-upload
  19. class="import-btn"
  20. :action="baseURL + 'student/import'"
  21. :http-request="handleImport"
  22. :file-list="importFileList"
  23. :show-file-list="false"
  24. >
  25. <el-button type="primary" size="mini">导入经销商</el-button>
  26. </el-upload>
  27. <el-button type="primary" size="mini" @click="hanleDownloadFiles">下载模板</el-button>
  28. </template>
  29. </el-row>
  30. <el-row v-if="region == 0" type="flex">
  31. <el-col :xs="24" :sm="12" :lg="14">
  32. <el-input v-model="keyword" placeholder="查找经销商" size="mini" />
  33. </el-col>
  34. <el-col
  35. :xs="24"
  36. :sm="1"
  37. :lg="1"
  38. style="margin-left: 10px"
  39. ><el-button size="mini" @click="submitScreenForm">确定</el-button></el-col>
  40. <el-col
  41. :xs="24"
  42. :sm="1"
  43. :lg="1"
  44. style="margin-left: 20px"
  45. ><el-button size="mini" @click="resetScreenForm">重置</el-button></el-col>
  46. </el-row>
  47. </slot>
  48. <el-row v-if="region == 0" :gutter="20">
  49. <el-col :span="10" :offset="0">
  50. <h5>未选经销商</h5>
  51. <el-divider direction="horizontal" content-position="left" />
  52. <div class="table">
  53. <el-table
  54. ref="multipleTable"
  55. :data="dataL"
  56. element-loading-text="Loading"
  57. border
  58. height="480px"
  59. fit
  60. highlight-current-row
  61. @select-all="handleSelectionAllChange"
  62. @selection-change="handleSelectionChange"
  63. >
  64. <el-table-column type="selection" width="55" :selectable="selectable" align="left" />
  65. <!-- <el-table-column-->
  66. <!-- prop="number"-->
  67. <!-- label="经销商编码"-->
  68. <!-- align="left"-->
  69. <!-- />-->
  70. <el-table-column
  71. prop="name"
  72. label="经销商名称"
  73. align="left"
  74. ><template slot-scope="scope">
  75. <CopyButton :copy-text="scope.row.name" />
  76. <span>{{ scope.row.name }}</span>
  77. <span class="red">{{ scope.row.number }}</span>
  78. </template>
  79. </el-table-column>
  80. </el-table>
  81. </div>
  82. <!-- 分页 -->
  83. <div style="margin: 20px 0">
  84. <el-pagination
  85. :current-page="currentPages"
  86. :page-sizes="[10, 20, 30, 50]"
  87. :page-size="10"
  88. layout="total, sizes, prev, pager, next, jumper"
  89. :total="clistTotal"
  90. @size-change="handleSizeChanges"
  91. @current-change="handleCurrentChanges"
  92. />
  93. </div>
  94. </el-col>
  95. <el-col :span="4" class="middle_box" :offset="0">
  96. <el-col> <el-button size="mini" :disabled="type == 2" @click="handleAllAdd">全部添加</el-button></el-col>
  97. <el-col> <el-button size="mini" :disabled="type == 2" @click="handleAdd">增加</el-button></el-col>
  98. <el-col> <el-button size="mini" :disabled="type == 1" @click="handleDelete">删除</el-button></el-col>
  99. <el-col> <el-button size="mini" :disabled="type == 1" @click="handleAllDelete">全部删除</el-button></el-col>
  100. </el-col>
  101. <el-col :span="10" :offset="0">
  102. <h5>已选经销商</h5>
  103. <el-divider direction="horizontal" content-position="left" />
  104. <div class="table">
  105. <el-table
  106. v-loading="listLoading"
  107. :data="custoList"
  108. element-loading-text="Loading"
  109. border
  110. height="480px"
  111. fit
  112. highlight-current-row
  113. stripe
  114. @select-all="handleSelectionAllChange2"
  115. @selection-change="handleSelectionChange2"
  116. >
  117. <el-table-column type="selection" width="55" align="left" />
  118. <!-- <el-table-column-->
  119. <!-- prop="customerNumber"-->
  120. <!-- label="经销商编码"-->
  121. <!-- align="left"-->
  122. <!-- />-->
  123. <el-table-column prop="customerName" label="经销商名称" align="left">
  124. <template slot-scope="scope">
  125. <CopyButton :copy-text="scope.row.customerName" />
  126. <span>{{ scope.row.customerName }}</span>
  127. <span class="red">{{ scope.row.customerNumber }}</span>
  128. </template>
  129. </el-table-column>
  130. </el-table>
  131. </div>
  132. </el-col>
  133. </el-row>
  134. <!-- 销售政策类型 ———— 限量-->
  135. <div v-if="policyType === 'LIMIT'">
  136. <div>
  137. <h4 style="display: inline-block; margin-right: 20px">经销商上限</h4>
  138. <el-divider />
  139. </div>
  140. <div style="margin: 20px 0">
  141. <el-upload
  142. class="import-btn cus-btn"
  143. :action="baseURL + 'student/import'"
  144. :http-request="handleImports"
  145. :file-list="importFileList"
  146. :show-file-list="false"
  147. >
  148. <el-button type="primary" size="mini">导入经销商</el-button>
  149. </el-upload>
  150. <el-button type="primary" size="mini" @click="hanleDownloadFilesPolicy">下载模板</el-button>
  151. </div>
  152. <el-row type="flex" style="margin: 20px 0">
  153. <el-col :xs="24" :sm="12" :lg="14">
  154. <el-input v-model="keyword2" placeholder="查找经销商" size="mini" />
  155. </el-col>
  156. <el-col
  157. :xs="24"
  158. :sm="1"
  159. :lg="1"
  160. style="margin-left: 10px"
  161. ><el-button size="mini" @click="submitScreenForm2">确定</el-button></el-col>
  162. <el-col
  163. :xs="24"
  164. :sm="1"
  165. :lg="1"
  166. style="margin-left: 20px"
  167. ><el-button size="mini" @click="resetScreenForm2">重置</el-button></el-col>
  168. </el-row>
  169. <div>
  170. <div class="table">
  171. <el-table
  172. v-loading="clistLoading"
  173. :data="list"
  174. element-loading-text="Loading"
  175. border
  176. fit
  177. highlight-current-row
  178. stripe
  179. @select-all="handleSelectionAllChange2"
  180. @selection-change="handleSelectionChange2"
  181. >
  182. <el-table-column type="index" label="序号" align="left" />
  183. <el-table-column prop="customerNumber" label="经销商编号" align="left" width="300">
  184. <template slot-scope="scope">
  185. <CopyButton :copy-text="scope.row.customerNumber" />
  186. <span>{{ scope.row.customerNumber }}</span>
  187. </template>
  188. </el-table-column>
  189. <el-table-column prop="customerName" label="经销商名称" align="left" width="300">
  190. <template slot-scope="scope">
  191. <CopyButton :copy-text="scope.row.customerName" />
  192. <span>{{ scope.row.customerName }}</span>
  193. </template>
  194. </el-table-column>
  195. <el-table-column prop="minBuyNum" label="最少起提数" align="left">
  196. <template slot-scope="scope">
  197. <span>{{ scope.row.minBuyNum }}</span>
  198. </template>
  199. </el-table-column>
  200. <el-table-column prop="maxBuyNum" label="最大提货组数" align="left">
  201. <template slot-scope="scope">
  202. <span>{{ scope.row.maxBuyNum }}</span>
  203. </template>
  204. </el-table-column>
  205. <el-table-column prop="orderNums" label="已下订单数" align="left">
  206. <template slot-scope="scope">
  207. <span>{{ scope.row.orderNums }}</span>
  208. </template>
  209. </el-table-column>
  210. <el-table-column prop="examineOrderNums" label="已审订单数" align="left">
  211. <template slot-scope="scope">
  212. <span>{{ scope.row.examineOrderNums }}</span>
  213. </template>
  214. </el-table-column>
  215. </el-table>
  216. </div>
  217. <!-- 分页 -->
  218. <div style="margin: 20px 0">
  219. <el-pagination
  220. :current-page="policyList.currentPages"
  221. :page-sizes="[10, 20, 30, 50]"
  222. :page-size="10"
  223. layout="total, sizes, prev, pager, next, jumper"
  224. :total="cTotal"
  225. @size-change="handleSizeChanges2"
  226. @current-change="handleCurrentChanges2"
  227. />
  228. </div>
  229. </div>
  230. </div>
  231. <!-- 销售政策类型 ———— 配提 综合 -->
  232. <div v-else>
  233. <div>
  234. <h4 style="display: inline-block; margin-right: 20px">经销商上限</h4>
  235. <el-divider />
  236. </div>
  237. <div style="margin: 20px 0">
  238. <el-upload
  239. class="import-btn cus-btn"
  240. :action="baseURL + 'student/import'"
  241. :http-request="handleImports"
  242. :file-list="importFileList"
  243. :show-file-list="false"
  244. >
  245. <el-button type="primary" size="mini">导入经销商</el-button>
  246. </el-upload>
  247. <el-button type="primary" size="mini" @click="hanleDownloadFilesPolicy">下载模板</el-button>
  248. </div>
  249. <el-row style="margin: 20px 0">
  250. <el-col :span="12">
  251. <el-input v-model="keyword2" placeholder="查找经销商" size="mini" />
  252. </el-col>
  253. <el-col :span="10" style="margin-left: 20px">
  254. <el-button size="mini" @click="submitScreenForm2">确定</el-button>
  255. <el-button size="mini" @click="resetScreenForm2">重置</el-button>
  256. <template v-if="batch">
  257. <el-button v-if="list.length" type="primary" size="mini" @click="handelBatchData">批量修改上限</el-button>
  258. <el-button v-if="list.length" type="primary" size="mini" @click="handelBatchData2">批量修改组数</el-button>
  259. </template>
  260. </el-col>
  261. </el-row>
  262. <div style="font-size: 14px">
  263. 注:经销商最大提货套数仅与经销商相关联,与机型没有限制关联;机型订货上线仅对机型做限制
  264. </div>
  265. <div>
  266. <div class="table">
  267. <el-table
  268. v-loading="clistLoading"
  269. :data="list"
  270. element-loading-text="Loading"
  271. border
  272. fit
  273. highlight-current-row
  274. stripe
  275. @select-all="handleSelectionAllChange2"
  276. @selection-change="handleSelectionChange2"
  277. >
  278. <el-table-column type="index" width="50" />
  279. <el-table-column
  280. prop="customerNumber"
  281. label="经销商编号
  282. "
  283. align="left"
  284. width="300"
  285. >
  286. <template slot-scope="scope">
  287. <CopyButton :copy-text="scope.row.customerNumber" />
  288. <span>{{ scope.row.customerNumber }}</span>
  289. </template>
  290. </el-table-column>
  291. <el-table-column prop="customerName" label="经销商名称" align="left" width="300">
  292. <template slot-scope="scope">
  293. <CopyButton :copy-text="scope.row.customerName" />
  294. <span>{{ scope.row.customerName }}</span>
  295. </template>
  296. </el-table-column>
  297. <el-table-column prop="maxBuyNum" label="最大提货套数" align="left">
  298. <template slot-scope="scope">
  299. {{ scope.row.maxBuyNum }}
  300. </template>
  301. </el-table-column>
  302. <el-table-column prop="materialName" label="物料名称" align="left">
  303. <template slot-scope="scope">
  304. {{ scope.row.materialName }}
  305. </template>
  306. </el-table-column>
  307. <el-table-column prop="materialNumber" label="物料编号" align="left">
  308. <template slot-scope="scope">
  309. {{ scope.row.materialNumber }}
  310. </template>
  311. </el-table-column>
  312. <el-table-column prop="limitQty" label="订货上限" align="left">
  313. <template slot-scope="scope">
  314. {{ scope.row.limitQty }}
  315. </template>
  316. </el-table-column>
  317. <el-table-column prop="orderNums" label="已下订单数" align="left">
  318. <template slot-scope="scope">
  319. {{ scope.row.orderNums }}
  320. </template>
  321. </el-table-column>
  322. <el-table-column prop="examineOrderNums" label="已审订单数" align="left">
  323. <template slot-scope="scope">
  324. {{ scope.row.examineOrderNums }}
  325. </template>
  326. </el-table-column>
  327. </el-table>
  328. </div>
  329. <!-- 分页 -->
  330. <div style="margin: 20px 0">
  331. <el-pagination
  332. :current-page="policyList.currentPages"
  333. :page-sizes="[10, 20, 30, 50]"
  334. :page-size="10"
  335. layout="total, sizes, prev, pager, next, jumper"
  336. :total="cTotal"
  337. @size-change="handleSizeChanges2"
  338. @current-change="handleCurrentChanges2"
  339. />
  340. </div>
  341. </div>
  342. </div>
  343. <!-- 操作按钮 -->
  344. <slot name="footer">
  345. <el-row style="margin: 20px 0 0 0">
  346. <el-button type="primary" size="mini" @click="handleSave">
  347. {{ comCode ? '保存' : '提交审核' }}
  348. </el-button>
  349. <el-button type="primary" size="mini" @click="handleReset">重置</el-button>
  350. </el-row>
  351. </slot>
  352. <el-dialog
  353. title="批量修改"
  354. :visible.sync="visible"
  355. width="50%"
  356. :append-to-body="true"
  357. :close-on-click-modal="false"
  358. @close="handleDialogVisible"
  359. >
  360. <el-row :gutter="20">
  361. <el-col :span="24" style="display: flex; align-items: center; margin-bottom: 20px">
  362. <el-col :span="4" :offset="0"> 购买量上限 </el-col>
  363. <el-col :span="8" :offset="0"> <el-input v-model="limitQty" size="mini" /></el-col>
  364. </el-col>
  365. <el-col :span="24" :offset="0" style="margin-bottom: 20px">
  366. <div style="display: flex">
  367. <el-input v-model="limitQtyKeyWord" placeholder="输入关键字搜索" size="mini" />
  368. <el-button style="margin-left: 20px" type="primary" size="mini" @click="handelBatchData('search')">查询</el-button>
  369. <el-button size="mini" @click="onReset">重置</el-button>
  370. </div>
  371. </el-col>
  372. </el-row>
  373. <zj-table
  374. :table-attributes="tableAttributes"
  375. :table-events="tableEvents"
  376. :is-drop="true"
  377. :columns="columns"
  378. :table-data="tableData"
  379. />
  380. <div style="margin: 20px 0">
  381. <el-pagination
  382. :current-page="batchCurrentPages"
  383. :page-sizes="[10, 20, 30, 50]"
  384. :page-size="10"
  385. layout="total, sizes, prev, pager, next, jumper"
  386. :total="batchTotal"
  387. @size-change="handleBatchSizeChanges"
  388. @current-change="handleBatchCurrentChanges"
  389. />
  390. </div>
  391. <span slot="footer">
  392. <el-button @click="handleDialogVisible">取消</el-button>
  393. <el-button type="primary" @click="onSubmit('limit')">确定</el-button>
  394. </span>
  395. </el-dialog>
  396. <el-dialog
  397. title="批量修改"
  398. :visible.sync="maxBuyNumVisible"
  399. width="50%"
  400. :append-to-body="true"
  401. :close-on-click-modal="false"
  402. @close="handleDialogVisible"
  403. >
  404. <el-row :gutter="20">
  405. <el-col :span="24" style="display: flex; align-items: cente; margin-bottom: 20px">
  406. <el-col :span="5" :offset="0"> 最大提货组数 </el-col>
  407. <el-col :span="8" :offset="0"> <el-input v-model="maxBuyNum" size="mini" /></el-col>
  408. </el-col>
  409. <el-col :span="24" :offset="0" style="margin-bottom: 20px">
  410. <div style="display: flex">
  411. <el-input v-model="maxBuyNumKeyWord" placeholder="输入关键字搜索" size="mini" clearable />
  412. <el-button style="margin-left: 20px" type="primary" size="mini" @click="handelBatchData('search')">查询</el-button>
  413. <el-button size="mini" @click="onReset">重置</el-button>
  414. </div>
  415. </el-col>
  416. </el-row>
  417. <zj-table
  418. :table-attributes="tableAttributes"
  419. :table-events="tableEvents"
  420. :is-drop="true"
  421. :columns="columns"
  422. :table-data="tableData"
  423. />
  424. <div style="margin: 20px 0">
  425. <el-pagination
  426. :current-page="batchCurrentPages"
  427. :page-sizes="[10, 20, 30, 50]"
  428. :page-size="10"
  429. layout="total, sizes, prev, pager, next, jumper"
  430. :total="batchTotal"
  431. @size-change="handleBatchSizeChanges"
  432. @current-change="handleBatchCurrentChanges"
  433. />
  434. </div>
  435. <span slot="footer">
  436. <el-button @click="handleDialogVisible">取消</el-button>
  437. <el-button type="primary" @click="onSubmit">确定</el-button>
  438. </span>
  439. </el-dialog>
  440. </div>
  441. </template>
  442. <script>
  443. import {
  444. deleteCondition,
  445. deleteMaterialPolicy,
  446. getConditionList,
  447. getCrList,
  448. getCustomerList,
  449. getPolicyList,
  450. updateCustomerCountBatch,
  451. updateLimitBatchupdate
  452. } from '@/api/policy_list'
  453. import { downloadFiles, handleImport } from '@/utils/util'
  454. import ImageUpload from '@/components/Common/image-upload.vue'
  455. import Minxin from '@/mixin'
  456. export default {
  457. name: 'Examine',
  458. components: {
  459. // eslint-disable-next-line vue/no-unused-components
  460. ImageUpload
  461. },
  462. mixins: [Minxin],
  463. // eslint-disable-next-line vue/require-prop-types
  464. props: ['code', 'yregion', 'policyType', 'batch'],
  465. data() {
  466. return {
  467. keyword: '',
  468. keyword2: '',
  469. region: '0',
  470. baseURL: '',
  471. dcurrentPage: 1,
  472. dpageSize: 10,
  473. dlistTotal: 0,
  474. currentPages: 1, // 当前页码
  475. pageSizes: 10, // 每页数量
  476. input: '',
  477. remark: '',
  478. fileList: [],
  479. listLoading: false,
  480. imageUrl: '',
  481. dataList: [],
  482. examineStatus: 'OK',
  483. options: {},
  484. value: '',
  485. detail: {},
  486. srcList: [],
  487. screenForm: {
  488. code: '',
  489. createBy: '',
  490. endCreateTime: '',
  491. endTime1: '',
  492. endTime2: '',
  493. examineBy: '',
  494. remark: '',
  495. startCreateTime: '',
  496. startTime1: '',
  497. startTime2: '',
  498. status: '',
  499. title: '',
  500. type: ''
  501. },
  502. conditionList: [],
  503. custoList: [],
  504. isEdit: 1,
  505. cid: '',
  506. cpolicyId: '',
  507. dataL: [],
  508. clistTotal: 0,
  509. clistTotals: 0,
  510. type: 1,
  511. importFileList: [],
  512. leftData: [],
  513. rightData: [],
  514. typeOptions: [
  515. {
  516. value: 'PROVISION',
  517. label: '配提'
  518. },
  519. {
  520. value: 'LIMIT',
  521. label: '限量'
  522. }
  523. ],
  524. comCode: '',
  525. policyList: {
  526. pageNum: 1,
  527. pageSize: 10,
  528. policyId: '',
  529. keyword: '',
  530. currentPages: 1
  531. },
  532. list: [],
  533. cTotal: 1,
  534. clistLoading: false,
  535. visible: false,
  536. maxBuyNumVisible: false,
  537. tableData: [],
  538. tableAttributes: {
  539. selectColumn: true
  540. },
  541. tableEvents: {
  542. 'selection-change': this.selectionChange
  543. },
  544. limitQty: 0,
  545. maxBuyNum: 0,
  546. limitQtyKeyWord: '',
  547. maxBuyNumKeyWord: '',
  548. selectedData: [],
  549. batchCurrentPages: 1,
  550. batchPageSizes: 10,
  551. batchTotal: 0
  552. }
  553. },
  554. computed: {
  555. adminWebsit() {
  556. return JSON.parse(localStorage.getItem('supply_user')).adminWebsit
  557. },
  558. columns() {
  559. return [
  560. {
  561. columnAttributes: {
  562. label: '经销商编码',
  563. prop: 'customerNumber'
  564. }
  565. },
  566. {
  567. columnAttributes: {
  568. label: '经销商名称',
  569. prop: 'customerName'
  570. }
  571. }
  572. ]
  573. }
  574. },
  575. watch: {
  576. dataL: (val, oval) => {
  577. console.log(val, oval)
  578. }
  579. },
  580. created() {
  581. this.comCode = this.code
  582. if (this.comCode) {
  583. if (this.yregion || this.yregion == 0) {
  584. this.region = '' + this.yregion
  585. }
  586. this.getCond()
  587. this.getPolicyList()
  588. }
  589. },
  590. methods: {
  591. getList() {
  592. this.getCrList()
  593. },
  594. onChange() {
  595. this.getCrList()
  596. },
  597. getCrList() {
  598. const customerParams = {
  599. pageNum: this.currentPages,
  600. pageSize: this.pageSizes,
  601. keyword: this.keyword,
  602. region: '',
  603. websitNumber: this.region == '0' && this.adminWebsit ? this.adminWebsit.websitNumber : ''
  604. }
  605. // 获取经销商列表
  606. getCrList(customerParams).then(res => {
  607. for (let j = 0; j < this.custoList.length; j++) {
  608. for (let i = 0; i < res.data.records.length; i++) {
  609. if (res.data.records[i].id === this.custoList[j].customerId) {
  610. res.data.records[i].disabled = true
  611. }
  612. }
  613. }
  614. this.dataL = res.data.records
  615. for (let k = 0; k < this.dataL.length; k++) {
  616. (this.dataL[k].customerId = this.dataL[k].id),
  617. (this.dataL[k].customerName = this.dataL[k].name),
  618. (this.dataL[k].customerNumber = this.dataL[k].number)
  619. }
  620. this.clistTotal = res.data.total
  621. })
  622. },
  623. getPolicyList() {
  624. this.clistLoading = true
  625. getPolicyList({
  626. pageNum: this.policyList.currentPages,
  627. pageSize: this.policyList.pageSize,
  628. policyId: this.comCode || this.code,
  629. keyword: this.keyword2
  630. }).then(res => {
  631. this.list = res.data.records
  632. console.log(this.list, '785787')
  633. this.cTotal = res.data.total
  634. this.clistLoading = false
  635. })
  636. },
  637. // 更改每页数量
  638. handleSizeChanges2(val) {
  639. this.policyList.pageSizes = val
  640. this.policyList.currentPages = 1
  641. this.getPolicyList()
  642. },
  643. // 更改当前页
  644. handleCurrentChanges2(val) {
  645. this.policyList.currentPages = val
  646. this.getPolicyList()
  647. },
  648. // 更改每页数量
  649. handleSizeChanges(val) {
  650. this.pageSizes = val
  651. this.currentPages = 1
  652. this.getCrList()
  653. },
  654. // 更改当前页
  655. handleCurrentChanges(val) {
  656. this.currentPages = val
  657. this.getCrList()
  658. },
  659. // 提交筛选表单
  660. submitScreenForm() {
  661. this.currentPages = 1
  662. this.getCrList()
  663. },
  664. // 重置筛选表单
  665. resetScreenForm() {
  666. this.keyword = ''
  667. this.currentPages = 1
  668. this.getCrList()
  669. },
  670. // 提交筛选表单
  671. submitScreenForm2() {
  672. this.policyList.currentPages = 1
  673. this.getPolicyList()
  674. },
  675. // 重置筛选表单
  676. resetScreenForm2() {
  677. this.keyword2 = ''
  678. this.policyList.currentPages = 1
  679. this.getPolicyList()
  680. },
  681. // 去掉相同数据
  682. resArr(arr1, arr2) {
  683. return arr1.filter(v => arr2.every(val => val.id !== v.id))
  684. },
  685. // 导入经销商模板
  686. async handleImport(param) {
  687. this.importLoading = true
  688. const file = param.file
  689. const formData = new FormData()
  690. formData.append('file', file)
  691. // formData.append('policyId', this.searchForm.code)
  692. // formData.append("mainId", this.searchForm.mainId);
  693. const result = await handleImport('policy/importCustomer', formData)
  694. console.log(result)
  695. this.importLoading = false
  696. this.importFileList = []
  697. if (result.code === 200) {
  698. await this.$alert(result.message, '导入成功', {
  699. confirmButtonText: '确定'
  700. })
  701. for (let i = 0; i < result.data.length; i++) {
  702. result.data[i].customerNumber = result.data[i].number
  703. result.data[i].customerName = result.data[i].name
  704. result.data[i].customerId = result.data[i].id
  705. }
  706. if (this.custoList.length) {
  707. this.custoList = [...this.custoList, ...this.resArr(this.custoList, result.data)]
  708. } else {
  709. this.custoList = result.data
  710. }
  711. } else {
  712. await this.$alert(result.message, '导入失败', {
  713. confirmButtonText: '确定'
  714. })
  715. }
  716. },
  717. async handleImports(param) {
  718. this.importLoading = true
  719. const file = param.file
  720. const formData = new FormData()
  721. formData.append('file', file)
  722. formData.append('policyId', this.comCode || this.code)
  723. // formData.append("mainId", this.searchForm.mainId);
  724. const result = await handleImport('policy/limit/import', formData)
  725. console.log(result)
  726. this.importLoading = false
  727. this.importFileList = []
  728. if (result.code === 200) {
  729. await this.$alert(result.message, '导入成功', {
  730. confirmButtonText: '确定'
  731. })
  732. this.list = result.data
  733. this.getPolicyList()
  734. } else {
  735. await this.$alert(result.message, '导入失败', {
  736. confirmButtonText: '确定'
  737. })
  738. }
  739. },
  740. // 下载经销商模板
  741. hanleDownloadFiles() {
  742. downloadFiles('policy/downloadCustomer')
  743. },
  744. hanleDownloadFilesPolicy() {
  745. downloadFiles('policy/limit/download')
  746. },
  747. getCommonApi(row) {
  748. (this.isEdit = 2), (this.cid = row.id), (this.cpolicyId = row.policyId)
  749. console.log(this.cpolicyId, this.comCode, this.cpolicyId === this.comCode)
  750. },
  751. getCond() {
  752. this.listLoading = true
  753. const custoParams = {
  754. pageNum: 1,
  755. pageSize: -1,
  756. policyId: this.comCode || this.code
  757. }
  758. getCustomerList(custoParams).then(res => {
  759. this.custoList = res.data.records
  760. console.log(this.custoList, '已选的')
  761. this.clistTotals = res.data.total
  762. this.listLoading = false
  763. // this.getCrList()
  764. })
  765. },
  766. handleCondition(id, index) {
  767. deleteCondition({ id }).then(res => {
  768. this.getConditionList()
  769. this.$successMsg('删除成功')
  770. })
  771. },
  772. getConditionList() {
  773. const condParams = {
  774. policyId: this.comCode
  775. }
  776. getConditionList(condParams).then(res => {
  777. this.conditionList = res.data
  778. })
  779. },
  780. // 删除
  781. hanleDelete(id) {
  782. const params = { policyMaterialId: id }
  783. deleteMaterialPolicy(params).then(res => {
  784. this.$successMsg('删除成功')
  785. })
  786. },
  787. /**
  788. * 根据条件禁用行复选框
  789. * 函数返回值为false则禁用选择(反之亦然)
  790. * @param {Object} row - 行数据
  791. * @param {String} index - 索引值
  792. * @return Boolean
  793. */
  794. selectable: function(row, index) {
  795. // row.disabled == undefined 才能被选中
  796. if (row.disabled === undefined || row.disabled === false) {
  797. return true
  798. } else {
  799. return false
  800. }
  801. // 函数必须有返回值且是布尔值
  802. // 页面刷新后该函数会执行 N 次进行判断(N 为表格行数)
  803. // 如果没有返回值则默认返回false(全部无法选中)
  804. },
  805. handleSelectionAllChange(e) {
  806. this.leftData = e
  807. this.type = 1
  808. },
  809. handleSelectionChange(e) {
  810. this.leftData = e
  811. this.type = 1
  812. },
  813. handleSelectionAllChange2(e) {
  814. this.rightData = e
  815. this.type = 2
  816. },
  817. handleSelectionChange2(e) {
  818. this.rightData = e
  819. this.type = 2
  820. },
  821. handleLeft(e) {
  822. this.type = 1
  823. },
  824. handleRight(e) {
  825. this.type = 2
  826. },
  827. handleAllAdd() {
  828. if (this.type === 1 && this.leftData.length) {
  829. for (let i = 0; i < this.dataL.length; i++) {
  830. for (let j = 0; j < this.leftData.length; j++) {
  831. if (this.dataL[i].id === this.leftData[j].id) {
  832. this.dataL[i].disabled = true
  833. }
  834. }
  835. }
  836. this.custoList = [...this.custoList, ...this.leftData]
  837. this.$refs.multipleTable.clearSelection()
  838. } else {
  839. this.$errorMsg('请选择要添加的经销商')
  840. }
  841. },
  842. handleAllDelete() {
  843. if (this.type === 2 && this.rightData.length) {
  844. for (let i = 0; i < this.dataL.length; i++) {
  845. for (let j = 0; j < this.rightData.length; j++) {
  846. if (this.dataL[i].id === this.rightData[j].customerId) {
  847. this.$set(this.dataL[i], 'disabled', false)
  848. // this.dataL[i].disabled = false
  849. }
  850. }
  851. }
  852. this.custoList = this.resArr(this.custoList, this.rightData)
  853. this.$refs.multipleTable.clearSelection()
  854. } else {
  855. this.$errorMsg('请选择要删除的经销商')
  856. }
  857. },
  858. handleAdd() {
  859. if (this.type === 1 && this.leftData.length) {
  860. for (let i = 0; i < this.dataL.length; i++) {
  861. for (let j = 0; j < this.leftData.length; j++) {
  862. if (this.dataL[i].id === this.leftData[j].id) {
  863. this.dataL[i].disabled = true
  864. }
  865. }
  866. }
  867. this.custoList = [...this.custoList, ...this.leftData]
  868. this.leftData = []
  869. this.$refs.multipleTable.clearSelection()
  870. } else {
  871. this.$errorMsg('请选择要添加的经销商')
  872. }
  873. },
  874. handleDelete() {
  875. if (this.type === 2 && this.rightData.length) {
  876. for (let i = 0; i < this.dataL.length; i++) {
  877. for (let j = 0; j < this.rightData.length; j++) {
  878. if (this.dataL[i].id === this.rightData[j].customerId) {
  879. this.$set(this.dataL[i], 'disabled', false)
  880. // this.dataL[i].disabled = false
  881. }
  882. }
  883. }
  884. this.custoList = this.resArr(this.custoList, this.rightData)
  885. this.$refs.multipleTable.clearSelection()
  886. } else {
  887. this.$errorMsg('请选择要删除的经销商')
  888. }
  889. },
  890. // 提交数据
  891. async handleSave() {
  892. this.$emit('handlEditPolicy', this.custoList, this.region)
  893. },
  894. handleReset() {
  895. this.dataR = this.rightData = []
  896. this.keyword = ''
  897. this.$emit('handleReset')
  898. },
  899. selectionChange(data) {
  900. this.selectedData = data
  901. },
  902. handelBatchData(search) {
  903. if (search) {
  904. this.batchCurrentPages = 1
  905. }
  906. getPolicyList({
  907. pageNum: this.batchCurrentPages,
  908. pageSize: this.batchPageSizes,
  909. policyId: this.comCode || this.code,
  910. keyword: this.limitQtyKeyWord
  911. }).then(res => {
  912. this.tableData = res.data.records
  913. this.batchTotal = res.data.total
  914. })
  915. this.visible = true
  916. },
  917. handelBatchData2() {
  918. this.maxBuyNumVisible = true
  919. },
  920. handleDialogVisible() {
  921. this.visible = false
  922. this.maxBuyNumVisible = false
  923. this.batchCurrentPages = 1
  924. this.batchPageSizes = 10
  925. this.limitQty = 0
  926. this.maxBuyNum = 0
  927. this.limitQtyKeyWord = ''
  928. this.maxBuyNumKeyWord = ''
  929. },
  930. onSubmit(type) {
  931. if (!this.selectedData.length) {
  932. this.$errorMsg('不能为空,请选择')
  933. return
  934. }
  935. if (this.limitQty <= 0 || this.maxBuyNum <= 0) {
  936. this.$errorMsg(type ? '购买量上限不能小于0' : '最大提货组数不能小于0')
  937. return
  938. }
  939. const customerIds = this.selectedData
  940. .map(k => {
  941. return k.customerId
  942. })
  943. .join('')
  944. const params = {
  945. customerIds,
  946. policyId: this.comCode || this.code
  947. }
  948. if (type) {
  949. params.limitQty = this.limitQty
  950. } else {
  951. params.maxBuyNum = this.maxBuyNum
  952. }
  953. updateLimitBatchupdate(params).then(res => {
  954. this.handleDialogVisible()
  955. this.$successMsg('批量修改成功')
  956. })
  957. },
  958. handleBatchSizeChanges(val) {
  959. this.batchCurrentPages = 1
  960. this.batchPageSizes = val
  961. this.handelBatchData()
  962. },
  963. onReset() {
  964. this.handleDialogVisible()
  965. this.handelBatchData()
  966. },
  967. handleBatchCurrentChanges(val) {
  968. this.batchCurrentPages = val
  969. this.handelBatchData()
  970. }
  971. }
  972. }
  973. </script>
  974. <style lang="scss" scoped>
  975. .radio {
  976. display: flex;
  977. align-items: center;
  978. margin: 0 0 20px 0;
  979. }
  980. .import-btn {
  981. margin: 0 20px;
  982. }
  983. .cus-btn {
  984. margin: 0;
  985. }
  986. .value {
  987. ::v-deep .el-input__prefix {
  988. display: none;
  989. }
  990. }
  991. .descriptions {
  992. // border: #EBEEF5;
  993. border: 1px solid #ebeef5;
  994. border-bottom: none;
  995. .el-row {
  996. height: 40px;
  997. line-height: 40px;
  998. }
  999. .el-col:nth-child(odd) {
  1000. background-color: #ebeef5;
  1001. }
  1002. .el-col {
  1003. padding: 0 15px;
  1004. height: 100%;
  1005. border-bottom: 1px solid #ebeef5;
  1006. }
  1007. }
  1008. .el-divider--horizontal {
  1009. margin: 20px 0;
  1010. }
  1011. .col {
  1012. height: 100px;
  1013. }
  1014. .import-btn {
  1015. margin-right: 10px;
  1016. display: inline-block;
  1017. }
  1018. ::v-deep .el-input__icon .el-icon-time {
  1019. display: none;
  1020. }
  1021. .middle_box {
  1022. margin-top: 80px;
  1023. text-align: center;
  1024. height: 430px;
  1025. display: flex;
  1026. flex-direction: column;
  1027. align-content: center;
  1028. justify-content: space-between;
  1029. align-items: center;
  1030. }
  1031. .img-box {
  1032. height: 150px;
  1033. display: flex;
  1034. align-items: center;
  1035. }
  1036. .red {
  1037. color: #f00;
  1038. }
  1039. </style>