AddCondition.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902
  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. data() {
  485. return {
  486. base: {
  487. id: null,
  488. policyConditionMaterials: [
  489. {
  490. id: null,
  491. materialId: "",
  492. materialName: "",
  493. materialNumber: "",
  494. policyConditionId: "",
  495. policyId: "",
  496. policyMaterialId: "",
  497. popType: 0,
  498. specification: "",
  499. walletType: "",
  500. },
  501. ],
  502. policyId: "",
  503. policyName: "",
  504. pop: "",
  505. },
  506. limit: "",
  507. VisibleModle: false,
  508. conditionBox: [[], []],
  509. conditionBoxs: [],
  510. multipleSelection: [],
  511. searchForm: {
  512. code: "",
  513. },
  514. pop: "",
  515. conditList: [],
  516. leftData: [],
  517. rightData: [],
  518. conditList2: [],
  519. type: "",
  520. saleTypeCode: "",
  521. arrIndex: 0,
  522. pageSize: 10,
  523. popArr: {},
  524. fang: false,
  525. newConditionBox: [],
  526. currentPage: 1,
  527. edit: "",
  528. mySize: 10,
  529. listLoadingArr: {},
  530. };
  531. },
  532. created() {
  533. this.getCommonApi();
  534. },
  535. computed: mapState({
  536. comCode: (state) => state.sales.code,
  537. }),
  538. methods: {
  539. getList() {},
  540. handleBack() {
  541. if (this.$parent.isShow == 10) {
  542. this.$parent.isShow = 8;
  543. } else if (this.$parent.isShow == 12) {
  544. this.$parent.isShow = 4;
  545. } else {
  546. this.$parent.isCondition = 0;
  547. Object.assign(this.$data, this.$options.data());
  548. }
  549. },
  550. /**
  551. * 根据条件禁用行复选框
  552. * 函数返回值为false则禁用选择(反之亦然)
  553. * @param {Object} row - 行数据
  554. * @param {String} index - 索引值
  555. * @return Boolean
  556. */
  557. selectable: function (row, index) {
  558. // row.disabled == undefined 才能被选中
  559. if (row.disabled == undefined) {
  560. return true;
  561. }
  562. // 函数必须有返回值且是布尔值
  563. // 页面刷新后该函数会执行 N 次进行判断(N 为表格行数)
  564. // 如果没有返回值则默认返回false(全部无法选中)
  565. },
  566. async getCommonApi(policyId) {
  567. if (this.id || policyId) {
  568. if (policyId) {
  569. this.edit = "eidt";
  570. }
  571. const res = await getConditionMaterialDetail({
  572. id: this.policyId || policyId || this.id,
  573. });
  574. this.pop = res.data.pop;
  575. let pop = res.data.pop.split(":");
  576. this.conditionBox = [];
  577. for (let i = 0; i < pop.length; i++) {
  578. if (i == 0) {
  579. this.limit = pop[i];
  580. continue;
  581. }
  582. this.$set(this.popArr, `line_${i - 1}`, pop[i]);
  583. this.$set(this.listLoadingArr, `listLoading${i}`, false);
  584. }
  585. for (let k = 0; k < pop.length; k++) {
  586. this.listLoadingArr[`listLoading${k}`] = true;
  587. const { data } = await getConditionMaterialList({
  588. pageNum: 1,
  589. pageSize: -1,
  590. policyConditionId: res.data.id,
  591. popType: k + 1,
  592. });
  593. if (policyId) {
  594. this.conditionBox.push(data.records);
  595. } else {
  596. this.conditionBoxs.push(data.records);
  597. }
  598. this.listLoadingArr[`listLoading${k}`] = false;
  599. }
  600. }
  601. },
  602. toggleSelection(rows) {
  603. if (rows) {
  604. rows.forEach((row) => {
  605. this.$refs.multipleTable.toggleRowSelection(row);
  606. });
  607. } else {
  608. this.$refs.multipleTable.clearSelection();
  609. }
  610. },
  611. hanleAddModel() {
  612. this.conditionBox.push([]);
  613. },
  614. handleSubmit() {
  615. var tableData = [];
  616. this.newConditionBox.push(JSON.parse(JSON.stringify(this.conditionBox)));
  617. for (let i = 0; i < this.conditionBox.length; i++) {
  618. for (let j = 0; j < this.conditionBox[i].length; j++) {
  619. this.conditionBox[i][j].popType = i + 1;
  620. this.conditionBox[i][j].policyId = this.$parent.searchForm.code || this.comCode;
  621. this.conditionBox[i][j].id = "";
  622. // this.conditionBox[i][j].policyMaterialId =this.conditionBox[i][j].materialId
  623. }
  624. tableData = [...tableData, ...this.conditionBox[i]];
  625. }
  626. if (!tableData.length) {
  627. this.$errorMsg("请选择机型");
  628. return;
  629. }
  630. var pop = [this.limit];
  631. for (const key in this.popArr) {
  632. pop.push(this.popArr[key]);
  633. }
  634. console.log(pop.join(":"));
  635. const params = {
  636. id: "",
  637. policyConditionMaterials: tableData,
  638. policyId: this.$parent.searchForm.code || this.comCode,
  639. policyName: "",
  640. pop: pop.join(":"),
  641. };
  642. addPoliyCondition(params).then((res) => {
  643. this.$successMsg("添加成功");
  644. this.conditionBox = [[], []];
  645. this.conditionBoxs = [];
  646. this.limit = "";
  647. this.pop = "";
  648. this.popArr = {};
  649. this.$parent.isCondition = 0;
  650. this.$parent.isFlag = 1;
  651. // Object.assign(this.$data, this.$options.data());
  652. this.$emit(
  653. "handleSubmitCon",
  654. this.$parent.searchForm.code || this.comCode
  655. );
  656. });
  657. },
  658. handleSelectionChange(val) {
  659. this.multipleSelection = val;
  660. },
  661. // 筛选全部数据
  662. hanleSelectAll(selection, index) {
  663. this.arrIndex = index;
  664. this.ids = selection.map((k) => {
  665. return k.id;
  666. });
  667. console.log(this.ids);
  668. },
  669. handleDeleteRow(index) {
  670. if (this.arrIndex == index && this.ids.length) {
  671. var arr = [];
  672. for (var i = 0; i < this.conditionBox[index].length; i++) {
  673. if (this.ids.indexOf(this.conditionBox[index][i].id) == -1) {
  674. arr.push(this.conditionBox[index][i]);
  675. }
  676. }
  677. this.conditionBox[index] = [];
  678. this.$set(this.conditionBox, index, arr);
  679. this.$refs.multipleTable.clearSelection();
  680. }
  681. },
  682. // 更改每页数量
  683. handleSizeChange(val) {
  684. this.pageSize = val;
  685. this.currentPage = 1;
  686. this.getMaterialLists(this.arrIndex);
  687. },
  688. // 更改当前页
  689. handleCurrentChange(val) {
  690. this.currentPage = val;
  691. this.getMaterialLists(this.arrIndex);
  692. },
  693. // 更改列表当前页
  694. handleTableCurrentChange(val) {
  695. this.currentPage = val;
  696. this.getMaterialLists(this.arrIndex);
  697. },
  698. getMaterialLists(index) {
  699. this.arrIndex = index;
  700. getMaterialList({
  701. pageNum: this.currentPage,
  702. pageSize: this.pageSize,
  703. saleTypeCode: this.saleTypeCode,
  704. policyId: this.$parent.searchForm.code || this.comCode,
  705. }).then((res) => {
  706. let datas = [];
  707. for (let j = 0; j < this.conditionBox.length; j++) {
  708. datas = [...datas, ...this.conditionBox[j]];
  709. }
  710. /**
  711. * @value newConditionBox 首页保存的所有选中者,即条件1
  712. * @value res.data.records,this.conditList 每次点击添加获取的最新数据
  713. * @value disabled 添加条件都进行比较上一个条件或者所有条件当中的限定机型和配提机型,
  714. * 如:上一个或者所有条件中已经存在disabled
  715. */
  716. if (this.newConditionBox.length) {
  717. this.conditList = res.data.records;
  718. if (this.conditionBox[index].length) {
  719. for (let n = 0; n < this.newConditionBox.length; n++) {
  720. for (let m = 0; m < this.newConditionBox[n].length; m++) {
  721. if (m == index) {
  722. this.$set(this.newConditionBox[n], m, [
  723. ...this.conditionBox[index],
  724. ...this.newConditionBox[n][m],
  725. ]);
  726. console.log(this.newConditionBox, "newenewnwn");
  727. }
  728. }
  729. }
  730. }
  731. for (let j = 0; j < this.newConditionBox.length; j++) {
  732. for (let o = 0; o < this.newConditionBox[j].length; o++) {
  733. if (o == index) {
  734. for (let i = 0; i < res.data.records.length; i++) {
  735. for (let k = 0; k < this.newConditionBox[j][o].length; k++) {
  736. if (
  737. this.newConditionBox[j][o][k].id == res.data.records[i].id
  738. ) {
  739. res.data.records[i].disabled = true;
  740. }
  741. }
  742. }
  743. } else {
  744. this.conditList = res.data.records;
  745. }
  746. }
  747. }
  748. this.conditList = res.data.records;
  749. } else {
  750. const newData = datas;
  751. if (newData.length) {
  752. for (let i = 0; i < res.data.records.length; i++) {
  753. for (let k = 0; k < newData.length; k++) {
  754. if (newData[k].id == res.data.records[i].id) {
  755. res.data.records[i].disabled = true;
  756. }
  757. }
  758. }
  759. }
  760. this.conditList = res.data.records;
  761. this.listTotal = res.data.total;
  762. }
  763. });
  764. },
  765. handleSelectionAllChange(e) {
  766. this.leftData = e;
  767. this.type = 1;
  768. },
  769. handleSelectionChange(e) {
  770. this.leftData = e;
  771. this.type = 1;
  772. },
  773. handleSelectionAllChange2(e) {
  774. this.rightData = e;
  775. this.type = 2;
  776. },
  777. handleSelectionChange2(e) {
  778. this.rightData = e;
  779. this.type = 2;
  780. },
  781. handleAllAdd() {
  782. this.conditList2 = this.leftData;
  783. this.leftData = [];
  784. },
  785. handleAllDelete() {
  786. this.conditList2 = [];
  787. },
  788. handleAdd() {
  789. this.conditList2 = this.leftData;
  790. },
  791. //去掉相同数据
  792. resArr(arr1, arr2) {
  793. return arr1.filter((v) => arr2.every((val) => val.id != v.id));
  794. },
  795. handleDelete() {
  796. if (this.type == 2) {
  797. this.conditList2 = this.resArr(this.conditList2, this.rightData);
  798. this.rightData = [];
  799. }
  800. },
  801. handleDiaSubmit() {
  802. if (this.conditList2.length) {
  803. for (let i = 0; i < this.conditionBox.length; i++) {
  804. if (i == this.arrIndex) {
  805. this.$set(this.conditionBox, i, [
  806. ...this.conditList2,
  807. ...this.conditionBox[i],
  808. ]);
  809. }
  810. }
  811. this.mySize = 10;
  812. this.currentPage = 1;
  813. this.pageSize = 10;
  814. this.VisibleModle = false;
  815. this.conditList2 = [];
  816. } else {
  817. this.$errorMsg("请选择内容");
  818. }
  819. },
  820. handleClose() {
  821. this.mySize = 10;
  822. this.currentPage = 1;
  823. this.pageSize = 10;
  824. },
  825. handleresale() {
  826. Object.assign(this.$data, this.$options.data());
  827. },
  828. },
  829. components: {
  830. AddModel,
  831. TabelTransfer,
  832. },
  833. };
  834. </script>
  835. <style lang="scss" scoped>
  836. .line {
  837. margin: 0 20px;
  838. }
  839. .mgb {
  840. margin-bottom: 20px;
  841. }
  842. .pdt {
  843. padding-bottom: 20px;
  844. }
  845. .text_rihgt {
  846. text-align: right;
  847. }
  848. .header {
  849. margin-bottom: 40px;
  850. }
  851. .el-main {
  852. overflow: hidden;
  853. }
  854. .btn {
  855. margin: 20px 0;
  856. text-align: center;
  857. }
  858. .query_btn {
  859. margin-left: 0;
  860. }
  861. .mg {
  862. margin: 20px;
  863. }
  864. .pdt {
  865. margin: 20px 0;
  866. }
  867. .el-main {
  868. overflow: hidden;
  869. }
  870. .middle {
  871. height: 430px;
  872. display: flex;
  873. align-content: center;
  874. justify-content: center;
  875. align-items: center;
  876. }
  877. .title {
  878. padding: 10px 0;
  879. text-align: center;
  880. border-left: 1px solid #ebeef5;
  881. border-right: 1px solid #ebeef5;
  882. border-top: 1px solid #ebeef5;
  883. }
  884. </style>