edit.vue 61 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077
  1. <template>
  2. <div class="BidSystemContractEdit">
  3. <Toptitle
  4. :title="
  5. $route.query.type == 1
  6. ? '新增工装订单'
  7. : $route.query.type == 2
  8. ? '编辑工装订单'
  9. : '查看工装订单'
  10. "
  11. >
  12. <slot name="titleButton">
  13. <Button
  14. type="primary"
  15. style="margin-right: 10px"
  16. :disabled="isChecked"
  17. @click="showAddInputModal = true"
  18. >
  19. 添加特殊字段
  20. </Button>
  21. <Button
  22. @click="showSupModal = true"
  23. type="primary"
  24. style="margin-right: 10px"
  25. >项目辅料</Button
  26. >
  27. <Button
  28. @click="goback()"
  29. type="primary"
  30. ghost
  31. style="margin-right: 10px"
  32. >返回</Button
  33. >
  34. <Button
  35. @click="postData()"
  36. type="primary"
  37. :disabled="isChecked"
  38. ghost
  39. style="margin-right: 10px"
  40. >保存</Button
  41. >
  42. </slot>
  43. </Toptitle>
  44. <div class="top_search">
  45. <Form :model="formData" :label-width="100" class="top_search_form">
  46. <FormItem label="订单号:">
  47. <Input
  48. type="text"
  49. size="small"
  50. disabled
  51. v-model="formData.order_no"
  52. placeholder="自动生成"
  53. style="width: 200px"
  54. />
  55. </FormItem>
  56. <FormItem label="项目名称:">
  57. <Input
  58. type="text"
  59. :disabled="isChecked"
  60. size="small"
  61. v-model="formData.residential_name"
  62. placeholder="请输入项目名称"
  63. style="width: 200px"
  64. />
  65. </FormItem>
  66. <FormItem label="客户名称:">
  67. <Select
  68. clearable
  69. filterable
  70. size="small"
  71. :disabled="isChecked"
  72. class="auto-width"
  73. @on-change="handleClientChange"
  74. v-model="formData.custom_id"
  75. >
  76. <Option
  77. v-for="item in clientList"
  78. :label="item.title"
  79. :key="item.id"
  80. :value="item.id"
  81. ></Option>
  82. </Select>
  83. </FormItem>
  84. <FormItem label="紧急程度:">
  85. <Select
  86. v-model="formData.warning_state"
  87. :disabled="isChecked"
  88. size="small"
  89. style="width: 200px"
  90. >
  91. <Option
  92. v-for="_item in warningList"
  93. :key="_item.id"
  94. :value="_item.id"
  95. :label="_item.title"
  96. ></Option>
  97. </Select>
  98. </FormItem>
  99. <FormItem label="项目定金:">
  100. <Input
  101. type="text"
  102. size="small"
  103. :disabled="isChecked"
  104. v-model="formData.front_money"
  105. placeholder="请输入项目定金"
  106. style="width: 200px"
  107. />
  108. <!-- <RadioGroup v-model="formData.pay_state"
  109. size="small">
  110. <Radio :label=0
  111. :disabled="isChecked">未收款</Radio>
  112. <Radio :label=1
  113. :disabled="isChecked">已收款</Radio>
  114. </RadioGroup> -->
  115. </FormItem>
  116. <FormItem label="详细地址:">
  117. <Select
  118. clearable
  119. filterable
  120. size="small"
  121. :disabled="isChecked"
  122. class="auto-width"
  123. @on-change="handleClientDetailChange"
  124. v-model="formData.custom_detail_id"
  125. >
  126. <Option
  127. v-for="item in clientDetailList"
  128. :label="item.address"
  129. :key="item.id"
  130. :value="item.id"
  131. ></Option>
  132. </Select>
  133. </FormItem>
  134. <FormItem label="手机号:">
  135. <Select
  136. clearable
  137. filterable
  138. size="small"
  139. :disabled="isChecked"
  140. class="auto-width"
  141. @on-change="handleClientDetailChange"
  142. v-model="formData.custom_detail_id"
  143. >
  144. <Option
  145. v-for="item in clientDetailList"
  146. :label="item.mobile"
  147. :key="item.id"
  148. :value="item.id"
  149. ></Option>
  150. </Select>
  151. </FormItem>
  152. <FormItem label="开始日期:">
  153. <DatePicker
  154. type="date"
  155. size="small"
  156. :disabled="isChecked"
  157. :options="options"
  158. @on-change="handleStartTimeChange"
  159. v-model="formData.start_time"
  160. placeholder=" 年/月/日"
  161. style="width: 200px"
  162. ></DatePicker>
  163. </FormItem>
  164. <FormItem label="结束日期:">
  165. <DatePicker
  166. type="date"
  167. size="small"
  168. :disabled="isChecked"
  169. :options="options"
  170. @on-change="handleEndTimeChange"
  171. v-model="formData.end_time"
  172. placeholder=" 年/月/日"
  173. style="width: 200px"
  174. ></DatePicker>
  175. </FormItem>
  176. <FormItem label="业务员:">
  177. <Select
  178. v-model="formData.salesman"
  179. filterable
  180. :disabled="isChecked"
  181. clearable
  182. style="width: 200px"
  183. size="small"
  184. >
  185. <Option
  186. v-for="item in salesmanList"
  187. :value="item.id"
  188. :key="item.id"
  189. >{{ item.nickname }}</Option
  190. >
  191. </Select>
  192. </FormItem>
  193. <!-- <FormItem label="订单类型:">
  194. <Select v-model="formData.type"
  195. :disabled="isChecked"
  196. size="small"
  197. style="width:200px">
  198. <Option label='工装'
  199. :value=1></Option>
  200. <Option label='家装'
  201. :value=2></Option>
  202. </Select>
  203. </FormItem> -->
  204. <FormItem
  205. v-for="item in formData.special"
  206. :key="item.id"
  207. :label="item.key + ':'"
  208. >
  209. <Input
  210. type="text"
  211. size="small"
  212. :disabled="isChecked"
  213. v-model="item.value"
  214. placeholder="请输入"
  215. style="width: 200px"
  216. />
  217. </FormItem>
  218. <FormItem label="备注:">
  219. <Input
  220. type="textarea"
  221. :disabled="isChecked"
  222. size="small"
  223. v-model="formData.remark"
  224. placeholder=""
  225. style="width: 200px"
  226. />
  227. </FormItem>
  228. </Form>
  229. </div>
  230. <div
  231. class="addArea"
  232. v-for="(areaItem, areaIndex) in formData.list"
  233. :key="areaItem.areaIndex"
  234. >
  235. <div class="addAreaBtn">
  236. <Button
  237. @click="handleAreaAdd(formData.list, areaIndex)"
  238. :disabled="isChecked"
  239. type="primary"
  240. style="margin-right: 10px"
  241. >新增区域</Button
  242. >
  243. <Button
  244. @click="handleAreaDele(areaIndex)"
  245. type="error"
  246. v-show="areaIndex != 0"
  247. :disabled="isChecked"
  248. style="margin-right: 10px"
  249. >删除区域</Button
  250. >
  251. <Button
  252. @click="handleAreaAddPDT(areaItem, areaIndex)"
  253. :disabled="isChecked"
  254. type="primary"
  255. >新增产品</Button
  256. >
  257. </div>
  258. <div class="addAreaForm">
  259. <Form :label-width="100" :model="areaItem" style="width: 60%">
  260. <FormItem label="区域编码:">
  261. <Input
  262. type="text"
  263. size="small"
  264. :disabled="isChecked"
  265. v-model="areaItem.num"
  266. placeholder="请输入区域编码"
  267. style="width: 120px"
  268. />
  269. </FormItem>
  270. <FormItem label="区域名称:">
  271. <Input
  272. type="text"
  273. size="small"
  274. :disabled="isChecked"
  275. v-model="areaItem.title"
  276. placeholder="请输入区域名称"
  277. style="width: 120px"
  278. />
  279. </FormItem>
  280. <FormItem label="单位:">
  281. <Input
  282. type="text"
  283. size="small"
  284. :disabled="isChecked"
  285. v-model="areaItem.unit"
  286. placeholder="请输入单位"
  287. style="width: 120px"
  288. />
  289. </FormItem>
  290. <FormItem label="工程量:">
  291. <Input
  292. type="text"
  293. size="small"
  294. v-model="areaItem.quantity"
  295. :disabled="isChecked"
  296. placeholder="请输入工程量"
  297. style="width: 120px"
  298. />
  299. </FormItem>
  300. <FormItem label="户型:">
  301. <Input
  302. type="text"
  303. size="small"
  304. :disabled="isChecked"
  305. v-model="areaItem.house_type"
  306. placeholder="请输入户型"
  307. style="width: 120px"
  308. />
  309. </FormItem>
  310. <FormItem
  311. v-for="item in areaItem.special"
  312. :key="item.id"
  313. :label="item.key + ':'"
  314. >
  315. <Input
  316. type="text"
  317. size="small"
  318. :disabled="isChecked"
  319. v-model="item.value"
  320. placeholder="请输入"
  321. style="width: 120px"
  322. />
  323. </FormItem>
  324. <FormItem label="备注:">
  325. <Input
  326. type="text"
  327. :disabled="isChecked"
  328. size="small"
  329. v-model="areaItem.remark"
  330. placeholder="请输入备注"
  331. style="width: 120px"
  332. />
  333. </FormItem>
  334. </Form>
  335. </div>
  336. <div class="addAreaTable">
  337. <Table
  338. :columns="tableColumns"
  339. :data="areaItem.product"
  340. max-height="600"
  341. border
  342. >
  343. <template slot="Set" slot-scope="{ row, index }">
  344. <a
  345. style="margin: 0 5px"
  346. v-show="$route.query.type != 3"
  347. @click="handleSet(row, index, 3, areaItem.product, areaIndex)"
  348. >编辑</a
  349. >
  350. <a
  351. style="margin: 0 5px; color: red"
  352. v-show="$route.query.type != 3"
  353. @click="handleSet(row, index, 4, areaItem.product)"
  354. >删除</a
  355. >
  356. </template>
  357. </Table>
  358. </div>
  359. </div>
  360. <li v-show="false" v-for="item in formData.list" :key="item.id"></li>
  361. <!-- 项目辅料弹窗 -->
  362. <Modal title="项目辅料" v-model="showSupModal" :width="400">
  363. <div>
  364. <div class="supModalBtn">
  365. <Button @click="handleAddSup" type="primary">新增</Button>
  366. </div>
  367. <Table :columns="supTableColumns" :data="supTableData" border>
  368. <template slot="combine" slot-scope="{ index }">
  369. <Select
  370. v-model="supTableData[index].id"
  371. @on-change="handlechange"
  372. size="small"
  373. >
  374. <Option
  375. v-for="item in combineList"
  376. :value="item.id"
  377. :key="item.id"
  378. :label="item.title"
  379. ></Option>
  380. </Select>
  381. </template>
  382. <template slot="supSet" slot-scope="{ row, index }">
  383. <a
  384. style="margin: 0 5px; color: red"
  385. v-show="$route.query.type != 3"
  386. @click="handleSupSet(row, index)"
  387. >删除</a
  388. >
  389. </template>
  390. </Table>
  391. </div>
  392. <div class="modal-footer" slot="footer">
  393. <Button @click="showSupModal = false">取消</Button>
  394. <Button type="primary" @click="showSupModal = false">确认</Button>
  395. </div>
  396. </Modal>
  397. <!-- 新增产品弹窗 -->
  398. <Modal
  399. title="新增产品"
  400. v-model="showPDTModal"
  401. :mask-closable="false"
  402. class="addPDTFormModal"
  403. :width="1000"
  404. >
  405. <div
  406. class="addPDTForm"
  407. v-for="(tempItem, tempIndex) in tempPDTList"
  408. :key="tempItem.id"
  409. >
  410. <Form :label-width="100" :model="tempItem">
  411. <FormItem label="产品名称:">
  412. <Input
  413. type="text"
  414. size="small"
  415. placeholder="请输入"
  416. v-model="tempItem.title"
  417. style="width: 120px"
  418. />
  419. </FormItem>
  420. <FormItem label="数量">
  421. <Input
  422. type="text"
  423. size="small"
  424. v-model="tempItem.num"
  425. placeholder="请输入"
  426. style="width: 120px"
  427. />
  428. </FormItem>
  429. <FormItem label="图号:">
  430. <Input
  431. type="text"
  432. size="small"
  433. placeholder="请输入"
  434. v-model="tempItem.url_number"
  435. style="width: 120px"
  436. />
  437. </FormItem>
  438. <FormItem label="图纸">
  439. <div class="product-img">
  440. <div class="product-add">
  441. <div
  442. class="items"
  443. v-for="(_item, _index) of tempItem.url"
  444. :key="_index"
  445. >
  446. <img
  447. @click="looks(_item)"
  448. :src="$store.state.ip + _item"
  449. alt=""
  450. />
  451. <Icon
  452. size="20"
  453. @click="delItems(_index, tempItem.url)"
  454. class="delete-img"
  455. type="ios-close-circle"
  456. />
  457. </div>
  458. <div class="add-items">
  459. <div class="_item">
  460. <Icon size="50" type="ios-add" />
  461. </div>
  462. <input
  463. @change="changeIpt($event, tempItem.url)"
  464. type="file"
  465. class="ipt"
  466. />
  467. </div>
  468. </div>
  469. </div>
  470. </FormItem>
  471. <FormItem label="产品分类">
  472. <Select
  473. v-model="tempItem.type_id"
  474. placeholder="请选择"
  475. style="width: 120px"
  476. @on-change="(e) => hanndleAddPDTTypeChange(tempItem, e)"
  477. size="small"
  478. >
  479. <Option
  480. v-for="item in PDTTypeList"
  481. :value="item.value"
  482. :key="item.value"
  483. >{{ item.label }}</Option
  484. >
  485. </Select>
  486. </FormItem>
  487. <div
  488. style="display: contents"
  489. v-for="el in tempItem.tempPDTTypeList"
  490. :key="el"
  491. >
  492. <FormItem
  493. :label="_item.title"
  494. v-for="_item in tempItem.tempMeasureList"
  495. v-show="el == _item.id"
  496. :key="_item.id"
  497. >
  498. <Input
  499. type="text"
  500. size="small"
  501. v-model="tempItem[_item.e_title]"
  502. placeholder="请输入"
  503. style="width: 120px"
  504. />
  505. </FormItem>
  506. </div>
  507. <FormItem label="价格:">
  508. <Input
  509. type="text"
  510. size="small"
  511. v-model="tempItem.price"
  512. placeholder="请输入备注"
  513. style="width: 120px"
  514. />
  515. </FormItem>
  516. <FormItem
  517. :label="item.key + ':'"
  518. v-for="item in productSpecValueList"
  519. :key="item.id"
  520. >
  521. <Input
  522. type="text"
  523. size="small"
  524. v-model="tempItem[item.key]"
  525. placeholder="请输入"
  526. style="width: 120px"
  527. />
  528. </FormItem>
  529. <FormItem label="备注:">
  530. <Input
  531. type="text"
  532. size="small"
  533. v-model="tempItem.remark"
  534. placeholder="请输入备注"
  535. style="width: 120px"
  536. />
  537. </FormItem>
  538. <FormItem label="工艺属性">
  539. <Button
  540. @click="handleProcessAdd(tempItem, tempIndex)"
  541. size="small"
  542. type="text"
  543. style="color: #57a3f3"
  544. >添加属性</Button
  545. >
  546. </FormItem>
  547. </Form>
  548. <div class="addPDTProcess">
  549. <div
  550. v-for="(_item, _index) in tempItem.addPDTProcessAttrList"
  551. :key="_item.id"
  552. >
  553. <span>属性{{ _index + 1 }}</span>
  554. <Select
  555. :value="_item.id"
  556. size="small"
  557. @on-change="
  558. (value) => handleAddPDTAttrChange(_item, _index, value)
  559. "
  560. style="width: 80px"
  561. >
  562. <Option
  563. v-for="__item in PDTProcessAttrList"
  564. :key="__item.id"
  565. :value="__item.id"
  566. :label="__item.title"
  567. >
  568. </Option>
  569. </Select>
  570. <Select
  571. :value="_item.process_detail"
  572. filterable
  573. clearable
  574. label-in-value
  575. @on-change="
  576. (value) => handleAddPDTAttrDetailChange(_item, _index, value)
  577. "
  578. size="small"
  579. style="width: 80px"
  580. >
  581. <Option
  582. v-for="__item in _item.PDTProcessAttrDetailList"
  583. :key="__item.id"
  584. :value="__item.id"
  585. :label="__item.title"
  586. />
  587. </Select>
  588. <div class="dele_icon">
  589. <!-- v-show="tempItem.addPDTProcessAttrList.length!=1" -->
  590. <Icon
  591. type="ios-trash"
  592. @click="
  593. handleAddPDTDetailDele(tempItem.addPDTProcessAttrList, _index)
  594. "
  595. />
  596. </div>
  597. </div>
  598. </div>
  599. <div class="addPDTBtn">
  600. <Button
  601. type="primary"
  602. style="margin-right: 10px"
  603. @click="handleAddPDTCopy(tempItem, tempIndex)"
  604. >复制</Button
  605. >
  606. <Button
  607. type="primary"
  608. style="margin-right: 10px"
  609. @click="handleAddPDTAdd(tempIndex)"
  610. >添加</Button
  611. >
  612. <Button
  613. type="error"
  614. v-show="tempIndex != 0"
  615. style="margin-right: 10px"
  616. @click="handleAddPDTDele(tempIndex)"
  617. >删除</Button
  618. >
  619. </div>
  620. </div>
  621. <div class="modal-footer" slot="footer">
  622. <Button @click="showPDTModal = false">取消</Button>
  623. <Button type="primary" @click="handleAddPDTConfirm">确认</Button>
  624. </div>
  625. </Modal>
  626. <!-- 编辑产品弹窗 -->
  627. <Modal
  628. title="编辑产品"
  629. v-model="showPDTEditModal"
  630. :mask-closable="false"
  631. class="addPDTFormModal"
  632. :width="1000"
  633. >
  634. <div class="addPDTForm">
  635. <Form :label-width="100" :model="PDTEdit">
  636. <FormItem label="产品名称:">
  637. <Input
  638. type="text"
  639. size="small"
  640. placeholder="请输入"
  641. v-model="PDTEdit.title"
  642. style="width: 120px"
  643. />
  644. </FormItem>
  645. <FormItem label="数量">
  646. <Input
  647. type="text"
  648. size="small"
  649. v-model="PDTEdit.num"
  650. placeholder="请输入"
  651. style="width: 120px"
  652. />
  653. </FormItem>
  654. <FormItem label="图号:">
  655. <Input
  656. type="text"
  657. size="small"
  658. placeholder="请输入"
  659. v-model="PDTEdit.url_number"
  660. style="width: 120px"
  661. />
  662. </FormItem>
  663. <FormItem label="图纸">
  664. <div class="product-img">
  665. <div class="product-add">
  666. <div
  667. class="items"
  668. v-for="(_item, _index) of PDTEdit.url"
  669. :key="_index"
  670. >
  671. <img
  672. @click="looks(_item)"
  673. :src="$store.state.ip + _item"
  674. alt=""
  675. />
  676. <Icon
  677. size="20"
  678. @click="delItems(_index, PDTEdit.url)"
  679. class="delete-img"
  680. type="ios-close-circle"
  681. />
  682. </div>
  683. <div class="add-items">
  684. <div class="_item">
  685. <Icon size="50" type="ios-add" />
  686. </div>
  687. <input
  688. @change="changeIpt($event, PDTEdit.url)"
  689. type="file"
  690. class="ipt"
  691. />
  692. </div>
  693. </div>
  694. </div>
  695. </FormItem>
  696. <FormItem label="产品分类">
  697. <Select
  698. v-model="PDTEdit.type_id"
  699. placeholder="请选择"
  700. style="width: 120px"
  701. @on-change="(e) => hanndleAddPDTTypeChange(PDTEdit, e)"
  702. size="small"
  703. >
  704. <Option
  705. v-for="item in PDTEditTypeList"
  706. :value="item.value"
  707. :key="item.value"
  708. >{{ item.label }}</Option
  709. >
  710. </Select>
  711. </FormItem>
  712. <div style="display: contents">
  713. <!-- <FormItem :label="_item.title"
  714. v-for="(_item) in PDTEdit.measures"
  715. :key="_item.id">
  716. <Input type="text"
  717. size="small"
  718. v-model="PDTEdit[_item.e_title]"
  719. placeholder="请输入"
  720. style="width: 120px" />
  721. </FormItem> -->
  722. </div>
  723. <div style="display: contents">
  724. <FormItem
  725. :label="_item.title"
  726. v-for="_item in PDTEdit.tempMeasureList"
  727. :key="_item.id"
  728. >
  729. <Input
  730. type="text"
  731. size="small"
  732. v-model="PDTEdit[_item.e_title]"
  733. placeholder="请输入"
  734. style="width: 120px"
  735. />
  736. </FormItem>
  737. </div>
  738. <FormItem label="价格:">
  739. <Input
  740. type="text"
  741. size="small"
  742. v-model="PDTEdit.price"
  743. placeholder="请输入备注"
  744. style="width: 120px"
  745. />
  746. </FormItem>
  747. <FormItem
  748. :label="item.key + ':'"
  749. v-for="item in productSpecValueList"
  750. :key="item.id"
  751. >
  752. <Input
  753. type="text"
  754. size="small"
  755. v-model="PDTEdit[item.key]"
  756. placeholder="请输入"
  757. style="width: 120px"
  758. />
  759. </FormItem>
  760. <FormItem label="备注:">
  761. <Input
  762. type="text"
  763. size="small"
  764. v-model="PDTEdit.remark"
  765. placeholder="请输入备注"
  766. style="width: 120px"
  767. />
  768. </FormItem>
  769. <FormItem label="工艺属性">
  770. <Button
  771. @click="handleEditProcessAdd()"
  772. size="small"
  773. type="text"
  774. style="color: #57a3f3"
  775. >添加属性</Button
  776. >
  777. </FormItem>
  778. </Form>
  779. <div class="addPDTProcess">
  780. <div
  781. v-for="(_item, _index) in PDTEdit.addPDTProcessAttrList"
  782. :key="_item.id"
  783. >
  784. <span>属性{{ _index + 1 }}</span>
  785. <Select
  786. :value="_item.id"
  787. size="small"
  788. @on-change="
  789. (value) => handleAddPDTAttrChange(_item, _index, value)
  790. "
  791. style="width: 80px"
  792. >
  793. <Option
  794. v-for="__item in PDTProcessAttrList"
  795. :key="__item.id"
  796. :value="__item.id"
  797. :label="__item.title"
  798. >
  799. </Option>
  800. </Select>
  801. <Select
  802. :value="_item.process_detail"
  803. filterable
  804. clearable
  805. label-in-value
  806. @on-change="
  807. (value) => handleAddPDTAttrDetailChange(_item, _index, value)
  808. "
  809. size="small"
  810. style="width: 80px"
  811. >
  812. <Option
  813. v-for="__item in _item.PDTProcessAttrDetailList"
  814. :key="__item.id"
  815. :value="__item.id"
  816. :label="__item.title"
  817. />
  818. </Select>
  819. <div class="dele_icon">
  820. <!-- v-show="PDTEdit.addPDTProcessAttrList.length!=1" -->
  821. <Icon
  822. type="ios-trash"
  823. @click="
  824. handleAddPDTDetailDele(PDTEdit.addPDTProcessAttrList, _index)
  825. "
  826. />
  827. </div>
  828. </div>
  829. </div>
  830. </div>
  831. <div class="modal-footer" slot="footer">
  832. <Button @click="showPDTEditModal = false">取消</Button>
  833. <Button type="primary" @click="handlePDTEditConfirm">确认</Button>
  834. </div>
  835. </Modal>
  836. <!-- 特殊字段弹窗 -->
  837. <Modal
  838. title="特殊字段"
  839. v-model="showAddInputModal"
  840. :mask-closable="false"
  841. class="addInputClassModal"
  842. :width="600"
  843. >
  844. <div class="addInputClass">
  845. <Tabs value="name1">
  846. <TabPane label="订单特殊字段" name="name1">
  847. <div style="display: flex; justify-content: center">
  848. <span
  849. class="dele_icon"
  850. @click="handleSpecValueAdd('', 1)"
  851. style="text-align: center; width: 50px"
  852. >添加
  853. </span>
  854. </div>
  855. <div class="addInputClassTab">
  856. <div v-for="(item, index) in contactSpecValueList" :key="index">
  857. <span>特殊字段名:</span>
  858. <Input
  859. type="text"
  860. size="small"
  861. v-model="item.key"
  862. placeholder="请输入"
  863. style="width: 120px"
  864. />
  865. <span class="dele_icon" style="margin-right: 5px">
  866. <Icon type="md-add" @click="handleSpecValueAdd(item, 1)" />
  867. </span>
  868. <span class="dele_icon">
  869. <Icon
  870. type="md-remove"
  871. @click="handleSpecValueDele(index, 1)"
  872. />
  873. </span>
  874. </div>
  875. </div>
  876. </TabPane>
  877. <TabPane label="区域特殊字段" name="name2">
  878. <div style="display: flex; justify-content: center">
  879. <span
  880. class="dele_icon"
  881. @click="handleSpecValueAdd('', 2)"
  882. style="text-align: center; width: 50px"
  883. >添加
  884. </span>
  885. </div>
  886. <div class="addInputClassTab">
  887. <div v-for="(item, index) in areaSpecValueList" :key="index">
  888. <span>特殊字段名:</span>
  889. <Input
  890. type="text"
  891. size="small"
  892. v-model="item.key"
  893. placeholder="请输入"
  894. style="width: 120px"
  895. />
  896. <span class="dele_icon" style="margin-right: 5px">
  897. <Icon type="md-add" @click="handleSpecValueAdd(item, 2)" />
  898. </span>
  899. <span class="dele_icon">
  900. <Icon
  901. type="md-remove"
  902. @click="handleSpecValueDele(index, 2)"
  903. />
  904. </span>
  905. </div>
  906. </div>
  907. </TabPane>
  908. <TabPane label="产品特殊字段" name="name3">
  909. <div style="display: flex; justify-content: center">
  910. <span
  911. class="dele_icon"
  912. @click="handleSpecValueAdd('', 3)"
  913. style="text-align: center; width: 50px"
  914. >添加
  915. </span>
  916. </div>
  917. <div class="addInputClassTab">
  918. <div v-for="(item, index) in productSpecValueList" :key="index">
  919. <span>特殊字段名:</span>
  920. <Input
  921. type="text"
  922. size="small"
  923. v-model="item.key"
  924. placeholder="请输入"
  925. style="width: 120px"
  926. />
  927. <span class="dele_icon" style="margin-right: 5px">
  928. <Icon type="md-add" @click="handleSpecValueAdd(item, 3)" />
  929. </span>
  930. <span class="dele_icon">
  931. <Icon
  932. type="md-remove"
  933. @click="handleSpecValueDele(index, 3)"
  934. />
  935. </span>
  936. </div>
  937. </div>
  938. </TabPane>
  939. </Tabs>
  940. <!-- <Form :label-width="100">
  941. <FormItem label="请输入字段名:">
  942. <Input type="text"
  943. size="small"
  944. v-model="addInputName"
  945. placeholder="请输入"
  946. style="width: 200px" />
  947. </FormItem>
  948. </Form> -->
  949. </div>
  950. <div class="modal-footer" slot="footer">
  951. <Button @click="showAddInputModal = false">取消</Button>
  952. <Button type="primary" @click="handleAddInputConfirm">确认</Button>
  953. </div>
  954. </Modal>
  955. </div>
  956. </template>
  957. <script>
  958. // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  959. // 例如:import 《组件名称》 from '《组件路径》';
  960. export default {
  961. name: "BidSystemContractEdit",
  962. components: {},
  963. props: {},
  964. // import引入的组件需要注入到对象中才能使用
  965. data() {
  966. // 这里存放数据
  967. return {
  968. showSupModal: false,
  969. showPDTModal: false,
  970. showPDTEditModal: false,
  971. options: {
  972. disabledDate(date) {
  973. return date && date.valueOf() < Date.now() - 86400000;
  974. },
  975. },
  976. formData: {
  977. order_no: "",
  978. residential_name: "",
  979. client_name: "",
  980. address: "",
  981. mobile: "",
  982. pay_state: "",
  983. warning_state: "",
  984. salesman: "",
  985. remark: "",
  986. start_time: "",
  987. end_time: "",
  988. type: "",
  989. special: [],
  990. head: [],
  991. //区域列表
  992. list: [
  993. {
  994. areaIndex: null,
  995. num: "",
  996. title: "",
  997. unit: "",
  998. quantity: "",
  999. house_type: "",
  1000. remark: "",
  1001. order_no: "",
  1002. product: [],
  1003. },
  1004. ],
  1005. },
  1006. tableColumns: [
  1007. { title: "序号", key: "index", align: "center", minWidth: 80 },
  1008. {
  1009. title: "产品名称",
  1010. key: "title",
  1011. align: "center",
  1012. tooltip: true,
  1013. minWidth: 100,
  1014. },
  1015. { title: "数量", key: "num", align: "center", minWidth: 80 },
  1016. { title: "价格", key: "price", align: "center", minWidth: 80 },
  1017. {
  1018. title: "规格",
  1019. key: "measure",
  1020. align: "center",
  1021. tooltip: true,
  1022. minWidth: 140,
  1023. },
  1024. {
  1025. title: "工艺属性",
  1026. key: "process_property",
  1027. align: "center",
  1028. tooltip: true,
  1029. minWidth: 120,
  1030. },
  1031. {
  1032. title: "图纸",
  1033. align: "center",
  1034. key: "url",
  1035. minWidth: 100,
  1036. render: (h, params) => {
  1037. const { row } = params;
  1038. let url = row.url ? row.url : [];
  1039. return h("img", {
  1040. attrs: {
  1041. src: this.$store.state.ip + url[0],
  1042. style:
  1043. "max-width:50px;max-height:50px;position:relative;top:3px;",
  1044. },
  1045. on: {
  1046. click: (e) => {
  1047. // this.axios('/api/orders_img', { params: { id: row.id, type: 1 } }).then(res => {
  1048. // row.imgs = res.data
  1049. let list = [];
  1050. row.url.forEach((el) => {
  1051. list.push({ img_url: el });
  1052. });
  1053. this.$previewImg({
  1054. list,
  1055. baseUrl: this.$store.state.ip,
  1056. baseImgField: "img_url",
  1057. baseTitleField: "",
  1058. });
  1059. // })
  1060. },
  1061. },
  1062. });
  1063. },
  1064. },
  1065. {
  1066. title: "图号",
  1067. key: "url_number",
  1068. align: "center",
  1069. tooltip: true,
  1070. minWidth: 80,
  1071. },
  1072. { title: "备注", key: "remark", align: "center", minWidth: 80 },
  1073. {
  1074. title: "操作",
  1075. key: "remark",
  1076. align: "center",
  1077. slot: "Set",
  1078. minWidth: 120,
  1079. },
  1080. ],
  1081. supTableColumns: [
  1082. { title: "序号", type: "index", align: "center" },
  1083. {
  1084. title: "辅料名称",
  1085. key: "title",
  1086. align: "center",
  1087. slot: "combine",
  1088. minWidth: 60,
  1089. },
  1090. { title: "操作", key: "set", align: "center", slot: "supSet" },
  1091. ],
  1092. supTableData: [], //产品分类列表
  1093. PDTTypeList: [], //项目辅料→辅料名称列表
  1094. PDTEditTypeList: [], //项目辅料→辅料名称列表
  1095. combineList: [], //业务员列表
  1096. salesmanList: [],
  1097. tempPDTIndex: "", // 新增产品暂存
  1098. tempPDTList: [
  1099. {
  1100. url: [],
  1101. process_property: "",
  1102. process_properties: [],
  1103. tempPDTTypeList: [],
  1104. measure: "",
  1105. //新增产品工艺属性列表
  1106. addPDTProcessAttrList: [
  1107. {
  1108. showValue: "",
  1109. showId: "",
  1110. PDTProcessAttrDetailList: [],
  1111. },
  1112. ],
  1113. },
  1114. ],
  1115. PDTEdit: {
  1116. url: [],
  1117. process_property: "",
  1118. process_properties: [],
  1119. tempPDTTypeList: [],
  1120. measure: "",
  1121. //新增产品工艺属性列表
  1122. addPDTProcessAttrList: [
  1123. {
  1124. showValue: "",
  1125. showId: "",
  1126. PDTProcessAttrDetailList: [],
  1127. },
  1128. ],
  1129. },
  1130. //是否查看
  1131. isChecked: false,
  1132. PDTProcessAttrList: [],
  1133. // 测量字段列表
  1134. measureList: [],
  1135. contactForm: [],
  1136. addInputTitle: "",
  1137. showAddInputModal: false,
  1138. addInputName: "",
  1139. contactSpecValueList: [],
  1140. areaSpecValueList: [],
  1141. productSpecValueList: [],
  1142. warningList: [],
  1143. clientList: [],
  1144. clientDetailList: [],
  1145. };
  1146. },
  1147. // 生命周期 - 创建完成(可以访问当前this实例)
  1148. created() {
  1149. //2编辑 3详情 0新增
  1150. this.$route.query.type == 3 ? (this.isChecked = true) : "";
  1151. this.$route.query.order_no
  1152. ? (this.formData.order_no = this.$route.query.order_no)
  1153. : "";
  1154. // 获取工艺属性
  1155. this.axios("/api/basics_properties_index").then((res) => {
  1156. this.PDTProcessAttrList = res.data.data;
  1157. });
  1158. // 获取紧急程度
  1159. this.axios.get("/api/warning_list").then((res) => {
  1160. this.warningList = res.data.data;
  1161. });
  1162. // 获取客户列表
  1163. this.axios.get("/api/custom_list").then((res) => {
  1164. this.clientList = res.data.data;
  1165. });
  1166. },
  1167. // 生命周期 - 挂载完成(可以访问DOM元素)
  1168. mounted() {
  1169. this.$route.query.type == 3 || this.$route.query.type == 2
  1170. ? this.initData(this.$route.query.order_no)
  1171. : "";
  1172. //获取操作员
  1173. this.axios("/api/user").then((res) => (this.salesmanList = res.data.data));
  1174. //获取产品分类下拉列表
  1175. this.axios("/api/parts_product_list").then((res) => {
  1176. this.PDTTypeList = res.data;
  1177. this.PDTTypeList.forEach((el) => {
  1178. el.value = el.id;
  1179. el.label = el.title;
  1180. });
  1181. this.PDTEditTypeList = this.PDTTypeList;
  1182. });
  1183. //获取基础测量字段列表
  1184. this.axios("/api/basics_measure_index").then((res) => {
  1185. this.measureList = res.data.data;
  1186. });
  1187. // 获取项目辅料列表
  1188. this.axios("/api/material_combination").then((res) => {
  1189. this.combineList = res.data.data;
  1190. });
  1191. },
  1192. methods: {
  1193. handlechange(val) {
  1194. console.log("val :>> ", val);
  1195. },
  1196. handleStartTimeChange(value) {
  1197. this.formData.start_time = value;
  1198. },
  1199. handleEndTimeChange(value) {
  1200. this.formData.end_time = value;
  1201. },
  1202. initData(order_no) {
  1203. this.axios({
  1204. method: "get",
  1205. url: "/api/order_area_list",
  1206. params: {
  1207. order_no,
  1208. },
  1209. })
  1210. .then((res) => {
  1211. this.formData = res.data;
  1212. if (this.formData.list.length == 0) {
  1213. this.formData.list.push({
  1214. areaIndex: 1,
  1215. num: "",
  1216. title: "",
  1217. unit: "",
  1218. quantity: "",
  1219. house_type: "",
  1220. remark: "",
  1221. order_no: "",
  1222. special: [],
  1223. head: [],
  1224. product: [
  1225. {
  1226. title: "",
  1227. num: "",
  1228. measure: "",
  1229. process_property: "",
  1230. special: [],
  1231. url: [],
  1232. url_number: "",
  1233. remark: "",
  1234. },
  1235. ],
  1236. });
  1237. }
  1238. this.formData.start_time = this.func.replaceDateNoHMS(
  1239. this.formData.start_time
  1240. );
  1241. this.formData.end_time = this.func.replaceDateNoHMS(
  1242. this.formData.end_time
  1243. );
  1244. this.formData.list.forEach((element) => {});
  1245. // 产品特殊字段→ 弹窗窗口,table表头
  1246. let arr = [];
  1247. res.data.head[3] &&
  1248. res.data.head[3].forEach((item) => {
  1249. // ele[key] = item.key
  1250. arr.push({
  1251. title: item.key,
  1252. key: item.key,
  1253. align: "center",
  1254. minWidth: 80,
  1255. });
  1256. });
  1257. this.tableColumns = [
  1258. { title: "序号", key: "index", align: "center", minWidth: 80 },
  1259. {
  1260. title: "产品名称",
  1261. key: "title",
  1262. align: "center",
  1263. tooltip: true,
  1264. minWidth: 100,
  1265. },
  1266. { title: "数量", key: "num", align: "center", minWidth: 80 },
  1267. { title: "价格", key: "price", align: "center", minWidth: 80 },
  1268. {
  1269. title: "规格",
  1270. key: "measure",
  1271. align: "center",
  1272. tooltip: true,
  1273. minWidth: 140,
  1274. },
  1275. {
  1276. title: "工艺属性",
  1277. key: "process_property",
  1278. align: "center",
  1279. tooltip: true,
  1280. minWidth: 120,
  1281. },
  1282. {
  1283. title: "图纸",
  1284. align: "center",
  1285. key: "url",
  1286. minWidth: 100,
  1287. render: (h, params) => {
  1288. const { row } = params;
  1289. let url = row.url ? row.url : [];
  1290. return h("img", {
  1291. attrs: {
  1292. src: this.$store.state.ip + url[0],
  1293. style:
  1294. "max-width:50px;max-height:50px;position:relative;top:3px;",
  1295. },
  1296. on: {
  1297. click: (e) => {
  1298. // this.axios('/api/orders_img', { params: { id: row.id, type: 1 } }).then(res => {
  1299. // row.imgs = res.data
  1300. let list = [];
  1301. row.url.forEach((el) => {
  1302. list.push({ img_url: el });
  1303. });
  1304. this.$previewImg({
  1305. list,
  1306. baseUrl: this.$store.state.ip,
  1307. baseImgField: "img_url",
  1308. baseTitleField: "",
  1309. });
  1310. // })
  1311. },
  1312. },
  1313. });
  1314. },
  1315. },
  1316. {
  1317. title: "图号",
  1318. key: "url_number",
  1319. align: "center",
  1320. tooltip: true,
  1321. minWidth: 80,
  1322. },
  1323. ...arr,
  1324. { title: "备注", key: "remark", align: "center", minWidth: 80 },
  1325. {
  1326. title: "操作",
  1327. key: "remark",
  1328. align: "center",
  1329. slot: "Set",
  1330. minWidth: 120,
  1331. },
  1332. ];
  1333. // 订单特殊字段
  1334. this.formData.special &&
  1335. this.formData.special.forEach((element) => {
  1336. this.formData.head[1].forEach((item) => {
  1337. if (element.head_id == item.id) {
  1338. element = Object.assign(element, item);
  1339. this.contactSpecValueList.push(element);
  1340. }
  1341. });
  1342. });
  1343. this.contactForm = this.formData.head[1]
  1344. ? this.formData.head[1]
  1345. : [{ key: "", value: "" }];
  1346. // 区域特殊字段
  1347. this.formData.list.forEach((element) => {
  1348. element.special &&
  1349. element.special.forEach((ele) => {
  1350. this.formData.head[2].forEach((item) => {
  1351. if (ele.head_id == item.id) {
  1352. ele = Object.assign(ele, item);
  1353. this.areaSpecValueList.push(ele);
  1354. }
  1355. });
  1356. });
  1357. });
  1358. this.areaSpecValueList = this.formData.head[2]
  1359. ? this.formData.head[2]
  1360. : [{ key: "", value: "" }];
  1361. // 产品特殊字段→ 弹窗窗口,table表头
  1362. this.formData.list.forEach((area) => {
  1363. area.product.forEach((pdt, index) => {
  1364. pdt.index = index + 1;
  1365. pdt.special &&
  1366. pdt.special.forEach((element) => {
  1367. this.formData.head[3].forEach((item) => {
  1368. if (element.head_id == item.id) {
  1369. element = Object.assign(element, item);
  1370. pdt[element.key] = element.value;
  1371. this.productSpecValueList.push(element);
  1372. }
  1373. });
  1374. });
  1375. });
  1376. });
  1377. this.productSpecValueList = this.formData.head[3]
  1378. ? this.formData.head[3]
  1379. : [{ key: "", value: "" }];
  1380. })
  1381. .catch((err) => {});
  1382. },
  1383. postData() {
  1384. //1新增 2编辑
  1385. let ip;
  1386. this.$route.query.type == 1
  1387. ? (ip = "order_area_add")
  1388. : (ip = "order_area_edit");
  1389. this.axios({
  1390. method: "post",
  1391. url: "/api/" + ip,
  1392. data: {
  1393. ...this.formData,
  1394. supTableData: this.supTableData,
  1395. },
  1396. })
  1397. .then((res) => {
  1398. this.$Message.success(res.msg);
  1399. // this.initData(this.$route.query.order_no)
  1400. this.goback();
  1401. })
  1402. .catch((err) => {});
  1403. },
  1404. // 操作table数据 3编辑 4删除
  1405. handleSet(row, index, type, table, areaIndex) {
  1406. switch (type) {
  1407. case 3:
  1408. this.PDTEdit = row;
  1409. console.log("this.PDTEdit :>> ", this.PDTEdit);
  1410. if (!this.PDTEdit.url) {
  1411. this.PDTEdit.url = [];
  1412. }
  1413. this.PDTEditAreaIndex = areaIndex;
  1414. this.PDTEditIndex = index;
  1415. this.PDTEdit.addPDTProcessAttrList
  1416. ? this.PDTEdit.addPDTProcessAttrList.forEach((element) => {
  1417. element.type_id ? (element.id = element.type_id) : "";
  1418. element.process_detail = element.showId * 1;
  1419. })
  1420. : (this.PDTEdit.addPDTProcessAttrList = []);
  1421. this.PDTEdit.tempPDTTypeList = [];
  1422. // if (this.PDTEdit.measures.length > 0) {
  1423. // this.PDTEdit.measures.forEach(el => {
  1424. // this.PDTEdit[el.e_title] = el.value
  1425. // });
  1426. // }
  1427. this.$route.query.type == 2 &&
  1428. (this.PDTEdit.tempMeasureList = this.PDTEdit.measures);
  1429. // console.log('this.PDTEdit.measures :>> ', this.PDTEdit.measures);
  1430. // for (const key in this.PDTEdit.measures) {
  1431. // this.PDTEdit.tempMeasureList.forEach(el => {
  1432. // // console.log('el.e_title :>> ', el.e_title);
  1433. // this.PDTEdit[el.e_title] = el.value
  1434. // console.log('key :>> ', key);
  1435. // if (key == el.e_title) {
  1436. // if (this.PDTEdit[key] == '') {
  1437. // this.PDTEdit.tempMeasureList.splice(this.PDTEdit.tempMeasureList.indexOf(el), 1)
  1438. // }
  1439. // }
  1440. // });
  1441. // }
  1442. console.log(
  1443. "this.PDTEdit.tempMeasureList :>> ",
  1444. this.PDTEdit.tempMeasureList
  1445. );
  1446. //获取属性
  1447. let newmeasureList = row.measure.split("*");
  1448. for (let i in newmeasureList) {
  1449. for (let j in this.measureList) {
  1450. if (
  1451. newmeasureList[i].indexOf(this.measureList[j].e_title) != -1
  1452. ) {
  1453. this.PDTEdit[this.measureList[j].e_title] =
  1454. newmeasureList[i].substring(1);
  1455. }
  1456. }
  1457. }
  1458. // this.axios('/api/basics_product_index', { params: { type_id: this.PDTEdit.type_id } }).then(res => {
  1459. // this.PDTEdit.tempMeasureList = res.data.data;
  1460. // })
  1461. // this.hanndleAddPDTTypeChange(this.PDTEdit,this.PDTEdit.type_id)
  1462. this.PDTEdit = JSON.parse(JSON.stringify(this.PDTEdit));
  1463. this.showPDTEditModal = true;
  1464. break;
  1465. case 4:
  1466. table.splice(index, 1);
  1467. break;
  1468. }
  1469. },
  1470. //新增产品复制
  1471. handleAddPDTCopy(item, index) {
  1472. const temp = JSON.parse(JSON.stringify(item));
  1473. this.tempPDTList.splice(index + 1, 0, temp);
  1474. },
  1475. //新增产品添加
  1476. handleAddPDTAdd(index) {
  1477. this.tempPDTList.splice(index + 1, 0, { addPDTProcessAttrList: [] });
  1478. },
  1479. //新增产品删除
  1480. handleAddPDTDele(index) {
  1481. this.tempPDTList.splice(index, 1);
  1482. },
  1483. //新增产品→新增区域确认
  1484. handleAddPDTConfirm() {
  1485. this.tempPDTList.forEach((element) => {
  1486. element.addPDTProcessAttrList.forEach((el) => {
  1487. element.process_property += el.showValue + ",";
  1488. element.process_properties += el.showId + ",";
  1489. });
  1490. element.process_property = element.process_property.substring(
  1491. 0,
  1492. element.process_property.length - 1
  1493. );
  1494. element.process_properties = element.process_properties.substring(
  1495. 0,
  1496. element.process_properties.length - 1
  1497. );
  1498. element.tempMeasureList.forEach((el) => {
  1499. element[el.e_title] &&
  1500. (element.measure += `${el.e_title ? el.e_title : 0}${
  1501. element[el.e_title]
  1502. }*`);
  1503. });
  1504. element.measure = element.measure.substring(
  1505. 0,
  1506. element.measure.length - 1
  1507. );
  1508. });
  1509. // console.log('this.formData.list[this.tempPDTIndex].product :>> ', this.formData.list[this.tempPDTIndex].product);
  1510. // console.log('this.tempPDTList :>> ', this.tempPDTList);
  1511. this.formData.list[this.tempPDTIndex].product.push(...this.tempPDTList);
  1512. this.$nextTick(() => {
  1513. //开辟新栈空间,更改指针
  1514. this.formData.list = JSON.parse(JSON.stringify(this.formData.list));
  1515. this.formData.list[this.tempPDTIndex].product.forEach((el, index) => {
  1516. el.index = index + 1;
  1517. });
  1518. // 置空新增产品对象
  1519. this.tempPDTList = [
  1520. {
  1521. url: [],
  1522. process_property: "",
  1523. process_properties: [],
  1524. tempPDTTypeList: [],
  1525. measure: "",
  1526. //新增产品工艺属性列表
  1527. addPDTProcessAttrList: [
  1528. {
  1529. showValue: "",
  1530. showId: "",
  1531. PDTProcessAttrDetailList: [],
  1532. },
  1533. ],
  1534. },
  1535. ];
  1536. this.showPDTModal = false;
  1537. });
  1538. },
  1539. // 编辑产品→确认
  1540. handlePDTEditConfirm() {
  1541. this.PDTEdit.process_property = "";
  1542. this.PDTEdit.process_properties = "";
  1543. this.PDTEdit.measure = "";
  1544. this.PDTEdit.tempMeasureList.forEach((element) => {
  1545. element.value = this.PDTEdit[element.e_title];
  1546. });
  1547. this.PDTEdit.addPDTProcessAttrList.forEach((el) => {
  1548. this.PDTEdit.process_property += el.showValue + ",";
  1549. this.PDTEdit.process_properties += el.showId + ",";
  1550. });
  1551. this.PDTEdit.process_property = this.PDTEdit.process_property.substring(
  1552. 0,
  1553. this.PDTEdit.process_property.length - 1
  1554. );
  1555. this.PDTEdit.process_properties =
  1556. this.PDTEdit.process_properties.substring(
  1557. 0,
  1558. this.PDTEdit.process_properties.length - 1
  1559. );
  1560. this.PDTEdit.tempMeasureList.forEach((el) => {
  1561. this.PDTEdit.measure += `${el.e_title}${this.PDTEdit[el.e_title]}*`;
  1562. });
  1563. this.PDTEdit.measure = this.PDTEdit.measure.substring(
  1564. 0,
  1565. this.PDTEdit.measure.length - 1
  1566. );
  1567. this.$nextTick(() => {
  1568. // this.formData.list[this.PDTEditAreaIndex].product[this.PDTEditIndex] = this.PDTEdit
  1569. this.showPDTEditModal = false;
  1570. this.formData.list[this.PDTEditAreaIndex].product.splice(
  1571. this.PDTEditIndex,
  1572. 1,
  1573. this.PDTEdit
  1574. );
  1575. this.$forceUpdate();
  1576. });
  1577. },
  1578. //添加工艺属性
  1579. handleProcessAdd(item, index) {
  1580. this.tempPDTList[index].addPDTProcessAttrList.push({
  1581. PDTProcessAttrDetailList: [],
  1582. });
  1583. },
  1584. // 编辑添加工艺属性
  1585. handleEditProcessAdd() {
  1586. this.$nextTick(() => {
  1587. !this.PDTEdit.addPDTProcessAttrList &&
  1588. (this.PDTEdit.addPDTProcessAttrList = []);
  1589. this.PDTEdit.addPDTProcessAttrList.push({
  1590. PDTProcessAttrDetailList: [],
  1591. });
  1592. this.$forceUpdate();
  1593. });
  1594. },
  1595. //选择工艺属性
  1596. handleAddPDTAttrChange(item, index, value) {
  1597. item.id = value;
  1598. this.axios("/api/properties_index", { params: { id: value } }).then(
  1599. (res) => {
  1600. item.PDTProcessAttrDetailList = res.data.data;
  1601. }
  1602. );
  1603. },
  1604. //选择工艺属性细节
  1605. handleAddPDTAttrDetailChange(item, index, value) {
  1606. item.showValue = value.label;
  1607. item.showId = value.value;
  1608. },
  1609. // 删除工艺属性
  1610. handleAddPDTDetailDele(arr, index) {
  1611. this.$nextTick(() => {
  1612. arr.splice(index, 1);
  1613. this.$forceUpdate();
  1614. });
  1615. },
  1616. //新增产品
  1617. handleAreaAddPDT(item, index) {
  1618. this.showPDTModal = true;
  1619. // this.tempPDTList = item
  1620. this.tempPDTList = [
  1621. {
  1622. url: [],
  1623. process_property: "",
  1624. process_properties: [],
  1625. tempPDTTypeList: [],
  1626. measure: "",
  1627. measures: [],
  1628. //新增产品工艺属性列表
  1629. addPDTProcessAttrList: [
  1630. {
  1631. showValue: "",
  1632. showId: "",
  1633. PDTProcessAttrDetailList: [],
  1634. },
  1635. ],
  1636. },
  1637. ];
  1638. this.tempPDTIndex = index;
  1639. },
  1640. //新增区域
  1641. handleAreaAdd(target, index) {
  1642. const obj = {
  1643. areaIndex: target.length + 1,
  1644. num: "",
  1645. title: "",
  1646. unit: "",
  1647. quantity: "",
  1648. house_type: "",
  1649. remark: "",
  1650. order_no: "",
  1651. product: [],
  1652. special: [...this.areaSpecValueList],
  1653. };
  1654. // target.push(obj)
  1655. // this.$set(this.formData, 'list', [...this.formData.list, obj])
  1656. this.formData.list.splice(index + 1, 0, obj);
  1657. },
  1658. //删除区域
  1659. handleAreaDele(index) {
  1660. this.formData.list.splice(index, 1);
  1661. },
  1662. handleClientChange(id) {
  1663. id &&
  1664. this.axios({
  1665. method: "get",
  1666. url: "/api/custom_detail",
  1667. params: { id },
  1668. }).then((res) => {
  1669. this.clientDetailList = res.data.list;
  1670. this.formData.service_id = res.data.detail.service_id;
  1671. this.formData.custom_detail_id = this.clientDetailList[0].id || 0;
  1672. this.fax = res.data.detail.fax;
  1673. });
  1674. },
  1675. handleClientDetailChange(value) {
  1676. if (value) {
  1677. let row = this.clientDetailList.filter((item) => item.id == value);
  1678. this.formData.address = row[0].address;
  1679. this.formData.mobile = row[0].mobile;
  1680. this.$forceUpdate();
  1681. }
  1682. },
  1683. //项目辅料新增
  1684. handleAddSup() {
  1685. this.supTableData.push({ index: "", id: "" });
  1686. this.supTableData.forEach((element, index) => {
  1687. element.index = index + 1;
  1688. });
  1689. },
  1690. //项目辅料删除
  1691. handleSupSet(row, index) {
  1692. this.supTableData.splice(index, 1);
  1693. // this.supTableData.forEach((element, index) => {
  1694. // element.index = index + 1
  1695. // });
  1696. },
  1697. goback() {
  1698. this.$router.go(-1);
  1699. },
  1700. looks(img) {
  1701. const array = [{ img_url: img }];
  1702. this.$previewImg({
  1703. list: array,
  1704. baseUrl: this.$store.state.ip,
  1705. baseImgField: "img_url",
  1706. baseTitleField: "",
  1707. });
  1708. },
  1709. delItems(n, arr) {
  1710. arr.splice(n, 1);
  1711. },
  1712. changeIpt(e, row) {
  1713. let file = e.target.files[0];
  1714. this.postImg(file, row);
  1715. e.target.value = null;
  1716. },
  1717. postImg(file, row) {
  1718. let formData = new FormData();
  1719. formData.append("file", file);
  1720. this.axios.post("/api/upload_pic", formData).then((res) => {
  1721. this.$nextTick(() => {
  1722. row.push(res.data.url);
  1723. this.$forceUpdate();
  1724. });
  1725. });
  1726. },
  1727. // 产品分类选择→对应不同测量字段
  1728. hanndleAddPDTTypeChange(item, e) {
  1729. e &&
  1730. this.axios("/api/basics_product_index", {
  1731. params: { type_id: e },
  1732. }).then((res) => {
  1733. item.tempPDTTypeList = res.data.data[0].measure_id.split(",");
  1734. this.measureList.forEach((el) => {
  1735. item[el.e_title] = "";
  1736. });
  1737. this.$nextTick(() => {
  1738. item.tempMeasureList = this.measureList;
  1739. this.$forceUpdate();
  1740. });
  1741. });
  1742. // basics_measure_index
  1743. },
  1744. // 添加特殊字段
  1745. handleAddInputConfirm() {
  1746. this.formData.special = JSON.parse(
  1747. JSON.stringify(this.contactSpecValueList)
  1748. );
  1749. this.formData.list.forEach((element) => {
  1750. element.special = JSON.parse(JSON.stringify(this.areaSpecValueList));
  1751. element.product.forEach((ele) => {
  1752. ele.special = JSON.parse(JSON.stringify(this.productSpecValueList));
  1753. });
  1754. });
  1755. let arr = [];
  1756. this.productSpecValueList.forEach((element) => {
  1757. arr.push({
  1758. title: element.key,
  1759. key: element.key,
  1760. align: "center",
  1761. minWidth: 80,
  1762. });
  1763. });
  1764. this.tableColumns = [
  1765. { title: "序号", key: "index", align: "center", minWidth: 80 },
  1766. {
  1767. title: "产品名称",
  1768. key: "title",
  1769. align: "center",
  1770. tooltip: true,
  1771. minWidth: 100,
  1772. },
  1773. { title: "数量", key: "num", align: "center", minWidth: 80 },
  1774. { title: "价格", key: "price", align: "center", minWidth: 80 },
  1775. {
  1776. title: "规格",
  1777. key: "measure",
  1778. align: "center",
  1779. tooltip: true,
  1780. minWidth: 140,
  1781. },
  1782. {
  1783. title: "工艺属性",
  1784. key: "process_property",
  1785. align: "center",
  1786. tooltip: true,
  1787. minWidth: 120,
  1788. },
  1789. {
  1790. title: "图纸",
  1791. align: "center",
  1792. key: "url",
  1793. minWidth: 100,
  1794. render: (h, params) => {
  1795. const { row } = params;
  1796. let url = row.url ? row.url : [];
  1797. return h("img", {
  1798. attrs: {
  1799. src: this.$store.state.ip + url[0],
  1800. style:
  1801. "max-width:50px;max-height:50px;position:relative;top:3px;",
  1802. },
  1803. on: {
  1804. click: (e) => {
  1805. // this.axios('/api/orders_img', { params: { id: row.id, type: 1 } }).then(res => {
  1806. // row.imgs = res.data
  1807. let list = [];
  1808. row.url.forEach((el) => {
  1809. list.push({ img_url: el });
  1810. });
  1811. this.$previewImg({
  1812. list,
  1813. baseUrl: this.$store.state.ip,
  1814. baseImgField: "img_url",
  1815. baseTitleField: "",
  1816. });
  1817. // })
  1818. },
  1819. },
  1820. });
  1821. },
  1822. },
  1823. {
  1824. title: "图号",
  1825. key: "url_number",
  1826. align: "center",
  1827. tooltip: true,
  1828. minWidth: 80,
  1829. },
  1830. ...arr,
  1831. { title: "备注", key: "remark", align: "center", minWidth: 80 },
  1832. {
  1833. title: "操作",
  1834. key: "remark",
  1835. align: "center",
  1836. slot: "Set",
  1837. minWidth: 120,
  1838. },
  1839. ];
  1840. this.showAddInputModal = false;
  1841. },
  1842. // 添加特殊字段
  1843. handleSpecValueAdd(item, type) {
  1844. switch (type) {
  1845. case 1:
  1846. this.contactSpecValueList.push({ key: "", value: "" });
  1847. break;
  1848. case 2:
  1849. this.areaSpecValueList.push({ key: "", value: "" });
  1850. break;
  1851. case 3:
  1852. this.productSpecValueList.push({ key: "", value: "" });
  1853. break;
  1854. }
  1855. },
  1856. // 删除特殊字段
  1857. handleSpecValueDele(index, type) {
  1858. switch (type) {
  1859. case 1:
  1860. this.contactSpecValueList.splice(index, 1);
  1861. break;
  1862. case 2:
  1863. this.areaSpecValueList.splice(index, 1);
  1864. break;
  1865. case 3:
  1866. this.productSpecValueList.splice(index, 1);
  1867. break;
  1868. }
  1869. },
  1870. },
  1871. // 监听属性 类似于data概念
  1872. computed: {},
  1873. // 监控data中的数据变化
  1874. watch: {},
  1875. beforeCreate() {}, // 生命周期 - 创建之前
  1876. beforeMount() {}, // 生命周期 - 挂载之前
  1877. beforeUpdate() {}, // 生命周期 - 更新之前
  1878. updated() {}, // 生命周期 - 更新之后
  1879. beforeDestroy() {}, // 生命周期 - 销毁之前
  1880. destroyed() {}, // 生命周期 - 销毁完成
  1881. activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
  1882. };
  1883. </script>
  1884. <style lang='scss' scoped>
  1885. .BidSystemContractEdit {
  1886. overflow: hidden;
  1887. overflow-y: auto;
  1888. position: relative;
  1889. top: 20px;
  1890. height: 85%;
  1891. padding-bottom: 20px;
  1892. }
  1893. .top_search {
  1894. padding: 20px 0;
  1895. width: 100%;
  1896. .top_search_form {
  1897. // width: 800px;
  1898. // display: flex;
  1899. // justify-content: space-around;
  1900. /deep/ .ivu-form-item {
  1901. display: inline-block;
  1902. width: 300px;
  1903. }
  1904. }
  1905. }
  1906. .addArea {
  1907. position: relative;
  1908. padding: 15px;
  1909. margin-bottom: 30px;
  1910. border-radius: 5px;
  1911. box-shadow: 1px 1px 5px 1px #999;
  1912. .addAreaBtn {
  1913. position: absolute;
  1914. right: 20px;
  1915. top: 20px;
  1916. }
  1917. /deep/ .ivu-form-item {
  1918. display: inline-block;
  1919. width: 220px;
  1920. }
  1921. }
  1922. .addPDTFormModal {
  1923. .addPDTForm {
  1924. width: 100%;
  1925. position: relative;
  1926. border-bottom: 1px solid #e8eaec;
  1927. margin-bottom: 30px;
  1928. /deep/ .ivu-form-item {
  1929. display: inline-block;
  1930. width: 300px;
  1931. }
  1932. .addPDTBtn {
  1933. position: absolute;
  1934. right: 10px;
  1935. bottom: 25px;
  1936. }
  1937. }
  1938. /deep/ .ivu-modal-body {
  1939. display: flex;
  1940. justify-content: center;
  1941. flex-wrap: wrap;
  1942. max-height: 700px;
  1943. overflow: hidden;
  1944. overflow-y: auto;
  1945. }
  1946. }
  1947. .addPDTProcess {
  1948. width: 300px;
  1949. padding-bottom: 15px;
  1950. div {
  1951. display: flex;
  1952. justify-content: space-around;
  1953. padding: 5px 0;
  1954. span {
  1955. padding-top: 6px;
  1956. }
  1957. }
  1958. .dele_icon {
  1959. width: 10px;
  1960. /deep/ .ivu-icon {
  1961. padding-top: 5px;
  1962. }
  1963. }
  1964. }
  1965. .product-img {
  1966. padding-top: 10px;
  1967. }
  1968. .product-add {
  1969. display: flex;
  1970. flex-wrap: wrap;
  1971. .ipt {
  1972. position: absolute;
  1973. width: 100%;
  1974. height: 100%;
  1975. opacity: 0;
  1976. cursor: pointer;
  1977. outline: none;
  1978. top: 0;
  1979. left: 0;
  1980. }
  1981. .add-items {
  1982. width: 40px;
  1983. height: 40px;
  1984. border: 1px dotted #e7e7e7;
  1985. border-radius: 5px;
  1986. display: flex;
  1987. justify-content: center;
  1988. align-items: center;
  1989. overflow: hidden;
  1990. position: relative;
  1991. flex-direction: column;
  1992. background: #f4f5f7;
  1993. .item {
  1994. width: 46px;
  1995. height: 46px;
  1996. background: #3764ff;
  1997. opacity: 0.6;
  1998. display: flex;
  1999. justify-content: center;
  2000. align-items: center;
  2001. border-radius: 50%;
  2002. color: #fff;
  2003. }
  2004. }
  2005. .items {
  2006. width: 40px;
  2007. height: 40px;
  2008. margin-bottom: 10px;
  2009. display: flex;
  2010. justify-content: center;
  2011. align-items: center;
  2012. background: #e7e7e7;
  2013. margin-right: 10px;
  2014. border-radius: 5px;
  2015. position: relative;
  2016. img {
  2017. max-width: 40px;
  2018. max-height: 40px;
  2019. }
  2020. }
  2021. }
  2022. .supModalBtn {
  2023. display: flex;
  2024. justify-content: flex-end;
  2025. margin-bottom: 10px;
  2026. }
  2027. /deep/.ivu-modal-body {
  2028. display: flex;
  2029. justify-content: center;
  2030. .addInputClass {
  2031. display: flex;
  2032. justify-content: center;
  2033. width: 500px;
  2034. .dele_icon {
  2035. cursor: pointer;
  2036. width: 10px;
  2037. /deep/ .ivu-icon {
  2038. padding-top: 5px;
  2039. }
  2040. }
  2041. }
  2042. }
  2043. .addInputClassTab {
  2044. display: flex;
  2045. justify-content: center;
  2046. align-items: center;
  2047. flex-wrap: wrap;
  2048. div {
  2049. display: flex;
  2050. justify-content: center;
  2051. align-items: center;
  2052. width: 100%;
  2053. padding: 5px;
  2054. .dele_icon {
  2055. i {
  2056. font-size: 20px;
  2057. }
  2058. }
  2059. }
  2060. }
  2061. /deep/.ivu-tabs-nav-scroll {
  2062. display: flex;
  2063. justify-content: center;
  2064. }
  2065. /deep/ .ivu-table-wrapper {
  2066. overflow: visible;
  2067. }
  2068. /deep/.ivu-table-fixed-body {
  2069. padding-bottom: 20px;
  2070. }
  2071. </style>