TabelTransfer.vue 35 KB

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