AddCondition.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922
  1. <template>
  2. <el-container class="app-container mymian-container">
  3. <el-header height="50px" class="header">
  4. <el-page-header
  5. @back="handleBack"
  6. :content="!id ? (!edit ? '新增' : '编辑') : '详情页面'"
  7. >
  8. </el-page-header>
  9. </el-header>
  10. <div class="line">
  11. <el-divider></el-divider>
  12. <h4>限定条件</h4>
  13. <el-divider></el-divider>
  14. </div>
  15. <el-main v-if="!id">
  16. <el-row v-if="conditionBox.length">
  17. <el-row :gutter="50">
  18. <el-col
  19. :xs="24"
  20. :sm="24"
  21. :lg="24"
  22. class="mgb"
  23. v-for="(item, index) in conditionBox"
  24. :key="index"
  25. >
  26. <h5 v-if="index == 0">限定机型</h5>
  27. <h5 v-if="index > 0">配提机型</h5>
  28. <el-row>
  29. <el-row class="pdt">
  30. <el-button
  31. type="primary"
  32. size="mini"
  33. @click="(VisibleModle = true), getMaterialLists(index)"
  34. >添加机型</el-button
  35. >
  36. <el-button
  37. type="primary"
  38. size="mini"
  39. @click="handleDeleteRow(index)"
  40. >删除机型</el-button
  41. >
  42. </el-row>
  43. <el-row class="table">
  44. <el-table
  45. v-loading="listLoadingArr[`listLoading${index}`]"
  46. style="width: 100%"
  47. :data="item"
  48. border
  49. @select="hanleSelectAll($event, index)"
  50. @select-all="hanleSelectAll($event, index)"
  51. >
  52. <el-table-column type="selection" width="55" align="left">
  53. </el-table-column>
  54. <el-table-column
  55. label="产品名称"
  56. width="300"
  57. show-overflow-tooltip
  58. align="left"
  59. prop="materialName"
  60. >
  61. <template slot-scope="scope">
  62. <CopyButton :copyText="scope.row.materialName" />
  63. <span>{{ scope.row.materialName }}</span>
  64. </template>
  65. </el-table-column>
  66. <el-table-column
  67. prop="specification"
  68. show-overflow-tooltip
  69. label="规格型号"
  70. align="left"
  71. >
  72. <template slot-scope="scope">
  73. <CopyButton :copyText="scope.row.specification" />
  74. <span>{{ scope.row.specification }}</span>
  75. </template>
  76. </el-table-column>
  77. </el-table>
  78. </el-row>
  79. </el-row>
  80. </el-col>
  81. </el-row>
  82. <el-row>
  83. <el-form label-width="120px" :inline="false" size="mini">
  84. <el-row>
  85. <el-form-item label="配置比例设置"> </el-form-item>
  86. </el-row>
  87. <el-col :xs="24" :sm="8" :lg="8">
  88. <el-form-item label="限定机型">
  89. <el-input size="mini" v-model="limit"></el-input>
  90. </el-form-item>
  91. </el-col>
  92. <el-col
  93. :xs="24"
  94. :sm="8"
  95. :lg="8"
  96. v-for="(len, index) in conditionBox.length - 1"
  97. >
  98. <el-form-item :label="'配提' + (index + 1) + '比例'">
  99. <el-input
  100. size="mini"
  101. v-model="popArr['line_' + index]"
  102. ></el-input>
  103. </el-form-item>
  104. </el-col>
  105. </el-form>
  106. </el-row>
  107. <el-divider></el-divider>
  108. </el-row>
  109. </el-main>
  110. <el-main v-else>
  111. <el-row>
  112. <el-row :gutter="50">
  113. <el-col
  114. :xs="24"
  115. :sm="24"
  116. :lg="24"
  117. class="mgb"
  118. v-for="(item, index) in conditionBoxs"
  119. :key="index"
  120. >
  121. <h5 v-if="index == 0">限定机型</h5>
  122. <h5 v-if="index > 0">配提机型</h5>
  123. <el-row>
  124. <el-row class="table">
  125. <el-table style="width: 100%" :data="item" border>
  126. <el-table-column
  127. type="selection"
  128. width="55"
  129. align="left"
  130. v-if="!id"
  131. >
  132. </el-table-column>
  133. <el-table-column
  134. type="index"
  135. label="序号"
  136. width="55"
  137. align="left"
  138. v-else
  139. >
  140. </el-table-column>
  141. <el-table-column
  142. label="产品名称"
  143. width="300"
  144. align="left"
  145. prop="materialName"
  146. >
  147. <template slot-scope="scope">
  148. <CopyButton :copyText="scope.row.materialName" />
  149. <span>{{ scope.row.materialName }}</span>
  150. </template>
  151. </el-table-column>
  152. <el-table-column
  153. prop="specification"
  154. label="规格型号"
  155. show-overflow-tooltip
  156. align="left"
  157. >
  158. <template slot-scope="scope">
  159. <CopyButton :copyText="scope.row.specification" />
  160. <span>{{ scope.row.specification }}</span>
  161. </template>
  162. </el-table-column>
  163. </el-table>
  164. </el-row>
  165. </el-row>
  166. </el-col>
  167. </el-row>
  168. <el-row v-if="conditionBoxs.length">
  169. <el-form label-width="120px" :inline="false" size="mini">
  170. <el-row>
  171. <el-form-item label="配置比例设置"> </el-form-item>
  172. </el-row>
  173. <el-col :xs="24" :sm="8" :lg="8">
  174. <el-form-item label="限定机型">
  175. <el-input
  176. size="mini"
  177. v-model="limit"
  178. :readonly="!id ? false : true"
  179. ></el-input>
  180. </el-form-item>
  181. </el-col>
  182. <el-col
  183. :xs="24"
  184. :sm="8"
  185. :lg="8"
  186. v-for="(len, index) in conditionBoxs.length - 1"
  187. >
  188. <el-form-item :label="'配提' + (index + 1) + '比例'">
  189. <el-input
  190. size="mini"
  191. :readonly="!id ? false : true"
  192. v-model="popArr['line_' + index]"
  193. ></el-input>
  194. </el-form-item>
  195. </el-col>
  196. </el-form>
  197. <el-col class="text_rihgt" v-if="false">
  198. <el-button type="primary" size="mini" @click=""
  199. >添加限定条件</el-button
  200. ></el-col
  201. >
  202. </el-row>
  203. <el-divider></el-divider>
  204. </el-row>
  205. </el-main>
  206. <el-footer height="100px" v-if="!id">
  207. <el-row :gutter="20">
  208. <el-col :xs="24" :sm="12" :lg="12" :offset="0">
  209. <el-button type="primary" size="mini" @click="handleSubmit"
  210. >保存</el-button
  211. >
  212. </el-col>
  213. <el-col :xs="24" :sm="12" :lg="12" :offset="0" class="tr">
  214. <el-button type="primary" size="mini" @click="hanleAddModel"
  215. >添加</el-button
  216. >
  217. <el-button type="primary" size="mini" @click="handleresale"
  218. >重置</el-button
  219. >
  220. </el-col>
  221. </el-row>
  222. </el-footer>
  223. <el-dialog
  224. :visible.sync="VisibleModle"
  225. width="80%"
  226. center
  227. @close="handleClose"
  228. :close-on-click-modal="false"
  229. >
  230. <div>
  231. <el-container>
  232. <el-header height="">
  233. <el-form label-width="0" :inline="false" size="mini">
  234. <el-col :xs="24" :sm="10" :lg="10" :offset="0">
  235. <el-form-item label="">
  236. <el-input
  237. v-model="saleTypeCode"
  238. placeholder="类型编号"
  239. ></el-input>
  240. </el-form-item>
  241. </el-col>
  242. <el-col :xs="24" :sm="10" :lg="10" :offset="1">
  243. <el-form-item label="">
  244. <el-button
  245. type="primary"
  246. size="mini"
  247. @click="getMaterialLists(arrIndex)"
  248. >搜索</el-button
  249. >
  250. </el-form-item>
  251. </el-col>
  252. </el-form>
  253. </el-header>
  254. <el-main height="">
  255. <el-row>
  256. <el-row :gutter="50">
  257. <el-col :xs="10" :ms="10" :lg="10">
  258. <el-row>
  259. <el-row> </el-row>
  260. <el-row class="table">
  261. <el-row class="title"> 可选产品列表 </el-row>
  262. <el-table
  263. ref="multipleTable"
  264. style="width: 100%"
  265. :data="conditList"
  266. border
  267. height="400"
  268. @select-all="handleSelectionAllChange"
  269. @selection-change="handleSelectionChange"
  270. >
  271. <el-table-column
  272. type="selection"
  273. width="55"
  274. :selectable="selectable"
  275. align="left"
  276. >
  277. </el-table-column>
  278. <el-table-column
  279. label="产品编码"
  280. prop="materialNumber"
  281. min-width="160"
  282. show-overflow-tooltip
  283. align="left"
  284. >
  285. <template slot-scope="scope">
  286. <CopyButton :copyText="scope.row.materialNumber" />
  287. <span>{{ scope.row.materialNumber }}</span>
  288. </template>
  289. </el-table-column>
  290. <el-table-column
  291. prop="materialName"
  292. label="产品名称"
  293. min-width="160"
  294. show-overflow-tooltip
  295. align="left"
  296. >
  297. <template slot-scope="scope">
  298. <CopyButton :copyText="scope.row.materialName" />
  299. <span>{{ scope.row.materialName }}</span>
  300. </template>
  301. </el-table-column>
  302. <el-table-column
  303. prop="specification"
  304. label="产品型号"
  305. min-width="300"
  306. show-overflow-tooltip
  307. align="left"
  308. >
  309. <template slot-scope="scope">
  310. <CopyButton :copyText="scope.row.specification" />
  311. <span>{{ scope.row.specification }}</span>
  312. </template>
  313. </el-table-column>
  314. <el-table-column
  315. prop="price"
  316. label="产品价格"
  317. min-width="160"
  318. show-overflow-tooltip
  319. align="right"
  320. >
  321. </el-table-column>
  322. </el-table>
  323. <el-row class="mg">
  324. <div>
  325. <el-pagination
  326. @size-change="handleSizeChange"
  327. @current-change="handleCurrentChange"
  328. :current-page="currentPage"
  329. :page-size.sync="mySize"
  330. :page-sizes="[10, 20, 30, 50]"
  331. layout="total, sizes, prev, pager, next, jumper"
  332. :total="listTotal"
  333. />
  334. </div>
  335. </el-row>
  336. </el-row>
  337. </el-row>
  338. </el-col>
  339. <el-col :xs="4" :ms="4" :lg="4" class="middle">
  340. <el-row :gutter="20" justify="center" align="middle">
  341. <el-row class="btn">
  342. <el-button
  343. type="primary"
  344. size="small "
  345. @click="handleAllAdd"
  346. :disabled="type == 2"
  347. >全部添加</el-button
  348. >
  349. </el-row>
  350. <el-row class="btn">
  351. <el-button
  352. type="primary"
  353. size="small "
  354. @click="handleAdd"
  355. :disabled="type == 2"
  356. >增加</el-button
  357. >
  358. </el-row>
  359. <el-row class="btn">
  360. <el-button
  361. type="primary"
  362. size="small "
  363. @click="handleDelete"
  364. :disabled="type == 1"
  365. >删除</el-button
  366. ></el-row
  367. >
  368. <el-row class="btn"
  369. ><el-button
  370. :disabled="type == 1"
  371. type="primary"
  372. size="small "
  373. @click="handleAllDelete"
  374. >全部删除</el-button
  375. ></el-row
  376. >
  377. </el-row>
  378. </el-col>
  379. <el-col :xs="10" :ms="10" :lg="10">
  380. <el-row>
  381. <el-row> </el-row>
  382. <el-row class="table">
  383. <el-row class="title"> 已选产品列表 </el-row>
  384. <el-table
  385. style="width: 100%"
  386. :data="conditList2"
  387. @select-all="handleSelectionAllChange2"
  388. @selection-change="handleSelectionChange2"
  389. border
  390. height="400"
  391. >
  392. <el-table-column
  393. type="selection"
  394. width="55"
  395. align="left"
  396. >
  397. </el-table-column>
  398. <el-table-column
  399. label="产品编码"
  400. prop="materialNumber"
  401. min-width="160"
  402. show-overflow-tooltip
  403. align="left"
  404. >
  405. <template slot-scope="scope">
  406. <CopyButton :copyText="scope.row.materialNumber" />
  407. <span>{{ scope.row.materialNumber }}</span>
  408. </template>
  409. </el-table-column>
  410. <el-table-column
  411. prop="materialName"
  412. label="产品名称"
  413. min-width="160"
  414. show-overflow-tooltip
  415. align="left"
  416. >
  417. <template slot-scope="scope">
  418. <CopyButton :copyText="scope.row.materialName" />
  419. <span>{{ scope.row.materialName }}</span>
  420. </template>
  421. </el-table-column>
  422. <el-table-column
  423. prop="specification"
  424. label="产品型号"
  425. min-width="300"
  426. show-overflow-tooltip
  427. align="left"
  428. >
  429. <template slot-scope="scope">
  430. <CopyButton :copyText="scope.row.specification" />
  431. <span>{{ scope.row.specification }}</span>
  432. </template>
  433. </el-table-column>
  434. <el-table-column
  435. prop="price"
  436. label="产品价格"
  437. min-width="160"
  438. show-overflow-tooltip
  439. align="right"
  440. >
  441. </el-table-column>
  442. </el-table>
  443. <el-row class="mg">
  444. <!-- <Pagination /> -->
  445. </el-row>
  446. </el-row>
  447. </el-row>
  448. </el-col>
  449. </el-row>
  450. </el-row>
  451. </el-main>
  452. </el-container>
  453. </div>
  454. <span slot="footer" class="dialog-footer">
  455. <el-button @click="VisibleModle = false;handleClose()">取 消</el-button>
  456. <el-button type="primary" @click="handleDiaSubmit">确 定</el-button>
  457. </span>
  458. </el-dialog>
  459. </el-container>
  460. </template>
  461. <script>
  462. import {
  463. addPoliyCondition,
  464. getConditionMaterialDetail,
  465. getConditionMaterialList,
  466. getMaterialList,
  467. } from "@/api/policy_list";
  468. import TabelTransfer from "./TabelTransfer.vue";
  469. import { mapState } from "vuex";
  470. import AddModel from "./AddModel";
  471. import Minxin from "@/mixin";
  472. export default {
  473. mixins: [Minxin],
  474. props: {
  475. id: {
  476. type: String,
  477. default: "",
  478. },
  479. policyId: {
  480. type: String,
  481. default: "",
  482. },
  483. },
  484. watch: {
  485. conditList: {
  486. handler(newValue, oldValue) {
  487. this.conditList = newValue
  488. },
  489. immediate: true,
  490. deep: true
  491. },
  492. conditList2: {
  493. handler(newValue, oldValue) {
  494. this.conditList2 = newValue
  495. },
  496. immediate: true,
  497. deep: true
  498. }
  499. },
  500. data() {
  501. return {
  502. base: {
  503. id: null,
  504. policyConditionMaterials: [
  505. {
  506. id: null,
  507. materialId: "",
  508. materialName: "",
  509. materialNumber: "",
  510. policyConditionId: "",
  511. policyId: "",
  512. policyMaterialId: "",
  513. popType: 0,
  514. specification: "",
  515. walletType: "",
  516. },
  517. ],
  518. policyId: "",
  519. policyName: "",
  520. pop: "",
  521. },
  522. limit: "",
  523. VisibleModle: false,
  524. conditionBox: [[], []],
  525. conditionBoxs: [],
  526. multipleSelection: [],
  527. searchForm: {
  528. code: "",
  529. },
  530. pop: "",
  531. conditList: [],
  532. leftData: [],
  533. rightData: [],
  534. conditList2: [],
  535. type: "",
  536. saleTypeCode: "",
  537. arrIndex: 0,
  538. pageSize: 10,
  539. popArr: {},
  540. fang: false,
  541. newConditionBox: [],
  542. currentPage: 1,
  543. edit: "",
  544. mySize: 10,
  545. listLoadingArr: {},
  546. };
  547. },
  548. created() {
  549. this.getCommonApi();
  550. },
  551. computed: mapState({
  552. comCode: (state) => state.sales.code,
  553. }),
  554. methods: {
  555. getList() {},
  556. handleBack() {
  557. if (this.$parent.isShow == 10) {
  558. this.$parent.isShow = 8;
  559. } else if (this.$parent.isShow == 12) {
  560. this.$parent.isShow = 4;
  561. } else {
  562. this.$parent.isCondition = 0;
  563. Object.assign(this.$data, this.$options.data());
  564. }
  565. },
  566. /**
  567. * 根据条件禁用行复选框
  568. * 函数返回值为false则禁用选择(反之亦然)
  569. * @param {Object} row - 行数据
  570. * @param {String} index - 索引值
  571. * @return Boolean
  572. */
  573. selectable: function (row, index) {
  574. // row.disabled == undefined 才能被选中
  575. if (row.disabled == undefined) {
  576. return true;
  577. }
  578. // 函数必须有返回值且是布尔值
  579. // 页面刷新后该函数会执行 N 次进行判断(N 为表格行数)
  580. // 如果没有返回值则默认返回false(全部无法选中)
  581. },
  582. async getCommonApi(policyId) {
  583. if (this.id || policyId) {
  584. if (policyId) {
  585. this.edit = "eidt";
  586. }
  587. const res = await getConditionMaterialDetail({
  588. id: this.policyId || policyId || this.id,
  589. });
  590. this.pop = res.data.pop;
  591. let pop = res.data.pop.split(":");
  592. this.conditionBox = [];
  593. for (let i = 0; i < pop.length; i++) {
  594. if (i == 0) {
  595. this.limit = pop[i];
  596. continue;
  597. }
  598. this.$set(this.popArr, `line_${i - 1}`, pop[i]);
  599. this.$set(this.listLoadingArr, `listLoading${i}`, false);
  600. }
  601. for (let k = 0; k < pop.length; k++) {
  602. this.listLoadingArr[`listLoading${k}`] = true;
  603. const { data } = await getConditionMaterialList({
  604. pageNum: 1,
  605. pageSize: -1,
  606. policyConditionId: res.data.id,
  607. popType: k + 1,
  608. });
  609. if (policyId) {
  610. this.conditionBox.push(data.records);
  611. } else {
  612. this.conditionBoxs.push(data.records);
  613. }
  614. this.listLoadingArr[`listLoading${k}`] = false;
  615. }
  616. }
  617. },
  618. toggleSelection(rows) {
  619. if (rows) {
  620. rows.forEach((row) => {
  621. this.$refs.multipleTable.toggleRowSelection(row);
  622. });
  623. } else {
  624. this.$refs.multipleTable.clearSelection();
  625. }
  626. },
  627. hanleAddModel() {
  628. this.conditionBox.push([]);
  629. },
  630. handleSubmit() {
  631. var tableData = [];
  632. this.newConditionBox.push(JSON.parse(JSON.stringify(this.conditionBox)));
  633. for (let i = 0; i < this.conditionBox.length; i++) {
  634. for (let j = 0; j < this.conditionBox[i].length; j++) {
  635. this.conditionBox[i][j].popType = i + 1;
  636. this.conditionBox[i][j].policyId = this.$parent.searchForm.code || this.comCode;
  637. this.conditionBox[i][j].id = "";
  638. // this.conditionBox[i][j].policyMaterialId =this.conditionBox[i][j].materialId
  639. }
  640. tableData = [...tableData, ...this.conditionBox[i]];
  641. }
  642. if (!tableData.length) {
  643. this.$errorMsg("请选择机型");
  644. return;
  645. }
  646. var pop = [this.limit];
  647. for (const key in this.popArr) {
  648. pop.push(this.popArr[key]);
  649. }
  650. console.log(pop.join(":"));
  651. const params = {
  652. id: "",
  653. policyConditionMaterials: tableData,
  654. policyId: this.$parent.searchForm.code || this.comCode,
  655. policyName: "",
  656. pop: pop.join(":"),
  657. };
  658. addPoliyCondition(params).then((res) => {
  659. this.$successMsg("添加成功");
  660. this.conditionBox = [[], []];
  661. this.conditionBoxs = [];
  662. this.limit = "";
  663. this.pop = "";
  664. this.popArr = {};
  665. this.$parent.isCondition = 0;
  666. this.$parent.isFlag = 1;
  667. // Object.assign(this.$data, this.$options.data());
  668. this.$emit(
  669. "handleSubmitCon",
  670. this.$parent.searchForm.code || this.comCode
  671. );
  672. });
  673. },
  674. handleSelectionChange(val) {
  675. this.multipleSelection = val;
  676. },
  677. // 筛选全部数据
  678. hanleSelectAll(selection, index) {
  679. this.arrIndex = index;
  680. this.ids = selection.map((k) => {
  681. return k.id;
  682. });
  683. console.log(this.ids);
  684. },
  685. handleDeleteRow(index) {
  686. if (this.arrIndex == index && this.ids.length) {
  687. var arr = [];
  688. for (var i = 0; i < this.conditionBox[index].length; i++) {
  689. if (this.ids.indexOf(this.conditionBox[index][i].id) == -1) {
  690. arr.push(this.conditionBox[index][i]);
  691. }
  692. }
  693. this.conditionBox[index] = [];
  694. this.$set(this.conditionBox, index, arr);
  695. this.$refs.multipleTable.clearSelection();
  696. }
  697. },
  698. // 更改每页数量
  699. handleSizeChange(val) {
  700. this.pageSize = val;
  701. this.currentPage = 1;
  702. this.getMaterialLists(this.arrIndex);
  703. },
  704. // 更改当前页
  705. handleCurrentChange(val) {
  706. this.currentPage = val;
  707. this.getMaterialLists(this.arrIndex);
  708. },
  709. // 更改列表当前页
  710. handleTableCurrentChange(val) {
  711. this.currentPage = val;
  712. this.getMaterialLists(this.arrIndex);
  713. },
  714. getMaterialLists(index) {
  715. this.arrIndex = index;
  716. getMaterialList({
  717. pageNum: this.currentPage,
  718. pageSize: this.pageSize,
  719. saleTypeCode: this.saleTypeCode,
  720. policyId: this.$parent.searchForm.code || this.comCode,
  721. }).then((res) => {
  722. let datas = [];
  723. for (let j = 0; j < this.conditionBox.length; j++) {
  724. datas = [...datas, ...this.conditionBox[j]];
  725. }
  726. /**
  727. * @value newConditionBox 首页保存的所有选中者,即条件1
  728. * @value res.data.records,this.conditList 每次点击添加获取的最新数据
  729. * @value disabled 添加条件都进行比较上一个条件或者所有条件当中的限定机型和配提机型,
  730. * 如:上一个或者所有条件中已经存在disabled
  731. */
  732. if (this.newConditionBox.length) {
  733. this.conditList = res.data.records;
  734. if (this.conditionBox[index].length) {
  735. for (let n = 0; n < this.newConditionBox.length; n++) {
  736. for (let m = 0; m < this.newConditionBox[n].length; m++) {
  737. if (m == index) {
  738. this.$set(this.newConditionBox[n], m, [
  739. ...this.conditionBox[index],
  740. ...this.newConditionBox[n][m],
  741. ]);
  742. console.log(this.newConditionBox, "newenewnwn");
  743. }
  744. }
  745. }
  746. }
  747. for (let j = 0; j < this.newConditionBox.length; j++) {
  748. for (let o = 0; o < this.newConditionBox[j].length; o++) {
  749. if (o == index) {
  750. for (let i = 0; i < res.data.records.length; i++) {
  751. for (let k = 0; k < this.newConditionBox[j][o].length; k++) {
  752. if (
  753. this.newConditionBox[j][o][k].id == res.data.records[i].id
  754. ) {
  755. res.data.records[i].disabled = true;
  756. }
  757. }
  758. }
  759. } else {
  760. this.conditList = res.data.records;
  761. }
  762. }
  763. }
  764. this.conditList = res.data.records;
  765. } else {
  766. const newData = datas;
  767. if (newData.length) {
  768. for (let i = 0; i < res.data.records.length; i++) {
  769. for (let k = 0; k < newData.length; k++) {
  770. if (newData[k].id == res.data.records[i].id) {
  771. res.data.records[i].disabled = true;
  772. }
  773. }
  774. }
  775. }
  776. this.conditList = res.data.records;
  777. this.listTotal = res.data.total;
  778. }
  779. });
  780. },
  781. handleSelectionAllChange(e) {
  782. this.leftData = e;
  783. this.type = 1;
  784. },
  785. handleSelectionChange(e) {
  786. this.leftData = e;
  787. this.type = 1;
  788. },
  789. handleSelectionAllChange2(e) {
  790. this.rightData = e;
  791. this.type = 2;
  792. },
  793. handleSelectionChange2(e) {
  794. this.rightData = e;
  795. this.type = 2;
  796. },
  797. handleAllAdd() {
  798. this.conditList2 = this.leftData;
  799. this.leftData = [];
  800. this.$refs.multipleTable.clearSelection();
  801. },
  802. handleAllDelete() {
  803. this.conditList2 = [];
  804. },
  805. //
  806. handleAdd() {
  807. this.conditList2 = [...new Set([...this.conditList2,...this.leftData])];
  808. this.$refs.multipleTable.clearSelection();
  809. },
  810. //去掉相同数据
  811. resArr(arr1, arr2) {
  812. return arr1.filter((v) => arr2.every((val) => val.id != v.id));
  813. },
  814. handleDelete() {
  815. if (this.type == 2) {
  816. this.conditList2 = this.resArr(this.conditList2, this.rightData);
  817. this.rightData = [];
  818. }
  819. },
  820. handleDiaSubmit() {
  821. if (this.conditList2.length) {
  822. for (let i = 0; i < this.conditionBox.length; i++) {
  823. if (i == this.arrIndex) {
  824. this.$set(this.conditionBox, i, [
  825. ...this.conditList2,
  826. ...this.conditionBox[i],
  827. ]);
  828. }
  829. }
  830. this.mySize = 10;
  831. this.currentPage = 1;
  832. this.pageSize = 10;
  833. this.VisibleModle = false;
  834. this.conditList2 = [];
  835. } else {
  836. this.$errorMsg("请选择内容");
  837. }
  838. },
  839. handleClose() {
  840. this.mySize = 10;
  841. this.currentPage = 1;
  842. this.pageSize = 10;
  843. },
  844. handleresale() {
  845. Object.assign(this.$data, this.$options.data());
  846. },
  847. },
  848. components: {
  849. AddModel,
  850. TabelTransfer,
  851. },
  852. };
  853. </script>
  854. <style lang="scss" scoped>
  855. .line {
  856. margin: 0 20px;
  857. }
  858. .mgb {
  859. margin-bottom: 20px;
  860. }
  861. .pdt {
  862. padding-bottom: 20px;
  863. }
  864. .text_rihgt {
  865. text-align: right;
  866. }
  867. .header {
  868. margin-bottom: 40px;
  869. }
  870. .el-main {
  871. overflow: hidden;
  872. }
  873. .btn {
  874. margin: 20px 0;
  875. text-align: center;
  876. }
  877. .query_btn {
  878. margin-left: 0;
  879. }
  880. .mg {
  881. margin: 20px;
  882. }
  883. .pdt {
  884. margin: 20px 0;
  885. }
  886. .el-main {
  887. overflow: hidden;
  888. }
  889. .middle {
  890. height: 430px;
  891. display: flex;
  892. align-content: center;
  893. justify-content: center;
  894. align-items: center;
  895. }
  896. .title {
  897. padding: 10px 0;
  898. text-align: center;
  899. border-left: 1px solid #ebeef5;
  900. border-right: 1px solid #ebeef5;
  901. border-top: 1px solid #ebeef5;
  902. }
  903. </style>