edit.vue 26 KB

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