changeDetail.vue 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067
  1. <template>
  2. <div class="changeDetail">
  3. <Modal class-name="vertical-center-modal" title='保存' v-model='show' :width="400" @on-ok="then"
  4. @on-cancel="show = false">
  5. <div>
  6. <span>确认保存吗?</span>
  7. </div>
  8. </Modal>
  9. <Toptitle title="变更">
  10. <slot name="titleButton">
  11. <Button
  12. @click="goback()"
  13. type="primary"
  14. ghost
  15. style="margin-right: 10px"
  16. >取消</Button>
  17. <Button
  18. @click="handleFinish()"
  19. type="primary"
  20. style="margin-right: 10px"
  21. >变更保存</Button
  22. >
  23. </slot>
  24. </Toptitle>
  25. <div>
  26. <div class="form">
  27. <div class="form_content">
  28. <Form
  29. :model="formData"
  30. :label-width="80"
  31. class="form_content_header"
  32. >
  33. <FormItem label="楼幢:">
  34. <Select
  35. filterable
  36. clearable
  37. v-model="formData.building"
  38. size="small"
  39. style="width: 120px"
  40. >
  41. <Option
  42. v-for="(_item, _index) in building_list"
  43. :key="_index"
  44. :label="_item"
  45. :value="_item"
  46. ></Option>
  47. </Select>
  48. </FormItem>
  49. <FormItem label="单元:">
  50. <Select
  51. filterable
  52. clearable
  53. v-model="formData.unit"
  54. size="small"
  55. style="width: 120px"
  56. >
  57. <Option
  58. v-for="(_item, _index) in unit_list"
  59. :key="_index"
  60. :label="_item"
  61. :value="_item"
  62. ></Option>
  63. </Select>
  64. </FormItem>
  65. <FormItem label="楼层:">
  66. <Select
  67. filterable
  68. clearable
  69. v-model="formData.floor"
  70. size="small"
  71. style="width: 120px"
  72. >
  73. <Option
  74. v-for="(_item, _index) in floor_list"
  75. :key="_index"
  76. :label="_item"
  77. :value="_item"
  78. ></Option>
  79. </Select>
  80. </FormItem>
  81. <FormItem label="房号:">
  82. <Select
  83. filterable
  84. clearable
  85. v-model="formData.room_number"
  86. size="small"
  87. style="width: 120px"
  88. >
  89. <Option
  90. v-for="(_item, _index) in room_number_list"
  91. :key="_index"
  92. :label="_item"
  93. :value="_item"
  94. ></Option>
  95. </Select>
  96. </FormItem>
  97. <FormItem label="产品名称:">
  98. <Select
  99. filterable
  100. clearable
  101. v-model="formData.product_title"
  102. size="small"
  103. style="width: 120px"
  104. >
  105. <Option
  106. v-for="(_item, _index) in product_title_list"
  107. :key="_index"
  108. :label="_item"
  109. :value="_item"
  110. ></Option>
  111. </Select>
  112. </FormItem>
  113. <FormItem label="图号:">
  114. <Select
  115. filterable
  116. clearable
  117. v-model="formData.pic_number"
  118. size="small"
  119. style="width: 120px"
  120. >
  121. <Option
  122. v-for="(_item, _index) in pic_number_list"
  123. :key="_index"
  124. :label="_item"
  125. :value="_item"
  126. ></Option>
  127. </Select>
  128. </FormItem>
  129. <FormItem>
  130. <Button @click="getListData" type="primary" size="small"
  131. >搜索</Button
  132. >
  133. </FormItem>
  134. </Form>
  135. <div class="top_search">
  136. <div><span>区域编码:</span>{{ formData.area_num }}</div>
  137. <div><span>区域名称:</span>{{ formData.area_title }}</div>
  138. <div><span>产品名称:</span>{{ formData.title }}</div>
  139. <div><span>数量:</span>{{ formData.num }}</div>
  140. <div><span>规格:</span>{{ formData.measure }}</div>
  141. <div><span>工艺属性:</span>{{ formData.process_property }}</div>
  142. <div><span>图号:</span>{{ formData.url_number }}</div>
  143. <div style="display:flex;">
  144. <span style="width:97px;">图纸:</span>
  145. <div>
  146. <span
  147. v-for="item in formData.url"
  148. :key="item"
  149. @click="checkImg(formData.url)"
  150. >
  151. <img :src="$store.state.ip + item" alt="" style=" max-width: 80px; max-height: 80px;"/>
  152. </span>
  153. </div>
  154. </div>
  155. <div>
  156. <span>左右式:</span
  157. >{{
  158. formData.left_right_mode == 1
  159. ? "左式"
  160. : formData.left_right_mode == 2
  161. ? "右式"
  162. : "无"
  163. }}
  164. </div>
  165. <!-- <div><span>价格:</span>{{ formData.price }}</div> -->
  166. <div><span>备注:</span>{{ formData.remark }}</div>
  167. </div>
  168. </div>
  169. <div class="form_middle">
  170. <Form class="form_middle_content" :label-width="100">
  171. <FormItem label="联系单编号:">
  172. <Input
  173. placeholder="请输入单号"
  174. style="width: auto"
  175. v-model="formData.contact_order_no"
  176. ></Input>
  177. </FormItem>
  178. <FormItem label="原生产单编号:">
  179. <span
  180. style="width: auto"
  181. >{{this.$route.query.order_no}}</span>
  182. </FormItem>
  183. <FormItem label="接收部门:">
  184. <Select
  185. filterable
  186. clearable
  187. v-model="formData.depart_end"
  188. size="small"
  189. style="width: 120px"
  190. >
  191. <Option
  192. v-for="(item,index) in depart_list"
  193. :key="index"
  194. :label="item.title"
  195. :value="item.id"
  196. ></Option>
  197. </Select>
  198. </FormItem>
  199. <FormItem label="发出部门:">
  200. <Select
  201. filterable
  202. clearable
  203. v-model="formData.depart_start"
  204. size="small"
  205. style="width: 120px"
  206. >
  207. <Option
  208. v-for="(item, index) in depart_list"
  209. :key="index"
  210. :label="item.title"
  211. :value="item.id"
  212. ></Option>
  213. </Select>
  214. </FormItem>
  215. <FormItem label="更改性质:">
  216. <Input placeholder="请输入..." style="width: auto" v-model="formData.change_type"></Input>
  217. </FormItem>
  218. <FormItem label="变更原因:">
  219. <Input
  220. type="textarea"
  221. placeholder="请输入..."
  222. style="width: auto"
  223. v-model="formData.msg"
  224. ></Input>
  225. </FormItem>
  226. </Form>
  227. </div>
  228. </div>
  229. </div>
  230. <Card style="width: 100%">
  231. <div style="margin-left: 5px">
  232. <Button
  233. type="primary"
  234. size="small"
  235. style="width: 70px"
  236. @click="add_line"
  237. >增行</Button
  238. >
  239. </div>
  240. <Table :columns="tableColumns" :data="tableData" border>
  241. <template slot="houseSet" slot-scope="{ row, index }">
  242. <Input
  243. type="text"
  244. size="small"
  245. v-if="row.input_state"
  246. v-model="tableData[index].house"
  247. placeholder="楼栋"
  248. />
  249. <span v-else>{{ tableData[index].house }}</span>
  250. </template>
  251. <template slot="unitSet" slot-scope="{ row, index }">
  252. <Input
  253. type="text"
  254. size="small"
  255. v-if="row.input_state"
  256. v-model="tableData[index].unit"
  257. placeholder="单元"
  258. />
  259. <span v-else>{{ tableData[index].unit }}</span>
  260. </template>
  261. <template slot="layerSet" slot-scope="{ row, index }">
  262. <Input
  263. type="text"
  264. size="small"
  265. v-if="row.input_state"
  266. v-model="tableData[index].layer"
  267. placeholder="楼层"
  268. />
  269. <span v-else>{{ tableData[index].layer }}</span>
  270. </template>
  271. <template slot="numberSet" slot-scope="{ row, index }">
  272. <Input
  273. type="text"
  274. size="small"
  275. v-if="row.input_state"
  276. v-model="tableData[index].number"
  277. placeholder="房间号"
  278. />
  279. <span v-else>{{ tableData[index].number }}</span>
  280. </template>
  281. <template slot="type_titleSet" slot-scope="{ row, index }">
  282. <el-cascader
  283. v-if="row.input_state"
  284. v-model="tableData[index].type_id"
  285. size="small"
  286. :show-all-levels="false"
  287. :options="cascader_list"
  288. :props="{
  289. expandTrigger: 'hover',
  290. children: 'child',
  291. value: 'id',
  292. label: 'title',
  293. emitPath: false,
  294. checkStrictly: true,
  295. }"
  296. @change="handleTypeTitleChange"
  297. ></el-cascader>
  298. <!-- @change="changeProduct(tableData[index], index)" -->
  299. <span v-else>{{ tableData[index].type_title }}</span>
  300. </template>
  301. <template slot="titleSet" slot-scope="{ row, index }">
  302. <Input
  303. type="text"
  304. size="small"
  305. v-if="row.input_state"
  306. v-model="tableData[index].title"
  307. placeholder="产品"
  308. />
  309. <span v-else>{{ tableData[index].title }}</span>
  310. </template>
  311. <template slot="product_unitSet" slot-scope="{ row, index }">
  312. <Input
  313. type="text"
  314. size="small"
  315. v-if="row.input_state"
  316. v-model="tableData[index].product_unit"
  317. placeholder="单位"
  318. />
  319. <span v-else>{{ tableData[index].product_unit }}</span>
  320. </template>
  321. <template slot="positionSet" slot-scope="{ row, index }">
  322. <Input
  323. type="text"
  324. size="small"
  325. v-if="row.input_state"
  326. v-model="tableData[index].position"
  327. placeholder="位置"
  328. />
  329. <span v-else>{{ tableData[index].position }}</span>
  330. </template>
  331. <template slot="urlSet" slot-scope="{ row,index }">
  332. <div class="product-img">
  333. <div class="product-add">
  334. <div
  335. class="items"
  336. v-show="tableData[index].url.length !== 0 ? true : false"
  337. >
  338. <img
  339. @click="looks(tableData[index].url)"
  340. v-for="(el, idx) in tableData[index].url"
  341. :key="idx"
  342. :src="$store.state.ip + el"
  343. alt=""
  344. />
  345. </div>
  346. <template style="flex" >
  347. <div style="display: flex; justify-content: center" v-if="row.input_state">
  348. <Icon
  349. size="50"
  350. @click="
  351. delItems(
  352. tableData[index].url.length - 1,
  353. tableData[index].url
  354. )
  355. "
  356. class="add-items"
  357. type="ios-remove"
  358. />
  359. <div class="add-items">
  360. <div class="_item">
  361. <Icon size="50" type="ios-add" />
  362. </div>
  363. <input
  364. @change="changeIpt($event, tableData[index])"
  365. type="file"
  366. class="ipt"
  367. />
  368. </div>
  369. </div>
  370. </template>
  371. </div>
  372. </div>
  373. </template>
  374. <template slot="url_numberSet" slot-scope="{ row, index }">
  375. <Input
  376. type="text"
  377. size="small"
  378. v-if="row.input_state"
  379. v-model="tableData[index].url_number"
  380. placeholder="图号"
  381. />
  382. <span v-else>{{ tableData[index].url_number }}</span>
  383. </template>
  384. <template slot="modelSet" slot-scope="{ row, index }">
  385. <Input
  386. type="text"
  387. size="small"
  388. v-if="row.input_state"
  389. v-model="tableData[index].model"
  390. placeholder="型号"
  391. />
  392. <span v-else>{{ tableData[index].model }}</span>
  393. </template>
  394. <template slot="status" slot-scope="{ row }">
  395. <span>{{ row.status === 5 ||row.status === 2?'':row.status === 4||row.check_state?'变更':'新增' }}</span>
  396. </template>
  397. <template slot="long" slot-scope="{ row, index }">
  398. <Input
  399. type="text"
  400. size="small"
  401. v-if="row.input_state"
  402. v-model="tableData[index].long"
  403. placeholder="长"
  404. />
  405. <span v-else>{{ row.long }}</span>
  406. </template>
  407. <template slot="width" slot-scope="{ row, index }">
  408. <Input
  409. type="text"
  410. size="small"
  411. v-if="row.input_state"
  412. v-model="tableData[index].wide"
  413. placeholder="宽"
  414. />
  415. <span v-else>{{ tableData[index].wide }}</span>
  416. </template>
  417. <template slot="heigh" slot-scope="{ row, index }">
  418. <Input
  419. type="text"
  420. size="small"
  421. v-if="row.input_state"
  422. v-model="tableData[index].high"
  423. placeholder="高"
  424. />
  425. <span v-else>{{ tableData[index].high }}</span>
  426. </template>
  427. <template slot="set" slot-scope="{ row, index }">
  428. <a
  429. style="margin: 0 5px; color: #2d8cf0;"
  430. @click="handleSet(row, index, 4)"
  431. v-show="row.status == 5 ||row.status == 0 && row.del "
  432. >变更</a
  433. >
  434. <a
  435. style="margin: 0 5px; color: rgb(58 199 101);"
  436. @click="handleSet(row, index, 1)"
  437. v-show="row.status == 4 && row.del "
  438. >确认</a
  439. >
  440. <a
  441. style="margin: 0 5px; color: #2d8cf0;"
  442. @click="handleSet(row, index, 2)"
  443. v-show="row.del"
  444. >复制</a
  445. >
  446. <a style="margin: 0 5px; color: red" @click="handleSet(row, index, 3)" v-show="row.del"
  447. >删除</a
  448. >
  449. </template>
  450. </Table>
  451. <div class="List_form_content">
  452. <div>
  453. <span style="font-size: 20px; font-weight: bold">原深化单内容</span>
  454. </div>
  455. <Table :columns="ListColumns" :data="ListData">
  456. <template slot="urlSet" slot-scope="{ index }">
  457. <div
  458. class="items"
  459. v-show="ListData[index].url.length !== 0 ? true : false"
  460. >
  461. <img
  462. @click="looks(ListData[index].url)"
  463. v-for="(el, idx) in ListData[index].url"
  464. :key="idx"
  465. :src="$store.state.ip + el"
  466. alt=""
  467. style="max-width: 40px; max-height: 40px"
  468. />
  469. </div>
  470. </template>
  471. </Table>
  472. </div>
  473. </Card>
  474. </div>
  475. </template>
  476. <script>
  477. export default {
  478. data() {
  479. return {
  480. formData: {
  481. building: "",
  482. unit: "",
  483. room_number: "",
  484. floor: "",
  485. product_title: "",
  486. copy_data:[],
  487. pic_number: "",
  488. depart_end:'',
  489. depart_start:'',
  490. msg:'',
  491. contact_order_no:'',
  492. change_type:''
  493. },
  494. cascader_list: [],
  495. building_list: [],
  496. show:false,
  497. type: 1,
  498. unit_list: [],
  499. floor_list: [],
  500. affirm:false,
  501. room_number_list: [],
  502. product_title_list: [],
  503. pic_number_list: [],
  504. tableColumns: [
  505. { title: "序号", align: "center", width: 100, key: "table_id" },
  506. {
  507. title: "楼栋",
  508. key: "house",
  509. align: "center",
  510. width: 80,
  511. slot: "houseSet",
  512. resizable: true,
  513. },
  514. {
  515. title: "楼单元",
  516. key: "unit",
  517. align: "center",
  518. width: 80,
  519. slot: "unitSet",
  520. resizable: true,
  521. },
  522. {
  523. title: "楼层",
  524. key: "layer",
  525. align: "center",
  526. width: 80,
  527. slot: "layerSet",
  528. resizable: true,
  529. },
  530. {
  531. title: "房间号",
  532. key: "number",
  533. align: "center",
  534. width: 100,
  535. slot: "numberSet",
  536. resizable: true,
  537. },
  538. {
  539. title: "产品分类",
  540. key: "title",
  541. align: "center",
  542. width: 140,
  543. slot: "type_titleSet",
  544. resizable: true,
  545. },
  546. {
  547. title: "产品",
  548. key: "title",
  549. align: "center",
  550. width: 130,
  551. slot: "titleSet",
  552. resizable: true,
  553. },
  554. {
  555. title: "计量单位",
  556. key: "product_unit",
  557. align: "center",
  558. width: 100,
  559. slot: "product_unitSet",
  560. resizable: true,
  561. },
  562. {
  563. title: "位置",
  564. key: "position",
  565. align: "center",
  566. width: 100,
  567. slot: "positionSet",
  568. resizable: true,
  569. },
  570. {
  571. title: "图纸",
  572. key: "url",
  573. align: "center",
  574. width: 120,
  575. slot: "urlSet",
  576. resizable: true,
  577. },
  578. {
  579. title: "图号",
  580. key: "url_number",
  581. align: "center",
  582. width: 120,
  583. slot: "url_numberSet",
  584. resizable: true,
  585. },
  586. {
  587. title: "型号",
  588. key: "model",
  589. align: "center",
  590. width: 120,
  591. slot: "modelSet",
  592. resizable: true,
  593. },
  594. {
  595. title: "长",
  596. key: "H",
  597. align: "center",
  598. width: 120,
  599. resizable: true,
  600. slot: "long",
  601. },
  602. {
  603. title: "宽",
  604. key: "W",
  605. align: "center",
  606. width: 120,
  607. slot: "width",
  608. resizable: true,
  609. },
  610. {
  611. title: "高",
  612. key: "T",
  613. align: "center",
  614. width: 120,
  615. slot: "heigh",
  616. resizable: true,
  617. },
  618. {
  619. title: "变更类型",
  620. key: "status",
  621. align: "center",
  622. width: 120,
  623. slot: "status",
  624. resizable: true,
  625. },
  626. this.$route.query.type == 2
  627. ? {
  628. title: "操作",
  629. key: "set",
  630. align: "center",
  631. minWidth: 160,
  632. fixed: "right",
  633. slot: "set",
  634. resizable: true,
  635. }
  636. : { width: 1 },
  637. ],
  638. tableData: [],
  639. ListColumns: [
  640. { title: "序号", align: "center", minWidth: 100, key: "table_id" },
  641. { title: "楼栋", key: "house", align: "center", minWidth: 100 },
  642. { title: "楼单元", key: "unit", align: "center", minWidth: 100 },
  643. { title: "楼层", key: "layer", align: "center", minWidth: 100 },
  644. { title: "房价号", key: "number", align: "center", minWidth: 100 },
  645. {
  646. title: "产品分类",
  647. key: "type_title",
  648. align: "center",
  649. minWidth: 100,
  650. },
  651. { title: "产品", key: "title", align: "center", minWidth: 100 },
  652. {
  653. title: "计量单位",
  654. key: "product_unit",
  655. align: "center",
  656. minWidth: 100,
  657. },
  658. { title: "位置", key: "position", align: "center", minWidth: 100 },
  659. {
  660. title: "图纸",
  661. key: "url",
  662. align: "center",
  663. minWidth: 100,
  664. slot: "urlSet",
  665. },
  666. { title: "图号", key: "url_number", align: "center", minWidth: 100 },
  667. { title: "型号", key: "model", align: "center", minWidth: 100 },
  668. { title: "长", key: "long", align: "center", minWidth: 100 },
  669. { title: "宽", key: "wide", align: "center", minWidth: 100 },
  670. { title: "高", key: "high", align: "center", minWidth: 100 },
  671. { title: "变更类型", key: "state", align: "center", minWidth: 100 },
  672. ],
  673. ListData: [],
  674. page_index: 1,
  675. page_size: 10,
  676. depart_list:[],
  677. show:false
  678. };
  679. },
  680. created(){
  681. this.axios.get("/api/basics_product_index").then((res) => {
  682. this.cascader_list = res.data.data;
  683. });
  684. this.axios.get('/api/employee_depart_list').then(res=>{
  685. this.depart_list = res.data
  686. let arr = [];
  687. this.depart_list.forEach(item=>{
  688. if(item.sub.length == 0){
  689. arr.push(item)
  690. }
  691. else{
  692. item.sub.forEach(_item=>{
  693. arr.push(_item)
  694. })
  695. }
  696. })
  697. this.depart_list =arr
  698. })
  699. },
  700. mounted() {
  701. this.initData(
  702. this.$route.query.order_no,
  703. this.$route.query.order_area_id,
  704. this.$route.query.order_area_product_id
  705. );
  706. },
  707. methods: {
  708. then(){
  709. let arr = [];
  710. let arr1 = [];
  711. this.tableData.forEach(item=>{
  712. item.product_title = item.title
  713. if(item.status ==1||item.status ==0){
  714. arr.push(item)
  715. }
  716. })
  717. this.ListData.forEach(item=>{
  718. item.product_title = item.title
  719. if(item.status ==2){
  720. arr1.push(item)
  721. }
  722. })
  723. this.axios({
  724. method:'post',
  725. url:'/api/change_area_product_save',
  726. data:{
  727. order_area_product_id:this.$route.query.order_area_product_id,
  728. get_depart_id:this.formData.depart_end,
  729. send_depart_id:this.formData.depart_start,
  730. change_type:this.formData.change_type,
  731. reason:this.formData.msg,
  732. change_list:[...arr1,...arr],
  733. contact_order_no:this.formData.contact_order_no
  734. }
  735. }).then(res=>{
  736. if(res.code == 200){
  737. this.$Message.success(res.msg)
  738. this.goback()
  739. }
  740. })
  741. },
  742. handleFinish(){
  743. if(this.formData.depart_end ==null||
  744. this.formData.depart_start == null||
  745. this.formData.change_type == null||
  746. this.formData.msg == null||
  747. this.formData.contact_order_no == null){
  748. this.$Message.error('请填写完整信息');
  749. }else{
  750. if(this.affirm){
  751. this.$Message.warning('变更请确认!');
  752. }else{
  753. this.show = true;
  754. }
  755. }
  756. },
  757. add_line() {
  758. let arr = {
  759. long: "",
  760. high: "",
  761. wide: "",
  762. change_state: false,
  763. status:1,
  764. copy_state:true,
  765. check_state: true,
  766. explode_status: '',
  767. house: '',
  768. house_id: "",
  769. id: '',
  770. input_state: true,
  771. layer: '',
  772. del:true,
  773. table_id:null,
  774. model: "",
  775. number: '',
  776. order_area_id: '',
  777. order_area_product_id: '',
  778. order_no: "",
  779. position: "",
  780. price: null,
  781. product_id: '',
  782. product_unit: "",
  783. real_price: '',
  784. sign_id: "",
  785. title: "",
  786. type_id: '',
  787. type_title: "",
  788. unit: '',
  789. url: [],
  790. url_number: "",
  791. _index: '',
  792. _rowKey: '',
  793. };
  794. this.tableData.unshift(arr);
  795. },
  796. handleTypeTitleChange(e) {},
  797. changeIpt(e, row) {
  798. let file = e.target.files[0];
  799. this.postImg(file, row);
  800. e.target.value = null;
  801. },
  802. postImg(file, row) {
  803. let formData = new FormData();
  804. formData.append("file", file);
  805. this.axios.post("/api/upload_pic", formData).then((res) => {
  806. row.url.push(res.data.url);
  807. });
  808. },
  809. delItems(n, arr) {
  810. arr.splice(n, 1);
  811. },
  812. looks(arr) {
  813. // const array = [{ img_url: img }];
  814. const array = arr.map((v) => {
  815. return { img_url: v };
  816. });
  817. console.log("array :>> ", array);
  818. this.$previewImg({
  819. list: array,
  820. baseUrl: this.$store.state.ip,
  821. baseImgField: "img_url",
  822. baseTitleField: "",
  823. });
  824. },
  825. handleSet(row, index, type) {
  826. switch (type) {
  827. case 1:
  828. this.affirm = false;
  829. this.tableData.forEach(item=>{
  830. if(item.status === 1){
  831. item.input_state = true
  832. }
  833. })
  834. if (!row.check_state) {
  835. this.copy_data[row.table_id-1].state = '变更';
  836. this.ListData.push(this.copy_data[row.table_id-1]);
  837. this.tableData[index].check_state = true; //已经更改过
  838. row.check_state = true;
  839. this.tableData[index].input_state = false;
  840. row.input_state = false;
  841. this.tableData[index].status = 0;
  842. row.status = 0;
  843. console.log(row);
  844. } else {
  845. row.state = '变更'
  846. this.tableData[index].input_state = false;
  847. row.input_state =false;
  848. this.tableData[index].status = 0;
  849. row.status =0;
  850. }
  851. break;
  852. case 2:
  853. if(this.affirm){
  854. this.$Message.warning('更改请确认!')
  855. }else{
  856. this.tableData.splice(index, 0, row);
  857. this.tableData[index + 1].check_state = false;
  858. this.tableData[index+1].status = 1;
  859. this.tableData[index + 1].input_state = true;
  860. this.tableData[index + 1].change_state = false;
  861. this.tableData[index+1].table_id = null;
  862. //标记是复制的数据
  863. this.tableData[index + 1].copy_state = true;
  864. console.log(row);}
  865. break;
  866. case 3:
  867. if(this.affirm){
  868. this.$Message.warning('更改请确认!')
  869. }else{
  870. this.confirmDelete({
  871. content: "确认删除么?",
  872. then: () => {
  873. let airArr ={
  874. long: "",
  875. high: "",
  876. wide: "",
  877. change_state: false,
  878. status:2,
  879. copy_state:true,
  880. check_state: true,
  881. explode_status: '',
  882. house: '',
  883. house_id: "",
  884. id: '',
  885. input_state: false,
  886. layer: '',
  887. model: "",
  888. table_id:null,
  889. number: '',
  890. order_area_id: '',
  891. order_area_product_id: '',
  892. order_no: "",
  893. position: "",
  894. price: null,
  895. product_id: '',
  896. product_unit: "",
  897. real_price: '',
  898. sign_id: "",
  899. title: "",
  900. type_id: '',
  901. type_title: "",
  902. del:false,
  903. unit: '',
  904. url: [],
  905. url_number: "",
  906. _index: '',
  907. _rowKey: '',
  908. };
  909. this.tableData.splice(index, 1);
  910. if (row.copy_state||row.check_state) {
  911. this.ListData.forEach(_item=>{
  912. if(_item.table_id === row.table_id){
  913. this.tableData.splice(index,0,airArr);
  914. _item.state = '删除';
  915. _item.status = 2;
  916. }
  917. })
  918. } else {
  919. this.tableData.splice(index,0,airArr);
  920. let arr = this.copy_data.slice(row.table_id-1,row.table_id)
  921. arr[0].state = "删除";
  922. arr[0].status =2;
  923. this.ListData = [...this.ListData, ...arr];
  924. console.log(arr);
  925. }
  926. }
  927. });
  928. }
  929. break;
  930. case 4:
  931. if(this.affirm){
  932. this.$Message.warning('更改请确认!')
  933. }else{
  934. this.tableData[index].input_state = true;
  935. row.input_state = true;
  936. this.tableData[index].status = 4;
  937. row.status = 4;
  938. this.affirm = true;
  939. this.tableData.forEach(item=>{
  940. if(item.status===1){
  941. item.input_state = false
  942. }
  943. })
  944. }
  945. break;
  946. }
  947. },
  948. getListData() {},
  949. goback() {
  950. this.$router.go(-1);
  951. },
  952. initData(order_no, order_area_id, order_area_product_id) {
  953. this.axios({
  954. method: "get",
  955. url: "/api/order_area_product_list",
  956. params: {
  957. order_no,
  958. order_area_id,
  959. order_area_product_id,
  960. },
  961. }).then((res) => {
  962. console.log(res);
  963. this.tableData = res.data.detail;
  964. this.formData =res.data;
  965. this.tableData.forEach((item,index) => {
  966. item.long = item.measure.split("*")[0];
  967. item.wide = item.measure.split("*")[1];
  968. item.high = item.measure.split("*")[2];
  969. item.del = true;
  970. item.table_id = index+1;
  971. item.status =5;
  972. item.input_state = false; //是否为input框
  973. item.check_state = false; //是否已经变更过
  974. item.change_state = true; //变更操作是否存在
  975. });
  976. this.copy_data =JSON.parse(JSON.stringify(this.tableData));
  977. });
  978. },
  979. },
  980. };
  981. </script>
  982. <style scoped lang='scss'>
  983. .changeDetail {
  984. overflow: auto;
  985. .form_content {
  986. border-bottom: 1px solid #a2a6b1;
  987. .top_search {
  988. display: flex;
  989. flex-wrap: wrap;
  990. div {
  991. width: 170px;
  992. font-size: 14px;
  993. margin: 10px 41px;
  994. }
  995. }
  996. .form_content_header {
  997. margin-top: 20px;
  998. display: flex;
  999. flex-wrap: wrap;
  1000. }
  1001. }
  1002. .form_middle {
  1003. margin: 20px 0;
  1004. .form_middle_content {
  1005. display: flex;
  1006. flex-wrap: wrap;
  1007. }
  1008. }
  1009. }
  1010. .product-add {
  1011. display: flex;
  1012. flex-direction: column;
  1013. .ipt {
  1014. position: absolute;
  1015. width: 100%;
  1016. height: 100%;
  1017. opacity: 0;
  1018. cursor: pointer;
  1019. outline: none;
  1020. top: 0;
  1021. left: 0;
  1022. }
  1023. .add-items {
  1024. width: 40px;
  1025. height: 40px;
  1026. border: 1px dotted #e7e7e7;
  1027. border-radius: 5px;
  1028. display: flex;
  1029. justify-content: center;
  1030. align-items: center;
  1031. overflow: hidden;
  1032. position: relative;
  1033. flex-direction: column;
  1034. background: #f4f5f7;
  1035. ._item {
  1036. width: 46px;
  1037. height: 46px;
  1038. background: #3764ff;
  1039. opacity: 0.6;
  1040. display: flex;
  1041. justify-content: center;
  1042. align-items: center;
  1043. border-radius: 50%;
  1044. color: #fff;
  1045. }
  1046. }
  1047. .items {
  1048. width: auto;
  1049. height: 40px;
  1050. margin-bottom: 10px;
  1051. overflow: hidden;
  1052. border-radius: 5px;
  1053. position: relative;
  1054. img {
  1055. max-width: 40px;
  1056. max-height: 40px;
  1057. }
  1058. }
  1059. }
  1060. .List_form_content {
  1061. margin: 30px 0;
  1062. }
  1063. .ivu-form-item{
  1064. width: 250px;
  1065. }
  1066. </style>