detailsPageEdit.vue 62 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860
  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="detailData.seeDisabled = false"
  15. type="primary"
  16. style="margin-right: 8px"
  17. >编辑</el-button>
  18. <el-dropdown style="margin-right: 8px;">
  19. <el-button
  20. type="primary"
  21. size="small"
  22. >
  23. 审核处理<i class="el-icon-arrow-down el-icon--right"></i>
  24. </el-button>
  25. <el-dropdown-menu slot="dropdown">
  26. <el-dropdown-item :disabled="!form.id || form.status > 0" @click.native="pleaseCheck">请核数据</el-dropdown-item>
  27. <el-dropdown-item v-if="form.status > 0" @click.native="checkScheduleDialog = true,checkId=form.id">审核进度</el-dropdown-item>
  28. <el-dropdown-item v-if="false">撤销请核</el-dropdown-item>
  29. </el-dropdown-menu>
  30. </el-dropdown>
  31. <el-dropdown style="margin-right: 8px;">
  32. <el-button
  33. type="warning"
  34. size="small"
  35. >
  36. 账单处理<i class="el-icon-arrow-down el-icon--right"></i>
  37. </el-button>
  38. <el-dropdown-menu slot="dropdown">
  39. <el-dropdown-item
  40. :disabled="detailData.seeDisabled || !form.id"
  41. @click.native="applyPayment('申请')"
  42. >
  43. 申请货款
  44. </el-dropdown-item>
  45. <!-- <el-dropdown-item-->
  46. <!-- @click.stop.native="applyPayment('收费')"-->
  47. <!-- :disabled="!this.form.id"-->
  48. <!-- >申请退款-->
  49. <!-- </el-dropdown-item>-->
  50. <el-dropdown-item
  51. @click.native="openApplicationDialog"
  52. :disabled="!form.id"
  53. >查看账单
  54. </el-dropdown-item>
  55. </el-dropdown-menu>
  56. </el-dropdown>
  57. <el-button
  58. size="small"
  59. class="el-button--small-yh"
  60. type="success"
  61. @click="copyOrder"
  62. :disabled="detailData.seeDisabled || !this.form.id"
  63. >
  64. 复制单据
  65. </el-button>
  66. <el-button
  67. size="small"
  68. class="el-button--small-yh"
  69. type="primary"
  70. :disabled="disabled || detailData.seeDisabled || browse"
  71. @click="editCustomer(false)"
  72. :loading="saveLoading"
  73. >保 存
  74. </el-button>
  75. <div v-if="checkDisabled" style="float: right;margin-left: 8px">
  76. <el-button type="primary"
  77. size="small"
  78. class="el-button--small-yh"
  79. @click.stop="openCheckDialog">
  80. 审批
  81. </el-button>
  82. </div>
  83. </div>
  84. </div>
  85. <div class="customer-main">
  86. <el-form :model="form" ref="form" label-width="130px" class="demo-ruleForm">
  87. <containerTitle title="基础资料"></containerTitle>
  88. <basic-container style="margin-bottom: 10px">
  89. <el-row>
  90. <el-col v-for="(item,index) in basicData.column" :key="index" :span="item.span?item.span:8">
  91. <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
  92. <!-- <avue-input-tree v-if="item.prop === 'corpsTypeId'" leaf-only multiple :props="{label:'title'}" v-model="form[item.prop]" placeholder="请选择内容" type="tree" :dic="dic"-->
  93. <!-- ></avue-input-tree>-->
  94. <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]"
  95. size="small" type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss" :disabled="detailData.seeDisabled || browse"/>
  96. <el-date-picker v-else-if="item.type === 'date'" style="width: 100%;" v-model="form[item.prop]"
  97. size="small" type="date" placeholder="选择日期"
  98. :disabled="detailData.seeDisabled || browse"/>
  99. <el-select v-else-if="item.prop === 'paymentType'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small" :disabled="detailData.seeDisabled || browse">
  100. <el-option v-for="(item,index) in paymentOption" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
  101. </el-select>
  102. <crop-select
  103. v-else-if="item.prop === 'corpId'"
  104. v-model="form[item.prop]"
  105. corpType="GYS"
  106. @getCorpData="returnBack"
  107. :disabled="detailData.seeDisabled || browse"
  108. ></crop-select>
  109. <el-select v-else-if="item.prop === 'banks'"
  110. v-model="form[item.prop]" placeholder="请选择"
  111. clearable
  112. filterable
  113. allow-create
  114. default-first-option
  115. size="small"
  116. style="width: 100%;"
  117. @change="banksChange"
  118. :disabled="detailData.seeDisabled || browse">
  119. <el-option v-for="(item,index) in bankList" :key="index" :label="item.accountNo" :value="item.accountNo"></el-option>
  120. </el-select>
  121. <el-input
  122. v-else-if="item.type == 'number'"
  123. placeholder="请输入"
  124. v-input-limit="2"
  125. size="small"
  126. :disabled="item.disabled || detailData.seeDisabled || browse"
  127. v-model.trim="form[item.prop]"
  128. />
  129. <el-select v-else-if="item.prop === 'packageRemarks'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small" :disabled="detailData.seeDisabled || browse">
  130. <el-option v-for="(item,index) in packageOptions" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
  131. </el-select>
  132. <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 || browse"></el-input>
  133. <el-input type="age" v-else v-model.trim="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled || detailData.seeDisabled || browse" placeholder="请输入"></el-input>
  134. </el-form-item>
  135. </el-col>
  136. </el-row>
  137. </basic-container>
  138. <containerTitle title="商品信息"></containerTitle>
  139. <basic-container style="margin-bottom: 10px">
  140. <avue-crud
  141. :option="customerContact"
  142. v-model="contactsForm"
  143. :data="contactsData"
  144. ref="crudContact"
  145. @row-save="rowSave"
  146. @row-click="handleRowClick"
  147. @row-update="rowUpdate"
  148. @row-del="rowDel"
  149. @selection-change="productSelection"
  150. @saveColumn="saveColumn('goods')"
  151. @resetColumn="resetColumn"
  152. >
  153. <template slot="cname" slot-scope="{ row }">
  154. <goods-select v-if="row.$cellEdit" v-model="row.cname" @getRow="getGoodsRow($event, row)"
  155. :configuration="goodsConfiguration" @receiveList="receiveGoodList" @returnRow="getRow($event, row)"/>
  156. <span v-else>
  157. {{ row.cname }}
  158. <!-- <span v-for="item in goodsConfiguration.dicData" v-if="item.cname == row.cname">{{ item.cname }}</span>-->
  159. </span>
  160. </template>
  161. <template slot="orderQuantity" slot-scope="{ row }">
  162. <el-input
  163. v-if="row.$cellEdit"
  164. v-model.trim="row.orderQuantity"
  165. oninput='this.value=this.value.replace(/[^(\d)]/g,"")' size="small"
  166. @input="changeContractAmt(row)"
  167. ></el-input>
  168. <span v-else>{{ row.orderQuantity | IntegerFormat }}</span>
  169. </template>
  170. <template slot="price" slot-scope="{ row }">
  171. <el-input
  172. v-if="row.$cellEdit"
  173. v-model.trim="row.price"
  174. oninput='this.value=this.value.replace(/[^\-?\d.]/g,"").replace(/^(\-)*(\d+)\.(\d\d).*$/, "$1$2.$3")' size="small"
  175. @input="changeContractAmt(row)"
  176. ></el-input>
  177. <span v-else>{{ row.price }}</span>
  178. </template>
  179. <!-- <template slot="storageQuantity" slot-scope="{ row }">-->
  180. <!-- <el-input-->
  181. <!-- v-if="row.$cellEdit"-->
  182. <!-- v-model.trim="row.storageQuantity"-->
  183. <!-- size="small"-->
  184. <!-- oninput='this.value=this.value.replace(/[^\-?\d.]/g,"").replace(/^(\-)*(\d+)\.(\d\d).*$/, "$1$2.$3")'-->
  185. <!-- ></el-input>-->
  186. <!-- <span v-else>{{ row.storageQuantity }}</span>-->
  187. <!-- </template>-->
  188. <!-- <template slot="actualQuantity" slot-scope="{ row }">-->
  189. <!-- <el-input-->
  190. <!-- v-if="row.$cellEdit"-->
  191. <!-- v-model.trim="row.actualQuantity"-->
  192. <!-- size="small"-->
  193. <!-- oninput='this.value=this.value.replace(/[^\-?\d.]/g,"").replace(/^(\-)*(\d+)\.(\d\d).*$/, "$1$2.$3")'-->
  194. <!-- ></el-input>-->
  195. <!-- <span v-else>{{ row.actualQuantity }}</span>-->
  196. <!-- </template>-->
  197. <template slot="code" slot-scope="{row,index}">
  198. <el-button type="text" size="mini" style="padding:4px 10px;float:left" @click="commodityChoice(row)" :disabled="detailData.seeDisabled || !row.$cellEdit">选择</el-button>
  199. <span>{{ row.code }}</span>
  200. </template>
  201. <template slot-scope="{row,index}" slot="menu">
  202. <el-button
  203. type="text"
  204. size="small"
  205. @click="rowCell(row,index)"
  206. :disabled="detailData.seeDisabled || browse"
  207. >{{ row.$cellEdit ? '保存' : '修改' }}
  208. </el-button>
  209. <el-button
  210. size="small"
  211. icon="el-icon-delete"
  212. type="text"
  213. @click="rowDel(row, index)"
  214. :disabled="detailData.seeDisabled || browse"
  215. v-if="!row.$cellEdit"
  216. >删 除</el-button>
  217. </template>
  218. <template slot="menuLeft" slot-scope="{size}">
  219. <el-button type="primary"
  220. icon="el-icon-plus"
  221. size="small"
  222. @click="commoditySelection"
  223. :disabled="detailData.seeDisabled || browse"
  224. >录入明细
  225. </el-button>
  226. <el-button type="warning"
  227. icon="el-icon-plus"
  228. size="small"
  229. :disabled="selection.length < 1 || detailData.seeDisabled || form.status != 3"
  230. @click="getShipmentC">生成采购确认
  231. </el-button>
  232. <el-button type="info" :size="size" icon="el-icon-printer" @click.stop="openReport()">报 表</el-button>
  233. </template>
  234. </avue-crud>
  235. </basic-container>
  236. <fee-info
  237. ref="feeInfo"
  238. :orderFeesList="advantageProjectData"
  239. :disabled="detailData.seeDisabled || form.status < 3"
  240. feeUrl="/trade-purchase/purchase-order/removeByFees"
  241. optionType="GN"
  242. itemType="采购"
  243. @beforeFinance="beforeFinance"
  244. />
  245. <!-- <containerTitle title="费用明细"></containerTitle>-->
  246. <!-- <basic-container style="margin-bottom: 10px">-->
  247. <!-- <avue-crud-->
  248. <!-- :option="advantageProject"-->
  249. <!-- v-model="advantageProjectForm"-->
  250. <!-- :data="advantageProjectData"-->
  251. <!-- ref="crudProject"-->
  252. <!-- @row-save="rowSaveProject"-->
  253. <!-- @row-update="rowUpdateProject"-->
  254. <!-- @row-del="rowDelProject"-->
  255. <!-- @saveColumn="saveColumn('fees')"-->
  256. <!-- >-->
  257. <!-- <template slot="code" slot-scope="{row,index}">-->
  258. <!-- <el-button type="text" size="mini" style="padding:4px 10px;float:left" @click="choice(row)" :disabled="detailData.seeDisabled || !row.$cellEdit">选择</el-button>-->
  259. <!-- <span>{{ row.code }}</span>-->
  260. <!-- </template>-->
  261. <!-- <template slot="corpId" slot-scope="{ row }">-->
  262. <!-- <selectComponent v-if="row.$cellEdit" v-model="row.corpId"-->
  263. <!-- :configuration="configuration" @receiveList="receiveList" typeData="GYS"/>-->
  264. <!-- <span v-else>-->
  265. <!-- <span v-for="item in configuration.dicData" v-if="item.id == row.corpId">{{ item.cname }}</span>-->
  266. <!-- </span>-->
  267. <!-- </template>-->
  268. <!-- <template slot="amount" slot-scope="{ row }">-->
  269. <!-- <el-input v-if="row.$cellEdit" v-model.trim="row.amount"-->
  270. <!-- size="small" v-input-limit="2"-->
  271. <!-- ></el-input>-->
  272. <!-- <span v-else>{{ row.amount }}</span>-->
  273. <!-- </template>-->
  274. <!-- <template slot="settlmentAmount" slot-scope="{ row }">-->
  275. <!-- <el-input v-if="row.$cellEdit" v-model.trim="row.settlmentAmount"-->
  276. <!-- size="small" v-input-limit="2"-->
  277. <!-- ></el-input>-->
  278. <!-- <span v-else>{{ row.settlmentAmount }}</span>-->
  279. <!-- </template>-->
  280. <!-- <template slot-scope="{row,index}" slot="menu">-->
  281. <!-- <el-button-->
  282. <!-- type="text"-->
  283. <!-- size="small"-->
  284. <!-- @click="rowCellTwo(row,index)"-->
  285. <!-- :disabled="detailData.seeDisabled"-->
  286. <!-- >{{ row.$cellEdit ? '保存' : '修改' }}-->
  287. <!-- </el-button>-->
  288. <!-- <el-button-->
  289. <!-- size="small"-->
  290. <!-- icon="el-icon-delete"-->
  291. <!-- type="text"-->
  292. <!-- @click="rowDelProject(row, index)"-->
  293. <!-- :disabled="detailData.seeDisabled"-->
  294. <!-- v-if="!row.$cellEdit"-->
  295. <!-- >删 除</el-button>-->
  296. <!-- </template>-->
  297. <!-- <template slot="menuLeft" slot-scope="{size}">-->
  298. <!-- <el-button type="primary"-->
  299. <!-- icon="el-icon-plus"-->
  300. <!-- size="small"-->
  301. <!-- @click="costIncrease"-->
  302. <!-- :disabled="detailData.seeDisabled"-->
  303. <!-- >录入明细-->
  304. <!-- </el-button>-->
  305. <!-- </template>-->
  306. <!-- </avue-crud>-->
  307. <!-- </basic-container>-->
  308. <containerTitle title="附件上传"></containerTitle>
  309. <basic-container style="margin-bottom: 40px">
  310. <avue-crud
  311. :option="bankOfDeposit"
  312. v-model="bankOfDepositForm"
  313. :data="bankOfDepositData"
  314. @row-save="rowSaveBankOfDeposit"
  315. @row-update="rowUpdateBankOfDeposit"
  316. @row-del="rowDelBankOfDeposit"
  317. :upload-after="uploadAfter"
  318. ref="uploadCrud"
  319. >
  320. <template slot="menuLeft">
  321. <el-button
  322. type="primary"
  323. icon="el-icon-plus"
  324. size="small"
  325. @click.stop="$refs.uploadCrud.rowAdd()"
  326. :disabled="detailData.seeDisabled || browse"
  327. >上传</el-button
  328. >
  329. </template>
  330. <template slot="menu" slot-scope="{ row, index }">
  331. <el-button
  332. size="small"
  333. icon="el-icon-edit"
  334. type="text"
  335. @click="$refs.uploadCrud.rowEdit(row, index)"
  336. :disabled="detailData.seeDisabled || browse"
  337. >编 辑</el-button
  338. >
  339. <el-button
  340. size="small"
  341. icon="el-icon-delete"
  342. type="text"
  343. @click="rowDelBankOfDeposit(row, index)"
  344. :disabled="detailData.seeDisabled || browse"
  345. >删 除</el-button
  346. >
  347. </template>
  348. </avue-crud>
  349. </basic-container>
  350. </el-form>
  351. </div>
  352. <el-dialog
  353. title="导入商品"
  354. append-to-body
  355. class="el-dialogDeep"
  356. :visible.sync="dialogVisible"
  357. width="80%"
  358. :close-on-click-modal="false"
  359. :destroy-on-close="true"
  360. :close-on-press-escape="false"
  361. @close="closeGoods">
  362. <el-row :style="{height: rowHeight}">
  363. <el-col :span="5" style="height: 100%;overflow-y: auto">
  364. <div>
  365. <el-scrollbar>
  366. <basic-container>
  367. <avue-tree :option="treeOption" :data="treeDataGoods" @node-click="nodeClick"/>
  368. </basic-container>
  369. </el-scrollbar>
  370. </div>
  371. </el-col>
  372. <el-col :span="19">
  373. <basic-container>
  374. <avue-crud :option="optionTwo"
  375. :table-loading="loading"
  376. :data="goodsListShow"
  377. ref="crud"
  378. @refresh-change="refreshChange"
  379. @selection-change="selectionChange"
  380. :page.sync="page"
  381. @search-change="goodsSearch"
  382. @on-load="onLoad">
  383. <template slot="menuLeft" slot-scope="{size}">
  384. <el-tabs v-model="activeName" @tab-click="tabHandle">
  385. <el-tab-pane label="查询结果" name="searchList"></el-tab-pane>
  386. <el-tab-pane label="已选定数据" name="importStaging"></el-tab-pane>
  387. </el-tabs>
  388. </template>
  389. <template slot-scope="scope" slot="menu">
  390. <el-button
  391. type="text"
  392. icon="el-icon-edit"
  393. size="small"
  394. @click.stop="importStagList(scope.row,scope.index)"
  395. v-if="activeName=='searchList'"
  396. :disabled="goodsListSave.findIndex(item => item.id == scope.row.id) !== -1"
  397. >选择
  398. </el-button>
  399. <el-button
  400. type="text"
  401. icon="el-icon-delete"
  402. size="small"
  403. @click.stop="removeStagList(scope.row,scope.index)"
  404. v-else
  405. >移除
  406. </el-button>
  407. </template>
  408. </avue-crud>
  409. </basic-container>
  410. </el-col>
  411. </el-row>
  412. <span slot="footer" class="dialog-footer">
  413. <el-button @click="dialogVisible = false">取 消</el-button>
  414. <el-button type="primary" @click="importGoods" v-if="commodityData !== true">导入</el-button>
  415. <el-button type="primary" @click="importChoice" v-if="commodityData === true"
  416. :disabled="tableData.length !== 1">导入</el-button>
  417. </span>
  418. </el-dialog>
  419. <el-dialog
  420. title="导入费用"
  421. append-to-body
  422. class="el-dialogDeep"
  423. :visible.sync="dialogCost"
  424. width="80%"
  425. :close-on-click-modal="false"
  426. :destroy-on-close="true"
  427. :close-on-press-escape="false"
  428. @close="closeFees">
  429. <el-row :style="{height: rowHeight}">
  430. <el-col :span="5" style="height: 100%;overflow-y: auto">
  431. <div>
  432. <el-scrollbar>
  433. <basic-container>
  434. <avue-tree :option="treeOptionCost" :data="treeData" @node-click="nodeClickCost"/>
  435. </basic-container>
  436. </el-scrollbar>
  437. </div>
  438. </el-col>
  439. <el-col :span="19">
  440. <basic-container>
  441. <avue-crud :option="optionTwoCost"
  442. :table-loading="loadingCost"
  443. :data="dataCost"
  444. ref="crud"
  445. @refresh-change="refreshChangeCost"
  446. @selection-change="selectionChangeCost"
  447. :page.sync="pageCost"
  448. @searchChange="feesSearch"
  449. @on-load="onLoadCost">
  450. </avue-crud>
  451. </basic-container>
  452. </el-col>
  453. </el-row>
  454. <span slot="footer" class="dialog-footer">
  455. <el-button @click="dialogCost = false">取 消</el-button>
  456. <el-button type="primary" @click="importCost" v-if="choiceData !== true">导入</el-button>
  457. <el-button type="primary" @click="choiceCost" v-if="choiceData === true"
  458. :disabled="tableDataCost.length !== 1">导入</el-button>
  459. </span>
  460. </el-dialog>
  461. <el-dialog
  462. title="账单"
  463. append-to-body
  464. class="el-dialogDeep"
  465. :visible.sync="applyPaymentDialog"
  466. width="60%"
  467. :close-on-click-modal="false"
  468. :destroy-on-close="true"
  469. :close-on-press-escape="false"
  470. v-dialog-drag
  471. >
  472. <apply-payment
  473. :billType="billType"
  474. :billData="billData"
  475. itemType="采购"
  476. @choceFun="choceFun"
  477. >
  478. </apply-payment>
  479. </el-dialog>
  480. <el-dialog
  481. append-to-body
  482. title="账单"
  483. class="el-dialogDeep"
  484. :visible.sync="financialAccountDialog"
  485. width="70%"
  486. :close-on-click-modal="false"
  487. :destroy-on-close="true"
  488. :close-on-press-escape="false"
  489. v-dialog-drag
  490. >
  491. <financial-account
  492. :billType="billType"
  493. :billData="billData"
  494. @choceFun="choceFun"
  495. >
  496. </financial-account>
  497. </el-dialog>
  498. <el-dialog
  499. title="申请记录"
  500. append-to-body
  501. class="el-dialogDeep"
  502. :visible.sync="applicationDialog"
  503. width="60%"
  504. :close-on-click-modal="false"
  505. :destroy-on-close="true"
  506. :close-on-press-escape="false"
  507. v-dialog-drag
  508. >
  509. <bill-application
  510. :billId="form.id"
  511. @choceApplication="choceApplication"
  512. >
  513. </bill-application>
  514. </el-dialog>
  515. <report-dialog
  516. :switchDialog="switchDialog"
  517. :reportId="form.id"
  518. reportName="发货通知单"
  519. @onClose="onClose()"
  520. ></report-dialog>
  521. <el-dialog
  522. append-to-body
  523. title="审批"
  524. class="el-dialogDeep"
  525. :visible.sync="checkDialog"
  526. width="50%"
  527. :close-on-click-modal="false"
  528. :destroy-on-close="true"
  529. :close-on-press-escape="false"
  530. v-dialog-drag
  531. >
  532. <check
  533. :checkData="checkData"
  534. :checkDetail="false"
  535. :idList="[]"
  536. @choceCheckFun="choceCheckFun"
  537. >
  538. </check>
  539. </el-dialog>
  540. <el-dialog
  541. append-to-body
  542. title="审批进度"
  543. class="el-dialogDeep"
  544. :visible.sync="checkScheduleDialog"
  545. width="40%"
  546. :close-on-click-modal="false"
  547. :destroy-on-close="true"
  548. :close-on-press-escape="false"
  549. v-dialog-drag
  550. >
  551. <check-schedule
  552. :checkId="checkId"
  553. :batchNo="batchNo"
  554. @choceScheduleFun="choceScheduleFun"
  555. >
  556. </check-schedule>
  557. </el-dialog>
  558. </div>
  559. </template>
  560. <script>
  561. import {
  562. typeSave,
  563. detail,
  564. corpsattn,
  565. corpsbank,
  566. corpsitem,
  567. // getList,
  568. getDeptLazyTreeS,
  569. getSysNo,
  570. generateShipment
  571. } from "@/api/basicData/purchaseOrder"
  572. import {getList} from "@/api/basicData/commodityType";
  573. import customerContact from "./configuration/customerContact.json"
  574. import advantageProject from "./configuration/advantageProject.json"
  575. import bankOfDeposit from "./configuration/bankOfDeposit.json"
  576. import commodity from "./configuration/commodity.json"
  577. import optionTwoCost from "./configuration/mainListCost.json"
  578. import {getDeptLazyTree, customerList} from "@/api/basicData/basicFeesDesc";
  579. import {selectGoodsNum} from "@/api/basicData/inventoryAccount"
  580. import { contrastObj, contrastList } from "@/util/contrastData";
  581. //账单组件
  582. import ApplyPayment from "../../../components/finance/applyPayment";
  583. import billApplication from "@/components/bill/billApplication";
  584. import { getlistBankBy, pleaseCheck, } from "@/api/basicData/configuration"
  585. import feeInfo from "@/components/fee-info/main";
  586. import {
  587. isDiscount,
  588. isPercentage,
  589. micrometerFormat,
  590. IntegerFormat
  591. } from "@/util/validate";
  592. import financialAccount from "../../../components/finance/financialAccount";
  593. import reportDialog from "@/components/report-dialog/main";
  594. import check from "@/components/check/check";
  595. import checkSchedule from "@/components/check/checkSchedule";
  596. export default {
  597. name: "detailsPage",
  598. props: {
  599. detailData: {
  600. type: Object,
  601. default: {
  602. seeDisabled: false
  603. }
  604. }
  605. },
  606. components:{
  607. ApplyPayment,
  608. billApplication,
  609. feeInfo,
  610. financialAccount,
  611. reportDialog,
  612. check,
  613. checkSchedule,
  614. },
  615. data() {
  616. return {
  617. configuration: {
  618. multipleChoices: false,
  619. multiple: false,
  620. collapseTags: false,
  621. placeholder: '请点击右边按钮选择',
  622. dicData: []
  623. },
  624. goodsConfiguration: {
  625. multipleChoices: false,
  626. multiple: false,
  627. collapseTags: false,
  628. placeholder: '请点击右边按钮选择',
  629. dicData: []
  630. },
  631. form: {},
  632. data: [],
  633. loadingCost: false,
  634. choiceData: false,
  635. commodityData: false,
  636. financialAccountDialog:false,
  637. dataCost: [],
  638. choiceIndex: '',
  639. dialogCost: false,
  640. treeDeptId: '',
  641. treeDeptIdCost: '',
  642. pageCost: {
  643. pageSize: 10,
  644. currentPage: 1,
  645. total: 0
  646. },
  647. page: {
  648. pageSize: 10,
  649. currentPage: 1,
  650. total: 0
  651. },
  652. loading: false,
  653. contactsForm: {},
  654. optionTwo: commodity,
  655. optionTwoCost: optionTwoCost,
  656. treeDataGoods: [],
  657. treeData: [],
  658. treeOptionCost: {
  659. nodeKey: 'id',
  660. lazy: true,
  661. treeLoad: function (node, resolve) {
  662. const parentId = (node.level === 0) ? 0 : node.data.id;
  663. getDeptLazyTree(parentId).then(res => {
  664. resolve(res.data.data.map(item => {
  665. return {
  666. ...item,
  667. leaf: !item.hasChildren
  668. }
  669. }))
  670. });
  671. },
  672. addBtn: false,
  673. menu: false,
  674. size: 'small',
  675. props: {
  676. labelText: '标题',
  677. label: 'title',
  678. value: 'value',
  679. children: 'children'
  680. }
  681. },
  682. treeOption: {
  683. nodeKey: 'id',
  684. lazy: true,
  685. treeLoad: function (node, resolve) {
  686. const parentId = (node.level === 0) ? 0 : node.data.id;
  687. getDeptLazyTreeS(parentId).then(res => {
  688. console.log(res.data.data)
  689. resolve(res.data.data.map(item => {
  690. return {
  691. ...item,
  692. leaf: !item.hasChildren
  693. }
  694. }))
  695. });
  696. },
  697. addBtn: false,
  698. menu: false,
  699. size: 'small',
  700. props: {
  701. labelText: '标题',
  702. label: 'title',
  703. value: 'value',
  704. children: 'children'
  705. }
  706. },
  707. billType:"申请", //账单类型
  708. billData:{}, //账单需要数据
  709. applyPaymentDialog:false,//生成账单组件
  710. applicationDialog: false,// 申请记录
  711. dialogVisible: false,
  712. advantageProjectForm: {},
  713. bankOfDepositForm: {},
  714. contactsData: [],
  715. advantageProjectData: [],
  716. saveLoading: false,
  717. disabled: false,
  718. bankOfDepositData: [],
  719. tableDataCost: [],
  720. dic: [],
  721. tableData: [],
  722. customerContact: {},
  723. advantageProject: {},
  724. bankOfDeposit: bankOfDeposit,
  725. basicData: {
  726. column: [
  727. {
  728. label: '供应商',
  729. prop: 'corpId',
  730. span: 16,
  731. rules: [
  732. {
  733. required: true,
  734. message: ' ',
  735. trigger: 'blur'
  736. }
  737. ]
  738. },{
  739. label: '付款方式',
  740. prop: 'paymentType',
  741. rules: [
  742. {
  743. required: true,
  744. message: ' ',
  745. trigger: 'blur'
  746. }
  747. ]
  748. },{
  749. label: '银行账号',
  750. prop: 'banks',
  751. rules: [
  752. {
  753. required: true,
  754. message: ' ',
  755. trigger: 'blur'
  756. }
  757. ]
  758. }, {
  759. label: '公司户头',
  760. prop: 'banksAccountName',
  761. rules: [
  762. {
  763. required: false,
  764. message: ' ',
  765. trigger: 'blur'
  766. }
  767. ]
  768. }, {
  769. label: '包装要求',
  770. prop: 'packageRemarks',
  771. rules: [
  772. {
  773. required: true,
  774. message: ' ',
  775. trigger: 'blur'
  776. }
  777. ]
  778. },
  779. {
  780. label: '系统编号',
  781. prop: 'sysNo',
  782. disabled: true,
  783. rules: [
  784. {
  785. required: false,
  786. message: ' ',
  787. trigger: 'blur'
  788. }
  789. ]
  790. }, {
  791. label: '来源单号',
  792. prop: 'orgOrderNo',
  793. disabled: true,
  794. rules: [
  795. {
  796. required: false,
  797. message: ' ',
  798. trigger: 'blur'
  799. }
  800. ]
  801. },
  802. // {
  803. // label: '预估运费',
  804. // prop: 'predictOceanFreight',
  805. // type: 'number',
  806. // rules: [
  807. // {
  808. // required: false,
  809. // message: ' ',
  810. // trigger: 'blur'
  811. // }
  812. // ]
  813. // },
  814. {
  815. label: '要求到货日期',
  816. prop: 'requiredArrivalDate',
  817. type: 'datetime',
  818. rules: [
  819. {
  820. required: true,
  821. message: ' ',
  822. trigger: 'blur'
  823. }
  824. ]
  825. }, {
  826. label: '已付金额',
  827. prop: 'settlmentAmount',
  828. type: 'number',
  829. disabled: true,
  830. rules: [
  831. {
  832. required: false,
  833. message: ' ',
  834. trigger: 'blur'
  835. }
  836. ]
  837. },{
  838. label: "备注",
  839. span: 24,
  840. prop: "orderRemark",
  841. type: 'textarea',
  842. mock: {
  843. type: 'county'
  844. }
  845. }
  846. ]
  847. },
  848. paymentOption: [],
  849. maxFeeNum: 0,
  850. maxGoodsNum: 0,
  851. selection: [],
  852. oldForm: {
  853. orderStatus: "录入"
  854. },
  855. oldGoodsList: [],
  856. oldFeesList: [],
  857. oldUploadList: [],
  858. // 弹窗高度
  859. rowHeight: '',
  860. // 查询时loading页面
  861. pageLoading: false,
  862. // 银行账号下拉
  863. bankList: [],
  864. activeName: 'searchList',
  865. // 商品列表数据合计
  866. goodsListShow: [],
  867. // 商品列表暂存
  868. goodsListSave: [],
  869. goodsListTotal: 0,
  870. goodsListSaveTotal: 0,
  871. pageList: {
  872. pageSize: 10,
  873. currentPage: 1,
  874. total: 0
  875. },
  876. itemType: '采购',
  877. packageOptions: [],
  878. switchDialog: false,
  879. // 请核状态禁用
  880. browse: false,
  881. checkDisabled: false,
  882. checkData: {},
  883. checkDialog: false,
  884. checkScheduleDialog: false,
  885. checkId: '',
  886. batchNo:'',
  887. }
  888. },
  889. mounted() {
  890. this.$nextTick(() => {
  891. // 监听浏览器高度变化,改变表格高度
  892. window.onresize = () => {
  893. this.rowHeight = (window.innerHeight - 130) + 'px'
  894. }
  895. })
  896. },
  897. filters: {
  898. IntegerFormat(num) {
  899. return IntegerFormat(num);
  900. }
  901. },
  902. //初始化查询
  903. async created() {
  904. this.rowHeight = (window.innerHeight - 130) + 'px'
  905. this.customerContact = customerContact
  906. console.log(this.customerContact)
  907. // this.customerContact = await this.getColumnData(this.getColumnName(18), customerContact);
  908. this.advantageProject = await this.getColumnData(this.getColumnName(19), advantageProject);
  909. this.getWorkDicts("payment_term").then(res => {
  910. this.paymentOption = res.data.data
  911. })
  912. this.getWorkDicts("packageRemarks").then(res => {
  913. this.packageOptions = res.data.data;
  914. });
  915. if (this.detailData.check) {
  916. this.checkDisabled = true
  917. this.batchNo = this.detailData.check.batchNo
  918. }
  919. if (this.detailData.id) {
  920. this.queryData(this.detailData.id)
  921. } else if(this.detailData.copyId) {
  922. this.queryData(this.detailData.copyId, true)
  923. } else {
  924. }
  925. },
  926. watch: {
  927. },
  928. methods: {
  929. // 明细查询
  930. queryData(id, isCopy = false) {
  931. this.pageLoading = true
  932. detail(id).then(res => {
  933. this.form = res.data.data;
  934. this.browse = this.form.status > 0? true: false
  935. this.contactsData = this.form.itemsVOList? this.form.itemsVOList: []
  936. this.advantageProjectData = this.form.orderFeesList? this.form.orderFeesList: []
  937. this.bankOfDepositData = this.form.orderFilesList? this.form.orderFilesList: []
  938. if (!this.form.itemsVOList) {
  939. this.contactsData = []
  940. } else {
  941. this.contactsData = this.form.itemsVOList
  942. }
  943. // if (!this.form.orderFeesList) {
  944. // this.advantageProjectData = []
  945. // } else {
  946. // this.advantageProjectData = this.form.orderFeesList
  947. // }
  948. // if (!this.form.orderFilesList) {
  949. // this.bankOfDepositData = []
  950. // } else {
  951. // this.bankOfDepositData = this.form.orderFilesList
  952. // }
  953. if (this.form.corpsName) {
  954. this.configuration.dicData = this.form.corpsName
  955. }
  956. let feesData = []
  957. this.advantageProjectData.forEach(item => {
  958. let a = {
  959. cname: item.corpName,
  960. id: item.corpId
  961. }
  962. feesData.push(a)
  963. })
  964. this.configuration.dicData = this.configuration.dicData.concat(feesData)
  965. // 去重
  966. this.removeRepeat()
  967. let goodsData = []
  968. this.form.orderItemsList = this.form.orderItemsList? this.form.orderItemsList: []
  969. this.form.orderItemsList.forEach(item => {
  970. let a = {
  971. cname: item.cname,
  972. }
  973. goodsData.push(a)
  974. })
  975. this.goodsConfiguration.dicData = [].concat(goodsData)
  976. this.removeGoodsRepeat()
  977. delete this.form.itemsVOList
  978. delete this.form.orderFeesList
  979. delete this.form.orderFilesList
  980. // delete this.form.corpsName
  981. // 获取最大值
  982. let num = []
  983. this.advantageProjectData.forEach(item => {
  984. num.push(item.sort)
  985. })
  986. if (num.length == 0) {
  987. this.maxFeeNum = 0;
  988. } else {
  989. this.maxFeeNum = num.reduce((a, b) => {
  990. return b > a? b: a;
  991. })
  992. }
  993. let goodsNum = []
  994. this.contactsData.forEach(item => {
  995. goodsNum.push(item.sort)
  996. })
  997. if (goodsNum.length == 0) {
  998. this.maxGoodsNum = 0;
  999. } else {
  1000. this.maxGoodsNum = goodsNum.reduce((a, b) => {
  1001. return b > a? b: a;
  1002. })
  1003. }
  1004. this.oldGoodsList = []
  1005. this.oldFeesList = []
  1006. this.oldUploadList = []
  1007. this.oldForm = Object.assign({}, this.form)
  1008. this.oldGoodsList = this.deepClone(this.contactsData)
  1009. this.oldFeesList = this.deepClone(this.advantageProjectData)
  1010. this.oldUploadList = this.deepClone(this.bankOfDepositData)
  1011. if (isCopy) {
  1012. delete this.form.sysNo;
  1013. delete this.form.id
  1014. this.contactsData.forEach(item => {
  1015. delete item.id
  1016. delete item.pid
  1017. })
  1018. this.advantageProjectData.forEach(item => {
  1019. delete item.id
  1020. delete item.pid
  1021. })
  1022. this.bankOfDepositData.forEach(item => {
  1023. delete item.id
  1024. delete item.pid
  1025. })
  1026. }
  1027. }).finally(() => {
  1028. this.saveLoading = false
  1029. this.pageLoading = false
  1030. });
  1031. },
  1032. copyOrder() {
  1033. this.queryData(this.form.id, true)
  1034. },
  1035. getGoodsRow(event,row) {
  1036. row.priceCategory = event.goodsTypeName
  1037. row.code = event.code
  1038. row.typeno = event.typeno
  1039. row.itemType = event.typeno
  1040. row.itemId = event.id
  1041. },
  1042. receiveGoodList(data) {
  1043. this.goodsConfiguration.dicData = this.goodsConfiguration.dicData.concat(data)
  1044. this.removeGoodsRepeat()
  1045. },
  1046. getRow(event,row) {
  1047. row.priceCategory = event[0].goodsTypeName
  1048. row.code = event[0].code
  1049. row.typeno = event[0].typeno
  1050. row.itemType = event[0].typeno
  1051. row.itemId = event[0].id
  1052. },
  1053. removeGoodsRepeat() {
  1054. let obj = []
  1055. this.goodsConfiguration.dicData = this.goodsConfiguration.dicData.reduce((current,next) => {
  1056. obj[next.cname] ? '': obj[next.cname] = true && current.push(next)
  1057. return current
  1058. }, [])
  1059. },
  1060. getShipmentC() {
  1061. for (let item in this.selection) {
  1062. if (!this.selection[item].id) {
  1063. return this.$message.error('选中数据有新数据,请先保存')
  1064. }
  1065. }
  1066. if (this.$store.getters.domTakeStatus) {
  1067. this.$alert("收货单存在,请保存发货单再进行操作", "温馨提示", {
  1068. confirmButtonText: "确定",
  1069. type: "warning",
  1070. callback: action => {
  1071. console.log(action);
  1072. }
  1073. });
  1074. } else {
  1075. this.generateShipmentC();
  1076. }
  1077. },
  1078. //生成收货单
  1079. generateShipmentC() {
  1080. let lsit = []
  1081. if (contrastObj(this.form, this.oldForm) ||
  1082. contrastList(this.contactsData, this.oldGoodsList) ||
  1083. contrastList(this.advantageProjectData, this.oldFeesList) ||
  1084. contrastList(this.bankOfDepositData, this.oldUploadList)
  1085. ) {
  1086. this.$confirm("数据发生变化未有提交记录, 是否保存?", "提示", {
  1087. confirmButtonText: "确定",
  1088. cancelButtonText: "取消",
  1089. type: "warning"
  1090. }).then(async () => {
  1091. await this.editCustomer(false, '收货')
  1092. }).catch(() => {
  1093. this.$message({
  1094. type: 'info',
  1095. message: '已取消'
  1096. });
  1097. })
  1098. } else {
  1099. this.selection.forEach(item => {
  1100. lsit.push(item.id)
  1101. })
  1102. let data = {
  1103. id: this.form.id,
  1104. orderItemIds: lsit
  1105. }
  1106. generateShipment(data).then(res => {
  1107. this.$router.$avueRouter.closeTag("/businessManagement/receipt/index");
  1108. this.$router.push({
  1109. path: "/businessManagement/receipt/index",
  1110. query: {form: JSON.stringify(res.data.data)},
  1111. });
  1112. })
  1113. }
  1114. },
  1115. //点击行可编辑
  1116. handleRowClick(row, event, column) {
  1117. console.log(row.$index)
  1118. },
  1119. //商品编辑
  1120. rowCell(row, index) {
  1121. console.log(row)
  1122. if (row.$cellEdit) {
  1123. if (Number(row.orderQuantity) < Number(row.actualQuantity)) {
  1124. return this.$message.error('订货数量不能小于发货数量')
  1125. }
  1126. }
  1127. this.$refs.crudContact.rowCell(row, index)
  1128. },
  1129. //费用编辑
  1130. rowCellTwo(row, index) {
  1131. console.log(row)
  1132. this.$refs.crudProject.rowCell(row, index)
  1133. },
  1134. //商品选中触发
  1135. productSelection(selection) {
  1136. this.selection = selection
  1137. },
  1138. //费用新增触发
  1139. costIncrease() {
  1140. this.dialogCost = !this.dialogCost
  1141. this.choiceData = false
  1142. },
  1143. //商品新增触发
  1144. commoditySelection() {
  1145. this.dialogVisible = !this.dialogVisible
  1146. this.tableData = []
  1147. this.commodityData = false
  1148. this.goodsListSave = [];
  1149. },
  1150. //点击费用明细选择触发
  1151. choice(row) {
  1152. this.dialogCost = !this.dialogCost
  1153. this.choiceData = true
  1154. console.log(row)
  1155. this.choiceIndex = row.$index
  1156. },
  1157. //点击商品明细选择触发
  1158. commodityChoice(row) {
  1159. this.dialogVisible = !this.dialogVisible
  1160. this.commodityData = true
  1161. console.log(row)
  1162. this.choiceIndexT = row.$index
  1163. },
  1164. //导入商品触发
  1165. importChoice() {
  1166. if (this.tableData.length === 1) {
  1167. this.contactsData[this.choiceIndexT].cname = this.tableData[0].cname
  1168. this.contactsData[this.choiceIndexT].code = this.tableData[0].code
  1169. this.contactsData[this.choiceIndexT].typeno = this.tableData[0].typeno
  1170. this.contactsData[this.choiceIndexT].itemType = this.tableData[0].typeno
  1171. this.contactsData[this.choiceIndexT].itemId = this.tableData[0].id
  1172. this.contactsData[this.choiceIndexT].priceCategory = this.tableData[0].goodsTypeName
  1173. this.contactsData[this.choiceIndexT].orderQuantity = 0
  1174. this.contactsData[this.choiceIndexT].price = 0
  1175. this.contactsData[this.choiceIndexT].amount = 0
  1176. selectGoodsNum({
  1177. goodsId: this.tableData[0].id,
  1178. itemType: this.tableData[0].typeno
  1179. }).then(res => {
  1180. this.contactsData[this.choiceIndexT].storageQuantity = res.data.data
  1181. })
  1182. }
  1183. this.dialogVisible = !this.dialogVisible
  1184. this.commodityData = false
  1185. },
  1186. //费用编辑导入触发
  1187. choiceCost() {
  1188. if (this.tableDataCost.length === 1) {
  1189. this.advantageProjectData[this.choiceIndex].feeName = this.tableDataCost[0].cname
  1190. this.advantageProjectData[this.choiceIndex].itemId = this.tableDataCost[0].id
  1191. this.advantageProjectData[this.choiceIndex].code = this.tableDataCost[0].code
  1192. }
  1193. this.dialogCost = !this.dialogCost
  1194. this.choiceData = false
  1195. },
  1196. //费用导入触发
  1197. importCost() {
  1198. // this.advantageProjectForm = this.advantageProjectForm.concat(this.tableDataCost)
  1199. if (this.tableDataCost.length > 0) {
  1200. for (let item in this.tableDataCost) {
  1201. console.log(this.tableDataCost[item])
  1202. this.tableDataCost[item].itemId = this.tableDataCost[item].id
  1203. this.tableDataCost[item].feeName = this.tableDataCost[item].cname
  1204. this.tableDataCost[item].sort = this.maxFeeNum + 1
  1205. this.maxFeeNum++
  1206. delete this.tableDataCost[item].id
  1207. this.$refs.crudProject.rowCellAdd(this.tableDataCost[item]);
  1208. this.$refs.crudProject.rowCell(this.tableDataCost[item], this.advantageProjectForm.length - 1)
  1209. }
  1210. }
  1211. this.tableDataCost = []
  1212. this.dialogCost = false
  1213. },
  1214. //确认导入触发
  1215. importGoods() {
  1216. if (this.goodsListSave.length > 0) {
  1217. for (let item in this.goodsListSave) {
  1218. selectGoodsNum({
  1219. goodsId: this.goodsListSave[item].id,
  1220. itemType: this.goodsListSave[item].typeno
  1221. }).then(res => {
  1222. this.$set(this.goodsListSave[item], 'storageQuantity', res.data.data)
  1223. this.goodsListSave[item].itemId = this.goodsListSave[item].id
  1224. this.goodsListSave[item].priceCategory = this.goodsListSave[item].goodsTypeName
  1225. delete this.goodsListSave[item].id
  1226. this.$set(this.goodsListSave[item], 'itemType', this.goodsListSave[item].typeno)
  1227. this.$set(this.goodsListSave[item], 'specificationAndModel', this.goodsListSave[item].typeno)
  1228. this.$set(this.goodsListSave[item], 'priceType', '一般')
  1229. this.$set(this.goodsListSave[item], 'orderQuantity', 0)
  1230. this.$set(this.goodsListSave[item], 'actualQuantity', 0)
  1231. this.goodsListSave[item].price = 0
  1232. this.goodsListSave[item].amount = 0
  1233. this.goodsListSave[item].sort = this.maxGoodsNum + 1
  1234. this.maxGoodsNum++
  1235. this.$refs.crudContact.rowCellAdd(this.goodsListSave[item]);
  1236. // this.$refs.crudContact.rowCell(this.goodsListSave[item], this.goodsListSave.length - 1)
  1237. })
  1238. }
  1239. } else {
  1240. for (let item in this.tableData) {
  1241. selectGoodsNum({
  1242. goodsId: this.tableData[item].id,
  1243. itemType: this.tableData[item].typeno
  1244. }).then(res => {
  1245. this.$set(this.tableData[item], 'storageQuantity', res.data.data)
  1246. this.tableData[item].itemId = this.tableData[item].id
  1247. this.tableData[item].priceCategory = this.tableData[item].goodsTypeName
  1248. delete this.tableData[item].id
  1249. this.$set(this.tableData[item], 'itemType', this.tableData[item].typeno)
  1250. this.$set(this.tableData[item], 'specificationAndModel', this.tableData[item].typeno)
  1251. this.$set(this.tableData[item], 'priceType', '一般')
  1252. this.$set(this.tableData[item], 'orderQuantity', 0)
  1253. this.$set(this.tableData[item], 'actualQuantity', 0)
  1254. this.tableData[item].price = 0
  1255. this.tableData[item].amount = 0
  1256. this.tableData[item].sort = this.maxGoodsNum + 1
  1257. this.maxGoodsNum++
  1258. this.$refs.crudContact.rowCellAdd(this.tableData[item]);
  1259. // this.$refs.crudContact.rowCell(this.tableData[item], this.tableData.length - 1)
  1260. })
  1261. }
  1262. }
  1263. if (this.tableData.length > 0) {
  1264. }
  1265. this.dialogVisible = false
  1266. },
  1267. closeGoods() {
  1268. this.treeDataGoods = [];
  1269. this.treeDeptId = "";
  1270. this.activeName = "searchList";
  1271. },
  1272. closeFees() {
  1273. this.treeDeptIdCost = "";
  1274. this.treeData = [];
  1275. },
  1276. //选中触发
  1277. selectionChange(list) {
  1278. console.log(list);
  1279. this.tableData = list
  1280. },
  1281. //费用选中触发
  1282. selectionChangeCost(list) {
  1283. console.log(list);
  1284. this.tableDataCost = list
  1285. },
  1286. //导入页左商品类型查询
  1287. nodeClick(data) {
  1288. this.treeDeptId = data.id;
  1289. this.page.currentPage = 1;
  1290. this.onLoad(this.page);
  1291. },
  1292. //导入页左费用类型查询
  1293. nodeClickCost(data) {
  1294. this.treeDeptIdCost = data.id;
  1295. this.pageCost.currentPage = 1;
  1296. this.onLoadCost(this.pageCost);
  1297. },
  1298. //刷新触发
  1299. refreshChange() {
  1300. this.treeDeptId = '';
  1301. this.page.currentPage = 1;
  1302. this.onLoad(this.page);
  1303. },
  1304. //费用刷新触发
  1305. refreshChangeCost() {
  1306. this.treeDeptIdCost = '';
  1307. this.pageCost.currentPage = 1;
  1308. this.onLoadCost(this.pageCost);
  1309. },
  1310. //新增商品信息保存触发
  1311. rowSave(row, done, loading) {
  1312. console.log(row)
  1313. console.log(this.contactsData)
  1314. // this.contactsData.push(row)
  1315. done()
  1316. },
  1317. //修改商品信息触发
  1318. rowUpdate(row, index, done, loading) {
  1319. done(row);
  1320. },
  1321. //删除商品信息触发
  1322. rowDel(row, index, donerowDel) {
  1323. this.$confirm("确定将选择数据删除?", {
  1324. confirmButtonText: "确定",
  1325. cancelButtonText: "取消",
  1326. type: "warning"
  1327. }).then(() => {
  1328. //商品判断是否需要调用删除接口
  1329. if (row.id) {
  1330. corpsattn(row.id).then(res => {
  1331. this.$message({
  1332. type: "success",
  1333. message: "操作成功!"
  1334. });
  1335. this.contactsData.splice(index, 1);
  1336. })
  1337. } else {
  1338. this.$message({
  1339. type: "success",
  1340. message: "操作成功!"
  1341. });
  1342. this.contactsData.splice(index, 1);
  1343. }
  1344. })
  1345. },
  1346. //新增费用明细保存触发
  1347. rowSaveProject(row, done, loading) {
  1348. // this.advantageProjectData.push(row)
  1349. done()
  1350. },
  1351. //修改费用明细触发
  1352. rowUpdateProject(row, index, done, loading) {
  1353. done(row);
  1354. },
  1355. goodsSearch(params, done) {
  1356. this.treeDeptId = '';
  1357. this.onLoad(this.page, params);
  1358. done()
  1359. },
  1360. //商品列表查询
  1361. onLoad(page, params = {}) {
  1362. this.loading = true;
  1363. getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
  1364. const data = res.data.data;
  1365. this.page.total = data.total;
  1366. this.data = data.records;
  1367. this.goodsListShow = data.records;
  1368. this.loading = false;
  1369. });
  1370. },
  1371. // 费用查询按钮
  1372. feesSearch(params, done) {
  1373. this.treeDeptIdCost = '';
  1374. this.onLoadCost(this.pageCost, params)
  1375. done()
  1376. },
  1377. //费用查询
  1378. onLoadCost(page, params = {}) {
  1379. this.loadingCost = true;
  1380. let queryParams = Object.assign({}, params, {
  1381. pageSize: page.pageSize,
  1382. pageNum: page.currentPage,
  1383. parentId: 0,
  1384. feesTypeId: this.treeDeptIdCost
  1385. })
  1386. customerList(queryParams).then(res => {
  1387. console.log(res)
  1388. const data = res.data.data;
  1389. this.pageCost.total = data.total;
  1390. this.dataCost = data.records;
  1391. this.loadingCost = false;
  1392. });
  1393. },
  1394. //删除费用明细触发
  1395. rowDelProject(row, index, donerowDel) {
  1396. this.$confirm("确定将选择数据删除?", {
  1397. confirmButtonText: "确定",
  1398. cancelButtonText: "取消",
  1399. type: "warning"
  1400. }).then(() => {
  1401. //费用判断是否需要调用删除接口
  1402. if (row.id) {
  1403. corpsitem(row.id).then(res => {
  1404. this.$message({
  1405. type: "success",
  1406. message: "操作成功!"
  1407. });
  1408. this.advantageProjectData.splice(index, 1);
  1409. })
  1410. } else {
  1411. this.$message({
  1412. type: "success",
  1413. message: "操作成功!"
  1414. });
  1415. this.advantageProjectData.splice(index, 1);
  1416. }
  1417. })
  1418. },
  1419. //新增附件上传保存触发
  1420. rowSaveBankOfDeposit(row, done, loading) {
  1421. this.bankOfDepositData.push(row)
  1422. done()
  1423. },
  1424. //修改附件上传触发
  1425. rowUpdateBankOfDeposit(row, index, done, loading) {
  1426. done(row);
  1427. },
  1428. //删除附件上传触发
  1429. rowDelBankOfDeposit(row, index, donerowDel) {
  1430. this.$confirm("确定将选择数据删除?", {
  1431. confirmButtonText: "确定",
  1432. cancelButtonText: "取消",
  1433. type: "warning"
  1434. }).then(() => {
  1435. //附件判断是否需要调用删除接口
  1436. if (row.id) {
  1437. corpsbank(row.id).then(res => {
  1438. this.$message({
  1439. type: "success",
  1440. message: "操作成功!"
  1441. });
  1442. this.bankOfDepositData.splice(index, 1);
  1443. })
  1444. } else {
  1445. this.$message({
  1446. type: "success",
  1447. message: "操作成功!"
  1448. });
  1449. this.bankOfDepositData.splice(index, 1);
  1450. }
  1451. })
  1452. },
  1453. uploadAfter(res, done) {
  1454. if (res.originalName) {
  1455. this.bankOfDepositForm.fileName = this.bankOfDepositForm.fileName
  1456. ? this.bankOfDepositForm.fileName
  1457. : res.originalName;
  1458. }
  1459. done();
  1460. },
  1461. // 计算费用
  1462. changeContractAmt(row) {
  1463. let orderQuantity = 0;
  1464. let purchaseAmount = 0;
  1465. if (row.price) {
  1466. purchaseAmount = row.purchaseAmount;
  1467. }
  1468. if (row.orderQuantity) {
  1469. orderQuantity = row.orderQuantity;
  1470. }
  1471. this.$set(row, "amount", Number(orderQuantity) * Number(purchaseAmount)).toFixed(2);
  1472. },
  1473. // 去重
  1474. removeRepeat() {
  1475. let obj = []
  1476. this.configuration.dicData = this.configuration.dicData.reduce((current,next) => {
  1477. obj[next.id] ? '': obj[next.id] = true && current.push(next)
  1478. return current
  1479. }, [])
  1480. },
  1481. receiveList(data){
  1482. this.configuration.dicData = this.configuration.dicData.concat(data)
  1483. this.removeRepeat()
  1484. },
  1485. //修改提交触发
  1486. editCustomer(isBack = false, type) {
  1487. this.$refs["form"].validate((valid) => {
  1488. if (valid) {
  1489. for (let item in this.contactsData) {
  1490. if (Number(this.contactsData[item].orderQuantity) < Number(this.contactsData[item].actualQuantity)) {
  1491. return this.$message.error('商品信息第'+ (parseInt(item) + 1) + '行订货数量不能小于发货数量')
  1492. }
  1493. }
  1494. this.form.orderAmount = 0;
  1495. this.contactsData.forEach(item => {
  1496. this.form.orderAmount = Number(this.form.orderAmount) + Number(item.amount)
  1497. })
  1498. //商品信息
  1499. this.form.itemsVOList = this.contactsData
  1500. // this.form.orderFeesList = this.advantageProjectData
  1501. this.form.orderFeesList = this.$refs.feeInfo.submitData()
  1502. this.form.orderFilesList = this.bankOfDepositData
  1503. if (typeof this.form.corpsTypeId == 'object') {
  1504. this.form.corpsTypeId = this.form.corpsTypeId.join(",")
  1505. }
  1506. this.saveLoading = true
  1507. this.form.billType = 'CG'
  1508. this.$set(this.form, 'tradeType', 'GN')
  1509. typeSave(this.form).then(res => {
  1510. this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
  1511. // this.saveLoading = false
  1512. if (isBack) {
  1513. //成功关闭此页面回到列表页
  1514. this.$emit("goBack");
  1515. } else {
  1516. this.queryData(res.data.data)
  1517. }
  1518. if (type == '收货') {
  1519. let lsit = []
  1520. this.selection.forEach(item => {
  1521. lsit.push(item.id)
  1522. })
  1523. let data = {
  1524. id: this.form.id,
  1525. orderItemIds: lsit
  1526. }
  1527. generateShipment(data).then(res => {
  1528. this.$router.$avueRouter.closeTag("/businessManagement/receipt/index");
  1529. this.$router.push({
  1530. path: "/businessManagement/receipt/index",
  1531. query: {form: JSON.stringify(res.data.data)},
  1532. });
  1533. })
  1534. }
  1535. }).catch(() => {
  1536. this.saveLoading = false
  1537. })
  1538. } else {
  1539. return false;
  1540. }
  1541. });
  1542. },
  1543. beforeBillData(bool,type){
  1544. this.billType = type
  1545. //采购明细提单号 list
  1546. this.billData = {
  1547. srcOrderno:this.form.orderNo,
  1548. itemType:"采购",
  1549. corpsName:this.form.corpsName,
  1550. corpId:this.form.corpId,
  1551. srcParentId: this.form.id,
  1552. currency: 'CNY',
  1553. exchangeRate: '1',
  1554. taxRate: '0',
  1555. accDate: this.form.businesDate,
  1556. srcType: 1,
  1557. tradeType: 'GN',
  1558. optionType: 'GN',
  1559. amount: this.form.orderAmount
  1560. }
  1561. if(bool){ //申请货款
  1562. this.billData.srcId = -1
  1563. }
  1564. },
  1565. // 查看申请记录
  1566. openApplicationDialog(){
  1567. this.applicationDialog = true
  1568. },
  1569. //关闭申记录
  1570. choceApplication(){
  1571. this.applicationDialog = false
  1572. },
  1573. //申请货款
  1574. applyPayment(type){
  1575. // if (contrastObj(this.form, this.oldForm) ||
  1576. // contrastList(this.contactsData, this.oldGoodsList) ||
  1577. // contrastList(this.advantageProjectData, this.oldFeesList) ||
  1578. // contrastList(this.bankOfDepositData, this.oldUploadList)
  1579. // ) {
  1580. // this.$confirm("您已改动数据,是否先保存在进行操作!", {
  1581. // confirmButtonText: "保存",
  1582. // cancelButtonText: "取消",
  1583. // type: "warning"
  1584. // }).then(() => {
  1585. // this.editCustomer();
  1586. // })
  1587. // }else{
  1588. this.beforeBillData(true,type);
  1589. this.financialAccountDialog = true;
  1590. // }
  1591. },
  1592. //关闭账单
  1593. choceFun(){
  1594. this.financialAccountDialog = false
  1595. },
  1596. //返回列表
  1597. backToList() {
  1598. if (contrastObj(this.form, this.oldForm) ||
  1599. contrastList(this.contactsData, this.oldGoodsList) ||
  1600. contrastList(this.advantageProjectData, this.oldFeesList) ||
  1601. contrastList(this.bankOfDepositData, this.oldUploadList)
  1602. ) {
  1603. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  1604. confirmButtonText: "确定",
  1605. cancelButtonText: "取消",
  1606. type: "warning"
  1607. }).then(() => {
  1608. this.editCustomer(true)
  1609. }).catch(() => {
  1610. this.$emit("goBack");
  1611. })
  1612. } else {
  1613. this.$emit("goBack");
  1614. }
  1615. },
  1616. // 保存列设置
  1617. async saveColumn(name) {
  1618. if (name == 'goods') {
  1619. const inSave = await this.saveColumnData(
  1620. this.getColumnName(18),
  1621. this.customerContact
  1622. );
  1623. if (inSave) {
  1624. this.$message.success("保存成功");
  1625. //关闭窗口
  1626. this.$refs.crudContact.$refs.dialogColumn.columnBox = false;
  1627. }
  1628. } else if (name === 'fees') {
  1629. const inSave = await this.saveColumnData(
  1630. this.getColumnName(19),
  1631. this.advantageProject
  1632. );
  1633. if (inSave) {
  1634. this.$message.success("保存成功");
  1635. //关闭窗口
  1636. this.$refs.crudProject.$refs.dialogColumn.columnBox = false;
  1637. }
  1638. }
  1639. },
  1640. async resetColumn() {
  1641. const inSave = await this.delColumnData(
  1642. this.getColumnName(18),
  1643. customerContact
  1644. );
  1645. if (inSave) {
  1646. this.$message.success("重置成功");
  1647. //关闭窗口
  1648. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  1649. }
  1650. },
  1651. returnBack(row) {
  1652. this.$set(this.form, 'paymentType', row.paymentType)
  1653. this.$set(this.form, 'packageRemarks', row.packageRemarks)
  1654. getlistBankBy(row.id).then(res =>{
  1655. this.$set(this.form, 'banks', null)
  1656. this.$set(this.form, 'banksAccountName', null)
  1657. this.$set(this.form, 'accountBank', null)
  1658. this.bankList = res.data
  1659. if (this.bankList.length > 0) {
  1660. this.form.banks = this.bankList[0].accountNo
  1661. this.form.banksAccountName = this.bankList[0].accountName
  1662. this.form.accountBank = this.bankList[0].accountBank
  1663. }
  1664. })
  1665. },
  1666. // 银行账号变化
  1667. banksChange(val) {
  1668. let isTrue = false
  1669. this.bankList.forEach(item => {
  1670. if (val == item.accountNo) {
  1671. this.$set(this.form, 'banksAccountName', item.accountName)
  1672. this.$set(this.form, 'accountBank', item.accountBank)
  1673. isTrue = true
  1674. }
  1675. })
  1676. if (!isTrue) {
  1677. this.$set(this.form, 'banksAccountName', null)
  1678. this.$set(this.form, 'accountBank', null)
  1679. }
  1680. },
  1681. // 标签页切换
  1682. tabHandle(data) {
  1683. if (data.name == 'searchList') {
  1684. this.goodsListShow = this.data;
  1685. this.page.total = this.pageList.total
  1686. } else if (data.name == 'importStaging') {
  1687. this.goodsListShow = this.goodsListSave;
  1688. this.page.total = 0
  1689. }
  1690. },
  1691. removeStagList(row, index) {
  1692. this.goodsListSave.splice(index, 1)
  1693. },
  1694. importStagList(row, index) {
  1695. this.goodsListSave.push(row);
  1696. },
  1697. beforeFinance(feesData,callback) {
  1698. this.advantageProjectData = feesData;
  1699. let params = {}
  1700. params.valid = true
  1701. params.parentId = this.form.id
  1702. params.srcOrderno = this.form.orderNo
  1703. callback(params)
  1704. },
  1705. // 报表
  1706. openReport() {
  1707. this.switchDialog =! this.switchDialog;
  1708. },
  1709. onClose(val) {
  1710. this.switchDialog = val;
  1711. },
  1712. //请核
  1713. pleaseCheck() {
  1714. // this.verification()
  1715. if (this.verification()) {
  1716. this.$confirm("您确定提交此次申请吗?", {
  1717. confirmButtonText: "确定",
  1718. cancelButtonText: "取消",
  1719. type: "warning"
  1720. }).then(() => {
  1721. const data = {
  1722. id : this.form.id,
  1723. checkType: 'cgqh',
  1724. url: '/businessManagement/purchaseOrder/index',
  1725. pageStatus:"this.$store.getters.domPurStatus",
  1726. pageLabel:"采购订单(N)",
  1727. checkFlag: 1,
  1728. }
  1729. this.pageLoading = true
  1730. pleaseCheck(data).then(res => {
  1731. this.$message.success('请核成功')
  1732. // this.pageLoading = false
  1733. this.saveActives = ''
  1734. this.queryData(this.form.id)
  1735. }).finally(() => {
  1736. this.pageLoading = false
  1737. })
  1738. })
  1739. } else {
  1740. }
  1741. },
  1742. verification() {
  1743. let getFeeList = this.$refs.feeInfo.submitData()
  1744. if (contrastObj(this.form, this.oldForm) ||
  1745. contrastList(this.contactsData, this.oldGoodsList) ||
  1746. // contrastList(getFeeList, this.oldFeesList) ||
  1747. contrastList(this.bankOfDepositData, this.oldUploadList)
  1748. ) {
  1749. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  1750. confirmButtonText: "确定",
  1751. cancelButtonText: "取消",
  1752. type: "warning"
  1753. }).then(() => {
  1754. this.editCustomer(false)
  1755. }).catch(() => {
  1756. return false; //取消改动数据
  1757. })
  1758. } else {
  1759. return true; //没有动过数据
  1760. }
  1761. },
  1762. //打开审核
  1763. openCheckDialog(){
  1764. this.checkData = this.detailData.check
  1765. this.checkDialog = true;
  1766. },
  1767. //关闭审核
  1768. choceCheckFun(){
  1769. this.checkDialog = false;
  1770. },
  1771. choceScheduleFun(){
  1772. this.checkScheduleDialog = false
  1773. },
  1774. }
  1775. }
  1776. </script>
  1777. <style lang="scss" scoped>
  1778. .back-icon {
  1779. line-height: 64px;
  1780. font-size: 20px;
  1781. margin-right: 8px;
  1782. }
  1783. //.add-customer-btn {
  1784. // position: fixed;
  1785. // right: 36px;
  1786. // top: 115px;
  1787. //}
  1788. ::v-deep .el-form-item {
  1789. margin-bottom: 0;
  1790. }
  1791. .el-dialogDeep {
  1792. ::v-deep .el-dialog {
  1793. margin: 1vh auto 0 !important;
  1794. padding-bottom: 10px !important;
  1795. .el-dialog__body, .el-dialog__footer {
  1796. padding-bottom: 0 !important;
  1797. padding-top: 0 !important;
  1798. }
  1799. }
  1800. }
  1801. .print-div {
  1802. color: #000;
  1803. }
  1804. .print_table {
  1805. table {
  1806. border-right: 1px solid #000;
  1807. border-bottom: 1px solid #000;
  1808. font-size: 12px;
  1809. margin-bottom: 5px;
  1810. }
  1811. table td {
  1812. border-left: 1px solid #000;
  1813. border-top: 1px solid #000;
  1814. vertical-align: middle;
  1815. padding: 2px;
  1816. text-align: center;
  1817. }
  1818. }
  1819. .table {
  1820. border-collapse: collapse;
  1821. border-spacing: 0;
  1822. background-color: transparent;
  1823. display: table;
  1824. width: 99%;
  1825. max-width: 100%;
  1826. margin: 0 auto;
  1827. }
  1828. .table td {
  1829. text-align: left;
  1830. vertical-align: middle;
  1831. font-size: 14px;
  1832. color: #000000;
  1833. padding: 10.5px 0 10.5px 30px;
  1834. //border: 1px solid #000;
  1835. }
  1836. ::v-deep .el-form-item {
  1837. margin-bottom: 0;
  1838. }
  1839. ::v-deep .el-form-item__content{
  1840. line-height: 32px;
  1841. }
  1842. </style>