Examine.vue 31 KB

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