edit.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871
  1. <template>
  2. <div class="BidSystemDeepeningOrderEdit">
  3. <Toptitle :title="type == 1 ? '深化单深化编辑' : '深化单深化详情'">
  4. <slot name="titleButton">
  5. <Button
  6. @click="goback()"
  7. type="primary"
  8. ghost
  9. style="margin-right: 10px"
  10. >返回</Button
  11. >
  12. <Button
  13. @click="postData()"
  14. type="primary"
  15. ghost
  16. v-show="type == 1"
  17. style="margin-right: 10px"
  18. >保存</Button
  19. >
  20. </slot>
  21. </Toptitle>
  22. <div class="top_search">
  23. <div><span>区域编码:</span>{{ formData.num }}</div>
  24. <div><span>区域名称:</span>{{ formData.area_title }}</div>
  25. <div><span>产品名称:</span>{{ formData.title }}</div>
  26. <div><span>数量:</span>{{ formData.num }}</div>
  27. <div><span>规格:</span>{{ formData.measure }}</div>
  28. <div><span>工艺属性:</span>{{ formData.process_property }}</div>
  29. <div><span>图号:</span>{{ formData.url_number }}</div>
  30. <div>
  31. <span>图纸:</span>
  32. <div>
  33. <span
  34. v-for="item in formData.url"
  35. :key="item"
  36. @click="checkImg(formData.url)"
  37. >
  38. <img :src="$store.state.ip + item" alt="" />
  39. </span>
  40. </div>
  41. </div>
  42. <div>
  43. <span>左右式:</span
  44. >{{
  45. formData.left_right_mode == 1
  46. ? "左式"
  47. : formData.left_right_mode == 2
  48. ? "右式"
  49. : "无"
  50. }}
  51. </div>
  52. <!-- <div><span>价格:</span>{{ formData.price }}</div> -->
  53. <div><span>备注:</span>{{ formData.remark }}</div>
  54. </div>
  55. <div class="table-data">
  56. <div class="table-data-btn">
  57. <span> </span>
  58. <div>
  59. <!-- <Upload style="display: inline"
  60. name="your_file"
  61. :show-upload-list="false"
  62. :headers="headers"
  63. :on-error="uploadError"
  64. :on-success="uploadSuccess"
  65. :action="$store.state.ip + '/api/upload_pic'">
  66. <Button type="primary"
  67. :disabled="isCheck"
  68. style="margin-right: 10px">导入</Button>
  69. </Upload> -->
  70. <Button
  71. type="primary"
  72. @click="handleAddList"
  73. v-show="type == 1"
  74. style="margin-right: 10px"
  75. >新增</Button
  76. >
  77. </div>
  78. </div>
  79. <div class="table-data-content">
  80. <!-- <vxe-table align="center"
  81. border
  82. resizable
  83. show-overflow
  84. :edit-config="{trigger: 'click', mode: 'cell'}"
  85. :data="tableData">
  86. <vxe-table-column type="seq"
  87. width="60"></vxe-table-column>
  88. <vxe-table-column field="house"
  89. title="楼栋"
  90. :edit-render="{name: 'input', attrs: {type: 'text', placeholder: '请输入'}}">
  91. <template #default="{ row }">
  92. <vxe-input v-model="row.house"
  93. placeholder="请输入"></vxe-input>
  94. </template>
  95. </vxe-table-column>
  96. <vxe-table-column field="unit"
  97. title="楼单元"
  98. :edit-render="{name: 'input', attrs: {type: 'text', placeholder: '请输入'}}">
  99. <template #default="{ row }">
  100. <vxe-input v-model="row.unit"
  101. placeholder="请输入"></vxe-input>
  102. </template>
  103. </vxe-table-column>
  104. <vxe-table-column field="layer"
  105. title="楼层"
  106. :edit-render="{name: 'input', attrs: {type: 'text', placeholder: '请输入'}}">
  107. <template #default="{ row }">
  108. <vxe-input v-model="row.layer"
  109. placeholder="请输入"></vxe-input>
  110. </template>
  111. </vxe-table-column>
  112. <vxe-table-column field="number"
  113. title="房间号"
  114. :edit-render="{name: 'input', attrs: {type: 'text', placeholder: '请输入'}}">
  115. <template #default="{ row }">
  116. <vxe-input v-model="row.number"
  117. placeholder="请输入"></vxe-input>
  118. </template>
  119. </vxe-table-column>
  120. <vxe-table-column field="title"
  121. title="产品"
  122. :edit-render="{name: 'input', attrs: {type: 'text', placeholder: '请输入'}}">
  123. <template #default="{ row }">
  124. <vxe-input v-model="row.title"
  125. placeholder="请输入"></vxe-input>
  126. </template>
  127. </vxe-table-column>
  128. <vxe-table-column field="price"
  129. title="价格"
  130. :edit-render="{name: 'input', attrs: {type: 'text', placeholder: '请输入'}}">
  131. <template #default="{ row }">
  132. <vxe-input v-model="row.price"
  133. placeholder="请输入"></vxe-input>
  134. </template>
  135. </vxe-table-column>
  136. <vxe-table-column field="product_unit"
  137. title="计量单位"
  138. :edit-render="{name: 'input', attrs: {type: 'text', placeholder: '请输入'}}">
  139. <template #default="{ row }">
  140. <vxe-input v-model="row.product_unit"
  141. placeholder="请输入"></vxe-input>
  142. </template>
  143. </vxe-table-column>
  144. <vxe-table-column field="position"
  145. title="位置"
  146. :edit-render="{name: 'input', attrs: {type: 'text', placeholder: '请输入'}}">
  147. <template #default="{ row }">
  148. <vxe-input v-model="row.position"
  149. placeholder="请输入"></vxe-input>
  150. </template>
  151. </vxe-table-column>
  152. <vxe-table-column field="url"
  153. title="图纸"
  154. :edit-render="{name: 'input', attrs: {type: 'text', placeholder: '请输入'}}">
  155. <template #default="{ row }">
  156. <vxe-input v-model="row.url"
  157. placeholder="请输入"></vxe-input>
  158. </template>
  159. </vxe-table-column>
  160. <vxe-table-column field="url_number"
  161. title="图号"
  162. :edit-render="{name: 'input', attrs: {type: 'text', placeholder: '请输入'}}">
  163. <template #default="{ row }">
  164. <vxe-input v-model="row.url_number"
  165. placeholder="请输入"></vxe-input>
  166. </template>
  167. </vxe-table-column>
  168. <vxe-table-column field="model"
  169. title="型号"
  170. :edit-render="{name: 'input', attrs: {type: 'text', placeholder: '请输入'}}">
  171. <template #default="{ row }">
  172. <vxe-input v-model="row.model"
  173. placeholder="请输入"></vxe-input>
  174. </template>
  175. </vxe-table-column>
  176. </vxe-table> -->
  177. <Table :columns="tableColumns" :data="tableData" border>
  178. <template slot="houseSet" slot-scope="{ index }">
  179. <Input
  180. type="text"
  181. size="small"
  182. v-if="type == 1"
  183. v-model="tableData[index].house"
  184. placeholder="楼栋"
  185. />
  186. <span v-else>{{ tableData[index].house }}</span>
  187. </template>
  188. <template slot="unitSet" slot-scope="{ index }">
  189. <Input
  190. type="text"
  191. size="small"
  192. v-if="type == 1"
  193. v-model="tableData[index].unit"
  194. placeholder="单元"
  195. />
  196. <span v-else>{{ tableData[index].unit }}</span>
  197. </template>
  198. <template slot="layerSet" slot-scope="{ index }">
  199. <Input
  200. type="text"
  201. size="small"
  202. v-if="type == 1"
  203. v-model="tableData[index].layer"
  204. placeholder="楼层"
  205. />
  206. <span v-else>{{ tableData[index].layer }}</span>
  207. </template>
  208. <template slot="numberSet" slot-scope="{ index }">
  209. <Input
  210. type="text"
  211. size="small"
  212. :disabled="isCheck"
  213. v-if="type == 1"
  214. v-model="tableData[index].number"
  215. placeholder="房间号"
  216. />
  217. <span v-else>{{ tableData[index].number }}</span>
  218. </template>
  219. <template slot="type_titleSet" slot-scope="{ index }">
  220. <el-cascader
  221. v-if="type == 1"
  222. v-model="tableData[index].type_id"
  223. size="small"
  224. :show-all-levels="false"
  225. :options="cascader_list"
  226. :props="{
  227. expandTrigger: 'hover',
  228. children: 'child',
  229. value: 'id',
  230. label: 'title',
  231. emitPath: false,
  232. checkStrictly: true,
  233. }"
  234. ></el-cascader>
  235. <!-- @change="changeProduct(tableData[index], index)" -->
  236. <span v-else>{{ tableData[index].type_title }}</span>
  237. </template>
  238. <template slot="titleSet" slot-scope="{ index }">
  239. <Input
  240. type="text"
  241. size="small"
  242. :disabled="isCheck"
  243. v-if="type == 1"
  244. v-model="tableData[index].title"
  245. placeholder="产品"
  246. />
  247. <span v-else>{{ tableData[index].title }}</span>
  248. </template>
  249. <!-- <template slot="priceSet"
  250. slot-scope="{ index }">
  251. <Input type="text"
  252. size="small"
  253. :disabled="isCheck"
  254. v-model="tableData[index].price"
  255. placeholder="价格" />
  256. </template> -->
  257. <template slot="product_unitSet" slot-scope="{ index }">
  258. <Input
  259. type="text"
  260. size="small"
  261. :disabled="isCheck"
  262. v-if="type == 1"
  263. v-model="tableData[index].product_unit"
  264. placeholder="单位"
  265. />
  266. <span v-else>{{ tableData[index].product_unit }}</span>
  267. </template>
  268. <template slot="positionSet" slot-scope="{ index }">
  269. <Input
  270. type="text"
  271. size="small"
  272. :disabled="isCheck"
  273. v-if="type == 1"
  274. v-model="tableData[index].position"
  275. placeholder="位置"
  276. />
  277. <span v-else>{{ tableData[index].position }}</span>
  278. </template>
  279. <template slot="urlSet" slot-scope="{ index }">
  280. <!-- <Input type="text"
  281. size="small"
  282. v-model="row.url"
  283. placeholder="图纸" /> -->
  284. <div class="product-img">
  285. <div class="product-add">
  286. <div
  287. class="items"
  288. v-for="(_item, _index) of tableData[index].url"
  289. :key="_index"
  290. >
  291. <img
  292. @click="looks(_item)"
  293. v-for="(el, idx) in tableData[index].url"
  294. :key="idx"
  295. :src="$store.state.ip + el"
  296. alt=""
  297. />
  298. <Icon
  299. size="20"
  300. v-show="type == 1"
  301. @click="delItems(_index, tableData[index].url)"
  302. class="delete-img"
  303. type="ios-close-circle"
  304. />
  305. </div>
  306. <div class="add-items" v-if="type == 1">
  307. <div class="_item">
  308. <Icon size="50" type="ios-add" />
  309. </div>
  310. <input
  311. @change="changeIpt($event, tableData[index])"
  312. type="file"
  313. class="ipt"
  314. />
  315. </div>
  316. </div>
  317. </div>
  318. </template>
  319. <template slot="url_numberSet" slot-scope="{ index }">
  320. <Input
  321. type="text"
  322. size="small"
  323. v-if="type == 1"
  324. v-model="tableData[index].url_number"
  325. placeholder="图号"
  326. />
  327. <span v-else>{{ tableData[index].url_number }}</span>
  328. </template>
  329. <template slot="modelSet" slot-scope="{ index }">
  330. <Input
  331. type="text"
  332. size="small"
  333. v-if="type == 1"
  334. v-model="tableData[index].model"
  335. placeholder="型号"
  336. />
  337. <span v-else>{{ tableData[index].model }}</span>
  338. </template>
  339. <template slot="set" slot-scope="{ index }">
  340. <a
  341. style="margin: 0 5px; color: red"
  342. v-show="type != 2"
  343. @click="handleSet(tableData[index], index)"
  344. >删除</a
  345. >
  346. </template>
  347. <div
  348. v-for="item in measureList"
  349. :key="item.e_title"
  350. :slot="'formula_' + item.e_title"
  351. slot-scope="{ index }"
  352. >
  353. <div>
  354. <Input
  355. v-if="type == 1"
  356. @on-focus="openKey(index, item.e_title)"
  357. size="small"
  358. clearable
  359. :placeholder="item.title"
  360. v-model="tableData[index][item.e_title]"
  361. />
  362. <span v-else>{{ tableData[index][item.e_title] }}</span>
  363. </div>
  364. </div>
  365. <!-- <div slot="formula_H"
  366. slot-scope="{ index }">
  367. <div>
  368. <Input :disabled="type == 2"
  369. @on-focus="openKey(index, 'H')"
  370. clearable
  371. placeholder="高"
  372. v-model="tableData[index].H"></Input>
  373. </div>
  374. </div> -->
  375. <!-- <template slot="formula_W"
  376. slot-scope="{ index }">
  377. <div>
  378. <Input :disabled="type == 2"
  379. @on-focus="openKey(index, 'W')"
  380. clearable
  381. placeholder="宽"
  382. v-model="tableData[index].W"></Input>
  383. </div>
  384. </template> -->
  385. <!-- <template slot="formula_D"
  386. slot-scope="{ index }">
  387. <div>
  388. <Input :disabled="type == 2"
  389. @on-focus="openKey(index, 'D')"
  390. clearable
  391. placeholder="深"
  392. v-model="tableData[index].D"></Input>
  393. </div>
  394. </template> -->
  395. </Table>
  396. </div>
  397. </div>
  398. <Modal
  399. v-model="showKey"
  400. :width="1250"
  401. :mask-closable="false"
  402. :closable="false"
  403. >
  404. <div>
  405. <KeyBoard
  406. :rightData="measureList"
  407. @cancel="cancelKey"
  408. @success="successKey"
  409. class="key-co"
  410. />
  411. </div>
  412. <div slot="footer"></div>
  413. </Modal>
  414. </div>
  415. </template>
  416. <script>
  417. // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  418. // 例如:import 《组件名称》 from '《组件路径》';
  419. import KeyBoard from "../../../components/keyboard/index";
  420. export default {
  421. name: "BidSystemDeepeningOrderEdit",
  422. components: {
  423. KeyBoard,
  424. },
  425. props: {},
  426. // import引入的组件需要注入到对象中才能使用
  427. data() {
  428. // 这里存放数据
  429. return {
  430. headers: { Authorization: localStorage.getItem("token") },
  431. formData: {},
  432. tableColumns: [
  433. {
  434. title: "序号",
  435. key: "index",
  436. align: "center",
  437. width: "80",
  438. resizable: true,
  439. },
  440. {
  441. title: "楼栋",
  442. key: "house",
  443. align: "center",
  444. width: "100",
  445. slot: "houseSet",
  446. resizable: true,
  447. },
  448. {
  449. title: "楼单元",
  450. key: "unit",
  451. align: "center",
  452. width: "100",
  453. slot: "unitSet",
  454. resizable: true,
  455. },
  456. {
  457. title: "楼层",
  458. key: "layer",
  459. align: "center",
  460. width: "100",
  461. slot: "layerSet",
  462. resizable: true,
  463. },
  464. {
  465. title: "房间号",
  466. key: "number",
  467. align: "center",
  468. width: "100",
  469. slot: "numberSet",
  470. resizable: true,
  471. },
  472. {
  473. title: "产品分类",
  474. key: "title",
  475. align: "center",
  476. minWidth: 200,
  477. slot: "type_titleSet",
  478. resizable: true,
  479. },
  480. {
  481. title: "产品",
  482. key: "title",
  483. align: "center",
  484. minWidth: 100,
  485. slot: "titleSet",
  486. resizable: true,
  487. },
  488. // {
  489. // title: "价格",
  490. // key: "price",
  491. // align: "center",
  492. // minWidth: 100,
  493. // slot: "priceSet",
  494. // },
  495. {
  496. title: "计量单位",
  497. key: "product_unit",
  498. align: "center",
  499. minWidth: 100,
  500. slot: "product_unitSet",
  501. resizable: true,
  502. },
  503. {
  504. title: "位置",
  505. key: "position",
  506. align: "center",
  507. minWidth: 100,
  508. slot: "positionSet",
  509. resizable: true,
  510. },
  511. {
  512. title: "图纸",
  513. key: "url",
  514. align: "center",
  515. minWidth: 100,
  516. slot: "urlSet",
  517. resizable: true,
  518. },
  519. {
  520. title: "图号",
  521. key: "url_number",
  522. align: "center",
  523. minWidth: 120,
  524. slot: "url_numberSet",
  525. resizable: true,
  526. },
  527. {
  528. title: "型号",
  529. key: "model",
  530. align: "center",
  531. minWidth: 120,
  532. slot: "modelSet",
  533. resizable: true,
  534. },
  535. this.$route.query.type == 1
  536. ? {
  537. title: "操作",
  538. key: "set",
  539. align: "center",
  540. minWidth: 120,
  541. fixed: "right",
  542. slot: "set",
  543. resizable: true,
  544. }
  545. : { width: 1 },
  546. ],
  547. tableData: [],
  548. type: this.$route.query.type,
  549. isCheck: false,
  550. order_no: "",
  551. order_area_id: "",
  552. order_area_product_id: "",
  553. tempAddCol: [],
  554. measureList: [],
  555. showKey: false,
  556. cascader_list: [],
  557. };
  558. },
  559. // 生命周期 - 创建完成(可以访问当前this实例)
  560. created() {
  561. this.type = this.$route.query.type;
  562. this.$route.query.type == 1
  563. ? (this.isCheck = false)
  564. : (this.isCheck = true);
  565. this.order_no = this.$route.query.order_no;
  566. this.order_area_id = this.$route.query.order_area_id;
  567. this.order_area_product_id = this.$route.query.order_area_product_id;
  568. // 获取产品分类
  569. this.axios.get("/api/basics_product_index").then((res) => {
  570. this.cascader_list = res.data.data;
  571. });
  572. },
  573. // 生命周期 - 挂载完成(可以访问DOM元素)
  574. mounted() {
  575. this.initData(
  576. this.order_no,
  577. this.order_area_id,
  578. this.order_area_product_id
  579. );
  580. },
  581. methods: {
  582. successKey(str) {
  583. // this.$nextTick(()=>{
  584. // console.log(this.tableData[this.attrindex])
  585. // this.tableData[this.attrindex][this.attrName] = str;
  586. // })
  587. let tableData = JSON.parse(JSON.stringify(this.tableData));
  588. tableData[this.attrindex][this.attrName] = str;
  589. this.tableData = tableData;
  590. this.showKey = false;
  591. },
  592. cancelKey() {
  593. this.showKey = false;
  594. },
  595. openKey(row, attr) {
  596. console.log(row, attr);
  597. this.showKey = true;
  598. this.attrindex = row;
  599. this.attrName = attr;
  600. },
  601. checkImg(item) {
  602. let list = [];
  603. item.forEach((el) => {
  604. list.push({ img_url: el });
  605. });
  606. // this.axios('/api/orders_img', { params: { id: this.order_area_product_id, type: 1 } }).then(res => {
  607. // if (res.code == 200) {
  608. this.$previewImg({
  609. list,
  610. baseUrl: this.$store.state.ip,
  611. baseImgField: "img_url",
  612. baseTitleField: "",
  613. });
  614. // }
  615. // })
  616. },
  617. handleUpLoad() {},
  618. handleAddList() {
  619. this.tableData.push({
  620. house: "",
  621. unit: "",
  622. layer: "",
  623. number: "",
  624. title: "",
  625. price: "",
  626. product_unit: "",
  627. position: "",
  628. url: [],
  629. url_number: "",
  630. model: "",
  631. type_id: this.formData.type_id,
  632. ...this.tempAddCol,
  633. });
  634. this.tableData.forEach((el, index) => {
  635. el.index = index + 1;
  636. });
  637. },
  638. initData(order_no, order_area_id, order_area_product_id) {
  639. this.axios({
  640. method: "get",
  641. url: "/api/order_area_product_list",
  642. params: {
  643. order_no,
  644. order_area_id,
  645. order_area_product_id,
  646. },
  647. }).then((res) => {
  648. this.formData = res.data;
  649. this.tableData = res.data.detail;
  650. this.tableData.forEach((el, index) => {
  651. el.index = index + 1;
  652. let tempM = el.measure.split("*");
  653. tempM.forEach((item) => {
  654. el[item.substring(0, 1)] = item.substring(1);
  655. });
  656. if (!el.type_id) {
  657. el.type_id = this.formData.type_id;
  658. }
  659. el.type_title = this.get_type_title(this.cascader_list, el)[0];
  660. });
  661. let tempArr = [];
  662. this.measureList = res.data.measures;
  663. this.formData.measures.forEach((el, index) => {
  664. this.tempAddCol[el.e_title] = "";
  665. tempArr.push({
  666. title: el.title,
  667. key: el.e_title,
  668. align: "center",
  669. width: "150",
  670. slot: `formula_${el.e_title}`,
  671. resizable: true,
  672. });
  673. });
  674. this.tableColumns = [...this.tableColumns, ...tempArr];
  675. });
  676. },
  677. get_type_title(source, target) {
  678. return source.map((item) => {
  679. if (item.id == target.type_id) {
  680. return item.title;
  681. } else {
  682. return this.get_type_title(item.child, target);
  683. }
  684. });
  685. },
  686. goback() {
  687. this.$router.go(-1);
  688. },
  689. postData() {
  690. this.tableData.forEach((element) => {
  691. let measure = "";
  692. for (const key in element) {
  693. const el = element[key];
  694. this.formData.measures.forEach((item) => {
  695. if (key == item.e_title) {
  696. measure += `${item.e_title}${el}*`;
  697. }
  698. });
  699. }
  700. element.measure = measure.slice(0, measure.length - 1);
  701. });
  702. this.axios({
  703. method: "post",
  704. url: "/api/order_area_product_save",
  705. data: {
  706. order_no: this.order_no,
  707. order_area_id: this.order_area_id,
  708. order_area_product_id: this.order_area_product_id,
  709. list: this.tableData,
  710. },
  711. })
  712. .then((res) => {
  713. this.$Message.success(res.msg);
  714. this.goback();
  715. })
  716. .catch((err) => {});
  717. },
  718. uploadError(err) {
  719. this.$Message.error(err.msg || "上传失败");
  720. },
  721. //导入成功
  722. uploadSuccess(res) {
  723. if (res.code == 200) {
  724. this.$Message.success(res.msg || "上传成功");
  725. // const temp = res.data;
  726. // let list = [...this.postInfo.children, ...temp];
  727. } else {
  728. this.$Message.warning(res.msg || "上传失败");
  729. }
  730. },
  731. handleSet(row, index) {
  732. this.tableData.splice(index, 1);
  733. this.tableData.forEach((el, index) => {
  734. el.index = index + 1;
  735. });
  736. },
  737. looks(img) {
  738. const array = [{ img_url: img }];
  739. this.$previewImg({
  740. list: array,
  741. baseUrl: this.$store.state.ip,
  742. baseImgField: "img_url",
  743. baseTitleField: "",
  744. });
  745. },
  746. delItems(n, arr) {
  747. arr.splice(n, 1);
  748. },
  749. changeIpt(e, row) {
  750. let file = e.target.files[0];
  751. this.postImg(file, row);
  752. e.target.value = null;
  753. },
  754. postImg(file, row) {
  755. let formData = new FormData();
  756. formData.append("file", file);
  757. this.axios.post("/api/upload_pic", formData).then((res) => {
  758. row.url.push(res.data.url);
  759. });
  760. },
  761. },
  762. // 监听属性 类似于data概念
  763. computed: {},
  764. // 监控data中的数据变化
  765. watch: {},
  766. beforeCreate() {}, // 生命周期 - 创建之前
  767. beforeMount() {}, // 生命周期 - 挂载之前
  768. beforeUpdate() {}, // 生命周期 - 更新之前
  769. updated() {}, // 生命周期 - 更新之后
  770. beforeDestroy() {}, // 生命周期 - 销毁之前
  771. destroyed() {}, // 生命周期 - 销毁完成
  772. activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
  773. };
  774. </script>
  775. <style lang="scss" scoped>
  776. .BidSystemDeepeningOrderEdit {
  777. position: relative;
  778. .top_search {
  779. width: 100%;
  780. display: flex;
  781. justify-content: flex-start;
  782. align-items: center;
  783. flex-wrap: wrap;
  784. padding: 10px 0;
  785. span {
  786. min-width: 40px;
  787. margin-right: 5px;
  788. }
  789. div {
  790. display: flex;
  791. justify-content: flex-start;
  792. align-items: center;
  793. width: 200px;
  794. word-break: break-word;
  795. padding: 10px;
  796. img {
  797. max-width: 60px;
  798. }
  799. }
  800. }
  801. .table-data {
  802. position: relative;
  803. width: 100%;
  804. .table-data-btn {
  805. display: flex;
  806. justify-content: space-between;
  807. padding: 10px 0;
  808. }
  809. }
  810. .product-img {
  811. padding-top: 10px;
  812. }
  813. .product-add {
  814. display: flex;
  815. flex-wrap: wrap;
  816. .ipt {
  817. position: absolute;
  818. width: 100%;
  819. height: 100%;
  820. opacity: 0;
  821. cursor: pointer;
  822. outline: none;
  823. top: 0;
  824. left: 0;
  825. }
  826. .add-items {
  827. width: 40px;
  828. height: 40px;
  829. border: 1px dotted #e7e7e7;
  830. border-radius: 5px;
  831. display: flex;
  832. justify-content: center;
  833. align-items: center;
  834. overflow: hidden;
  835. position: relative;
  836. flex-direction: column;
  837. background: #f4f5f7;
  838. .item {
  839. width: 46px;
  840. height: 46px;
  841. background: #3764ff;
  842. opacity: 0.6;
  843. display: flex;
  844. justify-content: center;
  845. align-items: center;
  846. border-radius: 50%;
  847. color: #fff;
  848. }
  849. }
  850. .items {
  851. width: 40px;
  852. height: 40px;
  853. margin-bottom: 10px;
  854. display: flex;
  855. justify-content: center;
  856. align-items: center;
  857. background: #e7e7e7;
  858. margin-right: 10px;
  859. border-radius: 5px;
  860. position: relative;
  861. img {
  862. max-width: 40px;
  863. max-height: 40px;
  864. }
  865. }
  866. }
  867. }
  868. </style>