addEditForm.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933
  1. <template>
  2. <el-form
  3. ref="ruleForm"
  4. :loading="loading"
  5. :model="ruleForm"
  6. status-icon
  7. :size="'mini'"
  8. :rules="rulesThis"
  9. label-width="110px"
  10. style="width: 100%"
  11. >
  12. <el-row>
  13. <el-col :span="12">
  14. <el-form-item label="销售方" prop="companyNo" class="clear">
  15. <search-work-company
  16. :value="ruleForm.companyNo"
  17. :placeholder="'销售方公司'"
  18. :disabled="type === 'view'"
  19. :size="'mini'"
  20. :isDetail="type === 'view'"
  21. @searchChange="company_idsearchChange"
  22. />
  23. </el-form-item>
  24. </el-col>
  25. <el-col :span="12">
  26. <el-form-item label="购买方公司" prop="khNo" class="clear">
  27. <search-customer
  28. :value="ruleForm.khNo"
  29. :names="ruleForm.customer_name"
  30. :placeholder="'购买方公司'"
  31. :size="'mini'"
  32. @searchChange="customerChange"
  33. :disabled="type === 'view'"
  34. :is-detail="type === 'view'"
  35. />
  36. </el-form-item>
  37. </el-col>
  38. <el-col :span="8">
  39. <el-form-item label="所属平台" prop="platform_code" class="clear">
  40. <search-terrace
  41. :value="ruleForm.platform_code"
  42. :disabled="type === 'view'"
  43. :size="'mini'"
  44. :is_show="'1'"
  45. :isDetail="type === 'view'"
  46. :names="platform_code_name"
  47. :placeholder="'所属平台'"
  48. @searchChange="platform_code_codesearchChange"
  49. />
  50. </el-form-item>
  51. </el-col>
  52. <el-col :span="8">
  53. <el-form-item label="竞价截止时间" prop="endtime" class="clear">
  54. <el-date-picker
  55. v-model="ruleForm.endtime"
  56. type="datetime"
  57. value-format="yyyy-MM-dd HH:mm:ss"
  58. style="width: 100%"
  59. :picker-options="pickerOptions"
  60. placeholder="竞价截止时间"
  61. >
  62. </el-date-picker>
  63. </el-form-item>
  64. </el-col>
  65. <el-col :span="8">
  66. <el-form-item label="竞价类型" prop="is_project" class="clear">
  67. <el-select
  68. v-model="ruleForm.is_project"
  69. style="width: 100%"
  70. :disabled="false"
  71. placeholder="竞价类型"
  72. @change="is_project_change"
  73. >
  74. <el-option
  75. v-for="item in options"
  76. :key="item.value"
  77. :label="item.label"
  78. :value="item.value"
  79. >
  80. </el-option>
  81. </el-select>
  82. </el-form-item>
  83. </el-col>
  84. <el-col :span="8" v-if="ruleForm.is_project === '1'">
  85. <el-form-item label="项目名称" prop="projectNo" class="clear">
  86. <el-select
  87. v-model="ruleForm.projectNo"
  88. multiple
  89. filterable
  90. remote
  91. clearable
  92. :multiple-limit="1"
  93. reserve-keyword
  94. style="width: 100%"
  95. :placeholder="'项目名称'"
  96. :remote-method="remoteMethod"
  97. :loading="selectLoading"
  98. @change="selectChange"
  99. >
  100. <el-option
  101. v-for="(item, index) in poptions"
  102. :key="item.projectNo + index"
  103. :label="item.project_name"
  104. :value="item.projectNo + ''"
  105. :disabled="item.status !== '1'"
  106. >
  107. </el-option>
  108. </el-select>
  109. </el-form-item>
  110. </el-col>
  111. <el-col :span="8" v-if="ruleForm.is_project === '1'">
  112. <el-form-item label="项目竞价截止时间" class="clear" required label-width="140px">
  113. <el-input
  114. placeholder="项目竞价截止时间"
  115. v-model="ruleForm.pendtime"
  116. disabled
  117. maxlength="500"
  118. />
  119. </el-form-item>
  120. </el-col>
  121. <el-col :span="8" v-if="ruleForm.is_project === '1'">
  122. <el-form-item label="要求到货时间" class="clear" required>
  123. <el-input
  124. placeholder="要求到货时间"
  125. v-model="ruleForm.arrtime"
  126. maxlength="500"
  127. disabled
  128. />
  129. </el-form-item>
  130. </el-col>
  131. <el-col :span="16" v-if="ruleForm.is_project === '1'">
  132. <el-form-item label="项目用途" class="clear" required>
  133. <el-input
  134. placeholder="项目用途"
  135. v-model="ruleForm.use_desc"
  136. disabled
  137. maxlength="500"
  138. />
  139. </el-form-item>
  140. </el-col>
  141. <el-col :span="8" v-if="ruleForm.is_project === '1'">
  142. <el-form-item label="项目总预算" class="clear" required>
  143. <el-input
  144. placeholder="项目总预算"
  145. v-model="ruleForm.budget_total"
  146. disabled
  147. maxlength="500"
  148. >
  149. <template slot="append">元</template></el-input
  150. >
  151. </el-form-item>
  152. </el-col>
  153. <el-col :span="24" v-if="ruleForm.is_project === '1'">
  154. <el-form-item label="项目商品要求" class="clear" required>
  155. <el-table
  156. ref="multipleTable"
  157. :data="ptableData"
  158. :size="'mini'"
  159. border
  160. stripe
  161. tooltip-effect="dark"
  162. style="width: 100%"
  163. @selection-change="handleSelectionChange"
  164. >
  165. <el-table-column type="selection" width="40"> </el-table-column>
  166. <el-table-column label="商品阶梯" width="70px">
  167. <template slot-scope="scope"> {{ scope.$index + 1 }}</template>
  168. </el-table-column>
  169. <el-table-column prop="good_type" label="商品类型" width="80px">
  170. <template slot-scope="scope">
  171. <el-tag
  172. :size="'mini'"
  173. v-text="
  174. (
  175. statusOptions.find((item) => item.value == scope.row.good_type) ||
  176. {}
  177. ).label || '--'
  178. "
  179. ></el-tag
  180. ></template>
  181. </el-table-column>
  182. <el-table-column prop="budget_price" label="预算单价" width="110" />
  183. <el-table-column prop="num" label="购买数量" width="110" />
  184. <el-table-column prop="cat_name" label="商品分类" />
  185. <el-table-column prop="good_img" label="图片" width="50">
  186. <template slot-scope="scope">
  187. <div
  188. v-if="scope.row.good_img"
  189. style="width: 20px; height: 20px"
  190. class="hover"
  191. v-viewer
  192. >
  193. <img
  194. :src="scope.row.good_img"
  195. style="display: inline-block; width: 100%; height: 100%"
  196. alt=""
  197. />
  198. </div>
  199. </template>
  200. </el-table-column>
  201. <el-table-column prop="good_name" label="商品名称" />
  202. </el-table>
  203. </el-form-item>
  204. </el-col>
  205. <el-co :span="24">
  206. <el-form-item label="竞价商品要求" class="clear" required>
  207. <el-table :data="tableData" stripe border :size="'mini'" style="width: 100%">
  208. <el-table-column
  209. prop="arrival_time"
  210. label="到货时间"
  211. width="100"
  212. show-overflow-tooltip
  213. />
  214. <el-table-column
  215. prop="budget_price"
  216. label="预算单价"
  217. show-overflow-tooltip
  218. width="110"
  219. />
  220. <el-table-column prop="num" label="购买数量" show-overflow-tooltip width="80">
  221. <template slot-scope="scope">
  222. <span>{{ scope.row.num }}</span
  223. ><span>{{ scope.row.unit_name }}</span>
  224. </template>
  225. </el-table-column>
  226. <el-table-column
  227. prop="cat_id_name"
  228. label="商品分类"
  229. show-overflow-tooltip
  230. min-width="170"
  231. />
  232. <el-table-column
  233. prop="good_img"
  234. label="图片"
  235. width="50"
  236. show-overflow-tooltip
  237. >
  238. <template slot-scope="scope">
  239. <img
  240. v-viewer
  241. style="width: 23px; height: 23px; margin: 0 5px 0 0"
  242. class="fl"
  243. v-if="scope.row.good_img"
  244. :src="scope.row.good_img"
  245. alt=""
  246. />
  247. </template>
  248. </el-table-column>
  249. <el-table-column
  250. prop="good_name"
  251. label="商品名称"
  252. show-overflow-tooltip
  253. min-width="170"
  254. />
  255. <el-table-column
  256. prop="specinfo"
  257. label="商品规格"
  258. show-overflow-tooltip
  259. width="170"
  260. >
  261. <template slot-scope="scope">
  262. <span v-for="(si, sii) in scope.row.specinfo" :key="si.spec_name + sii"
  263. ><span v-if="sii !== 0">-</span>{{ si.spec_name }}:[{{
  264. si.spec_value_name
  265. }}]</span
  266. >
  267. </template>
  268. </el-table-column>
  269. <el-table-column
  270. prop="is_addrs"
  271. label="是否多地"
  272. width="70"
  273. show-overflow-tooltip
  274. >
  275. <template slot-scope="scope">
  276. {{ scope.row.is_addrs === "1" ? "多地" : "一地" }}
  277. </template>
  278. </el-table-column>
  279. <el-table-column
  280. prop="is_custom"
  281. label="是否定制"
  282. width="70"
  283. show-overflow-tooltip
  284. >
  285. <template slot-scope="scope">
  286. {{ scope.row.is_custom === "1" ? "定制" : "非定制" }}
  287. </template>
  288. </el-table-column>
  289. <el-table-column fixed="right" width="80">
  290. <template slot="header" slot-scope="scope">
  291. <span>操作</span>
  292. <el-tooltip
  293. class="item"
  294. effect="dark"
  295. v-if="status === ''"
  296. content="添加活动商品"
  297. placement="top"
  298. >
  299. <i
  300. class="el-icon-circle-plus-outline fr"
  301. style="font-size: 18px; margin-top: 2px"
  302. @click="openEdit(-1, {})"
  303. />
  304. </el-tooltip>
  305. </template>
  306. <template slot-scope="scope">
  307. <el-tooltip effect="dark" content="修改" placement="top">
  308. <i
  309. class="el-icon-edit tb-icon"
  310. @click="openEdit(scope.$index, scope.row)"
  311. ></i>
  312. </el-tooltip>
  313. <el-tooltip
  314. v-if="status === ''"
  315. effect="dark"
  316. content="删除"
  317. placement="top"
  318. >
  319. <i
  320. class="el-icon-delete tb-icon"
  321. @click="openCostEditDelete(scope.$index)"
  322. ></i>
  323. </el-tooltip>
  324. </template>
  325. </el-table-column>
  326. </el-table>
  327. </el-form-item>
  328. <add-edit-good-modal
  329. :showModel="showModel"
  330. :sitem="editItem"
  331. @cancel="showModel = false"
  332. @refresh="editGoodRefresh"
  333. />
  334. </el-co>
  335. <el-col :span="24" style="text-align: right" v-if="id === 'add'">
  336. <el-button type="primary" @click="submitForm" :size="'mini'">保 存</el-button>
  337. </el-col>
  338. </el-row>
  339. </el-form>
  340. </template>
  341. <script>
  342. import asyncRequest from "@/apis/service/sellOut/zixunOrder";
  343. import resToken from "@/mixins/resToken";
  344. import addEditGoodModal from "./addEditGoodModal";
  345. import { mapGetters } from "vuex";
  346. export default {
  347. name: "handover",
  348. props: ["id", "sitem", "newTime"],
  349. mixins: [resToken],
  350. components: {
  351. addEditGoodModal,
  352. },
  353. computed: {
  354. ...mapGetters(["business_companyNo"]),
  355. },
  356. data() {
  357. return {
  358. multipleSelection: [],
  359. // 表格 - 数据
  360. tableData: [],
  361. ptableData: [],
  362. showModel: false,
  363. editItem: {},
  364. options: [
  365. { value: "0", label: "非项目" },
  366. { value: "1", label: "项目" },
  367. ],
  368. statusOptions: [
  369. { value: "1", label: "竞品" },
  370. { value: "2", label: "竞聘" },
  371. ],
  372. configOptions: ["证书", "包装盒", "绒布袋", "标签", "其他"],
  373. poptions: [],
  374. loading: false,
  375. selectLoading: false,
  376. pickerOptions: {
  377. disabledDate(time) {
  378. return time.getTime() < Date.now() - 60 * 60 * 24 * 1000;
  379. },
  380. },
  381. status: "", //存储详情接口返的状态
  382. ruleForm: {
  383. is_project: "0", //竞价类型 1非项目2项目,
  384. projectNo: [], //项目编号
  385. khNo: [], //客户编号
  386. customer_name: "", //客户名称
  387. companyNo: "",
  388. endtime: "", //竞价截止时间
  389. pendtime: "", //项目竞价截止时间
  390. platform_code: "", //平台id
  391. use_desc: "",
  392. budget_total: "",
  393. arrtime: "",
  394. },
  395. rulesThis: this.rules,
  396. // 验证规则
  397. rules: {
  398. companyNo: [
  399. {
  400. required: true,
  401. message: "请选择销售方公司",
  402. trigger: "change",
  403. },
  404. ],
  405. khNo: [
  406. {
  407. type: "array",
  408. required: true,
  409. message: "请选择购买方公司",
  410. trigger: "change",
  411. },
  412. ],
  413. platform_code: [
  414. {
  415. required: true,
  416. message: "请选择所属平台",
  417. trigger: "change",
  418. },
  419. ],
  420. endtime: [
  421. {
  422. required: true,
  423. message: "竞价截止时间不能为空",
  424. trigger: "change",
  425. },
  426. ],
  427. is_project: [
  428. {
  429. required: true,
  430. message: "请选择竞价类型!",
  431. trigger: "change",
  432. },
  433. ],
  434. projectNo: [
  435. {
  436. type: "array",
  437. required: true,
  438. message: "请选择项目",
  439. trigger: "change",
  440. },
  441. ],
  442. },
  443. };
  444. },
  445. computed: {
  446. powers() {
  447. const tran =
  448. this.$store.getters.btnList.find(
  449. (item) => item.menu_route == "zixunOrderDetail"
  450. ) || {};
  451. const { action } = tran ?? {};
  452. return action ?? [];
  453. },
  454. },
  455. mounted() {
  456. this.initForm();
  457. },
  458. watch: {
  459. id: function (val) {
  460. if (val) {
  461. this.initForm();
  462. }
  463. },
  464. newTime: function (val) {
  465. if (val) {
  466. this.initForm();
  467. }
  468. },
  469. },
  470. methods: {
  471. async initForm() {
  472. this.loading = true;
  473. this.status = "";
  474. this.rulesThis = this.rules;
  475. this.disabled = false;
  476. await this.resetForm();
  477. this.loading = false;
  478. },
  479. openEdit(index, editItem) {
  480. const { is_project } = this.ruleForm;
  481. if (index + "" == "-1" && is_project === "1") {
  482. if (this.multipleSelection.length === 0) {
  483. this.$message.warning("请选择一个项目商品要求!");
  484. return;
  485. }
  486. if (this.multipleSelection.length > 1) {
  487. this.$message.warning("每次创建只能选择一个项目商品要求!");
  488. return;
  489. }
  490. const {
  491. cat_info,
  492. budget_price,
  493. pgNo,
  494. num,
  495. good_type,
  496. good_name,
  497. good_img,
  498. } = this.multipleSelection[0];
  499. let cat_id = [];
  500. if (cat_info && cat_info.length > 0) {
  501. cat_info.forEach((e) => {
  502. cat_id.push(e.id);
  503. });
  504. }
  505. console.log(this.multipleSelection[0]);
  506. this.editItem = {
  507. p_cat_info: cat_info,
  508. p_cat_id: cat_id,
  509. p_budget_price: budget_price,
  510. p_pgNo: pgNo,
  511. p_num: num,
  512. p_good_type: good_type,
  513. p_good_name: good_name,
  514. p_good_img: good_img,
  515. p_arrtime: this.ruleForm.arrtime,
  516. };
  517. this.editItem.index = index;
  518. this.showModel = true;
  519. } else {
  520. this.editItem = editItem;
  521. this.editItem.index = index;
  522. this.showModel = true;
  523. }
  524. },
  525. handleSelectionChange(val) {
  526. this.multipleSelection = val;
  527. },
  528. editGoodRefresh(e) {
  529. console.log(e);
  530. const { index } = e;
  531. if (index + "" === "-1") {
  532. this.tableData.push(JSON.parse(JSON.stringify(e)));
  533. } else {
  534. const fsindex = parseInt(index + "");
  535. this.tableData[fsindex] = JSON.parse(JSON.stringify(e));
  536. this.$set(this.tableData, fsindex, this.tableData[fsindex]);
  537. }
  538. this.showModel = false;
  539. },
  540. //竞价类型选择
  541. is_project_change() {
  542. const { is_project } = this.ruleForm;
  543. if (is_project === "0") {
  544. } else {
  545. this.ptableData = [];
  546. }
  547. },
  548. openCostEditDelete(index) {
  549. this.tableData.splice(index, 1);
  550. },
  551. async resetForm() {
  552. this.resign_name = "";
  553. this.hand_name = "";
  554. this.status = "";
  555. // 重置
  556. await this.$nextTick(async () => {
  557. if (this.$refs.ruleForm) {
  558. this.$refs.ruleForm.resetFields();
  559. this.$refs.ruleForm.clearValidate();
  560. let {
  561. is_project, //竞价类型 1销售2竞价,
  562. projectNo, //项目编号
  563. khNo, //客户编号
  564. customer_name, //客户名称
  565. companyNo,
  566. endtime, //竞价截止时间
  567. platform_code, //平台id
  568. ladder,
  569. } = this.sitem;
  570. this.ruleForm = {
  571. is_project: is_project || "0", //竞价类型 1项目 0 非项目
  572. projectNo: projectNo ? [projectNo] : [], //项目编号
  573. khNo: khNo ? [khNo] : [], //客户编号
  574. customer_name: customer_name || "", //客户名称
  575. companyNo: companyNo || this.business_companyNo || "",
  576. endtime: endtime || "", //竞价截止时间
  577. platform_code: platform_code || "", //平台id
  578. use_desc: "",
  579. budget_total: "",
  580. arrtime: "",
  581. };
  582. this.tableData =
  583. ladder && ladder.length > 0 ? JSON.parse(JSON.stringify(ladder)) : [];
  584. if (this.ruleForm.projectNo && this.ruleForm.projectNo.length === 1) {
  585. await this.selectChange(this.ruleForm.projectNo);
  586. }
  587. }
  588. });
  589. },
  590. async submitForm() {
  591. console.log(this.ruleForm);
  592. await this.$refs.ruleForm.validate(async (valid) => {
  593. if (valid) {
  594. if (this.loading) {
  595. return;
  596. }
  597. this.loading = true;
  598. if (this.tableData.length === 0) {
  599. this.$message.warning("至少提供一条商品要求!");
  600. this.loading = false;
  601. return;
  602. }
  603. let model = JSON.parse(JSON.stringify(this.ruleForm));
  604. const { pendtime, is_project, endtime } = model;
  605. if (
  606. is_project === "1" &&
  607. new Date(endtime).getTime() > new Date(pendtime).getTime()
  608. ) {
  609. this.$message.warning("竞价截止时间不能晚于项目竞价截止时间!");
  610. this.loading = false;
  611. return;
  612. }
  613. if (new Date(endtime).getTime() <= new Date().getTime()) {
  614. this.$message.warning("竞价截止时间应该大于当前时间!");
  615. this.loading = false;
  616. return;
  617. }
  618. model.khNo = model.khNo.toString();
  619. model.projectNo = model.projectNo.toString();
  620. model.ladder = [];
  621. let list = JSON.parse(JSON.stringify(this.tableData));
  622. list.forEach((e) => {
  623. let im = {
  624. good_name: e.good_name,
  625. good_img: e.good_img,
  626. cat_id: e.cat_id[e.cat_id.length - 1],
  627. unit: e.unit.toString(),
  628. brand_id: e.brand_id.toString(),
  629. arrival_time: e.arrival_time,
  630. cost_desc: e.cost_desc,
  631. is_addrs: e.is_addrs,
  632. is_custom: e.is_custom,
  633. metal_id: e.metal_id,
  634. config: e.config.toString(),
  635. other_config: e.other_config,
  636. specs_weight: e.specs_weight,
  637. gold_price: e.gold_price,
  638. budget_price: e.budget_price,
  639. num: e.num,
  640. use_desc: e.use_desc,
  641. remark: e.remark,
  642. pgNo: e.pgNo,
  643. total_weight: e.total_weight,
  644. is_gold_price: e.is_gold_price,
  645. enclosure_file: e.enclosure_file,
  646. specinfo: [],
  647. };
  648. e.specinfo.forEach((a) => {
  649. let am = {
  650. specid: a.specid,
  651. spec_value_id: a.spec_value_id,
  652. };
  653. im.specinfo.push(am);
  654. });
  655. model.ladder.push(im);
  656. });
  657. console.log(model);
  658. const res = await asyncRequest.add(model);
  659. this.loading = false;
  660. if (res && res.code === 0) {
  661. this.$notify.success({
  662. title: "创建成功!",
  663. message: "",
  664. });
  665. this.$emit("refresh", true);
  666. } else if (res && res.code >= 100 && res.code <= 104) {
  667. await this.logout();
  668. } else {
  669. this.$message.warning(res.message);
  670. }
  671. } else {
  672. console.log("error submit!!");
  673. return false;
  674. }
  675. });
  676. },
  677. // //获取规格值
  678. // setResData() {
  679. // let list = JSON.parse(JSON.stringify(this.spec_tableData));
  680. // let oldlist = JSON.parse(JSON.stringify(this.old_spec_tableData));
  681. // let hasIDlist = [];
  682. // list.forEach((a) => {
  683. // if (a.id !== "") {
  684. // hasIDlist.push(a);
  685. // }
  686. // });
  687. // let newList = [];
  688. // let resList = [];
  689. // oldlist.forEach((a, ai) => {
  690. // let item = null;
  691. // let index = hasIDlist.findIndex((b) => a.id === b.id);
  692. // if (index === -1) {
  693. // item = JSON.parse(JSON.stringify(a));
  694. // item.is_del = "1";
  695. // } else {
  696. // item = JSON.parse(JSON.stringify(hasIDlist[index]));
  697. // }
  698. // newList.push(item);
  699. // });
  700. // list.forEach((b) => {
  701. // if (b.id === "") {
  702. // b.is_del = "0";
  703. // newList.push(b);
  704. // }
  705. // });
  706. // newList.forEach((a) => {
  707. // let m = {
  708. // id: a.id,
  709. // specid: a.specid,
  710. // spec_value_id: a.spec_value_id,
  711. // is_del: a.is_del || "0",
  712. // };
  713. // resList.push(m);
  714. // });
  715. // return resList;
  716. // },
  717. //项目选择
  718. async selectChange(e) {
  719. const key = e && e.length > 0 ? e[0] : "";
  720. if (key) {
  721. const { code, data, message } = await asyncRequest.pdetail({
  722. projectNo: key,
  723. });
  724. if (code === 0) {
  725. const { use_desc, budget_total, ladder, arrtime, endtime } = data;
  726. this.ruleForm.use_desc = use_desc || "";
  727. this.ruleForm.budget_total = budget_total || "";
  728. this.ruleForm.arrtime = arrtime || "";
  729. this.ruleForm.pendtime = endtime || "";
  730. this.ptableData = ladder;
  731. this.ptableData.forEach((e) => {
  732. e.cat_name = "";
  733. const { cat_info } = e;
  734. if (cat_info && cat_info.length > 0) {
  735. cat_info.forEach((b, bi) => {
  736. e.cat_name += bi !== 0 ? "/" + b.name : b.name;
  737. });
  738. }
  739. });
  740. this.tableData == [];
  741. } else if (code >= 100 && code <= 104) {
  742. await this.logout();
  743. } else {
  744. this.$message.warning(message);
  745. this.ptableData = [];
  746. this.ruleForm.use_desc = "";
  747. this.ruleForm.budget_total = "";
  748. this.ruleForm.arrtime = "";
  749. this.tableData == [];
  750. }
  751. } else {
  752. this.ptableData = [];
  753. this.ruleForm.use_desc = "";
  754. this.ruleForm.budget_total = "";
  755. this.ruleForm.arrtime = "";
  756. this.tableData = [];
  757. }
  758. },
  759. async remoteMethod(query) {
  760. this.selectLoading = true;
  761. this.poptions = [];
  762. const { platform_code, companyNo, khNo } = JSON.parse(
  763. JSON.stringify(this.ruleForm)
  764. );
  765. if (!companyNo) {
  766. this.$message.warning("请选择销售方公司!");
  767. this.selectLoading = false;
  768. return;
  769. }
  770. if (khNo.length === 0) {
  771. this.$message.warning("请选择购买方公司!");
  772. this.selectLoading = false;
  773. return;
  774. }
  775. if (platform_code === "") {
  776. this.$message.warning("请选择所属平台!");
  777. this.selectLoading = false;
  778. return;
  779. }
  780. if (!query) {
  781. this.selectLoading = false;
  782. return;
  783. }
  784. let formValue = {
  785. page: 1,
  786. size: 100,
  787. khNo: khNo.toString(),
  788. companyNo: companyNo,
  789. platform_code: platform_code,
  790. status: "1",
  791. project_name: query,
  792. };
  793. const { code, data, message } = await asyncRequest.plist(formValue);
  794. if (code === 0) {
  795. const { list } = data;
  796. this.poptions = list;
  797. } else if (code >= 100 && code <= 104) {
  798. await this.logout();
  799. } else {
  800. this.$message.warning(message);
  801. this.poptions = [];
  802. }
  803. this.selectLoading = false;
  804. },
  805. //平台选择
  806. platform_code_codesearchChange(e) {
  807. const { id, code, label } = e;
  808. this.ruleForm.platform_code = id || "";
  809. this.$refs.ruleForm.validateField("platform_code");
  810. this.ruleForm.projectNo = [];
  811. this.ruleForm.budget_total = "0";
  812. this.ruleForm.use_desc = "";
  813. this.ruleForm.pendtime = "";
  814. this.ruleForm.arrtime = "";
  815. this.ptableData = [];
  816. this.tableData = [];
  817. },
  818. //销售方公司选择
  819. company_idsearchChange(e) {
  820. if (e) {
  821. const { id, code, label } = e;
  822. this.ruleForm.companyNo = code || "";
  823. }
  824. this.$refs.ruleForm.validateField("companyNo");
  825. },
  826. //购买方公司选择
  827. customerChange(e) {
  828. if (e && e.id) {
  829. this.ruleForm.khNo = [e.code];
  830. this.ruleForm.customer_name = e.label;
  831. } else {
  832. this.ruleForm.khNo = [];
  833. this.ruleForm.customer_name = "";
  834. }
  835. this.$refs.ruleForm.validateField("khNo");
  836. this.ruleForm.projectNo = [];
  837. this.ruleForm.budget_total = "0";
  838. this.ruleForm.use_desc = "";
  839. this.ruleForm.pendtime = "";
  840. this.ruleForm.arrtime = "";
  841. this.ptableData = [];
  842. this.tableData = [];
  843. },
  844. },
  845. };
  846. </script>
  847. <style lang="scss" scoped>
  848. .el-form-item-error-img {
  849. width: 100%;
  850. ul {
  851. width: 100%;
  852. li {
  853. float: left;
  854. border: 1px solid rgb(220, 223, 230);
  855. // border-left: 0;
  856. box-sizing: border-box;
  857. width: 254px;
  858. height: 164px;
  859. line-height: 164px;
  860. position: relative;
  861. img {
  862. display: inline-block;
  863. width: 100%;
  864. height: 100%;
  865. }
  866. .el-icon-close {
  867. position: absolute;
  868. top: 0;
  869. right: 0;
  870. z-index: 2;
  871. width: 25px;
  872. height: 25px;
  873. text-align: center;
  874. line-height: 25px;
  875. font-size: 19px;
  876. &:hover {
  877. color: #6954f0;
  878. }
  879. }
  880. }
  881. }
  882. }
  883. .images_li {
  884. // width: 254px;
  885. // height: 164px;
  886. float: left;
  887. }
  888. .btnupload {
  889. float: left;
  890. border: 1px solid rgb(220, 223, 230);
  891. // border-left: 0;
  892. box-sizing: border-box;
  893. width: 254px;
  894. height: 164px;
  895. line-height: 164px;
  896. text-align: center;
  897. }
  898. .Upload {
  899. width: 254px;
  900. height: 164px;
  901. line-height: 164px;
  902. text-align: center;
  903. position: absolute;
  904. line-height: 0px;
  905. top: 0;
  906. left: 0;
  907. z-index: 2;
  908. line-height: 164px;
  909. }
  910. .avatar-uploader-icon {
  911. font-size: 33px;
  912. color: #8c939d;
  913. width: 50px;
  914. height: 50px;
  915. line-height: 50px;
  916. text-align: center;
  917. }
  918. </style>