index.vue 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487
  1. <template>
  2. <div class="box">
  3. <div class="tree">
  4. <treeList title="产品分类" submitType="1" :data="treeListData" v-model="sourceList.pagination.productClassifyId" @change="treeChange"
  5. @changeTreeList="getTreeList">
  6. </treeList>
  7. </div>
  8. <div class="content">
  9. <byTable :source="sourceList.data" :tableHeight="tableHeight" :pagination="sourceList.pagination" :config="config" :loading="loading"
  10. highlight-current-row :selectConfig="selectConfig" :action-list="[
  11. {
  12. text: '导出Excel',
  13. action: () => exportExcel(),
  14. disabled: false,
  15. },
  16. {
  17. text: '添加',
  18. action: () => openModal('add'),
  19. disabled: false,
  20. },]" @get-list="getList">
  21. <template #name="{ item }">
  22. <div>
  23. <span class="el-click">{{ item.name }}</span>
  24. </div>
  25. </template>
  26. <template #pic="{ item }">
  27. <div v-if="item.fileList.length > 0">
  28. <img :src="item.fileList[0].fileUrl" class="pic" @click="handleClickFile(item.fileList[0])" />
  29. </div>
  30. <div v-else></div>
  31. </template>
  32. <template #size="{ item }">
  33. <div v-if="item['length'] && item.width && item.height">
  34. <span>{{ item['length'] }}</span>*
  35. <span>{{ item.width }}</span>*
  36. <span>{{ item.height }}</span>
  37. </div>
  38. <div v-else></div>
  39. </template>
  40. <template #price="{ item }">
  41. <div v-if="item.price">
  42. <span> {{ moneyFormat(item.price ,2)}}</span>
  43. </div>
  44. <div v-else></div>
  45. </template>
  46. </byTable>
  47. </div>
  48. <el-dialog :title="modalType == 'add' ? '添加产品' : '编辑产品'" v-model="dialogVisible" width="80%" destroy-on-close>
  49. <div class="public_height_dialog">
  50. <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="formDom" v-loading="submitLoading">
  51. <template #nameEnglish>
  52. <div style="width: 100%">
  53. <el-input v-model="formData.data.nameEnglish" placeholder="请输入" onkeyup="value=value.replace(/[^\x00-\xff]/g, '')"></el-input>
  54. </div>
  55. </template>
  56. <template #productionFile>
  57. <div style="width: 100%">
  58. <span style="color:#409eff;cursor:pointer" @click="handleClickUpload('prodFilePath',true)"
  59. v-if="!formData.data.prodFilePath">点击上传</span>
  60. <span style="color:#409eff;cursor:pointer" @click="handleClickUpload('prodFilePath',false)" v-else>点击查看</span>
  61. </div>
  62. </template>
  63. <template #productionFileOne>
  64. <div style="width: 100%">
  65. <el-button type="primary" plain @click="handleClickUpload('prodImgPath',true)" v-if="!formData.data.prodImgPath">点击上传</el-button>
  66. <el-button type="primary" plain @click="handleClickUpload('prodImgPath',false)" v-else>点击查看</el-button>
  67. </div>
  68. </template>
  69. <template #color>
  70. <div style="width: 100%">
  71. <el-form-item label="颜色" class="margin-b-0 wid100">
  72. <el-row style="width: 100%">
  73. <el-col :span="12">
  74. <el-form-item prop="color" label-width="0px" class="margin-b-0 wid100">
  75. <el-input v-model="formData.data.color" placeholder="颜色" />
  76. </el-form-item>
  77. </el-col>
  78. <el-col :span="12">
  79. <el-form-item prop="colorCardCode" label-width="0px" class="margin-b-0 wid100">
  80. <el-input v-model="formData.data.colorCardCode" placeholder="色卡号" />
  81. </el-form-item>
  82. </el-col>
  83. </el-row>
  84. </el-form-item>
  85. </div>
  86. </template>
  87. <template #size>
  88. <div style="width: 100%">
  89. <el-form-item label="尺寸" class="margin-b-0 wid100" required>
  90. <el-row>
  91. <el-col :span="8">
  92. <el-form-item prop="length" label-width="0px" class="margin-b-0 wid100">
  93. <el-input-number v-model="formData.data['length']" placeholder="长 (cm)" style="width: 100%" :precision="2" :controls="false"
  94. :min="0" onmousewheel="return false;" />
  95. </el-form-item>
  96. </el-col>
  97. <el-col :span="8">
  98. <el-form-item prop="width" label-width="0px" class="margin-b-0 wid100">
  99. <el-input-number v-model="formData.data.width" placeholder="宽 (cm)" style="width: 100%" :precision="2" :controls="false"
  100. :min="0" onmousewheel="return false;" />
  101. </el-form-item>
  102. </el-col>
  103. <el-col :span="8">
  104. <el-form-item prop="height" label-width="0px" class="margin-b-0 wid100">
  105. <el-input-number v-model="formData.data.height" placeholder="高 (cm)" style="width: 100%" :precision="2" :controls="false"
  106. :min="0" onmousewheel="return false;" />
  107. </el-form-item>
  108. </el-col>
  109. </el-row>
  110. </el-form-item>
  111. </div>
  112. </template>
  113. <template #materialDetail>
  114. <div style="width: 100%;padding-left:15px">
  115. <el-button type="primary" @click="clickOpenSelectMaterial(1)" plain>选择包材/配件/辅材</el-button>
  116. <el-table :data="formData.data.productBomDetailList" style="width: 100%; margin-top: 16px">
  117. <el-table-column prop="materialName" label="物料名称" min-width="130" />
  118. <el-table-column prop="materialCode" label="物料编码" width="150" />
  119. <el-table-column label="数量" width="150">
  120. <template #default="{ row, $index }">
  121. <div style="width: 100%">
  122. <el-form-item :prop="'productBomDetailList.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true"
  123. class="margin-b-0 wid100">
  124. <el-input-number onmousewheel="return false;" v-model="row.quantity" placeholder="请输入" style="width: 100%" :precision="0"
  125. :controls="false" :min="1" />
  126. </el-form-item>
  127. </div>
  128. </template>
  129. </el-table-column>
  130. <el-table-column label="操作" width="60" align="center" fixed="right">
  131. <template #default="{ $index }">
  132. <el-button type="primary" link @click="handleRemove($index,1)">删除</el-button>
  133. </template>
  134. </el-table-column>
  135. </el-table>
  136. </div>
  137. </template>
  138. <template #technology>
  139. <div style="width:100%">
  140. <div class="small-title">
  141. ① 工艺线路
  142. </div>
  143. <el-row style="width:100%">
  144. <el-col :span="12">
  145. <el-form-item prop="technologyId" label="工艺产线" class="wid100">
  146. <el-select v-model="formData.data.technologyId" placeholder="请选择" style="width:100%">
  147. <el-option v-for="item in technologyData" :key="item.id" :label="item.name" :value="item.id" />
  148. </el-select>
  149. </el-form-item>
  150. </el-col>
  151. </el-row>
  152. <div class="small-title">
  153. ② LOGO
  154. </div>
  155. <el-row style="width:100%">
  156. <el-col :span="12">
  157. <el-form-item label="LOGO尺寸" class="wid100">
  158. <el-row>
  159. <el-col :span="8">
  160. <el-form-item prop="logoLength" label-width="0px" class="margin-b-0 wid100">
  161. <el-input-number v-model="formData.data.logoLength" placeholder="长 (cm)" style="width: 100%" :precision="2"
  162. :controls="false" :min="0" onmousewheel="return false;" />
  163. </el-form-item>
  164. </el-col>
  165. <el-col :span="8">
  166. <el-form-item prop="logoWidth" label-width="0px" class="margin-b-0 wid100">
  167. <el-input-number v-model="formData.data.logoWidth" placeholder="宽 (cm)" style="width: 100%" :precision="2" :controls="false"
  168. :min="0" onmousewheel="return false;" />
  169. </el-form-item>
  170. </el-col>
  171. <el-col :span="8">
  172. <el-form-item prop="logoHeight" label-width="0px" class="margin-b-0 wid100">
  173. <el-input-number v-model="formData.data.logoHeight" placeholder="高 (cm)" style="width: 100%" :precision="2"
  174. :controls="false" :min="0" onmousewheel="return false;" />
  175. </el-form-item>
  176. </el-col>
  177. </el-row>
  178. </el-form-item>
  179. </el-col>
  180. <el-col :span="12">
  181. <el-form-item prop="colorCount" label="几色印刷" class="wid100">
  182. <el-input-number v-model="formData.data.colorCount" placeholder="请输入" style="width: 100%" :precision="0" :controls="false"
  183. :min="1" onmousewheel="return false;" />
  184. </el-form-item>
  185. </el-col>
  186. </el-row>
  187. <div class="small-title">
  188. ③ 折叠
  189. </div>
  190. <el-row style="width:100%">
  191. <el-col :span="12">
  192. <el-form-item prop="isFold" label="是否折叠" class="wid100">
  193. <el-select v-model="formData.data.isFold" placeholder="请选择" style="width:100%">
  194. <el-option :label="'否'" :value="0" />
  195. <el-option :label="'是'" :value="1" />
  196. </el-select>
  197. </el-form-item>
  198. </el-col>
  199. <el-col :span="12">
  200. <el-form-item prop="foldWay" label="折叠数" class="wid100" v-if="formData.data.isFold==1">
  201. <el-select v-model="formData.data.foldWay" placeholder="请选择" style="width:100%">
  202. <el-option v-for="item in foldWayData" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
  203. </el-select>
  204. </el-form-item>
  205. </el-col>
  206. </el-row>
  207. <div class="small-title">
  208. ④ 包装要求
  209. </div>
  210. <el-row style="width:100%">
  211. <el-col :span="12">
  212. <el-form-item prop="packAsk" label="包装要求" class="wid100">
  213. <el-select v-model="formData.data.packAsk" placeholder="请选择" style="width:100%" multiple>
  214. <el-option v-for="item in packAskData" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
  215. </el-select>
  216. </el-form-item>
  217. </el-col>
  218. </el-row>
  219. <div class="small-title">
  220. ⑤ 是否定制
  221. </div>
  222. <el-row style="width:100%">
  223. <el-col :span="12">
  224. <el-form-item prop="isCustomized" label="是否定制" class="wid100">
  225. <el-select v-model="formData.data.isCustomized" placeholder="请选择" style="width:100%">
  226. <el-option :label="'否'" :value="0" />
  227. <el-option :label="'是'" :value="1" />
  228. </el-select>
  229. </el-form-item>
  230. </el-col>
  231. </el-row>
  232. <el-row style="width:100%">
  233. <el-form-item prop="technologyId" label="定制内容" class="wid100" v-if="formData.data.isCustomized==1">
  234. <table style="width:100%" border class="table">
  235. <tr>
  236. <td style="width:20%">
  237. </td>
  238. <td style="width:40%">附件</td>
  239. <td style="width:40%">备注</td>
  240. </tr>
  241. <tr v-for="(row,index) in formData.data.productCustomInfoList" :key="index">
  242. <td>
  243. <el-checkbox v-model="row.isCheckBox" label="" /> <span style="position:relative;top:-2px"> {{getLabel(row.type)}}</span>
  244. </td>
  245. <td>
  246. <el-upload :file-list="row.fileList" :action="uploadUrl" :data="uploadData" :limit="1" :list-type="'text'"
  247. :before-upload="(file)=>handleBeforeUploadOne(file,index)" :on-success="()=>handleSuccessOne(index)"
  248. :on-remove="(file)=>handleRemoveFile(file,index)" :on-preview="onPreviewFile"
  249. :on-exceed="()=>msgTip(`上传文件数量不可大于1`, 2)">
  250. <el-button text type="primary">上传附件</el-button>
  251. </el-upload>
  252. </td>
  253. <td>
  254. <el-form-item :prop="'productCustomInfoList.' + index + '.remark'" :rules="row.isCheckBox?rules.remark:''"
  255. class="margin-b-0 wid100">
  256. <el-input v-model="row.remark" placeholder="请输入备注" />
  257. </el-form-item>
  258. </td>
  259. </tr>
  260. </table>
  261. </el-form-item>
  262. </el-row>
  263. </div>
  264. </template>
  265. </byForm>
  266. </div>
  267. <template #footer>
  268. <el-button @click="dialogVisible = false" size="defualt" v-debounce>取 消</el-button>
  269. <el-button type="primary" @click="submitForm()" size="defualt" v-debounce>确 定</el-button>
  270. </template>
  271. </el-dialog>
  272. <el-dialog :title="'BOM 配置'" v-model="bomDialog" width="900" destroy-on-close>
  273. <!-- <div class="public_height_dialog"> -->
  274. <byForm :formConfig="bomFormConfig" :formOption="bomFormOption" v-model="formData.bomData" :rules="bomRules" ref="bomFormDom"
  275. v-loading="submitLoading">
  276. <!-- <template #accessories>
  277. <div style="width: 100%">
  278. <el-button type="primary" @click="openSelectMaterial = true" plain>选择</el-button>
  279. <el-table :data="formData.bomData.productBomDetailList" style="width: 100%; margin-top: 16px" border>
  280. <el-table-column prop="materialName" label="物料名称" min-width="130" />
  281. <el-table-column prop="materialCode" label="物料编码" width="150" />
  282. <el-table-column label="数量" width="150">
  283. <template #default="{ row, $index }">
  284. <div style="width: 100%">
  285. <el-form-item :prop="'productBomDetailList.' + $index + '.quantity'" :rules="bomRules.quantity" :inline-message="true"
  286. class="margin-b-0 wid100">
  287. <el-input-number onmousewheel="return false;" v-model="row.quantity" placeholder="请输入" style="width: 100%" :precision="0"
  288. :controls="false" :min="1" />
  289. </el-form-item>
  290. </div>
  291. </template>
  292. </el-table-column>
  293. <el-table-column label="操作" width="60" align="center" fixed="right">
  294. <template #default="{ $index }">
  295. <el-button type="primary" link @click="handleRemove($index,1)">删除</el-button>
  296. </template>
  297. </el-table-column>
  298. </el-table>
  299. </div>
  300. </template>
  301. <template #detail>
  302. <div style="width: 100%">
  303. <el-table :data="formData.bomData.processesList" style="width: 100%; " border>
  304. <el-table-column label="序号" type="index" width="80" />
  305. <el-table-column prop="code" label="工序编码" />
  306. <el-table-column prop="name" label="工序名称" />
  307. </el-table>
  308. </div>
  309. </template> -->
  310. <template #detail>
  311. <div style="width: 100%">
  312. <div style="text-align:center;margin-bottom:10px">
  313. 【{{formData.bomData.name}} {{formData.bomData.code}}】BOM单
  314. </div>
  315. <table border class="table" style="width:100%">
  316. <tbody>
  317. <tr>
  318. <td style="width:90px">原材料</td>
  319. <td style="padding:10px">
  320. <el-select v-model="formData.bomData.rawMaterialId" placeholder="请选择原材料" style="width:100%">
  321. <el-option v-for="item in rawMaterialData" :key="item.value" :label="item.label" :value="item.value" filterable />
  322. </el-select>
  323. </td>
  324. </tr>
  325. <tr>
  326. <td>
  327. 包材/配件/辅材
  328. </td>
  329. <td style="padding:20px 20px 20px">
  330. <div style="text-align:left"><el-button type="primary" @click="clickOpenSelectMaterial(2)" plain>选择</el-button></div>
  331. <el-table :data="formData.bomData.productBomDetailList" style="width: 100%;">
  332. <el-table-column prop="materialName" label="物料名称" min-width="130" />
  333. <el-table-column prop="materialCode" label="物料编码" width="150" />
  334. <el-table-column label="数量" width="150">
  335. <template #default="{ row, $index }">
  336. <div style="width: 100%">
  337. <el-form-item :prop="'productBomDetailList.' + $index + '.quantity'" :rules="bomRules.quantity" :inline-message="true"
  338. class="margin-b-0 wid100">
  339. <el-input-number onmousewheel="return false;" v-model="row.quantity" placeholder="请输入" style="width: 100%"
  340. :precision="0" :controls="false" :min="1" />
  341. </el-form-item>
  342. </div>
  343. </template>
  344. </el-table-column>
  345. <el-table-column label="操作" width="60" align="center" fixed="right">
  346. <template #default="{ $index }">
  347. <el-button type="primary" link @click="handleRemove($index,2)">删除</el-button>
  348. </template>
  349. </el-table-column>
  350. </el-table>
  351. </td>
  352. </tr>
  353. <tr>
  354. <td>
  355. 生产工序
  356. </td>
  357. <td style="padding:0 20px 20px">
  358. <el-table :data="formData.bomData.processesList" style="width: 100%; ">
  359. <el-table-column label="序号" type="index" width="80" />
  360. <el-table-column prop="code" label="工序编码" />
  361. <el-table-column prop="name" label="工序名称" />
  362. </el-table>
  363. </td>
  364. </tr>
  365. </tbody>
  366. </table>
  367. </div>
  368. </template>
  369. </byForm>
  370. <!-- </div> -->
  371. <template #footer>
  372. <el-button @click="bomDialog = false" size="defualt" v-debounce>取 消</el-button>
  373. <el-button type="primary" @click="submitBomForm()" size="defualt" v-debounce>确 定</el-button>
  374. </template>
  375. </el-dialog>
  376. <el-dialog :title="'物料选择'" v-model="openSelectMaterial" width="90%" destroy-on-close>
  377. <SelectMaterial :isNeRawMaterial="'1'" @selectMaterial="selectMaterial"></SelectMaterial>
  378. <template #footer>
  379. <el-button @click="bomDialog = false" size="defualt" v-debounce>取 消</el-button>
  380. </template>
  381. </el-dialog>
  382. <el-dialog title="导入产品" v-model="openExcelDialog" width="400">
  383. <div v-loading="excelLoading">
  384. <el-upload :action="actionUrl + '/productInfo/excelImportByEhsd'" :headers="headers" :on-success="handleSuccess" :on-progress="handleProgress"
  385. :show-file-list="false" :on-error="handleError" accept=".xlsx">
  386. <el-button type="primary">点击导入</el-button>
  387. </el-upload>
  388. </div>
  389. <template #footer>
  390. <el-button @click="openExcelDialog = false" size="default" v-debounce>取 消</el-button>
  391. </template>
  392. </el-dialog>
  393. </div>
  394. </template>
  395. <script setup>
  396. import byTable from "@/components/byTable/index";
  397. import byForm from "@/components/byForm/index";
  398. import treeList from "@/components/product/treeList";
  399. import SelectMaterial from "@/components/product/SelectMaterial.vue";
  400. import { getToken } from "@/utils/auth";
  401. const { proxy } = getCurrentInstance();
  402. const actionUrl = import.meta.env.VITE_APP_BASE_API;
  403. const loading = ref(false);
  404. const submitLoading = ref(false);
  405. const treeData = ref([]);
  406. const treeDataOne = ref([]);
  407. const treeListData = ref([]);
  408. const technologyData = ref([]);
  409. const companyData = ref([]);
  410. const currencyData = computed(
  411. () => proxy.useUserStore().allDict["account_currency"]
  412. );
  413. const packAskData = computed(() => proxy.useUserStore().allDict["pack_ask"]);
  414. const foldWayData = computed(() => proxy.useUserStore().allDict["fold_way"]);
  415. const headers = ref({ Authorization: "Bearer " + getToken() });
  416. const uploadData = ref({});
  417. const tableHeight = ref(0);
  418. const getTableHeight = () => {
  419. tableHeight.value = window.innerHeight - 245;
  420. };
  421. getTableHeight();
  422. window.addEventListener("resize", () => {
  423. getTableHeight();
  424. });
  425. const sourceList = ref({
  426. data: [],
  427. pagination: {
  428. total: 3,
  429. pageNum: 1,
  430. pageSize: 10,
  431. type: "",
  432. productClassifyId: "",
  433. keyword: "",
  434. definition: "1",
  435. companyId: "",
  436. },
  437. });
  438. const dialogVisible = ref(false);
  439. const openExcelDialog = ref(false);
  440. const excelLoading = ref(false);
  441. const modalType = ref("add");
  442. const rules = ref({
  443. companyId: [{ required: true, message: "请选择归属公司", trigger: "change" }],
  444. productClassifyId: [
  445. { required: true, message: "请选择产品分类", trigger: "change" },
  446. ],
  447. name: [{ required: true, message: "请输入产品名称", trigger: "blur" }],
  448. customCode: [{ required: true, message: "请输入产品编号", trigger: "blur" }],
  449. length: [{ required: true, message: "请输入长 (cm)", trigger: "blur" }],
  450. width: [{ required: true, message: "请输入宽 (cm)", trigger: "blur" }],
  451. height: [{ required: true, message: "请输入高 (cm)", trigger: "blur" }],
  452. technologyId: [
  453. { required: true, message: "请选择生产工艺", trigger: "change" },
  454. ],
  455. rawMaterialId: [
  456. { required: true, message: "请选择原材料", trigger: "change" },
  457. ],
  458. quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
  459. remark: [{ required: true, message: "请输入备注", trigger: "blur" }],
  460. });
  461. const props = defineProps({
  462. selectStatus: Boolean,
  463. });
  464. const selectConfig = computed(() => [
  465. {
  466. label: "业务公司",
  467. prop: "companyId",
  468. data: companyData.value,
  469. },
  470. ]);
  471. const config = computed(() => {
  472. return [
  473. {
  474. attrs: {
  475. label: "图片",
  476. slot: "pic",
  477. align: "center",
  478. width: 80,
  479. },
  480. },
  481. {
  482. attrs: {
  483. label: "业务公司",
  484. prop: "companyName",
  485. width: 150,
  486. },
  487. },
  488. {
  489. attrs: {
  490. label: "产品分类",
  491. prop: "classifyName",
  492. "min-width": 200,
  493. },
  494. },
  495. {
  496. attrs: {
  497. label: "产品编码",
  498. prop: "customCode",
  499. width: 180,
  500. },
  501. },
  502. {
  503. attrs: {
  504. label: "产品名称",
  505. slot: "name",
  506. "min-width": 200,
  507. },
  508. },
  509. // {
  510. // attrs: {
  511. // label: "产品英文名",
  512. // prop: "nameEnglish",
  513. // "min-width": 120,
  514. // },
  515. // },
  516. // {
  517. // attrs: {
  518. // label: "产品规格",
  519. // prop: "spec",
  520. // width: 120,
  521. // },
  522. // },
  523. {
  524. attrs: {
  525. label: "尺寸 (cm)",
  526. slot: "size",
  527. width: 130,
  528. },
  529. },
  530. {
  531. attrs: {
  532. label: "颜色",
  533. prop: "color",
  534. width: 100,
  535. },
  536. },
  537. {
  538. attrs: {
  539. label: "净重",
  540. prop: "netWeight",
  541. width: 100,
  542. },
  543. render(val) {
  544. if (val) {
  545. return val + " kg";
  546. }
  547. },
  548. },
  549. {
  550. attrs: {
  551. label: "销售价",
  552. prop: "price",
  553. width: 100,
  554. },
  555. render(val) {
  556. return proxy.moneyFormat(val, 2);
  557. },
  558. },
  559. // {
  560. // attrs: {
  561. // label: "海关编码",
  562. // prop: "hsCode",
  563. // width: 100,
  564. // },
  565. // },
  566. {
  567. attrs: {
  568. label: "原材料编码",
  569. prop: "rawMaterialCode",
  570. width: 120,
  571. },
  572. },
  573. {
  574. attrs: {
  575. label: "原材料",
  576. prop: "rawMaterialName",
  577. "min-width": 300,
  578. },
  579. },
  580. {
  581. attrs: {
  582. label: "操作",
  583. width: "160",
  584. align: "center",
  585. fixed: "right",
  586. },
  587. renderHTML(row) {
  588. return [
  589. // {
  590. // attrs: {
  591. // label: "选择",
  592. // type: "primary",
  593. // text: true,
  594. // },
  595. // el: "button",
  596. // click() {
  597. // clickSelect(row);
  598. // },
  599. // }
  600. {
  601. attrs: {
  602. label: "BOM",
  603. type: "primary",
  604. text: true,
  605. },
  606. el: "button",
  607. click() {
  608. bomSetting(row);
  609. },
  610. },
  611. {
  612. attrs: {
  613. label: "修改",
  614. type: "primary",
  615. text: true,
  616. },
  617. el: "button",
  618. click() {
  619. getDtl(row);
  620. },
  621. },
  622. {
  623. attrs: {
  624. label: "删除",
  625. type: "danger",
  626. text: true,
  627. },
  628. el: "button",
  629. click() {
  630. proxy
  631. .msgConfirm()
  632. .then((res) => {
  633. proxy
  634. .post("/productInfo/delete", {
  635. id: row.id,
  636. })
  637. .then((res) => {
  638. proxy.msgTip("删除成功", 1);
  639. getList();
  640. });
  641. })
  642. .catch((err) => {});
  643. },
  644. },
  645. ];
  646. },
  647. },
  648. ];
  649. });
  650. const getPriceData = () => {
  651. if (
  652. formData.data["length"] &&
  653. formData.data.width &&
  654. formData.data.technologyId &&
  655. formData.data.rawMaterialId
  656. ) {
  657. proxy
  658. .post("/productInfo/getProductPrice", {
  659. id: formData.data.id || "",
  660. length: formData.data["length"],
  661. width: formData.data.width,
  662. technologyId: formData.data.technologyId,
  663. rawMaterialId: formData.data.rawMaterialId,
  664. })
  665. .then((res) => {
  666. formData.data.price = res.price;
  667. });
  668. }
  669. };
  670. const formData = reactive({
  671. data: {},
  672. bomData: {},
  673. });
  674. const formOption = reactive({
  675. disabled: false,
  676. inline: true,
  677. labelWidth: 100,
  678. itemWidth: 100,
  679. });
  680. const formDom = ref(null);
  681. const formConfig = computed(() => {
  682. return [
  683. {
  684. type: "title1",
  685. title: "基本信息",
  686. },
  687. {
  688. type: "treeSelect",
  689. prop: "companyId",
  690. label: "业务公司",
  691. data: treeDataOne.value,
  692. propsTreeLabel: "deptName",
  693. propsTreeValue: "deptId",
  694. itemWidth: 50,
  695. },
  696. {
  697. type: "treeSelect",
  698. prop: "productClassifyId",
  699. label: "产品分类",
  700. data: treeData.value,
  701. itemWidth: 50,
  702. disabled: false,
  703. },
  704. {
  705. type: "input",
  706. prop: "name",
  707. label: "产品名称",
  708. itemWidth: 50,
  709. disabled: false,
  710. },
  711. {
  712. type: "slot",
  713. slotName: "nameEnglish",
  714. label: "英文名",
  715. itemWidth: 50,
  716. },
  717. {
  718. type: "input",
  719. prop: "customCode",
  720. label: "产品编号",
  721. itemWidth: 50,
  722. disabled: false,
  723. },
  724. {
  725. type: "number",
  726. prop: "price",
  727. label: "销售价",
  728. precision: 2,
  729. min: 0.01,
  730. controls: false,
  731. itemWidth: 50,
  732. disabled: false,
  733. },
  734. {
  735. type: "uploadImg",
  736. // listType: "picture-card",
  737. // limit: 1,
  738. // accept: ".gif, .jpeg, .jpg, .png",
  739. prop: "fileList",
  740. imgProp: "imageUrl",
  741. label: "产品缩略图",
  742. itemWidth: 50,
  743. },
  744. {
  745. type: "input",
  746. prop: "hsCode",
  747. label: "海关编码",
  748. itemWidth: 50,
  749. disabled: false,
  750. },
  751. {
  752. type: "slot",
  753. slotName: "productionFileOne",
  754. label: "产品原图",
  755. itemWidth: 100,
  756. },
  757. {
  758. type: "upload",
  759. listType: "text",
  760. accept: "",
  761. limit: 1,
  762. prop: "prodFileList",
  763. label: "生产文件",
  764. },
  765. // {
  766. // type: "slot",
  767. // slotName: "productionFile",
  768. // label: "生产文件",
  769. // itemWidth: 100,
  770. // },
  771. {
  772. type: "title1",
  773. title: "主材",
  774. },
  775. {
  776. type: "select",
  777. prop: "rawMaterialId",
  778. label: "原材料",
  779. itemWidth: 50,
  780. data: rawMaterialData.value,
  781. filterable: true,
  782. disabled: false,
  783. fn: (val) => {
  784. // let current = rawMaterialData.value.find((x) => x.value == val);
  785. // if (current) {
  786. // formData.data.price = Number(
  787. // parseFloat(
  788. // current["length"] * current.width * current.price
  789. // ).toFixed(2)
  790. // );
  791. // }
  792. // getPriceData();
  793. },
  794. },
  795. // {
  796. // type: "selectInput",
  797. // prop: "price",
  798. // selectProp: "currency",
  799. // label: "销售价",
  800. // itemWidth: 50,
  801. // disabledSelect: true,
  802. // data: currencyData.value,
  803. // disabled: true,
  804. // },
  805. // {
  806. // type: "select",
  807. // prop: "technologyId",
  808. // label: "生产工艺",
  809. // itemWidth: 50,
  810. // data: technologyData.value,
  811. // filterable: true,
  812. // disabled: false,
  813. // fn: () => {
  814. // // getPriceData();
  815. // },
  816. // },
  817. // {
  818. // type: "input",
  819. // prop: "spec",
  820. // label: "规格型号",
  821. // itemWidth: 50,
  822. // disabled: false,
  823. // },
  824. {
  825. type: "slot",
  826. slotName: "color",
  827. prop: "",
  828. label: "",
  829. itemWidth: 50,
  830. disabled: false,
  831. },
  832. {
  833. type: "slot",
  834. slotName: "size",
  835. prop: "",
  836. label: "",
  837. itemWidth: 50,
  838. disabled: false,
  839. },
  840. // {
  841. // type: "select",
  842. // prop: "innerPackMethod",
  843. // label: "内包装方式",
  844. // required: true,
  845. // itemWidth: 50,
  846. // multiple: true,
  847. // data: innerMethon.value,
  848. // filterable: true,
  849. // placeholder: "内包装方式",
  850. // style: {
  851. // width: "100%",
  852. // },
  853. // disabled: false,
  854. // },
  855. // {
  856. // type: "select",
  857. // prop: "outerPackMethod",
  858. // label: "外包装方式",
  859. // required: true,
  860. // itemWidth: 50,
  861. // multiple: true,
  862. // data: outsideMethon.value,
  863. // filterable: true,
  864. // placeholder: "外包装方式",
  865. // style: {
  866. // width: "100%",
  867. // },
  868. // disabled: false,
  869. // },
  870. {
  871. type: "number",
  872. prop: "netWeight",
  873. label: "净重(kg)",
  874. precision: 2,
  875. min: 0,
  876. controls: false,
  877. itemWidth: 50,
  878. },
  879. // {
  880. // type: "input",
  881. // itemType: "textarea",
  882. // prop: "remark",
  883. // label: "备注",
  884. // itemWidth: 100,
  885. // },
  886. {
  887. type: "title1",
  888. title: "辅材",
  889. },
  890. {
  891. type: "slot",
  892. slotName: "materialDetail",
  893. },
  894. {
  895. type: "title1",
  896. title: "附加工艺要求",
  897. },
  898. {
  899. type: "slot",
  900. slotName: "technology",
  901. },
  902. ];
  903. });
  904. const getList = (req) => {
  905. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  906. loading.value = true;
  907. proxy.post("/productInfo/page", sourceList.value.pagination).then(
  908. (res) => {
  909. sourceList.value.data = res.rows.map((x) => ({
  910. ...x,
  911. fileList: [],
  912. }));
  913. sourceList.value.pagination.total = res.total;
  914. setTimeout(() => {
  915. loading.value = false;
  916. }, 200);
  917. let productIdList = res.rows.map((x) => x.id);
  918. // 请求文件数据并回显
  919. if (productIdList.length > 0) {
  920. // proxy.getFile(productIdList, sourceList.value.data, "id");
  921. proxy
  922. .post("/fileInfo/getList", { businessIdList: productIdList })
  923. .then((fileObj) => {
  924. for (let i = 0; i < sourceList.value.data.length; i++) {
  925. const ele = sourceList.value.data[i];
  926. for (const key in fileObj) {
  927. if (
  928. ele.id == key &&
  929. fileObj[ele.id] &&
  930. fileObj[ele.id].length > 0
  931. ) {
  932. ele.fileList = fileObj[ele.id].filter(
  933. (x) => x.businessType == "0"
  934. );
  935. }
  936. }
  937. }
  938. });
  939. }
  940. },
  941. (err) => {
  942. loading.value = false;
  943. }
  944. );
  945. };
  946. const getDict = () => {
  947. proxy
  948. .get("/tenantDept/list", {
  949. pageNum: 1,
  950. pageSize: 9999,
  951. keyword: "",
  952. tenantId: proxy.useUserStore().user.tenantId,
  953. type: 0,
  954. })
  955. .then((res) => {
  956. companyData.value = res.data.map((x) => ({
  957. ...x,
  958. label: x.deptName,
  959. value: x.deptId,
  960. }));
  961. treeDataOne.value = proxy.handleTree(res.data, "deptId");
  962. });
  963. };
  964. getDict();
  965. const treeChange = (e) => {
  966. if (e.id != undefined) {
  967. sourceList.value.pagination.productClassifyId = e.id;
  968. getList({ productClassifyId: e.id });
  969. }
  970. };
  971. const productCustomInfoListData = ref([
  972. {
  973. type: 1,
  974. isCheck: 0,
  975. isCheckBox: false,
  976. fileList: [],
  977. remark: "",
  978. },
  979. {
  980. type: 2,
  981. isCheck: 0,
  982. isCheckBox: false,
  983. fileList: [],
  984. remark: "",
  985. },
  986. {
  987. type: 3,
  988. isCheck: 0,
  989. isCheckBox: false,
  990. fileList: [],
  991. remark: "",
  992. },
  993. ]);
  994. const openModal = () => {
  995. dialogVisible.value = true;
  996. modalType.value = "add";
  997. formData.data = {
  998. definition: "1",
  999. fileList: [],
  1000. currency: "",
  1001. prodFileList: [],
  1002. isFold: 0,
  1003. isCustomized: 0,
  1004. packAsk: [],
  1005. productBomDetailList: [],
  1006. productCustomInfoList: productCustomInfoListData.value,
  1007. };
  1008. // if (currencyData.value && currencyData.value.length > 0) {
  1009. // formData.data.currency = currencyData.value[0].dictKey;
  1010. // }
  1011. };
  1012. const openExcel = () => {
  1013. openExcelDialog.value = true;
  1014. };
  1015. const submitForm = () => {
  1016. formDom.value.handleSubmit((valid) => {
  1017. if (!formData.data.fileList.length > 0) {
  1018. return proxy.msgTip("请上传图片", 2);
  1019. }
  1020. // if(!formData.data.productBomDetailList.length>0){
  1021. // }
  1022. // formData.data.fileList = formData.data.fileList.map((x) => ({
  1023. // id: x.id,
  1024. // fileName: x.fileName,
  1025. // fileUrl: x.fileUrl,
  1026. // }));
  1027. for (let i = 0; i < formData.data.productCustomInfoList.length; i++) {
  1028. const ele = formData.data.productCustomInfoList[i];
  1029. ele.isCheck = ele.isCheckBox ? 1 : 0;
  1030. if (ele.isCheckBox) {
  1031. if (!(ele.fileList && ele.fileList.length > 0)) {
  1032. return proxy.msgTip(`请上传${getLabel(ele.type)}附件`, 2);
  1033. }
  1034. }
  1035. }
  1036. if (formData.data.packAsk && formData.data.packAsk.length > 0) {
  1037. formData.data.packAsk = formData.data.packAsk.join(",");
  1038. }
  1039. submitLoading.value = true;
  1040. proxy.post("/productInfo/" + modalType.value, formData.data).then(
  1041. (res) => {
  1042. proxy.msgTip("操作成功", 1);
  1043. dialogVisible.value = false;
  1044. submitLoading.value = false;
  1045. getList();
  1046. },
  1047. (err) => {
  1048. submitLoading.value = false;
  1049. if (formData.data.packAsk) {
  1050. formData.data.packAsk = formData.data.packAsk.split(",");
  1051. }
  1052. }
  1053. );
  1054. });
  1055. };
  1056. const getTreeList = () => {
  1057. proxy
  1058. .post("/productClassify/tree", { parentId: "", name: "", definition: "1" })
  1059. .then((message) => {
  1060. treeListData.value = [
  1061. {
  1062. id: "",
  1063. label: "全部",
  1064. parentId: "",
  1065. children: message,
  1066. },
  1067. ];
  1068. treeData.value = message;
  1069. });
  1070. };
  1071. const getTechnologyData = () => {
  1072. proxy.post("/technology/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  1073. technologyData.value = res.rows;
  1074. });
  1075. };
  1076. const getDtl = (row) => {
  1077. modalType.value = "edit";
  1078. proxy.post("/productInfo/detail", { id: row.id }).then((res) => {
  1079. formData.data = res;
  1080. formData.data.productBomDetailList =
  1081. formData.data.productBomDetailList.filter((x) => x.type == 2);
  1082. if (
  1083. formData.data.productCustomInfoList &&
  1084. formData.data.productCustomInfoList.length > 0
  1085. ) {
  1086. formData.data.productCustomInfoList.forEach((x) => {
  1087. x.isCheckBox = x.isCheck == 1;
  1088. if (!x.fileList) {
  1089. x.fileList = [];
  1090. } else {
  1091. x.fileList = x.fileList.map((x) => ({
  1092. ...x,
  1093. url: x.fileUrl,
  1094. name: x.fileName,
  1095. }));
  1096. }
  1097. });
  1098. }
  1099. // let list = [];
  1100. // for (let i = 0; i < productCustomInfoListData.value.length; i++) {
  1101. // const iele = productCustomInfoListData.value[i];
  1102. // let current = formData.data.productCustomInfoList.find(
  1103. // (x) => x.type == iele.type
  1104. // );
  1105. // if (current) {
  1106. // list.push({
  1107. // ...iele,
  1108. // ...current,
  1109. // isCheckBox: current.isCheck == 1,
  1110. // fileList: current.fileList.map((x) => ({
  1111. // ...x,
  1112. // url: x.fileUrl,
  1113. // name: x.fileName,
  1114. // })),
  1115. // });
  1116. // } else {
  1117. // list.push(iele);
  1118. // }
  1119. // }
  1120. // formData.data.productCustomInfoList = list;
  1121. if (formData.data.packAsk) {
  1122. formData.data.packAsk = formData.data.packAsk.split(",");
  1123. }
  1124. formData.data.fileList = row.fileList.map((x) => ({
  1125. ...x,
  1126. url: x.fileUrl,
  1127. name: x.fileName,
  1128. }));
  1129. if (formData.data.fileList.length > 0) {
  1130. formData.data.imageUrl = formData.data.fileList[0].fileUrl;
  1131. }
  1132. proxy
  1133. .post("/fileInfo/getList", { businessIdList: [row.id] })
  1134. .then((fileObj) => {
  1135. if (fileObj[row.id] && fileObj[row.id].length > 0) {
  1136. formData.data.prodFileList = fileObj[row.id]
  1137. .filter((x) => x.businessType == "2")
  1138. .map((item) => {
  1139. return {
  1140. ...item,
  1141. name: item.fileName,
  1142. url: item.fileUrl,
  1143. };
  1144. });
  1145. } else {
  1146. formData.data.prodFileList = [];
  1147. }
  1148. });
  1149. dialogVisible.value = true;
  1150. });
  1151. };
  1152. const rawMaterialData = ref([]);
  1153. const getRawMaterialData = () => {
  1154. proxy.post("/productInfo/page", { productClassifyId: 100 }).then((res) => {
  1155. rawMaterialData.value = res.rows.map((x) => ({
  1156. ...x,
  1157. label:
  1158. x.name +
  1159. "," +
  1160. x.customCode +
  1161. "," +
  1162. `${x["length"]}*${x.width}*${x.height}(cm)` +
  1163. "," +
  1164. x.color,
  1165. value: x.id,
  1166. }));
  1167. });
  1168. };
  1169. getRawMaterialData();
  1170. const bomDialog = ref(false);
  1171. const bomFormDom = ref(null);
  1172. const bomFormOption = reactive({
  1173. disabled: false,
  1174. inline: true,
  1175. labelWidth: 100,
  1176. itemWidth: 100,
  1177. });
  1178. const bomFormConfig = computed(() => {
  1179. return [
  1180. // {
  1181. // type: "title1",
  1182. // title: "BOM 信息",
  1183. // },
  1184. // {
  1185. // type: "select",
  1186. // prop: "rawMaterialId",
  1187. // label: "原材料",
  1188. // itemWidth: 100,
  1189. // data: rawMaterialData.value,
  1190. // filterable: true,
  1191. // disabled: false,
  1192. // },
  1193. // {
  1194. // type: "slot",
  1195. // slotName: "accessories",
  1196. // label: "包材辅料",
  1197. // itemWidth: 100,
  1198. // },
  1199. // {
  1200. // type: "title1",
  1201. // title: "生产工序",
  1202. // },
  1203. {
  1204. type: "slot",
  1205. slotName: "detail",
  1206. label: "",
  1207. },
  1208. ];
  1209. });
  1210. const bomRules = ref({
  1211. rawMaterialId: [
  1212. { required: true, message: "请选择原材料", trigger: "change" },
  1213. ],
  1214. quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
  1215. });
  1216. const bomSetting = (row) => {
  1217. bomDialog.value = true;
  1218. proxy.post("/productBomInfo/detail", { id: row.id }).then((res) => {
  1219. formData.bomData = {
  1220. name: row.name,
  1221. code: row.customCode,
  1222. id: res.id,
  1223. rawMaterialId: res.rawMaterialId,
  1224. productBomDetailList: [],
  1225. processesList: res.processesList,
  1226. };
  1227. if (res.productBomDetailList && res.productBomDetailList.length > 0) {
  1228. formData.bomData.productBomDetailList = res.productBomDetailList.filter(
  1229. (x) => x.type == 2
  1230. );
  1231. } else {
  1232. formData.bomData.productBomDetailList = [];
  1233. }
  1234. });
  1235. };
  1236. const submitBomForm = () => {
  1237. bomFormDom.value.handleSubmit((valid) => {
  1238. if (!formData.bomData.productBomDetailList.length > 0) {
  1239. return proxy.msgTip("请选择包材辅料", 2);
  1240. }
  1241. formData.bomData.productBomDetailList.push({
  1242. materialId: formData.bomData.rawMaterialId,
  1243. type: 1,
  1244. quantity: 1,
  1245. });
  1246. submitLoading.value = true;
  1247. proxy.post("/productBomInfo/edit", formData.bomData).then(
  1248. (res) => {
  1249. proxy.msgTip("操作成功", 1);
  1250. getList();
  1251. bomDialog.value = false;
  1252. submitLoading.value = false;
  1253. },
  1254. (err) => {
  1255. submitLoading.value = false;
  1256. }
  1257. );
  1258. });
  1259. };
  1260. const openSelectMaterial = ref(false);
  1261. const openType = ref(-1);
  1262. const clickOpenSelectMaterial = (type) => {
  1263. openType.value = type;
  1264. openSelectMaterial.value = true;
  1265. };
  1266. const selectMaterial = (row) => {
  1267. if (openType.value == 1) {
  1268. let flag = formData.data.productBomDetailList.some(
  1269. (x) => x.materialId == row.id
  1270. );
  1271. if (!flag) {
  1272. formData.data.productBomDetailList.push({
  1273. type: 2,
  1274. materialName: row.name,
  1275. materialCode: row.customCode,
  1276. materialId: row.id,
  1277. quantity: null,
  1278. });
  1279. proxy.msgTip("选择成功");
  1280. } else {
  1281. proxy.msgTip("该物料已选择", 2);
  1282. }
  1283. } else {
  1284. let flag = formData.bomData.productBomDetailList.some(
  1285. (x) => x.materialId == row.id
  1286. );
  1287. if (!flag) {
  1288. formData.bomData.productBomDetailList.push({
  1289. type: 2,
  1290. materialName: row.name,
  1291. materialCode: row.customCode,
  1292. materialId: row.id,
  1293. quantity: null,
  1294. });
  1295. proxy.msgTip("选择成功");
  1296. } else {
  1297. proxy.msgTip("该物料已选择", 2);
  1298. }
  1299. }
  1300. };
  1301. const handleRemove = (index, type) => {
  1302. if (type == 1) {
  1303. formData.data.productBomDetailList.splice(index, 1);
  1304. } else {
  1305. formData.bomData.productBomDetailList.splice(index, 1);
  1306. }
  1307. };
  1308. const handleClickFile = (file) => {
  1309. window.open(file.fileUrl, "_blank");
  1310. };
  1311. const handleProgress = () => {
  1312. excelLoading.value = true;
  1313. };
  1314. const handleError = (err) => {
  1315. proxy.msgTip(`${err},请重试`, 2);
  1316. openExcelDialog.value = false;
  1317. excelLoading.value = false;
  1318. };
  1319. const handleSuccess = (res) => {
  1320. if (res.code != 200) {
  1321. return proxy.msgTip(`${err},请重试`, 2);
  1322. } else {
  1323. proxy.msgTip(`导入成功`, 1);
  1324. openExcelDialog.value = false;
  1325. excelLoading.value = false;
  1326. getList();
  1327. }
  1328. };
  1329. const clickSelect = (item) => {
  1330. proxy.$emit("selectProduct", item);
  1331. };
  1332. const handleClickUpload = async (att, flag) => {
  1333. let res = null;
  1334. let path = "";
  1335. if (flag) {
  1336. proxy.msgTip("请稍后", 2);
  1337. res = await proxy.post("/fileService/createTempFolder");
  1338. if (res && res.path) {
  1339. formData.data[att] = res.path;
  1340. path = res.path;
  1341. }
  1342. } else {
  1343. path = formData.data[att];
  1344. }
  1345. let a = document.createElement("a");
  1346. a.href = "printer://" + "ftp://121.37.194.75/" + path + "/";
  1347. a.style.display = "none";
  1348. document.body.appendChild(a);
  1349. a.click();
  1350. document.body.removeChild(a);
  1351. };
  1352. getTechnologyData();
  1353. getTreeList();
  1354. getList();
  1355. const exportExcel = () => {
  1356. proxy.msgTip("正在导出,请稍后", 2);
  1357. proxy
  1358. .postTwo("/productInfo/exportExcel", sourceList.value.pagination)
  1359. .then((res) => {
  1360. proxy.downloadFile(res, "产品数据.xlsx");
  1361. });
  1362. };
  1363. const handleBeforeUploadOne = async (file, index) => {
  1364. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  1365. file.id = res.id;
  1366. file.fileUrl = res.fileUrl;
  1367. uploadData.value = res.uploadBody;
  1368. formData.data.productCustomInfoList[index].fileData = res;
  1369. return true;
  1370. };
  1371. const handleSuccessOne = (index) => {
  1372. if (
  1373. formData.data.productCustomInfoList[index].fileData &&
  1374. formData.data.productCustomInfoList[index].fileData.fileUrl
  1375. ) {
  1376. let file = formData.data.productCustomInfoList[index].fileData;
  1377. formData.data.productCustomInfoList[index].fileList.push({
  1378. id: file.id,
  1379. fileName: file.fileName,
  1380. name: file.fileName,
  1381. url: file.fileUrl,
  1382. fileUrl: file.fileUrl,
  1383. });
  1384. formData.data.productCustomInfoList[index].fileData = {};
  1385. }
  1386. };
  1387. const handleRemoveFile = (file, index) => {
  1388. let sonIndex = formData.data.productCustomInfoList[index].fileList.findIndex(
  1389. (x) => x.id == file.id || x.id == file.raw.id
  1390. );
  1391. if (sonIndex > -1) {
  1392. formData.data.productCustomInfoList[index].fileList.splice(sonIndex, 1);
  1393. }
  1394. };
  1395. const onPreviewFile = (file) => {
  1396. if (file && file.fileUrl) {
  1397. window.open(file.fileUrl, "_blank");
  1398. } else {
  1399. window.open(file.raw.fileUrl, "_blank");
  1400. }
  1401. };
  1402. let obj = {
  1403. 1: "定制刀模",
  1404. 2: "定制纹路",
  1405. 3: "定制模具",
  1406. };
  1407. const getLabel = (type) => {
  1408. return obj[type];
  1409. };
  1410. </script>
  1411. <style lang="scss" scoped>
  1412. .box {
  1413. padding: 10px;
  1414. display: flex;
  1415. justify-content: space-between;
  1416. .tree {
  1417. width: 300px;
  1418. }
  1419. .content {
  1420. width: calc(100% - 310px);
  1421. }
  1422. }
  1423. .pic {
  1424. object-fit: contain;
  1425. width: 50px;
  1426. height: 50px;
  1427. cursor: pointer;
  1428. vertical-align: middle;
  1429. }
  1430. .table {
  1431. border-collapse: collapse;
  1432. border-spacing: 0;
  1433. td {
  1434. text-align: center;
  1435. padding: 2px 4px;
  1436. // padding: 5px 10px;
  1437. }
  1438. }
  1439. .small-title {
  1440. padding-left: 15px;
  1441. margin-bottom: 10px;
  1442. color: #3366ff;
  1443. font-size: 14px;
  1444. }
  1445. :deep(.el-checkbox) {
  1446. margin-right: 0px;
  1447. }
  1448. </style>