edit.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874
  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. @change="handleTypeTitleChange"
  235. ></el-cascader>
  236. <!-- @change="changeProduct(tableData[index], index)" -->
  237. <span v-else>{{ tableData[index].type_title }}</span>
  238. </template>
  239. <template slot="titleSet" slot-scope="{ index }">
  240. <Input
  241. type="text"
  242. size="small"
  243. :disabled="isCheck"
  244. v-if="type == 1"
  245. v-model="tableData[index].title"
  246. placeholder="产品"
  247. />
  248. <span v-else>{{ tableData[index].title }}</span>
  249. </template>
  250. <!-- <template slot="priceSet"
  251. slot-scope="{ index }">
  252. <Input type="text"
  253. size="small"
  254. :disabled="isCheck"
  255. v-model="tableData[index].price"
  256. placeholder="价格" />
  257. </template> -->
  258. <template slot="product_unitSet" slot-scope="{ index }">
  259. <Input
  260. type="text"
  261. size="small"
  262. :disabled="isCheck"
  263. v-if="type == 1"
  264. v-model="tableData[index].product_unit"
  265. placeholder="单位"
  266. />
  267. <span v-else>{{ tableData[index].product_unit }}</span>
  268. </template>
  269. <template slot="positionSet" slot-scope="{ index }">
  270. <Input
  271. type="text"
  272. size="small"
  273. :disabled="isCheck"
  274. v-if="type == 1"
  275. v-model="tableData[index].position"
  276. placeholder="位置"
  277. />
  278. <span v-else>{{ tableData[index].position }}</span>
  279. </template>
  280. <template slot="urlSet" slot-scope="{ index }">
  281. <!-- <Input type="text"
  282. size="small"
  283. v-model="row.url"
  284. placeholder="图纸" /> -->
  285. <div class="product-img">
  286. <div class="product-add">
  287. <div
  288. class="items"
  289. v-for="(_item, _index) of tableData[index].url"
  290. :key="_index"
  291. >
  292. <img
  293. @click="looks(_item)"
  294. v-for="(el, idx) in tableData[index].url"
  295. :key="idx"
  296. :src="$store.state.ip + el"
  297. alt=""
  298. />
  299. <Icon
  300. size="20"
  301. v-show="type == 1"
  302. @click="delItems(_index, tableData[index].url)"
  303. class="delete-img"
  304. type="ios-close-circle"
  305. />
  306. </div>
  307. <div class="add-items" v-if="type == 1">
  308. <div class="_item">
  309. <Icon size="50" type="ios-add" />
  310. </div>
  311. <input
  312. @change="changeIpt($event, tableData[index])"
  313. type="file"
  314. class="ipt"
  315. />
  316. </div>
  317. </div>
  318. </div>
  319. </template>
  320. <template slot="url_numberSet" slot-scope="{ index }">
  321. <Input
  322. type="text"
  323. size="small"
  324. v-if="type == 1"
  325. v-model="tableData[index].url_number"
  326. placeholder="图号"
  327. />
  328. <span v-else>{{ tableData[index].url_number }}</span>
  329. </template>
  330. <template slot="modelSet" slot-scope="{ index }">
  331. <Input
  332. type="text"
  333. size="small"
  334. v-if="type == 1"
  335. v-model="tableData[index].model"
  336. placeholder="型号"
  337. />
  338. <span v-else>{{ tableData[index].model }}</span>
  339. </template>
  340. <template slot="set" slot-scope="{ index }">
  341. <a
  342. style="margin: 0 5px; color: red"
  343. v-show="type != 2"
  344. @click="handleSet(tableData[index], index)"
  345. >删除</a
  346. >
  347. </template>
  348. <div
  349. v-for="item in measureList"
  350. :key="item.e_title"
  351. :slot="'formula_' + item.e_title"
  352. slot-scope="{ index }"
  353. >
  354. <div>
  355. <Input
  356. v-if="type == 1"
  357. @on-focus="openKey(index, item.e_title)"
  358. size="small"
  359. clearable
  360. :placeholder="item.title"
  361. v-model="tableData[index][item.e_title]"
  362. />
  363. <span v-else>{{ tableData[index][item.e_title] }}</span>
  364. </div>
  365. </div>
  366. <!-- <div slot="formula_H"
  367. slot-scope="{ index }">
  368. <div>
  369. <Input :disabled="type == 2"
  370. @on-focus="openKey(index, 'H')"
  371. clearable
  372. placeholder="高"
  373. v-model="tableData[index].H"></Input>
  374. </div>
  375. </div> -->
  376. <!-- <template slot="formula_W"
  377. slot-scope="{ index }">
  378. <div>
  379. <Input :disabled="type == 2"
  380. @on-focus="openKey(index, 'W')"
  381. clearable
  382. placeholder="宽"
  383. v-model="tableData[index].W"></Input>
  384. </div>
  385. </template> -->
  386. <!-- <template slot="formula_D"
  387. slot-scope="{ index }">
  388. <div>
  389. <Input :disabled="type == 2"
  390. @on-focus="openKey(index, 'D')"
  391. clearable
  392. placeholder="深"
  393. v-model="tableData[index].D"></Input>
  394. </div>
  395. </template> -->
  396. </Table>
  397. </div>
  398. </div>
  399. <Modal
  400. v-model="showKey"
  401. :width="1250"
  402. :mask-closable="false"
  403. :closable="false"
  404. >
  405. <div>
  406. <KeyBoard
  407. :rightData="measureList"
  408. @cancel="cancelKey"
  409. @success="successKey"
  410. class="key-co"
  411. />
  412. </div>
  413. <div slot="footer"></div>
  414. </Modal>
  415. </div>
  416. </template>
  417. <script>
  418. // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  419. // 例如:import 《组件名称》 from '《组件路径》';
  420. import KeyBoard from "../../../components/keyboard/index";
  421. export default {
  422. name: "BidSystemDeepeningOrderEdit",
  423. components: {
  424. KeyBoard,
  425. },
  426. props: {},
  427. // import引入的组件需要注入到对象中才能使用
  428. data() {
  429. // 这里存放数据
  430. return {
  431. headers: { Authorization: localStorage.getItem("token") },
  432. formData: {},
  433. tableColumns: [
  434. {
  435. title: "序号",
  436. type: "index",
  437. align: "center",
  438. width: "80",
  439. resizable: true,
  440. },
  441. {
  442. title: "楼栋",
  443. key: "house",
  444. align: "center",
  445. width: "100",
  446. slot: "houseSet",
  447. resizable: true,
  448. },
  449. {
  450. title: "楼单元",
  451. key: "unit",
  452. align: "center",
  453. width: "100",
  454. slot: "unitSet",
  455. resizable: true,
  456. },
  457. {
  458. title: "楼层",
  459. key: "layer",
  460. align: "center",
  461. width: "100",
  462. slot: "layerSet",
  463. resizable: true,
  464. },
  465. {
  466. title: "房间号",
  467. key: "number",
  468. align: "center",
  469. width: "100",
  470. slot: "numberSet",
  471. resizable: true,
  472. },
  473. {
  474. title: "产品分类",
  475. key: "title",
  476. align: "center",
  477. minWidth: 200,
  478. slot: "type_titleSet",
  479. resizable: true,
  480. },
  481. {
  482. title: "产品",
  483. key: "title",
  484. align: "center",
  485. minWidth: 100,
  486. slot: "titleSet",
  487. resizable: true,
  488. },
  489. // {
  490. // title: "价格",
  491. // key: "price",
  492. // align: "center",
  493. // minWidth: 100,
  494. // slot: "priceSet",
  495. // },
  496. {
  497. title: "计量单位",
  498. key: "product_unit",
  499. align: "center",
  500. minWidth: 100,
  501. slot: "product_unitSet",
  502. resizable: true,
  503. },
  504. {
  505. title: "位置",
  506. key: "position",
  507. align: "center",
  508. minWidth: 100,
  509. slot: "positionSet",
  510. resizable: true,
  511. },
  512. {
  513. title: "图纸",
  514. key: "url",
  515. align: "center",
  516. minWidth: 100,
  517. slot: "urlSet",
  518. resizable: true,
  519. },
  520. {
  521. title: "图号",
  522. key: "url_number",
  523. align: "center",
  524. minWidth: 120,
  525. slot: "url_numberSet",
  526. resizable: true,
  527. },
  528. {
  529. title: "型号",
  530. key: "model",
  531. align: "center",
  532. minWidth: 120,
  533. slot: "modelSet",
  534. resizable: true,
  535. },
  536. this.$route.query.type == 1
  537. ? {
  538. title: "操作",
  539. key: "set",
  540. align: "center",
  541. minWidth: 120,
  542. fixed: "right",
  543. slot: "set",
  544. resizable: true,
  545. }
  546. : { width: 1 },
  547. ],
  548. tableData: [],
  549. type: this.$route.query.type,
  550. isCheck: false,
  551. order_no: "",
  552. order_area_id: "",
  553. order_area_product_id: "",
  554. tempAddCol: [],
  555. measureList: [],
  556. showKey: false,
  557. cascader_list: [],
  558. };
  559. },
  560. // 生命周期 - 创建完成(可以访问当前this实例)
  561. created() {
  562. this.type = this.$route.query.type;
  563. this.$route.query.type == 1
  564. ? (this.isCheck = false)
  565. : (this.isCheck = true);
  566. this.order_no = this.$route.query.order_no;
  567. this.order_area_id = this.$route.query.order_area_id;
  568. this.order_area_product_id = this.$route.query.order_area_product_id;
  569. // 获取产品分类
  570. this.axios.get("/api/basics_product_index").then((res) => {
  571. this.cascader_list = res.data.data;
  572. });
  573. },
  574. // 生命周期 - 挂载完成(可以访问DOM元素)
  575. mounted() {
  576. this.initData(
  577. this.order_no,
  578. this.order_area_id,
  579. this.order_area_product_id
  580. );
  581. },
  582. methods: {
  583. successKey(str) {
  584. // this.$nextTick(()=>{
  585. // console.log(this.tableData[this.attrindex])
  586. // this.tableData[this.attrindex][this.attrName] = str;
  587. // })
  588. let tableData = JSON.parse(JSON.stringify(this.tableData));
  589. tableData[this.attrindex][this.attrName] = str;
  590. this.tableData = tableData;
  591. this.showKey = false;
  592. },
  593. cancelKey() {
  594. this.showKey = false;
  595. },
  596. openKey(row, attr) {
  597. console.log(row, attr);
  598. this.showKey = true;
  599. this.attrindex = row;
  600. this.attrName = attr;
  601. },
  602. checkImg(item) {
  603. let list = [];
  604. item.forEach((el) => {
  605. list.push({ img_url: el });
  606. });
  607. // this.axios('/api/orders_img', { params: { id: this.order_area_product_id, type: 1 } }).then(res => {
  608. // if (res.code == 200) {
  609. this.$previewImg({
  610. list,
  611. baseUrl: this.$store.state.ip,
  612. baseImgField: "img_url",
  613. baseTitleField: "",
  614. });
  615. // }
  616. // })
  617. },
  618. handleUpLoad() {},
  619. handleAddList() {
  620. this.tableData.push({
  621. house: "",
  622. unit: "",
  623. layer: "",
  624. number: "",
  625. title: "",
  626. price: "",
  627. product_unit: "",
  628. position: "",
  629. url: [],
  630. url_number: "",
  631. model: "",
  632. type_id: this.formData.type_id,
  633. ...this.tempAddCol,
  634. });
  635. this.tableData.forEach((el, index) => {
  636. el.index = index + 1;
  637. });
  638. },
  639. initData(order_no, order_area_id, order_area_product_id) {
  640. this.axios({
  641. method: "get",
  642. url: "/api/order_area_product_list",
  643. params: {
  644. order_no,
  645. order_area_id,
  646. order_area_product_id,
  647. },
  648. }).then((res) => {
  649. this.formData = res.data;
  650. this.tableData = res.data.detail;
  651. this.tableData.forEach((el, index) => {
  652. el.index = index + 1;
  653. let tempM = el.measure.split("*");
  654. tempM.forEach((item) => {
  655. el[item.substring(0, 1)] = item.substring(1);
  656. });
  657. if (!el.type_id) {
  658. el.type_id = this.formData.type_id;
  659. }
  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. handleTypeTitleChange(e){
  762. }
  763. },
  764. // 监听属性 类似于data概念
  765. computed: {},
  766. // 监控data中的数据变化
  767. watch: {},
  768. beforeCreate() {}, // 生命周期 - 创建之前
  769. beforeMount() {}, // 生命周期 - 挂载之前
  770. beforeUpdate() {}, // 生命周期 - 更新之前
  771. updated() {}, // 生命周期 - 更新之后
  772. beforeDestroy() {}, // 生命周期 - 销毁之前
  773. destroyed() {}, // 生命周期 - 销毁完成
  774. activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
  775. };
  776. </script>
  777. <style lang="scss" scoped>
  778. .BidSystemDeepeningOrderEdit {
  779. position: relative;
  780. .top_search {
  781. width: 100%;
  782. display: flex;
  783. justify-content: flex-start;
  784. align-items: center;
  785. flex-wrap: wrap;
  786. padding: 10px 0;
  787. span {
  788. min-width: 40px;
  789. margin-right: 5px;
  790. }
  791. div {
  792. display: flex;
  793. justify-content: flex-start;
  794. align-items: center;
  795. width: 200px;
  796. word-break: break-word;
  797. padding: 10px;
  798. img {
  799. max-width: 60px;
  800. }
  801. }
  802. }
  803. .table-data {
  804. position: relative;
  805. width: 100%;
  806. .table-data-btn {
  807. display: flex;
  808. justify-content: space-between;
  809. padding: 10px 0;
  810. }
  811. }
  812. .product-img {
  813. padding-top: 10px;
  814. }
  815. .product-add {
  816. display: flex;
  817. flex-wrap: wrap;
  818. .ipt {
  819. position: absolute;
  820. width: 100%;
  821. height: 100%;
  822. opacity: 0;
  823. cursor: pointer;
  824. outline: none;
  825. top: 0;
  826. left: 0;
  827. }
  828. .add-items {
  829. width: 40px;
  830. height: 40px;
  831. border: 1px dotted #e7e7e7;
  832. border-radius: 5px;
  833. display: flex;
  834. justify-content: center;
  835. align-items: center;
  836. overflow: hidden;
  837. position: relative;
  838. flex-direction: column;
  839. background: #f4f5f7;
  840. .item {
  841. width: 46px;
  842. height: 46px;
  843. background: #3764ff;
  844. opacity: 0.6;
  845. display: flex;
  846. justify-content: center;
  847. align-items: center;
  848. border-radius: 50%;
  849. color: #fff;
  850. }
  851. }
  852. .items {
  853. width: 40px;
  854. height: 40px;
  855. margin-bottom: 10px;
  856. display: flex;
  857. justify-content: center;
  858. align-items: center;
  859. background: #e7e7e7;
  860. margin-right: 10px;
  861. border-radius: 5px;
  862. position: relative;
  863. img {
  864. max-width: 40px;
  865. max-height: 40px;
  866. }
  867. }
  868. }
  869. }
  870. </style>