detailsPage.vue 65 KB

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