index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. <template>
  2. <div class="app-container">
  3. <el-form
  4. :model="query"
  5. ref="queryForm"
  6. v-show="showSearch"
  7. :inline="true"
  8. >
  9. <el-row>
  10. <el-form-item label="提单号" prop="fMblno">
  11. <el-input
  12. v-model="query.fMblno"
  13. placeholder="请输入提单号"
  14. clearable
  15. size="small"
  16. @change="fMblnoChange"
  17. />
  18. </el-form-item>
  19. <el-form-item label="货主" prop="fCorpid">
  20. <el-select
  21. v-model="query.fCorpid"
  22. filterable
  23. clearable
  24. remote
  25. style="width: 80%"
  26. :remote-method="corpsRemoteMethod"
  27. placeholder="请输入模糊查找"
  28. >
  29. <el-option
  30. v-for="(dict, index) in fMblnoOptions"
  31. :key="index.fId"
  32. :label="dict.fName"
  33. :value="dict.fId"
  34. ></el-option>
  35. </el-select>
  36. </el-form-item>
  37. <el-form-item label="日期" prop="bsdateList">
  38. <el-date-picker
  39. v-model="query.bsdateList"
  40. type="daterange"
  41. range-separator="至"
  42. start-placeholder="开始日期"
  43. value-format="yyyy-MM-dd HH:mm:ss"
  44. :default-time="['00:00:00', '23:59:59']"
  45. end-placeholder="结束日期"
  46. :picker-options="pickerOptions"
  47. unlink-panels>
  48. </el-date-picker>
  49. </el-form-item>
  50. </el-row>
  51. </el-form>
  52. <el-row :gutter="10" class="mb8">
  53. <el-col :span="1.5">
  54. <el-button
  55. type="primary"
  56. icon="el-icon-plus"
  57. size="mini"
  58. @click="getList"
  59. v-hasPermi="['warehouseBusiness:containerPort:add']"
  60. >查询
  61. </el-button>
  62. </el-col>
  63. <el-col :span="1.5">
  64. <el-button
  65. type="warning"
  66. icon="el-icon-download"
  67. size="mini"
  68. @click="exportOne"
  69. >导出
  70. </el-button>
  71. </el-col>
  72. <!-- <el-col :span="1.5">-->
  73. <!-- <el-button-->
  74. <!-- type="danger"-->
  75. <!-- icon="el-icon-delete"-->
  76. <!-- size="mini"-->
  77. <!-- :disabled="multiple"-->
  78. <!-- @click="handleDelete"-->
  79. <!-- v-hasPermi="['agreement:agreementTask:remove']"-->
  80. <!-- >删除-->
  81. <!-- </el-button>-->
  82. <!-- </el-col>-->
  83. <!-- <el-col :span="1.5">-->
  84. <!-- <el-button-->
  85. <!-- type="info"-->
  86. <!-- icon="el-icon-download"-->
  87. <!-- size="mini"-->
  88. <!-- :disabled="single"-->
  89. <!-- @click="handleUpdate(null, 2)"-->
  90. <!-- v-hasPermi="['agreement:agreementStorage:export']"-->
  91. <!-- >复制新增-->
  92. <!-- </el-button>-->
  93. <!-- </el-col>-->
  94. <right-toolbar
  95. :showSearch.sync="showSearch"
  96. @queryTable="getList"
  97. ></right-toolbar>
  98. </el-row>
  99. <el-form :inline="true" :model="formInline" class="demo-form-inline">
  100. <el-form-item label="提单号">
  101. <el-input v-model="query.fMblno" placeholder="提单号" disabled></el-input>
  102. </el-form-item>
  103. <el-form-item label="货主">
  104. <el-select
  105. v-model="query.fCorpid"
  106. filterable
  107. remote
  108. style="width: 80%"
  109. :remote-method="corpsRemoteMethod"
  110. placeholder="请输入模糊查找"
  111. disabled
  112. >
  113. <el-option
  114. v-for="(dict, index) in fMblnoOptions"
  115. :key="index.fId"
  116. :label="dict.fName"
  117. :value="dict.fId"
  118. ></el-option>
  119. </el-select>
  120. </el-form-item>
  121. <el-form-item label="品名">
  122. <el-input v-model="formInline.goodsName" placeholder="请输入品名" disabled></el-input>
  123. </el-form-item>
  124. </el-form>
  125. <el-table
  126. :data="tableData"
  127. style="width: 100%"
  128. ref="table1"
  129. :height="tableHeight1"
  130. >
  131. <el-table-column type="selection" width="60" align="center" />
  132. <el-table-column type="index" label="行号" align="center"/>
  133. <el-table-column prop="fBusinessType" label="作业类型" width="180" align="center"/>
  134. <el-table-column prop="fCntval" label="箱型箱量" width="180" align="center"/>
  135. <el-table-column prop="inBsdate" label="入库日期" width="180" align="center"/>
  136. <el-table-column prop="inQty" label="入库件数" width="180" align="center"/>
  137. <el-table-column prop="inGrossweight" label="入库毛重" width="180" align="center"/>
  138. <el-table-column prop="outBsdate" label="出库日期" width="180" align="center"/>
  139. <el-table-column prop="outQty" label="出库件数" width="180" align="center"/>
  140. <el-table-column prop="outGrossweight" label="出库毛重" width="180" align="center"/>
  141. <el-table-column prop="fQtyblc" label="结余件数" width="180" align="center"/>
  142. <el-table-column prop="fGrossweightblc" label="结余毛重" width="180" align="center"/>
  143. <el-table-column prop="fBilltype" label="业务类型" width="180" align="center"/>
  144. <el-table-column prop="remark" label="备注" width="180" align="center"/>
  145. </el-table>
  146. <h3>
  147. <i class="el-icon-coin"></i>费用明细
  148. <el-button
  149. type="warning"
  150. icon="el-icon-download"
  151. size="mini"
  152. @click="exportTwo"
  153. >导出
  154. </el-button>
  155. </h3>
  156. <el-table
  157. :data="costData"
  158. style="width: 100%"
  159. ref="table2"
  160. :height="tableHeight2"
  161. >
  162. <el-table-column type="selection" width="60" align="center" />
  163. <el-table-column type="index" label="行号" align="center"/>
  164. <el-table-column prop="createTime" label="日期" width="180" align="center"/>
  165. <el-table-column prop="fBusinessType" label="作业类型" width="180" align="center"/>
  166. <el-table-column prop="fFeeid" label="费用" width="180" align="center"/>
  167. <el-table-column prop="fQty" label="数量" align="center"/>
  168. <el-table-column prop="fUnitprice" label="单价" align="center"/>
  169. <el-table-column prop="fAmount" label="金额" align="center"/>
  170. <el-table-column prop="remark" label="备注" align="center"/>
  171. </el-table>
  172. </div>
  173. </template>
  174. <script>
  175. import { listpayable , exportOne , exportTwo, getCorps} from '@/api/singleTicket'
  176. import {listCorps} from "@/api/basicdata/corps";
  177. export default {
  178. name: "index",
  179. data(){
  180. return{
  181. pickerOptions: {
  182. shortcuts: [{
  183. text: '最近一周',
  184. onClick(picker) {
  185. const end = new Date();
  186. const start = new Date();
  187. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  188. picker.$emit('pick', [start, end]);
  189. }
  190. }, {
  191. text: '最近一个月',
  192. onClick(picker) {
  193. const end = new Date();
  194. const start = new Date();
  195. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  196. picker.$emit('pick', [start, end]);
  197. }
  198. }, {
  199. text: '最近三个月',
  200. onClick(picker) {
  201. const end = new Date();
  202. const start = new Date();
  203. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  204. picker.$emit('pick', [start, end]);
  205. }
  206. }]
  207. },
  208. tableHeight1: '0',
  209. tableHeight2: '0',
  210. query:{},
  211. costData:[],
  212. formInline:{},
  213. tableData:[],
  214. showSearch: true,
  215. fMblnoOptions:[]
  216. }
  217. },
  218. created() {
  219. // let date = new Date();
  220. // let year = parseInt(date.getFullYear())
  221. // let month = parseInt(date.getMonth() + 1)
  222. // let currentMonth = date.getMonth()
  223. // let nextMonth = ++currentMonth
  224. // let nextMonthFirstDay = new Date(date.getFullYear(), nextMonth, 1) // 下个月的第一天
  225. // let oneDay = 1000*60*60*24
  226. // let lastTime = new Date(nextMonthFirstDay - oneDay) // 下个月的第一天减去一天,就是上个月的最后一天
  227. // let day = lastTime.getDate()
  228. // if (day < 10) {
  229. // day = '0' + day
  230. // }
  231. // this.$set(this.query,'bsdateList', [year + '-' + month + '-' + '01 00:00:00', year + '-' + month + '-' + day + ' 23:59:59'])
  232. },
  233. mounted() {
  234. this.$nextTick(() => {
  235. // 根据浏览器高度设置初始高度
  236. this.tableHeight1 = (window.innerHeight - this.$refs.table1.$el.offsetTop - 160) / 2
  237. // 监听浏览器高度变化,改变表格高度
  238. window.onresize = () => {
  239. this.tableHeight1 = (window.innerHeight - this.$refs.table1.$el.offsetTop - 70) /2
  240. }
  241. });
  242. this.$nextTick(() => {
  243. // 根据浏览器高度设置初始高度
  244. this.tableHeight2 = (window.innerHeight - this.$refs.table1.$el.offsetTop - 160) / 2
  245. // 监听浏览器高度变化,改变表格高度
  246. window.onresize = () => {
  247. this.tableHeight2 = (window.innerHeight - this.$refs.table1.$el.offsetTop - 70) /2
  248. }
  249. })
  250. },
  251. methods:{
  252. getList(){
  253. listpayable(this.query).then(res=>{
  254. this.costData = res.data.feeList
  255. this.tableData = res.data.singleAnalysis
  256. for (let item in this.tableData){
  257. if (this.tableData[item].inQty == 0){
  258. this.tableData[item].inQty = ''
  259. }
  260. if (this.tableData[item].inGrossweight == 0){
  261. this.tableData[item].inGrossweight = ''
  262. }
  263. if (this.tableData[item].outGrossweight == 0){
  264. this.tableData[item].outGrossweight = ''
  265. }
  266. if (this.tableData[item].fQtyblc == 0){
  267. this.tableData[item].fQtyblc = ''
  268. }
  269. if (this.tableData[item].fGrossweightblc == 0){
  270. this.tableData[item].fGrossweightblc = ''
  271. }
  272. if (this.tableData[item].outQty == 0){
  273. this.tableData[item].outQty = ''
  274. }
  275. }
  276. this.formInline.goodsName = res.data.goodsName
  277. })
  278. },
  279. exportOne(){
  280. let query = this.query
  281. this.$confirm("是否确认导出", "警告", {
  282. confirmButtonText: "确定",
  283. cancelButtonText: "取消",
  284. type: "warning",
  285. }).then(function () {
  286. return exportOne(query);
  287. }).then((response) => {
  288. this.download(response.msg);
  289. });
  290. },
  291. exportTwo(){
  292. let query = this.query
  293. this.$confirm("是否确认导出", "警告", {
  294. confirmButtonText: "确定",
  295. cancelButtonText: "取消",
  296. type: "warning",
  297. }).then(function () {
  298. return exportTwo(query);
  299. }).then((response) => {
  300. this.download(response.msg);
  301. });
  302. },
  303. corpsRemoteMethod(name) {
  304. if (this.query.fMblno) return
  305. if (name == null || name === "") {
  306. return false;
  307. }
  308. let queryParams = { pageNum: 1, fName: name, type: 1 };
  309. listCorps(queryParams).then((response) => {
  310. this.fMblnoOptions = response.rows;
  311. });
  312. },
  313. resetQuery(){},
  314. // 提单号变化触发
  315. fMblnoChange() {
  316. this.$set(this.query, 'fCorpid', '')
  317. if (this.query.fMblno) {
  318. getCorps({fMblno: this.query.fMblno}).then(res => {
  319. this.fMblnoOptions = res.data;
  320. if (this.fMblnoOptions.length > 0) this.query.fCorpid = this.fMblnoOptions[0].fId
  321. })
  322. } else {
  323. listCorps({type: 1}).then((response) => {
  324. this.fMblnoOptions = response.rows;
  325. });
  326. }
  327. },
  328. }
  329. }
  330. </script>
  331. <style scoped>
  332. </style>