detailsPage.vue 58 KB

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