MaterialModal.vue 68 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775
  1. <template>
  2. <j-modal
  3. :title="title"
  4. :width="width"
  5. :visible="visible"
  6. :confirmLoading="confirmLoading"
  7. v-bind:prefixNo="prefixNo"
  8. fullscreen
  9. switchHelp
  10. switchFullscreen
  11. @cancel="handleCancel"
  12. :id="prefixNo"
  13. :style="modalStyle"
  14. >
  15. <template slot="footer">
  16. <a-button key="back" @click="handleCancel">取消</a-button>
  17. <a-button type="primary" v-if="showOkFlag" :loading="confirmLoading" @click="handleOk">保存(Ctrl+S)</a-button>
  18. </template>
  19. <a-spin :spinning="confirmLoading">
  20. <a-form :form="form">
  21. <a-tabs default-active-key="1" size="small">
  22. <a-tab-pane key="1" tab="基本信息" id="materialHeadModal" forceRender>
  23. <a-row class="form-row" :gutter="24">
  24. <a-col :md="6" :sm="24">
  25. <a-form-item
  26. :labelCol="labelCol"
  27. :wrapperCol="wrapperCol"
  28. label="名称"
  29. data-step="1"
  30. data-title="名称"
  31. data-intro="名称必填,可以重复"
  32. >
  33. <a-input
  34. placeholder="请输入名称"
  35. v-decorator.trim="['name', validatorRules.name]"
  36. @change="handleNameChange"
  37. />
  38. </a-form-item>
  39. </a-col>
  40. <a-col :md="6" :sm="24">
  41. <a-form-item
  42. :labelCol="labelCol"
  43. :wrapperCol="wrapperCol"
  44. label="规格"
  45. data-step="2"
  46. data-title="规格"
  47. data-intro="规格不必填,比如:10克"
  48. >
  49. <a-input placeholder="请输入规格" v-decorator.trim="['standard', validatorRules.standard]" />
  50. </a-form-item>
  51. </a-col>
  52. <a-col :md="6" :sm="24">
  53. <a-form-item
  54. :labelCol="labelCol"
  55. :wrapperCol="wrapperCol"
  56. label="型号"
  57. data-step="3"
  58. data-title="型号"
  59. data-intro="型号是比规格更小的属性,比如:RX-01"
  60. >
  61. <a-input placeholder="请输入型号" v-decorator.trim="['model', validatorRules.model]" />
  62. </a-form-item>
  63. </a-col>
  64. <a-col :md="6" :sm="24">
  65. <a-form-item
  66. :labelCol="labelCol"
  67. :wrapperCol="wrapperCol"
  68. label="单位"
  69. data-step="4"
  70. data-title="单位"
  71. data-intro="此处支持单个单位和多单位,勾选多单位就可以切换到多单位的下拉框,多单位需要先在【多单位】页面进行录入。
  72. 比如牛奶有瓶和箱两种单位,12瓶=1箱,这就构成了多单位,多单位中有个换算比例"
  73. >
  74. <a-row class="form-row" :gutter="24">
  75. <a-col :lg="15" :md="15" :sm="24" style="padding: 0px 0px 0px 12px">
  76. <a-input
  77. placeholder="输入单位"
  78. v-if="!unitChecked"
  79. v-decorator.trim="['unit', validatorRules.unit]"
  80. @change="onlyUnitOnChange"
  81. />
  82. <a-select
  83. :value="unitList"
  84. placeholder="选择多单位"
  85. v-decorator="['unitId', validatorRules.unitId]"
  86. @change="manyUnitOnChange"
  87. showSearch
  88. optionFilterProp="children"
  89. v-if="unitChecked"
  90. :dropdownMatchSelectWidth="false"
  91. >
  92. <div slot="dropdownRender" slot-scope="menu">
  93. <v-nodes :vnodes="menu" />
  94. <a-divider style="margin: 4px 0" />
  95. <div
  96. style="padding: 4px 8px; cursor: pointer"
  97. @mousedown="(e) => e.preventDefault()"
  98. @click="addUnit"
  99. >
  100. <a-icon type="plus" /> 新增多单位
  101. </div>
  102. </div>
  103. <a-select-option v-for="(item, index) in unitList" :key="index" :value="item.id">
  104. {{ item.name }}
  105. </a-select-option>
  106. </a-select>
  107. </a-col>
  108. <a-col :lg="9" :md="9" :sm="24" style="padding: 0px; text-align: center">
  109. <a-checkbox :checked="unitChecked" @change="unitOnChange">多单位</a-checkbox>
  110. </a-col>
  111. </a-row>
  112. </a-form-item>
  113. </a-col>
  114. </a-row>
  115. <a-row class="form-row" :gutter="24">
  116. <a-col :md="6" :sm="24">
  117. <a-form-item
  118. :labelCol="labelCol"
  119. :wrapperCol="wrapperCol"
  120. label="颜色"
  121. data-step="5"
  122. data-title="颜色"
  123. data-intro="请填写商品的颜色,如果是多属性商品可以不填(下面有多属性开关)"
  124. >
  125. <a-input placeholder="请输入颜色" v-decorator.trim="['color']" />
  126. </a-form-item>
  127. </a-col>
  128. <a-col :md="6" :sm="24">
  129. <a-form-item
  130. :labelCol="labelCol"
  131. :wrapperCol="wrapperCol"
  132. label="品牌"
  133. data-step="6"
  134. data-title="品牌"
  135. data-intro="请填写商品的品牌,方便区别不同品牌的商品"
  136. >
  137. <a-input placeholder="请输入品牌" v-decorator.trim="['brand']" />
  138. </a-form-item>
  139. </a-col>
  140. <a-col :md="6" :sm="24">
  141. <a-form-item
  142. :labelCol="labelCol"
  143. :wrapperCol="wrapperCol"
  144. label="助记码"
  145. data-step="7"
  146. data-title="助记码"
  147. data-intro="助记码自动生成,助记码是商品名称的首字母缩写"
  148. >
  149. <a-input placeholder="" v-decorator.trim="['mnemonic']" :readOnly="true" />
  150. </a-form-item>
  151. </a-col>
  152. <a-col :md="6" :sm="24">
  153. <a-form-item
  154. :labelCol="labelCol"
  155. :wrapperCol="wrapperCol"
  156. label="类别"
  157. data-step="8"
  158. data-title="类别"
  159. data-intro="类别需要在【商品类别】页面进行录入,录入之后在此处进行调用"
  160. >
  161. <a-tree-select
  162. style="width: 100%"
  163. :dropdownStyle="{ maxHeight: '200px', overflow: 'auto' }"
  164. allow-clear
  165. :treeData="categoryTree"
  166. v-decorator="['categoryId', validatorRules.categoryId]"
  167. placeholder="请选择类别"
  168. >
  169. </a-tree-select>
  170. </a-form-item>
  171. </a-col>
  172. </a-row>
  173. <a-row class="form-row" :gutter="24">
  174. <a-col :md="6" :sm="24">
  175. <a-form-item
  176. :labelCol="labelCol"
  177. :wrapperCol="wrapperCol"
  178. label="基础重量"
  179. data-step="9"
  180. data-title="基础重量"
  181. data-intro="请填写基本单位对应的重量,用于计算按重量分摊费用时单据中各行商品分摊的费用成本"
  182. >
  183. <a-input-number style="width: 100%" placeholder="请输入基础重量(kg)" v-decorator.trim="['weight']" />
  184. </a-form-item>
  185. </a-col>
  186. <a-col :md="6" :sm="24">
  187. <a-form-item
  188. :labelCol="labelCol"
  189. :wrapperCol="wrapperCol"
  190. label="序列号"
  191. data-step="10"
  192. data-title="序列号"
  193. data-intro="此处是商品的序列号开关,如果选择了有,则在采购入库单据需要录入该商品的序列号,在销售出库单据需要选择该商品的序列号进行出库"
  194. >
  195. <a-tooltip title="如果选择为有,则在采购入库单需要录入该商品的序列号">
  196. <a-select placeholder="有无序列号" v-decorator="['enableSerialNumber']">
  197. <a-select-option value="1">有</a-select-option>
  198. <a-select-option value="0">无</a-select-option>
  199. </a-select>
  200. </a-tooltip>
  201. </a-form-item>
  202. </a-col>
  203. <a-col :md="6" :sm="24">
  204. <a-form-item
  205. :labelCol="labelCol"
  206. :wrapperCol="wrapperCol"
  207. label="系统SKU"
  208. data-step="11"
  209. data-title="系统SKU"
  210. data-intro="系统SKU"
  211. >
  212. <a-input placeholder="提交后自动生成" disabled v-decorator="['systemSku']" />
  213. </a-form-item>
  214. </a-col>
  215. <a-col :md="6" :sm="24">
  216. <a-form-item
  217. :labelCol="labelCol"
  218. :wrapperCol="wrapperCol"
  219. label="无动销提醒周期"
  220. data-step="12"
  221. data-title="无动销提醒周期"
  222. data-intro="无动销提醒周期"
  223. >
  224. <a-tooltip title="无动销提醒周期">
  225. <a-select placeholder="无动销提醒周期" v-decorator="['movingPinReminderCycle']">
  226. <a-select-option value="一周">一周</a-select-option>
  227. <a-select-option value="两周">两周</a-select-option>
  228. <a-select-option value="一个月">一个月</a-select-option>
  229. <a-select-option value="一季度">一季度</a-select-option>
  230. </a-select>
  231. </a-tooltip>
  232. </a-form-item>
  233. </a-col>
  234. <!-- <a-col :md="6" :sm="24">
  235. <a-form-item
  236. :labelCol="labelCol"
  237. :wrapperCol="wrapperCol"
  238. label="保质期"
  239. data-step="10"
  240. data-title="保质期"
  241. data-intro="保质期指的是商品的保质期(天),主要针对带生产日期的,此类商品一般有批号"
  242. >
  243. <a-input-number style="width: 100%" placeholder="请输入保质期(天)" v-decorator.trim="['expiryNum']" />
  244. </a-form-item>
  245. </a-col>
  246. <a-col :md="6" :sm="24">
  247. <a-form-item
  248. :labelCol="labelCol"
  249. :wrapperCol="wrapperCol"
  250. label="仓位货架"
  251. data-step="11"
  252. data-title="仓位货架"
  253. data-intro="仓位货架指的是仓库中的仓位和货架号,主要适用于仓库较大的场景,方便查找商品的准确位置"
  254. >
  255. <a-input style="width: 100%" placeholder="请输入仓位货架" v-decorator.trim="['position']" />
  256. </a-form-item>
  257. </a-col>
  258. <a-col :md="6" :sm="24">
  259. <a-form-item
  260. :labelCol="labelCol"
  261. :wrapperCol="wrapperCol"
  262. label="制造商"
  263. data-step="12"
  264. data-title="制造商"
  265. data-intro="请填写商品的制造商,一般适用于制造行业"
  266. >
  267. <a-input placeholder="请输入制造商" v-decorator.trim="['mfrs']" />
  268. </a-form-item>
  269. </a-col> -->
  270. </a-row>
  271. <!-- <a-row class="form-row" :gutter="24">
  272. <a-col :md="6" :sm="24">
  273. <a-form-item
  274. :labelCol="labelCol"
  275. :wrapperCol="wrapperCol"
  276. label="批号"
  277. data-step="14"
  278. data-title="批号"
  279. data-intro="此处是商品的批号开关,如果选择了有,则在采购入库单据需要录入该商品的批号和有效期,在销售出库单据需要选择该商品的批号进行出库"
  280. >
  281. <a-tooltip title="如果选择为有,则在采购入库单需要录入该商品的批号和有效期">
  282. <a-select placeholder="有无批号" v-decorator="['enableBatchNumber']">
  283. <a-select-option value="1">有</a-select-option>
  284. <a-select-option value="0">无</a-select-option>
  285. </a-select>
  286. </a-tooltip>
  287. </a-form-item>
  288. </a-col>
  289. <a-col :md="6" :sm="24" v-if="!model.id">
  290. <a-form-item
  291. :labelCol="labelCol"
  292. :wrapperCol="wrapperCol"
  293. label="多属性"
  294. data-step="13"
  295. data-title="多属性"
  296. data-intro="多属性是针对的sku商品(比如服装、鞋帽行业),此处开关如果启用就可以在下方进行多sku的配置,配置具体的颜色、尺码之类的组合"
  297. >
  298. <a-tooltip title="多属性针对服装、鞋帽等行业,需要先录入单位才能激活此处输入框">
  299. <a-tag class="tag-info" v-if="!manySkuStatus">需要先录入单位才能激活</a-tag>
  300. <a-select
  301. mode="multiple"
  302. v-decorator="['manySku']"
  303. showSearch
  304. optionFilterProp="children"
  305. placeholder="请选择多属性(可多选)"
  306. @change="onManySkuChange"
  307. v-show="manySkuStatus"
  308. >
  309. <a-select-option
  310. v-for="(item, index) in materialAttributeList"
  311. :key="index"
  312. :value="item.value"
  313. :disabled="item.disabled"
  314. >
  315. {{ item.name }}
  316. </a-select-option>
  317. </a-select>
  318. </a-tooltip>
  319. </a-form-item>
  320. </a-col>
  321. </a-row> -->
  322. <a-row class="form-row" :gutter="24">
  323. <a-col :md="12" :sm="24" v-if="manySkuSelected >= 1">
  324. <a-form-item
  325. :labelCol="{ xs: { span: 24 }, sm: { span: 4 } }"
  326. :wrapperCol="{ xs: { span: 24 }, sm: { span: 20 } }"
  327. :label="skuOneTitle"
  328. >
  329. <a-select
  330. mode="multiple"
  331. v-decorator="['skuOne']"
  332. showSearch
  333. optionFilterProp="children"
  334. placeholder="请选择(可多选)"
  335. @select="onSkuChange"
  336. @deselect="onSkuOneDeSelect"
  337. >
  338. <a-select-option v-for="(item, index) in skuOneList" :key="index" :value="item.value">
  339. {{ item.name }}
  340. </a-select-option>
  341. </a-select>
  342. </a-form-item>
  343. </a-col>
  344. <a-col :md="12" :sm="24" v-if="manySkuSelected >= 2">
  345. <a-form-item
  346. :labelCol="{ xs: { span: 24 }, sm: { span: 4 } }"
  347. :wrapperCol="{ xs: { span: 24 }, sm: { span: 20 } }"
  348. :label="skuTwoTitle"
  349. >
  350. <a-select
  351. mode="multiple"
  352. v-decorator="['skuTwo']"
  353. showSearch
  354. optionFilterProp="children"
  355. placeholder="请选择(可多选)"
  356. @select="onSkuChange"
  357. @deselect="onSkuTwoDeSelect"
  358. >
  359. <a-select-option v-for="(item, index) in skuTwoList" :key="index" :value="item.value">
  360. {{ item.name }}
  361. </a-select-option>
  362. </a-select>
  363. </a-form-item>
  364. </a-col>
  365. <a-col :md="12" :sm="24" v-if="manySkuSelected >= 3">
  366. <a-form-item
  367. :labelCol="{ xs: { span: 24 }, sm: { span: 4 } }"
  368. :wrapperCol="{ xs: { span: 24 }, sm: { span: 20 } }"
  369. :label="skuThreeTitle"
  370. >
  371. <a-select
  372. mode="multiple"
  373. v-decorator="['skuThree']"
  374. showSearch
  375. optionFilterProp="children"
  376. placeholder="请选择(可多选)"
  377. @select="onSkuChange"
  378. @deselect="onSkuThreeDeSelect"
  379. >
  380. <a-select-option v-for="(item, index) in skuThreeList" :key="index" :value="item.value">
  381. {{ item.name }}
  382. </a-select-option>
  383. </a-select>
  384. </a-form-item>
  385. </a-col>
  386. </a-row>
  387. <div style="margin-top: 8px" id="materialDetailModal">
  388. <j-editable-table
  389. ref="editableMeTable"
  390. :loading="meTable.loading"
  391. :columns="meTable.columns"
  392. :dataSource="meTable.dataSource"
  393. :height="300"
  394. :minWidth="1000"
  395. :maxHeight="300"
  396. :rowNumber="false"
  397. :rowSelection="true"
  398. :actionButton="true"
  399. @valueChange="onValueChange"
  400. @added="onAdded"
  401. @deleted="onDeleted"
  402. >
  403. <template #supplierId="{ handleChange, value }">
  404. <a-select
  405. placeholder="请选择供应商"
  406. v-decorator="['supplierId']"
  407. :dropdownMatchSelectWidth="false"
  408. showSearch
  409. optionFilterProp="children"
  410. :value="typeof value === 'string' ? Number(value) : ''"
  411. @change="($event) => handleChange($event)"
  412. >
  413. <div slot="dropdownRender" slot-scope="menu">
  414. <v-nodes :vnodes="menu" />
  415. <a-divider style="margin: 4px 0" />
  416. <div
  417. style="padding: 4px 8px; cursor: pointer"
  418. @mousedown="(e) => e.preventDefault()"
  419. @click="addVendor"
  420. >
  421. <a-icon type="plus" /> 新增供应商
  422. </div>
  423. </div>
  424. <a-select-option v-for="(item, index) in supList" :key="index" :value="item.id">
  425. {{ item.supplier }}
  426. </a-select-option>
  427. </a-select>
  428. </template>
  429. <template #depotId="{ handleChange, value }">
  430. <a-select
  431. placeholder="请选择仓库名称"
  432. v-decorator="['depotId']"
  433. :dropdownMatchSelectWidth="false"
  434. showSearch
  435. optionFilterProp="children"
  436. :value="value"
  437. @change="($event) => handleChange($event)"
  438. >
  439. <div slot="dropdownRender" slot-scope="menu">
  440. <v-nodes :vnodes="menu" />
  441. <a-divider style="margin: 4px 0" />
  442. <div
  443. style="padding: 4px 8px; cursor: pointer"
  444. @mousedown="(e) => e.preventDefault()"
  445. @click="addDepot"
  446. >
  447. <a-icon type="plus" /> 新增仓库
  448. </div>
  449. </div>
  450. <a-select-option v-for="(item, index) in depotList" :key="index" :value="item.value">
  451. {{ item.text }}
  452. </a-select-option>
  453. </a-select>
  454. </template>
  455. <template #buttonAfter>
  456. <a-button @click="batchSetPrice('purchase')">采购价-批量</a-button>
  457. <a-button style="margin-left: 8px" @click="batchSetPrice('commodity')">零售价-批量</a-button>
  458. <a-button style="margin-left: 8px" @click="batchSetPrice('wholesale')">销售价-批量</a-button>
  459. <a-button style="margin-left: 8px" @click="batchSetPrice('low')">最低售价-批量</a-button>
  460. </template>
  461. </j-editable-table>
  462. <!-- 表单区域 -->
  463. <batch-set-price-modal ref="priceModalForm" @ok="batchSetPriceModalFormOk"></batch-set-price-modal>
  464. </div>
  465. <a-row class="form-row" :gutter="24">
  466. <a-col :lg="24" :md="24" :sm="24">
  467. <a-form-item :labelCol="labelCol" :wrapperCol="{ xs: { span: 24 }, sm: { span: 24 } }" label="">
  468. <a-textarea :rows="1" placeholder="请输入备注" v-decorator="['remark']" style="margin-top: 8px" />
  469. </a-form-item>
  470. </a-col>
  471. </a-row>
  472. </a-tab-pane>
  473. <a-tab-pane key="2" tab="扩展信息" forceRender>
  474. <a-row v-if="mpShort.otherField1.enabled" class="form-row" :gutter="24">
  475. <a-col :lg="6" :md="6" :sm="6">
  476. <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="mpShort.otherField1.name">
  477. <a-input v-decorator.trim="['otherField1']" />
  478. </a-form-item>
  479. </a-col>
  480. </a-row>
  481. <a-row v-if="mpShort.otherField2.enabled" class="form-row" :gutter="24">
  482. <a-col :lg="6" :md="6" :sm="6">
  483. <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="mpShort.otherField2.name">
  484. <a-input v-decorator.trim="['otherField2']" />
  485. </a-form-item>
  486. </a-col>
  487. </a-row>
  488. <a-row v-if="mpShort.otherField3.enabled" class="form-row" :gutter="24">
  489. <a-col :lg="6" :md="6" :sm="6">
  490. <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="mpShort.otherField3.name">
  491. <a-input v-decorator.trim="['otherField3']" />
  492. </a-form-item>
  493. </a-col>
  494. </a-row>
  495. </a-tab-pane>
  496. <a-tab-pane key="3" tab="库存数量" forceRender>
  497. <j-editable-table
  498. ref="editableDepotTable"
  499. :loading="depotTable.loading"
  500. :columns="depotTable.columns"
  501. :dataSource="depotTable.dataSource"
  502. :minWidth="1000"
  503. :maxHeight="300"
  504. :rowNumber="true"
  505. :rowSelection="false"
  506. :actionButton="false"
  507. >
  508. <template #buttonAfter>
  509. <a-button style="margin: 0px 0px 8px 0px" @click="batchSetStock('initStock')">期初库存-批量</a-button>
  510. <a-button style="margin-left: 8px" @click="batchSetStock('lowSafeStock')">最低安全库存-批量</a-button>
  511. <a-button style="margin-left: 8px" @click="batchSetStock('highSafeStock')">最高安全库存-批量</a-button>
  512. </template>
  513. </j-editable-table>
  514. <!-- 表单区域 -->
  515. <batch-set-stock-modal ref="stockModalForm" @ok="batchSetStockModalFormOk"></batch-set-stock-modal>
  516. </a-tab-pane>
  517. <a-tab-pane key="4" tab="图片信息" forceRender>
  518. <a-row class="form-row" :gutter="24" style="padding-top: 20px">
  519. <a-col :lg="18" :md="18" :sm="24">
  520. <a-form-item
  521. :labelCol="{ xs: { span: 24 }, sm: { span: 3 } }"
  522. :wrapperCol="{ xs: { span: 24 }, sm: { span: 20 } }"
  523. label="图片信息"
  524. >
  525. <j-image-upload v-model="fileList" bizPath="material" text="上传" isMultiple></j-image-upload>
  526. </a-form-item>
  527. </a-col>
  528. <a-col :lg="6" :md="6" :sm="24"></a-col>
  529. </a-row>
  530. <a-row class="form-row" :gutter="24">
  531. <a-col :lg="18" :md="18" :sm="24">
  532. <a-form-item
  533. :labelCol="{ xs: { span: 24 }, sm: { span: 3 } }"
  534. :wrapperCol="{ xs: { span: 24 }, sm: { span: 20 } }"
  535. label="上传提示"
  536. >
  537. 图片最多4张,且单张大小不超过1M
  538. </a-form-item>
  539. </a-col>
  540. <a-col :lg="6" :md="6" :sm="24"></a-col>
  541. </a-row>
  542. </a-tab-pane>
  543. </a-tabs>
  544. </a-form>
  545. </a-spin>
  546. <!-- 供应商modal -->
  547. <vendor-modal ref="vendorModalForm" @ok="vendorModalFormOk"></vendor-modal>
  548. <!-- 仓库modal -->
  549. <depot-modal ref="depotModalForm" @ok="depotModalFormOk"></depot-modal>
  550. <unit-modal ref="unitModalForm" @ok="unitModalFormOk"></unit-modal>
  551. </j-modal>
  552. </template>
  553. <script>
  554. import pick from 'lodash.pick'
  555. import BatchSetPriceModal from './BatchSetPriceModal'
  556. import BatchSetStockModal from './BatchSetStockModal'
  557. import UnitModal from '../../system/modules/UnitModal'
  558. import VendorModal from '@/views//system/modules/VendorModal'
  559. import DepotModal from '@/views//system/modules/DepotModal'
  560. import JEditableTable from '@/components/jeecg/JEditableTable'
  561. import { FormTypes, getRefPromise, VALIDATE_NO_PASSED, validateFormAndTables } from '@/utils/JEditableTableUtil'
  562. import {
  563. checkMaterial,
  564. checkMaterialBarCode,
  565. getMaterialAttributeNameList,
  566. getMaterialAttributeValueListById,
  567. getMaxBarCode,
  568. queryMaterialCategoryTreeList,
  569. changeNameToPinYin,
  570. } from '@/api/api'
  571. import { removeByVal, autoJumpNextInput, handleIntroJs } from '@/utils/util'
  572. import { getAction, httpAction } from '@/api/manage'
  573. import JImageUpload from '@/components/jeecg/JImageUpload'
  574. import JDate from '@/components/jeecg/JDate'
  575. import Vue from 'vue'
  576. import { MaterialModalMixins } from '../mixins/MaterialModalMixins'
  577. export default {
  578. name: 'MaterialModal',
  579. mixins: [MaterialModalMixins],
  580. components: {
  581. BatchSetPriceModal,
  582. BatchSetStockModal,
  583. UnitModal,
  584. VendorModal,
  585. DepotModal,
  586. JImageUpload,
  587. JDate,
  588. JEditableTable,
  589. VNodes: {
  590. functional: true,
  591. render: (h, ctx) => ctx.props.vnodes,
  592. },
  593. },
  594. data() {
  595. return {
  596. title: '操作',
  597. width: '1300px',
  598. visible: false,
  599. modalStyle: '',
  600. categoryTree: [],
  601. unitList: [],
  602. depotList: [],
  603. fileList: [],
  604. unitStatus: false,
  605. manyUnitStatus: true,
  606. unitChecked: false,
  607. manySkuStatus: false,
  608. switchDisabled: false, //开关的启用状态
  609. barCodeSwitch: false, //生成条码开关
  610. maxBarCodeInfo: '', //最大条码
  611. meDeleteIdList: [], //删除条码信息的id数组
  612. prefixNo: 'material',
  613. materialAttributeList: [],
  614. skuOneTitle: '属性1',
  615. skuTwoTitle: '属性2',
  616. skuThreeTitle: '属性3',
  617. skuOneList: [],
  618. skuTwoList: [],
  619. skuThreeList: [],
  620. manySkuSelected: 0,
  621. model: {},
  622. showOkFlag: true,
  623. setTimeFlag: null,
  624. labelCol: {
  625. xs: { span: 24 },
  626. sm: { span: 8 },
  627. },
  628. wrapperCol: {
  629. xs: { span: 24 },
  630. sm: { span: 16 },
  631. },
  632. mpShort: {
  633. mfrs: {},
  634. otherField1: {},
  635. otherField2: {},
  636. otherField3: {},
  637. },
  638. meTable: {
  639. loading: false,
  640. dataSource: [],
  641. columns: [
  642. {
  643. title: '批次号',
  644. // key: 'barCode',
  645. key: 'batchNumber',
  646. width: '15%',
  647. type: FormTypes.input,
  648. disabled: true,
  649. defaultValue: '',
  650. placeholder: '自动生成',
  651. // validateRules: [
  652. // { required: true, message: '${title}不能为空' },
  653. // { pattern: /^.{4,40}$/, message: '长度为4到40位' },
  654. // { handler: this.validateBarCode },
  655. // ],
  656. },
  657. {
  658. title: '单位',
  659. key: 'commodityUnit',
  660. width: '8%',
  661. type: FormTypes.input,
  662. defaultValue: '',
  663. placeholder: '请输入${title}',
  664. validateRules: [{ required: true, message: '${title}不能为空' }],
  665. },
  666. {
  667. title: '多属性',
  668. key: 'sku',
  669. width: '25%',
  670. type: FormTypes.input,
  671. defaultValue: '',
  672. readonly: true,
  673. placeholder: '请输入${title}',
  674. },
  675. {
  676. title: '采购价',
  677. key: 'purchaseDecimal',
  678. width: '9%',
  679. type: FormTypes.inputNumber,
  680. defaultValue: '',
  681. placeholder: '请输入${title}',
  682. },
  683. {
  684. title: '零售价',
  685. key: 'commodityDecimal',
  686. width: '9%',
  687. type: FormTypes.inputNumber,
  688. defaultValue: '',
  689. placeholder: '请输入${title}',
  690. },
  691. {
  692. title: '销售价',
  693. key: 'wholesaleDecimal',
  694. width: '9%',
  695. type: FormTypes.inputNumber,
  696. defaultValue: '',
  697. placeholder: '请输入${title}',
  698. },
  699. {
  700. title: '最低售价',
  701. key: 'lowDecimal',
  702. width: '9%',
  703. type: FormTypes.inputNumber,
  704. defaultValue: '',
  705. placeholder: '请输入${title}',
  706. },
  707. {
  708. title: '生产日期',
  709. key: 'productionDate',
  710. width: '12%',
  711. type: FormTypes.date,
  712. defaultValue: '',
  713. placeholder: '请选择${title}',
  714. },
  715. {
  716. title: '保质期(天)',
  717. key: 'expiryNum',
  718. width: '9%',
  719. type: FormTypes.inputNumber,
  720. defaultValue: '',
  721. placeholder: '请输入${title}',
  722. },
  723. {
  724. title: '供应商',
  725. key: 'supplierId',
  726. width: '12%',
  727. type: FormTypes.slot,
  728. slotName: 'supplierId',
  729. defaultValue: '',
  730. placeholder: '请选择${title}',
  731. },
  732. {
  733. title: '商品条码',
  734. key: 'barCode',
  735. width: '12%',
  736. type: FormTypes.input,
  737. defaultValue: '',
  738. placeholder: '请输入${title}',
  739. },
  740. {
  741. title: '库存(最小单位)',
  742. key: 'inventory',
  743. width: '9%',
  744. type: FormTypes.inputNumber,
  745. defaultValue: '',
  746. placeholder: '请输入${title}',
  747. },
  748. {
  749. title: '仓库名称',
  750. key: 'depotId',
  751. width: '10%',
  752. type: FormTypes.slot,
  753. slotName: 'depotId',
  754. defaultValue: '',
  755. placeholder: '请选择${title}',
  756. },
  757. {
  758. title: '仓位货架',
  759. key: 'position',
  760. width: '9%',
  761. type: FormTypes.input,
  762. defaultValue: '',
  763. placeholder: '请输入${title}',
  764. },
  765. ],
  766. },
  767. depotTable: {
  768. loading: false,
  769. dataSource: [],
  770. columns: [
  771. {
  772. title: '仓库',
  773. key: 'name',
  774. width: '15%',
  775. type: FormTypes.normal,
  776. },
  777. {
  778. title: '期初库存数量',
  779. key: 'initStock',
  780. width: '15%',
  781. type: FormTypes.inputNumber,
  782. defaultValue: '',
  783. placeholder: '请输入${title}',
  784. },
  785. {
  786. title: '最低安全库存数量',
  787. key: 'lowSafeStock',
  788. width: '15%',
  789. type: FormTypes.inputNumber,
  790. defaultValue: '',
  791. placeholder: '请输入${title}',
  792. },
  793. {
  794. title: '最高安全库存数量',
  795. key: 'highSafeStock',
  796. width: '15%',
  797. type: FormTypes.inputNumber,
  798. defaultValue: '',
  799. placeholder: '请输入${title}',
  800. },
  801. ],
  802. },
  803. confirmLoading: false,
  804. form: this.$form.createForm(this),
  805. validatorRules: {
  806. name: {
  807. rules: [
  808. { required: true, message: '请输入名称!' },
  809. { max: 100, message: '长度请小于100个字符', trigger: 'blur' },
  810. ],
  811. },
  812. standard: {
  813. rules: [{ max: 100, message: '长度请小于100个字符', trigger: 'blur' }],
  814. },
  815. categoryId: {
  816. rules: [{ required: true, message: '请选择类别!' }],
  817. },
  818. model: {
  819. rules: [{ max: 100, message: '长度请小于100个字符', trigger: 'blur' }],
  820. },
  821. unit: {
  822. rules: [{ required: true, message: '请输入单位!' }],
  823. },
  824. unitId: {
  825. rules: [{ required: true, message: '请选择多单位!' }],
  826. },
  827. },
  828. url: {
  829. add: '/material/add',
  830. edit: '/material/update',
  831. materialsExtendList: '/materialsExtend/getDetailList',
  832. depotWithStock: '/depot/getAllListWithStock',
  833. },
  834. }
  835. },
  836. created() {
  837. this.loadParseMaterialProperty()
  838. let realScreenWidth = window.screen.width
  839. this.width = realScreenWidth < 1500 ? '1200px' : '1400px'
  840. this.initSelectOpts()
  841. },
  842. mounted() {
  843. document.getElementById(this.prefixNo).addEventListener('keydown', this.handleOkKey)
  844. },
  845. beforeDestroy() {
  846. document.getElementById(this.prefixNo).removeEventListener('keydown', this.handleOkKey)
  847. },
  848. methods: {
  849. // 快捷键
  850. handleOkKey(e) {
  851. const key = window.event.keyCode ? window.event.keyCode : window.event.which
  852. if (key === 83 && e.ctrlKey) {
  853. //保存 CTRL+S
  854. this.handleOk()
  855. e.preventDefault()
  856. }
  857. },
  858. // 获取所有的editableTable实例
  859. getAllTable() {
  860. return Promise.all([getRefPromise(this, 'editableMeTable'), getRefPromise(this, 'editableDepotTable')])
  861. },
  862. add() {
  863. //隐藏多属性
  864. this.meTable.columns[2].type = FormTypes.hidden
  865. // 默认新增一条数据
  866. this.getAllTable().then((editableTables) => {
  867. editableTables[0].add()
  868. })
  869. this.edit({})
  870. this.$nextTick(() => {
  871. handleIntroJs('material', 11)
  872. })
  873. },
  874. edit(record) {
  875. this.form.resetFields()
  876. this.model = Object.assign({}, record)
  877. this.activeKey = '1'
  878. this.manySkuSelected = 0
  879. this.barCodeSwitch = false
  880. this.manySkuStatus = false
  881. this.maxBarCodeInfo = ''
  882. this.visible = true
  883. this.meDeleteIdList = []
  884. this.modalStyle = 'top:20px;height: 95%;'
  885. if (JSON.stringify(record) === '{}') {
  886. this.fileList = []
  887. } else {
  888. setTimeout(() => {
  889. this.fileList = record.imgName
  890. }, 5)
  891. }
  892. this.$nextTick(() => {
  893. this.form.setFieldsValue(
  894. pick(
  895. this.model,
  896. 'name',
  897. 'standard',
  898. 'unit',
  899. 'unitId',
  900. 'model',
  901. 'color',
  902. 'brand',
  903. 'mnemonic',
  904. 'categoryId',
  905. 'enableSerialNumber',
  906. 'movingPinReminderCycle',
  907. 'systemSku',
  908. 'weight',
  909. 'remark',
  910. 'otherField1',
  911. 'otherField2',
  912. 'otherField3'
  913. )
  914. )
  915. autoJumpNextInput('materialHeadModal')
  916. autoJumpNextInput('materialDetailModal')
  917. })
  918. this.initMaterialAttribute()
  919. this.loadTreeData()
  920. this.loadUnitListData()
  921. // 加载子表数据
  922. if (this.model.id) {
  923. //禁用多属性开关
  924. this.switchDisabled = true
  925. // 判断是否是多单位
  926. if (this.model.unit) {
  927. this.unitChecked = false
  928. this.unitStatus = false
  929. this.manyUnitStatus = true
  930. } else {
  931. this.unitChecked = true
  932. this.unitStatus = true
  933. this.manyUnitStatus = false
  934. }
  935. let params = { materialId: this.model.id }
  936. //编辑商品的时候多属性字段可以修改
  937. this.meTable.columns[2].readonly = false
  938. this.requestMeTableData(this.url.materialsExtendList, params, this.meTable)
  939. this.requestDepotTableData(this.url.depotWithStock, { mId: this.model.id }, this.depotTable)
  940. } else {
  941. this.switchDisabled = false
  942. this.meTable.columns[2].readonly = true
  943. this.requestDepotTableData(this.url.depotWithStock, { mId: 0 }, this.depotTable)
  944. }
  945. },
  946. /** 查询条码tab的数据 */
  947. requestMeTableData(url, params, tab) {
  948. tab.loading = true
  949. getAction(url, params)
  950. .then((res) => {
  951. for (let i = 0; i < res.data.rows.length; i++) {
  952. if (res.data.rows[i].sku) {
  953. this.meTable.columns[2].type = FormTypes.input
  954. } else {
  955. this.meTable.columns[2].type = FormTypes.hidden
  956. }
  957. }
  958. tab.dataSource = res.data.rows || []
  959. console.log('tab.dataSource-----', tab.dataSource)
  960. })
  961. .finally(() => {
  962. tab.loading = false
  963. })
  964. },
  965. /** 查询仓库tab的数据 */
  966. requestDepotTableData(url, params, tab) {
  967. tab.loading = true
  968. getAction(url, params)
  969. .then((res) => {
  970. tab.dataSource = res.data || []
  971. console.log('====================', res.data)
  972. })
  973. .finally(() => {
  974. tab.loading = false
  975. })
  976. },
  977. close() {
  978. this.$emit('close')
  979. this.visible = false
  980. this.modalStyle = ''
  981. this.unitStatus = false
  982. this.manyUnitStatus = true
  983. this.unitChecked = false
  984. this.getAllTable().then((editableTables) => {
  985. editableTables[0].initialize()
  986. editableTables[1].initialize()
  987. })
  988. },
  989. handleOk() {
  990. this.validateFields()
  991. },
  992. handleCancel() {
  993. this.close()
  994. },
  995. /** 触发表单验证 */
  996. validateFields() {
  997. this.getAllTable()
  998. .then((tables) => {
  999. /** 一次性验证主表和所有的次表 */
  1000. return validateFormAndTables(this.form, tables)
  1001. })
  1002. .then((allValues) => {
  1003. let formData = this.classifyIntoFormData(allValues)
  1004. formData.sortList = []
  1005. if (formData.unit === undefined) {
  1006. formData.unit = ''
  1007. }
  1008. if (formData.unitId === undefined) {
  1009. formData.unitId = ''
  1010. }
  1011. if (this.unitChecked) {
  1012. formData.unit = ''
  1013. } else {
  1014. formData.unitId = ''
  1015. }
  1016. // 发起请求
  1017. return this.requestAddOrEdit(formData)
  1018. })
  1019. .catch((e) => {
  1020. if (e.error === VALIDATE_NO_PASSED) {
  1021. // 如果有未通过表单验证的子表,就自动跳转到它所在的tab
  1022. this.activeKey = e.index == null ? this.activeKey : (e.index + 1).toString()
  1023. } else {
  1024. console.error(e)
  1025. }
  1026. })
  1027. },
  1028. /** 整理成formData */
  1029. classifyIntoFormData(allValues) {
  1030. let materialMain = Object.assign(this.model, allValues.formValue)
  1031. return {
  1032. ...materialMain, // 展开
  1033. meList: allValues.tablesValue[0].values,
  1034. stock: allValues.tablesValue[1].values,
  1035. }
  1036. },
  1037. /** 发起新增或修改的请求 */
  1038. requestAddOrEdit(formData) {
  1039. console.log('formData------------', formData)
  1040. if (formData.meList.length === 0) {
  1041. this.$message.warning('抱歉,请输入条码信息!')
  1042. return
  1043. }
  1044. if (formData.enableSerialNumber === '1' && formData.enableBatchNumber === '1') {
  1045. this.$message.warning('抱歉,序列号和批号只能选择一项!')
  1046. return
  1047. }
  1048. //校验商品是否存在,通过校验商品的名称、型号、规格、颜色、单位、制造商等
  1049. let param = {
  1050. id: this.model.id ? this.model.id : 0,
  1051. name: this.model.name,
  1052. model: this.parseParam(this.model.model),
  1053. color: this.parseParam(this.model.color),
  1054. standard: this.parseParam(this.model.standard),
  1055. mfrs: this.parseParam(this.model.mfrs),
  1056. otherField1: this.parseParam(this.model.otherField1),
  1057. otherField2: this.parseParam(this.model.otherField2),
  1058. otherField3: this.parseParam(this.model.otherField3),
  1059. unit: this.parseParam(this.model.unit),
  1060. unitId: this.parseParam(this.model.unitId),
  1061. }
  1062. checkMaterial(param).then((res) => {
  1063. if (res && res.code === 200) {
  1064. if (res.data.status) {
  1065. this.$message.warning('抱歉,该商品已存在!')
  1066. return
  1067. } else {
  1068. //进一步校验单位
  1069. let basicUnit = '',
  1070. otherUnit = '',
  1071. otherUnitTwo = '',
  1072. otherUnitThree = ''
  1073. if (formData.unitId) {
  1074. let unitArr = this.unitList
  1075. for (let i = 0; i < unitArr.length; i++) {
  1076. if (unitArr[i].id == formData.unitId) {
  1077. basicUnit = unitArr[i].basicUnit
  1078. otherUnit = unitArr[i].otherUnit
  1079. if (unitArr[i].otherUnitTwo) {
  1080. otherUnitTwo = unitArr[i].otherUnitTwo
  1081. }
  1082. if (unitArr[i].otherUnitThree) {
  1083. otherUnitThree = unitArr[i].otherUnitThree
  1084. }
  1085. }
  1086. }
  1087. }
  1088. if (!formData.unit) {
  1089. //此时为多单位
  1090. if (formData.meList.length < 2) {
  1091. this.$message.warning('多单位的商品条码行数至少要有两行,请再新增一行条码信息!')
  1092. return
  1093. }
  1094. if (formData.meList[0].commodityUnit != basicUnit) {
  1095. this.$message.warning(
  1096. '条码之后的单位填写有误,单位【' +
  1097. formData.meList[0].commodityUnit +
  1098. '】请修改为【' +
  1099. basicUnit +
  1100. '】!'
  1101. )
  1102. return
  1103. }
  1104. if (formData.meList[1].commodityUnit != otherUnit) {
  1105. this.$message.warning(
  1106. '条码之后的单位填写有误,单位【' +
  1107. formData.meList[1].commodityUnit +
  1108. '】请修改为【' +
  1109. otherUnit +
  1110. '】!'
  1111. )
  1112. return
  1113. }
  1114. }
  1115. let skuCount = 0
  1116. for (let i = 0; i < formData.meList.length; i++) {
  1117. let commodityUnit = formData.meList[i].commodityUnit
  1118. if (formData.unit) {
  1119. if (commodityUnit != formData.unit) {
  1120. this.$message.warning(
  1121. '条码之后的单位填写有误,单位【' + commodityUnit + '】请修改为【' + formData.unit + '】!'
  1122. )
  1123. return
  1124. }
  1125. } else if (formData.unitId) {
  1126. if (
  1127. commodityUnit != basicUnit &&
  1128. commodityUnit != otherUnit &&
  1129. commodityUnit != otherUnitTwo &&
  1130. commodityUnit != otherUnitThree
  1131. ) {
  1132. let warnInfo =
  1133. '条码之后的单位填写有误,单位【' +
  1134. commodityUnit +
  1135. '】请修改为【' +
  1136. basicUnit +
  1137. '】或【' +
  1138. otherUnit +
  1139. '】'
  1140. if (otherUnitTwo) {
  1141. warnInfo += '或【' + otherUnitTwo + '】'
  1142. }
  1143. if (otherUnitThree) {
  1144. warnInfo += '或【' + otherUnitThree + '】'
  1145. }
  1146. warnInfo += '!'
  1147. this.$message.warning(warnInfo)
  1148. return
  1149. }
  1150. }
  1151. if (formData.sku) {
  1152. skuCount++
  1153. }
  1154. }
  1155. //对最低和最高安全库存进行校验
  1156. for (let i = 0; i < formData.stock.length; i++) {
  1157. let depotStockObj = formData.stock[i]
  1158. if (skuCount && depotStockObj.initStock && depotStockObj.initStock - 0) {
  1159. this.$message.warning('抱歉,多属性商品不能录入期初库存,建议进行盘点录入!')
  1160. return
  1161. }
  1162. if (formData.enableSerialNumber === '1' && depotStockObj.initStock && depotStockObj.initStock - 0) {
  1163. this.$message.warning('抱歉,序列号商品不能录入期初库存,建议进行入库单据录入!')
  1164. return
  1165. }
  1166. if (formData.enableBatchNumber === '1' && depotStockObj.initStock && depotStockObj.initStock - 0) {
  1167. this.$message.warning('抱歉,批号商品不能录入期初库存,建议进行入库单据录入!')
  1168. return
  1169. }
  1170. if (depotStockObj.lowSafeStock && depotStockObj.highSafeStock) {
  1171. if (depotStockObj.lowSafeStock - 0 > depotStockObj.highSafeStock - 0) {
  1172. this.$message.warning('抱歉,' + depotStockObj.name + '的最低安全库存大于最高安全库存!')
  1173. return
  1174. }
  1175. }
  1176. }
  1177. //图片校验
  1178. if (this.fileList && this.fileList.length > 0) {
  1179. formData.imgName = this.fileList
  1180. let fileArr = this.fileList.split(',')
  1181. if (fileArr.length > 4) {
  1182. this.$message.warning('抱歉,商品图片不能超过4张!')
  1183. return
  1184. }
  1185. } else {
  1186. formData.imgName = ''
  1187. }
  1188. formData.meDeleteIdList = this.meDeleteIdList
  1189. //接口调用
  1190. let url = this.url.add,
  1191. method = 'post'
  1192. if (this.model.id) {
  1193. url = this.url.edit
  1194. method = 'put'
  1195. }
  1196. const that = this
  1197. this.confirmLoading = true
  1198. httpAction(url, formData, method)
  1199. .then((res) => {
  1200. if (res.code === 200) {
  1201. that.$emit('ok')
  1202. that.confirmLoading = false
  1203. that.close()
  1204. } else {
  1205. that.$message.warning(res.data.message)
  1206. that.confirmLoading = false
  1207. }
  1208. })
  1209. .finally(() => {})
  1210. }
  1211. }
  1212. })
  1213. },
  1214. parseParam(param) {
  1215. return param ? param : ''
  1216. },
  1217. validateBarCode(type, value, row, column, callback, target) {
  1218. let params = {
  1219. barCode: value,
  1220. id: row.id.length >= 20 ? 0 : row.id,
  1221. }
  1222. checkMaterialBarCode(params).then((res) => {
  1223. if (res && res.code === 200) {
  1224. if (!res.data.status) {
  1225. callback(true)
  1226. } else {
  1227. callback(false, '该条码已经存在')
  1228. }
  1229. } else {
  1230. callback(false, res.data)
  1231. }
  1232. })
  1233. },
  1234. loadTreeData() {
  1235. let that = this
  1236. let params = {}
  1237. params.id = ''
  1238. queryMaterialCategoryTreeList(params).then((res) => {
  1239. if (res) {
  1240. that.categoryTree = []
  1241. for (let i = 0; i < res.length; i++) {
  1242. let temp = res[i]
  1243. that.categoryTree.push(temp)
  1244. }
  1245. }
  1246. })
  1247. },
  1248. loadUnitListData() {
  1249. let that = this
  1250. let params = {}
  1251. params.currentPage = 1
  1252. params.pageSize = 100
  1253. getAction('/unit/getAllList', params).then((res) => {
  1254. if (res) {
  1255. that.unitList = res.data
  1256. }
  1257. })
  1258. },
  1259. onManySkuChange(value) {
  1260. this.manySkuSelected = value.length
  1261. //控制多属性下拉框中选择项的状态
  1262. if (value.length < 3) {
  1263. this.materialAttributeList.forEach((item, index, array) => {
  1264. array.indexOf(item.value) === -1 ? Vue.set(array[index], 'disabled', false) : ''
  1265. })
  1266. } else {
  1267. this.materialAttributeList.forEach((item, index, array) => {
  1268. value.indexOf(item.value) === -1 ? Vue.set(array[index], 'disabled', true) : ''
  1269. })
  1270. }
  1271. //更新属性1和属性2和属性3的下拉框
  1272. if (value.length <= 3) {
  1273. let skuOneId = value[0]
  1274. let skuTwoId = value[1]
  1275. let skuThreeId = value[2]
  1276. this.materialAttributeList.forEach((item) => {
  1277. if (item.value === skuOneId) {
  1278. this.skuOneTitle = item.name
  1279. }
  1280. if (item.value === skuTwoId) {
  1281. this.skuTwoTitle = item.name
  1282. }
  1283. if (item.value === skuThreeId) {
  1284. this.skuThreeTitle = item.name
  1285. }
  1286. })
  1287. if (skuOneId) {
  1288. getMaterialAttributeValueListById({ id: skuOneId }).then((res) => {
  1289. this.skuOneList = res ? res : []
  1290. })
  1291. }
  1292. if (skuTwoId) {
  1293. getMaterialAttributeValueListById({ id: skuTwoId }).then((res) => {
  1294. this.skuTwoList = res ? res : []
  1295. })
  1296. }
  1297. if (skuThreeId) {
  1298. getMaterialAttributeValueListById({ id: skuThreeId }).then((res) => {
  1299. this.skuThreeList = res ? res : []
  1300. })
  1301. }
  1302. }
  1303. //控制条码列表中的多属性列
  1304. if (value.length > 0) {
  1305. this.meTable.columns[2].type = FormTypes.input
  1306. } else {
  1307. this.meTable.columns[2].type = FormTypes.hidden
  1308. }
  1309. this.barCodeSwitch = false
  1310. this.meTable.dataSource = []
  1311. },
  1312. onSkuChange() {
  1313. let skuOneData = this.form.getFieldValue('skuOne')
  1314. let skuTwoData = this.form.getFieldValue('skuTwo')
  1315. let skuThreeData = this.form.getFieldValue('skuThree')
  1316. this.autoSkuList(skuOneData, skuTwoData, skuThreeData)
  1317. },
  1318. onSkuOneDeSelect(value) {
  1319. let skuOneData = this.form.getFieldValue('skuOne')
  1320. let skuTwoData = this.form.getFieldValue('skuTwo')
  1321. let skuThreeData = this.form.getFieldValue('skuThree')
  1322. removeByVal(skuOneData, value)
  1323. this.autoSkuList(skuOneData, skuTwoData, skuThreeData)
  1324. },
  1325. onSkuTwoDeSelect(value) {
  1326. let skuOneData = this.form.getFieldValue('skuOne')
  1327. let skuTwoData = this.form.getFieldValue('skuTwo')
  1328. let skuThreeData = this.form.getFieldValue('skuThree')
  1329. removeByVal(skuTwoData, value)
  1330. this.autoSkuList(skuOneData, skuTwoData, skuThreeData)
  1331. },
  1332. onSkuThreeDeSelect(value) {
  1333. let skuOneData = this.form.getFieldValue('skuOne')
  1334. let skuTwoData = this.form.getFieldValue('skuTwo')
  1335. let skuThreeData = this.form.getFieldValue('skuThree')
  1336. removeByVal(skuThreeData, value)
  1337. this.autoSkuList(skuOneData, skuTwoData, skuThreeData)
  1338. },
  1339. autoSkuList(skuOneData, skuTwoData, skuThreeData) {
  1340. let unit = this.form.getFieldValue('unit')
  1341. if (unit) {
  1342. //计算多属性已经选择了几个
  1343. let skuArr = []
  1344. if (this.getNumByField('skuOne')) {
  1345. skuArr.push(skuOneData)
  1346. }
  1347. if (this.getNumByField('skuTwo')) {
  1348. skuArr.push(skuTwoData)
  1349. }
  1350. if (this.getNumByField('skuThree')) {
  1351. skuArr.push(skuThreeData)
  1352. }
  1353. let skuArrOne = skuArr[0]
  1354. let skuArrTwo = skuArr[1]
  1355. let skuArrThree = skuArr[2]
  1356. let count = this.getNumByField('skuOne') + this.getNumByField('skuTwo') + this.getNumByField('skuThree')
  1357. let barCodeSku = []
  1358. if (count === 1) {
  1359. let skuArrOnly = []
  1360. if (this.getNumByField('skuOne')) {
  1361. skuArrOnly = skuOneData
  1362. } else if (this.getNumByField('skuTwo')) {
  1363. skuArrOnly = skuTwoData
  1364. } else if (this.getNumByField('skuThree')) {
  1365. skuArrOnly = skuThreeData
  1366. }
  1367. for (let i = 0; i < skuArrOnly.length; i++) {
  1368. barCodeSku.push(skuArrOnly[i])
  1369. }
  1370. } else if (count === 2) {
  1371. for (let i = 0; i < skuArrOne.length; i++) {
  1372. for (let j = 0; j < skuArrTwo.length; j++) {
  1373. barCodeSku.push(skuArrOne[i] + '/' + skuArrTwo[j])
  1374. }
  1375. }
  1376. } else if (count === 3) {
  1377. for (let i = 0; i < skuArrOne.length; i++) {
  1378. for (let j = 0; j < skuArrTwo.length; j++) {
  1379. for (let k = 0; k < skuArrThree.length; k++) {
  1380. barCodeSku.push(skuArrOne[i] + '/' + skuArrTwo[j] + '/' + skuArrThree[k])
  1381. }
  1382. }
  1383. }
  1384. }
  1385. let meTableData = []
  1386. getMaxBarCode({}).then((res) => {
  1387. if (res && res.code === 200) {
  1388. let maxBarCode = res.data.barCode - 0
  1389. for (let i = 0; i < barCodeSku.length; i++) {
  1390. let currentBarCode = maxBarCode + i + 1
  1391. meTableData.push({ barCode: currentBarCode, commodityUnit: unit, sku: barCodeSku[i] })
  1392. }
  1393. this.meTable.dataSource = meTableData
  1394. }
  1395. })
  1396. } else {
  1397. this.$message.warning('请填写单位(注意不要勾选多单位)')
  1398. this.barCodeSwitch = false
  1399. }
  1400. },
  1401. getNumByField(field) {
  1402. let num = 0
  1403. if (this.form.getFieldValue(field)) {
  1404. if (this.form.getFieldValue(field).length > 0) {
  1405. num = 1
  1406. }
  1407. }
  1408. return num
  1409. },
  1410. onAdded(event) {
  1411. const { row, target } = event
  1412. target.setValues([{ rowKey: row.id, values: { barCode: '', commodityUnit: '' } }])
  1413. },
  1414. onDeleted(value) {
  1415. this.meDeleteIdList = value
  1416. },
  1417. //单元值改变一个字符就触发一次
  1418. onValueChange(event) {
  1419. console.log('onValueChange--------table-change', event)
  1420. const { type, row, column, value, target } = event
  1421. switch (column.key) {
  1422. case 'purchaseDecimal':
  1423. case 'commodityDecimal':
  1424. case 'wholesaleDecimal':
  1425. case 'lowDecimal':
  1426. this.changeDecimalByValue(row)
  1427. break
  1428. }
  1429. },
  1430. //修改商品明细中的价格触发计算
  1431. changeDecimalByValue(row) {
  1432. let unitArr = this.unitList
  1433. let basicUnit = '',
  1434. otherUnit = '',
  1435. ratio = 1,
  1436. otherUnitTwo = '',
  1437. ratioTwo = 1,
  1438. otherUnitThree = '',
  1439. ratioThree = 1
  1440. for (let i = 0; i < unitArr.length; i++) {
  1441. if (unitArr[i].id === this.form.getFieldValue('unitId')) {
  1442. basicUnit = unitArr[i].basicUnit
  1443. otherUnit = unitArr[i].otherUnit
  1444. ratio = unitArr[i].ratio
  1445. if (unitArr[i].otherUnitTwo) {
  1446. otherUnitTwo = unitArr[i].otherUnitTwo
  1447. ratioTwo = unitArr[i].ratioTwo
  1448. }
  1449. if (unitArr[i].otherUnitThree) {
  1450. otherUnitThree = unitArr[i].otherUnitThree
  1451. ratioThree = unitArr[i].ratioThree
  1452. }
  1453. }
  1454. }
  1455. if (row.commodityUnit === basicUnit) {
  1456. this.$refs.editableMeTable.getValues((error, values) => {
  1457. let mArr = values,
  1458. basicPurchaseDecimal = '',
  1459. basicCommodityDecimal = '',
  1460. basicWholesaleDecimal = '',
  1461. basicLowDecimal = ''
  1462. for (let i = 0; i < mArr.length; i++) {
  1463. let mInfo = mArr[i]
  1464. if (i === 0) {
  1465. basicPurchaseDecimal = mInfo.purchaseDecimal
  1466. basicCommodityDecimal = mInfo.commodityDecimal
  1467. basicWholesaleDecimal = mInfo.wholesaleDecimal
  1468. basicLowDecimal = mInfo.lowDecimal
  1469. } else {
  1470. //副单位进行换算
  1471. if (basicPurchaseDecimal) {
  1472. mInfo.purchaseDecimal = (basicPurchaseDecimal * ratio).toFixed(2)
  1473. }
  1474. if (basicCommodityDecimal) {
  1475. mInfo.commodityDecimal = (basicCommodityDecimal * ratio).toFixed(2)
  1476. }
  1477. if (basicWholesaleDecimal) {
  1478. mInfo.wholesaleDecimal = (basicWholesaleDecimal * ratio).toFixed(2)
  1479. }
  1480. if (basicLowDecimal) {
  1481. mInfo.lowDecimal = (basicLowDecimal * ratio).toFixed(2)
  1482. }
  1483. if (otherUnitTwo && i === 2) {
  1484. if (basicPurchaseDecimal) {
  1485. mInfo.purchaseDecimal = (basicPurchaseDecimal * ratioTwo).toFixed(2)
  1486. }
  1487. if (basicCommodityDecimal) {
  1488. mInfo.commodityDecimal = (basicCommodityDecimal * ratioTwo).toFixed(2)
  1489. }
  1490. if (basicWholesaleDecimal) {
  1491. mInfo.wholesaleDecimal = (basicWholesaleDecimal * ratioTwo).toFixed(2)
  1492. }
  1493. if (basicLowDecimal) {
  1494. mInfo.lowDecimal = (basicLowDecimal * ratioTwo).toFixed(2)
  1495. }
  1496. }
  1497. if (otherUnitThree && i === 3) {
  1498. if (basicPurchaseDecimal) {
  1499. mInfo.purchaseDecimal = (basicPurchaseDecimal * ratioThree).toFixed(2)
  1500. }
  1501. if (basicCommodityDecimal) {
  1502. mInfo.commodityDecimal = (basicCommodityDecimal * ratioThree).toFixed(2)
  1503. }
  1504. if (basicWholesaleDecimal) {
  1505. mInfo.wholesaleDecimal = (basicWholesaleDecimal * ratioThree).toFixed(2)
  1506. }
  1507. if (basicLowDecimal) {
  1508. mInfo.lowDecimal = (basicLowDecimal * ratioThree).toFixed(2)
  1509. }
  1510. }
  1511. }
  1512. }
  1513. this.meTable.dataSource = mArr
  1514. })
  1515. }
  1516. },
  1517. batchSetPrice(type) {
  1518. if (this.manySkuSelected > 0 || this.model.id) {
  1519. this.$refs.priceModalForm.add(type)
  1520. this.$refs.priceModalForm.disableSubmit = false
  1521. } else {
  1522. this.$message.warning('抱歉,只有开启多属性才能进行批量操作!')
  1523. }
  1524. },
  1525. batchSetStock(type) {
  1526. this.$refs.stockModalForm.add(type)
  1527. this.$refs.stockModalForm.disableSubmit = false
  1528. },
  1529. batchSetPriceModalFormOk(price, batchType) {
  1530. let arr = this.meTable.dataSource
  1531. if (arr.length === 0) {
  1532. this.$message.warning('请先录入条码、单位等信息!')
  1533. } else {
  1534. let meTableData = []
  1535. for (let i = 0; i < arr.length; i++) {
  1536. let meInfo = {
  1537. barCode: arr[i].barCode,
  1538. commodityUnit: arr[i].commodityUnit,
  1539. sku: arr[i].sku,
  1540. purchaseDecimal: arr[i].purchaseDecimal,
  1541. commodityDecimal: arr[i].commodityDecimal,
  1542. wholesaleDecimal: arr[i].wholesaleDecimal,
  1543. lowDecimal: arr[i].lowDecimal,
  1544. }
  1545. if (batchType === 'purchase') {
  1546. meInfo.purchaseDecimal = price - 0
  1547. } else if (batchType === 'commodity') {
  1548. meInfo.commodityDecimal = price - 0
  1549. } else if (batchType === 'wholesale') {
  1550. meInfo.wholesaleDecimal = price - 0
  1551. } else if (batchType === 'low') {
  1552. meInfo.lowDecimal = price - 0
  1553. }
  1554. if (arr[i].id) {
  1555. meInfo.id = arr[i].id
  1556. }
  1557. meTableData.push(meInfo)
  1558. }
  1559. this.meTable.dataSource = meTableData
  1560. }
  1561. },
  1562. batchSetStockModalFormOk(stock, batchType) {
  1563. let arr = this.depotTable.dataSource
  1564. let depotTableData = []
  1565. for (let i = 0; i < arr.length; i++) {
  1566. let depotInfo = {
  1567. name: arr[i].name,
  1568. initStock: arr[i].initStock,
  1569. lowSafeStock: arr[i].lowSafeStock,
  1570. highSafeStock: arr[i].highSafeStock,
  1571. }
  1572. if (batchType === 'initStock') {
  1573. depotInfo.initStock = stock - 0
  1574. } else if (batchType === 'lowSafeStock') {
  1575. depotInfo.lowSafeStock = stock - 0
  1576. } else if (batchType === 'highSafeStock') {
  1577. depotInfo.highSafeStock = stock - 0
  1578. }
  1579. if (arr[i].id) {
  1580. depotInfo.id = arr[i].id
  1581. }
  1582. depotTableData.push(depotInfo)
  1583. }
  1584. this.depotTable.dataSource = depotTableData
  1585. },
  1586. initMaterialAttribute() {
  1587. getMaterialAttributeNameList().then((res) => {
  1588. if (res) {
  1589. this.materialAttributeList = res
  1590. }
  1591. })
  1592. },
  1593. loadParseMaterialProperty() {
  1594. let mpList = Vue.ls.get('materialPropertyList')
  1595. for (let i = 0; i < mpList.length; i++) {
  1596. if (mpList[i].nativeName === '制造商') {
  1597. this.mpShort.mfrs.name = mpList[i].anotherName
  1598. this.mpShort.mfrs.enabled = mpList[i].enabled
  1599. }
  1600. if (mpList[i].nativeName === '自定义1') {
  1601. this.mpShort.otherField1.name = mpList[i].anotherName
  1602. this.mpShort.otherField1.enabled = mpList[i].enabled
  1603. }
  1604. if (mpList[i].nativeName === '自定义2') {
  1605. this.mpShort.otherField2.name = mpList[i].anotherName
  1606. this.mpShort.otherField2.enabled = mpList[i].enabled
  1607. }
  1608. if (mpList[i].nativeName === '自定义3') {
  1609. this.mpShort.otherField3.name = mpList[i].anotherName
  1610. this.mpShort.otherField3.enabled = mpList[i].enabled
  1611. }
  1612. }
  1613. },
  1614. handleNameChange(e) {
  1615. let that = this
  1616. if (e.target.value) {
  1617. if (this.setTimeFlag != null) {
  1618. clearTimeout(this.setTimeFlag)
  1619. }
  1620. this.setTimeFlag = setTimeout(() => {
  1621. changeNameToPinYin({ name: e.target.value }).then((res) => {
  1622. if (res && res.code === 200) {
  1623. that.form.setFieldsValue({ mnemonic: res.data })
  1624. } else {
  1625. that.$message.warning(res.data)
  1626. }
  1627. })
  1628. }, 500)
  1629. } else {
  1630. that.form.setFieldsValue({ mnemonic: '' })
  1631. }
  1632. },
  1633. onlyUnitOnChange(e) {
  1634. if (e.target.value) {
  1635. //单位有填写了之后则显示多属性的文本框
  1636. this.manySkuStatus = true
  1637. } else {
  1638. this.manySkuStatus = false
  1639. }
  1640. this.$refs.editableMeTable.getValues((error, values) => {
  1641. let mArr = values
  1642. for (let i = 0; i < mArr.length; i++) {
  1643. let mInfo = mArr[i]
  1644. mInfo.commodityUnit = e.target.value
  1645. }
  1646. this.meTable.dataSource = mArr
  1647. })
  1648. },
  1649. manyUnitOnChange(value) {
  1650. let unitArr = this.unitList
  1651. let basicUnit = '',
  1652. otherUnit = '',
  1653. ratio = 1,
  1654. otherUnitTwo = '',
  1655. ratioTwo = 1,
  1656. otherUnitThree = '',
  1657. ratioThree = 1
  1658. for (let i = 0; i < unitArr.length; i++) {
  1659. if (unitArr[i].id === value) {
  1660. basicUnit = unitArr[i].basicUnit
  1661. otherUnit = unitArr[i].otherUnit
  1662. ratio = unitArr[i].ratio
  1663. if (unitArr[i].otherUnitTwo) {
  1664. otherUnitTwo = unitArr[i].otherUnitTwo
  1665. ratioTwo = unitArr[i].ratioTwo
  1666. }
  1667. if (unitArr[i].otherUnitThree) {
  1668. otherUnitThree = unitArr[i].otherUnitThree
  1669. ratioThree = unitArr[i].ratioThree
  1670. }
  1671. }
  1672. }
  1673. this.$refs.editableMeTable.getValues((error, values) => {
  1674. let mArr = values,
  1675. basicPurchaseDecimal = '',
  1676. basicCommodityDecimal = '',
  1677. basicWholesaleDecimal = '',
  1678. basicLowDecimal = ''
  1679. for (let i = 0; i < mArr.length; i++) {
  1680. let mInfo = mArr[i]
  1681. if (i === 0) {
  1682. mInfo.commodityUnit = basicUnit
  1683. basicPurchaseDecimal = mInfo.purchaseDecimal
  1684. basicCommodityDecimal = mInfo.commodityDecimal
  1685. basicWholesaleDecimal = mInfo.wholesaleDecimal
  1686. basicLowDecimal = mInfo.lowDecimal
  1687. } else {
  1688. //副单位进行换算
  1689. mInfo.commodityUnit = otherUnit
  1690. if (basicPurchaseDecimal) {
  1691. mInfo.purchaseDecimal = (basicPurchaseDecimal * ratio).toFixed(2)
  1692. }
  1693. if (basicCommodityDecimal) {
  1694. mInfo.commodityDecimal = (basicCommodityDecimal * ratio).toFixed(2)
  1695. }
  1696. if (basicWholesaleDecimal) {
  1697. mInfo.wholesaleDecimal = (basicWholesaleDecimal * ratio).toFixed(2)
  1698. }
  1699. if (basicLowDecimal) {
  1700. mInfo.lowDecimal = (basicLowDecimal * ratio).toFixed(2)
  1701. }
  1702. if (otherUnitTwo && i === 2) {
  1703. mInfo.commodityUnit = otherUnitTwo
  1704. if (basicPurchaseDecimal) {
  1705. mInfo.purchaseDecimal = (basicPurchaseDecimal * ratioTwo).toFixed(2)
  1706. }
  1707. if (basicCommodityDecimal) {
  1708. mInfo.commodityDecimal = (basicCommodityDecimal * ratioTwo).toFixed(2)
  1709. }
  1710. if (basicWholesaleDecimal) {
  1711. mInfo.wholesaleDecimal = (basicWholesaleDecimal * ratioTwo).toFixed(2)
  1712. }
  1713. if (basicLowDecimal) {
  1714. mInfo.lowDecimal = (basicLowDecimal * ratioTwo).toFixed(2)
  1715. }
  1716. }
  1717. if (otherUnitThree && i === 3) {
  1718. mInfo.commodityUnit = otherUnitThree
  1719. if (basicPurchaseDecimal) {
  1720. mInfo.purchaseDecimal = (basicPurchaseDecimal * ratioThree).toFixed(2)
  1721. }
  1722. if (basicCommodityDecimal) {
  1723. mInfo.commodityDecimal = (basicCommodityDecimal * ratioThree).toFixed(2)
  1724. }
  1725. if (basicWholesaleDecimal) {
  1726. mInfo.wholesaleDecimal = (basicWholesaleDecimal * ratioThree).toFixed(2)
  1727. }
  1728. if (basicLowDecimal) {
  1729. mInfo.lowDecimal = (basicLowDecimal * ratioThree).toFixed(2)
  1730. }
  1731. }
  1732. }
  1733. }
  1734. this.meTable.dataSource = mArr
  1735. })
  1736. },
  1737. unitOnChange(e) {
  1738. let isChecked = e.target.checked
  1739. if (isChecked) {
  1740. this.unitStatus = true
  1741. this.manyUnitStatus = false
  1742. this.unitChecked = true
  1743. } else {
  1744. this.unitStatus = false
  1745. this.manyUnitStatus = true
  1746. this.unitChecked = false
  1747. }
  1748. },
  1749. addUnit() {
  1750. this.$refs.unitModalForm.add()
  1751. this.$refs.unitModalForm.title = '新增多单位'
  1752. this.$refs.unitModalForm.disableSubmit = false
  1753. },
  1754. unitModalFormOk() {
  1755. this.loadUnitListData()
  1756. },
  1757. },
  1758. }
  1759. </script>
  1760. <style scoped>
  1761. .input-table {
  1762. max-width: 100%;
  1763. min-width: 1200px;
  1764. }
  1765. .tag-info {
  1766. font-size: 14px;
  1767. height: 32px;
  1768. line-height: 32px;
  1769. width: 100%;
  1770. padding: 0px 11px;
  1771. color: #bbb;
  1772. background-color: #ffffff;
  1773. }
  1774. </style>