index.vue 91 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857
  1. <template>
  2. <el-card shadow="always" :body-style="{ padding: '10px' }">
  3. <div class="app-container">
  4. <el-dialog
  5. :title="upload.title"
  6. :visible.sync="upload.open"
  7. width="400px"
  8. append-to-body
  9. >
  10. <el-upload
  11. ref="upload"
  12. :limit="1"
  13. accept=".xlsx, .xls"
  14. :headers="upload.headers"
  15. :action="
  16. upload.url +
  17. '?updateSupport=' +
  18. upload.updateSupport +
  19. '&tableName=' +
  20. tableName +
  21. '&sqlKey=' +
  22. tableKey
  23. "
  24. v-loading="upload.isUploading"
  25. :disabled="upload.isUploading"
  26. :on-progress="handleFileUploadProgress"
  27. :on-success="handleFileSuccess"
  28. :auto-upload="false"
  29. :onChange="handleChange"
  30. drag
  31. >
  32. <i class="el-icon-upload"></i>
  33. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  34. <div class="el-upload__tip text-center" slot="tip">
  35. <!-- <div class="el-upload__tip" slot="tip">-->
  36. <!-- <el-checkbox v-model="upload.updateSupport"/>-->
  37. <!-- 是否更新已经存在的用户数据-->
  38. <!-- </div>-->
  39. <span>仅允许导入xls、xlsx格式文件。</span>
  40. <el-link
  41. type="primary"
  42. :underline="false"
  43. style="font-size: 12px; vertical-align: baseline"
  44. @click="importTemplate"
  45. >下载模板
  46. </el-link>
  47. </div>
  48. </el-upload>
  49. <div slot="footer" class="dialog-footer">
  50. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  51. <el-button @click="upload.open = false">取 消</el-button>
  52. </div>
  53. </el-dialog>
  54. <Queryfrom
  55. :form-vals="templateInfo.where"
  56. :statisticList="statisticList"
  57. :showCount="showCount"
  58. :showSearch="showSearch"
  59. @getList="getList"
  60. ref="mychild"
  61. />
  62. <el-row :gutter="10" class="mb8">
  63. <el-col :span="1.5">
  64. <el-button
  65. type="primary"
  66. plain
  67. icon="el-icon-plus"
  68. size="mini"
  69. @click="addHandler"
  70. >新增
  71. </el-button>
  72. </el-col>
  73. <!-- <el-col :span="1.5" v-if="false">
  74. <el-button
  75. type="success"
  76. plain
  77. icon="el-icon-edit"
  78. size="mini"
  79. :disabled="single"
  80. @click="handleUpdate"
  81. >修改
  82. </el-button>
  83. </el-col> -->
  84. <el-col :span="1.5">
  85. <el-button
  86. type="danger"
  87. plain
  88. icon="el-icon-delete"
  89. size="mini"
  90. :disabled="multiple"
  91. @click="myDeleteHandler"
  92. >删除
  93. </el-button>
  94. </el-col>
  95. <!-- <el-col :span="1.5">
  96. <el-button
  97. plain
  98. icon="el-icon-upload2"
  99. size="mini"
  100. @click="upload.open = true"
  101. >导入
  102. </el-button>
  103. </el-col>
  104. <el-col :span="1.5">
  105. <el-button
  106. type="warning"
  107. plain
  108. icon="el-icon-download"
  109. size="mini"
  110. @click="handleExport"
  111. >导出
  112. </el-button>
  113. </el-col>
  114. <right-toolbar
  115. style="float: right"
  116. :showCount.sync="showCount"
  117. :showSearch.sync="showSearch"
  118. :counts="true"
  119. @queryTable="pageList"
  120. ></right-toolbar> -->
  121. </el-row>
  122. <el-table
  123. v-loading="loading"
  124. :data="tableList"
  125. @selection-change="handleSelectionChange"
  126. ref="tableRef"
  127. :cell-style="cellStyle"
  128. :reserve-selection="true"
  129. row-key="saleOrderId"
  130. >
  131. <el-table-column
  132. type="selection"
  133. width="55"
  134. reserve-selection
  135. align="center"
  136. >
  137. </el-table-column>
  138. <!-- <el-table-column type="selection" width="55" /> -->
  139. <el-table-column prop="saleNo" label="合同号" />
  140. <el-table-column prop="saleDate" label="日期" />
  141. <el-table-column prop="customName" label="客户名称" />
  142. <el-table-column prop="deliveryDate" label="交货日期" />
  143. <el-table-column prop="saleLeadTime" label="交货天数" />
  144. <el-table-column prop="saleAmountInWords" label="合计金额(大写)" />
  145. <el-table-column prop="status" label="状态">
  146. <template slot-scope="scope">{{
  147. getDictLabel(scope.row.status, "sales_order_status")
  148. }}</template>
  149. </el-table-column>
  150. <el-table-column prop="salesman" label="销售员" />
  151. <el-table-column prop="remark" label="备注" />
  152. <el-table-column label="操作">
  153. <template slot-scope="scope">
  154. <el-dropdown>
  155. <el-button type="warning" plain size="small">
  156. 操作<i class="el-icon-arrow-down el-icon--right"></i>
  157. </el-button>
  158. <el-dropdown-menu slot="dropdown">
  159. <el-dropdown-item>
  160. <el-button
  161. size="mini"
  162. type="text"
  163. icon="el-icon-edit"
  164. @click="handleUpdate(scope.row)"
  165. >修改
  166. </el-button>
  167. </el-dropdown-item>
  168. <el-dropdown-item>
  169. <el-button
  170. size="mini"
  171. type="text"
  172. icon="el-icon-tickets"
  173. @click="handlePrint(scope.row)"
  174. >详情
  175. </el-button>
  176. </el-dropdown-item>
  177. <el-dropdown-item>
  178. <el-button
  179. size="mini"
  180. type="text"
  181. icon="el-icon-folder-checked"
  182. @click="handleSubmit(scope.row)"
  183. >提交
  184. </el-button>
  185. </el-dropdown-item>
  186. <el-dropdown-item>
  187. <el-button
  188. size="mini"
  189. type="text"
  190. icon="el-icon-delete"
  191. @click="handleDelete(scope.row)"
  192. >删除
  193. </el-button>
  194. </el-dropdown-item>
  195. </el-dropdown-menu>
  196. </el-dropdown>
  197. </template>
  198. </el-table-column>
  199. </el-table>
  200. <pagination
  201. v-show="total > 0"
  202. :total="total"
  203. :page.sync="queryParams.pageNum"
  204. :limit.sync="queryParams.pageSize"
  205. @pagination="pageList"
  206. />
  207. <!-- 添加或修改销售出库单:- 过磅记录生成数据对话框 -->
  208. <el-dialog
  209. :title="title"
  210. width="1100px"
  211. :visible.sync="open"
  212. append-to-body
  213. >
  214. <el-row :gutter="20">
  215. <el-form
  216. :model="formData"
  217. ref="formDataRef"
  218. :rules="rules"
  219. label-width="100px"
  220. :inline="true"
  221. size="normal"
  222. >
  223. <el-col :span="12">
  224. <el-form-item prop="saleNo" label="合同号:">
  225. <!-- <el-input size="small" v-model="formData.saleNo"></el-input> -->
  226. {{ formData.saleNo }}
  227. </el-form-item>
  228. </el-col>
  229. <!-- <el-col :span="12">
  230. <el-form-item prop="lotNumber" label="批号:">
  231. <el-input size="small" v-model="formData.lotNumber"></el-input>
  232. </el-form-item>
  233. </el-col> -->
  234. <el-col :span="12">
  235. <el-form-item prop="saleDate" label="日期:">
  236. <!-- <el-date-picker
  237. size="small"
  238. v-model="formData.saleDate"
  239. value-format="yyyy-MM-dd"
  240. format="yyyy-MM-dd"
  241. type="date"
  242. placeholder="选择日期"
  243. >
  244. </el-date-picker> -->
  245. {{ formData.saleDate }}
  246. </el-form-item>
  247. </el-col>
  248. <el-col :span="12">
  249. <el-form-item prop="saleCustomNo" label="客户名称:">
  250. <el-select
  251. size="small"
  252. v-model="formData.saleCustomNo"
  253. placeholder="请选择客户"
  254. clearable
  255. filterable
  256. @change="customChangeHandler"
  257. >
  258. <el-option
  259. v-for="item in customerOptions"
  260. :key="item.customNo"
  261. :label="item.customName"
  262. :value="item.customNo"
  263. >
  264. </el-option>
  265. </el-select>
  266. </el-form-item>
  267. </el-col>
  268. <el-col :span="12">
  269. <el-form-item v-if="isLeader" label="业务员:">
  270. <el-select
  271. size="small"
  272. v-model="formData.salesman"
  273. placeholder="请选择业务员"
  274. clearable
  275. filterable
  276. @change="salemanChange"
  277. >
  278. <el-option
  279. v-for="item in salesmanList"
  280. :key="item.value"
  281. :label="item.label"
  282. :value="item.value"
  283. >
  284. </el-option>
  285. </el-select>
  286. </el-form-item>
  287. <el-form-item v-else label="业务员:">
  288. <!-- <el-input
  289. v-model="formData.salesman"
  290. size="small"
  291. clearable
  292. ></el-input> -->
  293. {{ nickName }}
  294. </el-form-item>
  295. </el-col>
  296. <el-col :span="12">
  297. <el-form-item label="联系人:" size="normal">
  298. {{ formData.contactPerson }}
  299. </el-form-item>
  300. <el-form-item label="客户地址:" size="normal">
  301. {{ formData.customAddress }}
  302. </el-form-item>
  303. <el-form-item label="客户国别:" size="normal">
  304. {{ formData.customCountryType }}
  305. </el-form-item>
  306. </el-col>
  307. <el-col :span="12">
  308. <el-form-item label-width="120px" label="合计金额(大写):">
  309. <!-- <el-input
  310. v-model="formData.saleAmountInWords"
  311. size="small"
  312. clearable
  313. ></el-input> -->
  314. {{ formData.saleAmountInWords }}
  315. </el-form-item>
  316. </el-col>
  317. <!-- <el-col :span="12">
  318. <el-form-item label="付款方式:">
  319. <el-select
  320. v-model="formData.salePayType"
  321. size="small"
  322. clearable
  323. filterable
  324. >
  325. <el-option
  326. v-for="item in dict.type.retail_order_pay_method"
  327. :key="item.value"
  328. :label="item.label"
  329. :value="item.value"
  330. ></el-option>
  331. </el-select>
  332. 零售单
  333. </el-form-item>
  334. </el-col> -->
  335. <!-- <el-col :span="12">
  336. <el-form-item
  337. label-width="120px"
  338. prop="saleOrderEstimatedTime"
  339. label="预计下单时间:"
  340. >
  341. {{ formData.saleOrderEstimatedTime }}
  342. </el-form-item>
  343. </el-col> -->
  344. <!-- <el-col :span="12">
  345. <el-form-item label="交货日期:" size="normal" prop="deliveryDate">
  346. {{ formData.deliveryDate }}
  347. </el-form-item>
  348. </el-col> -->
  349. <!-- <el-col :span="12">
  350. <el-form-item label="交货天数:" size="normal" prop="saleLeadTime">
  351. {{ formData.saleLeadTime }}
  352. </el-form-item>
  353. </el-col> -->
  354. <el-col :span="24">
  355. <el-divider>货品明细</el-divider>
  356. </el-col>
  357. <el-table
  358. :data="productionTableData"
  359. border
  360. show-summary
  361. :summary-method="getSummaries"
  362. sum-text="小计"
  363. style="width: 100%"
  364. >
  365. <el-table-column prop="productName" label="品名" width="180">
  366. <template slot-scope="scope">
  367. <!-- <el-input
  368. v-model="scope.row.productName"
  369. size="small"
  370. clearable
  371. ></el-input> -->
  372. <el-select
  373. v-model="scope.row.productNo"
  374. placeholder=""
  375. :filter-method="(val) => mySelectFilter(val, scope.row)"
  376. clearable
  377. filterable
  378. @change="
  379. handleProductChange(scope.row.productNo, scope.row)
  380. "
  381. >
  382. <el-option
  383. v-for="item in productionOptions"
  384. :key="item.productNo"
  385. :label="item.productName"
  386. :value="item.productNo"
  387. >
  388. <span class="discribe" style="float: left">{{
  389. item.productName
  390. }}</span>
  391. <span
  392. style="float: right; color: #8492a6; font-size: 13px"
  393. >{{ item.productSpecifications }}</span
  394. >
  395. </el-option>
  396. </el-select>
  397. </template>
  398. </el-table-column>
  399. <el-table-column prop="productType" label="类型">
  400. </el-table-column>
  401. <el-table-column prop="productNumber" label="箱数">
  402. <template slot-scope="scope">
  403. <el-input
  404. v-model="scope.row.productNumber"
  405. oninput="value=value.replace(/[^0-9.]/g,'')"
  406. size="small"
  407. clearable
  408. @change="computedPrice(scope.row)"
  409. ></el-input>
  410. </template>
  411. </el-table-column>
  412. <el-table-column prop="productUnitPrice" label="单价">
  413. <template slot-scope="scope">
  414. <el-input
  415. v-model="scope.row.productUnitPrice"
  416. size="small"
  417. oninput="value=value.replace(/[^0-9.]/g,'')"
  418. @change="computedPrice(scope.row)"
  419. clearable
  420. ></el-input>
  421. </template>
  422. </el-table-column>
  423. <el-table-column prop="productAmounts" label="金额">
  424. <template slot-scope="scope">
  425. {{ scope.row.productAmounts }}
  426. </template>
  427. </el-table-column>
  428. <el-table-column prop="sliceType" label="切片型号">
  429. <template slot-scope="scope">
  430. <el-select
  431. v-model="scope.row.sliceType"
  432. placeholder=""
  433. clearable
  434. filterable
  435. @change="sliceTypeChangeHandler(scope.row)"
  436. >
  437. <el-option
  438. v-for="item in sliceTypeOptions"
  439. :key="item.materielCode"
  440. :label="item.materielName"
  441. :value="item.materielCode"
  442. >
  443. </el-option>
  444. </el-select>
  445. </template>
  446. </el-table-column>
  447. <el-table-column prop="colourNumber" label="色号">
  448. <template slot-scope="scope">
  449. <el-select
  450. v-model="scope.row.colourNumber"
  451. placeholder=""
  452. clearable
  453. filterable
  454. @change="colourNumberChangeHandler(scope.row)"
  455. >
  456. <el-option
  457. v-for="item in colourNumberOptions"
  458. :key="item.materielCode"
  459. :label="item.materieEncoding + item.materieColorNumber"
  460. :value="item.materielCode"
  461. >
  462. <span class="discribe" style="float: left">{{
  463. item.materieEncoding + item.materieColorNumber
  464. }}</span>
  465. <!-- <span
  466. style="float: right; color: #8492a6; font-size: 13px"
  467. >{{ item.materielCode }}</span
  468. > -->
  469. </el-option>
  470. </el-select>
  471. </template>
  472. </el-table-column>
  473. <el-table-column prop="remark" label="备注">
  474. <template slot-scope="scope">
  475. <el-input
  476. v-model="scope.row.remark"
  477. size="small"
  478. clearable
  479. ></el-input>
  480. </template>
  481. </el-table-column>
  482. <el-table-column label="操作">
  483. <template slot-scope="scope">
  484. <el-button
  485. type="danger"
  486. size="small"
  487. @click="deleteProduct(scope.$index)"
  488. >删除</el-button
  489. >
  490. </template>
  491. </el-table-column>
  492. </el-table>
  493. <el-button
  494. class="mt5"
  495. type="primary"
  496. style="width: 100%"
  497. size="small"
  498. @click="addProduct"
  499. >添加货品</el-button
  500. >
  501. <!-- <el-col :span="12" v-show="formData.salePayType == '1'">
  502. <el-form-item prop="earnestMoney" label="定金">
  503. <el-input
  504. v-model="formData.earnestMoney"
  505. clearable
  506. size="small"
  507. />
  508. </el-form-item>
  509. </el-col> -->
  510. <el-col :span="24">
  511. <el-divider>订单备注</el-divider>
  512. </el-col>
  513. <el-col :span="24">
  514. <el-input
  515. type="textarea"
  516. v-model="formData.orderRemark"
  517. placeholder=""
  518. size="normal"
  519. clearable
  520. ></el-input>
  521. </el-col>
  522. <!-- <el-col :span="24">
  523. <el-divider>审计人员数据</el-divider>
  524. </el-col> -->
  525. </el-form>
  526. </el-row>
  527. <div slot="footer" class="dialog-footer">
  528. <el-button type="primary" @click="editConfirm">确 定</el-button>
  529. <el-button @click="cancel">取 消</el-button>
  530. </div>
  531. </el-dialog>
  532. <!-- 自定义弹窗 -->
  533. <el-dialog title="提交" :visible.sync="deliverShow" width="1200px">
  534. <!-- <DialogTemplate
  535. ref="dialogRef"
  536. :groupKey="groupKey"
  537. :rowobj="rowobj"
  538. :subCount="subCount"
  539. :tableCount="tableCount"
  540. :subTableName="subTableName"
  541. @addList="addListHandler"
  542. >
  543. </DialogTemplate> -->
  544. <RetailProvide ref="deliverRef"></RetailProvide>
  545. <span slot="footer" class="dialog-footer">
  546. <el-button @click="deliverShow = false">取 消</el-button>
  547. <el-button type="primary" @click="btnComfirm">确 定</el-button>
  548. </span>
  549. </el-dialog>
  550. <!-- 详情弹窗 -->
  551. <el-dialog title="详情" :visible.sync="detailShow" width="1250px">
  552. <div ref="detailTable" id="detail"></div>
  553. <span slot="footer" class="dialog-footer">
  554. <el-button @click="detailShow = false">取 消</el-button>
  555. <el-button type="primary" @click="detailPrintHandler"
  556. >打 印</el-button
  557. >
  558. </span>
  559. </el-dialog>
  560. <!-- 销售出库弹窗 -->
  561. <el-dialog
  562. title="打印-销售出库单"
  563. :visible.sync="outBoundShow"
  564. width="1000px"
  565. >
  566. <OutBound ref="outBoundRef" :currentRow="currentRow"></OutBound>
  567. <span slot="footer" class="dialog-footer">
  568. <el-button @click="outBoundShow = false">取 消</el-button>
  569. <el-button type="primary" @click="outBoundPrintHandler">
  570. 打印</el-button
  571. >
  572. </span>
  573. </el-dialog>
  574. <div id="printDom"></div>
  575. </div>
  576. </el-card>
  577. </template>
  578. <script>
  579. import {
  580. delTableData,
  581. dragTableInfo,
  582. listTable,
  583. unionListTableData,
  584. getInfoBySqlKey,
  585. btnCommonApi,
  586. addTableData,
  587. batchEdit,
  588. getStatisticList,
  589. getTableList1,
  590. checkOrderNo,
  591. delOrder,
  592. productInvoiceInfo,
  593. addProductInvoice,
  594. updateProductInvoice,
  595. queryMaterielList,
  596. } from "@/api/tablelist/commonTable";
  597. import {
  598. saleOrderList,
  599. getRoleUser,
  600. addRetailOrder,
  601. getRetailOrderInfo,
  602. editRetailOrder,
  603. retailProductInvoiceInfo,
  604. } from "@/api/system/retailMange.js";
  605. import { listData } from "@/api/system/tenant/data";
  606. import { getToken } from "@/utils/auth";
  607. import Queryfrom from "@/views/tablelist/commonTable/queryfrom.vue";
  608. import { camelCase, toUnderline } from "@/utils";
  609. import { inputDisableComplete } from "@/utils/other";
  610. import Menu from "@/views/tablelist/commonTable/BtnMenu.vue";
  611. import { checkRole } from "@/utils/permission";
  612. import DialogTemplate from "@/views/dialogTemplate/components/index.vue";
  613. import {
  614. queryDropDownBoxData,
  615. getSaleOrderProductionList,
  616. } from "@/api/dragform/form";
  617. import { v4 as uuidv4 } from "uuid";
  618. import { mapState } from "vuex";
  619. import moment from "moment";
  620. import Deliver from "@/views/orderMange/components/dialogForm/Deliver.vue";
  621. import RetailProvide from "@/views/orderMange/components/dialogForm/RetailProvide.vue";
  622. import OutBound from "@/views/orderMange/components/dialogForm/OutBound.vue";
  623. import outBoundPrint from "@/utils/print/outBoundPrint";
  624. import { listCustomer } from "@/api/system/customer";
  625. import { numToCapital } from "@/utils/other";
  626. export default {
  627. name: "retailMange",
  628. dicts: [
  629. "payment_method",
  630. "direction_of_twist",
  631. "retail_order_pay_method",
  632. "sales_order_status",
  633. ],
  634. components: {
  635. Queryfrom,
  636. Menu,
  637. DialogTemplate,
  638. Deliver,
  639. OutBound,
  640. RetailProvide,
  641. },
  642. data() {
  643. return {
  644. totalMoney: "", //合计金额 小写
  645. createById: "", //创建者id
  646. salesmanList: [], //销售员列表
  647. isLeader: false, //当前登录用户是否为领导
  648. selection: [], //勾选的数据
  649. // 出库单 start
  650. outBoundShow: false,
  651. // 出库单 end
  652. // 发货 start
  653. deliverShow: false,
  654. // 发货 end
  655. // 出库单 start
  656. // 出库单 end
  657. myDelIds: [], //新增接口 删除的id
  658. // 详情弹窗数据
  659. detailShow: false,
  660. printDomData: "",
  661. // k-form-build组件渲染弹窗
  662. kOpen: false,
  663. // 新的自定义数据 start
  664. orderType: 0, //新的条件查询参数
  665. productIds: [], //货品Ids
  666. isEdit: false,
  667. formData: {
  668. //订单表数据
  669. saleNo: "", //合同号
  670. saleCustomNo: "", //客户编号
  671. saleDate: "", //销售单日期
  672. saleOrderEstimatedTime: "", //预计下单时间
  673. saleLeadTime: "1", //交货周期
  674. deliveryDate: "", //交货日期
  675. saleAmounts: "", //合计金额 小写
  676. saleAmountInWords: "", //合计金额 大写
  677. salePayType: "1", //支付方式
  678. earnestMoney: "", //定金
  679. salesman: "", //业务员
  680. saleLeader: "", //业务主管
  681. finance: "", //财务部
  682. production: "", //生产部
  683. saleApprover: "", //批准人
  684. customAddress: "", //客户地址
  685. customCountryType: "", //国家类型
  686. contactPerson: "", //联系人
  687. // 货品明细表数据
  688. lotNumber: "", //批号
  689. productNo: "", //货品号
  690. productName: "", //货品名称
  691. productNumber: "", //销售数量
  692. productWeight: "", //销售重量kg
  693. productUnitPrice: "", //单价
  694. productAmounts: "", //金额
  695. sliceType: "", //切片类型
  696. sliceTypeLabel: "",
  697. colourNumberLabel: "",
  698. colourNumber: "", //色号
  699. remark: "", //备注
  700. // 工艺表
  701. orderRemark: "",
  702. },
  703. sliceTypeOptions: [], //切片型号选项
  704. colourNumberOptions: [], //色号选项
  705. allProductionOptions: [], //所有产品选项
  706. productionOptions: [],
  707. customerOptions: [],
  708. productionTableData: [
  709. // {
  710. // productNo: "", //货品名称
  711. // productNumber: 2, //销售数量
  712. // productWeight: 1, //销售重量kg
  713. // productUnitPrice: 20, //单价
  714. // productAmounts: 20, //金额
  715. // remark: "", //备注
  716. // },
  717. ],
  718. rules: {
  719. saleNo: [
  720. {
  721. required: true,
  722. message: "请输入合同号",
  723. trigger: "blur",
  724. },
  725. // {
  726. // validator: this.validateOrderNo,
  727. // trigger: "blur",
  728. // },
  729. ],
  730. saleDate: [
  731. {
  732. required: true,
  733. message: "请选择日期",
  734. trigger: "change",
  735. },
  736. ],
  737. // lotNumber: [
  738. // {
  739. // required: true,
  740. // message: "请输入批号",
  741. // trigger: "blur",
  742. // },
  743. // ],
  744. saleCustomNo: [
  745. {
  746. required: true,
  747. message: "请选择客户",
  748. trigger: "change",
  749. },
  750. ],
  751. saleOrderEstimatedTime: [
  752. {
  753. required: true,
  754. message: "请选择预计下单时间",
  755. trigger: "change",
  756. },
  757. ],
  758. saleLeadTime: [
  759. {
  760. required: true,
  761. message: "请输入交货天数",
  762. trigger: "blur",
  763. },
  764. ],
  765. // earnestMoney: [
  766. // {
  767. // validator: this.validateEarnestMoney,
  768. // trigger: "blur",
  769. // },
  770. // ],
  771. },
  772. // end
  773. // 绑定按钮dialog
  774. btnDialogVisible: false,
  775. // 绑定修改dialog
  776. groupKey: "",
  777. // 遮罩层
  778. loading: true,
  779. // 选中数组
  780. ids: [],
  781. // 非单个禁用
  782. single: true,
  783. // 非多个禁用
  784. multiple: true,
  785. // 显示统计
  786. showCount: true,
  787. // 显示搜索条件
  788. showSearch: true,
  789. // 总条数
  790. total: 0,
  791. // 用户表格数据
  792. tableList: [],
  793. // 弹出层标题
  794. title: "",
  795. // 日期范围
  796. dateRange: [],
  797. // 表单参数
  798. form: {},
  799. // cru 弹窗
  800. open: false,
  801. // excel共通导入数据
  802. upload: {
  803. // 是否显示弹出层
  804. open: false,
  805. // 弹出层标题(
  806. title: "",
  807. // 是否禁用上传
  808. isUploading: false,
  809. // 是否更新已经存在的数据
  810. updateSupport: 0,
  811. // 设置上传的请求头部
  812. headers: { Authorization: "Bearer " + getToken() },
  813. // 上传的地址
  814. url: process.env.VUE_APP_BASE_API1 + "common/uploadData",
  815. },
  816. // 排序方式 默认降序
  817. sortOrder: true,
  818. // 共通查询参数接受子组件的参数
  819. queryParams: {
  820. saleOrderTechnologyNo: "retailOrder",
  821. pageNum: 1, // 第几页
  822. pageSize: 10, // 每页大小
  823. orderByColumn: "", // 根据某列排序
  824. isAsc: "", // desc(降序)或 asc(升序)
  825. saleOrderOrderType: "",
  826. // 基本查询参数
  827. basicMap: {
  828. tableName: "drag_form",
  829. },
  830. // 当前表字段筛选参数
  831. queryMap: {
  832. queryCriteriaValue: "",
  833. },
  834. },
  835. // 列信息
  836. columns: {},
  837. // 当前模版信息
  838. templateInfo: {},
  839. // 查询条件
  840. queryFromWhere: {},
  841. // 当前table唯一标识
  842. tableKey: null,
  843. // 当前表名称
  844. tableName: null,
  845. //存放html代码块
  846. iframeUrl: "",
  847. //存放表单渲染数据
  848. jsonData: {},
  849. // 回显表格数据,
  850. defaultValue: {},
  851. // 统计card
  852. statisticList: [],
  853. // 样式表
  854. styleList: [],
  855. // 字典样式对象
  856. dictStyleObj: {},
  857. // 操作列 按钮数据
  858. excuteBtnArr: [],
  859. // 下拉框动态数据
  860. dynamicData: {},
  861. // 当前点击按钮的数据
  862. currentBtnData: {},
  863. // 修改选中行
  864. rowobj: {},
  865. // 该行的统计信息
  866. subCount: [],
  867. tableCount: [],
  868. // 弹窗新增数据
  869. addLists: [],
  870. subTableName: "",
  871. // 当前点击行的数据
  872. currentRow: {},
  873. };
  874. },
  875. created() {
  876. // 得到当前展示的table的唯一标识
  877. this.tableKey = this.$route.query.tableKey;
  878. },
  879. watch: {
  880. totalMoney: {
  881. handler(newVal, oldVal) {
  882. if (isNaN(Number(newVal))) {
  883. this.formData.saleAmountInWords = "零";
  884. } else {
  885. const ntc = new numToCapital();
  886. this.formData.saleAmountInWords = ntc.uppercase(newVal);
  887. }
  888. },
  889. deep: true,
  890. immediate: true,
  891. },
  892. },
  893. async mounted() {
  894. await this.getDropDownData();
  895. },
  896. computed: {
  897. isShowExcuteCol() {
  898. return !this.excuteBtnArr?.every((arr) => arr.children.length == 0);
  899. },
  900. ...mapState({
  901. nickName: (state) => state.user.nickName,
  902. userInfo: (state) => state.user,
  903. }),
  904. },
  905. methods: {
  906. // 业务员改变回调
  907. salemanChange(val) {
  908. if (!val) {
  909. this.createById = "";
  910. return;
  911. } else {
  912. this.createById = this.salesmanList.find(
  913. (item) => item.value == val
  914. ).id;
  915. }
  916. },
  917. // 生成合同号
  918. getSaleNo() {
  919. let timeStr = moment().format("YYYYMMDD");
  920. for (var i = 0; i < 5; i++) {
  921. timeStr += parseInt(Math.random() * 10);
  922. }
  923. return timeStr;
  924. },
  925. // 自定义筛选方法
  926. mySelectFilter(value, row) {
  927. console.log(value);
  928. // row.productNo = value;
  929. if (value) {
  930. let target = this.productionOptions.find((item) =>
  931. item.productName.includes(value)
  932. );
  933. console.log(target);
  934. if (target) {
  935. this.productionOptions = [target];
  936. //找到
  937. return true;
  938. } else {
  939. //前100个没找到
  940. // 在全部列表中查找
  941. target = this.allProductionOptions.find((item) =>
  942. item.productName.includes(value)
  943. );
  944. console.log(target);
  945. if (target) {
  946. this.productionOptions = [target];
  947. return true;
  948. } else {
  949. return false;
  950. }
  951. }
  952. } else {
  953. this.productionOptions = this.allProductionOptions.slice(0, 500);
  954. }
  955. },
  956. // 出库单回调
  957. async myPrintOutBoundHandler(row, data) {
  958. console.log("row", row);
  959. this.currentRow = row;
  960. this.outBoundShow = true;
  961. this.$nextTick(() => {
  962. this.$refs.outBoundRef.getTableData(row);
  963. });
  964. },
  965. // 出库单打印回调
  966. async outBoundPrintHandler() {
  967. let res = await this.$refs.outBoundRef.getPrintData();
  968. console.log(res);
  969. if (res.flag) {
  970. res.data.form.printUser = this.nickName;
  971. outBoundPrint(res.data, "printDom");
  972. }
  973. },
  974. // 产品名称改变
  975. handleProductChange(productNo, row) {
  976. if (!productNo) {
  977. this.productionOptions = this.allProductionOptions.slice(0, 500);
  978. return;
  979. }
  980. row.productName = this.productionOptions.find(
  981. (item) => item.productNo == productNo
  982. )?.productName;
  983. row.productType = this.productionOptions.find(
  984. (item) => item.productNo == productNo
  985. )?.productType;
  986. this.productionOptions = this.allProductionOptions.slice(0, 500);
  987. },
  988. // 订单类型改变回调
  989. orderTypeChange(type) {
  990. this.getList(false, type);
  991. },
  992. // 重置审计表单数据
  993. resetFormData() {
  994. Object.assign(this.formData, {
  995. //订单表数据
  996. saleNo: this.getSaleNo(), //合同号
  997. saleCustomNo: "", //客户编号
  998. saleDate: moment(new Date()).format("YYYY-MM-DD"), //销售单日期
  999. saleOrderEstimatedTime: moment(new Date()).format("YYYY-MM-DD"), //预计下单时间
  1000. saleLeadTime: "1", //交货周期
  1001. deliveryDate: moment(new Date()).format("YYYY-MM-DD"),
  1002. saleAmounts: "", //合计金额 小写
  1003. saleAmountInWords: "", //合计金额 大写
  1004. salePayType: "1", //支付方式
  1005. earnestMoney: "",
  1006. salesman: "", //业务员
  1007. saleLeader: "", //业务主管
  1008. finance: "", //财务部
  1009. production: "", //生产部
  1010. saleApprover: "", //批准人
  1011. customAddress: "", //客户地址
  1012. customCountryType: "", //国家类型
  1013. contactPerson: "", //联系人
  1014. // 货品明细表数据
  1015. lotNumber: "", //批号
  1016. productNo: "", //货品号
  1017. productName: "", //货品名称
  1018. productNumber: "", //销售数量
  1019. productWeight: "", //销售重量kg
  1020. productUnitPrice: "", //单价
  1021. productAmounts: "", //金额
  1022. sliceType: "", //切片类型
  1023. sliceTypeLabel: "",
  1024. colourNumberLabel: "",
  1025. colourNumber: "", //色号
  1026. remark: "", //备注
  1027. // 工艺表
  1028. craftGrid: "", //网络
  1029. craftOil: "", //油剂
  1030. craftPackage: "", //卷装
  1031. craftColorFastness: "", //色牢度
  1032. directionOfTwist: "",
  1033. craftOther: "", //其它工艺要求
  1034. craftMark: "", //包装/贴唛
  1035. shippingMethod: "", //运输方式
  1036. });
  1037. this.productionTableData = [];
  1038. },
  1039. // 自定义的小计计算方法
  1040. getSummaries(param) {
  1041. const { columns, data } = param;
  1042. console.log(columns, data);
  1043. const sums = [];
  1044. columns.forEach((column, index) => {
  1045. if (index === 0) {
  1046. sums[index] = "小计";
  1047. return;
  1048. }
  1049. const values = data.map((item) => Number(item[column.property]));
  1050. if (
  1051. index === 1 ||
  1052. index === 5 ||
  1053. index === 6 ||
  1054. index === 7 ||
  1055. index === 8
  1056. ) {
  1057. sums[index] = "";
  1058. } else if (!values.every((value) => isNaN(value))) {
  1059. sums[index] = values
  1060. .reduce((prev, curr) => {
  1061. const value = Number(curr);
  1062. if (!isNaN(value)) {
  1063. return prev + curr;
  1064. } else {
  1065. return prev;
  1066. }
  1067. }, 0)
  1068. ?.toFixed(2);
  1069. console.log(sums[index], index);
  1070. if (index == 4) {
  1071. this.totalMoney = sums[index];
  1072. }
  1073. } else {
  1074. sums[index] = "N/A";
  1075. }
  1076. });
  1077. return sums;
  1078. },
  1079. // 货品表格数据删除回调
  1080. deleteProduct(index) {
  1081. this.productionTableData.splice(index, 1);
  1082. },
  1083. // 货品表格数据新增回调
  1084. addProduct() {
  1085. this.productionTableData.push({
  1086. saleProductNo: uuidv4(),
  1087. productNo: "", //货品编号
  1088. productType: "", //类型
  1089. productName: "", //货品名称
  1090. productNumber: "", //销售数量
  1091. productWeight: "", //销售重量kg
  1092. productUnitPrice: "", //单价
  1093. productAmounts: "", //金额
  1094. sliceType: "022", //切片类型 初始为 切片
  1095. sliceTypeLabel: "",
  1096. colourNumberLabel: "",
  1097. colourNumber: "", //色号
  1098. remark: "", //备注
  1099. });
  1100. },
  1101. // 客户名称改变回调
  1102. customChangeHandler(val) {
  1103. // if (!val) return;
  1104. let customData = this.customerOptions.find(
  1105. (item) => item.customNo == val
  1106. );
  1107. this.formData.customAddress = customData?.customAddress || "无";
  1108. this.formData.customCountryType = customData?.customCountryType || "无";
  1109. this.formData.contactPerson = customData?.contactPerson || "无";
  1110. },
  1111. // 获取销售员角色列表
  1112. async getRoleUser() {
  1113. try {
  1114. let res = await getRoleUser("salesman");
  1115. if (res.code == 200) {
  1116. this.salesmanList = res.data.map((item) => {
  1117. return {
  1118. label: item.nickName,
  1119. value: item.nickName,
  1120. id: item.userId,
  1121. };
  1122. });
  1123. } else {
  1124. this.$message.error("获取销售员角色列表失败");
  1125. }
  1126. } catch (error) {
  1127. console.log(error);
  1128. }
  1129. },
  1130. //审计新增
  1131. async addHandler() {
  1132. this.isEdit = false;
  1133. await this.getDropDownData();
  1134. // 判断是否是销售员
  1135. console.log(this.userInfo);
  1136. this.isLeader = !this.userInfo.roles.includes("salesman");
  1137. if (!this.isLeader) {
  1138. this.createById = this.userInfo.userId;
  1139. }
  1140. await this.getRoleUser();
  1141. this.resetFormData();
  1142. this.title = "新增零售单";
  1143. this.open = true;
  1144. this.$nextTick(() => {
  1145. this.$refs["formDataRef"].clearValidate();
  1146. });
  1147. },
  1148. // 获取下拉框数据
  1149. async getDropDownData() {
  1150. try {
  1151. // let payLoad = [
  1152. // {
  1153. // basicMap: {
  1154. // tableName: "production",
  1155. // },
  1156. // },
  1157. // {
  1158. // basicMap: {
  1159. // tableName: "customer",
  1160. // },
  1161. // },
  1162. // ];
  1163. // let res = await queryDropDownBoxData(payLoad);
  1164. // 新的获取客户选项数据的接口
  1165. let res = await listCustomer({ isEnablePaging: false });
  1166. if (res.code == 200) {
  1167. // let { customer } = res.data.resultMap;
  1168. // this.allProductionOptions = production || [];
  1169. // this.productionOptions =
  1170. // this.allProductionOptions.slice(0, 100) || [];
  1171. this.customerOptions = res.rows || [];
  1172. } else {
  1173. throw Error("获取下拉框数据失败");
  1174. }
  1175. let proRes = await getSaleOrderProductionList();
  1176. if (proRes.code == 200) {
  1177. // let { production, customer } = proRes.data.resultMap;
  1178. this.allProductionOptions = proRes.data || [];
  1179. this.productionOptions =
  1180. this.allProductionOptions.slice(0, 500) || [];
  1181. } else {
  1182. throw Error("获取下拉框数据失败");
  1183. }
  1184. } catch (error) {
  1185. console.log(error);
  1186. }
  1187. // 色号数据
  1188. try {
  1189. let payLoad = [
  1190. {
  1191. basicMap: {
  1192. tableName: "materiel",
  1193. },
  1194. conditionMap: {
  1195. materiel_species: ["1"],
  1196. },
  1197. },
  1198. ];
  1199. // let res = await queryDropDownBoxData(payLoad);
  1200. let res = await queryMaterielList();
  1201. if (res.code == 200) {
  1202. // let { materiel } = res.data;
  1203. this.colourNumberOptions = res.data || [];
  1204. } else {
  1205. throw Error("获取下拉框数据失败");
  1206. }
  1207. } catch (error) {
  1208. console.log(error);
  1209. }
  1210. // 切片型号
  1211. try {
  1212. let payLoad = [
  1213. {
  1214. basicMap: {
  1215. tableName: "materiel",
  1216. },
  1217. conditionMap: {
  1218. materiel_species: ["6"],
  1219. },
  1220. },
  1221. ];
  1222. let res = await queryDropDownBoxData(payLoad);
  1223. if (res.code == 200) {
  1224. console.log(res.data.resultMap);
  1225. let { materiel } = res.data.resultMap;
  1226. this.sliceTypeOptions = materiel || [];
  1227. } else {
  1228. throw Error("获取下拉框数据失败");
  1229. }
  1230. } catch (error) {
  1231. console.log(error);
  1232. }
  1233. },
  1234. //
  1235. // 获取row-key
  1236. getRowKey(row) {
  1237. return row[
  1238. camelCase(this.tableName + "_" + this.templateInfo.template?.primaryKey)
  1239. ];
  1240. },
  1241. /** 查询列表 */
  1242. async getList() {
  1243. this.loading = true;
  1244. try {
  1245. let res = await saleOrderList(this.queryParams);
  1246. console.log(res);
  1247. if (res.code == 200) {
  1248. this.tableList = res.rows;
  1249. this.total = res.total;
  1250. } else {
  1251. this.$message.error(res.msg);
  1252. }
  1253. this.loading = false;
  1254. } catch (error) {
  1255. console.log(error);
  1256. this.loading = false;
  1257. }
  1258. },
  1259. // 校验定金
  1260. validateEarnestMoney(rule, value, callback) {
  1261. console.log(value);
  1262. if (this.formData.salePayType == "1") {
  1263. if (value == "" || value == null || value == undefined) {
  1264. callback(new Error("请输入定金金额"));
  1265. } else {
  1266. callback();
  1267. }
  1268. } else {
  1269. callback();
  1270. }
  1271. },
  1272. // 校验订单号是否有效
  1273. async validateOrderNo(rule, value, callback) {
  1274. console.log(value);
  1275. // let saleNo = this.formData.orderNo;
  1276. // 检验订单号合法
  1277. let checkNoPayload = {
  1278. saleNo: value,
  1279. };
  1280. if (this.isEdit) {
  1281. checkNoPayload.id = this.formData.id;
  1282. }
  1283. let result = await checkOrderNo(checkNoPayload);
  1284. if (result.code == 200) {
  1285. if (result.data) {
  1286. callback();
  1287. } else {
  1288. callback(new Error("合同号已存在"));
  1289. }
  1290. } else {
  1291. callback(new Error("校验失败,请稍后再试"));
  1292. }
  1293. },
  1294. // 校验表格数据
  1295. validateTableData() {
  1296. if (this.productionTableData.length == 0) {
  1297. return {
  1298. res: false,
  1299. msg: "请添加货品明细",
  1300. };
  1301. }
  1302. let res = this.productionTableData.every((item) => {
  1303. return (
  1304. item.productNo &&
  1305. item.productNumber &&
  1306. item.productUnitPrice &&
  1307. item.productAmounts &&
  1308. item.sliceType &&
  1309. item.colourNumber
  1310. );
  1311. });
  1312. if (!res) {
  1313. return {
  1314. res: false,
  1315. msg: "请填写完整货品明细",
  1316. };
  1317. }
  1318. return {
  1319. res: true,
  1320. msg: "",
  1321. };
  1322. },
  1323. // 审计 提交编辑结果按钮回调
  1324. async editConfirm() {
  1325. this.$refs.formDataRef.validate(async (valid) => {
  1326. if (valid) {
  1327. console.log(valid);
  1328. let tableValidate = this.validateTableData();
  1329. if (!tableValidate.res) {
  1330. this.$message.warning(tableValidate.msg);
  1331. return;
  1332. }
  1333. let {
  1334. id,
  1335. //订单表数据
  1336. saleNo,
  1337. saleCustomNo,
  1338. saleDate,
  1339. saleOrderEstimatedTime,
  1340. saleLeadTime,
  1341. deliveryDate,
  1342. saleAmounts,
  1343. saleAmountInWords,
  1344. salePayType,
  1345. salesman,
  1346. customAddress,
  1347. customCountryType, //国家类型
  1348. contactPerson, //联系人
  1349. // 工艺表数据
  1350. orderRemark,
  1351. } = this.formData;
  1352. let payload = {
  1353. createById: this.createById,
  1354. saleOrderTechnologyNo: "retailOrder",
  1355. saleNo,
  1356. saleCustomNo,
  1357. saleDate,
  1358. saleOrderEstimatedTime,
  1359. saleLeadTime,
  1360. deliveryDate,
  1361. saleAmounts,
  1362. saleAmountInWords,
  1363. salePayType,
  1364. customAddress, //客户地址
  1365. customCountryType, //国家类型
  1366. contactPerson, //联系人
  1367. remark: orderRemark,
  1368. salesman: this.isLeader ? salesman : this.nickName,
  1369. status: 1,
  1370. };
  1371. payload.saleProductsList = this.productionTableData;
  1372. if (this.isEdit) {
  1373. payload.id = id;
  1374. let res = await editRetailOrder(payload);
  1375. if (res.code === 200) {
  1376. this.$message.success("修改成功");
  1377. this.open = false;
  1378. this.getList();
  1379. } else {
  1380. this.$message.error("修改失败");
  1381. }
  1382. } else {
  1383. //新增
  1384. let res = await addRetailOrder(payload);
  1385. if (res.code == 200) {
  1386. this.$message.success("添加成功");
  1387. this.open = false;
  1388. this.getList();
  1389. } else {
  1390. this.$message.error("添加失败");
  1391. }
  1392. }
  1393. // Object.keys(saleValue).map((k) => {
  1394. // saleData.commMap[k] = saleValue[k];
  1395. // });
  1396. }
  1397. });
  1398. },
  1399. // 审计 编辑回调
  1400. async handleEdit(index, row) {
  1401. console.log(row);
  1402. let { saleOrderSaleNo } = row;
  1403. try {
  1404. let payLoad = [
  1405. {
  1406. basicMap: {
  1407. tableName: "sale_order",
  1408. },
  1409. conditionMap: {
  1410. sale_no: [saleOrderSaleNo],
  1411. },
  1412. },
  1413. {
  1414. basicMap: {
  1415. tableName: "sale_products",
  1416. },
  1417. conditionMap: {
  1418. sale_order_no: [saleOrderSaleNo],
  1419. },
  1420. },
  1421. {
  1422. basicMap: {
  1423. tableName: "sale_craft",
  1424. },
  1425. conditionMap: {
  1426. sale_order_no: [saleOrderSaleNo],
  1427. },
  1428. },
  1429. ];
  1430. let res = await queryDropDownBoxData(payLoad);
  1431. if (res.code == 200) {
  1432. this.isEdit = true;
  1433. let { sale_craft, sale_order, sale_products } = res.data.resultMap;
  1434. Object.assign(this.formData, {
  1435. ...sale_craft[0],
  1436. ...sale_order[0],
  1437. });
  1438. let { saleDate, saleOrderEstimatedTime, deliveryDate } =
  1439. sale_order[0];
  1440. saleDate && (this.formData.saleDate = new Date(saleDate));
  1441. saleOrderEstimatedTime &&
  1442. (this.formData.saleOrderEstimatedTime = saleOrderEstimatedTime);
  1443. deliveryDate && (this.formData.deliveryDate = new Date(deliveryDate));
  1444. this.productIds = sale_products.map((item) => item.saleProductNo);
  1445. await this.getDropDownData();
  1446. this.productionTableData = sale_products.map((item) => {
  1447. item.productType = this.productionOptions.find(
  1448. (i) => item.productNo == i.productNo
  1449. )?.productType;
  1450. return item;
  1451. });
  1452. if (this.formData.saleCustomNo) {
  1453. this.customChangeHandler(this.formData.saleCustomNo);
  1454. }
  1455. this.title = "编辑审计单";
  1456. this.open = true;
  1457. }
  1458. } catch (error) {
  1459. console.log(error);
  1460. }
  1461. },
  1462. // 审计 批量删除回调
  1463. async batchDelete() {
  1464. if (!this.ids.length) return;
  1465. try {
  1466. await this.$confirm("是否确认删除选中的数据?", "警告", {
  1467. confirmButtonText: "确定",
  1468. cancelButtonText: "取消",
  1469. type: "warning",
  1470. });
  1471. let orderPayload = {
  1472. basicMap: {
  1473. tableName: "sale_order",
  1474. },
  1475. conditionMap: {
  1476. saleNo: this.ids,
  1477. },
  1478. };
  1479. let productsPayload = {
  1480. basicMap: {
  1481. tableName: "sale_products",
  1482. },
  1483. conditionMap: {
  1484. saleOrderNo: this.ids,
  1485. },
  1486. };
  1487. let craftPayload = {
  1488. basicMap: {
  1489. tableName: "sale_craft",
  1490. },
  1491. conditionMap: {
  1492. saleOrderNo: this.ids,
  1493. },
  1494. };
  1495. let orderRes = await delTableData(orderPayload);
  1496. // let productRes = await delTableData(productsPayload);
  1497. // let craftRes = await delTableData(craftPayload);
  1498. if (orderRes.code == 200) {
  1499. this.$message.success("删除成功");
  1500. this.getList();
  1501. } else {
  1502. this.$message.error("删除失败");
  1503. throw Error("删除失败");
  1504. }
  1505. this.ids = [];
  1506. this.$refs.tableRef.clearSelection();
  1507. } catch (error) {
  1508. console.log(error);
  1509. }
  1510. },
  1511. // 计算金额
  1512. computedPrice(row) {
  1513. let { productNumber, productUnitPrice } = row;
  1514. console.log(
  1515. "productNumber, productUnitPrice",
  1516. productNumber,
  1517. productUnitPrice
  1518. );
  1519. row.productAmounts = (
  1520. Number(productNumber) * Number(productUnitPrice)
  1521. ).toFixed(2);
  1522. },
  1523. isUpperCase(char) {
  1524. return char === char.toUpperCase();
  1525. },
  1526. // 下划线命名转驼峰命名
  1527. toUnderScoreCase(str) {
  1528. if (str === null) {
  1529. return null;
  1530. }
  1531. let sb = "";
  1532. // 前置字符是否大写
  1533. let preCharIsUpperCase = true;
  1534. // 当前字符是否大写
  1535. let curreCharIsUpperCase = true;
  1536. // 下一字符是否大写
  1537. let nexteCharIsUpperCase = true;
  1538. for (let i = 0; i < str.length; i++) {
  1539. let c = str.charAt(i);
  1540. if (i > 0) {
  1541. preCharIsUpperCase = isUpperCase(str.charAt(i - 1));
  1542. } else {
  1543. preCharIsUpperCase = false;
  1544. }
  1545. curreCharIsUpperCase = isUpperCase(c);
  1546. if (i < str.length - 1) {
  1547. nexteCharIsUpperCase = isUpperCase(str.charAt(i + 1));
  1548. }
  1549. if (
  1550. preCharIsUpperCase &&
  1551. curreCharIsUpperCase &&
  1552. !nexteCharIsUpperCase
  1553. ) {
  1554. sb += SEPARATOR;
  1555. } else if (i !== 0 && !preCharIsUpperCase && curreCharIsUpperCase) {
  1556. sb += SEPARATOR;
  1557. }
  1558. sb += c.toLowerCase();
  1559. }
  1560. return sb;
  1561. },
  1562. // 处理列表信息
  1563. columnsHandler(columns) {
  1564. let resArr = [];
  1565. console.log(columns, 111);
  1566. columns.forEach((item) => {
  1567. for (const key in item) {
  1568. let tempObj = {};
  1569. tempObj.key = camelCase(key);
  1570. tempObj.value = item[key];
  1571. resArr.push(tempObj);
  1572. }
  1573. });
  1574. console.log(resArr, 222);
  1575. return resArr;
  1576. },
  1577. // 取消按钮
  1578. cancel() {
  1579. this.open = false;
  1580. // this.reset();
  1581. },
  1582. // k-form-build 取消按钮
  1583. kCancel() {
  1584. this.kOpen = false;
  1585. // this.reset();
  1586. },
  1587. // 分页查询
  1588. pageList(row) {
  1589. // 调用子组件-》携带子组件参数请求后台
  1590. this.$refs.mychild.pageList(
  1591. row == undefined
  1592. ? {
  1593. limit: this.queryParams.pageSize,
  1594. page: this.queryParams.pageNum,
  1595. }
  1596. : row
  1597. );
  1598. },
  1599. // 多选框选中数据
  1600. handleSelectionChange(selection) {
  1601. // this.ids = selection.map(
  1602. // (item) =>
  1603. // item[
  1604. // camelCase(
  1605. // this.tableName + "_" + this.templateInfo.template?.primaryKey
  1606. // )
  1607. // ]
  1608. // );
  1609. this.selection = selection;
  1610. this.myDelIds = selection.map((item) => item.saleOrderId);
  1611. console.log(this.myDelIds);
  1612. this.ids = selection.map((item) => item.saleOrderSaleNo);
  1613. this.single = selection.length != 1;
  1614. this.multiple = !selection.length;
  1615. },
  1616. // 更多操作触发
  1617. handleCommand(command, row) {
  1618. switch (command) {
  1619. case "handleResetPwd":
  1620. this.handleResetPwd(row);
  1621. break;
  1622. case "handleAuthRole":
  1623. this.handleAuthRole(row);
  1624. break;
  1625. default:
  1626. break;
  1627. }
  1628. },
  1629. /** 新增按钮操作 */
  1630. handleAdd(row) {
  1631. // this.reset();
  1632. this.defaultValue = {};
  1633. getInfoBySqlKey(this.templateInfo.template.sqlKey).then(({ data }) => {
  1634. if (!data || !data.dfVueTemplate) {
  1635. this.jsonData = false;
  1636. this.$message.error("当前表格未绑定表单!");
  1637. return;
  1638. }
  1639. if (data.dfFormSql) {
  1640. let dynamicData = JSON.parse(data.dfFormSql);
  1641. Object.assign(this.dynamicData, dynamicData);
  1642. }
  1643. this.jsonData = JSON.parse(data.dfVueTemplate);
  1644. this.open = true;
  1645. this.title = "添加信息";
  1646. this.form.password = this.initPassword;
  1647. this.$nextTick(() => {
  1648. this.$refs.addFromRef.reset();
  1649. inputDisableComplete();
  1650. });
  1651. });
  1652. },
  1653. longestCommonSubstring(strs) {
  1654. if (!strs || strs.includes("")) return "";
  1655. let str1_Length = strs[0].length;
  1656. let str_Nums = strs.length;
  1657. let flag = 0;
  1658. for (let i = 0; i < str1_Length && flag == 0; i++) {
  1659. let char = strs[0][i];
  1660. for (var j = 1; j < str_Nums; j++) {
  1661. if (char !== strs[j][i] || i == strs[j].length) {
  1662. return strs[1].substring(0, i);
  1663. }
  1664. }
  1665. }
  1666. return strs[0];
  1667. },
  1668. // 绑定dialog对话框关闭
  1669. handleClose() {
  1670. this.btnDialogVisible = false;
  1671. },
  1672. getLastUppercaseWord(text) {
  1673. const pattern = /\b[A-Z][a-z]*\b/g;
  1674. const matches = [...text.matchAll(pattern)];
  1675. if (matches.length > 0) {
  1676. const lastMatch = matches[matches.length - 1][0];
  1677. return lastMatch;
  1678. } else {
  1679. return null;
  1680. }
  1681. },
  1682. // 初始化数据
  1683. initData(data) {
  1684. let {
  1685. id,
  1686. //订单表数据
  1687. saleNo,
  1688. saleCustomNo,
  1689. saleDate,
  1690. saleOrderEstimatedTime,
  1691. saleLeadTime,
  1692. deliveryDate,
  1693. saleAmounts,
  1694. saleAmountInWords,
  1695. salePayType,
  1696. salesman,
  1697. customAddress,
  1698. customCountryType, //国家类型
  1699. contactPerson, //联系人
  1700. // 工艺表数据
  1701. remark,
  1702. // 产品列表
  1703. saleProductsList,
  1704. } = data;
  1705. Object.assign(this.formData, {
  1706. id,
  1707. //订单表数据
  1708. saleNo,
  1709. saleCustomNo,
  1710. saleDate,
  1711. saleOrderEstimatedTime,
  1712. saleLeadTime,
  1713. deliveryDate,
  1714. saleAmounts,
  1715. saleAmountInWords,
  1716. salePayType,
  1717. salesman,
  1718. customAddress,
  1719. customCountryType, //国家类型
  1720. contactPerson, //联系人
  1721. // 工艺表数据
  1722. orderRemark: remark,
  1723. });
  1724. this.customChangeHandler(saleCustomNo);
  1725. this.productionTableData = saleProductsList.map((item) => {
  1726. let {
  1727. id,
  1728. saleProductNo,
  1729. productNo, //货品编号
  1730. productName, //货品名称
  1731. productNumber, //销售数量
  1732. productWeight, //销售重量kg
  1733. productUnitPrice, //单价
  1734. productAmounts, //金额
  1735. sliceType, //切片类型 初始为 切片
  1736. sliceTypeLabel,
  1737. colourNumberLabel,
  1738. colourNumber, //色号
  1739. remark, //备注
  1740. } = item;
  1741. let productType = this.allProductionOptions.find(
  1742. (i) => productNo == i.productNo
  1743. )?.productType;
  1744. return {
  1745. id,
  1746. saleProductNo,
  1747. productNo, //货品编号
  1748. productType, //类型
  1749. productName, //货品名称
  1750. productNumber, //销售数量
  1751. productWeight, //销售重量kg
  1752. productUnitPrice, //单价
  1753. productAmounts, //金额
  1754. sliceType, //切片类型 初始为 切片
  1755. sliceTypeLabel,
  1756. colourNumberLabel,
  1757. colourNumber, //色号
  1758. remark,
  1759. };
  1760. });
  1761. },
  1762. /** 修改按钮操作 */
  1763. async handleUpdate(row) {
  1764. console.log(row);
  1765. this.isEdit = true;
  1766. await this.getDropDownData();
  1767. this.isLeader = !this.userInfo.roles.includes("salesman");
  1768. if (!this.isLeader) {
  1769. this.createById = this.userInfo.userId;
  1770. }
  1771. await this.getRoleUser();
  1772. this.title = "修改零售单";
  1773. try {
  1774. let res = await getRetailOrderInfo(row.id);
  1775. console.log(res);
  1776. if (res.code == 200) {
  1777. this.initData(res.data);
  1778. this.open = true;
  1779. } else {
  1780. this.$message.error(res.msg);
  1781. }
  1782. } catch (error) {
  1783. console.log(error);
  1784. }
  1785. },
  1786. //详情 打印回调
  1787. async handlePrint(row) {
  1788. await this.getDropDownData();
  1789. this.isLeader = !this.userInfo.roles.includes("salesman");
  1790. if (!this.isLeader) {
  1791. this.createById = this.userInfo.userId;
  1792. }
  1793. await this.getRoleUser();
  1794. try {
  1795. let res = await getRetailOrderInfo(row.id);
  1796. console.log(res);
  1797. if (res.code == 200) {
  1798. this.initData(res.data);
  1799. this.printDomData = this.getPrintDom(res.data);
  1800. this.detailShow = true;
  1801. this.$nextTick(() => {
  1802. this.$refs.detailTable.innerHTML = this.printDomData;
  1803. });
  1804. } else {
  1805. this.$message.error(res.msg);
  1806. }
  1807. } catch (error) {
  1808. console.log(error);
  1809. }
  1810. },
  1811. // 提交 回调
  1812. async handleSubmit(row) {
  1813. this.deliverShow = true;
  1814. this.$nextTick(() => {
  1815. this.$refs.deliverRef.productInvoiceInfo(row);
  1816. });
  1817. },
  1818. // 获取打印dom
  1819. getPrintDom(data) {
  1820. let {
  1821. id,
  1822. //订单表数据
  1823. saleNo,
  1824. saleCustomNo,
  1825. saleDate,
  1826. saleOrderEstimatedTime,
  1827. saleLeadTime,
  1828. deliveryDate,
  1829. saleAmounts,
  1830. saleAmountInWords,
  1831. salePayType,
  1832. salesman,
  1833. customAddress,
  1834. customCountryType, //国家类型
  1835. contactPerson, //联系人
  1836. // 工艺表数据
  1837. orderRemark,
  1838. } = this.formData;
  1839. this.productionTableData;
  1840. let customData = this.customerOptions.find(
  1841. (item) => item.customNo == saleCustomNo
  1842. );
  1843. let customerName = customData ? customData.customName : "";
  1844. let printStr = `
  1845. <table style="width:1200px; border-collapse:collapse;" border="1" cellpadding="10" align="center">
  1846. <div style="text-align:center;font-size: 20px;">诸暨市新丝维纤维有限公司</div>
  1847. <div style="text-align:center;">销售合同审计单</div>
  1848. <tbody>
  1849. <tr>
  1850. <td width="600px" colspan="4">合同号:${saleNo}</td>
  1851. <td width="600px" colspan="4">日期:${saleDate.replace(
  1852. "T",
  1853. " "
  1854. )}</td>
  1855. </tr>
  1856. <tr align="center">
  1857. <td width="300px" colspan="2">客户名称:</td>
  1858. <td width="300px" colspan="2">${customerName}</td>
  1859. <td colspan="2">业务员:</td>
  1860. <td colspan="2">${salesman}</td>
  1861. </tr>
  1862. <tr align="center">
  1863. <td width="300px" colspan="2">客户地址:</td>
  1864. <td width="300px" colspan="2">${customAddress}</td>
  1865. <td width="300px" colspan="2">客户国别:</td>
  1866. <td width="300px" colspan="2">${customCountryType}</td>
  1867. </tr>
  1868. <tr align="center">
  1869. <td width="300px" colspan="2">联系人:</td>
  1870. <td width="150px" colspan="1">${contactPerson}</td>
  1871. <td colspan="2">合计金额(大写):</td>
  1872. <td colspan="3">${saleAmountInWords}</td>
  1873. </tr>
  1874. <tr align="center">
  1875. <td colspan="8">货品明细</td>
  1876. </tr>
  1877. <tr align="center">
  1878. <td width="150px">品名</td>
  1879. <td width="150px">类型</td>
  1880. <td width="150px">箱数</td>
  1881. <td width="150px">单价</td>
  1882. <td width="150px">金额</td>
  1883. <td width="150px">切片型号</td>
  1884. <td width="150px">色号</td>
  1885. <td width="150px">备注</td>
  1886. </tr>`;
  1887. let amountTotal = 0,
  1888. singlTotal = 0,
  1889. moneyTotal = 0;
  1890. for (let i = 0; i < this.productionTableData.length; i++) {
  1891. let item = this.productionTableData[i];
  1892. amountTotal += Number(item.productNumber);
  1893. singlTotal += Number(item.productUnitPrice);
  1894. moneyTotal += Number(item.productAmounts);
  1895. let productData = this.productionOptions.find(
  1896. (pro) => pro.productNo == item.productNo
  1897. );
  1898. item.sliceTypeLabel =
  1899. this.sliceTypeOptions.find((k) => k.materielCode == item.sliceType)
  1900. ?.materielName || "";
  1901. item.colourNumberLabel = this.colourNumberOptions.find(
  1902. (k) => k.materielCode == item.colourNumber
  1903. )?.materieColorNumber;
  1904. let productName = productData ? productData.productName : "";
  1905. let productType = productData ? productData.productType : "";
  1906. printStr += `<tr align="center">
  1907. <td>${productName}</td>
  1908. <td>${productType}</td>
  1909. <td>${item.productNumber}</td>
  1910. <td>${item.productUnitPrice}</td>
  1911. <td>${item.productAmounts}</td>
  1912. <td>${item.sliceTypeLabel}</td>
  1913. <td>${item.colourNumberLabel}</td>
  1914. <td>${item.remark}</td>
  1915. </tr>`;
  1916. }
  1917. // 计算小计
  1918. amountTotal = amountTotal.toFixed(2);
  1919. singlTotal = singlTotal.toFixed(2);
  1920. moneyTotal = moneyTotal.toFixed(2);
  1921. printStr += `
  1922. <tr align="center">
  1923. <td>小计:</td>
  1924. <td></td>
  1925. <td>${amountTotal}</td>
  1926. <td>${singlTotal}</td>
  1927. <td>${moneyTotal}</td>
  1928. <td></td>
  1929. <td></td>
  1930. <td></td>
  1931. </tr>`;
  1932. printStr += `<tr align="left">
  1933. <td colspan="8">订单备注:${orderRemark}</td>
  1934. </tr>
  1935. </tbody>
  1936. </table>`;
  1937. return printStr;
  1938. },
  1939. // 添加真正的字段名
  1940. addRealFieldName(row) {
  1941. let fieldList = Object.keys(row);
  1942. // let tableName = this.longestCommonSubstring(fieldList);
  1943. let tableName = camelCase(this.tableName);
  1944. fieldList.forEach((field) => {
  1945. let realField = field.replace(tableName, "");
  1946. realField = realField[0].toLocaleLowerCase() + realField.substring(1);
  1947. row[realField] = row[field];
  1948. });
  1949. },
  1950. /** 提交按钮 */
  1951. submitForm: function () {
  1952. this.$refs["form"].validate((valid) => {
  1953. if (valid) {
  1954. if (this.form.userId != undefined) {
  1955. updateUser(this.form).then((response) => {
  1956. this.$modal.msgSuccess("修改成功");
  1957. this.open = false;
  1958. this.getList();
  1959. });
  1960. } else {
  1961. addUser(this.form).then((response) => {
  1962. this.$modal.msgSuccess("新增成功");
  1963. this.open = false;
  1964. this.getList();
  1965. });
  1966. }
  1967. }
  1968. });
  1969. },
  1970. /** 删除按钮操作
  1971. *
  1972. * 删除提示信息语句(标识)
  1973. * */
  1974. handleDelete(row, btnData) {
  1975. let delIds = this.ids;
  1976. let primary = camelCase(this.templateInfo.template?.primaryKey);
  1977. // let realyKey=
  1978. this.addRealFieldName(row);
  1979. if (row[primary] != undefined && row[primary] != null) {
  1980. delIds = [];
  1981. delIds.push(row[primary]);
  1982. }
  1983. let data = {
  1984. basicMap: {
  1985. btnType: btnData.btnType,
  1986. btnKey: btnData.btnKey,
  1987. tableName: this.tableName,
  1988. },
  1989. conditionMap: {
  1990. // id: delIds,
  1991. },
  1992. btnParametersMap: {},
  1993. };
  1994. if (this.currentBtnData.btnParams) {
  1995. let btnParams =
  1996. JSON.parse(this.currentBtnData.btnParams)?.commonFieldData || [];
  1997. let conditionData =
  1998. JSON.parse(this.currentBtnData.btnParams).conditionData || [];
  1999. conditionData.forEach((item) => {
  2000. data.conditionMap[item.fieldName.split(".")[1]] = item.fieldValue
  2001. ? item.fieldValue
  2002. : this.currentRow[camelCase(item.fieldName.replace(".", "_"))];
  2003. });
  2004. btnParams.forEach((item) => {
  2005. data.btnParametersMap[item.fieldName.split(".")[1]] = item.fieldValue
  2006. ? item.fieldValue
  2007. : this.currentRow[camelCase(item.fieldName.replace(".", "_"))];
  2008. });
  2009. }
  2010. // data.conditionMap[this.templateInfo.template?.primaryKey] = delIds;
  2011. this.$modal
  2012. .confirm('是否确认删除"' + delIds + '"的数据项?')
  2013. .then(function () {
  2014. // return delTableData(data);
  2015. return btnCommonApi(data);
  2016. })
  2017. .then(() => {
  2018. // 调用子组件查询方法 目的是携带上子组件中的查询参数
  2019. this.$refs.mychild.pageList();
  2020. this.$modal.msgSuccess("删除成功");
  2021. })
  2022. .catch(() => {});
  2023. },
  2024. // 批量删除接口
  2025. handleBatchDelete() {
  2026. let delIds = this.ids;
  2027. let primary = camelCase(this.templateInfo.template?.primaryKey);
  2028. // if (row && row[primary] != undefined && row[primary] != null) {
  2029. // delIds = [];
  2030. // delIds.push(row[primary]);
  2031. // }
  2032. let data = {
  2033. basicMap: {
  2034. tableName: this.tableName,
  2035. },
  2036. conditionMap: {
  2037. // id: delIds,
  2038. },
  2039. };
  2040. // if (this.currentBtnData.btnParams) {
  2041. // let btnParams = JSON.parse(this.currentBtnData.btnParams);
  2042. // btnParams.forEach((item) => {
  2043. // data.btnParametersMap[
  2044. // this.formatField(item.fieldName, camelCase(this.tableName))
  2045. // ] = item.fieldValue
  2046. // ? item.fieldValue
  2047. // : this.currentRow[item.fieldName];
  2048. // });
  2049. // }
  2050. data.conditionMap[this.templateInfo.template?.primaryKey] = delIds;
  2051. this.$modal
  2052. .confirm('是否确认删除"' + delIds + '"的数据项?')
  2053. .then(function () {
  2054. return delTableData(data);
  2055. // return btnCommonApi(data);
  2056. })
  2057. .then(() => {
  2058. // 调用子组件查询方法 目的是携带上子组件中的查询参数
  2059. this.$refs.mychild.pageList();
  2060. this.$modal.msgSuccess("删除成功");
  2061. })
  2062. .catch(() => {});
  2063. },
  2064. /** 导出按钮操作 */
  2065. handleExport() {
  2066. let primary = "saleOrderId";
  2067. let realyKey = "saleOrderId";
  2068. if (this.myDelIds.length > 0) {
  2069. this.queryParams["execlMap"] = [];
  2070. this.myDelIds.forEach((item) => {
  2071. this.queryParams.execlMap.push(
  2072. this.tableList.find((ttem) => {
  2073. return ttem[realyKey] === item;
  2074. })
  2075. );
  2076. });
  2077. } else {
  2078. this.$message.warning("请至少勾选一条导出数据");
  2079. return;
  2080. }
  2081. this.queryParams.execlMap = JSON.stringify(this.queryParams.execlMap);
  2082. this.download(
  2083. process.env.VUE_APP_BASE_API1 + "common/export",
  2084. {
  2085. ...this.queryParams,
  2086. },
  2087. `文件名称_${new Date().getTime()}.xlsx`
  2088. );
  2089. },
  2090. /** 导入按钮操作 */
  2091. handleImport() {
  2092. this.upload.title = "当前导入";
  2093. this.upload.open = true;
  2094. },
  2095. /** 下载模板操作 */
  2096. importTemplate() {
  2097. this.download(
  2098. process.env.VUE_APP_BASE_API1 +
  2099. `common/exportTemplate?tableName=${this.tableName}&sqlkey=${this.templateInfo.template.sqlKey}`,
  2100. {},
  2101. `下载模版名称${new Date().getTime()}.xlsx`
  2102. );
  2103. },
  2104. // 文件上传中处理
  2105. handleFileUploadProgress(event, file, fileList) {
  2106. this.upload.isUploading = true;
  2107. },
  2108. // 文件上传成功处理
  2109. handleFileSuccess(response, file, fileList) {
  2110. this.upload.open = false;
  2111. this.upload.isUploading = false;
  2112. this.$refs.upload.clearFiles();
  2113. this.$alert(
  2114. "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
  2115. response.msg +
  2116. "</div>",
  2117. "导入结果",
  2118. { dangerouslyUseHTMLString: true }
  2119. );
  2120. this.$refs.mychild.pageList({
  2121. limit: this.queryParams.pageSize,
  2122. page: this.queryParams.pageNum,
  2123. });
  2124. },
  2125. //重点在这里
  2126. handleChange(file, fileList) {
  2127. file.name = this.tableName + "." + file.name.split(".")[1];
  2128. fileList.forEach((item) => {
  2129. item.name = this.tableName + "." + file.name.split(".")[1];
  2130. });
  2131. let newFile = new File(
  2132. [file],
  2133. this.tableName + "." + file.name.split(".")[1]
  2134. ); //创建出来也是不可编辑的file对象
  2135. },
  2136. // 提交上传文件
  2137. submitFileForm() {
  2138. this.$refs.upload.submit();
  2139. },
  2140. // 弹窗新增的数
  2141. addListHandler(val) {
  2142. this.addLists.push(...val);
  2143. },
  2144. // 绑定弹窗Dialog确定按钮
  2145. async btnComfirm() {
  2146. let res = await this.$refs.deliverRef.getAllData();
  2147. let { flag, isEdit, data } = res;
  2148. if (flag) {
  2149. if (isEdit) {
  2150. //编辑
  2151. let payLoad = {
  2152. ...data.formData,
  2153. saleProductInfoList: data.tableData,
  2154. };
  2155. let res = await updateProductInvoice(payLoad);
  2156. if (res.code == 200) {
  2157. this.$message.success("修改成功");
  2158. this.deliverShow = false;
  2159. this.getList();
  2160. } else {
  2161. this.$message.error("网络异常");
  2162. }
  2163. } else {
  2164. //新增
  2165. let payLoad = {
  2166. ...data.formData,
  2167. saleProductInfoList: data.tableData,
  2168. };
  2169. let res = await addProductInvoice(payLoad);
  2170. if (res.code == 200) {
  2171. this.$message.success("保存成功");
  2172. this.deliverShow = false;
  2173. this.getList();
  2174. } else {
  2175. this.$message.error("网络异常");
  2176. }
  2177. }
  2178. }
  2179. },
  2180. // 去掉表名 开头字母小写
  2181. formatField(field = "", tableName) {
  2182. let temp = field.replace(tableName, "");
  2183. return toUnderline(temp[0].toLowerCase() + temp.slice(1));
  2184. },
  2185. //提交编辑结果按钮回调
  2186. async editConfirmHandler() {
  2187. if (this.$refs.addFromRef) {
  2188. this.$refs.addFromRef
  2189. .getData()
  2190. .then(async (values) => {
  2191. let data = {
  2192. basicMap: {
  2193. tableName: this.tableName,
  2194. // btnKey: btnData.btnKey,
  2195. btnKey: this.currentBtnData.btnKey,
  2196. },
  2197. addListMap: [values],
  2198. conditionMap: {},
  2199. commMap: {},
  2200. btnParametersMap: {},
  2201. };
  2202. if (this.currentBtnData.btnParams) {
  2203. let btnParams =
  2204. JSON.parse(this.currentBtnData.btnParams)?.commonFieldData ||
  2205. [];
  2206. let conditionData =
  2207. JSON.parse(this.currentBtnData.btnParams).conditionData || [];
  2208. // let
  2209. btnParams.forEach((item) => {
  2210. data.btnParametersMap[item.fieldName.split(".")[1]] =
  2211. item.fieldValue
  2212. ? item.fieldValue
  2213. : this.currentRow[
  2214. camelCase(item.fieldName.replace(".", "_"))
  2215. ];
  2216. });
  2217. conditionData.forEach((item) => {
  2218. data.conditionMap[item.fieldName.split(".")[1]] =
  2219. item.fieldValue
  2220. ? item.fieldValue
  2221. : this.currentRow[
  2222. camelCase(item.fieldName.replace(".", "_"))
  2223. ];
  2224. });
  2225. }
  2226. if (Object.keys(this.defaultValue).length) {
  2227. // data.conditionMap[this.templateInfo.template?.primaryKey] =
  2228. // this.defaultValue[this.templateInfo.template?.primaryKey];
  2229. Object.keys(values).map((k) => {
  2230. data.commMap[k] = values[k];
  2231. });
  2232. data.basicMap.btnType = this.currentBtnData.btnType;
  2233. data.basicMap.visible = true;
  2234. } else {
  2235. data.basicMap.btnType = "INSERT";
  2236. data.basicMap.visible = true;
  2237. }
  2238. try {
  2239. let res = await btnCommonApi(data);
  2240. if (res.code == 200) {
  2241. this.$message.success("操作成功");
  2242. } else {
  2243. this.$message.error("网络异常,请稍后再试");
  2244. }
  2245. } catch (error) {
  2246. console.log(error);
  2247. this.$message.error("网络异常,请稍后再试");
  2248. }
  2249. this.getList();
  2250. this.defaultValue = {};
  2251. this.kOpen = false;
  2252. })
  2253. .catch((res) => {
  2254. console.log(res);
  2255. this.$modal.msgError("表单校验失败,请规范填写数据");
  2256. });
  2257. } else {
  2258. // 没有绑定表单
  2259. let data = {
  2260. basicMap: {
  2261. tableName: this.tableName,
  2262. // btnKey: btnData.btnKey,
  2263. btnKey: this.currentBtnData.btnKey,
  2264. btnType: this.currentBtnData.btnType,
  2265. visible: true,
  2266. },
  2267. addListMap: [],
  2268. conditionMap: {},
  2269. commMap: {},
  2270. btnParametersMap: {},
  2271. };
  2272. if (this.currentBtnData.btnParams) {
  2273. let btnParams =
  2274. JSON.parse(this.currentBtnData.btnParams)?.commonFieldData || [];
  2275. let conditionData =
  2276. JSON.parse(this.currentBtnData.btnParams).conditionData || [];
  2277. conditionData.forEach((item) => {
  2278. data.conditionMap[item.fieldName.split(".")[1]] = item.fieldValue
  2279. ? item.fieldValue
  2280. : this.currentRow[camelCase(item.fieldName.replace(".", "_"))];
  2281. });
  2282. btnParams.forEach((item) => {
  2283. data.btnParametersMap[item.fieldName.split(".")[1]] =
  2284. item.fieldValue
  2285. ? item.fieldValue
  2286. : this.currentRow[camelCase(item.fieldName.replace(".", "_"))];
  2287. });
  2288. }
  2289. // data.basicMap.btnType = this.currentBtnData.btnType;
  2290. // data.basicMap.visible = true;
  2291. try {
  2292. let res = await btnCommonApi(data);
  2293. if (res.code == 200) {
  2294. this.$message.success("操作成功");
  2295. } else {
  2296. this.$message.error("网络异常,请稍后再试");
  2297. }
  2298. } catch (error) {
  2299. console.log(error);
  2300. this.$message.error("网络异常,请稍后再试");
  2301. }
  2302. this.getList();
  2303. this.defaultValue = {};
  2304. this.kOpen = false;
  2305. }
  2306. },
  2307. // 使用提交数据类型的按钮获取数据
  2308. tempSubBtn(getData) {
  2309. getData()
  2310. .then((values) => {
  2311. console.log("验证通过", values);
  2312. })
  2313. .catch(() => {
  2314. console.log("验证未通过,获取失败");
  2315. });
  2316. },
  2317. // 判断是否生效行样式
  2318. cellStyle({ row, column, rowIndex, columnIndex }) {
  2319. let rowStyleList = this.styleList.filter((item) => item.styleType == 0);
  2320. if (!rowStyleList.length) return "";
  2321. let mainTableName = this.templateInfo.querySql.tableAlias; //主表名
  2322. for (let i = 0; i < rowStyleList.length; i++) {
  2323. let item = rowStyleList[i];
  2324. let judgeRes = this.determineCondition(item.styleCondtion, row);
  2325. if (judgeRes) {
  2326. let styleCode = JSON.parse(item.styleCode);
  2327. return `background-color:${styleCode.rowBgColor};`;
  2328. }
  2329. }
  2330. },
  2331. // 获取生效条件组结果
  2332. determineCondition(conditionStr, row) {
  2333. let conditionList = JSON.parse(conditionStr);
  2334. if (!conditionList.length) return false;
  2335. return conditionList.every((item) => this.judgeOneCondition(item, row));
  2336. },
  2337. // 获取单个判断条件结果
  2338. judgeOneCondition(item, row) {
  2339. let fullField = camelCase(item.tableName + "_" + item.fieldName);
  2340. switch (item.condition) {
  2341. case 1:
  2342. return row[fullField] > item.flagValue;
  2343. case 2:
  2344. return row[fullField] < item.flagValue;
  2345. case 3:
  2346. return row[fullField] == item.flagValue;
  2347. case 4:
  2348. return row[fullField] >= item.flagValue;
  2349. case 5:
  2350. return row[fullField] <= item.flagValue;
  2351. default:
  2352. return true; //默认为true
  2353. }
  2354. },
  2355. // 设置表格字段样式
  2356. async setFieldStyleData(tableList) {
  2357. console.log(JSON.parse(JSON.stringify(tableList)));
  2358. let fieldConditionList = this.styleList.filter(
  2359. (item) => item.styleType == 1 || item.styleType == 2
  2360. );
  2361. if (!fieldConditionList.length) return tableList;
  2362. let res = await this.setDictStyleData();
  2363. this.dictStyleObj = res.reduce((pre, item) => {
  2364. return {
  2365. ...pre,
  2366. ...item,
  2367. };
  2368. }, {});
  2369. // console.log("this.dictStyleObj", this.dictStyleObj);
  2370. tableList.forEach((row) => {
  2371. // if (!row.styleFieldObj) row.styleFieldObj = {};
  2372. for (let i = 0; i < fieldConditionList.length; i++) {
  2373. let item = fieldConditionList[i];
  2374. if (item.styleType == 1) {
  2375. //字段样式
  2376. let judgeRes = this.determineCondition(item.styleCondtion, row);
  2377. if (judgeRes) {
  2378. let styleCode = JSON.parse(item.styleCode);
  2379. if (!row.styleFieldObj) row.styleFieldObj = {};
  2380. row.styleFieldObj[item.styleField] = {
  2381. styleType: item.styleType,
  2382. fieldStyleType: styleCode.fieldStyleType,
  2383. fontColor: styleCode.fontColor,
  2384. isTagFullBg: styleCode.isTagFullBg,
  2385. tagType: styleCode.tagType,
  2386. };
  2387. // row.styleField = item.styleField; //样式生效字段
  2388. // row.styleType = item.styleType; //0:行样式 1:字段样式 2:字典样式
  2389. // row.fieldStyleType = styleCode.fieldStyleType; //0:文本 1:标签
  2390. // row.fontColor = styleCode.fontColor;
  2391. // row.isTagFullBg = styleCode.isTagFullBg; //true/false
  2392. // row.tagType = styleCode.tagType; //string
  2393. }
  2394. } else {
  2395. //字典样式
  2396. let dicStyle = this.dictStyleObj[item.styleField]?.find((dict) => {
  2397. return dict.dictValue == row[item.styleField];
  2398. });
  2399. if (dicStyle) {
  2400. if (!row.styleFieldObj) row.styleFieldObj = {};
  2401. row.styleFieldObj[item.styleField] = dicStyle; //设置该字段应该显示的字典样式
  2402. row.styleFieldObj[item.styleField].styleType = 2;
  2403. }
  2404. }
  2405. }
  2406. });
  2407. return tableList;
  2408. },
  2409. //设置表格字典相关数据
  2410. setDictStyleData() {
  2411. let fieldConditionList = this.styleList.filter(
  2412. (item) => item.styleType == 2
  2413. );
  2414. if (!fieldConditionList.length) return;
  2415. let PromiseList = fieldConditionList.map((item) => {
  2416. return new Promise((resolve, reject) => {
  2417. let temp = {};
  2418. try {
  2419. listData({
  2420. isEnablePaging: false,
  2421. dictType: item.styleCondtion,
  2422. }).then((res) => {
  2423. temp[item.styleField] = res.rows;
  2424. resolve(temp);
  2425. });
  2426. } catch (error) {
  2427. reject(error);
  2428. }
  2429. });
  2430. });
  2431. return Promise.all(PromiseList);
  2432. },
  2433. // 内链页面跳转
  2434. routerHandler(btnData, type) {
  2435. let { url, commonFieldData } = JSON.parse(btnData.btnParams);
  2436. let tempArr = [];
  2437. if (commonFieldData) {
  2438. let queryArr = JSON.parse(commonFieldData);
  2439. tempArr = queryArr.map((item) => {
  2440. let key = this.formatField(item.fieldName, camelCase(this.tableName));
  2441. let value = item.fieldValue
  2442. ? item.fieldValue
  2443. : this.currentRow[item.fieldName];
  2444. return key + "=" + value;
  2445. });
  2446. }
  2447. if (tempArr.length) {
  2448. url += "?" + tempArr.join("&");
  2449. }
  2450. // let link = btnData.btnParams;
  2451. if (type == "INNERLINK") {
  2452. this.$router.push(url);
  2453. } else {
  2454. window.open("http://" + url, "_blank");
  2455. }
  2456. },
  2457. async handleDetail(row) {
  2458. this.printDomData = await this.getDetailTableString(row);
  2459. this.detailShow = true;
  2460. this.$nextTick(() => {
  2461. this.$refs.detailTable.innerHTML = this.printDomData;
  2462. });
  2463. },
  2464. // 切片类型改变回调
  2465. sliceTypeChangeHandler(row) {
  2466. let { sliceType } = row;
  2467. if (sliceType) {
  2468. row.sliceTypeLabel = this.sliceTypeOptions.find(
  2469. (item) => item.materielCode == sliceType
  2470. )?.materielName;
  2471. }
  2472. },
  2473. // 色号改变回调
  2474. colourNumberChangeHandler(row) {
  2475. let { colourNumber } = row;
  2476. if (colourNumber) {
  2477. let target = this.colourNumberOptions.find(
  2478. (item) => item.materielCode == colourNumber
  2479. );
  2480. if (target) {
  2481. row.colourNumberLabel =
  2482. target.materieEncoding + target.materieColorNumber;
  2483. }
  2484. // row.colourNumberLabel = this.colourNumberOptions.find(
  2485. // (item) => item.materielCode == colourNumber
  2486. // )?.materieColorNumber;
  2487. }
  2488. },
  2489. // 打印回调
  2490. detailPrintHandler() {
  2491. document.body.innerHTML = document.getElementById("printDom").innerHTML =
  2492. this.printDomData;
  2493. window.print(); //打印
  2494. window.location.reload();
  2495. return false;
  2496. },
  2497. // 根据字典value获取字典label
  2498. getDictLabel(value, dict) {
  2499. return (
  2500. this.dict.type[dict].find((item) => {
  2501. return item.value === value;
  2502. })?.label || ""
  2503. );
  2504. },
  2505. // 获取详情html字符串
  2506. async getDetailTableString(row) {
  2507. let { saleOrderSaleNo } = row;
  2508. let payLoad = [
  2509. {
  2510. basicMap: {
  2511. tableName: "sale_order",
  2512. },
  2513. conditionMap: {
  2514. sale_no: [saleOrderSaleNo],
  2515. },
  2516. },
  2517. {
  2518. basicMap: {
  2519. tableName: "sale_products",
  2520. },
  2521. conditionMap: {
  2522. sale_order_no: [saleOrderSaleNo],
  2523. },
  2524. },
  2525. {
  2526. basicMap: {
  2527. tableName: "sale_craft",
  2528. },
  2529. conditionMap: {
  2530. sale_order_no: [saleOrderSaleNo],
  2531. },
  2532. },
  2533. ];
  2534. let res = await queryDropDownBoxData(payLoad);
  2535. if (res.code == 200) {
  2536. console.log(res);
  2537. let { sale_craft, sale_order, sale_products } = res.data.resultMap;
  2538. let {
  2539. //订单表数据
  2540. saleNo, //合同号
  2541. lotNumber, //批号
  2542. saleCustomNo, //客户编号
  2543. saleDate, //销售单日期
  2544. saleOrderEstimatedTime, //预计下单时间
  2545. saleLeadTime, //交货周期
  2546. deliveryDate,
  2547. saleAmounts, //合计金额 小写
  2548. saleAmountInWords, //合计金额 大写
  2549. salePayType, //支付方式
  2550. earnestMoney,
  2551. salesman, //业务员
  2552. saleLeader, //业务主管
  2553. finance, //财务部
  2554. production, //生产部
  2555. saleApprover, //批准人
  2556. // customAddress, //客户地址
  2557. // customCountryType, //国家类型
  2558. // contactPerson, //联系人
  2559. // 货品明细表数据
  2560. // productNo, //货品号
  2561. // productName, //货品名称
  2562. // productNumber: "", //销售数量
  2563. // productWeight: "", //销售重量kg
  2564. // productUnitPrice: "", //单价
  2565. // productAmounts: "", //金额
  2566. // remark: "", //备注
  2567. // 工艺表
  2568. craftGrid, //网络
  2569. craftOil, //油剂
  2570. craftPackage, //卷装
  2571. craftColorFastness, //色牢度
  2572. directionOfTwist,
  2573. craftOther, //其它工艺要求
  2574. craftMark, //包装/贴唛
  2575. shippingMethod, //运输方式
  2576. } = { ...sale_craft[0], ...sale_order[0] };
  2577. let customData = this.customerOptions.find(
  2578. (item) => item.customNo == saleCustomNo
  2579. );
  2580. let payType = this.getDictLabel(salePayType, "payment_method"); //付款方式
  2581. let customerName = customData ? customData.customName : "";
  2582. let customAddress = customData?.customAddress || "无";
  2583. let customCountryType = customData?.customCountryType || "";
  2584. let contactPerson = customData?.contactPerson || "无";
  2585. let directionOfTwistDescription = directionOfTwist
  2586. ? this.getDictLabel(directionOfTwist, "direction_of_twist")
  2587. : "";
  2588. let printStr = `
  2589. <table style="width:1200px; border-collapse:collapse;" border="1" cellpadding="10" align="center">
  2590. <div style="text-align:center;font-size: 20px;">诸暨市新丝维纤维有限公司</div>
  2591. <div style="text-align:center;">销售合同审计单</div>
  2592. <tbody>
  2593. <tr>
  2594. <td width="600px" colspan="4">合同号:${saleNo}</td>
  2595. <td width="600px" colspan="4">日期:${saleDate.replace(
  2596. "T",
  2597. " "
  2598. )}</td>
  2599. </tr>
  2600. <tr align="center">
  2601. <td width="300px" colspan="2">客户名称:</td>
  2602. <td width="300px" colspan="2">${customerName}</td>
  2603. <td width="300px" colspan="2">联系人:</td>
  2604. <td width="150px" colspan="1">${contactPerson}</td>
  2605. </tr>
  2606. <tr align="center">
  2607. <td width="300px" colspan="2">客户地址:</td>
  2608. <td width="300px" colspan="2">${customAddress}</td>
  2609. <td width="300px" colspan="2">客户国别:</td>
  2610. <td width="300px" colspan="2">${customCountryType}</td>
  2611. </tr>
  2612. <tr align="center">
  2613. <td width="300px" colspan="2">预计下单时间:</td>
  2614. <td colspan="1">${saleOrderEstimatedTime.replace(
  2615. "T",
  2616. " "
  2617. )}</td>
  2618. <td colspan="1">交货周期:</td>
  2619. <td >${saleLeadTime}</td>
  2620. <td colspan="2">交货日期:</td>
  2621. <td >${deliveryDate.replace("T", " ")}</td>
  2622. </tr>
  2623. <tr align="center">
  2624. <td colspan="8">货品明细</td>
  2625. </tr>
  2626. <tr align="center">
  2627. <td width="150px">品名</td>
  2628. <td width="150px">类型</td>
  2629. <td width="150px">箱数</td>
  2630. <td width="150px">单价</td>
  2631. <td width="150px">金额</td>
  2632. <td width="150px">切片型号</td>
  2633. <td width="150px">色号</td>
  2634. <td width="150px">备注</td>
  2635. </tr>`;
  2636. let amountTotal = 0,
  2637. singlTotal = 0,
  2638. moneyTotal = 0;
  2639. for (let i = 0; i < sale_products.length; i++) {
  2640. let item = sale_products[i];
  2641. amountTotal += Number(item.productNumber);
  2642. singlTotal += Number(item.productUnitPrice);
  2643. moneyTotal += Number(item.productAmounts);
  2644. let productData = this.productionOptions.find(
  2645. (pro) => pro.productNo == item.productNo
  2646. );
  2647. console.log("item", item);
  2648. item.sliceTypeLabel =
  2649. this.sliceTypeOptions.find((k) => k.materielCode == item.sliceType)
  2650. ?.materielName || "";
  2651. item.colourNumberLabel = this.colourNumberOptions.find(
  2652. (k) => k.materielCode == item.colourNumber
  2653. )?.materieColorNumber;
  2654. let productName = productData ? productData.productName : "";
  2655. let productType = productData ? productData.productType : "";
  2656. printStr += `<tr align="center">
  2657. <td>${productName}</td>
  2658. <td>${productType}</td>
  2659. <td>${item.productNumber}</td>
  2660. <td>${item.productUnitPrice}</td>
  2661. <td>${item.productAmounts}</td>
  2662. <td>${item.sliceTypeLabel}</td>
  2663. <td>${item.colourNumberLabel}</td>
  2664. <td>${item.remark}</td>
  2665. </tr>`;
  2666. }
  2667. // 计算小计
  2668. printStr += `
  2669. <tr align="center">
  2670. <td>小计:</td>
  2671. <td></td>
  2672. <td>${amountTotal}</td>
  2673. <td>${singlTotal}</td>
  2674. <td>${moneyTotal}</td>
  2675. <td></td>
  2676. <td></td>
  2677. <td></td>
  2678. </tr>
  2679. <tr>
  2680. <td colspan="8">合计金额(大写):${saleAmountInWords}</td>
  2681. </tr>
  2682. `;
  2683. if (salePayType == "1") {
  2684. //定金
  2685. printStr += `
  2686. <tr>
  2687. <td colspan="4">付款方式:${payType}</td>
  2688. <td colspan="4">定金:${earnestMoney}</td>
  2689. </tr>`;
  2690. } else {
  2691. printStr += `
  2692. <tr>
  2693. <td colspan="8">付款方式:${payType}</td>
  2694. </tr>`;
  2695. }
  2696. printStr += `<tr align="center">
  2697. <td colspan="8">工艺要求</td>
  2698. </tr>
  2699. <tr align="center">
  2700. <td width="150px">网络</td>
  2701. <td width="150px">油剂</td>
  2702. <td width="150px">卷装</td>
  2703. <td width="150px">色牢度</td>
  2704. <td width="150px">捻向</td>
  2705. <td width="150px">其他</td>
  2706. <td width="150px"></td>
  2707. <td width="150px"></td>
  2708. </tr>
  2709. <tr align="center">
  2710. <td >${craftGrid}</td>
  2711. <td>${craftOil}</td>
  2712. <td>${craftPackage}</td>
  2713. <td>${craftColorFastness}</td>
  2714. <td>${directionOfTwistDescription}</td>
  2715. <td>${craftOther}</td>
  2716. <td width="150px"></td>
  2717. <td width="150px"></td>
  2718. </tr>
  2719. <tr>
  2720. <td colspan="8">包装/贴唛:${craftMark}</td>
  2721. </tr>
  2722. <tr>
  2723. <td colspan="8">装运方式:${shippingMethod}</td>
  2724. </tr>
  2725. <tr align="center">
  2726. <td colspan="2">业务员:</td>
  2727. <td colspan="2">${salesman}</td>
  2728. <td colspan="2">财务部:</td>
  2729. <td colspan="2">${finance}</td>
  2730. </tr>
  2731. <tr align="center">
  2732. <td colspan="2">业务主管:</td>
  2733. <td colspan="2">${saleApprover}</td>
  2734. <td></td>
  2735. <td></td>
  2736. <td></td>
  2737. <td></td>
  2738. </tr>
  2739. </tbody>
  2740. </table>
  2741. `;
  2742. return printStr;
  2743. // <td colspan="2">业务主管:</td>
  2744. // <td colspan="2">${saleLeader}</td>
  2745. // <tr align="center">
  2746. // // <td colspan="2">生产部:</td>
  2747. // // <td colspan="2">${production}</td>
  2748. // </tr>
  2749. // <tr align="center">
  2750. // <td colspan="2"> 2</td>
  2751. // <td> </td>
  2752. // <td> </td>
  2753. // <td> </td>
  2754. // <td> </td>
  2755. // </tr>
  2756. // <tr>
  2757. // <td colspan="2">小计:</td>
  2758. // <td></td>
  2759. // <td></td>
  2760. // <td></td>
  2761. // <td></td>
  2762. // </tr>
  2763. }
  2764. },
  2765. // 自定义删除按钮
  2766. async myDeleteHandler(row) {
  2767. console.log(row);
  2768. let stateArr = ["2", "3", "4", "5", "6", "8"];
  2769. let isDeleteValidate = this.selection.some((item) => {
  2770. return stateArr.includes(item.status);
  2771. });
  2772. console.log(this.selection);
  2773. console.log(isDeleteValidate);
  2774. if (isDeleteValidate) {
  2775. this.$message.error("仅允许删除订单状态为'未提交'或'未通过'的订单");
  2776. return;
  2777. }
  2778. await this.$confirm("是否确认删除选中的数据?", "警告", {
  2779. confirmButtonText: "确定",
  2780. cancelButtonText: "取消",
  2781. type: "warning",
  2782. });
  2783. let payLoad = row.saleOrderId ? [row.saleOrderId] : this.myDelIds;
  2784. console.log(payLoad);
  2785. try {
  2786. let res = await delOrder(payLoad);
  2787. if (res.code === 200) {
  2788. this.$message.success("删除成功");
  2789. this.getList();
  2790. this.myDelIds = [];
  2791. // this.$nextTick(() => {
  2792. // this.$refs.tableRef?.clearSelection();
  2793. // });
  2794. } else {
  2795. this.$message.error(res.msg);
  2796. }
  2797. } catch (error) {}
  2798. },
  2799. // 发货回调
  2800. myDeliverHandler(row) {
  2801. this.currentRow = row;
  2802. this.deliverShow = true;
  2803. this.$nextTick(() => {
  2804. this.$refs.deliverRef.productInvoiceInfo(row);
  2805. });
  2806. },
  2807. },
  2808. };
  2809. </script>
  2810. <style scoped lang="scss">
  2811. ::v-deep .el-dialog:not(.is-fullscreen) {
  2812. min-width: 610px !important;
  2813. }
  2814. </style>