AddCondition.vue 28 KB

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