edit.vue 86 KB

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