record.vue 29 KB

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