detailsPage.vue 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630
  1. <template>
  2. <div>
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left" @click="backToList(0)"
  6. >返回列表
  7. </el-button>
  8. </div>
  9. <div class="add-customer-btn">
  10. <el-button
  11. class="el-button&#45;&#45;small-yh"
  12. style="margin-left: 6px;"
  13. type="primary"
  14. size="small"
  15. v-if="editButton && form.status == 0"
  16. @click="inEdit"
  17. >编 辑
  18. </el-button>
  19. <el-button
  20. class="el-button--small-yh"
  21. v-if="!editButton"
  22. style="margin-left: 6px;"
  23. type="primary"
  24. size="small"
  25. :disabled="isSaveBtn"
  26. @click="editCustomer(0)"
  27. >保 存
  28. </el-button>
  29. <el-button
  30. class="el-button--small-yh"
  31. style="margin-left: 6px;"
  32. type="warning"
  33. size="small"
  34. @click="revokePlan()"
  35. v-if="Number(form.status) === 1"
  36. >撤 销
  37. </el-button>
  38. <el-button
  39. class="el-button--small-yh"
  40. style="margin-left: 6px;"
  41. type="success"
  42. size="small"
  43. v-if="!editButton"
  44. @click="editCustomer(1)"
  45. :disabled="form.status == 1"
  46. >提 交
  47. </el-button>
  48. <!-- <el-dropdown v-if="form.status == 1">
  49. <el-button style="margin-left: 6px;" type="success" size="small">
  50. 审 核<i class="el-icon-arrow-down el-icon--right"></i>
  51. </el-button>
  52. <el-dropdown-menu slot="dropdown">
  53. <el-dropdown-item @click.native="auditPlan(2)">通过</el-dropdown-item>
  54. <el-dropdown-item @click.native="approve()">驳回</el-dropdown-item>
  55. </el-dropdown-menu>
  56. </el-dropdown> -->
  57. </div>
  58. </div>
  59. <div style="margin-top: 50px">
  60. <trade-card title="基础信息">
  61. <avue-form :option="optionForm" v-model="form" ref="form" :upload-exceed="uploadExceed">
  62. <template slot-scope="{ row, index }" slot="contacts">
  63. <!-- 联系人 -->
  64. <el-select
  65. v-model="form.contacts"
  66. placeholder="请选择"
  67. size="small"
  68. style="width:60%"
  69. clearable
  70. filterable
  71. allow-create
  72. default-first-option
  73. @change="contactsChange($event)"
  74. :disabled="editButton || form.status == 1"
  75. >
  76. <el-option v-for="item in contactsOption" :key="item.cname" :label="item.cname" :value="item.contacts" />
  77. </el-select>
  78. </template>
  79. <tempalte slot="customerName">
  80. <dic-select
  81. v-model="form.customerName"
  82. placeholder="货主"
  83. key="id"
  84. label="cname"
  85. res="records"
  86. url="/blade-sales-part/corpsDesc/list?current=1&size=20&&enableOrNot=1&corpType=KH"
  87. :filterable="true"
  88. :remote="true"
  89. dataName="cname"
  90. @selectChange="dicChange('customerName', $event)"
  91. :disabled="editButton || form.status == 1"
  92. ></dic-select>
  93. </tempalte>
  94. <tempalte slot="storageName">
  95. <dic-select
  96. v-model="form.storageName"
  97. placeholder="仓库"
  98. key="id"
  99. label="cname"
  100. res="records"
  101. url="/blade-sales-part/tire/center/warehouse/storage/list?current=1&size=5"
  102. :filterable="true"
  103. :remote="true"
  104. dataName="cname"
  105. @selectChange="dicChange('storageName', $event)"
  106. :disabled="editButton || form.status == 1 || form.planItemsList.length > 0"
  107. ></dic-select>
  108. </tempalte>
  109. <tempalte slot="warehouseKeeperName">
  110. <dic-select
  111. v-model="form.warehouseKeeperName"
  112. placeholder="库管"
  113. key="id"
  114. label="realName"
  115. res="records"
  116. url="/blade-user/page?current=1&size=5&userType=2"
  117. :filterable="true"
  118. :remote="true"
  119. dataName="realName"
  120. @selectChange="dicChange('warehouseKeeperName', $event)"
  121. :disabled="editButton || form.status == 1"
  122. ></dic-select>
  123. </tempalte>
  124. </avue-form>
  125. </trade-card>
  126. <trade-card title="明细信息">
  127. <el-tabs v-model="activeName" type="card">
  128. <el-tab-pane label="商品明细" name="sale_detail">
  129. <avue-crud
  130. :option="optionContacts"
  131. ref="formContacts"
  132. :data="form.planItemsList"
  133. :key="key"
  134. @row-update="rowUpdate"
  135. @row-close="rowClose"
  136. :before-close="beforeClose"
  137. @selection-change="selectionContacts"
  138. @resetColumn="resetColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 477)"
  139. @saveColumn="saveColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 477)"
  140. >
  141. <template slot-scope="{ scope, row }" slot="menuLeft">
  142. <el-button type="primary" icon="el-icon-plus" size="small" :disabled="editButton || form.status == 1" @click="rowAdd(row)"
  143. >添加商品
  144. </el-button>
  145. <el-button
  146. type="success"
  147. size="small"
  148. :disabled="editButton || form.status == 1"
  149. icon="el-icon-bottom"
  150. @click="excelDialogfun('code')"
  151. >按Code导入
  152. </el-button>
  153. <el-button type="primary" icon="el-icon-printer" size="small" @click="handlePrint">打印 </el-button>
  154. <!-- <el-button type="danger" plain size="small" @click="batchDelete"
  155. :disabled="editButton || form.status == 1 || selectionMultilist.length == 0">
  156. 一键删除
  157. </el-button> -->
  158. </template>
  159. <template slot="regionNameForm" slot-scope="{ row }">
  160. <dic-select
  161. v-if="row.$cellEdit"
  162. v-model="row.regionName"
  163. placeholder="库区"
  164. key="id"
  165. label="regionName"
  166. :url="'/blade-sales-part/tire/center/warehouse/storage-region/getRegionSelected?storageId=' + form.storageId"
  167. :filterable="true"
  168. :remote="true"
  169. dataName="regionName"
  170. @selectChange="rowDicChange('regionName', $event, row)"
  171. ></dic-select>
  172. <span v-else>{{ row.regionName }}</span>
  173. </template>
  174. <template slot="goodsNumForm" slot-scope="{ row }">
  175. <el-input-number
  176. v-if="row.$cellEdit"
  177. size="small"
  178. v-model="row.goodsNum"
  179. type="number"
  180. :min="1"
  181. :max="99999"
  182. :controls="false"
  183. :precision="numberDecimal"
  184. style="width: 100%"
  185. @change="moneyChange(row)"
  186. ></el-input-number>
  187. <span v-else>{{ row.goodsNum }}</span>
  188. </template>
  189. <template slot="price" slot-scope="{ row }">
  190. <el-input
  191. v-if="row.$cellEdit"
  192. size="small"
  193. v-model="row.price"
  194. style="width: 100%"
  195. type="number"
  196. :controls="false"
  197. @change="moneyChange(row)"
  198. ></el-input>
  199. <span v-else>{{ row.price }}</span>
  200. </template>
  201. <template slot="dot" slot-scope="{ row }">
  202. <el-input v-if="row.$cellEdit" v-model="row.dot" size="small" style="width: 100%" />
  203. <span v-else>{{ row.dot }}</span>
  204. </template>
  205. <template slot="rebatePrice" slot-scope="{ row }">
  206. <el-input v-if="row.$cellEdit" size="small" v-model="row.rebatePrice" style="width: 100%"></el-input>
  207. <span v-else>{{ row.rebatePrice }}</span>
  208. </template>
  209. <template slot="remarks" slot-scope="{ row }">
  210. <el-input v-if="row.$cellEdit" size="small" v-model="row.remarks" style="width: 100%"></el-input>
  211. <span v-else>{{ row.remarks }}</span>
  212. </template>
  213. <template slot-scope="{ type, size, row, index, disabled }" slot="menu">
  214. <el-button
  215. :size="size"
  216. :disabled="editButton || form.status == 1 || row.isDeleted == 1"
  217. :type="type"
  218. :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
  219. @click="rowEdit(row, index)"
  220. >{{ row.$cellEdit ? "保存" : "编辑" }}
  221. </el-button>
  222. <el-button
  223. :icon="row.isDeleted == 1 ? 'el-icon-refresh-left' : 'el-icon-delete'"
  224. :size="size"
  225. :disabled="editButton || form.status == 1"
  226. :type="type"
  227. @click="rowDel(row, index, 'planItemsList')"
  228. >{{ row.isDeleted == 1 ? "恢复" : "删除" }}
  229. </el-button>
  230. </template>
  231. </avue-crud>
  232. </el-tab-pane>
  233. <el-tab-pane label="费用明细" name="outbound_records">
  234. <avue-crud
  235. :option="optionOutboundRecords"
  236. ref="outbound_records"
  237. :data="form.centerShipCostList"
  238. @row-update="rowUpdate"
  239. @resetColumn="resetColumnTwo('outbound_records', 'optionOutboundRecords', 'optionOutboundRecordsBack', 478)"
  240. @saveColumn="saveColumnTwo('outbound_records', 'optionOutboundRecords', 'optionOutboundRecordsBack', 478)"
  241. >
  242. <template slot-scope="{ scope, row }" slot="menuLeft">
  243. <el-button type="primary" size="small" @click="feeSubmit()">一键保存</el-button>
  244. </template>
  245. <template slot="indexHeader" slot-scope="{ row, index }">
  246. <el-button type="primary" size="mini" icon="el-icon-plus" circle @click="addRow()"> </el-button>
  247. </template>
  248. <template slot="index" slot-scope="{ row, index }">
  249. <span>{{ index + 1 }}</span>
  250. </template>
  251. <template slot="costNameForm" slot-scope="{ row }">
  252. <dic-select
  253. v-if="row.$cellEdit"
  254. v-model="row.costName"
  255. placeholder="费用名称"
  256. key="id"
  257. res="records"
  258. label="cname"
  259. url="/blade-sales-part/tire/center/warehouse/costDesc/list?current=1&size=5"
  260. :filterable="true"
  261. :remote="true"
  262. dataName="cname"
  263. @selectChange="rowDicChange('costName', $event, row)"
  264. ></dic-select>
  265. <span v-else>{{ row.costName }}</span>
  266. </template>
  267. <tempalte slot="costPriceForm" slot-scope="{ row }">
  268. <el-input-number
  269. v-if="row.$cellEdit"
  270. v-model="row.costPrice"
  271. @change="countChange(row)"
  272. type="number"
  273. :controls="false"
  274. placeholder="请输入 单价"
  275. size="small"
  276. style="width: 100%;"
  277. ></el-input-number>
  278. <span v-else>{{ row.costPrice }}</span>
  279. </tempalte>
  280. <tempalte slot="goodsNumForm" slot-scope="{ row }">
  281. <el-input-number
  282. v-if="row.$cellEdit"
  283. v-model="row.goodsNum"
  284. @change="countChange(row)"
  285. type="number"
  286. :min="1"
  287. :max="99999"
  288. :controls="false"
  289. placeholder="请输入 数量"
  290. size="small"
  291. style="width: 100%;"
  292. ></el-input-number>
  293. <span v-else>{{ row.goodsNum }}</span>
  294. </tempalte>
  295. <template slot-scope="{ type, size, row, index, disabled }" slot="menu">
  296. <el-button
  297. :size="size"
  298. :disabled="row.isDeleted == 1"
  299. :type="type"
  300. :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
  301. @click="rowEdit(row, index)"
  302. >{{ row.$cellEdit ? "保存" : "编辑" }}
  303. </el-button>
  304. <el-button
  305. :icon="row.isDeleted == 1 ? 'el-icon-refresh-left' : 'el-icon-delete'"
  306. :size="size"
  307. :type="type"
  308. @click="rowDel(row, index, 'centerShipCostList')"
  309. >{{ row.isDeleted == 1 ? "恢复" : "删除" }}
  310. </el-button>
  311. </template>
  312. </avue-crud>
  313. </el-tab-pane>
  314. </el-tabs>
  315. </trade-card>
  316. <report-dialog :switchDialog="switchDialog" reportName="中心仓-入库" :reportId="form.id" @onClose="onClose()"></report-dialog>
  317. </div>
  318. <el-dialog title="导入明细" append-to-body :visible.sync="excelBox" v-if="excelBox" width="555px" :close-on-click-modal="false" v-dialog-drag>
  319. <avue-form :option="excelOption" v-model="excelForm" table-loading="excelLoading" :upload-before="uploadBefore" :upload-after="uploadAfter">
  320. <template slot="excelTemplate">
  321. <el-button type="primary" @click="derivation"> 点击下载<i class="el-icon-download el-icon--right"></i> </el-button>
  322. </template>
  323. </avue-form>
  324. <p style="text-align: center;color: #DC0505">
  325. 温馨提示 第一次导入时请先下载模板
  326. </p>
  327. </el-dialog>
  328. <el-dialog
  329. title="选择商品"
  330. append-to-body
  331. class="el-dialogDeep"
  332. :visible.sync="dialogVisible"
  333. width="80%"
  334. :close-on-click-modal="false"
  335. :destroy-on-close="true"
  336. :close-on-press-escape="false"
  337. @close="closeGoods"
  338. >
  339. <el-row :style="{ height: rowHeight }">
  340. <el-col :span="5">
  341. <div>
  342. <el-scrollbar>
  343. <basic-container>
  344. <avue-tree style="height: 70vh;overflow-y: auto" :option="treeOption" :data="treeDataGoods" @node-click="nodeClick" />
  345. </basic-container>
  346. </el-scrollbar>
  347. </div>
  348. </el-col>
  349. <el-col :span="19">
  350. <basic-container>
  351. <avue-crud
  352. :option="optionTwo"
  353. :table-loading="loading"
  354. :data="goodsListShow"
  355. ref="crud"
  356. :search.sync="SelectSearch"
  357. @refresh-change="refreshChange"
  358. @selection-change="selectionChange"
  359. @search-change="goodsSearch"
  360. :page.sync="page"
  361. @on-load="onLoadfun"
  362. >
  363. <template slot="menuLeft">
  364. <el-tabs v-model="activeNameTabs" @tab-click="tabHandle">
  365. <el-tab-pane label="查询结果" name="searchList" />
  366. <el-tab-pane label="已选定数据" name="importStaging" />
  367. </el-tabs>
  368. </template>
  369. <template slot="goodsNum" slot-scope="{ row }">
  370. <el-input-number
  371. v-model="row.goodsNum"
  372. size="small"
  373. :controls="false"
  374. :precision="numberDecimal"
  375. @input="amountChange($event, row)"
  376. style="width: 100%"
  377. />
  378. </template>
  379. <template slot="price" slot-scope="{ row }">
  380. <el-input-number v-model="row.price" size="small" :controls="false" style="width: 100%" />
  381. </template>
  382. <template slot="dot" slot-scope="{ row }">
  383. <el-input v-model="row.dot" size="small" style="width: 100%" />
  384. </template>
  385. <template slot-scope="scope" slot="menu">
  386. <el-button
  387. type="text"
  388. icon="el-icon-edit"
  389. size="small"
  390. @click.stop="importStagList(scope.row, scope.index)"
  391. v-if="activeNameTabs == 'searchList'"
  392. :disabled="goodsListSave.findIndex(item => item.id == scope.row.id) !== -1"
  393. >
  394. 选择
  395. </el-button>
  396. <el-button type="text" icon="el-icon-delete" size="small" @click.stop="removeStagList(scope.row, scope.index)" v-else
  397. >移除
  398. </el-button>
  399. </template>
  400. </avue-crud>
  401. </basic-container>
  402. </el-col>
  403. </el-row>
  404. <span slot="footer" class="dialog-footer">
  405. <el-button @click="dialogVisible = false" :loading="saveLoading">取 消</el-button>
  406. <el-button type="primary" @click="importGoods" v-if="commodityData !== true" :loading="saveLoading">导入</el-button>
  407. </span>
  408. </el-dialog>
  409. <el-dialog title="驳回数据" append-to-body :visible.sync="approveVisible" width="30%" :close-on-click-modal="false" v-dialog-drag>
  410. <span>
  411. <el-input type="textarea" :rows="5" placeholder="请输入驳回原因" v-model="auditMsg"> </el-input>
  412. </span>
  413. <span slot="footer" class="dialog-footer">
  414. <el-button @click="approveVisible = false" size="mini">取消</el-button>
  415. <el-button
  416. type="danger"
  417. @click="
  418. approveVisible = false;
  419. auditPlan(3);
  420. "
  421. size="mini"
  422. >确定</el-button
  423. >
  424. </span>
  425. </el-dialog>
  426. </div>
  427. </template>
  428. <script>
  429. import { getDetails as getCustom } from "@/api/tirePartsMall/basicData/customerInformation";
  430. import { dateFormat } from "@/util/date";
  431. import { getToken } from "@/util/auth";
  432. import { dotList, goodsDetail } from "@/api/tirePartsMall/purchasingManagement/warehouseEntryOrder";
  433. import reportDialog from "@/components/report-dialog/main";
  434. import checkSchedule from "@/components/checkL/checkSchedule";
  435. import check from "@/components/checkL/check";
  436. import { getCorpType, getList } from "@/api/tirePartsMall/basicData/commodityInformation";
  437. import { isProcurement } from "@/api/basicData/configuration";
  438. import commodity from "../../configuration/commodity.json";
  439. import { getDetails, submit, itemRemove, auditPlan, revokePlanIn, feeSubmit } from "@/api/storehouse/plan.js";
  440. import dicSelect from "@/components/dicSelect/main";
  441. import _ from "lodash";
  442. export default {
  443. name: "detailsPage",
  444. data() {
  445. return {
  446. auditMsg: null,
  447. approveVisible: false,
  448. excelBox: false,
  449. numberDecimal: 0,
  450. SelectSearch: {},
  451. // 编辑还是保存
  452. mingxibaocun: true,
  453. // 批次号请求到的数据
  454. picihaolist: [],
  455. // 添加商品弹窗
  456. dialogVisible: false,
  457. // 弹窗高度
  458. rowHeight: "",
  459. // 左侧选择搜索
  460. treeDataGoods: [],
  461. treeDeptId: "",
  462. page: {
  463. pageSize: 10,
  464. currentPage: 1,
  465. total: 0,
  466. pageSizes: [10, 50, 100, 300, 500]
  467. },
  468. pageList: {
  469. pageSize: 10,
  470. currentPage: 1,
  471. total: 0
  472. },
  473. // 左侧选择
  474. treeOption: {
  475. addBtn: false,
  476. menu: false,
  477. size: "small",
  478. props: {
  479. labelText: "标题",
  480. label: "title",
  481. value: "value"
  482. }
  483. },
  484. // 表格需要的配置
  485. optionTwo: commodity,
  486. loading: false,
  487. // 商品列表数据合计
  488. goodsListShow: [],
  489. // 商品列表暂存
  490. goodsListSave: [],
  491. saveLoading: false,
  492. commodityData: false,
  493. surplusRouteQuantityOption: [],
  494. tableData: [],
  495. // tabs切换
  496. activeNameTabs: "searchList",
  497. data: [],
  498. inventory: 0,
  499. isStatus: 1,
  500. // 商品名称
  501. goodsIdoptions: [],
  502. dataList: [],
  503. dicUrlWithCustomId: "",
  504. sharedCompanyId: 0,
  505. isAddBtn: false,
  506. viewDisabled: false, // 请核和大审批按钮是否禁用
  507. isApplySettlement: false, // 请核数据按钮是否禁用
  508. isRevocationRequest: true, // 撤销审核
  509. isExamineBtn: true, // 审批
  510. isAdd: false,
  511. editButton: false, // 编辑按钮和保存按钮的显示隐藏
  512. isSaveBtn: false, // 保存的禁用
  513. isDisabledTask: false, // 生成,撤销任务按钮是否禁用
  514. buttonText: "生成任务",
  515. buttonColor: "success", // 初始颜色为success
  516. isContacts: false, // 基础信息插槽禁用
  517. goods: [],
  518. isDisabled: false,
  519. //地址
  520. recAddressOption: [],
  521. contactsOption: [],
  522. checkData: {},
  523. checkScheduleDialog: false,
  524. isConfirmRefundBtn: true,
  525. checkDialog: false,
  526. checkId: "",
  527. batchNo: "",
  528. switchDialog: false,
  529. activeName: "sale_detail",
  530. disabled: false,
  531. key: 0,
  532. templateUrl: "/api/blade-sales-part/tire/center/warehouse/stockDesc/exportStockTemplate", // 模板url
  533. form: {
  534. planItemsList: [],
  535. centerShipCostList: [],
  536. bsType: "RP",
  537. status: 0
  538. },
  539. excelOption: {
  540. submitBtn: false,
  541. emptyBtn: false,
  542. column: [
  543. {
  544. label: "模板下载",
  545. prop: "excelTemplate",
  546. formslot: true,
  547. span: 24
  548. },
  549. {
  550. label: "导入明细",
  551. prop: "excelFile",
  552. type: "upload",
  553. drag: true,
  554. loadText: "上传中,请稍等",
  555. accept: ".xls,.xlsx",
  556. span: 24,
  557. propsHttp: {
  558. res: "data"
  559. },
  560. tip: "请上传 .xls,.xlsx 标准格式文件",
  561. action: "/api/blade-sales-part/ship/import-item"
  562. }
  563. ]
  564. },
  565. optionForm: {
  566. menuBtn: false,
  567. span: 8,
  568. disabled: false,
  569. labelWidth: 100,
  570. column: [
  571. {
  572. label: "货主",
  573. prop: "customerName",
  574. disabled: false,
  575. rules: [
  576. {
  577. required: true,
  578. message: " ",
  579. trigger: "blur"
  580. }
  581. ]
  582. },
  583. {
  584. label: "联系人",
  585. type: "select",
  586. prop: "contacts",
  587. disabled: false,
  588. allowCreate: true,
  589. filterable: true,
  590. props: {
  591. label: "address",
  592. value: "id"
  593. },
  594. dicUrl: "/api/blade-sales-part/corpsAddr/corpIdByAddr?pid={{key}}"
  595. },
  596. {
  597. label: "电话",
  598. prop: "phone",
  599. disabled: false,
  600. type: "number",
  601. controls: false,
  602. precision: 0,
  603. max: 99999999999
  604. },
  605. {
  606. label: "制单人",
  607. prop: "createUserName",
  608. disabled: true
  609. },
  610. {
  611. label: "仓库",
  612. prop: "storageName",
  613. rules: [
  614. {
  615. required: true,
  616. message: " ",
  617. trigger: "blur"
  618. }
  619. ]
  620. },
  621. {
  622. label: "入库日期",
  623. prop: "businesDate",
  624. searchProp: "businesDateList",
  625. disabled: false,
  626. type: "date",
  627. value: dateFormat(new Date(), "yyyy-MM-dd"),
  628. format: "yyyy-MM-dd",
  629. valueFormat: "yyyy-MM-dd",
  630. rules: [
  631. {
  632. required: true,
  633. message: "",
  634. trigger: "blur"
  635. }
  636. ]
  637. },
  638. {
  639. label: "单据编号",
  640. prop: "ordNo",
  641. disabled: true
  642. },
  643. {
  644. label: "计划总数量",
  645. prop: "goodsTotalNum",
  646. disabled: true
  647. },
  648. {
  649. label: "司机姓名",
  650. prop: "driverName"
  651. },
  652. {
  653. label: "司机电话",
  654. prop: "driverPhone"
  655. },
  656. {
  657. label: "车牌号",
  658. prop: "licensePlate"
  659. },
  660. {
  661. label: "库管",
  662. prop: "warehouseKeeperName"
  663. },
  664. {
  665. label: "车辆照片",
  666. prop: "vehiclePhoto",
  667. listType: "picture-card",
  668. type: "upload",
  669. limit: 4,
  670. span: 24,
  671. propsHttp: {
  672. url: "link",
  673. name: "originalName",
  674. res: "data"
  675. },
  676. action: "/api/blade-resource/oss/endpoint/put-file"
  677. },
  678. {
  679. label: "备注",
  680. prop: "remarks",
  681. type: "textarea",
  682. disabled: false,
  683. span: 24,
  684. minRows: 1
  685. }
  686. ]
  687. },
  688. formContacts: {},
  689. optionContacts: {},
  690. optionContactsBack: {
  691. disabled: false,
  692. border: true,
  693. align: "center",
  694. index: true,
  695. addBtnText: "添加商品",
  696. updateBtnText: "保存",
  697. refreshBtn: false,
  698. dialogDrag: true,
  699. addBtn: false,
  700. span: 8,
  701. height: 500,
  702. // 添加
  703. addRowBtn: false,
  704. // 保存按钮
  705. editBtn: false,
  706. // 航编辑开启
  707. // cellBtn: true,
  708. rowKey: "ids",
  709. delBtn: false,
  710. menuWidth: 140,
  711. dialogTop: 25,
  712. dialogWidth: "80%",
  713. summaryText: this.$t("land118n.total"),
  714. showSummary: true,
  715. selection: true,
  716. sumColumnList: [
  717. {
  718. name: "goodsNum",
  719. type: "sum"
  720. },
  721. {
  722. name: "price",
  723. type: "sum",
  724. decimals: 2
  725. },
  726. {
  727. name: "sendNum",
  728. type: "sum",
  729. decimals: 2
  730. },
  731. {
  732. name: "subTotalMoney",
  733. type: "sum",
  734. decimals: 2
  735. },
  736. {
  737. name: "returnsNumber",
  738. type: "sum"
  739. },
  740. {
  741. name: "returnsAmount",
  742. type: "sum"
  743. }
  744. ],
  745. column: [
  746. {
  747. label: "商品名称",
  748. prop: "goodsName",
  749. width: 200,
  750. disabled: false,
  751. remote: true,
  752. overHidden: true
  753. },
  754. {
  755. label: "库区",
  756. prop: "regionName",
  757. cell: true,
  758. slot: true,
  759. formslot: true,
  760. overHidden: true,
  761. rules: [
  762. {
  763. required: true,
  764. message: " ",
  765. trigger: "blur"
  766. }
  767. ]
  768. },
  769. {
  770. label: "数量",
  771. prop: "goodsNum",
  772. cell: true,
  773. slot: true,
  774. formslot: true,
  775. overHidden: true,
  776. rules: [
  777. {
  778. required: true,
  779. message: " ",
  780. trigger: "blur"
  781. }
  782. ]
  783. },
  784. {
  785. label: "价格",
  786. prop: "price",
  787. overHidden: true,
  788. width: 100
  789. },
  790. {
  791. label: "批次号",
  792. prop: "dot",
  793. width: 100,
  794. overHidden: true
  795. },
  796. {
  797. label: "小计",
  798. prop: "subTotalMoney",
  799. overHidden: true,
  800. width: 100,
  801. disabled: true,
  802. editDisplay: false,
  803. addDisplay: false
  804. },
  805. {
  806. label: "商品编码",
  807. prop: "goodsNo",
  808. overHidden: true,
  809. disabled: false,
  810. width: 100
  811. },
  812. {
  813. label: "品牌",
  814. prop: "brandName",
  815. disabled: false,
  816. width: 100,
  817. overHidden: true
  818. },
  819. {
  820. label: "规格型号",
  821. prop: "propertyName",
  822. overHidden: true,
  823. disabled: false,
  824. width: 100
  825. },
  826. {
  827. label: "花纹",
  828. prop: "pattern",
  829. overHidden: true,
  830. disabled: false,
  831. width: 100
  832. },
  833. {
  834. label: "商品描述",
  835. prop: "goodsDescription",
  836. disabled: false,
  837. overHidden: true,
  838. width: 100
  839. },
  840. {
  841. label: "单位",
  842. prop: "units",
  843. overHidden: true
  844. // type: "select",
  845. // disabled: false,
  846. // props: {
  847. // label: "dictValue",
  848. // value: "dictValue"
  849. // },
  850. // dicUrl: "/api/blade-system/dict-biz/dictionary?code=unit",
  851. // overHidden: true,
  852. // width: 100
  853. },
  854. {
  855. label: "备注",
  856. prop: "remarks",
  857. overHidden: true,
  858. width: 100,
  859. disabled: false
  860. }
  861. ]
  862. },
  863. selectionMultilist: [], // 多选数据
  864. optionPaymentDetails: {},
  865. optionPaymentDetailsBack: {
  866. align: "center",
  867. index: true,
  868. addBtnText: "录入明细",
  869. menu: false,
  870. refreshBtn: false,
  871. dialogDrag: true,
  872. addBtn: false,
  873. span: 8,
  874. height: 600,
  875. addRowBtn: false,
  876. editBtn: false,
  877. delBtn: false,
  878. menuWidth: 140,
  879. dialogTop: 25,
  880. dialogWidth: "80%",
  881. column: [
  882. {
  883. label: "支付编号",
  884. prop: "serialNumber"
  885. },
  886. {
  887. label: "金额",
  888. prop: "amount"
  889. },
  890. {
  891. label: "类型",
  892. prop: "type"
  893. },
  894. {
  895. label: "支付时间",
  896. prop: "createTime"
  897. }
  898. ]
  899. },
  900. optionOutboundRecords: {},
  901. optionOutboundRecordsBack: {
  902. height: "auto",
  903. calcHeight: 30,
  904. menuWidth: 120,
  905. align: "center",
  906. border: true,
  907. menu: true,
  908. refreshBtn: false,
  909. addBtn: false,
  910. span: 8,
  911. addRowBtn: false,
  912. editBtn: false,
  913. delBtn: false,
  914. column: [
  915. {
  916. label: "index",
  917. prop: "index",
  918. width: "55",
  919. headerslot: true
  920. },
  921. {
  922. label: "费用名称",
  923. prop: "costName",
  924. headerslot: true,
  925. cell: true,
  926. slot: true,
  927. formslot: true,
  928. rules: [
  929. {
  930. required: true,
  931. message: " ",
  932. trigger: "blur"
  933. }
  934. ]
  935. },
  936. {
  937. label: "单价",
  938. prop: "costPrice",
  939. headerslot: true,
  940. cell: true,
  941. slot: true,
  942. formslot: true,
  943. rules: [
  944. {
  945. required: true,
  946. message: " ",
  947. trigger: "blur"
  948. }
  949. ]
  950. },
  951. {
  952. label: "数量",
  953. prop: "goodsNum",
  954. headerslot: true,
  955. cell: true,
  956. slot: true,
  957. formslot: true,
  958. rules: [
  959. {
  960. required: true,
  961. message: " ",
  962. trigger: "blur"
  963. }
  964. ]
  965. },
  966. {
  967. label: "金额",
  968. prop: "costAmount",
  969. headerslot: true
  970. },
  971. {
  972. label: "备注",
  973. prop: "remark",
  974. cell: true,
  975. headerslot: true
  976. }
  977. ]
  978. }
  979. };
  980. },
  981. components: { reportDialog, check, checkSchedule, dicSelect },
  982. props: {
  983. onLoad: Object,
  984. detailData: Object
  985. },
  986. async created() {
  987. this.optionContacts = await this.getColumnData(this.getColumnName(477), this.optionContactsBack);
  988. this.optionOutboundRecords = await this.getColumnData(this.getColumnName(478), this.optionOutboundRecordsBack);
  989. this.key++;
  990. if (this.onLoad.id && this.detailData.id) {
  991. this.$set(this.optionForm, "disabled", true);
  992. this.$set(this.optionContactsBack, "disabled", true);
  993. this.editButton = true;
  994. this.getDetail(this.onLoad.id, true);
  995. } else if (this.onLoad.id) {
  996. this.getDetail(this.onLoad.id, true);
  997. }
  998. isProcurement({ param: "number.decimal" }).then(res => {
  999. this.numberDecimal = res.data.data ? Number(res.data.data) : 0;
  1000. });
  1001. },
  1002. mounted() {
  1003. this.$nextTick(() => {
  1004. // 监听浏览器高度变化,改变表格高度
  1005. window.onresize = () => {
  1006. this.rowHeight = window.innerHeight - 130 + "px";
  1007. };
  1008. });
  1009. },
  1010. methods: {
  1011. uploadExceed(limit, files, fileList, column) {
  1012. this.$message.error("超出上传限制文件数量");
  1013. },
  1014. countChange(row) {
  1015. row.costAmount = _.multiply(Number(row.costPrice ? row.costPrice : 0), Number(row.goodsNum ? row.goodsNum : 0)).toFixed(2);
  1016. },
  1017. moneyChange(row) {
  1018. row.subTotalMoney = _.multiply(Number(row.price ? row.price : 0), Number(row.goodsNum ? row.goodsNum : 0)).toFixed(2);
  1019. },
  1020. revokePlan() {
  1021. this.$confirm("确定要撤销该入库单吗?", "提示", {
  1022. confirmButtonText: "确定",
  1023. cancelButtonText: "取消",
  1024. type: "warning"
  1025. }).then(() => {
  1026. revokePlanIn(this.form.id).then(res => {
  1027. this.$message({
  1028. type: "success",
  1029. message: "撤销成功!"
  1030. });
  1031. this.getDetail(res.data.data, true);
  1032. });
  1033. });
  1034. },
  1035. addRow() {
  1036. // if (!this.form.id) {
  1037. // return this.$message.error('请保存数据')
  1038. // }
  1039. this.form.centerShipCostList.push({
  1040. parentId: this.form.id,
  1041. billType: 1,
  1042. costType: 0,
  1043. goodsNum: this.form.goodsTotalNum,
  1044. $cellEdit: true
  1045. });
  1046. },
  1047. feeSubmit() {
  1048. if (!this.form.id) {
  1049. return this.$message.error("请保存数据");
  1050. }
  1051. if (this.form.centerShipCostList.length == 0) {
  1052. return this.$message.error("请录入费用明细");
  1053. }
  1054. for (let row of this.form.centerShipCostList.filter(item => item.isDeleted != 1)) {
  1055. if (!row.costName || !row.goodsNum || !row.costPrice) {
  1056. this.$refs.outbound_records.rowCell(row, row.$index);
  1057. return this.$message.error("请完善费用明细信息");
  1058. }
  1059. }
  1060. feeSubmit(this.form.centerShipCostList).then(res => {
  1061. this.getDetail(this.form.id);
  1062. });
  1063. },
  1064. inEdit() {
  1065. if (this.form.status != 1) {
  1066. this.editButton = false;
  1067. this.$set(this.optionForm, "disabled", false);
  1068. this.$set(this.optionContactsBack, "disabled", false);
  1069. }
  1070. },
  1071. rowDicChange(name, row, el) {
  1072. if (name == "costName") {
  1073. if (row) {
  1074. el.costId = row.id;
  1075. } else {
  1076. el.costId = null;
  1077. el.costName = null;
  1078. }
  1079. }
  1080. if (name == "regionName") {
  1081. if (row) {
  1082. el.regionId = row.id;
  1083. } else {
  1084. el.regionId = null;
  1085. el.regionName = null;
  1086. }
  1087. }
  1088. },
  1089. dicChange(name, row) {
  1090. if (name == "customerName") {
  1091. if (row) {
  1092. this.form.customerId = row.id;
  1093. getCustom({ id: row.id }).then(res => {
  1094. if (res.data.data) {
  1095. this.dicUrlWithCustomId = res.data.data.id ? res.data.data.id : "";
  1096. this.form.contacts = res.data.data.corpsAttnList[0].cname;
  1097. this.form.phone = res.data.data.corpsAttnList[0].tel;
  1098. this.contactsOption = res.data.data.corpsAddrList;
  1099. }
  1100. });
  1101. } else {
  1102. this.form.customerId = null;
  1103. this.form.customerName = null;
  1104. this.dicUrlWithCustomId = null;
  1105. this.form.contacts = null;
  1106. this.form.phone = null;
  1107. }
  1108. }
  1109. if (name == "warehouseKeeperName") {
  1110. if (row) {
  1111. this.form.warehouseKeeper = row.id;
  1112. // this.form.warehouseKeeperName=row.realName
  1113. } else {
  1114. this.form.warehouseKeeper = null;
  1115. this.form.warehouseKeeperName = null;
  1116. }
  1117. }
  1118. if (name == "storageName") {
  1119. if (row) {
  1120. this.form.storageId = row.id;
  1121. this.form.storageName = row.cname;
  1122. } else {
  1123. this.form.storageId = null;
  1124. this.form.storageName = null;
  1125. }
  1126. }
  1127. },
  1128. // 获取左侧筛选
  1129. getAllWorkDicts() {
  1130. getCorpType({ corpType: "SP", whetherIntegral: "0" }).then(res => {
  1131. this.treeDataGoods = res.data.data;
  1132. });
  1133. },
  1134. //导入页左商品类型查询
  1135. nodeClick(data) {
  1136. this.treeDeptId = data.id;
  1137. this.page.currentPage = 1;
  1138. this.onLoadfun(this.page, { ...this.SelectSearch, goodsTypeId: this.treeDeptId });
  1139. },
  1140. closeGoods() {
  1141. this.treeDataGoods = [];
  1142. this.treeDeptId = "";
  1143. this.activeNameTabs = "searchList";
  1144. },
  1145. //刷新触发
  1146. refreshChange() {
  1147. this.page.currentPage = 1;
  1148. this.onLoadfun(this.page);
  1149. },
  1150. // 这个方法是解决 this.onLoad is not a function 的问题
  1151. onaloadfun(page, params = { artsVision: this.form.belongToCorpId }) {
  1152. this.loading = true;
  1153. getList({
  1154. ...params,
  1155. current: page.currentPage,
  1156. size: page.pageSize,
  1157. whetherIntegral: "0"
  1158. }).then(res => {
  1159. console.log(res, 1213);
  1160. const data = res.data.data;
  1161. this.page.total = data.total;
  1162. this.pageList.total = data.total;
  1163. this.data = data.records;
  1164. this.goodsListShow = data.records;
  1165. this.loading = false;
  1166. });
  1167. },
  1168. //选中触发
  1169. selectionChange(list) {
  1170. this.tableData = list;
  1171. },
  1172. // 点击搜索触发
  1173. goodsSearch(params, done) {
  1174. this.page.currentPage = 1;
  1175. params = {
  1176. ...params,
  1177. artsVision: this.form.belongToCorpId
  1178. };
  1179. this.onLoadfun(this.page, params);
  1180. done();
  1181. },
  1182. // 标签页切换
  1183. tabHandle(data) {
  1184. if (data.name == "searchList") {
  1185. this.goodsListShow = this.data;
  1186. this.page.total = this.pageList.total;
  1187. } else if (data.name == "importStaging") {
  1188. this.goodsListShow = this.goodsListSave;
  1189. this.page.total = 0;
  1190. }
  1191. },
  1192. // 商品信息价格计算
  1193. amountChange(value, row) {
  1194. if (value > 0) {
  1195. this.$refs.crud.toggleRowSelection(row, true);
  1196. } else {
  1197. this.$refs.crud.toggleRowSelection(row, false);
  1198. }
  1199. },
  1200. importStagList(row, index, type) {
  1201. this.goodsListSave.push(row);
  1202. },
  1203. removeStagList(row, index, type) {
  1204. this.goodsListSave.splice(row.$index, 1);
  1205. },
  1206. //确认导入触发
  1207. async importGoods() {
  1208. this.surplusRouteQuantityOption.push({ storageQuantity: "0" });
  1209. if (this.goodsListSave.length > 0) {
  1210. this.goodsListSaveHandle();
  1211. } else {
  1212. if (this.tableData.length > 0) {
  1213. this.tableDataHandle();
  1214. }
  1215. }
  1216. },
  1217. // 导入按钮事件
  1218. tableDataHandle() {
  1219. // 循环获取库存数量
  1220. for (let item of this.tableData) {
  1221. this.form.planItemsList.push({
  1222. price: item.price ? item.price : 0,
  1223. goodsId: item.id,
  1224. goodsName: item.cname,
  1225. dot: item.dot,
  1226. brandName: item.brandName,
  1227. brandId: item.brandId,
  1228. goodsTypeId: item.goodsTypeId,
  1229. goodsNo: item.code,
  1230. // propertyName:item.typeno,
  1231. // 规格型号
  1232. propertyName: item.specificationAndModel,
  1233. // 花纹
  1234. pattern: item.brandItem,
  1235. // 商品描述
  1236. goodsDescription: item.goodsDescription,
  1237. goodsNum: item.goodsNum,
  1238. units: item.unit,
  1239. inventory: item.inventory,
  1240. // sendNum:res.data.data[0],
  1241. // 小计
  1242. subTotalMoney: item.goodsNum * item.price,
  1243. //
  1244. // inventory:item.balanceQuantity,
  1245. // 备注
  1246. remarks: item.remarks,
  1247. rebatePrice: item.rebatePrice,
  1248. // 批次号的状态
  1249. dotedittype: false,
  1250. // 价格数量
  1251. goodsNumtype: false,
  1252. // 价格
  1253. pricetype: false,
  1254. // 是否是编辑状态
  1255. $cellEdit: true
  1256. });
  1257. }
  1258. this.dialogVisible = false;
  1259. },
  1260. // 导入
  1261. goodsListSaveHandle() {
  1262. this.tableData = this.goodsListSave;
  1263. this.tableDataHandle();
  1264. },
  1265. //导入商品弹窗列表查询
  1266. onLoadfun(page, params = {}) {
  1267. console.log(params);
  1268. this.loading = true;
  1269. getList({
  1270. ...params,
  1271. current: page.currentPage,
  1272. size: page.pageSize,
  1273. customId: this.form.customerId,
  1274. stock: this.form.storageId,
  1275. enableOrNot: 1,
  1276. artsVision: this.form.belongToCorpId,
  1277. goodsTypeId: this.treeDeptId,
  1278. whetherIntegral: "0",
  1279. ...Object.assign(params, this.SelectSearch)
  1280. }).then(res => {
  1281. res.data.data.records.forEach(e => {
  1282. e.rebatePrice = 0;
  1283. });
  1284. const data = res.data.data;
  1285. this.page.total = data.total;
  1286. this.pageList.total = data.total;
  1287. this.data = data.records;
  1288. this.goodsListShow = data.records;
  1289. // 获取单价数据
  1290. for (let item of this.goodsListShow) {
  1291. item.goodsNum = item.goodsNum ? item.goodsNum : 0;
  1292. }
  1293. this.loading = false;
  1294. });
  1295. },
  1296. // 采购明细行编辑
  1297. rowEdit(row, index) {
  1298. if (row.$cellEdit) {
  1299. this.$set(row, "$cellEdit", false);
  1300. } else {
  1301. this.$set(row, "$cellEdit", true);
  1302. }
  1303. },
  1304. //联系人change
  1305. contactsChange(e) {
  1306. console.log(e);
  1307. console.log(this.contactsOption);
  1308. // 假设this.contactsOption是你的数组对象
  1309. let matchedContact = this.contactsOption.find(item => item.contacts == e);
  1310. // 判断是否找到匹配的对象
  1311. this.$set(this.form, "phone", matchedContact.tel);
  1312. },
  1313. uploadAfter(res, done, loading, column) {
  1314. if (Array.isArray(res)) {
  1315. if (res instanceof Array) {
  1316. this.form.planItemsList = this.form.planItemsList.concat(res);
  1317. for (let item of this.form.planItemsList) {
  1318. item.price = item.price ? item.price : 0;
  1319. }
  1320. res.forEach(item => {
  1321. dotList({
  1322. storageId: this.form.storageId,
  1323. goodsId: res.goodsId
  1324. }).then(e => {
  1325. this.findObject(this.optionContactsBack.column, "dot").dicData = e.data.data;
  1326. });
  1327. });
  1328. }
  1329. this.excelBox = false;
  1330. } else {
  1331. this.$message.error(res);
  1332. }
  1333. loading = false;
  1334. done(res);
  1335. },
  1336. derivation() {
  1337. window.open(`${this.templateUrl}?${this.website.tokenHeader}=${getToken()}&stockId=${this.form.storageId}`);
  1338. },
  1339. uploadBefore(file, done, loading) {
  1340. done();
  1341. loading = true;
  1342. },
  1343. // 销售明细 导入按钮
  1344. excelDialogfun(name) {
  1345. if (!this.form.customerId) {
  1346. this.$message.error("请选择货主");
  1347. return;
  1348. }
  1349. if (!this.form.storageId) {
  1350. this.$message.error("请选择仓库");
  1351. return;
  1352. }
  1353. if (name == "名称") {
  1354. this.findObject(this.excelOption.column, "excelFile").action = "/api/blade-sales-part/order/import-item-name";
  1355. this.templateUrl = "/api/blade-sales-part/order/export-item-name";
  1356. } else if (name == "code") {
  1357. this.findObject(this.excelOption.column, "excelFile").action = "/api/blade-sales-part/tire/center/warehouse/plan/import-item-code/" + this.form.storageId;
  1358. this.templateUrl = "/api/blade-sales-part/tire/center/warehouse/plan/exportPlanTemplate";
  1359. }
  1360. this.excelBox = true;
  1361. },
  1362. approve(type) {
  1363. this.approveVisible = true;
  1364. this.auditMsg = null;
  1365. },
  1366. auditPlan(type) {
  1367. if (type == 2) {
  1368. this.$confirm("是否提交审核?", "提示", {
  1369. confirmButtonText: "确定",
  1370. cancelButtonText: "取消",
  1371. type: "warning"
  1372. }).then(() => {
  1373. let obj = {
  1374. id: this.form.id,
  1375. status: type,
  1376. auditMsg: type == 3 ? this.auditMsg : null,
  1377. version: this.form.version
  1378. };
  1379. auditPlan(obj).then(res => {
  1380. this.getDetail(this.form.id);
  1381. });
  1382. });
  1383. }
  1384. if (type == 3) {
  1385. let obj = {
  1386. id: this.form.id,
  1387. status: type,
  1388. auditMsg: type == 3 ? this.auditMsg : null,
  1389. version: this.form.version
  1390. };
  1391. auditPlan(obj).then(res => {
  1392. this.getDetail(this.form.id);
  1393. });
  1394. }
  1395. },
  1396. isMobile(s) {
  1397. return /^1[0-9]{10}$/.test(s);
  1398. },
  1399. //修改提交触发
  1400. editCustomer(type) {
  1401. this.$refs["form"].validate((valid, done) => {
  1402. done();
  1403. if (valid) {
  1404. if (!this.isMobile(this.form.phone)) {
  1405. return this.$message.error("请正确输入电话");
  1406. }
  1407. for (let row of this.form.planItemsList.filter(item => item.isDeleted != 1)) {
  1408. if (!row.regionName || !row.goodsNum) {
  1409. this.$refs.formContacts.rowCell(row, row.$index);
  1410. return this.$message.error("请完善商品明细信息");
  1411. }
  1412. }
  1413. for (let row of this.form.centerShipCostList.filter(item => item.isDeleted != 1)) {
  1414. if (!row.costName || !row.goodsNum || !row.costPrice) {
  1415. this.$refs.outbound_records.rowCell(row, row.$index);
  1416. return this.$message.error("请完善费用明细信息");
  1417. }
  1418. }
  1419. let obj = {
  1420. ...this.form,
  1421. vehiclePhoto: JSON.stringify(this.form.vehiclePhoto),
  1422. status: type
  1423. };
  1424. const loading = this.$loading({
  1425. lock: true,
  1426. text: "加载中",
  1427. spinner: "el-icon-loading",
  1428. background: "rgba(255,255,255,0.7)"
  1429. });
  1430. submit(obj)
  1431. .then(res => {
  1432. this.$message.success(type === 1 ? "提交成功" : "保存成功");
  1433. this.getDetail(res.data.data);
  1434. })
  1435. .finally(() => {
  1436. loading.close();
  1437. });
  1438. } else {
  1439. return false;
  1440. }
  1441. });
  1442. },
  1443. //关闭弹窗表单
  1444. beforeClose(done, type) {
  1445. done();
  1446. },
  1447. getDetail(id, type) {
  1448. const loading = this.$loading({
  1449. lock: true,
  1450. text: "加载中",
  1451. spinner: "el-icon-loading",
  1452. background: "rgba(255,255,255,0.7)"
  1453. });
  1454. getDetails({ id: id })
  1455. .then(res => {
  1456. (res.data.data.vehiclePhoto = JSON.parse(res.data.data.vehiclePhoto)), (this.form = res.data.data);
  1457. this.$nextTick(() => {
  1458. this.$refs.formContacts.doLayout();
  1459. });
  1460. if (res.data.data.status == 1) {
  1461. this.$set(this.optionForm, "disabled", true);
  1462. this.$set(this.optionContactsBack, "disabled", true);
  1463. this.editButton = true;
  1464. }
  1465. })
  1466. .finally(() => {
  1467. loading.close();
  1468. });
  1469. },
  1470. rowDel(row, index, list) {
  1471. if (row.isDeleted == 1) {
  1472. row.isDeleted = 0;
  1473. } else {
  1474. this.$confirm("确定将选择数据删除?", {
  1475. confirmButtonText: "确定",
  1476. cancelButtonText: "取消",
  1477. type: "warning"
  1478. }).then(() => {
  1479. if (row.id) {
  1480. // itemRemove({ ids: row.id }).then(res => {
  1481. // this.form.planItemsList.splice(index, 1);
  1482. // this.$message.success("操作成功!");
  1483. // });
  1484. row.isDeleted = 1;
  1485. this.$set(row, "$cellEdit", false);
  1486. } else {
  1487. this.form[list].splice(index, 1);
  1488. }
  1489. });
  1490. }
  1491. },
  1492. // 明细信息多选
  1493. selectionContacts(list) {
  1494. this.selectionMultilist = list;
  1495. },
  1496. // 一键删除
  1497. batchDelete() {
  1498. if (this.selectionMultilist.length == 0) {
  1499. return this.$message.warning("请选择要删除的数据");
  1500. }
  1501. this.$confirm("确定将选择数据删除?", {
  1502. confirmButtonText: "确定",
  1503. cancelButtonText: "取消",
  1504. type: "warning"
  1505. }).then(() => {
  1506. let multiList = this.selectionMultilist;
  1507. let arr = this.form.planItemsList;
  1508. // 获取有id 的数据
  1509. const itemsWithId = multiList.filter(item => item.hasOwnProperty("id"));
  1510. let arrIds = itemsWithId.map(item => item.id); // 获取id 数据
  1511. // 把选中的删除掉
  1512. multiList.forEach(item => {
  1513. for (let index in arr) {
  1514. if (JSON.stringify(item) == JSON.stringify(arr[index])) {
  1515. arr.splice(Number(index), 1);
  1516. }
  1517. }
  1518. });
  1519. // 有id 的处理
  1520. if (itemsWithId.length != 0) {
  1521. itemRemove({ ids: arrIds.join(",") }).then(res => {
  1522. this.$message.success("操作成功!");
  1523. });
  1524. }
  1525. });
  1526. },
  1527. rowUpdate(form, index, done, loading) {
  1528. this.$set(form, "goodsName", form.$goodsId);
  1529. console.log(form);
  1530. done(form);
  1531. },
  1532. rowAdd(row) {
  1533. if (!this.form.customerId) {
  1534. this.$message.error("请选择货主");
  1535. return;
  1536. }
  1537. if (!this.form.storageId) {
  1538. this.$message.error("请选择仓库");
  1539. return;
  1540. }
  1541. this.getAllWorkDicts();
  1542. this.refreshChange();
  1543. this.goodsListSave = [];
  1544. this.dialogVisible = true;
  1545. },
  1546. //打印
  1547. handlePrint() {
  1548. this.switchDialog = !this.switchDialog;
  1549. },
  1550. onClose(val) {
  1551. this.switchDialog = val;
  1552. },
  1553. //自定义列保存
  1554. async saveColumnTwo(ref, option, optionBack, code) {
  1555. /**
  1556. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  1557. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  1558. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  1559. */
  1560. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  1561. if (inSave) {
  1562. this.$message.success("保存成功");
  1563. //关闭窗口
  1564. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  1565. }
  1566. },
  1567. //自定义列重置
  1568. async resetColumnTwo(ref, option, optionBack, code) {
  1569. this[option] = this[optionBack];
  1570. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  1571. if (inSave) {
  1572. this.$message.success("重置成功");
  1573. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  1574. }
  1575. },
  1576. backToList(type) {
  1577. this.$emit("backToList", type);
  1578. }
  1579. },
  1580. watch: {
  1581. "form.planItemsList": {
  1582. // 执行方法
  1583. handler(Value, newValue) {
  1584. this.form.goodsTotalNum = 0;
  1585. Value.forEach(item => {
  1586. this.form.goodsTotalNum += Number(item.goodsNum ? item.goodsNum : 0);
  1587. });
  1588. },
  1589. deep: false, // 深度监听
  1590. immediate: false // 第一次改变就执行
  1591. }
  1592. }
  1593. };
  1594. </script>
  1595. <style lang="scss" scoped>
  1596. ::v-deep .el-form-item {
  1597. margin-bottom: 8px !important;
  1598. }
  1599. ::v-deep .el-dialog__body {
  1600. padding: 10px 20px;
  1601. }
  1602. ::v-deep .el-table .cell {
  1603. padding: 0 2px !important;
  1604. .el-form-item {
  1605. margin-bottom: 0px !important;
  1606. }
  1607. }
  1608. ::v-deep .avue-crud .el-table .el-form-item__label {
  1609. left: -1px;
  1610. }
  1611. </style>