addEditForm.vue 28 KB

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