detailsPage.vue 60 KB

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