record.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823
  1. <template>
  2. <div class="bg" id="index">
  3. <el-row class="row_top">
  4. <el-col :span="12">
  5. <el-date-picker @change="datechange" format="yyyy-MM-dd" v-model="value2" type="daterange" unlink-panels
  6. range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
  7. </el-date-picker>
  8. <el-input style="width:40%;" :placeholder="'可按业务编号、车牌号、客户名、货名查找'" clearable v-model="searchKeyWord" class="search_css"></el-input>
  9. <el-button type="primary" size="small" @click="lookup" class="search">查找</el-button>
  10. </el-col>
  11. <el-col style="text-align:right" :span="12">
  12. <!-- <el-button v-hasPermission="`speedEdition.inOutRecordJsb.batch` " type="primary" size="small" @click="batchPay(1)">批量收款</el-button>
  13. <el-button v-hasPermission="`speedEdition.inOutRecordJsb.batch` " type="primary" size="small" @click="batchPay(2)">批量付款</el-button>
  14. <el-button v-hasPermission="`speedEdition.inOutRecordJsb.import` " type="primary" size="small" @click="exportExcel()">导出</el-button>
  15. <el-button v-hasPermission="`speedEdition.inOutRecordJsb.tray`" type="primary" size="small" @click="handlestatus(1)">盘亏</el-button>
  16. <el-button v-hasPermission="`speedEdition.inOutRecordJsb.tray`" type="primary" size="small" @click="handlestatus(2)">盘盈</el-button> -->
  17. <el-button type="primary" size="small" @click="batchPay(1)">批量收款</el-button>
  18. <el-button type="primary" size="small" @click="batchPay(2)">批量付款</el-button>
  19. <el-button type="primary" size="small" @click="exportExcel()">导出</el-button>
  20. <el-button type="primary" size="small" @click="handlestatus(1)">盘亏</el-button>
  21. <el-button type="primary" size="small" @click="handlestatus(2)">盘盈</el-button>
  22. </el-col>
  23. </el-row>
  24. <div class="row2">
  25. <div class="left">
  26. <!-- <el-button v-hasPermission="`speedEdition.inOutRecordJsb.status` " :type="searchType==''?'primary':''" size="small" @click="search(0)">全部</el-button>
  27. <el-button v-hasPermission="`speedEdition.inOutRecordJsb.status` " :type="searchType==1?'primary':''" size="small" @click="search(1)">入库记录</el-button>
  28. <el-button v-hasPermission="`speedEdition.inOutRecordJsb.status` " :type="searchType==2?'primary':''" size="small" @click="search(2)">出库记录</el-button>
  29. <el-button v-hasPermission="`speedEdition.inOutRecordJsb.status` " :type="status=='已付'?'primary':''" size="small" @click="search('已付')">已付</el-button>
  30. <el-button v-hasPermission="`speedEdition.inOutRecordJsb.status` " :type="status=='未付'?'primary':''" size="small" @click="search('未付')">未付</el-button>
  31. <el-button v-hasPermission="`speedEdition.inOutRecordJsb.status` " :type="status=='已收'?'primary':''" size="small" @click="search('已收')">已收</el-button>
  32. <el-button v-hasPermission="`speedEdition.inOutRecordJsb.status` " :type="status=='未收'?'primary':''" size="small" @click="search('未收')">未收</el-button> -->
  33. <el-button :type="searchType==''?'primary':''" size="small" @click="search(0)">全部</el-button>
  34. <el-button :type="searchType==1?'primary':''" size="small" @click="search(1)">入库记录</el-button>
  35. <el-button :type="searchType==2?'primary':''" size="small" @click="search(2)">出库记录</el-button>
  36. <el-button :type="status=='已付'?'primary':''" size="small" @click="search('已付')">已付</el-button>
  37. <el-button :type="status=='未付'?'primary':''" size="small" @click="search('未付')">未付</el-button>
  38. <el-button :type="status=='已收'?'primary':''" size="small" @click="search('已收')">已收</el-button>
  39. <el-button :type="status=='未收'?'primary':''" size="small" @click="search('未收')">未收</el-button>
  40. </div>
  41. <div class="right">
  42. <el-select v-model="value" placeholder="请选择" @change="changeGoodsName">
  43. <el-option v-for="item in goodsList" :key="item.id" :label="item.goodsName" :value="item.goodsName">
  44. </el-option>
  45. </el-select>
  46. <div class="text">合计【{{ storage }}】吨</div>
  47. <div class="text">加权成本【{{ weightedCost }}】元/吨</div>
  48. <!-- <el-button v-hasPermission="`speedEdition.inOutRecordJsb.zero`" type="primary" size="small" @click="zero()">计算</el-button> -->
  49. <el-button type="primary" size="small" @click="zero()">计算</el-button>
  50. </div>
  51. </div>
  52. <div>
  53. <el-table ref="multipleTable" :data="tableData" tooltip-effect="dark" style="width: 100%"
  54. @selection-change="handleSelectionChange" class="table">
  55. <el-table-column type="selection" width="55">
  56. </el-table-column>
  57. <el-table-column label="业务编号" width="120" prop="businessNo">
  58. </el-table-column>
  59. <el-table-column prop="positionNo" label="仓位"></el-table-column>
  60. <el-table-column prop="address" label="类型" show-overflow-tooltip>
  61. <template slot-scope="scope">
  62. <div v-if="scope.row.inOutFlag == 1">出库</div>
  63. <div v-else>入库</div>
  64. </template>
  65. </el-table-column>
  66. <el-table-column prop="carNumber" label="车牌号" show-overflow-tooltip>
  67. </el-table-column>
  68. <el-table-column prop="customerName" label="客户" show-overflow-tooltip>
  69. <template slot-scope="scope">
  70. <div style="color:cornflowerblue" v-if="scope.row.customerId" @click="selectCustomer(scope.row)">
  71. {{ scope.row.customerName }}</div>
  72. <div v-else>{{ scope.row.customerName }}</div>
  73. </template>
  74. </el-table-column>
  75. <el-table-column prop="goodsName" label="货名" show-overflow-tooltip>
  76. </el-table-column>
  77. <el-table-column prop="grossWeight" label="毛重(吨)" show-overflow-tooltip>
  78. </el-table-column>
  79. <el-table-column prop="tare" label="皮重(吨)" show-overflow-tooltip>
  80. </el-table-column>
  81. <el-table-column prop="netWeight" label="净重(吨)" show-overflow-tooltip>
  82. </el-table-column>
  83. <el-table-column prop="bulkDensity" label="容重(克/升)" width="100">
  84. </el-table-column>
  85. <el-table-column prop="waterContent" label="水分(%)" show-overflow-tooltip>
  86. </el-table-column>
  87. <el-table-column prop="address" label="更多指标" >
  88. <template slot-scope="scope">
  89. <div v-if="scope.row.carNumber!='盘盈'&&scope.row.carNumber!='盘亏'" @click="moreindicator(scope.row)" style="color:cornflowerblue">查看</div>
  90. <!-- <div style="color:cornflowerblue" @click="moreInfo(scope.row)">查看</div> -->
  91. </template>
  92. </el-table-column>
  93. <el-table-column prop="unitPrice" label="单价(元/吨)" width="100">
  94. </el-table-column>
  95. <el-table-column prop="grainFund" label="粮款(元)" show-overflow-tooltip>
  96. </el-table-column>
  97. <el-table-column prop="address" label="备注" >
  98. <template slot-scope="scope">
  99. <el-popover v-if="scope.row.remark"
  100. placement="bottom"
  101. title="备注"
  102. width="200"
  103. trigger="click"
  104. :content="scope.row.remark">
  105. <div slot="reference" style="color:cornflowerblue">查看</div>
  106. </el-popover>
  107. </template>
  108. </el-table-column>
  109. <el-table-column prop="createDate" label="日期" width="140">
  110. </el-table-column>
  111. <el-table-column prop="status" label="收支状态" show-overflow-tooltip>
  112. <template slot-scope="scope">
  113. <div v-if="scope.row.carNumber!='盘盈'&&scope.row.carNumber!='盘亏'" style="display:flex;align-items: center">
  114. <div >{{ scope.row.status }}</div>
  115. <img src="../../../public/img/change.png" alt="" width="18" height="20"
  116. style="vertical-align: text-top; position: relative; top: -1px" @click="changeStatus(scope.row)">
  117. </div>
  118. </template>
  119. </el-table-column>
  120. <el-table-column prop="address" label="附件" show-overflow-tooltip>
  121. <template slot-scope="scope">
  122. <img width="18" height="20" style="vertical-align: text-top; position: relative; top: -1px"
  123. src="../../../public/img/fujian.png" @click="fujian(scope.row)" alt="" />
  124. <span v-if="scope.row.addressUrlArray != null">
  125. {{
  126. scope.row.addressUrlArray.length == 0
  127. ? ''
  128. : scope.row.addressUrlArray.length
  129. }}
  130. </span>
  131. </template>
  132. </el-table-column>
  133. <el-table-column prop="address" label="操作" show-overflow-tooltip>
  134. <template scope="scope">
  135. <span style="color: red;" @click="del(scope.row)">删除</span>
  136. </template>
  137. </el-table-column>
  138. </el-table>
  139. </div>
  140. <div style="text-align: center; padding: 10px">
  141. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
  142. :page-size="deptCircularPage.pageSize" :page-sizes="[10, 30, 50, 100, 500, 1000]" layout="total, sizes, prev, pager, next, jumper" :total="deptBudgetTotal">
  143. </el-pagination>
  144. <WinseaContentModal v-model="accessoryTFs" @on-cancel="handleClose">
  145. <div>
  146. <ws-upload ref="upload" :size-limit="size" @onChange="onChange" :comp-id="compId" :appendix-ids="appendixIdss"
  147. accept=".jpg, .jpeg, .png, .pdf, .doc, .docx, .zip, .rar" />
  148. </div>
  149. </WinseaContentModal>
  150. </div>
  151. <el-dialog :close-on-click-modal="false" width="320px" title="更多指标" :visible.sync="isShowindex" :append-to-body="true" :close="indexclose">
  152. <el-form class="customer" label-position="right" label-width="120px">
  153. <el-form-item class="customer-item" label="容重(克/升)">
  154. <el-input disabled maxlength="100" size="small" v-model="goodindexObj.bulkDensity" />
  155. </el-form-item>
  156. <el-form-item class="customer-item" label="水分(%)">
  157. <el-input disabled size="small" v-model="goodindexObj.waterContent" />
  158. </el-form-item>
  159. <el-form-item class="customer-item" label="蛋白(%)">
  160. <el-input disabled v-model="goodindexObj.protein" size="small" />
  161. </el-form-item>
  162. <el-form-item class="customer-item" label="杂质(%)">
  163. <el-input disabled v-model="goodindexObj.impurity" size="small" />
  164. </el-form-item>
  165. <el-form-item class="customer-item" label="霉变粒(%)">
  166. <el-input disabled v-model="goodindexObj.mildewGrain" size="small" />
  167. </el-form-item>
  168. <el-form-item class="customer-item" label="热损伤(%)">
  169. <el-input disabled v-model="goodindexObj.jiaorenli" size="small" />
  170. </el-form-item>
  171. <el-form-item class="customer-item" label="不完善粒(%)">
  172. <el-input disabled v-model="goodindexObj.imperfectGrain" size="small" />
  173. </el-form-item>
  174. </el-form>
  175. </el-dialog>
  176. <el-dialog :close-on-click-modal="false" width="320px" title="客户信息" :visible.sync="isShowCustomer" :append-to-body="true" :close="customerclose">
  177. <el-form class="customer" label-position="right" label-width="120px">
  178. <el-form-item class="customer-item" label="姓名">
  179. <el-input disabled maxlength="100" size="small" v-model="customerObj.customerName" />
  180. </el-form-item>
  181. <el-form-item class="customer-item" label="手机号">
  182. <el-input disabled size="small" v-model="customerObj.customerPhone" />
  183. </el-form-item>
  184. <el-form-item class="customer-item" label="银行卡号">
  185. <el-input disabled v-model="customerObj.bankCard" size="small" />
  186. </el-form-item>
  187. <el-form-item class="customer-item" label="开户行">
  188. <el-input disabled v-model="customerObj.bankDeposit" size="small" />
  189. </el-form-item>
  190. <el-form-item class="customer-item" label="开户支行">
  191. <el-input disabled v-model="customerObj.bankDepositBranch" size="small" />
  192. </el-form-item>
  193. </el-form>
  194. </el-dialog>
  195. <!-- <el-dialog width="320px" title="指标信息" :visible.sync="isShowMoreInfo" :append-to-body="true" :close="moreInfoClose">
  196. <el-form class="customer" label-position="right" label-width="80px">
  197. <el-form-item label="水分">
  198. <el-input disabled size="small" v-model="moreInfoObj.waterContent" />
  199. </el-form-item>
  200. <el-form-item label="杂质">
  201. <el-input disabled size="small" v-model="moreInfoObj.impurity" />
  202. </el-form-item>
  203. <el-form-item label="霉变粒">
  204. <el-input disabled size="small" v-model="moreInfoObj.mildewGrain" />
  205. </el-form-item>
  206. <el-form-item label="不完善粒">
  207. <el-input disabled size="small" v-model="moreInfoObj.imperfectGrain" />
  208. </el-form-item>
  209. <el-form-item label="容重">
  210. <el-input disabled size="small" v-model="moreInfoObj.bulkDensity" />
  211. </el-form-item>
  212. <el-form-item label="热损伤">
  213. <el-input disabled size="small" v-model="moreInfoObj.jiaorenli" />
  214. </el-form-item>
  215. <el-form-item label="蛋白">
  216. <el-input disabled size="small" v-model="moreInfoObj.protein" />
  217. </el-form-item>
  218. </el-form>
  219. </el-dialog> -->
  220. <el-dialog width="320px" :title="inventoryTitle" :visible.sync="isShowInventory" :append-to-body="true"
  221. :close="inventoryClose">
  222. <el-form class="customer" label-position="right" label-width="120px">
  223. <el-form-item class="customer-item" label="货名">
  224. <el-select v-model="pSubmitObj.goodsName" placeholder="请选择" @change="changeGoodsName1">
  225. <el-option v-for="item in goodsList" :key="item.id" :label="item.goodsName" :value="item.goodsName">
  226. </el-option>
  227. </el-select>
  228. </el-form-item>
  229. <el-form-item class="customer-item" label="现有库存">
  230. <el-input disabled size="small" v-model="goodsObj1.storage" />
  231. </el-form-item>
  232. <el-form-item class="customer-item" label="盘亏重量(吨)" v-if="inventoryTitle == '盘亏'">
  233. <el-input placeholder="输入盘亏重量" maxlength="100" size="small" v-model="pSubmitObj.netWeight" @input="inputVal"
  234. type="number" />
  235. </el-form-item>
  236. <el-form-item class="customer-item" label="单价(元/吨)" v-if="inventoryTitle == '盘亏'">
  237. <el-input placeholder="输入盘亏重量单价" size="small" v-model="pSubmitObj.unitPrice" @input="inputVal" type="number" />
  238. </el-form-item>
  239. <el-form-item class="customer-item" label="货值(元)" v-if="inventoryTitle == '盘亏'">
  240. <el-input disabled placeholder="自动计算盘亏重量的货值" size="small" v-model="pSubmitObj.grainFund" />
  241. </el-form-item>
  242. <el-form-item class="customer-item" label="盘盈重量(吨)" v-if="inventoryTitle == '盘盈'">
  243. <el-input placeholder="输入盘盈重量" maxlength="100" size="small" v-model="pSubmitObj.netWeight" @input="inputVal"
  244. type="number" />
  245. </el-form-item>
  246. <el-form-item class="customer-item" label="单价(元/吨)" v-if="inventoryTitle == '盘盈'">
  247. <el-input placeholder="输入盘盈重量单价" size="small" v-model="pSubmitObj.unitPrice" @input="inputVal" type="number" />
  248. </el-form-item>
  249. <el-form-item class="customer-item" label="货值(元)" v-if="inventoryTitle == '盘盈'">
  250. <el-input disabled placeholder="自动计算盘盈重量的货值" size="small" v-model="pSubmitObj.grainFund" />
  251. </el-form-item>
  252. </el-form>
  253. <div slot="footer" class="dialog-footer">
  254. <el-button @click="panSubmit" type='primary'>提 交</el-button>
  255. </div>
  256. </el-dialog>
  257. </div>
  258. </template>
  259. <script>
  260. import WsUpload from '@/components/WsUpload'
  261. import {
  262. downloadFile
  263. } from '@/utils/batchDown'
  264. import {
  265. dayjs,
  266. EventBus
  267. } from 'base-core-lib'
  268. import {
  269. speedWarehouseInOutInfoList,
  270. speedWarehouseInOutInfoAdd,
  271. speedWarehouseInOutInfoEdit,
  272. speedWarehouseInOutInfoDel,
  273. makeZero,
  274. // selectInOutCount,
  275. exportOrder,
  276. speedCustomerInfo,
  277. speedGoodsList
  278. } from '@/model/speedGoods'
  279. export default {
  280. components: {
  281. WsUpload
  282. },
  283. data() {
  284. return {
  285. moreInfoObj:{},
  286. isShowMoreInfo:false,
  287. remarkVal: '',
  288. isShowRemark: false,
  289. dataObj: {},
  290. size: 10,
  291. pSubmitObj: {
  292. goodsName: ''
  293. },
  294. goodsObj: {},
  295. storage :'',
  296. weightedCost:'',
  297. goodsObj1: {},
  298. date: {
  299. year: dayjs().format('YYYY'),
  300. month: dayjs().format('MM'),
  301. },
  302. searchType:'',
  303. startDate: '',
  304. endDate: '',
  305. inventoryTitle: '',
  306. isShowInventory: false,
  307. isShowCustomer: false,
  308. customerObj: {},
  309. compId: localStorage.getItem('ws-pf_compId'),
  310. appendixIdss: [],
  311. applstatus: false,
  312. accessoryTFs: false,
  313. deptCircularPage: {},
  314. deptBudgetTotal: 0,
  315. currentPage: 1,
  316. pageSize: 10,
  317. tableData: [],
  318. multipleSelection: [],
  319. goodsList: [],
  320. value: '',
  321. searchKeyWord: '',
  322. value2: '',
  323. status: '',
  324. isShowindex:false,
  325. goodindexObj:{}
  326. };
  327. },
  328. created() {
  329. this.getGoodSName()
  330. this.getList()
  331. },
  332. mounted() {
  333. },
  334. beforeDestroy() {
  335. },
  336. methods: {
  337. moreindicator(row){
  338. this.goodindexObj=row
  339. this.isShowindex=true
  340. },
  341. moreInfoClose(){
  342. this.isShowMoreInfo = false
  343. },
  344. //更多指标
  345. moreInfo(val) {
  346. this.moreInfoObj = val
  347. console.log(this.moreInfoObj)
  348. this.isShowMoreInfo = true
  349. },
  350. // 查看备注
  351. lookRemark(val) {
  352. this.remarkVal = val
  353. this.isShowRemark = true
  354. },
  355. // 更改已付、未付、已收、未收状态
  356. changeStatus(val) {
  357. if (val.status == '已付') {
  358. val.status = "未付"
  359. } else if (val.status == '未付') {
  360. val.status = "已付"
  361. val.flag = 1
  362. } else if (val.status == '已收') {
  363. val.status = "未收"
  364. } else if (val.status == '未收') {
  365. val.status = "已收"
  366. val.flag = 2
  367. }
  368. speedWarehouseInOutInfoEdit(val).toPromise()
  369. .then((res) => {
  370. if (res.toLowerCase() == "ok") {
  371. this.$message.success('状态切换成功!')
  372. this.isShowInventory = false
  373. }
  374. })
  375. },
  376. //计算盘盈盘亏货值
  377. inputVal() {
  378. if (this.pSubmitObj.netWeight && this.pSubmitObj.unitPrice) {
  379. this.pSubmitObj.grainFund = this.pSubmitObj.netWeight * this.pSubmitObj.unitPrice
  380. }
  381. },
  382. //盘亏盘盈
  383. async panSubmit() {
  384. this.pSubmitObj.compId = this.compId
  385. if (this.inventoryTitle == '盘亏') {
  386. this.pSubmitObj.inOutFlag = 1
  387. this.pSubmitObj.noFlag = 'PK'
  388. } else {
  389. this.pSubmitObj.inOutFlag = 2
  390. this.pSubmitObj.noFlag = 'PY'
  391. }
  392. // //查看编号
  393. // await selectInOutCount({
  394. // compId: this.compId,
  395. // noFlag: _number,
  396. // }).toPromise()
  397. // .then((res) => {
  398. // this.pSubmitObj.noFlag = res
  399. // })
  400. // console.log(this.pSubmitObj)
  401. await speedWarehouseInOutInfoAdd(this.pSubmitObj).toPromise()
  402. .then((res) => {
  403. this.$message.success('提交成功!')
  404. this.isShowInventory = false
  405. this.pSubmitObj={
  406. goodsName: ''
  407. }
  408. this.getList()
  409. })
  410. },
  411. // 查看客户
  412. selectCustomer(val) {
  413. speedCustomerInfo({
  414. customerId: val.customerId
  415. })
  416. .toPromise()
  417. .then((response) => {
  418. this.isShowCustomer = true
  419. this.customerObj = response
  420. })
  421. },
  422. //搜索
  423. search(type) {
  424. switch (type) {
  425. case 0:
  426. this.searchType = ''
  427. this.status = ''
  428. break
  429. case 1:
  430. this.searchType = 1
  431. break;
  432. case 2:
  433. this.searchType = 2
  434. break;
  435. default:
  436. this.status = type
  437. break
  438. }
  439. this.getList()
  440. },
  441. //选择货名
  442. changeGoodsName(val) {
  443. this.goodsObj = this.goodsList.filter((item) => {
  444. if (val == item.goodsName) return item
  445. })[0]
  446. this.storage =''
  447. this.weightedCost=''
  448. console.log(this.goodsObj)
  449. },
  450. //盘盈盘亏选择货名
  451. changeGoodsName1(val) {
  452. this.goodsObj1 = this.goodsList.filter((item) => {
  453. if (val == item.goodsName) return item
  454. })[0]
  455. },
  456. dateFormat(fmt, date) {
  457. let ret
  458. const opt = {
  459. 'Y+': date.getFullYear().toString(), // 年
  460. 'm+': (date.getMonth() + 1).toString(), // 月
  461. 'd+': date.getDate().toString(), // 日
  462. // 'H+': date.getHours().toString(), // 时
  463. // "M+": date.getMinutes().toString(), // 分
  464. // "S+": date.getSeconds().toString() // 秒
  465. // 有其他格式化字符需求可以继续添加,必须转化成字符串
  466. }
  467. for (let k in opt) {
  468. ret = new RegExp('(' + k + ')').exec(fmt)
  469. if (ret) {
  470. fmt = fmt.replace(
  471. ret[1],
  472. ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, '0')
  473. )
  474. }
  475. }
  476. return fmt
  477. },
  478. datechange(e) {
  479. if (this.value2) {
  480. this.startDate = this.dateFormat('YYYY-mm-dd', this.value2[0])
  481. this.endDate = this.dateFormat('YYYY-mm-dd', this.value2[1])
  482. } else {
  483. this.startDate = ''
  484. this.endDate = ''
  485. }
  486. this.getList()
  487. },
  488. getGoodSName(status) {
  489. //货名下拉
  490. speedGoodsList({
  491. compId: localStorage.getItem('ws-pf_compId')
  492. })
  493. .toPromise()
  494. .then((response) => {
  495. this.goodsList = response
  496. if (this.goodsList.length != 0) {
  497. for (let i = 0; i < response.length; i++) {
  498. if(response[i].setDefault!=0){
  499. this.pSubmitObj.goodsName=response[i].goodsName
  500. // this.goodsObj = response[i]
  501. // this.goodsObj1 = response[i]
  502. }
  503. }
  504. // this.pSubmitObj.goodsName = this.goodsList[0].goodsName
  505. if(!status){
  506. for (let i = 0; i < response.length; i++) {
  507. if(response[i].setDefault!=0){
  508. this.value=response[i].goodsName
  509. this.goodsObj = response[i]
  510. this.goodsObj1 = response[i]
  511. }
  512. }
  513. // this.value = this.goodsList[0].goodsName
  514. // this.goodsObj = this.goodsList[0]
  515. // this.goodsObj1 = this.goodsList[0]
  516. }else{
  517. this.goodsObj = this.goodsList.filter((item) => {
  518. if (this.value == item.goodsName) return item
  519. })[0]
  520. this.goodsObj1 = JSON.parse(JSON.stringify(this.goodsObj))
  521. }
  522. console.log(this.goodsObj)
  523. if(status){
  524. this.weightedCost=this.goodsObj.weightedCost
  525. }else{
  526. this.weightedCost=''
  527. }
  528. }
  529. })
  530. },
  531. getList() {
  532. speedWarehouseInOutInfoList({
  533. compId: this.compId,
  534. currentPage: this.currentPage,
  535. pageSize: this.pageSize,
  536. searchKeyWord: this.searchKeyWord,
  537. searchType: this.searchType,
  538. startDate: this.startDate,
  539. endDate: this.endDate,
  540. status: this.status
  541. })
  542. .toPromise()
  543. .then((response) => {
  544. if (response.records) {
  545. for (let i = 0; i < response.records.length; i++) {
  546. response.records[i].addressUrlArray = []
  547. response.records[i].addressUrlArray = response.records[i].addressUrl ? response.records[i].addressUrl.split(",") : []
  548. }
  549. }
  550. this.tableData = response.records
  551. this.deptBudgetTotal = response.total
  552. })
  553. },
  554. async exportExcel() {
  555. if (this.multipleSelection.length == 0) {
  556. this.$message.error("请勾选导出条目!")
  557. return
  558. }
  559. const {
  560. data
  561. } = await exportOrder({
  562. speedWarehouseInOutInfoList: this.multipleSelection
  563. }, {}, {
  564. responseType: 'blob',
  565. }).toPromise()
  566. downloadFile({
  567. res: data,
  568. fileName: `${this.date.year + (this.date.month ? `-${this.date.month}` : '')
  569. }_出入库记录`,
  570. type: 'xls',
  571. })
  572. },
  573. // 批量收付款
  574. batchPay(val) {
  575. if (this.multipleSelection.length==0) {
  576. this.$message.error('暂未勾选条目!')
  577. return
  578. }
  579. let _flag = ''
  580. let _text = ""
  581. if (val == 1) {
  582. _text = '收款'
  583. _flag = 4
  584. for (let i = 0; i < this.multipleSelection.length; i++) {
  585. if (this.multipleSelection[i].status == '已付' || this.multipleSelection[i].status == '未付'||this.multipleSelection[i].status == '已收') {
  586. this.$message.error('请勾选待收款的出库条目!')
  587. return
  588. }
  589. }
  590. } else {
  591. _text = '付款'
  592. _flag = 3
  593. for (let i = 0; i < this.multipleSelection.length; i++) {
  594. if (this.multipleSelection[i].status == '已收' || this.multipleSelection[i].status == '未收'|| this.multipleSelection[i].status == '已付') {
  595. this.$message.error('请勾选待付款的入库条目!')
  596. return
  597. }
  598. }
  599. }
  600. this.$confirm('确定勾选的条目均已' + _text + '?', '提示', {
  601. confirmButtonText: '确定',
  602. cancelButtonText: '取消',
  603. type: 'warning'
  604. }).then(() => {
  605. speedWarehouseInOutInfoEdit({ flag: _flag, speedWarehouseInOutInfoList: this.multipleSelection }).toPromise()
  606. .then((res) => {
  607. if (res == "OK") {
  608. this.$message.success('提交成功!')
  609. this.isShowInventory = false
  610. this.getList()
  611. }
  612. })
  613. }).catch(() => {
  614. return false
  615. });
  616. },
  617. del(val) {
  618. this.$confirm('确定删除出入库记录?', '提示', {
  619. confirmButtonText: '确定',
  620. cancelButtonText: '取消',
  621. type: 'warning'
  622. }).then(() => {
  623. speedWarehouseInOutInfoDel({ id: val.id}).toPromise()
  624. .then((res) => {
  625. this.$message.success('删除成功!')
  626. this.getList()
  627. })
  628. }).catch(() => {
  629. return false
  630. });
  631. },
  632. // 归零
  633. zero() {
  634. if(this.multipleSelection.length==0){
  635. this.$message.error('暂未勾选条目!')
  636. return
  637. }
  638. var num=0
  639. for(var i=0;i<this.multipleSelection.length;i++){
  640. if(this.multipleSelection[i].inOutFlag==1){
  641. this.$message.error('请勾选入库条目!')
  642. return
  643. }
  644. if(this.multipleSelection[i].goodsName==this.goodsObj.goodsName&&this.multipleSelection[i].netWeight&&this.multipleSelection[i].grainFund){
  645. num+=this.multipleSelection[i].netWeight
  646. }
  647. }
  648. this.storage=num
  649. // this.$confirm('确定将【' + this.goodsObj.goodsName + '】的库存和成本归零?', '提示', {
  650. // confirmButtonText: '确定',
  651. // cancelButtonText: '取消',
  652. // type: 'warning'
  653. // }).then(() => {
  654. makeZero({
  655. id: this.goodsObj.id,
  656. speedWarehouseInOutInfoList:this.multipleSelection,
  657. goodsName:this.value,
  658. }).toPromise()
  659. .then((response) => {
  660. this.$message({
  661. type: 'success',
  662. message: '操作成功!'
  663. });
  664. this.getGoodSName(1)
  665. })
  666. // }).catch(() => {
  667. // return false
  668. // });
  669. },
  670. inventoryClose() {
  671. this.isShowInventory = false
  672. },
  673. //盘亏盘盈
  674. handlestatus(type) {
  675. if (type == 1) {
  676. this.inventoryTitle = '盘亏'
  677. } else {
  678. this.inventoryTitle = '盘盈'
  679. }
  680. this.isShowInventory = true
  681. },
  682. remarkClose() {
  683. this.isShowRemark = false
  684. },
  685. customerclose() {
  686. this.isShowCustomer = false
  687. },
  688. indexclose(){
  689. this.isShowindex = false
  690. },
  691. // 查看客户
  692. customerClick(val) {
  693. this.isShowCustomer = true
  694. },
  695. onChange() {
  696. this.$refs.upload
  697. .handleSaveBill()
  698. .then(async (response) => {
  699. this.dataObj.addressUrl = response
  700. this.dataObj.flag = 0
  701. speedWarehouseInOutInfoEdit(this.dataObj)
  702. .toPromise()
  703. .then((response) => {
  704. this.accessoryTFs = false
  705. this.$message.success('上传成功')
  706. this.getList()
  707. })
  708. })
  709. .catch((res) => {
  710. EventBus.$emit('error', (JSON.parse(res) || {}).message)
  711. this.$refs.upload.clearFiles()
  712. })
  713. },
  714. // 上传附件
  715. uploadSuccess(data, files, url) {
  716. console.log(data, files, url)
  717. },
  718. handleClose() {
  719. this.dialogViewSpareMoney = false
  720. },
  721. fujian(row) {
  722. this.id = row.id
  723. this.accessoryTFs = true
  724. this.dataObj = row
  725. this.appendixIdss = row.addressUrl
  726. },
  727. handleSizeChange(val) {
  728. this.pageSize = val
  729. this.getList()
  730. },
  731. handleCurrentChange(val) {
  732. this.currentPage = val
  733. this.getList()
  734. },
  735. toggleSelection(rows) {
  736. if (rows) {
  737. rows.forEach(row => {
  738. this.$refs.multipleTable.toggleRowSelection(row);
  739. });
  740. } else {
  741. this.$refs.multipleTable.clearSelection();
  742. }
  743. },
  744. handleSelectionChange(val) {
  745. this.multipleSelection = val;
  746. },
  747. lookup() {
  748. this.getList()
  749. },
  750. },
  751. };
  752. </script>
  753. <style lang="scss" scoped>
  754. .bg {
  755. width: 100%;
  756. height: 100%;
  757. padding: 16px 16px 10px 16px;
  758. box-sizing: border-box;
  759. background-size: cover;
  760. background-position: center center;
  761. .row1 {
  762. display: flex;
  763. justify-content: space-between;
  764. .left {
  765. display: flex;
  766. }
  767. }
  768. .row2 {
  769. margin-top: 20px;
  770. display: flex;
  771. justify-content: space-between;
  772. .right {
  773. display: flex;
  774. align-items: center;
  775. .text {
  776. margin: 0 10px;
  777. }
  778. }
  779. }
  780. }
  781. .search,
  782. .search_css {
  783. margin-left: 10px;
  784. }
  785. .el-row .el-col .search_css.el-input{
  786. width:38% !important;
  787. }
  788. .table {
  789. margin-top: 20px;
  790. }
  791. </style>