inventoryTable.vue 74 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418
  1. <template>
  2. <el-form ref="form" :model="form" :rules="rules">
  3. <ele-pro-table
  4. ref="table"
  5. :needPage="false"
  6. :columns="columns"
  7. :datasource="form.datasource"
  8. class="time-form"
  9. height="300"
  10. full-height="calc(100vh - 76px)"
  11. @columns-change="handleColumnChange"
  12. :cache-key="cacheKeyUrl"
  13. :selection.sync="selection"
  14. >
  15. <!-- 表头工具栏 -->
  16. <template v-slot:toolbar>
  17. <div class="headbox">
  18. <div>
  19. <el-button
  20. size="small"
  21. type="primary"
  22. icon="el-icon-plus"
  23. class="ele-btn-icon"
  24. @click="handParent('', -1)"
  25. >
  26. 新增
  27. </el-button>
  28. <el-button
  29. size="small"
  30. type="primary"
  31. icon="el-icon-plus"
  32. class="ele-btn-icon"
  33. v-if="isGoods"
  34. @click="handGoods(-1)"
  35. >
  36. 选择商品
  37. </el-button>
  38. <el-button
  39. size="small"
  40. type="primary"
  41. icon="el-icon-plus"
  42. class="ele-btn-icon"
  43. v-if="isTemporary"
  44. @click="handlAdd"
  45. >
  46. 新增临时产品
  47. </el-button>
  48. <el-button
  49. size="small"
  50. type="primary"
  51. class="ele-btn-icon"
  52. @click="save"
  53. v-if="isDrawer"
  54. >
  55. 保存
  56. </el-button>
  57. <setAllValue
  58. :disabled="!selection.length"
  59. title="客户期望交期"
  60. @success="setAllValueChange"
  61. valueKey="customerExpectDeliveryDeadline"
  62. />
  63. <setAllValue
  64. :disabled="!selection.length"
  65. title="生产交付交期"
  66. valueKey="produceDeliveryDeadline"
  67. @success="setAllValueChange"
  68. />
  69. </div>
  70. <div class="pricebox">
  71. <span class="amount">总计:{{ allPrice }}元</span>
  72. <el-form-item
  73. style="width: 300px"
  74. v-if="isDiscountTotalPrice"
  75. label="优惠后总金额:"
  76. prop="discountTotalPrice"
  77. :rules="{
  78. required: true,
  79. message: '请输入优惠后总金额',
  80. trigger: 'change'
  81. }"
  82. >
  83. <el-input
  84. type="number"
  85. :min="0"
  86. :max="allPrice"
  87. :disabled="!allPrice"
  88. v-model="form.discountTotalPrice"
  89. style="width: 180px"
  90. placeholder="请输入"
  91. @input="discountInputByOrder(form.discountTotalPrice)"
  92. >
  93. <template slot="append">元</template>
  94. </el-input>
  95. </el-form-item>
  96. </div>
  97. </div>
  98. </template>
  99. <template v-slot:productName="{ row, $index }">
  100. <el-form-item
  101. :prop="'datasource.' + $index + '.productName'"
  102. :rules="{
  103. required: true,
  104. message: '请输入',
  105. trigger: 'change'
  106. }"
  107. >
  108. <el-input
  109. :disabled="!!row.productId && row.productId != 0"
  110. v-model="row.productName"
  111. placeholder="请输入"
  112. style="width: 60%; margin-right: 10px"
  113. ></el-input>
  114. <el-button
  115. size="small"
  116. type="primary"
  117. @click.native="handParent(row, $index)"
  118. >选择
  119. </el-button>
  120. </el-form-item>
  121. </template>
  122. <template v-slot:entrustedEnterpriseId="scope">
  123. <el-form-item prop="entrustedEnterpriseId">
  124. <el-select
  125. v-model="scope.row.entrustedEnterpriseId"
  126. clearable
  127. filterable
  128. >
  129. <el-option
  130. v-for="i in scope.row.entrustedEnterpriseIdList"
  131. :key="i.id"
  132. :value="i.id"
  133. :label="i.name"
  134. ></el-option>
  135. </el-select>
  136. </el-form-item>
  137. </template>
  138. <template v-slot:headerCustomerMark="{ column }">
  139. <span class="is-required">{{ column.label }}</span>
  140. </template>
  141. <template v-slot:customerMark="{ row, $index }">
  142. <el-form-item
  143. :prop="'datasource.' + $index + '.customerMark'"
  144. :rules="{
  145. required: isCustomerMark ? true : false,
  146. message: '请输入客户代号',
  147. trigger: 'change'
  148. }"
  149. >
  150. <el-input
  151. v-model="row.customerMark"
  152. :disabled="quoteType === 2"
  153. placeholder="请输入"
  154. ></el-input>
  155. </el-form-item>
  156. </template>
  157. <template v-slot:headerProductName="{ column }">
  158. <span class="is-required">{{ column.label }}</span>
  159. </template>
  160. <template v-slot:productCode="scope">
  161. <el-form-item :prop="'datasource.' + scope.$index + '.productCode'">
  162. <el-input
  163. v-model="scope.row.productCode"
  164. :disabled="
  165. quoteType != 2 ||
  166. (!!scope.row.productId && scope.row.productId != 0)
  167. "
  168. ></el-input>
  169. </el-form-item>
  170. </template>
  171. <template v-slot:productCategoryName="scope">
  172. <el-form-item
  173. :prop="'datasource.' + scope.$index + '.productCategoryName'"
  174. >
  175. <el-input v-model="scope.row.productCategoryName" disabled></el-input>
  176. </el-form-item>
  177. </template>
  178. <template v-slot:headerTotalCount="{ column }">
  179. <span :class="{ 'is-required': isTotalCount }">{{ column.label }}</span>
  180. </template>
  181. <template v-slot:headerTaxRate="{ column }">
  182. <span class="is-required">{{ column.label }}</span>
  183. </template>
  184. <template v-slot:totalPrice="scope">
  185. <el-form-item :prop="'datasource.' + scope.$index + '.totalPrice'">
  186. {{ (Number(scope.row.totalPrice) || 0).toFixed(2) }}元
  187. </el-form-item>
  188. </template>
  189. <template v-slot:productBrand="scope">
  190. <el-form-item :prop="'datasource.' + scope.$index + '.productBrand'">
  191. <el-input
  192. v-model="scope.row.productBrand"
  193. :disabled="!!scope.row.productId && scope.row.productId != 0"
  194. ></el-input>
  195. </el-form-item>
  196. </template>
  197. <template v-slot:modelType="scope">
  198. <el-form-item :prop="'datasource.' + scope.$index + '.modelType'">
  199. <el-input
  200. v-model="scope.row.modelType"
  201. :disabled="!!scope.row.productId && scope.row.productId != 0"
  202. ></el-input>
  203. </el-form-item>
  204. </template>
  205. <template v-slot:specification="scope">
  206. <el-form-item :prop="'datasource.' + scope.$index + '.specification'">
  207. <el-input
  208. v-model="scope.row.specification"
  209. :disabled="!!scope.row.productId && scope.row.productId != 0"
  210. ></el-input>
  211. </el-form-item>
  212. </template>
  213. <template v-slot:guaranteePeriod="scope">
  214. <div class="period">
  215. <div class="borderleftnone">
  216. <el-form-item
  217. :prop="'datasource.' + scope.$index + '.guaranteePeriod'"
  218. :rules="{
  219. pattern: numberReg,
  220. message: '请输入有效期',
  221. trigger: 'blur'
  222. }"
  223. >
  224. <el-input
  225. v-model="scope.row.guaranteePeriod"
  226. @change="
  227. setDeliveryDays(scope.row, scope.$index, 'guaranteePeriod')
  228. "
  229. placeholder="请输入"
  230. ></el-input>
  231. </el-form-item>
  232. </div>
  233. <div class="borderrightnone">
  234. <DictSelection
  235. dictName="质保期单位"
  236. clearable
  237. v-model="scope.row.guaranteePeriodUnitCode"
  238. @change="
  239. setDeliveryDays(scope.row, scope.$index, 'guaranteePeriod')
  240. "
  241. :isOne="scope.$index === 0"
  242. >
  243. </DictSelection>
  244. </div>
  245. </div>
  246. </template>
  247. <!-- <template v-slot:measuringUnit="scope">
  248. <el-form-item :prop="'datasource.' + scope.$index + '.measuringUnit'">
  249. <el-input
  250. v-model="scope.row.measuringUnit"
  251. :disabled="!!scope.row.productCode"
  252. placeholder="请输入"
  253. ></el-input>
  254. </el-form-item>
  255. </template> -->
  256. <template v-slot:remark="scope">
  257. <el-form-item :prop="'datasource.' + scope.$index + '.remark'">
  258. <el-input
  259. v-model="scope.row.remark"
  260. type="textarea"
  261. placeholder="请输入"
  262. ></el-input>
  263. </el-form-item>
  264. </template>
  265. <template v-slot:singlePrice="scope">
  266. <el-form-item
  267. :prop="'datasource.' + scope.$index + '.singlePrice'"
  268. :rules="{
  269. required: quoteType !== 2 && isSinglePrice ? true : false,
  270. message: '请输入单价',
  271. trigger: 'change'
  272. }"
  273. >
  274. <el-input
  275. v-model="scope.row.singlePrice"
  276. placeholder="请输入"
  277. :disabled="quoteType === 2"
  278. @input="changeCount(scope.row, scope.$index)"
  279. type="number"
  280. >
  281. <template slot="append">元</template>
  282. </el-input>
  283. </el-form-item>
  284. </template>
  285. <template v-slot:taxRate="scope">
  286. <el-form-item
  287. :prop="'datasource.' + scope.$index + '.taxRate'"
  288. :rules="{
  289. required: isTaxRate == 1 ? true : false,
  290. message: '请输入税率',
  291. trigger: 'change'
  292. }"
  293. >
  294. <el-input
  295. v-model="scope.row.taxRate"
  296. placeholder="请输入"
  297. type="number"
  298. :disabled="quoteType === 2"
  299. @input="getNotaxSinglePrice"
  300. >
  301. <template slot="append">%</template>
  302. </el-input>
  303. </el-form-item>
  304. </template>
  305. <template v-slot:headerSinglePrice="{ column }">
  306. <span :class="isSinglePrice ? 'is-required' : ''">{{
  307. column.label
  308. }}</span>
  309. </template>
  310. <template v-slot:headerCustomerExpectDeliveryDeadline="{ column }">
  311. <span :class="isDate == 1 ? 'is-required' : ''">{{
  312. column.label
  313. }}</span>
  314. </template>
  315. <template v-slot:technicalAnswerName="{ row, $index }">
  316. <el-form-item :prop="'datasource.' + $index + '.technicalAnswerName'">
  317. <el-input
  318. v-model="row.technicalAnswerName"
  319. placeholder="请输入"
  320. @click.native="handHead(row, $index)"
  321. ></el-input>
  322. </el-form-item>
  323. </template>
  324. <template v-slot:technicalParams="scope">
  325. <el-form-item :prop="'datasource.' + scope.$index + '.technicalParams'">
  326. <el-input
  327. type="textarea"
  328. v-model="scope.row.technicalParams"
  329. placeholder="请输入"
  330. ></el-input>
  331. </el-form-item>
  332. </template>
  333. <template v-slot:technicalDrawings="scope">
  334. <el-form-item
  335. :prop="'datasource.' + scope.$index + '.technicalDrawings'"
  336. >
  337. <fileMain v-model="scope.row.technicalDrawings"></fileMain>
  338. </el-form-item>
  339. </template>
  340. <template v-slot:customerReqFiles="scope">
  341. <el-form-item
  342. :prop="'datasource.' + scope.$index + '.customerReqFiles'"
  343. >
  344. <fileMain v-model="scope.row.customerReqFiles"></fileMain>
  345. </el-form-item>
  346. </template>
  347. <template v-slot:industryArtFiles="scope">
  348. <el-form-item
  349. :prop="'datasource.' + scope.$index + '.industryArtFiles'"
  350. :rules="{
  351. required: false,
  352. message: '请输入',
  353. trigger: 'change'
  354. }"
  355. >
  356. <fileMain v-model="scope.row.industryArtFiles"></fileMain>
  357. </el-form-item>
  358. </template>
  359. <template v-slot:otherFiles="scope">
  360. <el-form-item :prop="'datasource.' + scope.$index + '. otherFiles'">
  361. <fileMain v-model="scope.row.otherFiles"></fileMain>
  362. </el-form-item>
  363. </template>
  364. <template v-slot:headerProduceDeliveryDeadline="{ column }">
  365. <span
  366. :class="isProduceDeliveryDeadline && isDate == 1 ? 'is-required' : ''"
  367. >{{ column.label }}</span
  368. >
  369. </template>
  370. <template v-slot:produceDeliveryDeadline="scope">
  371. <el-form-item
  372. :prop="'datasource.' + scope.$index + '.produceDeliveryDeadline'"
  373. :rules="{
  374. required: isProduceDeliveryDeadline && isDate == 1 ? true : false,
  375. message: '选择生产交付交期',
  376. trigger: 'change'
  377. }"
  378. >
  379. <el-date-picker
  380. style="width: 140px"
  381. value-format="yyyy-MM-dd"
  382. v-model="scope.row.produceDeliveryDeadline"
  383. @change="
  384. setDeliveryDays(scope.row, scope.$index, 'guaranteePeriod')
  385. "
  386. type="date"
  387. placeholder="选择日期"
  388. >
  389. </el-date-picker>
  390. </el-form-item>
  391. </template>
  392. <template v-slot:customerExpectDeliveryDeadline="scope">
  393. <el-form-item
  394. v-if="scope.row.arrivalWay == 1 || !scope.row.arrivalWay"
  395. :rules="{
  396. required: isDate == 1 && quoteType != 2 ? true : false,
  397. message:
  398. contractBookType == 1 ? '请选择客户期望交期' : '请选择交付日期',
  399. trigger: 'change'
  400. }"
  401. :prop="
  402. 'datasource.' + scope.$index + '.customerExpectDeliveryDeadline'
  403. "
  404. >
  405. <el-date-picker
  406. style="width: 140px"
  407. v-model="scope.row.customerExpectDeliveryDeadline"
  408. value-format="yyyy-MM-dd"
  409. @change="
  410. setDeliveryDays(scope.row, scope.$index, 'guaranteePeriod')
  411. "
  412. type="date"
  413. placeholder="选择日期"
  414. >
  415. </el-date-picker>
  416. </el-form-item>
  417. <el-form-item v-if="scope.row.arrivalWay == 2">
  418. <el-link
  419. type="primary"
  420. :underline="false"
  421. @click.native="handleMethod(scope.row, scope.$index)"
  422. >
  423. 设置分批时间
  424. </el-link>
  425. </el-form-item>
  426. </template>
  427. <template v-slot:provenance="scope">
  428. <el-form-item :prop="'datasource.' + scope.$index + '.provenance'">
  429. <DictSelection
  430. dictName="产地"
  431. clearable
  432. v-model="scope.row.provenance"
  433. :disabled="quoteType === 2"
  434. collapse-tags
  435. multiple
  436. :isOne="scope.$index === 0"
  437. >
  438. </DictSelection>
  439. </el-form-item>
  440. </template>
  441. <template v-slot:guaranteePeriodDeadline="scope">
  442. <el-form-item
  443. :prop="'datasource.' + scope.$index + '.guaranteePeriodDeadline'"
  444. >
  445. <el-date-picker
  446. style="width: 140px"
  447. v-model="scope.row.guaranteePeriodDeadline"
  448. type="date"
  449. value-format="yyyy-MM-dd"
  450. placeholder="选择日期"
  451. >
  452. </el-date-picker>
  453. </el-form-item>
  454. </template>
  455. <template v-slot:singleWeight="scope">
  456. <el-form-item :prop="'datasource.' + scope.$index + '.singleWeight'">
  457. <el-input
  458. v-model="scope.row.singleWeight"
  459. @input="handleCountChange(scope.row, scope.$index)"
  460. placeholder="请输入"
  461. >
  462. <template slot="append">
  463. <span v-if="!!scope.row.productId && scope.row.productId != 0">
  464. {{ scope.row.weightUnit }}
  465. </span>
  466. <el-input
  467. v-else
  468. v-model="scope.row.weightUnit"
  469. placeholder="单位"
  470. style="width: 80px; padding: 0"
  471. ></el-input>
  472. </template>
  473. </el-input>
  474. </el-form-item>
  475. </template>
  476. <template v-slot:technologyRouteName="scope">
  477. <el-form-item
  478. :prop="'datasource.' + scope.$index + '.technologyRouteName'"
  479. :rules="{
  480. required: false,
  481. message: '请选择',
  482. trigger: 'change'
  483. }"
  484. >
  485. <el-input
  486. v-model="scope.row.technologyRouteName"
  487. placeholder="请选择"
  488. @click.native="openVersion(scope.$index)"
  489. ></el-input>
  490. </el-form-item>
  491. </template>
  492. <template v-slot:pricingWay="scope">
  493. <el-form-item :prop="'datasource.' + scope.$index + '.pricingWay'">
  494. <el-select
  495. v-model="scope.row.pricingWay"
  496. placeholder="请选择"
  497. :rules="{
  498. required: true,
  499. message: '请选择计价方式',
  500. trigger: 'change'
  501. }"
  502. >
  503. <el-option
  504. v-for="item in pricingWayList"
  505. :key="item.id"
  506. :label="item.name"
  507. :value="item.id"
  508. @click.native="changeCount(scope.row, scope.$index)"
  509. >
  510. </el-option>
  511. </el-select>
  512. </el-form-item>
  513. </template>
  514. <template v-slot:headerPricingWay="{ column }">
  515. <span class="is-required">{{ column.label }}</span>
  516. </template>
  517. <template v-slot:taskName="scope">
  518. <el-form-item :prop="'datasource.' + scope.$index + '.taskName'">
  519. <el-input
  520. v-model="scope.row.taskName"
  521. placeholder="请选择"
  522. style="width: 60%; margin-right: 10px"
  523. disabled
  524. ></el-input>
  525. <el-button
  526. size="small"
  527. type="primary"
  528. @click.native="handleTaskinstance(scope.row, scope.$index)"
  529. >选择
  530. </el-button>
  531. </el-form-item>
  532. </template>
  533. <template v-slot:arrivalWay="scope">
  534. <el-form-item :prop="'datasource.' + scope.$index + '.arrivalWay'">
  535. <el-select
  536. v-model="scope.row.arrivalWay"
  537. clearable
  538. style="width: 100%"
  539. >
  540. <el-option
  541. v-for="item in arrivalWayList"
  542. :key="item.value"
  543. :label="item.label"
  544. :value="item.value"
  545. >
  546. </el-option>
  547. </el-select>
  548. </el-form-item>
  549. </template>
  550. <template v-slot:batchNo="scope">
  551. <el-form-item
  552. :prop="'datasource.' + scope.$index + '.batchNo'"
  553. :rules="[
  554. {
  555. required: isBatchNo == 1 ? true : false,
  556. message: '请输入批号',
  557. trigger: 'blur'
  558. }
  559. ]"
  560. >
  561. <el-input
  562. v-model="scope.row.batchNo"
  563. placeholder="请输入"
  564. :disabled="quoteType === 2"
  565. v-no-chinese
  566. >
  567. </el-input>
  568. </el-form-item>
  569. </template>
  570. <template v-slot:headerBatchNo="{ column }">
  571. <span class="is-required">{{ column.label }}</span>
  572. </template>
  573. <template v-slot:orderNo="{ row, $index }">
  574. <el-form-item :prop="'datasource.' + $index + '.orderNo'">
  575. <el-select v-model="row.orderNo" style="width: 100%">
  576. <el-option
  577. :label="item.orderNo"
  578. :value="item.orderNo"
  579. @click.native="orderNoChange(row, item)"
  580. v-for="(item, index) in orderOption"
  581. :key="index"
  582. ></el-option>
  583. </el-select>
  584. </el-form-item>
  585. </template>
  586. <template v-slot:goodsLevel="{ row, $index }">
  587. <el-form-item :prop="'datasource.' + $index + '.goodsLevel'">
  588. <el-select
  589. v-model="row.goodsLevel"
  590. style="width: 100%"
  591. :disabled="quoteType === 2"
  592. >
  593. <el-option
  594. :label="item.label"
  595. :value="item.value"
  596. v-for="(item, index) in levelList"
  597. :key="index"
  598. ></el-option>
  599. </el-select>
  600. </el-form-item>
  601. </template>
  602. <template v-slot:goodsPriceType="{ row, $index }">
  603. <el-form-item :prop="'datasource.' + $index + '.goodsPriceType'">
  604. <DictSelection
  605. dictName="商品价格类型"
  606. clearable
  607. :disabled="quoteType === 2"
  608. v-model="row.goodsPriceType"
  609. @change="goodsPriceTypeChange(row, $index)"
  610. :isOne="$index === 0"
  611. >
  612. </DictSelection>
  613. </el-form-item>
  614. </template>
  615. <template v-slot:saleCount="scope">
  616. <el-form-item
  617. :prop="'datasource.' + scope.$index + '.' + countObj.countKey"
  618. :rules="{
  619. required: quoteType !== 2 && isTotalCount ? true : false,
  620. message: '请输入数量',
  621. trigger: 'change'
  622. }"
  623. >
  624. <el-input
  625. v-model="scope.row[countObj.countKey]"
  626. placeholder="请输入"
  627. type="number"
  628. :min="0"
  629. @input="handleCountChange(scope.row, scope.$index)"
  630. >
  631. <template slot="append">
  632. <el-select
  633. v-model="scope.row[countObj.unitIdKey]"
  634. style="width: 80px"
  635. v-if="!!scope.row.productId && scope.row.productId != 0"
  636. >
  637. <el-option
  638. :label="item.conversionUnit"
  639. :value="item.id"
  640. @click.native="packingChange(item, scope.$index)"
  641. v-for="(item, index) in scope.row.packageDispositionList"
  642. :key="index"
  643. ></el-option>
  644. </el-select>
  645. <el-input
  646. v-else
  647. v-model="scope.row.measuringUnit"
  648. placeholder="单位"
  649. style="width: 80px; padding: 0"
  650. ></el-input>
  651. </template>
  652. </el-input>
  653. </el-form-item>
  654. </template>
  655. <!-- <template v-slot:saleUnit="scope">
  656. <el-form-item
  657. :prop="'datasource.' + scope.$index + '.' + countObj.unitIdKey"
  658. >
  659. <el-select
  660. v-model="scope.row[countObj.unitIdKey]"
  661. style="width: 100%"
  662. @change="changeCount(scope.row, scope.$index)"
  663. >
  664. <el-option
  665. :label="item.conversionUnit"
  666. :value="item.id"
  667. @click.native="packingChange(item, scope.$index)"
  668. v-for="(item, index) in scope.row.packageDispositionList"
  669. :key="index"
  670. ></el-option>
  671. </el-select>
  672. </el-form-item>
  673. </template> -->
  674. <template v-slot:modelKey="scope">
  675. <el-form-item :prop="'datasource.' + scope.$index + '.' + 'modelKey'">
  676. <DictSelection
  677. dictName="物品机型"
  678. clearable
  679. :disabled="quoteType === 2"
  680. v-model="scope.row.modelKey"
  681. :isOne="scope.$index === 0"
  682. filterable
  683. allow-create
  684. default-first-option
  685. multiple
  686. >
  687. </DictSelection>
  688. </el-form-item>
  689. </template>
  690. <template v-slot:colorKey="scope">
  691. <el-form-item :prop="'datasource.' + scope.$index + '.' + 'colorKey'">
  692. <DictSelection
  693. dictName="物品颜色"
  694. clearable
  695. v-model="scope.row.colorKey"
  696. :isOne="scope.$index === 0"
  697. filterable
  698. allow-create
  699. default-first-option
  700. multiple
  701. >
  702. </DictSelection>
  703. </el-form-item>
  704. </template>
  705. <!-- 生产加工类型特有列的模板 -->
  706. <template v-slot:thickNess="{ row, $index }">
  707. <el-form-item :prop="'datasource.' + $index + '.thickNess'">
  708. <el-input v-model="row.thickNess" placeholder="请输入">
  709. <template slot="append">mm</template></el-input
  710. >
  711. </el-form-item>
  712. </template>
  713. <template v-slot:squareNumber="{ row, $index }">
  714. <el-form-item :prop="'datasource.' + $index + '.squareNumber'">
  715. <el-input v-model="row.squareNumber" placeholder="请输入">
  716. <template slot="append">m²</template></el-input
  717. >
  718. </el-form-item>
  719. </template>
  720. <template v-slot:processingFeeBeforeTax="{ row, $index }">
  721. <el-form-item
  722. :prop="'datasource.' + $index + '.processingFeeBeforeTax'"
  723. >
  724. <el-input
  725. v-model="row.processingFeeBeforeTax"
  726. type="number"
  727. placeholder="请输入"
  728. @input="calculateIncludingTaxPrice(row, $index)"
  729. >
  730. <template slot="append">元</template>
  731. </el-input>
  732. </el-form-item>
  733. </template>
  734. <template v-slot:packagingFeeNotTaxed="{ row, $index }">
  735. <el-form-item :prop="'datasource.' + $index + '.packagingFeeNotTaxed'">
  736. <el-input
  737. v-model="row.packagingFeeNotTaxed"
  738. type="number"
  739. placeholder="请输入"
  740. @input="calculateIncludingTaxPrice(row, $index)"
  741. >
  742. <template slot="append">元</template>
  743. </el-input>
  744. </el-form-item>
  745. </template>
  746. <template v-slot:transportationFeeWithoutTax="{ row, $index }">
  747. <el-form-item
  748. :prop="'datasource.' + $index + '.transportationFeeWithoutTax'"
  749. >
  750. <el-input
  751. v-model="row.transportationFeeWithoutTax"
  752. type="number"
  753. placeholder="请输入"
  754. @input="calculateIncludingTaxPrice(row, $index)"
  755. >
  756. <template slot="append">元</template>
  757. </el-input>
  758. </el-form-item>
  759. </template>
  760. <!-- 新增未税小记列模板 -->
  761. <template v-slot:quotationSubtotalBeforeTax="{ row, $index }">
  762. <el-form-item
  763. :prop="'datasource.' + $index + '.quotationSubtotalBeforeTax'"
  764. >
  765. {{ (Number(row.quotationSubtotalBeforeTax) || 0).toFixed(2) }}元
  766. </el-form-item>
  767. </template>
  768. <template v-slot:extraTax="{ row, $index }">
  769. <el-form-item :prop="'datasource.' + $index + '.extraTax'">
  770. <el-input
  771. v-model="row.extraTax"
  772. type="number"
  773. placeholder="请输入"
  774. @input="calculateIncludingTaxPrice(row, $index)"
  775. >
  776. <template slot="append">%</template>
  777. </el-input>
  778. </el-form-item>
  779. </template>
  780. <!-- 含税单价改为含税小计 -->
  781. <template v-slot:quotationSubtotalTax="{ row, $index }">
  782. <el-form-item :prop="'datasource.' + $index + '.quotationSubtotalTax'">
  783. {{ (Number(row.quotationSubtotalTax) || 0).toFixed(2) }}元
  784. <!-- <el-input
  785. v-model="row.quotationSubtotalTax"
  786. type="number"
  787. placeholder="请输入"
  788. >
  789. <template slot="append">元</template>
  790. </el-input> -->
  791. </el-form-item>
  792. </template>
  793. <template v-slot:productionRequirements="{ row, $index }">
  794. <el-form-item
  795. :prop="'datasource.' + $index + '.productionRequirements'"
  796. >
  797. <el-input
  798. v-model="row.productionRequirements"
  799. placeholder="请输入"
  800. type="textarea"
  801. >
  802. </el-input>
  803. </el-form-item>
  804. </template>
  805. <!-- 操作列 -->
  806. <template v-slot:action="scope">
  807. <el-popconfirm
  808. class="ele-action"
  809. title="确定要删除吗?"
  810. @confirm="remove(scope.$index)"
  811. >
  812. <template v-slot:reference>
  813. <el-link type="danger" :underline="false" icon="el-icon-delete">
  814. 删除
  815. </el-link>
  816. </template>
  817. </el-popconfirm>
  818. </template>
  819. </ele-pro-table>
  820. <product-list
  821. ref="productListRef"
  822. classType="1"
  823. :is-get-inventory-total="true"
  824. @changeParent="changeParent"
  825. :isSupplier="isSupplier"
  826. :isSalesRecord="isSalesRecord"
  827. ></product-list>
  828. <head-list ref="headRef" @changeParent="changeAnswer"></head-list>
  829. <ProductionVersion
  830. ref="versionRefs"
  831. @changeProduct="changeProduct"
  832. ></ProductionVersion>
  833. <taskinstance-dialog
  834. ref="taskinstanceDialogRef"
  835. v-if="taskinstanceDialogFlag"
  836. @saveTaskInstance="saveTaskInstance"
  837. :visible.sync="taskinstanceDialogFlag"
  838. ></taskinstance-dialog>
  839. <timeDialog
  840. @chooseTime="chooseTime"
  841. ref="timeDialogRef"
  842. :isBatch="true"
  843. ></timeDialog>
  844. <selectStockLedgerDialog
  845. ref="selectStockLedgerDialogRef"
  846. @changeParent="replaceTable"
  847. :isSupplier="isSupplier"
  848. ></selectStockLedgerDialog>
  849. <commodityPriceListDialog
  850. ref="commodityPriceListDialogRef"
  851. @changeParent="changeParent"
  852. ></commodityPriceListDialog>
  853. </el-form>
  854. </template>
  855. <script>
  856. import { numberReg } from 'ele-admin';
  857. import productList from '@/BIZComponents/product-list.vue';
  858. import dictMixins from '@/mixins/dictMixins';
  859. import fileUpload from '@/components/upload/fileUpload';
  860. import headList from '@/BIZComponents/user-select/user-select.vue';
  861. import ProductionVersion from '@/components/ProductionVersion2/index.vue';
  862. import { getInventoryTotalAPI } from '@/api/wms';
  863. import { pricingWayList, lbjtList } from '@/enum/dict.js';
  864. import { changeCount, getAllPrice } from '@/BIZComponents/setProduct.js';
  865. import { contactQueryByCategoryIdsAPI } from '@/api/saleManage/contact';
  866. import taskinstanceDialog from '@/BIZComponents/procedure/taskinstanceDialog.vue';
  867. import timeDialog from '@/components/timeDialog/index.vue';
  868. import { copyObj } from '@/utils/util';
  869. import selectStockLedgerDialog from '@/BIZComponents/selectStockLedger/selectStockLedgerDialog.vue'; //库存台账
  870. import setAllValue from '@/BIZComponents/setAllValue.vue'; //批量修改
  871. import tabMixins from '@/mixins/tableColumnsMixin';
  872. import commodityPriceListDialog from '@/views/commodityManagement/commodityPriceList/components/commodityPriceListDialog.vue';
  873. const dayjs = require('dayjs');
  874. import { levelList } from '@/enum/dict.js';
  875. import {
  876. getGoodsPriceByCondition,
  877. getGoodsByCategoryId
  878. } from '@/api/goodsManage/index';
  879. import { parameterGetByCode } from '@/api/main/index.js';
  880. export default {
  881. mixins: [dictMixins, tabMixins],
  882. components: {
  883. fileUpload,
  884. productList,
  885. headList,
  886. ProductionVersion,
  887. taskinstanceDialog,
  888. timeDialog,
  889. selectStockLedgerDialog,
  890. commodityPriceListDialog,
  891. setAllValue
  892. },
  893. props: {
  894. pageName: {
  895. default: '',
  896. type: String
  897. },
  898. isDiscountTotalPrice: {
  899. default: false,
  900. type: Boolean
  901. },
  902. quoteType: {
  903. type: Number,
  904. default: 1
  905. },
  906. isGuaranteePeriod: {
  907. default: true,
  908. type: Boolean
  909. },
  910. customerMark: {
  911. default: '',
  912. type: String
  913. },
  914. isContractId: {
  915. type: Boolean,
  916. default: false
  917. },
  918. isSinglePrice: {
  919. //单价必填
  920. type: Boolean,
  921. default: true
  922. },
  923. isTotalCount: {
  924. //数量必填
  925. type: Boolean,
  926. default: true
  927. },
  928. isCustomerMark: {
  929. //客户代号必填
  930. type: Boolean,
  931. default: false
  932. },
  933. isDiscount: {
  934. //折让
  935. type: Boolean,
  936. default: true
  937. },
  938. isProduceDeliveryDeadline: {
  939. //生产交付交期必填
  940. type: Boolean,
  941. default: false
  942. },
  943. isDrawer: {
  944. type: Boolean,
  945. default: false
  946. },
  947. isChangeCount: {
  948. //默认计算
  949. type: Boolean,
  950. default: true
  951. },
  952. contractBookType: {
  953. //合同类型 1销售 2采购
  954. type: [String, Number],
  955. default: 1
  956. },
  957. isTemporary: {
  958. //临时
  959. type: Boolean,
  960. default: false
  961. },
  962. isSupplier: {
  963. //供应商
  964. type: Boolean,
  965. default: false
  966. },
  967. isSalesRecord: {
  968. default: ''
  969. },
  970. isArrivalWay: {
  971. //分批到货时间
  972. type: Boolean,
  973. default: false
  974. },
  975. //订单类型
  976. needProduce: {
  977. type: [String, Number],
  978. default: 1
  979. },
  980. cacheKeyUrl: '',
  981. //是否显示订单编码
  982. isOrderNo: {
  983. type: Boolean,
  984. default: false
  985. },
  986. isBatchNo: {
  987. type: Boolean, //批次号是否必填
  988. default: false
  989. },
  990. orderOption: {
  991. default: () => {
  992. return [];
  993. }
  994. },
  995. //是否商品
  996. isGoods: {
  997. type: Boolean,
  998. default: false
  999. },
  1000. // 是否税率必填
  1001. isTaxRate: {
  1002. type: [Number, String],
  1003. default: 0
  1004. },
  1005. defTaxRate: {
  1006. type: Number,
  1007. default: undefined
  1008. },
  1009. countObj: {
  1010. type: Object,
  1011. default: () => {
  1012. return {
  1013. countKey: 'saleCount',
  1014. unitKey: 'saleUnit',
  1015. unitIdKey: 'saleUnitId'
  1016. };
  1017. }
  1018. }
  1019. },
  1020. data() {
  1021. const defaultForm = {
  1022. key: null,
  1023. endTime: '',
  1024. isFirst: 0,
  1025. name: '',
  1026. startTime: '',
  1027. workHour: '',
  1028. guaranteePeriodUnitCode: '',
  1029. technicalDrawings: [],
  1030. arrivalWay: 1,
  1031. // 生产加工类型特有字段
  1032. thickNess: '',
  1033. squareNumber: '',
  1034. processingFeeBeforeTax: '',
  1035. packagingFeeNotTaxed: '',
  1036. transportationFeeWithoutTax: '',
  1037. extraTax: '',
  1038. quotationSubtotalTax: '',
  1039. // 新增未税小记字段
  1040. quotationSubtotalBeforeTax: ''
  1041. };
  1042. return {
  1043. levelList,
  1044. taskinstanceDialogFlag: false,
  1045. allPrice: 0,
  1046. numberReg,
  1047. defaultForm,
  1048. form: {
  1049. datasource: [],
  1050. discountTotalPrice: 0
  1051. },
  1052. isDate: 1,
  1053. pricingWayList,
  1054. curIndex: '',
  1055. rules: {},
  1056. dictList: {},
  1057. arrivalWayList: [
  1058. { label: '一次性到货', value: 1 },
  1059. { label: '分批到货', value: 2 }
  1060. ],
  1061. columnsVersion: 1,
  1062. selection: []
  1063. };
  1064. },
  1065. computed: {
  1066. canHandl() {
  1067. return this.form.datasource.length;
  1068. },
  1069. columns() {
  1070. let columnsVersion = this.columnsVersion;
  1071. // 基础列定义
  1072. let baseColumns = [
  1073. {
  1074. width: 45,
  1075. type: 'index',
  1076. columnKey: 'index',
  1077. align: 'center',
  1078. fixed: 'left'
  1079. },
  1080. {
  1081. label: '选择',
  1082. width: 45,
  1083. type: 'selection',
  1084. columnKey: 'selection',
  1085. align: 'center',
  1086. fixed: 'left'
  1087. },
  1088. {
  1089. minWidth: 200,
  1090. prop: 'orderNo',
  1091. slot: 'orderNo',
  1092. label: '订单编码',
  1093. isNone: !this.isOrderNo,
  1094. showOverflowTooltip: true,
  1095. align: 'center'
  1096. },
  1097. {
  1098. width: 280,
  1099. prop: 'productName',
  1100. label: '名称',
  1101. slot: 'productName',
  1102. headerSlot: 'headerProductName',
  1103. align: 'center',
  1104. fixed: 'left'
  1105. },
  1106. {
  1107. width: 120,
  1108. prop: 'productCode',
  1109. label: '编码',
  1110. slot: 'productCode',
  1111. align: 'center'
  1112. },
  1113. {
  1114. width: 120,
  1115. prop: 'specification',
  1116. label: '规格',
  1117. slot: 'specification',
  1118. align: 'center'
  1119. },
  1120. {
  1121. minWidth: 240,
  1122. prop: 'taskName',
  1123. label: '工序',
  1124. slot: 'taskName',
  1125. align: 'center'
  1126. },
  1127. {
  1128. minWidth: 120,
  1129. prop: 'entrustedEnterpriseId',
  1130. label: '受托企业',
  1131. slot: 'entrustedEnterpriseId',
  1132. isNone: !this.isCustomerMark,
  1133. align: 'center'
  1134. },
  1135. {
  1136. width: 250,
  1137. prop: 'saleCount',
  1138. label: '数量',
  1139. slot: 'saleCount',
  1140. headerSlot: this.isTotalCount ? 'headerTotalCount' : '',
  1141. align: 'center'
  1142. }
  1143. ];
  1144. // 当quoteType为2时添加生产加工相关列
  1145. if (this.quoteType === 2) {
  1146. baseColumns.push(
  1147. {
  1148. width: 150,
  1149. prop: 'thickNess',
  1150. label: '厚度',
  1151. slot: 'thickNess',
  1152. align: 'center'
  1153. },
  1154. {
  1155. width: 150,
  1156. prop: 'squareNumber',
  1157. label: '平方数',
  1158. slot: 'squareNumber',
  1159. align: 'center'
  1160. },
  1161. {
  1162. width: 150,
  1163. prop: 'processingFeeBeforeTax',
  1164. label: '加工费(未税)',
  1165. slot: 'processingFeeBeforeTax',
  1166. align: 'center'
  1167. },
  1168. {
  1169. width: 150,
  1170. prop: 'packagingFeeNotTaxed',
  1171. label: '包装费(未税)',
  1172. slot: 'packagingFeeNotTaxed',
  1173. align: 'center'
  1174. },
  1175. {
  1176. width: 150,
  1177. prop: 'transportationFeeWithoutTax',
  1178. label: '运输费(未税)',
  1179. slot: 'transportationFeeWithoutTax',
  1180. align: 'center'
  1181. },
  1182. {
  1183. width: 150,
  1184. prop: 'quotationSubtotalBeforeTax',
  1185. label: '未税小计',
  1186. slot: 'additionalTaxRate_untaxed',
  1187. align: 'center'
  1188. },
  1189. {
  1190. width: 150,
  1191. prop: 'extraTax',
  1192. label: '税率(%)',
  1193. slot: 'extraTax',
  1194. align: 'center'
  1195. },
  1196. {
  1197. width: 150,
  1198. prop: 'quotationSubtotalTax',
  1199. label: '含税小计',
  1200. slot: 'quotationSubtotalTax',
  1201. align: 'center'
  1202. }
  1203. );
  1204. }
  1205. // 其他列
  1206. const otherColumns = [
  1207. {
  1208. width: 160,
  1209. prop: 'customerExpectDeliveryDeadline',
  1210. label: this.contractBookType == 1 ? '客户期望交期' : '交付日期',
  1211. slot: 'customerExpectDeliveryDeadline',
  1212. headerSlot:
  1213. this.isDate == 1 && this.quoteType != 2
  1214. ? 'headerCustomerExpectDeliveryDeadline'
  1215. : '',
  1216. align: 'center'
  1217. },
  1218. {
  1219. width: 180,
  1220. prop: 'singleWeight',
  1221. label: '单重',
  1222. slot: 'singleWeight',
  1223. headerSlot: 'headerSingleWeight',
  1224. align: 'center'
  1225. },
  1226. {
  1227. minWidth: 120,
  1228. prop: 'goodsLevel',
  1229. label: '物品级别',
  1230. slot: 'goodsLevel',
  1231. align: 'center',
  1232. isNone: this.quoteType === 2
  1233. },
  1234. {
  1235. width: 200,
  1236. prop: 'totalCount',
  1237. label: '计量数量',
  1238. headerSlot: 'headerTotalCount',
  1239. align: 'center',
  1240. formatter: (_row, _column, cellValue) => {
  1241. if (_row.totalCount) {
  1242. return _row.totalCount + ' ' + (_row.measuringUnit || '');
  1243. }
  1244. },
  1245. isNone: this.quoteType === 2
  1246. },
  1247. {
  1248. width: 200,
  1249. prop: 'customerMark',
  1250. label: this.contractBookType == 1 ? '客户代号' : '供应商代号',
  1251. slot: 'customerMark',
  1252. headerSlot: this.isCustomerMark ? 'headerCustomerMark' : '',
  1253. align: 'center',
  1254. isNone: this.quoteType === 2
  1255. },
  1256. {
  1257. minWidth: 160,
  1258. prop: 'productionCodes',
  1259. label: '生产编号',
  1260. align: 'center',
  1261. isNone: this.quoteType === 2
  1262. },
  1263. {
  1264. minWidth: 280,
  1265. prop: 'productionRequirements',
  1266. label: '生产要求',
  1267. align: 'center',
  1268. slot: 'productionRequirements',
  1269. isNone: !this.isProductionRequirements && this.quoteType === 2
  1270. },
  1271. {
  1272. width: 200,
  1273. prop: 'productCategoryName',
  1274. label: '类型',
  1275. slot: 'productCategoryName',
  1276. align: 'center',
  1277. isNone: this.quoteType === 2
  1278. },
  1279. {
  1280. width: 120,
  1281. prop: 'packingSpecification',
  1282. align: 'center',
  1283. label: '包装规格',
  1284. showOverflowTooltip: true,
  1285. isNone: this.quoteType === 2
  1286. },
  1287. {
  1288. width: 160,
  1289. prop: 'goodsPriceType',
  1290. label: '价格类型',
  1291. slot: 'goodsPriceType',
  1292. align: 'center',
  1293. isNone: this.quoteType === 2
  1294. },
  1295. {
  1296. width: 200,
  1297. prop: 'singlePrice',
  1298. label: '单价',
  1299. slot: 'singlePrice',
  1300. headerSlot: this.isSinglePrice ? 'headerSinglePrice' : '',
  1301. align: 'center',
  1302. isNone: this.quoteType === 2
  1303. },
  1304. {
  1305. width: 160,
  1306. prop: 'taxRate',
  1307. label: '税率',
  1308. slot: 'taxRate',
  1309. align: 'center',
  1310. headerSlot: this.isTaxRate == 1 ? 'headerTaxRate' : '',
  1311. isNone: this.quoteType === 2
  1312. },
  1313. {
  1314. width: 180,
  1315. prop: 'notaxSinglePrice',
  1316. label: '不含税单价',
  1317. slot: 'notaxSinglePrice',
  1318. align: 'center',
  1319. isNone: this.quoteType === 2
  1320. },
  1321. {
  1322. width: 160,
  1323. prop: 'discountSinglePrice',
  1324. label: '折让单价',
  1325. align: 'center',
  1326. isNone: !this.isDiscount,
  1327. formatter: (_row, _column, cellValue) => {
  1328. return _row.discountSinglePrice
  1329. ? Number(_row.discountSinglePrice).toFixed(2)
  1330. : '';
  1331. }
  1332. },
  1333. {
  1334. width: 120,
  1335. prop: 'totalPrice',
  1336. label: '合计',
  1337. slot: 'totalPrice',
  1338. align: 'center'
  1339. },
  1340. {
  1341. width: 160,
  1342. prop: 'discountTotalPrice',
  1343. label: '折让合计',
  1344. align: 'center',
  1345. isNone: !this.isDiscount,
  1346. formatter: (_row, _column, cellValue) => {
  1347. return _row.discountTotalPrice
  1348. ? Number(_row.discountTotalPrice).toFixed(2)
  1349. : '';
  1350. }
  1351. },
  1352. {
  1353. width: 110,
  1354. prop: 'batchNo',
  1355. label: '批次号',
  1356. slot: 'batchNo',
  1357. headerSlot: this.isBatchNo ? 'headerBatchNo' : '',
  1358. align: 'center',
  1359. isNone: this.quoteType === 2
  1360. },
  1361. {
  1362. width: 120,
  1363. prop: 'availableCountBase',
  1364. label: '库存数量',
  1365. slot: 'availableCountBase',
  1366. align: 'center',
  1367. isNone: this.quoteType === 2
  1368. },
  1369. // {
  1370. // width: 120,
  1371. // prop: 'measuringUnit',
  1372. // label: '计量单位',
  1373. // slot: 'measuringUnit',
  1374. // align: 'center'
  1375. // },
  1376. {
  1377. prop: 'provenance',
  1378. label: '产地',
  1379. slot: 'provenance',
  1380. align: 'center',
  1381. showOverflowTooltip: true,
  1382. minWidth: 200,
  1383. isNone: this.quoteType === 2
  1384. },
  1385. {
  1386. width: 180,
  1387. prop: 'totalWeight',
  1388. label: '总重',
  1389. slot: 'totalWeight',
  1390. formatter: (_row, _column, cellValue) => {
  1391. if (_row.totalWeight) {
  1392. return _row.totalWeight + ' ' + (_row.weightUnit || '');
  1393. }
  1394. },
  1395. align: 'center'
  1396. },
  1397. {
  1398. width: 160,
  1399. prop: 'productBrand',
  1400. label: '牌号',
  1401. slot: 'productBrand',
  1402. align: 'center',
  1403. isNone: this.quoteType === 2
  1404. },
  1405. {
  1406. width: 120,
  1407. prop: 'modelType',
  1408. label: '型号',
  1409. slot: 'modelType',
  1410. align: 'center',
  1411. isNone: this.quoteType === 2
  1412. },
  1413. {
  1414. width: 160,
  1415. prop: 'modelKey',
  1416. label: '机型',
  1417. slot: 'modelKey',
  1418. align: 'center',
  1419. isNone: this.quoteType === 2
  1420. },
  1421. {
  1422. width: 160,
  1423. prop: 'colorKey',
  1424. label: '颜色',
  1425. slot: 'colorKey',
  1426. align: 'center',
  1427. isNone: this.quoteType === 2
  1428. },
  1429. {
  1430. width: 120,
  1431. prop: 'produceType',
  1432. align: 'center',
  1433. label: '属性类型',
  1434. isNone: this.quoteType === 2,
  1435. showOverflowTooltip: true,
  1436. formatter: (row, column) => {
  1437. if (row.produceType) {
  1438. return row.produceType
  1439. .map((item) => {
  1440. return lbjtList[item];
  1441. })
  1442. .toString();
  1443. }
  1444. }
  1445. },
  1446. {
  1447. width: 160,
  1448. prop: 'arrivalWay',
  1449. label: '到货方式',
  1450. slot: 'arrivalWay',
  1451. align: 'center',
  1452. isNone: !this.isArrivalWay || this.quoteType === 2
  1453. },
  1454. {
  1455. width: 160,
  1456. prop: 'produceDeliveryDeadline',
  1457. label: '生产交付交期',
  1458. slot: 'produceDeliveryDeadline',
  1459. headerSlot:
  1460. this.isDate == 1 && this.isProduceDeliveryDeadline
  1461. ? 'headerProduceDeliveryDeadline'
  1462. : '',
  1463. isNone: this.contractBookType != 1,
  1464. align: 'center'
  1465. },
  1466. {
  1467. width: 200,
  1468. prop: 'guaranteePeriod',
  1469. label: '有效期',
  1470. slot: 'guaranteePeriod',
  1471. align: 'center',
  1472. isNone: this.quoteType === 2
  1473. },
  1474. {
  1475. width: 200,
  1476. prop: 'guaranteePeriodDeadline',
  1477. label: '有效期截止日期',
  1478. slot: 'guaranteePeriodDeadline',
  1479. isNone: !this.isGuaranteePeriod || this.quoteType === 2,
  1480. align: 'center'
  1481. },
  1482. {
  1483. width: 120,
  1484. prop: 'imgCode',
  1485. align: 'center',
  1486. label: '图号/件号',
  1487. showOverflowTooltip: true,
  1488. isNone: this.quoteType === 2
  1489. },
  1490. {
  1491. width: 220,
  1492. prop: 'customerReqFiles',
  1493. label: '客户需求',
  1494. slot: 'customerReqFiles',
  1495. align: 'center',
  1496. isNone: this.quoteType === 2
  1497. },
  1498. {
  1499. width: 130,
  1500. prop: 'technicalAnswerName',
  1501. label: '技术答疑人',
  1502. slot: 'technicalAnswerName',
  1503. align: 'center',
  1504. isNone: this.quoteType === 2
  1505. },
  1506. {
  1507. width: 220,
  1508. prop: 'technicalParams',
  1509. label: '技术参数',
  1510. slot: 'technicalParams',
  1511. align: 'center',
  1512. isNone: this.quoteType === 2
  1513. },
  1514. {
  1515. width: 240,
  1516. prop: 'technicalDrawings',
  1517. label: '技术图纸',
  1518. slot: 'technicalDrawings',
  1519. align: 'center'
  1520. },
  1521. {
  1522. width: 120,
  1523. prop: 'drawingVersion',
  1524. label: '图纸版本',
  1525. align: 'center',
  1526. isNone: this.quoteType === 2
  1527. },
  1528. {
  1529. width: 240,
  1530. prop: 'technologyRouteName',
  1531. label: '工艺路线',
  1532. slot: 'technologyRouteName',
  1533. align: 'center',
  1534. isNone: this.quoteType === 2
  1535. },
  1536. {
  1537. width: 240,
  1538. prop: 'industryArtFiles',
  1539. label: '工艺附件',
  1540. slot: 'industryArtFiles',
  1541. align: 'center',
  1542. isNone: this.quoteType === 2
  1543. },
  1544. {
  1545. width: 240,
  1546. prop: 'otherFiles',
  1547. label: '其他附件',
  1548. slot: 'otherFiles',
  1549. align: 'center',
  1550. isNone: this.quoteType === 2
  1551. },
  1552. {
  1553. width: 220,
  1554. prop: 'remark',
  1555. label: '备注',
  1556. slot: 'remark',
  1557. align: 'center'
  1558. },
  1559. {
  1560. columnKey: 'action',
  1561. label: '操作',
  1562. width: 120,
  1563. align: 'center',
  1564. resizable: false,
  1565. slot: 'action',
  1566. fixed: 'right',
  1567. showOverflowTooltip: true
  1568. }
  1569. ];
  1570. // 合并所有列
  1571. return [...baseColumns, ...otherColumns].filter((item) => !item.isNone);
  1572. }
  1573. },
  1574. created() {
  1575. parameterGetByCode({
  1576. code: 'eom_inventoryTable_customerExpectDeliveryDeadline'
  1577. }).then((res) => {
  1578. if (res.value) {
  1579. this.isDate = res.value;
  1580. }
  1581. });
  1582. },
  1583. methods: {
  1584. handleCountChange(row, index) {
  1585. // 数量变化时,若为生产加工类型,触发含税小计计算
  1586. if (this.quoteType === 2) {
  1587. this.calculateIncludingTaxPrice(row, index);
  1588. } else {
  1589. this.changeCount(row, index);
  1590. }
  1591. },
  1592. packingChange(item, index) {
  1593. this.$set(
  1594. this.form.datasource[index],
  1595. this.countObj.unitKey,
  1596. item.conversionUnit
  1597. );
  1598. this.handleCountChange(this.form.datasource[index], index);
  1599. },
  1600. openVersion(index) {
  1601. this.$refs.versionRefs.open(index);
  1602. },
  1603. //设置分批到货时间
  1604. handleMethod(row, index) {
  1605. this.$refs.timeDialogRef.open(row, index);
  1606. },
  1607. chooseTime({ arrivalBatch, index }) {
  1608. this.$set(
  1609. this.form.datasource[index],
  1610. 'arrivalBatch',
  1611. copyObj(arrivalBatch)
  1612. );
  1613. },
  1614. //工艺路线
  1615. changeProduct(data, index) {
  1616. this.$set(
  1617. this.form.datasource[index],
  1618. 'technologyRouteName',
  1619. data.name
  1620. );
  1621. this.$set(this.form.datasource[index], 'technologyRouteId', data.id);
  1622. },
  1623. handleTaskinstance(row, index) {
  1624. this.taskinstanceDialogFlag = true;
  1625. this.$nextTick(() => {
  1626. this.$refs.taskinstanceDialogRef.open(row, index);
  1627. });
  1628. },
  1629. saveTaskInstance(row = {}) {
  1630. this.$set(this.form.datasource[row.index], 'taskId', row.id);
  1631. this.$set(this.form.datasource[row.index], 'taskName', row.name);
  1632. this.$set(
  1633. this.form.datasource[row.index],
  1634. 'routingId',
  1635. row.produceRoutingId
  1636. );
  1637. },
  1638. async getSupplierObj(productList, queryName) {
  1639. try {
  1640. let categoryIds = productList
  1641. .filter((item) => item.productId)
  1642. .map((item) => item.productId);
  1643. if (categoryIds.length > 0) {
  1644. return await contactQueryByCategoryIdsAPI({
  1645. categoryIds
  1646. });
  1647. } else {
  1648. return Promise.resolve({});
  1649. }
  1650. } catch (e) {
  1651. return Promise.resolve({});
  1652. }
  1653. },
  1654. setDeliveryDays(row, index, type, isAll) {
  1655. if (isAll) {
  1656. this.form.datasource.forEach((item, i) => {
  1657. let guaranteePeriodUnitName = this.guaranteePeriodUnit(
  1658. item.guaranteePeriodUnitCode
  1659. );
  1660. this.$set(
  1661. this.form.datasource[i],
  1662. 'guaranteePeriodDeadline',
  1663. guaranteePeriodUnitName != 'second'
  1664. ? this.setDay(
  1665. item.guaranteePeriod,
  1666. guaranteePeriodUnitName,
  1667. item
  1668. )
  1669. : ''
  1670. );
  1671. });
  1672. return;
  1673. }
  1674. if (type == 'guaranteePeriod') {
  1675. let guaranteePeriodUnitName = this.guaranteePeriodUnit(
  1676. row.guaranteePeriodUnitCode
  1677. );
  1678. this.$set(
  1679. this.form.datasource[index],
  1680. 'guaranteePeriodDeadline',
  1681. guaranteePeriodUnitName != 'second'
  1682. ? this.setDay(row.guaranteePeriod, guaranteePeriodUnitName, row)
  1683. : ''
  1684. );
  1685. }
  1686. },
  1687. guaranteePeriodUnit(code) {
  1688. return code == 3
  1689. ? 'day'
  1690. : code == 4
  1691. ? 'month'
  1692. : code == 5
  1693. ? 'year'
  1694. : 'second';
  1695. },
  1696. setDay(addDay, dateType = 'day', item) {
  1697. let tiem =
  1698. this.contractBookType == 1
  1699. ? item.produceDeliveryDeadline
  1700. : item.customerExpectDeliveryDeadline;
  1701. return dayjs(tiem || new Date())
  1702. .add(addDay, dateType)
  1703. .format('YYYY-MM-DD');
  1704. },
  1705. // 返回列表数据
  1706. getTableValue() {
  1707. let comitDatasource = copyObj(this.form.datasource);
  1708. if (comitDatasource.length === 0) return [];
  1709. comitDatasource.forEach((v) => {
  1710. if (v.guaranteePeriodUnitCode) {
  1711. v.guaranteePeriodUnitName = this.getDictValue(
  1712. '保质期单位',
  1713. v.guaranteePeriodUnitCode
  1714. );
  1715. }
  1716. if (v.modelKey) {
  1717. v.modelKey = v.modelKey.toString();
  1718. }
  1719. if (v.colorKey) {
  1720. v.colorKey = v.colorKey.toString();
  1721. }
  1722. v.technicalDrawings = v.technicalDrawings ? v.technicalDrawings : [];
  1723. v.customerReqFiles = v.customerReqFiles || [];
  1724. v.industryArtFiles = v.industryArtFiles || [];
  1725. v.otherFiles = v.otherFiles || [];
  1726. });
  1727. return comitDatasource;
  1728. },
  1729. getPrice() {
  1730. return [this.allPrice, this.form.discountTotalPrice];
  1731. },
  1732. //改变数量
  1733. changeCount(row, index) {
  1734. if (!row) {
  1735. this.form.datasource = this.form.datasource.map((item, i) => {
  1736. return changeCount(item, this.countObj, false);
  1737. });
  1738. } else {
  1739. const updatedRow = changeCount(row, this.countObj, false);
  1740. this.$set(this.form.datasource, index, updatedRow);
  1741. }
  1742. this.$nextTick(() => {
  1743. // 生产加工类型不需要计算不含税单价,但需要计算含税小计
  1744. this.getNotaxSinglePrice();
  1745. this.changeAll();
  1746. });
  1747. },
  1748. // 计算含税小计(原含税单价逻辑)
  1749. calculateIncludingTaxPrice(row, index) {
  1750. if (!row) return;
  1751. // 计算未税小记
  1752. const quotationSubtotalBeforeTax =
  1753. (Number(row.processingFeeBeforeTax) || 0) +
  1754. (Number(row.packagingFeeNotTaxed) || 0) +
  1755. (Number(row.transportationFeeWithoutTax) || 0);
  1756. // 使用 $nextTick 确保响应式更新完成
  1757. // this.$nextTick(() => {
  1758. this.$set(
  1759. this.form.datasource[index],
  1760. 'quotationSubtotalBeforeTax',
  1761. quotationSubtotalBeforeTax.toFixed(2)
  1762. );
  1763. // 计算含税小计
  1764. const taxRate = (Number(row.extraTax) || 0) / 100;
  1765. const quotationSubtotalTax = quotationSubtotalBeforeTax * (1 + taxRate);
  1766. this.$set(
  1767. this.form.datasource[index],
  1768. 'quotationSubtotalTax',
  1769. quotationSubtotalTax.toFixed(2)
  1770. );
  1771. const quantity = Number(row[this.countObj.countKey]) || 1;
  1772. const totalPrice = quotationSubtotalTax * quantity;
  1773. this.$set(
  1774. this.form.datasource[index],
  1775. 'totalPrice',
  1776. totalPrice.toFixed(2)
  1777. );
  1778. if (row[this.countObj.unitKey] == row.weightUnit) {
  1779. this.$set(this.form.datasource[index], 'totalWeight', quantity);
  1780. } else {
  1781. if (quantity && row.singleWeight) {
  1782. this.$set(
  1783. this.form.datasource[index],
  1784. 'totalWeight',
  1785. (quantity * row.singleWeight).toFixed(2)
  1786. );
  1787. }
  1788. }
  1789. this.changeAll();
  1790. // });
  1791. },
  1792. changeAll() {
  1793. this.allPrice = getAllPrice(this.form.datasource) || 0;
  1794. if (this.isDiscountTotalPrice) {
  1795. this.form.discountTotalPrice = this.allPrice;
  1796. this.$emit('setDiscountTotalPrice', this.allPrice);
  1797. }
  1798. this.$emit('setCountAmount', this.allPrice);
  1799. },
  1800. setCustomerMark(customerMark) {
  1801. this.form.datasource.forEach((item) => {
  1802. item['customerMark'] = customerMark;
  1803. this.$forceUpdate();
  1804. });
  1805. },
  1806. //计算不含税单价
  1807. getNotaxSinglePrice() {
  1808. this.form.datasource.forEach((item, index) => {
  1809. if (item.singlePrice && item.taxRate) {
  1810. this.$set(
  1811. this.form.datasource[index],
  1812. 'notaxSinglePrice',
  1813. parseFloat(
  1814. (item.singlePrice / (1 + item.taxRate / 100)).toFixed(2)
  1815. )
  1816. );
  1817. } else {
  1818. this.$set(this.form.datasource[index], 'notaxSinglePrice', '');
  1819. }
  1820. });
  1821. },
  1822. //设置优惠后总金额修改产品单价
  1823. discountInputByOrder(val) {
  1824. this.form.discountTotalPrice = val;
  1825. this.form.datasource.forEach((item, index) => {
  1826. this.$set(
  1827. this.form.datasource[index],
  1828. 'discountSinglePrice',
  1829. this.getDiscountSinglePrice(item)
  1830. );
  1831. this.$set(
  1832. this.form.datasource[index],
  1833. 'discountTotalPrice',
  1834. this.getDiscountTotalPrice(item)
  1835. );
  1836. });
  1837. this.$emit('setDiscountTotalPrice', val);
  1838. this.$forceUpdate();
  1839. this.$refs.table.reRenderTable();
  1840. },
  1841. setAllValueChange({ key, value }) {
  1842. let indexS = this.selection.map((item) => item.key - 1);
  1843. indexS.forEach((i) => {
  1844. this.$set(this.form.datasource[i], key, value);
  1845. this.setDeliveryDays(this.form.datasource[i], i, 'guaranteePeriod');
  1846. });
  1847. },
  1848. //获取折让单价
  1849. getDiscountSinglePrice(row) {
  1850. let num =
  1851. (Number(this.form.discountTotalPrice) / Number(this.allPrice)) *
  1852. Number(row.singlePrice);
  1853. return isNaN(num) ? '' : num;
  1854. },
  1855. //获取折让合计
  1856. getDiscountTotalPrice(row) {
  1857. let num = 0;
  1858. num =
  1859. Number(row.discountSinglePrice) * Number(row[this.countObj.countKey]);
  1860. return isNaN(num) ? '' : num.toFixed(2);
  1861. },
  1862. orderNoChange(row, item) {
  1863. row['orderId'] = item.orderId;
  1864. },
  1865. //修改回显
  1866. async putTableValue(data) {
  1867. let productList =
  1868. (data &&
  1869. (data.quoteProductList || data.productList || data.detailList)) ||
  1870. [];
  1871. if (productList) {
  1872. let supplierObj = await this.getSupplierObj(productList, 'productId');
  1873. productList.forEach((item, index) => {
  1874. item['key'] = index + 1;
  1875. if (item.modelKey) {
  1876. item.modelKey = item.modelKey.split(',');
  1877. }
  1878. if (item.colorKey) {
  1879. item.colorKey = item.colorKey.split(',');
  1880. }
  1881. item.guaranteePeriodUnitCode = item.guaranteePeriodUnitCode
  1882. ? item.guaranteePeriodUnitCode + ''
  1883. : '';
  1884. let guaranteePeriodUnitName = this.guaranteePeriodUnit(
  1885. item.guaranteePeriodUnitCode
  1886. );
  1887. if (item.guaranteePeriod && item.guaranteePeriodUnitCode) {
  1888. item['guaranteePeriodDeadline'] =
  1889. item['guaranteePeriodDeadline'] ||
  1890. guaranteePeriodUnitName != 'second'
  1891. ? this.setDay(
  1892. item.guaranteePeriod,
  1893. guaranteePeriodUnitName,
  1894. item
  1895. )
  1896. : '';
  1897. }
  1898. item.entrustedEnterpriseIdList = supplierObj[item.productId];
  1899. // if (supplierObj[item.productId]?.length === 1) {
  1900. // item.entrustedEnterpriseId = supplierObj[item.productId][0].id;
  1901. // }
  1902. item.entrustedEnterpriseId = item.entrustedEnterpriseId || '';
  1903. item['customerMark'] = item.customerMark || this.customerMark;
  1904. item['arrivalWay'] = item.arrivalWay || 1;
  1905. });
  1906. this.form.datasource = productList;
  1907. let codeList = this.form.datasource
  1908. .filter((item) => item.productCode)
  1909. .map((item) => item.productCode);
  1910. //获取仓库库存
  1911. let inventoryTotalList = await getInventoryTotalAPI(codeList);
  1912. this.form.datasource
  1913. .filter((item) => item.productCode)
  1914. .forEach((item, index) => {
  1915. let find =
  1916. inventoryTotalList.find(
  1917. (key) => key.code == item.productCode
  1918. ) || {};
  1919. this.form.datasource;
  1920. this.$set(
  1921. this.form.datasource[index],
  1922. 'availableCountBase',
  1923. find.availableCountBase
  1924. );
  1925. });
  1926. if (this.isChangeCount) {
  1927. this.changeCount();
  1928. } else {
  1929. this.allPrice = data.totalAmount || data?.contractVO?.totalPrice;
  1930. }
  1931. if (this.isDiscountTotalPrice) {
  1932. this.form.discountTotalPrice =
  1933. data.payAmount || data?.contractVO?.discountTotalPrice;
  1934. }
  1935. this.$refs.table.reload();
  1936. }
  1937. },
  1938. //选择产品
  1939. handParent(row, index) {
  1940. let item = {
  1941. id: row?.productCode
  1942. };
  1943. if (row?.goodsId) {
  1944. this.handGoods(index);
  1945. return;
  1946. }
  1947. if (this.needProduce == 1 || this.needProduce == 2) {
  1948. this.$refs.productListRef.open(item, index);
  1949. } else {
  1950. this.$refs.selectStockLedgerDialogRef.open(item, index);
  1951. }
  1952. },
  1953. handGoods(index) {
  1954. this.$refs.commodityPriceListDialogRef.open(index);
  1955. },
  1956. //选择技术人回调
  1957. changeAnswer(obj, idx) {
  1958. this.$set(this.form.datasource[idx], 'technicalAnswerId', obj.id);
  1959. this.$set(this.form.datasource[idx], 'technicalAnswerName', obj.name);
  1960. },
  1961. handHead(row, index) {
  1962. let item = {
  1963. id: row.technicalAnswerId
  1964. };
  1965. this.$refs.headRef.open(item, index);
  1966. },
  1967. //选择产品回调
  1968. changeParent(obj, idx) {
  1969. obj.forEach((item, index) => {
  1970. let i = idx == -1 ? index : idx;
  1971. let row = JSON.parse(JSON.stringify(this.defaultForm));
  1972. row.key = this.form.datasource.length + 1;
  1973. let parasm = idx == -1 ? row : this.form.datasource[i];
  1974. this.$set(parasm, 'productId', item.id);
  1975. this.$set(parasm, 'categoryName', item.name);
  1976. this.$set(parasm, 'productCategoryId', item.categoryLevelId);
  1977. this.$set(parasm, 'productBrand', item.brandNum);
  1978. this.$set(parasm, 'productCategoryName', item.categoryLevelPath);
  1979. this.$set(parasm, 'productCode', item.code);
  1980. this.$set(parasm, 'productName', item.name);
  1981. this.$set(parasm, 'modelType', item.modelType);
  1982. this.$set(parasm, 'availableCountBase', item.availableCountBase);
  1983. this.$set(parasm, 'measuringUnit', item.measuringUnit);
  1984. this.$set(parasm, 'specification', item.specification);
  1985. this.$set(parasm, 'weightUnit', item.weightUnit);
  1986. this.$set(parasm, 'singleWeight', item.netWeight);
  1987. this.$set(parasm, 'pricingWay', 1);
  1988. this.$set(parasm, 'goodsLevel', item.goodsLevel);
  1989. this.$set(parasm, 'guaranteePeriod', item.warrantyPeriod);
  1990. this.$set(
  1991. parasm,
  1992. 'customerExpectDeliveryDeadline',
  1993. dayjs(new Date()).format('YYYY-MM-DD')
  1994. );
  1995. if (item.modelKey) {
  1996. this.$set(parasm, 'modelKey', item.modelKey.split(','));
  1997. }
  1998. if (item.colorKey) {
  1999. this.$set(parasm, 'colorKey', item.colorKey.split(','));
  2000. }
  2001. if (this.defTaxRate) {
  2002. this.$set(parasm, 'taxRate', parasm.taxRate || this.defTaxRate);
  2003. }
  2004. this.$set(
  2005. parasm,
  2006. 'guaranteePeriodUnitCode',
  2007. item.warrantyPeriodUnit ? item.warrantyPeriodUnit + '' : ''
  2008. );
  2009. if (item.warrantyPeriod && item.warrantyPeriodUnit) {
  2010. this.$set(
  2011. parasm,
  2012. 'guaranteePeriodDeadline',
  2013. this.setDay(
  2014. item.warrantyPeriod,
  2015. this.guaranteePeriodUnit(item.warrantyPeriodUnit),
  2016. {}
  2017. )
  2018. );
  2019. }
  2020. this.$set(
  2021. parasm,
  2022. 'packageDispositionList',
  2023. item.packageDispositionList
  2024. );
  2025. if (item.packageDispositionList?.length) {
  2026. this.$set(
  2027. parasm,
  2028. this.countObj.unitIdKey,
  2029. item.packageDispositionList[0].id
  2030. );
  2031. this.$set(
  2032. parasm,
  2033. this.countObj.unitKey,
  2034. item.packageDispositionList[0].conversionUnit
  2035. );
  2036. }
  2037. this.$set(parasm, 'arrivalWay', item.arrivalWay || 1);
  2038. this.$set(parasm, 'imgCode', item.imgCode);
  2039. this.$set(parasm, 'produceType', item.componentAttribute);
  2040. if (this.isOrderNo) {
  2041. this.$set(parasm, 'orderNo', this.orderOption[0]?.orderNo);
  2042. this.$set(parasm, 'orderId', this.orderOption[0]?.orderId);
  2043. }
  2044. if (this.isGoods && item.goodsId) {
  2045. this.$set(parasm, 'goodsId', item.goodsId);
  2046. this.$set(parasm, 'goodsPriceId', item.goodsPriceId);
  2047. this.$set(parasm, 'goodsPriceType', item.goodsPriceType);
  2048. this.$set(parasm, 'singlePrice', item.singlePrice);
  2049. this.$set(parasm, 'notaxSinglePrice', item.notaxSinglePrice);
  2050. this.$set(parasm, 'taxRate', item.taxRate);
  2051. this.$set(parasm, 'discountSinglePrice', item.singlePrice);
  2052. this.$set(parasm, 'totalCount', '');
  2053. } else {
  2054. this.$set(parasm, 'singlePrice', parasm.singlePrice || 0);
  2055. }
  2056. // 初始化生产加工特有字段及未税小记
  2057. // 当quoteType为2时,数量默认设置为1
  2058. if (this.quoteType === 2) {
  2059. this.processSetValue(parasm);
  2060. }
  2061. if (this.isSupplier) {
  2062. this.$set(
  2063. parasm,
  2064. 'entrustedEnterpriseIdList',
  2065. item.entrustedEnterpriseIdList
  2066. );
  2067. this.$set(
  2068. parasm,
  2069. 'entrustedEnterpriseId',
  2070. item.entrustedEnterpriseId
  2071. );
  2072. }
  2073. this.$set(parasm, 'approvalNumber', item.extField?.approvalNumber);
  2074. this.$set(
  2075. parasm,
  2076. 'packingSpecification',
  2077. item.extField.packingSpecification
  2078. );
  2079. this.$set(parasm, 'customerMark', this.customerMark);
  2080. if (item.purchaseOrigins?.length > 0) {
  2081. item.purchaseOrigins = item.purchaseOrigins.map((val) => val + '');
  2082. }
  2083. this.$set(parasm, 'provenance', item.purchaseOrigins || []);
  2084. if (idx == -1) {
  2085. this.form.datasource.push(row);
  2086. }
  2087. });
  2088. this.changeCount();
  2089. },
  2090. replaceTable(obj, idx) {
  2091. obj.forEach(async (item, index) => {
  2092. let i = idx == -1 ? index : idx;
  2093. let row = JSON.parse(JSON.stringify(this.defaultForm));
  2094. row.key = this.form.datasource.length + 1;
  2095. let parasm = idx == -1 ? row : this.form.datasource[i];
  2096. this.$set(parasm, 'customerMark', this.customerMark);
  2097. this.$set(parasm, 'productId', item.productId);
  2098. this.$set(parasm, 'categoryName', item.productName);
  2099. this.$set(parasm, 'productCategoryId', item.categoryLevelId);
  2100. this.$set(parasm, 'productBrand', item.productBrand);
  2101. this.$set(parasm, 'productCategoryName', item.categoryLevelPath);
  2102. this.$set(parasm, 'productCode', item.productCode);
  2103. this.$set(parasm, 'productName', item.productName);
  2104. this.$set(parasm, 'modelType', item.categoryModel);
  2105. this.$set(parasm, 'availableCountBase', item.measureQuantity);
  2106. this.$set(parasm, 'measuringUnit', item.measuringUnit);
  2107. this.$set(parasm, 'specification', item.specification);
  2108. this.$set(parasm, 'weightUnit', item.weightUnit);
  2109. this.$set(parasm, 'singleWeight', item.weight);
  2110. this.$set(parasm, 'pricingWay', 1);
  2111. this.$set(parasm, 'arrivalWay', item.arrivalWay || 1);
  2112. this.$set(parasm, 'batchNo', item.batchNo);
  2113. this.$set(parasm, 'imgCode', '');
  2114. this.$set(parasm, 'produceType', item.componentAttribute);
  2115. let goodsData = await getGoodsByCategoryId(item.productId);
  2116. goodsData = goodsData.filter((item) => item.approvalStatus == 2);
  2117. if (goodsData?.length) {
  2118. let goodsPriceList = goodsData[0]?.goodsPriceList[0];
  2119. this.$set(parasm, 'goodsId', goodsData[0].id);
  2120. this.$set(parasm, 'goodsPriceId', goodsPriceList.id);
  2121. this.$set(parasm, 'goodsPriceType', goodsPriceList.priceType);
  2122. this.$set(parasm, 'singlePrice', goodsPriceList.unitPrice || 0);
  2123. this.$set(
  2124. parasm,
  2125. 'notaxSinglePrice',
  2126. goodsPriceList.excludeTaxPrice
  2127. );
  2128. this.$set(parasm, 'taxRate', goodsPriceList.taxRate);
  2129. this.$set(parasm, 'discountSinglePrice', goodsPriceList.unitPrice);
  2130. this.$set(parasm, 'totalCount', '');
  2131. } else {
  2132. this.$set(parasm, 'singlePrice', 0);
  2133. }
  2134. if (item.modelKey) {
  2135. this.$set(parasm, 'modelKey', item.modelKey.split(','));
  2136. }
  2137. if (item.colorKey) {
  2138. this.$set(parasm, 'colorKey', item.colorKey.split(','));
  2139. }
  2140. if (this.isSupplier) {
  2141. this.$set(
  2142. parasm,
  2143. 'entrustedEnterpriseIdList',
  2144. item.entrustedEnterpriseIdList
  2145. );
  2146. this.$set(
  2147. parasm,
  2148. 'entrustedEnterpriseId',
  2149. item.entrustedEnterpriseId
  2150. );
  2151. }
  2152. this.$set(parasm, 'approvalNumber', item.extField?.approvalNumber);
  2153. this.$set(
  2154. parasm,
  2155. 'packingSpecification',
  2156. item.extField.packingSpecification
  2157. );
  2158. this.$set(
  2159. parasm,
  2160. 'packageDispositionList',
  2161. item.packageDispositionList
  2162. );
  2163. if (item.packageDispositionList?.length) {
  2164. this.$set(
  2165. parasm,
  2166. this.countObj.unitIdKey,
  2167. item.packageDispositionList[0].id
  2168. );
  2169. this.$set(
  2170. parasm,
  2171. this.countObj.unitKey,
  2172. item.packageDispositionList[0].conversionUnit
  2173. );
  2174. }
  2175. this.$set(parasm, 'customerMark', this.customerMark);
  2176. if (item.purchaseOrigins?.length > 0) {
  2177. item.purchaseOrigins = item.purchaseOrigins.map((val) => val + '');
  2178. }
  2179. this.$set(parasm, 'provenance', item.purchaseOrigins || []);
  2180. // 初始化生产加工特有字段及未税小记
  2181. // 当quoteType为2时,数量默认设置为1
  2182. if (this.quoteType === 2) {
  2183. this.processSetValue(parasm);
  2184. }
  2185. if (idx == -1) {
  2186. this.form.datasource.push(row);
  2187. }
  2188. });
  2189. },
  2190. remove(index) {
  2191. this.form.datasource.splice(index, 1);
  2192. this.setSort();
  2193. this.changeAll();
  2194. },
  2195. // 重新排序
  2196. setSort() {
  2197. this.form.datasource.forEach((n, index) => {
  2198. n.key = index + 1;
  2199. });
  2200. },
  2201. // 添加临时产品
  2202. handlAdd() {
  2203. let item = JSON.parse(JSON.stringify(this.defaultForm));
  2204. item.key = this.form.datasource.length + 1;
  2205. item.customerMark = this.customerMark;
  2206. // 初始化生产加工特有字段及未税小记
  2207. // 当quoteType为2时,数量默认设置为1
  2208. if (this.quoteType === 2) {
  2209. this.processSetValue(item);
  2210. }
  2211. this.form.datasource.push(item);
  2212. },
  2213. processSetValue(parasm) {
  2214. this.$set(parasm, this.countObj.countKey, 1);
  2215. this.$set(parasm, 'thickNess', '');
  2216. this.$set(parasm, 'squareNumber', '');
  2217. this.$set(parasm, 'processingFeeBeforeTax', '');
  2218. this.$set(parasm, 'packagingFeeNotTaxed', '');
  2219. this.$set(parasm, 'transportationFeeWithoutTax', '');
  2220. this.$set(parasm, 'extraTax', 13);
  2221. this.$set(parasm, 'quotationSubtotalBeforeTax', '0.00');
  2222. this.$set(parasm, 'quotationSubtotalTax', '');
  2223. },
  2224. validateForm(callback) {
  2225. this.$refs.form.validate((valid, obj) => {
  2226. if (obj) {
  2227. let messages = Object.keys(obj).map((key) => obj[key][0]);
  2228. if (messages.length > 0) {
  2229. this.$message.warning(messages[0].message);
  2230. }
  2231. }
  2232. callback(valid);
  2233. });
  2234. },
  2235. goodsPriceTypeChange(row, index) {
  2236. if (row.goodsId) {
  2237. getGoodsPriceByCondition({
  2238. id: row.goodsId,
  2239. priceType: row.goodsPriceType
  2240. }).then((res) => {
  2241. if (res.id) {
  2242. this.$set(this.form.datasource[index], 'goodsPriceId', res.id);
  2243. this.$set(
  2244. this.form.datasource[index],
  2245. 'goodsPriceType',
  2246. res.priceType
  2247. );
  2248. this.$set(
  2249. this.form.datasource[index],
  2250. 'singlePrice',
  2251. res.unitPrice
  2252. );
  2253. this.$set(
  2254. this.form.datasource[index],
  2255. 'notaxSinglePrice',
  2256. res.excludeTaxPrice
  2257. );
  2258. this.$set(this.form.datasource[index], 'taxRate', res.taxRate);
  2259. this.$set(
  2260. this.form.datasource[index],
  2261. 'discountSinglePrice',
  2262. res.unitPrice
  2263. );
  2264. }
  2265. this.changeCount(row, index);
  2266. });
  2267. }
  2268. },
  2269. save() {
  2270. this.$emit('save');
  2271. }
  2272. }
  2273. };
  2274. </script>
  2275. <style lang="scss" scoped>
  2276. .headbox {
  2277. display: flex;
  2278. justify-content: space-between;
  2279. align-items: center;
  2280. .amount {
  2281. font-size: 14px;
  2282. font-weight: bold;
  2283. padding-right: 30px;
  2284. }
  2285. }
  2286. .time-form .el-form-item {
  2287. margin-bottom: 0 !important;
  2288. }
  2289. ::v-deep .period {
  2290. display: flex;
  2291. .borderleftnone {
  2292. .el-input--medium .el-input__inner {
  2293. border-top-right-radius: 0;
  2294. border-bottom-right-radius: 0;
  2295. }
  2296. }
  2297. .borderrightnone {
  2298. .el-input--medium .el-input__inner {
  2299. border-top-left-radius: 0;
  2300. border-bottom-left-radius: 0;
  2301. }
  2302. }
  2303. }
  2304. ::v-deep .time-form tbody > tr:hover > td {
  2305. background-color: transparent !important;
  2306. }
  2307. ::v-deep .time-form .el-table tr {
  2308. background-color: #ffffff;
  2309. }
  2310. .pricebox {
  2311. display: flex;
  2312. justify-content: flex-start;
  2313. align-items: center;
  2314. font-weight: bold;
  2315. }
  2316. :deep(.el-input-group__append){
  2317. padding: 0;
  2318. }
  2319. </style>