detailsPageEdit.vue 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602
  1. <template>
  2. <div class="borderless" v-loading="pageLoading">
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <!-- <i class="back-icon el-icon-arrow-left"></i><i style="font-style:normal">返回管理列表</i>-->
  6. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  7. @click="backToList">返回列表
  8. </el-button>
  9. </div>
  10. <div class="add-customer-btn">
  11. <el-button
  12. v-if="detailData.seeDisabled"
  13. size="small"
  14. @click="editHandle"
  15. type="primary"
  16. >编 辑</el-button>
  17. <el-button type="primary"
  18. size="small"
  19. :disabled="!form.id"
  20. @click="postMessage"
  21. >发送消息</el-button>
  22. <el-button
  23. class="el-button--small-yh"
  24. type="primary"
  25. @click="revokeInGoods"
  26. size="small"
  27. v-if="form.deliveryStatus !== '录入'"
  28. :disabled="detailData.seeDisabled"
  29. >撤销收货</el-button>
  30. <el-button
  31. class="el-button--small-yh"
  32. type="primary"
  33. @click="sendInGoods"
  34. size="small"
  35. v-if="form.deliveryStatus == '录入'"
  36. :disabled="detailData.seeDisabled || !this.form.id"
  37. >确认收货</el-button>
  38. <el-button
  39. class="el-button--small-yh"
  40. size="small"
  41. type="success" @click="copyOrder"
  42. :disabled="detailData.seeDisabled || !this.form.id">
  43. 复制单据
  44. </el-button>
  45. <el-button
  46. class="el-button--small-yh"
  47. type="primary"
  48. :disabled="disabled || detailData.seeDisabled"
  49. @click="editCustomer(false)"
  50. size="small"
  51. :loading="saveLoading"
  52. >保 存
  53. </el-button>
  54. </div>
  55. </div>
  56. <div class="customer-main">
  57. <el-form :model="form" ref="form" label-width="130px" class="demo-ruleForm">
  58. <containerTitle title="基础资料"></containerTitle>
  59. <basic-container style="margin-bottom: 10px">
  60. <el-row>
  61. <el-col v-for="(item,index) in basicData.column" :key="index" :span="item.span?item.span:8">
  62. <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
  63. <!-- <avue-input-tree v-if="item.prop === 'corpsTypeId'" leaf-only multiple :props="{label:'title'}" v-model="form[item.prop]" placeholder="请选择内容" type="tree" :dic="dic"-->
  64. <!-- ></avue-input-tree>-->
  65. <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]"
  66. size="small" type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss" :disabled="detailData.seeDisabled || receiveDisabled"/>
  67. <el-date-picker v-else-if="item.type === 'date'" style="width: 100%;" v-model="form[item.prop]"
  68. size="small" type="date" placeholder="选择日期"
  69. :disabled="detailData.seeDisabled || receiveDisabled"/>
  70. <crop-select
  71. v-else-if="item.prop === 'corpId'"
  72. v-model="form[item.prop]"
  73. corpType="GYS"
  74. :disabled="detailData.seeDisabled || receiveDisabled"
  75. @getCorpData="returnBack"
  76. ></crop-select>
  77. <crop-select
  78. v-else-if="item.prop === 'salesCompany'"
  79. v-model="form[item.prop]"
  80. corpType="GS"
  81. :disabled="detailData.seeDisabled || receiveDisabled"
  82. @getCorpData="getGSName"
  83. ></crop-select>
  84. <!-- <selectComponent v-else-if="item.prop === 'corpId'" v-model="form[item.prop]"-->
  85. <!-- :configuration="configuration" style="width: 100%" :disabled="detailData.seeDisabled"/>-->
  86. <!-- <selectComponent v-else-if="item.prop === 'salesCompany'" v-model="form[item.prop]"-->
  87. <!-- :configuration="companyConfiguration" style="width: 100%" :disabled="detailData.seeDisabled"/>-->
  88. <el-select v-else-if="item.prop === 'purchaseMode'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small" :disabled="detailData.seeDisabled || receiveDisabled">
  89. <el-option v-for="(item,index) in procurementMethodOption" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
  90. </el-select>
  91. <el-select v-else-if="item.prop === 'warehouseType'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small" :disabled="detailData.seeDisabled || receiveDisabled">
  92. <el-option v-for="(item,index) in warehouseTypeOption" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
  93. </el-select>
  94. <warehouse-select v-else-if="item.prop === 'storageId'" v-model="form[item.prop]"
  95. :configuration="configurationWarehouse" style="width: 100%" :disabled="detailData.seeDisabled || receiveDisabled"/>
  96. <el-input
  97. v-else-if="item.type == 'number'"
  98. placeholder="请输入"
  99. v-input-limit="2"
  100. size="small"
  101. :disabled="item.disabled || detailData.seeDisabled || receiveDisabled"
  102. v-model.trim="form[item.prop]"
  103. />
  104. <el-input type="textarea" v-else-if="item.type === 'textarea'" v-model.trim="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled || detailData.seeDisabled || receiveDisabled"></el-input>
  105. <el-input type="age" v-else v-model.trim="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled || detailData.seeDisabled || receiveDisabled"></el-input>
  106. </el-form-item>
  107. </el-col>
  108. </el-row>
  109. </basic-container>
  110. <containerTitle title="商品信息"></containerTitle>
  111. <basic-container style="margin-bottom: 10px">
  112. <avue-crud
  113. :option="customerContact"
  114. v-model="contactsForm"
  115. :data="contactsData"
  116. ref="crudContact"
  117. @row-save="rowSave"
  118. @row-click="handleRowClick"
  119. @row-update="rowUpdate"
  120. @row-del="rowDel"
  121. @saveColumn="saveColumn('goods')"
  122. @resetColumn="resetColumn"
  123. >
  124. <template slot="code" slot-scope="{row,index}">
  125. <el-button type="text" size="mini" style="padding:4px 10px;float:left" :disabled="detailData.seeDisabled || !row.$cellEdit" @click="commodityChoice(row)">选择</el-button>
  126. <span>{{ row.code }}</span>
  127. </template>
  128. <template slot-scope="{row,index}" slot="menu">
  129. <el-button
  130. type="text"
  131. size="small"
  132. @click="rowCell(row,index)"
  133. :disabled="detailData.seeDisabled || receiveDisabled"
  134. >{{ row.$cellEdit ? '保存' : '修改' }}
  135. </el-button>
  136. <el-button
  137. size="small"
  138. icon="el-icon-delete"
  139. type="text"
  140. @click="rowDel(row, index)"
  141. :disabled="detailData.seeDisabled || receiveDisabled"
  142. v-if="!row.$cellEdit"
  143. >删 除</el-button>
  144. </template>
  145. <template slot="actualQuantity" slot-scope="{ row }">
  146. <el-input
  147. v-if="row.$cellEdit"
  148. v-model.trim="row.actualQuantity"
  149. v-input-limit="0"
  150. @change="actualQuantityChange(row)"
  151. ></el-input>
  152. <span v-else>{{ row.actualQuantity | IntegerFormat }}</span>
  153. </template>
  154. <template slot="menuLeft" slot-scope="{size}">
  155. <el-button type="primary"
  156. icon="el-icon-plus"
  157. size="small"
  158. @click="commoditySelection"
  159. :disabled="detailData.seeDisabled || receiveDisabled"
  160. >录入明细
  161. </el-button>
  162. <el-button type="info" :size="size" icon="el-icon-printer">报 表</el-button>
  163. </template>
  164. </avue-crud>
  165. </basic-container>
  166. <fee-info
  167. ref="feeInfo"
  168. :orderFeesList="advantageProjectData"
  169. :disabled="detailData.seeDisabled || receiveDisabled"
  170. @beforeFinance="beforeFinance"
  171. :srcType="3"
  172. optionType="GN"
  173. itemType="收货"
  174. feeUrl="/blade-deliver-goods/deliveryfees/update"
  175. :corpId="form.corpId"
  176. />
  177. <!-- <containerTitle title="费用明细"></containerTitle>-->
  178. <!-- <basic-container style="margin-bottom: 10px">-->
  179. <!-- <avue-crud-->
  180. <!-- :option="advantageProject"-->
  181. <!-- v-model="advantageProjectForm"-->
  182. <!-- :data="advantageProjectData"-->
  183. <!-- ref="crudProject"-->
  184. <!-- @row-save="rowSaveProject"-->
  185. <!-- @row-update="rowUpdateProject"-->
  186. <!-- @row-del="rowDelProject"-->
  187. <!-- @saveColumn="saveColumn('fees')"-->
  188. <!-- >-->
  189. <!-- <template slot="code" slot-scope="{row,index}">-->
  190. <!-- <el-button type="text" size="mini" style="padding:4px 10px;float:left" @click="choice(row)" :disabled="detailData.seeDisabled || !row.$cellEdit">选择</el-button>-->
  191. <!-- <span>{{ row.code }}</span>-->
  192. <!-- </template>-->
  193. <!-- <template slot="corpId" slot-scope="{ row }">-->
  194. <!-- <selectComponent v-if="row.$cellEdit" v-model="row.corpId"-->
  195. <!-- :configuration="configuration" @receiveList="receiveList"/>-->
  196. <!-- <span v-else>-->
  197. <!-- <span v-for="(item, index) in configuration.dicData" :key="index" v-if="item.id == row.corpId">{{ item.cname }}</span>-->
  198. <!-- </span>-->
  199. <!-- </template>-->
  200. <!-- <template slot="amount" slot-scope="{ row }">-->
  201. <!-- <el-input v-if="row.$cellEdit" v-model.trim="row.amount"-->
  202. <!-- size="small" v-input-limit="2"-->
  203. <!-- ></el-input>-->
  204. <!-- <span v-else>{{ row.amount }}</span>-->
  205. <!-- </template>-->
  206. <!-- <template slot="settlmentAmount" slot-scope="{ row }">-->
  207. <!-- <el-input v-if="row.$cellEdit" v-model.trim="row.settlmentAmount"-->
  208. <!-- size="small" v-input-limit="2"-->
  209. <!-- ></el-input>-->
  210. <!-- <span v-else>{{ row.settlmentAmount }}</span>-->
  211. <!-- </template>-->
  212. <!-- <template slot-scope="{row,index}" slot="menu">-->
  213. <!-- <el-button-->
  214. <!-- type="text"-->
  215. <!-- size="small"-->
  216. <!-- @click="rowCellTwo(row,index)"-->
  217. <!-- :disabled="detailData.seeDisabled"-->
  218. <!-- >{{ row.$cellEdit ? '保存' : '修改' }}-->
  219. <!-- </el-button>-->
  220. <!-- <el-button-->
  221. <!-- size="small"-->
  222. <!-- icon="el-icon-delete"-->
  223. <!-- type="text"-->
  224. <!-- @click="rowDelProject(row, index)"-->
  225. <!-- :disabled="detailData.seeDisabled"-->
  226. <!-- v-if="!row.$cellEdit"-->
  227. <!-- >删 除</el-button>-->
  228. <!-- </template>-->
  229. <!-- <template slot="menuLeft" slot-scope="{size}">-->
  230. <!-- <el-button type="primary"-->
  231. <!-- icon="el-icon-plus"-->
  232. <!-- size="small"-->
  233. <!-- @click="costIncrease"-->
  234. <!-- :disabled="detailData.seeDisabled"-->
  235. <!-- >录入明细-->
  236. <!-- </el-button>-->
  237. <!-- </template>-->
  238. <!-- </avue-crud>-->
  239. <!-- </basic-container>-->
  240. <containerTitle title="附件上传"></containerTitle>
  241. <basic-container style="margin-bottom: 40px">
  242. <avue-crud
  243. :option="bankOfDeposit"
  244. v-model="bankOfDepositForm"
  245. :data="bankOfDepositData"
  246. @row-save="rowSaveBankOfDeposit"
  247. @row-update="rowUpdateBankOfDeposit"
  248. @row-del="rowDelBankOfDeposit"
  249. :upload-after="uploadAfter"
  250. ref="uploadCrud"
  251. >
  252. <template slot="menuLeft">
  253. <el-button
  254. type="primary"
  255. icon="el-icon-plus"
  256. size="small"
  257. @click.stop="$refs.uploadCrud.rowAdd()"
  258. :disabled="detailData.seeDisabled || receiveDisabled"
  259. >上传</el-button
  260. >
  261. </template>
  262. <template slot="menu" slot-scope="{ row, index }">
  263. <el-button
  264. size="small"
  265. icon="el-icon-edit"
  266. type="text"
  267. @click="$refs.uploadCrud.rowEdit(row, index)"
  268. :disabled="detailData.seeDisabled || receiveDisabled"
  269. >编 辑</el-button
  270. >
  271. <el-button
  272. size="small"
  273. icon="el-icon-delete"
  274. type="text"
  275. @click="rowDelBankOfDeposit(row, index)"
  276. :disabled="detailData.seeDisabled || receiveDisabled"
  277. >删 除</el-button
  278. >
  279. </template>
  280. </avue-crud>
  281. </basic-container>
  282. </el-form>
  283. </div>
  284. <el-dialog
  285. title="导入商品"
  286. append-to-body
  287. class="el-dialogDeep"
  288. :visible.sync="dialogVisible"
  289. width="80%"
  290. :close-on-click-modal="false"
  291. :destroy-on-close="true"
  292. :close-on-press-escape="false"
  293. @close="closeGoods">
  294. <el-row :style="{height: rowHeight}">
  295. <el-col :span="5" style="height: 100%;overflow-y: auto">
  296. <div>
  297. <el-scrollbar>
  298. <basic-container>
  299. <avue-tree :option="treeOption" :data="treeDataGoods" @node-click="nodeClick"/>
  300. </basic-container>
  301. </el-scrollbar>
  302. </div>
  303. </el-col>
  304. <el-col :span="19">
  305. <basic-container>
  306. <avue-crud :option="optionTwo"
  307. :table-loading="loading"
  308. :data="data"
  309. ref="crud"
  310. @refresh-change="refreshChange"
  311. @selection-change="selectionChange"
  312. :page.sync="page"
  313. @search-change="goodsSearch"
  314. @on-load="onLoad"></avue-crud>
  315. </basic-container>
  316. </el-col>
  317. </el-row>
  318. <span slot="footer" class="dialog-footer">
  319. <el-button @click="dialogVisible = false">取 消</el-button>
  320. <el-button type="primary" @click="importGoods" v-if="commodityData !== true">导入</el-button>
  321. <el-button type="primary" @click="importChoice" v-if="commodityData === true"
  322. :disabled="tableData.length !== 1">导入</el-button>
  323. </span>
  324. </el-dialog>
  325. <el-dialog
  326. title="导入费用"
  327. append-to-body
  328. class="el-dialogDeep"
  329. :visible.sync="dialogCost"
  330. width="80%"
  331. :close-on-click-modal="false"
  332. :destroy-on-close="true"
  333. :close-on-press-escape="false"
  334. @close="closeFees">
  335. <el-row :style="{height: rowHeight}">
  336. <el-col :span="5" style="height: 100%;overflow-y: auto">
  337. <div>
  338. <el-scrollbar>
  339. <basic-container>
  340. <avue-tree :option="treeOptionCost" :data="treeData" @node-click="nodeClickCost"/>
  341. </basic-container>
  342. </el-scrollbar>
  343. </div>
  344. </el-col>
  345. <el-col :span="19">
  346. <basic-container>
  347. <avue-crud :option="optionTwoCost"
  348. :table-loading="loadingCost"
  349. :data="dataCost"
  350. ref="crud"
  351. @refresh-change="refreshChangeCost"
  352. @selection-change="selectionChangeCost"
  353. :page.sync="pageCost"
  354. @searchChange="feesSearch"
  355. @on-load="onLoadCost">
  356. </avue-crud>
  357. </basic-container>
  358. </el-col>
  359. </el-row>
  360. <span slot="footer" class="dialog-footer">
  361. <el-button @click="dialogCost = false">取 消</el-button>
  362. <el-button type="primary" @click="importCost" v-if="choiceData !== true">导入</el-button>
  363. <el-button type="primary" @click="choiceCost" v-if="choiceData === true"
  364. :disabled="tableDataCost.length !== 1">导入</el-button>
  365. </span>
  366. </el-dialog>
  367. <messagePost
  368. v-if="messageVisble"
  369. ref="messagePost"
  370. @closeDialog="closeDialog"
  371. ></messagePost>
  372. </div>
  373. </template>
  374. <script>
  375. import {
  376. typeSave, detail, deleteDetails,
  377. corpstypeTree,
  378. corpsattn,
  379. corpsbank,
  380. corpsfiles,
  381. corpsitem,
  382. // getList,
  383. sendInGoods,
  384. revokeInGoods
  385. } from "@/api/basicData/receipt"
  386. import {getList} from "@/api/basicData/commodityType";
  387. import customerContact from "./configuration/customerContact.json"
  388. import advantageProject from "./configuration/advantageProject.json"
  389. import bankOfDeposit from "./configuration/bankOfDeposit.json"
  390. import commodity from "./configuration/commodity.json"
  391. import optionTwoCost from "./configuration/mainListCost.json"
  392. import {getDeptLazyTree, customerList,getDeptLazyTreeTwo} from "@/api/basicData/basicFeesDesc";
  393. import {customerList as wareHouseType} from "@/api/basicData/basicStorageType"
  394. import {customerList as selectWareHouse} from "@/api/basicData/basicStorageDesc"
  395. import {selectGoodsNum} from "@/api/basicData/inventoryAccount"
  396. import { contrastObj, contrastList } from "@/util/contrastData";
  397. import feeInfo from "@/components/fee-info/main";
  398. import {
  399. isDiscount,
  400. isPercentage,
  401. micrometerFormat,
  402. IntegerFormat
  403. } from "@/util/validate";
  404. export default {
  405. name: "detailsPage",
  406. props: {
  407. detailData: {
  408. type: Object
  409. }
  410. },
  411. components: {
  412. feeInfo,
  413. },
  414. data() {
  415. return {
  416. saveLoading: false,
  417. configuration: {
  418. multipleChoices: false,
  419. multiple: false,
  420. collapseTags: false,
  421. placeholder: '请点击右边按钮选择',
  422. dicData: []
  423. },
  424. companyConfiguration: {
  425. multipleChoices: false,
  426. multiple: false,
  427. collapseTags: false,
  428. placeholder: '请点击右边按钮选择',
  429. dicData: []
  430. },
  431. configurationWarehouse: {
  432. multipleChoices: false,
  433. multiple: false,
  434. collapseTags: false,
  435. placeholder: "请点击右边按钮选择",
  436. dicData: [],
  437. },
  438. form: {},
  439. data: [],
  440. loadingCost: false,
  441. choiceData: false,
  442. commodityData: false,
  443. dataCost: [],
  444. choiceIndex: '',
  445. dialogCost: false,
  446. treeDeptId: '',
  447. treeDeptIdCost: '',
  448. pageCost: {
  449. pageSize: 10,
  450. currentPage: 1,
  451. total: 0
  452. },
  453. page: {
  454. pageSize: 10,
  455. currentPage: 1,
  456. total: 0
  457. },
  458. loading: false,
  459. contactsForm: {},
  460. optionTwo: commodity,
  461. optionTwoCost: optionTwoCost,
  462. treeData: [],
  463. treeDataGoods: [],
  464. treeOptionCost: {
  465. nodeKey: 'id',
  466. lazy: true,
  467. treeLoad: function (node, resolve) {
  468. const parentId = (node.level === 0) ? 0 : node.data.id;
  469. getDeptLazyTree(parentId).then(res => {
  470. resolve(res.data.data.map(item => {
  471. return {
  472. ...item,
  473. leaf: !item.hasChildren
  474. }
  475. }))
  476. });
  477. },
  478. addBtn: false,
  479. menu: false,
  480. size: 'small',
  481. props: {
  482. labelText: '标题',
  483. label: 'title',
  484. value: 'value',
  485. children: 'children'
  486. }
  487. },
  488. treeOption: {
  489. nodeKey: 'id',
  490. lazy: true,
  491. treeLoad: function (node, resolve) {
  492. const parentId = (node.level === 0) ? 0 : node.data.id;
  493. getDeptLazyTreeTwo(parentId).then(res => {
  494. resolve(res.data.data.map(item => {
  495. return {
  496. ...item,
  497. leaf: !item.hasChildren
  498. }
  499. }))
  500. });
  501. },
  502. addBtn: false,
  503. menu: false,
  504. size: 'small',
  505. props: {
  506. labelText: '标题',
  507. label: 'title',
  508. value: 'value',
  509. children: 'children'
  510. }
  511. },
  512. dialogVisible: false,
  513. advantageProjectForm: {},
  514. bankOfDepositForm: {},
  515. contactsData: [],
  516. advantageProjectData: [],
  517. disabled: false,
  518. bankOfDepositData: [],
  519. tableDataCost: [],
  520. dic: [],
  521. tableData: [],
  522. customerContact: {},
  523. advantageProject: {},
  524. bankOfDeposit: bankOfDeposit,
  525. basicData: {
  526. column: [
  527. {
  528. label: '系统编号',//发货通知(点击)
  529. prop: 'sysNo',
  530. disabled: true,
  531. rules: [
  532. {
  533. required: false,
  534. message: ' ',
  535. trigger: 'blur'
  536. }
  537. ]
  538. }, {
  539. label: '供应商',
  540. prop: 'corpId',
  541. span: 16,
  542. rules: [
  543. {
  544. required: true,
  545. message: ' ',
  546. trigger: 'blur'
  547. }
  548. ]
  549. },{
  550. label: '采购方式',
  551. prop: 'purchaseMode',
  552. rules: [
  553. {
  554. required: true,
  555. message: ' ',
  556. trigger: 'blur'
  557. }
  558. ]
  559. }, {
  560. label: '所属公司',
  561. prop: 'salesCompany',
  562. span: 16,
  563. rules: [
  564. {
  565. required: true,
  566. message: ' ',
  567. trigger: 'blur'
  568. }
  569. ]
  570. },{
  571. label: '仓库类型',
  572. prop: 'warehouseType',//字典表
  573. rules: [
  574. {
  575. required: true,
  576. message: ' ',
  577. trigger: 'blur'
  578. }
  579. ]
  580. }, {
  581. label: '仓库名称',
  582. prop: 'storageId',
  583. span: 16,
  584. rules: [
  585. {
  586. required: true,
  587. message: ' ',
  588. trigger: 'blur'
  589. }
  590. ]
  591. }, {
  592. label: '匹配订单号',
  593. prop: 'srcOrderNo',
  594. rules: [
  595. {
  596. required: false,
  597. message: ' ',
  598. trigger: 'blur'
  599. }
  600. ]
  601. },{
  602. label: '入库金额',
  603. prop: 'deliveryAmount',
  604. disabled: true,
  605. rules: [
  606. {
  607. required: false,
  608. message: ' ',
  609. trigger: 'blur'
  610. }
  611. ]
  612. }, {
  613. label: '采购金额',
  614. prop: 'purchaseAmount',
  615. disabled: true,
  616. rules: [
  617. {
  618. required: false,
  619. message: ' ',
  620. trigger: 'blur'
  621. }
  622. ]
  623. },{
  624. label: '入库数量',
  625. prop: 'totalQuantity',
  626. disabled: true,
  627. rules: [
  628. {
  629. required: false,
  630. message: ' ',
  631. trigger: 'blur'
  632. }
  633. ]
  634. }, {
  635. label: '费用合计',
  636. type: 'number',
  637. prop: 'totalCost',
  638. rules: [
  639. {
  640. required: false,
  641. message: ' ',
  642. trigger: 'blur'
  643. }
  644. ]
  645. }, {
  646. label: '入库日期',
  647. prop: 'businessDate',
  648. type: 'datetime',
  649. rules: [
  650. {
  651. required: true,
  652. message: ' ',
  653. trigger: 'blur'
  654. }
  655. ]
  656. }, {
  657. label: '发货地址',
  658. prop: 'arrivalAddress',
  659. rules: [
  660. {
  661. required: false,
  662. message: ' ',
  663. trigger: 'blur'
  664. }
  665. ]
  666. }, {
  667. label: '发货人',
  668. prop: 'arrivalContact',
  669. rules: [
  670. {
  671. required: false,
  672. message: ' ',
  673. trigger: 'blur'
  674. }
  675. ]
  676. }, {
  677. label: '发货电话',
  678. prop: 'arrivalTel',
  679. rules: [
  680. {
  681. required: false,
  682. message: ' ',
  683. trigger: 'blur'
  684. }
  685. ]
  686. },{
  687. label: "入库单备注",
  688. span: 24,
  689. type: 'textarea',
  690. prop: "deliveryRemarks",
  691. mock: {
  692. type: 'county'
  693. }
  694. }
  695. ]
  696. },
  697. statusOption: [],
  698. procurementMethodOption: [],
  699. warehouseTypeOption: [],
  700. // 仓库类型
  701. warehouseType: [],
  702. // 仓库名称
  703. warehouseName: [],
  704. // 第一次进入
  705. firstComing: false,
  706. // 费用信息排序的最大值
  707. maxFeeNum: 0,
  708. maxGoodsNum: 0,
  709. oldForm: {
  710. orderStatus: "录入"
  711. },
  712. oldGoodsList: [],
  713. oldFeesList: [],
  714. oldUploadList: [],
  715. // 弹窗高度
  716. rowHeight: '',
  717. // 查询时loading页面
  718. pageLoading: false,
  719. // 收货禁用
  720. receiveDisabled: false,
  721. messageVisble:false,
  722. }
  723. },
  724. mounted() {
  725. this.$nextTick(() => {
  726. // 监听浏览器高度变化,改变表格高度
  727. window.onresize = () => {
  728. this.rowHeight = (window.innerHeight - 130) + 'px'
  729. }
  730. })
  731. },
  732. filters: {
  733. IntegerFormat(num) {
  734. return IntegerFormat(num);
  735. }
  736. },
  737. //初始化查询
  738. async created() {
  739. this.rowHeight = (window.innerHeight - 130) + 'px'
  740. this.customerContact = await this.getColumnData(this.getColumnName(24), customerContact);
  741. this.advantageProject = await this.getColumnData(this.getColumnName(25), advantageProject);
  742. this.getWorkDicts("procurement_method").then(res => {
  743. this.procurementMethodOption = res.data.data
  744. })
  745. this.getWorkDicts("warehouseType").then(res => {
  746. this.warehouseTypeOption = res.data.data
  747. })
  748. wareHouseType().then(res => {
  749. this.warehouseType = res.data.data.records
  750. this.warehouseType.forEach(item => {
  751. this.$set(item, 'label', item.cname)
  752. this.$set(item, 'value', item.id)
  753. if (item.hasChildren) {
  754. this.$set(item, 'children', [])
  755. }
  756. })
  757. let result = [], temp = {}
  758. for(let i = 0; i < this.warehouseType.length;i++) {
  759. temp[this.warehouseType[i].id] = this.warehouseType[i]
  760. }
  761. for (let j = 0;j < this.warehouseType.length;j++) {
  762. let current = this.warehouseType[j]
  763. let tempCurrentParent = temp[current.parentId]
  764. if (tempCurrentParent) {
  765. if (!tempCurrentParent["children"]) {
  766. tempCurrentParent["children"] = []
  767. }
  768. tempCurrentParent["children"].push(current)
  769. } else {
  770. result.push(current)
  771. }
  772. }
  773. this.warehouseType = result
  774. });
  775. selectWareHouse().then(res => {
  776. this.warehouseName = res.data.data.records
  777. })
  778. this.form.deliveryAmount = 0
  779. this.form.totalQuantity = 0
  780. this.form.purchaseAmount = 0
  781. this.form.deliveryStatus = '录入'
  782. if (this.detailData.id) {
  783. this.queryData(this.detailData.id)
  784. }else if (this.detailData.form){
  785. this.form = JSON.parse(this.detailData.form);
  786. delete this.form.createTime
  787. delete this.form.id
  788. delete this.form.sysNo
  789. this.contactsData = this.form.orderItemsList
  790. delete this.form.orderItemsList
  791. this.configuration.dicData = this.form.corpName
  792. delete this.form.corpName
  793. this.$set(this.form, 'deliveryStatus', '录入')
  794. this.$set(this.form, 'salesCompany', this.form.belongToCorpId)
  795. delete this.form.belongToCorpList
  796. this.$set(this.form, 'deliveryAmount', 0)
  797. this.$set(this.form, 'totalQuantity', 0)
  798. this.$set(this.form, 'purchaseAmount', 0)
  799. this.contactsData.forEach(item => {
  800. this.$set(item, 'specificationAndModel', item.itemType)
  801. this.$set(item, 'orgOrderNo', this.form.orgOrderNo)
  802. this.$set(item, "inventoryNumber", item.storageQuantity)
  803. this.$set(item, "srcId", item.id)
  804. this.$set(item, "deliveryAmount", item.amount)
  805. this.$set(item, "purchaseAmount", item.price)
  806. this.$set(item, "purchaseQuantity", Number(item.orderQuantity))
  807. this.$set(item, "actualQuantity", (Number(item.orderQuantity) - Number(item.actualQuantity)))
  808. // 入库数量和入库金额的比例
  809. this.$set(item, 'scale', Number(item.deliveryAmount / item.actualQuantity))
  810. this.form.deliveryAmount = Number(this.form.deliveryAmount) + Number(item.deliveryAmount)
  811. this.form.totalQuantity = Number(this.form.totalQuantity) + Number(item.actualQuantity)
  812. this.form.purchaseAmount = Number(this.form.purchaseAmount) + Number(item.deliveryAmount)
  813. this.form.deliveryAmount = (this.form.deliveryAmount).toFixed(2)
  814. this.form.purchaseAmount = (this.form.purchaseAmount).toFixed(2)
  815. delete item.id
  816. delete item.pid
  817. })
  818. } else if (this.detailData.copyId) {
  819. this.queryData(this.detailData.copyId, true)
  820. }
  821. },
  822. watch: {
  823. },
  824. methods: {
  825. queryData(id, isCopy = false) {
  826. this.pageLoading = true
  827. detail(id).then(res => {
  828. this.form = res.data.data;
  829. this.receiveDisabled = this.form.deliveryStatus == '录入'? false: true
  830. this.contactsData = this.form.deliveryItemsList
  831. this.advantageProjectData = this.form.deliveryFeesList
  832. this.bankOfDepositData = this.form.deliveryFilesList
  833. this.configuration.dicData = this.form.corpName
  834. this.contactsData.forEach(item => {
  835. // this.form.deliveryAmount += Number(item.deliveryAmount)
  836. // this.form.totalQuantity += Number(item.actualQuantity)
  837. // 入库金额和入库数量的比例
  838. this.$set(item, 'scale', (item.deliveryAmount / item.actualQuantity))
  839. })
  840. let feesData = []
  841. this.form.deliveryFeesList.forEach(item => {
  842. let a = {
  843. cname: item.corpName,
  844. id: item.corpId
  845. }
  846. feesData.push(a)
  847. })
  848. this.configuration.dicData = this.configuration.dicData.concat(feesData)
  849. // 去重
  850. this.removeRepeat()
  851. if (this.form.companyName) {
  852. this.companyConfiguration.dicData = this.companyConfiguration.dicData.concat(this.form.companyName)
  853. }
  854. delete this.form.deliveryItemsList
  855. delete this.form.deliveryFeesList
  856. delete this.form.deliveryFilesList
  857. delete this.form.corpName
  858. delete this.form.companyName
  859. // 获取最大值
  860. let num = []
  861. this.advantageProjectData.forEach(item => {
  862. num.push(item.sort)
  863. })
  864. if (num.length == 0) {
  865. this.maxFeeNum = 0;
  866. } else {
  867. this.maxFeeNum = num.reduce((a, b) => {
  868. return b > a? b: a;
  869. })
  870. }
  871. let goodsNum = []
  872. this.contactsData.forEach(item => {
  873. goodsNum.push(item.sort)
  874. })
  875. if (goodsNum.length == 0) {
  876. this.maxGoodsNum = 0;
  877. } else {
  878. this.maxGoodsNum = goodsNum.reduce((a, b) => {
  879. return b > a? b: a;
  880. })
  881. }
  882. this.oldGoodsList = []
  883. this.oldFeesList = []
  884. this.oldUploadList = []
  885. this.oldForm = Object.assign({}, this.form)
  886. this.oldGoodsList = this.deepClone(this.contactsData)
  887. this.oldFeesList = this.deepClone(this.advantageProjectData)
  888. this.oldUploadList = this.deepClone(this.bankOfDepositData)
  889. if (isCopy) {
  890. delete this.form.id
  891. delete this.form.sysNo
  892. this.contactsData.forEach(item => {
  893. delete item.id
  894. delete item.pid
  895. })
  896. this.advantageProjectData.forEach(item => {
  897. delete item.id
  898. delete item.pid
  899. })
  900. this.bankOfDepositData.forEach(item => {
  901. delete item.id
  902. delete item.pid
  903. })
  904. this.form.deliveryStatus = '录入'
  905. this.receiveDisabled = false;
  906. }
  907. }).finally(() => {
  908. this.saveLoading = false
  909. this.pageLoading = false
  910. });
  911. },
  912. copyOrder() {
  913. this.queryData(this.form.id, true)
  914. },
  915. // 入库数量变化时调用
  916. actualQuantityChange(row) {
  917. if (Number(row.actualQuantity) > Number(row.purchaseQuantity)) {
  918. this.$message.error('入库数量不能超过采购数量')
  919. row.actualQuantity = 0
  920. }
  921. // if (row.scale) {
  922. // row.deliveryAmount = Number(row.actualQuantity) * Number(row.scale)
  923. // }
  924. },
  925. // 类别变换时触发
  926. warehouseTreeChange(id) {
  927. this.warehouseName = []
  928. if (this.firstComing) {
  929. if (!this.form.storageId) {
  930. this.$set(this.form, 'storageId', null)
  931. } else {
  932. this.form.storageId = null
  933. }
  934. }
  935. let data = {
  936. storageTypeId: id
  937. }
  938. selectWareHouse(data).then(res => {
  939. this.warehouseName = res.data.data.records
  940. })
  941. this.firstComing = true
  942. },
  943. //点击行可编辑
  944. handleRowClick(row, event, column) {
  945. console.log(row.$index)
  946. },
  947. //商品编辑
  948. rowCell(row, index) {
  949. console.log(row)
  950. this.$refs.crudContact.rowCell(row, index)
  951. },
  952. //费用编辑
  953. rowCellTwo(row, index) {
  954. console.log(row)
  955. this.$refs.crudProject.rowCell(row, index)
  956. },
  957. //费用新增触发
  958. costIncrease() {
  959. this.dialogCost = !this.dialogCost
  960. this.choiceData = false
  961. },
  962. //商品新增触发
  963. commoditySelection() {
  964. this.dialogVisible = !this.dialogVisible
  965. this.tableData = []
  966. this.commodityData = false
  967. },
  968. //点击费用明细选择触发
  969. choice(row) {
  970. this.dialogCost = !this.dialogCost
  971. this.choiceData = true
  972. console.log(row)
  973. this.choiceIndex = row.$index
  974. },
  975. //点击商品明细选择触发
  976. commodityChoice(row) {
  977. this.dialogVisible = !this.dialogVisible
  978. this.commodityData = true
  979. console.log(row)
  980. this.choiceIndexT = row.$index
  981. },
  982. //导入商品触发
  983. importChoice() {
  984. if (this.tableData.length === 1) {
  985. this.contactsData[this.choiceIndexT].cname = this.tableData[0].cname
  986. this.contactsData[this.choiceIndexT].code = this.tableData[0].code
  987. this.contactsData[this.choiceIndexT].typeno = this.tableData[0].typeno
  988. this.contactsData[this.choiceIndexT].specificationAndModel = this.tableData[0].typeno
  989. this.contactsData[this.choiceIndexT].itemId = this.tableData[0].id
  990. selectGoodsNum({
  991. goodsId: this.tableData[0].id,
  992. itemType: this.tableData[0].typeno
  993. }).then(res => {
  994. this.contactsData[this.choiceIndexT].storageQuantity = res.data.data
  995. })
  996. }
  997. this.dialogVisible = !this.dialogVisible
  998. this.commodityData = false
  999. },
  1000. //费用编辑导入触发
  1001. choiceCost() {
  1002. console.log('1111')
  1003. if (this.tableDataCost.length === 1) {
  1004. this.advantageProjectData[this.choiceIndex].feeName = this.tableDataCost[0].cname
  1005. this.advantageProjectData[this.choiceIndex].itemId = this.tableDataCost[0].id
  1006. this.advantageProjectData[this.choiceIndex].code = this.tableDataCost[0].code
  1007. }
  1008. this.dialogCost = !this.dialogCost
  1009. this.choiceData = false
  1010. },
  1011. //费用导入触发
  1012. importCost() {
  1013. console.log('111111')
  1014. // this.advantageProjectForm = this.advantageProjectForm.concat(this.tableDataCost)
  1015. if (this.tableDataCost.length > 0) {
  1016. for (let item in this.tableDataCost) {
  1017. console.log(this.tableDataCost[item])
  1018. this.tableDataCost[item].itemId = this.tableDataCost[item].id
  1019. this.tableDataCost[item].feeName = this.tableDataCost[item].cname
  1020. this.tableDataCost[item].sort = this.maxFeeNum + 1
  1021. this.maxFeeNum++
  1022. delete this.tableDataCost[item].id
  1023. this.$refs.crudProject.rowCellAdd(this.tableDataCost[item]);
  1024. this.$refs.crudProject.rowCell(this.tableDataCost[item], this.advantageProjectForm.length - 1)
  1025. }
  1026. }
  1027. this.tableDataCost = []
  1028. this.dialogCost = false
  1029. },
  1030. //确认导入触发
  1031. importGoods() {
  1032. // this.contactsData = this.contactsData.concat(this.tableData)
  1033. if (this.tableData.length > 0) {
  1034. for (let item in this.tableData) {
  1035. selectGoodsNum({
  1036. goodsId: this.tableData[item].id,
  1037. itemType: this.tableData[item].typeno
  1038. }).then(res => {
  1039. this.tableData[item].storageQuantity = res.data.data
  1040. this.tableData[item].itemId = this.tableData[item].id
  1041. this.tableData[item].priceCategory = this.tableData[item].goodsTypeName
  1042. delete this.tableData[item].goodsTypeName
  1043. delete this.tableData[item].id
  1044. delete this.tableData[item].status
  1045. delete this.tableData[item].isDeleted
  1046. this.$set(this.tableData[item], 'specificationAndModel', this.tableData[item].typeno)
  1047. this.$set(this.tableData[item], 'purchaseQuantity', 0)
  1048. this.$set(this.tableData[item], 'actualQuantity', 0)
  1049. this.$set(this.tableData[item], 'purchaseAmount', 0)
  1050. this.$set(this.tableData[item], 'deliveryAmount', 0)
  1051. this.tableData[item].sort = this.maxGoodsNum + 1
  1052. this.maxGoodsNum++
  1053. this.$refs.crudContact.rowCellAdd(this.tableData[item]);
  1054. this.$refs.crudContact.rowCell(this.tableData[item], this.contactsData.length - 1)
  1055. })
  1056. }
  1057. }
  1058. this.dialogVisible = false
  1059. },
  1060. closeGoods() {
  1061. this.treeDataGoods = [];
  1062. this.treeDeptId = "";
  1063. },
  1064. closeFees() {
  1065. this.treeDeptIdCost = "";
  1066. this.treeData = [];
  1067. },
  1068. //选中触发
  1069. selectionChange(list) {
  1070. console.log(list);
  1071. this.tableData = list
  1072. },
  1073. //费用选中触发
  1074. selectionChangeCost(list) {
  1075. console.log(list);
  1076. this.tableDataCost = list
  1077. },
  1078. //导入页左商品类型查询
  1079. nodeClick(data) {
  1080. this.treeDeptId = data.id;
  1081. this.page.currentPage = 1;
  1082. this.onLoad(this.page);
  1083. },
  1084. //导入页左费用类型查询
  1085. nodeClickCost(data) {
  1086. this.treeDeptIdCost = data.id;
  1087. this.pageCost.currentPage = 1;
  1088. this.onLoadCost(this.pageCost);
  1089. },
  1090. //刷新触发
  1091. refreshChange() {
  1092. this.treeDeptId = '';
  1093. this.page.currentPage = 1;
  1094. this.onLoad(this.page);
  1095. },
  1096. //费用刷新触发
  1097. refreshChangeCost() {
  1098. this.treeDeptIdCost = '';
  1099. this.pageCost.currentPage = 1;
  1100. this.onLoadCost(this.pageCost);
  1101. },
  1102. //新增商品信息保存触发
  1103. rowSave(row, done, loading) {
  1104. // this.contactsData.push(row)
  1105. done()
  1106. },
  1107. //修改商品信息触发
  1108. rowUpdate(row, index, done, loading) {
  1109. done(row);
  1110. },
  1111. //删除商品信息触发
  1112. rowDel(row, index, donerowDel) {
  1113. this.$confirm("确定将选择数据删除?", {
  1114. confirmButtonText: "确定",
  1115. cancelButtonText: "取消",
  1116. type: "warning"
  1117. }).then(() => {
  1118. //商品判断是否需要调用删除接口
  1119. if (row.id) {
  1120. corpsattn(row.id).then(res => {
  1121. this.$message({
  1122. type: "success",
  1123. message: "操作成功!"
  1124. });
  1125. this.contactsData.splice(index, 1);
  1126. })
  1127. } else {
  1128. this.$message({
  1129. type: "success",
  1130. message: "操作成功!"
  1131. });
  1132. this.contactsData.splice(index, 1);
  1133. }
  1134. })
  1135. },
  1136. //新增费用明细保存触发
  1137. rowSaveProject(row, done, loading) {
  1138. // this.advantageProjectData.push(row)
  1139. done()
  1140. },
  1141. //修改费用明细触发
  1142. rowUpdateProject(row, index, done, loading) {
  1143. done(row);
  1144. },
  1145. goodsSearch(params, done) {
  1146. this.treeDeptId = '';
  1147. this.onLoad(this.page, params);
  1148. done()
  1149. },
  1150. //商品列表查询
  1151. onLoad(page, params = {}) {
  1152. this.loading = true;
  1153. getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
  1154. console.log(res)
  1155. const data = res.data.data;
  1156. this.page.total = data.total;
  1157. this.data = data.records;
  1158. this.loading = false;
  1159. });
  1160. },
  1161. // 费用查询按钮
  1162. feesSearch(params, done) {
  1163. this.treeDeptIdCost = '';
  1164. this.onLoadCost(this.pageCost, params)
  1165. done()
  1166. },
  1167. //费用查询
  1168. onLoadCost(page, params = {}) {
  1169. this.loadingCost = true;
  1170. let queryParams = Object.assign({}, params, {
  1171. pageSize: page.pageSize,
  1172. pageNum: page.currentPage,
  1173. parentId: 0,
  1174. feesTypeId: this.treeDeptIdCost
  1175. })
  1176. customerList(queryParams).then(res => {
  1177. console.log(res)
  1178. const data = res.data.data;
  1179. this.pageCost.total = data.total;
  1180. this.dataCost = data.records;
  1181. this.loadingCost = false;
  1182. });
  1183. },
  1184. //删除费用明细触发
  1185. rowDelProject(row, index, donerowDel) {
  1186. this.$confirm("确定将选择数据删除?", {
  1187. confirmButtonText: "确定",
  1188. cancelButtonText: "取消",
  1189. type: "warning"
  1190. }).then(() => {
  1191. //费用判断是否需要调用删除接口
  1192. if (row.id) {
  1193. corpsitem(row.id).then(res => {
  1194. this.$message({
  1195. type: "success",
  1196. message: "操作成功!"
  1197. });
  1198. this.advantageProjectData.splice(index, 1);
  1199. })
  1200. } else {
  1201. this.$message({
  1202. type: "success",
  1203. message: "操作成功!"
  1204. });
  1205. this.advantageProjectData.splice(index, 1);
  1206. }
  1207. })
  1208. },
  1209. //新增附件上传保存触发
  1210. rowSaveBankOfDeposit(row, done, loading) {
  1211. this.bankOfDepositData.push(row)
  1212. done()
  1213. },
  1214. //修改附件上传触发
  1215. rowUpdateBankOfDeposit(row, index, done, loading) {
  1216. done(row);
  1217. },
  1218. //删除附件上传触发
  1219. rowDelBankOfDeposit(row, index, donerowDel) {
  1220. this.$confirm("确定将选择数据删除?", {
  1221. confirmButtonText: "确定",
  1222. cancelButtonText: "取消",
  1223. type: "warning"
  1224. }).then(() => {
  1225. //附件判断是否需要调用删除接口
  1226. if (row.id) {
  1227. corpsbank(row.id).then(res => {
  1228. this.$message({
  1229. type: "success",
  1230. message: "操作成功!"
  1231. });
  1232. this.bankOfDepositData.splice(index, 1);
  1233. })
  1234. } else {
  1235. this.$message({
  1236. type: "success",
  1237. message: "操作成功!"
  1238. });
  1239. this.bankOfDepositData.splice(index, 1);
  1240. }
  1241. })
  1242. },
  1243. uploadAfter(res, done) {
  1244. if (res.originalName) {
  1245. this.bankOfDepositForm.fileName = this.bankOfDepositForm.fileName
  1246. ? this.bankOfDepositForm.fileName
  1247. : res.originalName;
  1248. }
  1249. done();
  1250. },
  1251. // 去重
  1252. removeRepeat() {
  1253. let obj = []
  1254. this.configuration.dicData = this.configuration.dicData.reduce((current,next) => {
  1255. obj[next.id] ? '': obj[next.id] = true && current.push(next)
  1256. return current
  1257. }, [])
  1258. },
  1259. receiveList(data){
  1260. this.configuration.dicData = this.configuration.dicData.concat(data)
  1261. this.removeRepeat()
  1262. },
  1263. // 确认收货
  1264. sendInGoods() {
  1265. this.$refs["form"].validate((valid) => {
  1266. if (valid) {
  1267. if (this.contactsData.length == 0) {
  1268. return this.$message.error('商品信息为空')
  1269. }
  1270. if (contrastObj(this.form, this.oldForm) ||
  1271. contrastList(this.contactsData, this.oldGoodsList) ||
  1272. // contrastList(this.advantageProjectData, this.oldFeesList) ||
  1273. contrastList(this.bankOfDepositData, this.oldUploadList)
  1274. ) {
  1275. this.$confirm("数据发生变化未有提交记录, 是否保存?", "提示", {
  1276. confirmButtonText: "确定",
  1277. cancelButtonText: "取消",
  1278. type: "warning"
  1279. }).then(async () => {
  1280. await this.editCustomer(false, '收货')
  1281. }).catch(() => {
  1282. this.$message.info('已取消')
  1283. })
  1284. } else {
  1285. //商品信息
  1286. this.form.deliveryItemsList = this.contactsData
  1287. this.form.deliveryFeesList = this.advantageProjectData
  1288. this.form.deliveryFilesList = this.bankOfDepositData
  1289. if (typeof this.form.corpsTypeId == 'object') {
  1290. this.form.corpsTypeId = this.form.corpsTypeId.join(",")
  1291. }
  1292. this.pageLoading = true
  1293. sendInGoods(this.form).then(res => {
  1294. this.$message.success('收货成功')
  1295. this.queryData(res.data.data.id)
  1296. }).finally(() => {
  1297. this.pageLoading = false
  1298. })
  1299. }
  1300. } else {
  1301. return false;
  1302. }
  1303. });
  1304. },
  1305. // 撤销收货
  1306. revokeInGoods() {
  1307. this.$refs["form"].validate((valid) => {
  1308. if (valid) {
  1309. //商品信息
  1310. this.form.deliveryItemsList = this.contactsData
  1311. this.form.deliveryFeesList = this.advantageProjectData
  1312. this.form.deliveryFilesList = this.bankOfDepositData
  1313. if (typeof this.form.corpsTypeId == 'object') {
  1314. this.form.corpsTypeId = this.form.corpsTypeId.join(",")
  1315. }
  1316. this.pageLoading = true
  1317. revokeInGoods(this.form).then(res => {
  1318. this.$message.success('撤销成功')
  1319. this.queryData(res.data.data.id)
  1320. }).finally(() => {
  1321. this.pageLoading = false
  1322. })
  1323. } else {
  1324. return false;
  1325. }
  1326. });
  1327. },
  1328. //修改提交触发
  1329. editCustomer(isBack = false, type) {
  1330. this.$refs["form"].validate((valid) => {
  1331. if (valid) {
  1332. this.form.deliveryAmount = 0
  1333. this.form.totalQuantity = 0
  1334. this.form.purchaseAmount = 0
  1335. this.contactsData.forEach(item => {
  1336. this.form.deliveryAmount = Number(this.form.deliveryAmount) + Number(item.deliveryAmount)
  1337. this.form.totalQuantity = Number(this.form.totalQuantity) + Number(item.actualQuantity)
  1338. this.form.purchaseAmount = Number(this.form.purchaseAmount) + Number(item.deliveryAmount)
  1339. this.form.deliveryAmount = (this.form.deliveryAmount).toFixed(2)
  1340. this.form.purchaseAmount = (this.form.purchaseAmount).toFixed(2)
  1341. })
  1342. //商品信息
  1343. this.form.deliveryItemsList = this.contactsData
  1344. // this.form.deliveryFeesList = this.advantageProjectData
  1345. this.form.deliveryFeesList = this.$refs.feeInfo.submitData()
  1346. this.form.deliveryFilesList = this.bankOfDepositData
  1347. if (typeof this.form.corpsTypeId == 'object') {
  1348. this.form.corpsTypeId = this.form.corpsTypeId.join(",")
  1349. }
  1350. // this.form.id && this.unLock({moduleName: 'sh',tableName: 'business_delivery', billId: this.form.id})
  1351. this.saveLoading = true
  1352. typeSave(this.form).then(res => {
  1353. // this.$set(this.detailData, 'seeDisabled', true);
  1354. this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
  1355. if (isBack) {
  1356. //成功关闭此页面回到列表页
  1357. this.$emit("goBack");
  1358. this.leaveDetailsKey(this.$route.name)
  1359. } else {
  1360. this.queryData(res.data.data.id)
  1361. }
  1362. if (type == '收货') {
  1363. this.$nextTick(() => {
  1364. this.form.deliveryItemsList = this.contactsData
  1365. this.form.deliveryFeesList = this.advantageProjectData
  1366. this.form.deliveryFilesList = this.bankOfDepositData
  1367. if (typeof this.form.corpsTypeId == 'object') {
  1368. this.form.corpsTypeId = this.form.corpsTypeId.join(",")
  1369. }
  1370. this.pageLoading = true
  1371. sendInGoods(this.form).then(res => {
  1372. this.$message.success('收货成功')
  1373. this.queryData(res.data.data.id)
  1374. }).finally(() => {
  1375. this.pageLoading = false
  1376. })
  1377. })
  1378. }
  1379. }).catch(() => {
  1380. this.pageLoading = false
  1381. this.saveLoading = false
  1382. })
  1383. }
  1384. });
  1385. },
  1386. //返回列表
  1387. backToList() {
  1388. if (contrastObj(this.form, this.oldForm) ||
  1389. contrastList(this.contactsData, this.oldGoodsList) ||
  1390. // contrastList(this.advantageProjectData, this.oldFeesList) ||
  1391. contrastList(this.bankOfDepositData, this.oldUploadList)
  1392. ) {
  1393. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  1394. confirmButtonText: "确定",
  1395. cancelButtonText: "取消",
  1396. type: "warning"
  1397. }).then(() => {
  1398. this.editCustomer(true)
  1399. }).catch(() => {
  1400. !this.detailData.seeDisabled && this.form.id && this.unLock({moduleName: 'sh',tableName: 'business_delivery', billId: this.form.id})
  1401. this.$emit("goBack");
  1402. this.leaveDetailsKey(this.$route.name)
  1403. })
  1404. } else {
  1405. !this.detailData.seeDisabled && this.form.id && this.unLock({moduleName: 'sh',tableName: 'business_delivery', billId: this.form.id})
  1406. this.$emit("goBack");
  1407. this.leaveDetailsKey(this.$route.name)
  1408. }
  1409. },
  1410. // 保存列设置
  1411. async saveColumn(name) {
  1412. if (name == 'goods') {
  1413. const inSave = await this.saveColumnData(
  1414. this.getColumnName(24),
  1415. this.customerContact
  1416. );
  1417. if (inSave) {
  1418. this.$message.success("保存成功");
  1419. //关闭窗口
  1420. this.$refs.crudContact.$refs.dialogColumn.columnBox = false;
  1421. }
  1422. } else if (name === 'fees') {
  1423. const inSave = await this.saveColumnData(
  1424. this.getColumnName(25),
  1425. this.advantageProject
  1426. );
  1427. if (inSave) {
  1428. this.$message.success("保存成功");
  1429. //关闭窗口
  1430. this.$refs.crudProject.$refs.dialogColumn.columnBox = false;
  1431. }
  1432. }
  1433. },
  1434. async resetColumn() {
  1435. this.customerContact = customerContact
  1436. const inSave = await this.delColumnData(
  1437. this.getColumnName(24),
  1438. customerContact
  1439. );
  1440. if (inSave) {
  1441. this.$message.success("重置成功");
  1442. //关闭窗口
  1443. this.$refs.crudContact.$refs.dialogColumn.columnBox = false;
  1444. }
  1445. },
  1446. //费用明细回调
  1447. beforeFinance(feesData,callback){
  1448. this.advantageProjectData = feesData;
  1449. let params = {}
  1450. //暂时默认通过 之后优化
  1451. params.valid = true
  1452. params.parentId = this.form.id
  1453. params.srcOrderno = this.form.orderNo
  1454. callback(params)
  1455. },
  1456. // 发送消息
  1457. postMessage() {
  1458. this.messageVisble = true
  1459. this.$nextTick(() => {
  1460. this.$refs.messagePost.init()
  1461. })
  1462. },
  1463. closeDialog() {
  1464. this.messageVisble = false
  1465. },
  1466. editHandle() {
  1467. const data = {
  1468. moduleName: 'sh',
  1469. tableName: 'business_delivery',
  1470. billId: this.form.id,
  1471. no: localStorage.getItem('browserID'),
  1472. billNo: this.form.sysNo
  1473. }
  1474. this.saveLoading = true
  1475. this.checkLock(data).then(res => {
  1476. if (res.data.code == 200) {
  1477. this.onLock(data).then(response => {
  1478. this.queryData(this.form.id)
  1479. })
  1480. this.inDetailsKey(this.$route.name, {
  1481. moduleName: 'sh',
  1482. tableName: 'business_delivery',
  1483. billId: this.form.id,
  1484. })
  1485. this.detailData.seeDisabled = false;
  1486. }
  1487. }).catch(error => {
  1488. }).finally(() => {
  1489. this.saveLoading = false
  1490. })
  1491. },
  1492. returnBack(data) {
  1493. if (data.belongtocompany) {
  1494. // this.form.salesCompany = data.belongtocompany
  1495. }
  1496. },
  1497. getGSName(row) {
  1498. this.form.belongCompany = row.cname
  1499. },
  1500. }
  1501. }
  1502. </script>
  1503. <style lang="scss" scoped>
  1504. //.customer-head {
  1505. // position: fixed;
  1506. // top: 105px;
  1507. // width: 100%;
  1508. // margin-left: -10px;
  1509. // height: 62px;
  1510. // background: #ffffff;
  1511. // box-shadow: 0 4px 12px 0px rgba(232, 232, 235, 1);
  1512. // z-index: 999;
  1513. // /* display: flex;
  1514. // justify-content: left; */
  1515. //}
  1516. //
  1517. //.customer-back {
  1518. // cursor: pointer;
  1519. // line-height: 62px;
  1520. // font-size: 16px;
  1521. // color: #323233;
  1522. // font-weight: 400;
  1523. //}
  1524. .back-icon {
  1525. line-height: 64px;
  1526. font-size: 20px;
  1527. margin-right: 8px;
  1528. }
  1529. //.add-customer-btn {
  1530. // position: fixed;
  1531. // right: 36px;
  1532. // top: 115px;
  1533. //}
  1534. ::v-deep .el-form-item {
  1535. margin-bottom: 0;
  1536. }
  1537. .el-dialogDeep {
  1538. ::v-deep .el-dialog {
  1539. margin: 1vh auto 0 !important;
  1540. padding-bottom: 10px !important;
  1541. .el-dialog__body, .el-dialog__footer {
  1542. padding-bottom: 0 !important;
  1543. padding-top: 0 !important;
  1544. }
  1545. }
  1546. }
  1547. .print-div {
  1548. color: #000;
  1549. }
  1550. .print_table {
  1551. table {
  1552. border-right: 1px solid #000;
  1553. border-bottom: 1px solid #000;
  1554. font-size: 12px;
  1555. margin-bottom: 5px;
  1556. }
  1557. table td {
  1558. border-left: 1px solid #000;
  1559. border-top: 1px solid #000;
  1560. vertical-align: middle;
  1561. padding: 2px;
  1562. text-align: center;
  1563. }
  1564. }
  1565. .table {
  1566. border-collapse: collapse;
  1567. border-spacing: 0;
  1568. background-color: transparent;
  1569. display: table;
  1570. width: 99%;
  1571. max-width: 100%;
  1572. margin: 0 auto;
  1573. }
  1574. .table td {
  1575. text-align: left;
  1576. vertical-align: middle;
  1577. font-size: 14px;
  1578. color: #000000;
  1579. padding: 10.5px 0 10.5px 30px;
  1580. //border: 1px solid #000;
  1581. }
  1582. ::v-deep .el-form-item {
  1583. margin-bottom: 0;
  1584. }
  1585. ::v-deep .el-form-item__content{
  1586. line-height: 32px;
  1587. }
  1588. </style>