|
@@ -1,213 +1,595 @@
|
|
|
<template>
|
|
|
- <div class="app-container">
|
|
|
- <!-- 查询和其他操作 -->
|
|
|
- <div class="filter-container">
|
|
|
- <el-button v-permission="['expressBill:expressbill:list']" class="filter-item" type="primary" size="mini" icon="el-icon-search" @click="handleFilter">查找</el-button>
|
|
|
- <el-button v-permission="['expressBill:expressbill:create']" class="filter-item" type="primary" size="mini" icon="el-icon-edit" @click="handleCreate">添加</el-button>
|
|
|
- </div>
|
|
|
-
|
|
|
- <!-- 查询结果 -->
|
|
|
- <el-table
|
|
|
- v-loading="listLoading"
|
|
|
- :data="list"
|
|
|
- size="small"
|
|
|
- element-loading-text="正在查询中。。。"
|
|
|
- border
|
|
|
- fit
|
|
|
- highlight-current-row
|
|
|
- >
|
|
|
- <el-table-column align="center" label="操作" class-name="small-padding fixed-width">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-button v-permission="['expressBill:expressbill:edit']" type="primary" size="mini" @click="handleUpdate(scope.row)">编辑</el-button>
|
|
|
- <el-button v-permission="['expressBill:expressbill:delete']" type="danger" size="mini" @click="handleDelete(scope.row)">删除</el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
-
|
|
|
- <pagination
|
|
|
- v-show="total>0"
|
|
|
- :total="total"
|
|
|
- :page.sync="listQuery.page"
|
|
|
- :limit.sync="listQuery.limit"
|
|
|
- @pagination="getList"
|
|
|
+ <div class="app-container">
|
|
|
+ <!-- 查询和其他操作 -->
|
|
|
+ <div class="filter-container">
|
|
|
+ <el-input
|
|
|
+ v-model="listQuery.type.customer"
|
|
|
+ clearable
|
|
|
+ class="filter-item"
|
|
|
+ size="small"
|
|
|
+ style="width: 200px;"
|
|
|
+ placeholder="请输入客户名称"
|
|
|
+ />
|
|
|
+ <el-select
|
|
|
+ v-model="listQuery.type.courierAervices"
|
|
|
+ placeholder="请选择快递种类"
|
|
|
+ style="margin:0 20px;"
|
|
|
+ clearable
|
|
|
+ size="small"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in kdList"
|
|
|
+ :label="item.type"
|
|
|
+ :value="item.type"
|
|
|
+ :key="index"
|
|
|
/>
|
|
|
+ </el-select>
|
|
|
+ <el-button
|
|
|
+ v-permission="['expressBill:expressbill:list']"
|
|
|
+ class="filter-item"
|
|
|
+ type="primary"
|
|
|
+ size="mini"
|
|
|
+ icon="el-icon-search"
|
|
|
+ @click="handleFilter"
|
|
|
+ >查找</el-button>
|
|
|
+ <el-button
|
|
|
+ v-permission="['expressBill:expressbill:create']"
|
|
|
+ class="filter-item"
|
|
|
+ type="primary"
|
|
|
+ size="mini"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ @click="handleCreate"
|
|
|
+ >添加</el-button>
|
|
|
+ <el-button
|
|
|
+ v-permission="['expressBill:expressbill:create']"
|
|
|
+ class="filter-item"
|
|
|
+ type="primary"
|
|
|
+ size="mini"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ @click="exportlist"
|
|
|
+ >导出</el-button>
|
|
|
|
|
|
- <!-- 添加或修改对话框 -->
|
|
|
- <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
|
|
|
- <el-form
|
|
|
- ref="dataForm"
|
|
|
- :rules="rules"
|
|
|
- :model="dataForm"
|
|
|
- status-icon
|
|
|
- label-position="left"
|
|
|
- label-width="100px"
|
|
|
- style="width: 400px; margin-left:50px;"
|
|
|
- >
|
|
|
- <el-form-item label="id" prop="id" hidden>
|
|
|
- <el-input v-model="dataForm.id" />
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
- <el-button @click="dialogFormVisible = false">取消</el-button>
|
|
|
- <el-button v-if="dialogStatus=='create'" :loading="submiting" type="primary" @click="createData">确定</el-button>
|
|
|
- <el-button v-else type="primary" :loading="submiting" @click="updateData">确定</el-button>
|
|
|
- </div>
|
|
|
- </el-dialog>
|
|
|
+ <el-upload
|
|
|
+ :on-change="importClick"
|
|
|
+ :show-file-list="false"
|
|
|
+ :auto-upload="false"
|
|
|
+ style="margin-left: 8px;margin-bottom:0"
|
|
|
+ class="filter-item"
|
|
|
+ action=""
|
|
|
+ accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel">
|
|
|
+ <el-button
|
|
|
+ class="filter-item"
|
|
|
+ type="primary"
|
|
|
+ size="mini"
|
|
|
+ icon="el-icon-edit">导入</el-button>
|
|
|
+ </el-upload>
|
|
|
</div>
|
|
|
+
|
|
|
+ <!-- 查询结果 -->
|
|
|
+ <el-table
|
|
|
+ v-loading="listLoading"
|
|
|
+ :data="list"
|
|
|
+ :summary-method="getSummaries"
|
|
|
+ size="small"
|
|
|
+ element-loading-text="正在查询中。。。"
|
|
|
+ border
|
|
|
+ fit
|
|
|
+ highlight-current-row
|
|
|
+ show-summary
|
|
|
+ @selection-change="handleSelectionChange"
|
|
|
+ >
|
|
|
+ <el-table-column :selectable="selectInit" type="selection" />
|
|
|
+ <el-table-column type="index" label="序号">
|
|
|
+ <template scope="scope">
|
|
|
+ <span v-if="scope.$index < 9">0{{ scope.$index + 1 }}</span>
|
|
|
+ <span v-else>{{ scope.$index + 1 }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column align="center" label="客户编号" prop="customerNo" />
|
|
|
+ <el-table-column align="center" label="客户名称" prop="customer" />
|
|
|
+ <el-table-column align="center" label="快递种类" prop="courierAervices" />
|
|
|
+ <el-table-column align="center" label="产品" prop="goods" />
|
|
|
+ <el-table-column align="center" label="重量" prop="weight" />
|
|
|
+ <el-table-column align="center" label="单价" prop="price" />
|
|
|
+ <el-table-column align="center" label="总价" prop="amount" />
|
|
|
+ <el-table-column align="center" label="支付方式" prop="payType" />
|
|
|
+ <el-table-column align="center" label="备注" prop="remarks" />
|
|
|
+ <el-table-column align="center" label="操作" class-name="small-padding">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ v-permission="['expressBill:expressbill:edit']"
|
|
|
+ type="primary"
|
|
|
+ size="mini"
|
|
|
+ @click="handleUpdate(scope.row)"
|
|
|
+ >编辑</el-button>
|
|
|
+ <el-button
|
|
|
+ v-permission="['expressBill:expressbill:delete']"
|
|
|
+ type="danger"
|
|
|
+ size="mini"
|
|
|
+ @click="handleDelete(scope.row)"
|
|
|
+ >删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <el-pagination
|
|
|
+ :current-page="currentPage"
|
|
|
+ :page-sizes="[100, 200, 300, 400,1000,1500,2000]"
|
|
|
+ :page-size="100"
|
|
|
+ :total="total"
|
|
|
+ layout="total, sizes, prev, pager, next, jumper"
|
|
|
+ @size-change="handleSizeChange"
|
|
|
+ @current-change="handleCurrentChange"/>
|
|
|
+
|
|
|
+ <!-- 添加或修改对话框 -->
|
|
|
+ <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
|
|
|
+ <el-form
|
|
|
+ ref="dataForm"
|
|
|
+ :rules="rules"
|
|
|
+ :model="dataForm"
|
|
|
+ status-icon
|
|
|
+ label-position="left"
|
|
|
+ label-width="100px"
|
|
|
+ style="width: 400px; margin-left:50px;"
|
|
|
+ >
|
|
|
+ <el-form-item label="id" prop="id" hidden>
|
|
|
+ <el-input v-model="dataForm.id" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="客户编号" prop="customerNo">
|
|
|
+ <el-input v-model="dataForm.customerNo" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="客户名称" prop="customer">
|
|
|
+ <el-input v-model="dataForm.customer" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="快递种类" prop="courierAervices">
|
|
|
+ <!-- <el-input v-model="dataForm.courierAervices" /> -->
|
|
|
+ <el-select v-model="dataForm.courierAervices" placeholder="请选择快递种类" style="width:100%">
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in kdList"
|
|
|
+ :label="item.type"
|
|
|
+ :value="item.type"
|
|
|
+ :key="index"/>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="产品" prop="goods">
|
|
|
+ <el-input v-model="dataForm.goods" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="重量" prop="weight">
|
|
|
+ <el-input v-model="dataForm.weight" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="单价" prop="price">
|
|
|
+ <el-input v-model="dataForm.price" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="总价" prop="amount">
|
|
|
+ <el-input v-model="dataForm.amount" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="支付方式" prop="payType">
|
|
|
+ <!-- <el-input v-model="dataForm.payType" /> -->
|
|
|
+ <el-select v-model="dataForm.payType" placeholder="请选择支付方式" style="width:100%">
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in payList"
|
|
|
+ :label="item.type"
|
|
|
+ :value="item.type"
|
|
|
+ :key="index"/>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="备注" prop="remarks">
|
|
|
+ <el-input v-model="dataForm.remarks" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="dialogFormVisible = false">取消</el-button>
|
|
|
+ <el-button
|
|
|
+ v-if="dialogStatus=='create'"
|
|
|
+ :loading="submiting"
|
|
|
+ type="primary"
|
|
|
+ @click="createData"
|
|
|
+ >确定</el-button>
|
|
|
+ <el-button v-else :loading="submiting" type="primary" @click="updateData">确定</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import {
|
|
|
- listExpressBill,
|
|
|
- createExpressBill,
|
|
|
- updateExpressBill,
|
|
|
- deleteExpressBill
|
|
|
- } from '@/api/expressBill'
|
|
|
- import Pagination from '@/components/Pagination'
|
|
|
- export default {
|
|
|
- name: 'ExpressBill',
|
|
|
- components: { Pagination },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- list: null,
|
|
|
- total: 0,
|
|
|
- listLoading: true,
|
|
|
- listQuery: {
|
|
|
- page: 1,
|
|
|
- limit: 20
|
|
|
- },
|
|
|
- dataForm: {
|
|
|
- id: undefined
|
|
|
- },
|
|
|
- dialogFormVisible: false,
|
|
|
- submiting: false,
|
|
|
- dialogStatus: '',
|
|
|
- textMap: {
|
|
|
- update: '编辑',
|
|
|
- create: '创建'
|
|
|
- },
|
|
|
- rules: {
|
|
|
- }
|
|
|
- }
|
|
|
+import {
|
|
|
+ listExpressBill,
|
|
|
+ createExpressBill,
|
|
|
+ updateExpressBill,
|
|
|
+ deleteExpressBill,
|
|
|
+ exportXlsx,
|
|
|
+ importWord
|
|
|
+} from '@/api/expressBill'
|
|
|
+import Pagination from '@/components/Pagination'
|
|
|
+export default {
|
|
|
+ name: 'ExpressBill',
|
|
|
+ components: { Pagination },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ excelFreightspace: [],
|
|
|
+ modification: [],
|
|
|
+ kdList1: [],
|
|
|
+ kdList: [
|
|
|
+ {
|
|
|
+ type: 'UPS'
|
|
|
},
|
|
|
- created() {
|
|
|
- this.getList()
|
|
|
+ {
|
|
|
+ type: 'DHL'
|
|
|
},
|
|
|
- methods: {
|
|
|
- getList() {
|
|
|
- this.listLoading = true
|
|
|
- listExpressBill(this.listQuery).then(response => {
|
|
|
- this.list = response.data.data.items
|
|
|
- this.total = response.data.data.total
|
|
|
- this.listLoading = false
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- this.list = []
|
|
|
- this.total = 0
|
|
|
- this.listLoading = false
|
|
|
+ {
|
|
|
+ type: 'TNT'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: '直达'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ payList1: [],
|
|
|
+ payList: [
|
|
|
+ {
|
|
|
+ type: '现金'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: '微信'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: '银行转账'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ list: null,
|
|
|
+ total: 0,
|
|
|
+ listLoading: true,
|
|
|
+ listQuery: {
|
|
|
+ page: 1,
|
|
|
+ limit: 100,
|
|
|
+ type: {
|
|
|
+ customer: '',
|
|
|
+ courierAervices: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ dataForm: {
|
|
|
+ id: undefined
|
|
|
+ },
|
|
|
+ dialogFormVisible: false,
|
|
|
+ submiting: false,
|
|
|
+ dialogStatus: '',
|
|
|
+ textMap: {
|
|
|
+ update: '编辑',
|
|
|
+ create: '创建'
|
|
|
+ },
|
|
|
+ rules: {}
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getList()
|
|
|
+ this.currentPage = 1
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ handleSizeChange(val) {
|
|
|
+ console.log(`每页 ${val} 条`)
|
|
|
+ this.listQuery.limit = val
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ handleCurrentChange(val) {
|
|
|
+ this.listQuery.page = val
|
|
|
+ console.log(`当前页: ${val}`)
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ getSummaries(param) {
|
|
|
+ const { columns, data } = param
|
|
|
+ const sums = []
|
|
|
+ columns.forEach((column, index) => {
|
|
|
+ if (index === 0) {
|
|
|
+ sums[index] = '合计'
|
|
|
+ return
|
|
|
+ } else if (index == 8) {
|
|
|
+ const values = data.map((item) => Number(item[column.property]))
|
|
|
+ if (!values.every((value) => isNaN(value))) {
|
|
|
+ sums[index] = values.reduce((prev, curr) => {
|
|
|
+ const value = Number(curr)
|
|
|
+ if (!isNaN(value)) {
|
|
|
+ return prev + curr
|
|
|
+ } else {
|
|
|
+ return prev
|
|
|
+ }
|
|
|
+ }, 0)
|
|
|
+ sums[index] += ''
|
|
|
+ } else {
|
|
|
+ sums[index] = '--'
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // sums[index] = "--";
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ return sums
|
|
|
+ },
|
|
|
+ importClick(file, fileList) {
|
|
|
+ this.fileTemp = file.raw
|
|
|
+ const fileName = file.raw.name
|
|
|
+ const fileType = fileName.substring(fileName.lastIndexOf('.') + 1)
|
|
|
+ // 判断上传文件格式
|
|
|
+ if (this.fileTemp) {
|
|
|
+ if (fileType == 'xlsx' || fileType == 'xls') {
|
|
|
+ this.importf(this.fileTemp)
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '附件格式错误,请删除后重新上传!'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '请上传附件!'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ importf(obj) {
|
|
|
+ this.excelFreightspace = []
|
|
|
+ // this.dialogVisible = true;
|
|
|
+ const _this = this
|
|
|
+ const inputDOM = this.$refs.inputer // 通过DOM取文件数据
|
|
|
+ this.file = event.currentTarget.files[0]
|
|
|
+ var rABS = false // 是否将文件读取为二进制字符串
|
|
|
+ var f = this.file
|
|
|
+ var reader = new FileReader()
|
|
|
+ // if (!FileReader.prototype.readAsBinaryString) {
|
|
|
+ FileReader.prototype.readAsBinaryString = function(f) {
|
|
|
+ var binary = ''
|
|
|
+ var rABS = false // 是否将文件读取为二进制字符串
|
|
|
+ var pt = this
|
|
|
+ var wb // 读取完成的数据
|
|
|
+ var outdata
|
|
|
+ var reader = new FileReader()
|
|
|
+ reader.onload = function(e) {
|
|
|
+ var bytes = new Uint8Array(reader.result)
|
|
|
+ var length = bytes.byteLength
|
|
|
+ for (var i = 0; i < length; i++) {
|
|
|
+ binary += String.fromCharCode(bytes[i])
|
|
|
+ }
|
|
|
+ var XLSX = require('xlsx')
|
|
|
+ if (rABS) {
|
|
|
+ wb = XLSX.read(btoa(fixdata(binary)), {
|
|
|
+ // 手动转化
|
|
|
+ type: 'base64',
|
|
|
+ cellDates: true
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ wb = XLSX.read(binary, {
|
|
|
+ type: 'binary'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // outdata就是你想要的东西 excel导入的数据
|
|
|
+ outdata = XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]])
|
|
|
+ // excel 数据再处理
|
|
|
+ const arr = []
|
|
|
+ outdata.map(v => {
|
|
|
+ // let jsonString = JSON.stringify(v).replace(/\*/g, '').replace(/\s/ig,'');
|
|
|
+ const jsonString = JSON.stringify(v)
|
|
|
+ .replace(/\//g, '')
|
|
|
+ .replace(/\s/gi, '')
|
|
|
+ v = JSON.parse(jsonString)
|
|
|
+ const obj = {}
|
|
|
+ // xxx代表列名
|
|
|
+ debugger
|
|
|
+ obj.customerNo = v.客户编号
|
|
|
+ obj.customer = v.客户名称
|
|
|
+ obj.courierAervices = v.快递种类
|
|
|
+ obj.goods = v.产品
|
|
|
+ obj.weight = v.重量
|
|
|
+ obj.price = v.单价
|
|
|
+ obj.amount = v.总价
|
|
|
+ obj.payType = v.支付方式
|
|
|
+ obj.remarks = v.备注
|
|
|
+ for (let i = 0; i < _this.kdList.length; i++) {
|
|
|
+ _this.kdList1.push(_this.kdList[i].type)
|
|
|
+ }
|
|
|
+ for (let i = 0; i < _this.payList.length; i++) {
|
|
|
+ _this.payList1.push(_this.payList[i].type)
|
|
|
+ }
|
|
|
+ if (!_this.payList1.includes(obj.payType)) {
|
|
|
+ _this.isAllowExport = false
|
|
|
+ _this.$notify({
|
|
|
+ title: '失败',
|
|
|
+ message: '导入失败,导入数据中支付方式在系统中不存在,请重新编辑',
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ _this.excelFreightspace.push(obj)
|
|
|
+ _this.isAllowExport = true
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!_this.kdList1.includes(obj.courierAervices)) {
|
|
|
+ _this.isAllowExport = false
|
|
|
+ _this.$notify({
|
|
|
+ title: '失败',
|
|
|
+ message: '导入失败,导入数据中快递种类在系统中不存在,请重新编辑',
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ _this.excelFreightspace.push(obj)
|
|
|
+ _this.isAllowExport = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (_this.excelFreightspace && _this.isAllowExport) {
|
|
|
+ importWord(_this.excelFreightspace).then(response => {
|
|
|
+ if (response.status == '200') {
|
|
|
+ _this.$notify({
|
|
|
+ title: '成功',
|
|
|
+ message: '导入成功',
|
|
|
+ type: 'success'
|
|
|
})
|
|
|
- },
|
|
|
- handleFilter() {
|
|
|
- this.listQuery.page = 1
|
|
|
- this.getList()
|
|
|
- },
|
|
|
- resetForm() {
|
|
|
- this.dataForm = {
|
|
|
- id: undefined
|
|
|
+ _this.getList()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ reader.readAsArrayBuffer(f)
|
|
|
+ }
|
|
|
+ if (rABS) {
|
|
|
+ reader.readAsArrayBuffer(f)
|
|
|
+ } else {
|
|
|
+ reader.readAsBinaryString(f)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleSelectionChange(val) {
|
|
|
+ this.modification = val
|
|
|
+ },
|
|
|
+ selectInit(row) {
|
|
|
+ return true
|
|
|
+ },
|
|
|
+ async exportlist() {
|
|
|
+ debugger
|
|
|
+ if (this.modification.length == 0) {
|
|
|
+ this.$message.warning('请选择要导出的条目!')
|
|
|
+ } else {
|
|
|
+ console.log('导出数据', this.modification)
|
|
|
+ const _data = {
|
|
|
+ expressBillDTOS: this.modification
|
|
|
+ }
|
|
|
+ const {
|
|
|
+ data
|
|
|
+ } = await exportXlsx(_data).then((response) => { debugger
|
|
|
+ this.download(response.data.data)
|
|
|
+ // downloadFile({
|
|
|
+ // res: data,
|
|
|
+ // fileName: `${
|
|
|
+ // this.date.year + (this.date.month ? `-${this.date.month}` : '')
|
|
|
+ // }付款信息`,
|
|
|
+ // type: 'xls',
|
|
|
+ // })
|
|
|
+ if (response.status == '200') {
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getList() {
|
|
|
+ this.listLoading = true
|
|
|
+ listExpressBill(this.listQuery)
|
|
|
+ .then(response => {
|
|
|
+ this.list = response.data.data.items
|
|
|
+ this.total = response.data.data.total
|
|
|
+ this.listLoading = false
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.list = []
|
|
|
+ this.total = 0
|
|
|
+ this.listLoading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleFilter() {
|
|
|
+ this.listQuery.page = 1
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ resetForm() {
|
|
|
+ this.dataForm = {
|
|
|
+ id: undefined
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleCreate() {
|
|
|
+ this.resetForm()
|
|
|
+ this.dialogStatus = 'create'
|
|
|
+ this.dialogFormVisible = true
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs['dataForm'].clearValidate()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ createData() {
|
|
|
+ this.$refs['dataForm'].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ this.submiting = true
|
|
|
+ createExpressBill(this.dataForm)
|
|
|
+ .then(response => {
|
|
|
+ this.list.unshift(response.data.data)
|
|
|
+ this.dialogFormVisible = false
|
|
|
+ this.$notify.success({
|
|
|
+ title: '成功',
|
|
|
+ message: '添加成功'
|
|
|
+ })
|
|
|
+ this.submiting = false
|
|
|
+ })
|
|
|
+ .catch(response => {
|
|
|
+ this.$notify.error({
|
|
|
+ title: '失败',
|
|
|
+ message: response.data.errmsg
|
|
|
+ })
|
|
|
+ this.submiting = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleUpdate(row) {
|
|
|
+ this.dataForm = Object.assign({}, row)
|
|
|
+ this.dialogStatus = 'update'
|
|
|
+ this.dialogFormVisible = true
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs['dataForm'].clearValidate()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ updateData() {
|
|
|
+ this.$refs['dataForm'].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ this.submiting = true
|
|
|
+ updateExpressBill(this.dataForm)
|
|
|
+ .then(() => {
|
|
|
+ for (const v of this.list) {
|
|
|
+ if (v.id === this.dataForm.id) {
|
|
|
+ const index = this.list.indexOf(v)
|
|
|
+ this.list.splice(index, 1, this.dataForm)
|
|
|
+ break
|
|
|
}
|
|
|
- },
|
|
|
- handleCreate() {
|
|
|
- this.resetForm()
|
|
|
- this.dialogStatus = 'create'
|
|
|
- this.dialogFormVisible = true
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs['dataForm'].clearValidate()
|
|
|
- })
|
|
|
- },
|
|
|
- createData() {
|
|
|
- this.$refs['dataForm'].validate(valid => {
|
|
|
- if (valid) {
|
|
|
- this.submiting = true
|
|
|
- createExpressBill(this.dataForm).then(response => {
|
|
|
- this.list.unshift(response.data.data)
|
|
|
- this.dialogFormVisible = false
|
|
|
- this.$notify.success({
|
|
|
- title: '成功',
|
|
|
- message: '添加成功'
|
|
|
- })
|
|
|
- this.submiting = false
|
|
|
- })
|
|
|
- .catch(response => {
|
|
|
- this.$notify.error({
|
|
|
- title: '失败',
|
|
|
- message: response.data.errmsg
|
|
|
- })
|
|
|
- this.submiting = false
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- handleUpdate(row) {
|
|
|
- this.dataForm = Object.assign({}, row)
|
|
|
- this.dialogStatus = 'update'
|
|
|
- this.dialogFormVisible = true
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs['dataForm'].clearValidate()
|
|
|
- })
|
|
|
- },
|
|
|
- updateData() {
|
|
|
- this.$refs['dataForm'].validate(valid => {
|
|
|
- if (valid) {
|
|
|
- this.submiting = true
|
|
|
- updateExpressBill(this.dataForm).then(() => {
|
|
|
- for (const v of this.list) {
|
|
|
- if (v.id === this.dataForm.id) {
|
|
|
- const index = this.list.indexOf(v)
|
|
|
- this.list.splice(index, 1, this.dataForm)
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
- this.dialogFormVisible = false
|
|
|
- this.submiting = false
|
|
|
- this.$notify.success({
|
|
|
- title: '成功',
|
|
|
- message: '更新成功'
|
|
|
- })
|
|
|
- })
|
|
|
- .catch(response => {
|
|
|
- this.$notify.error({
|
|
|
- title: '失败',
|
|
|
- message: response.data.errmsg
|
|
|
- })
|
|
|
- this.submiting = false
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- handleDelete(row) {
|
|
|
- this.$confirm('此操作将永久删除该记录---' + row.id + '---, 是否继续?', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
- }).then(() => {
|
|
|
- deleteExpressBill(row.id).then(response => {
|
|
|
- this.$notify.success({
|
|
|
- title: '成功',
|
|
|
- message: '删除成功'
|
|
|
- })
|
|
|
- const index = this.list.indexOf(row)
|
|
|
- this.list.splice(index, 1)
|
|
|
- })
|
|
|
- .catch(response => {
|
|
|
- this.$notify.error({
|
|
|
- title: '失败',
|
|
|
- message: response.data.errmsg
|
|
|
- })
|
|
|
- })
|
|
|
- }).catch(() => {
|
|
|
- return false
|
|
|
- })
|
|
|
- }
|
|
|
+ }
|
|
|
+ this.dialogFormVisible = false
|
|
|
+ this.submiting = false
|
|
|
+ this.$notify.success({
|
|
|
+ title: '成功',
|
|
|
+ message: '更新成功'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ .catch(response => {
|
|
|
+ this.$notify.error({
|
|
|
+ title: '失败',
|
|
|
+ message: response.data.errmsg
|
|
|
+ })
|
|
|
+ this.submiting = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleDelete(row) {
|
|
|
+ this.$confirm(
|
|
|
+ '此操作将永久删除该记录---' + row.id + '---, 是否继续?',
|
|
|
+ '提示',
|
|
|
+ {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
}
|
|
|
+ )
|
|
|
+ .then(() => {
|
|
|
+ deleteExpressBill(row.id)
|
|
|
+ .then(response => {
|
|
|
+ this.$notify.success({
|
|
|
+ title: '成功',
|
|
|
+ message: '删除成功'
|
|
|
+ })
|
|
|
+ const index = this.list.indexOf(row)
|
|
|
+ this.list.splice(index, 1)
|
|
|
+ })
|
|
|
+ .catch(response => {
|
|
|
+ this.$notify.error({
|
|
|
+ title: '失败',
|
|
|
+ message: response.data.errmsg
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ return false
|
|
|
+ })
|
|
|
}
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|