edit.vue 77 KB

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