Commit ab241ea9 by 胡悦

添加发货明细

1 parent 02c4f75e
...@@ -12,12 +12,14 @@ ...@@ -12,12 +12,14 @@
"dependencies": { "dependencies": {
"axios": "^0.18.0", "axios": "^0.18.0",
"echarts": "^4.9.0", "echarts": "^4.9.0",
"file-saver": "^2.0.5",
"glsx-vue-common": "^1.2.1", "glsx-vue-common": "^1.2.1",
"glsx-vue-components": "^1.0.13", "glsx-vue-components": "^1.0.13",
"moment": "^2.29.1", "moment": "^2.29.1",
"sass-loader": "^7.1.0", "sass-loader": "^7.1.0",
"vue": "^2.5.17", "vue": "^2.5.17",
"vue-echarts": "^5.0.0-beta.0" "vue-echarts": "^5.0.0-beta.0",
"xlsx": "^0.16.9"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "^3.0.1", "@vue/cli-plugin-babel": "^3.0.1",
......
...@@ -18,6 +18,7 @@ const methods = { ...@@ -18,6 +18,7 @@ const methods = {
HeatMapIp: `${path}heatMapIp`, HeatMapIp: `${path}heatMapIp`,
TimeRangeLogin: `${path}timeRangeLogin`, TimeRangeLogin: `${path}timeRangeLogin`,
TrendLogin: `${path}trendLogin`, TrendLogin: `${path}trendLogin`,
ShipFindAll: `${path3}findAll` ShipFindAll: `${path3}findAll`,
shipImport: `${path3}import`
} }
export { methods } export { methods }
...@@ -6,8 +6,10 @@ import 'glsx-vue-components/dist/glsx-vue-components.css' ...@@ -6,8 +6,10 @@ import 'glsx-vue-components/dist/glsx-vue-components.css'
import '@/styles/index.scss' import '@/styles/index.scss'
import { Request as request } from 'glsx-vue-common' import { Request as request } from 'glsx-vue-common'
import moment from 'moment' import moment from 'moment'
import XLSX from 'xlsx'
// import axios from 'axios' // import axios from 'axios'
Vue.use(GlsxVueComponents) Vue.use(GlsxVueComponents)
Vue.use(XLSX)
// Vue.prototype.getAddrUrl = 'https://dj.test.glsx.com.cn/web-dj-site/common/address/getAddressByLngLat' // Vue.prototype.getAddrUrl = 'https://dj.test.glsx.com.cn/web-dj-site/common/address/getAddressByLngLat'
Vue.prototype.getAddrUrl = 'http://dj.glsx.com.cn/web-dj-site/common/address/getAddressByLngLat' Vue.prototype.getAddrUrl = 'http://dj.glsx.com.cn/web-dj-site/common/address/getAddressByLngLat'
Vue.prototype.size = 'mini' Vue.prototype.size = 'mini'
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<gl-form-item label="搜索关键字:"> <gl-form-item label="搜索关键字:">
<gl-input <gl-input
:size="size" :size="size"
placeholder="请输入设备号 / 卡号 / 发往客户" placeholder="请输入设备号 / 卡号"
v-model="searcher.searchKey" v-model="searcher.searchKey"
:disabled="disabled" :disabled="disabled"
clearable clearable
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
:disabled="disabled" :disabled="disabled"
@click="handleSearch(1)" @click="handleSearch(1)"
>查询</gl-button> >查询</gl-button>
<el-popover <el-popover
ref="shipPopover" ref="shipPopover"
class="m-l10" class="m-l10"
...@@ -75,7 +76,7 @@ ...@@ -75,7 +76,7 @@
></gl-option> ></gl-option>
</gl-select> </gl-select>
</gl-form-item> </gl-form-item>
<gl-form-item label="发往客户:"> <!-- <gl-form-item label="发往客户:">
<gl-input <gl-input
:size="size" :size="size"
placeholder="请输入发往客户" placeholder="请输入发往客户"
...@@ -83,7 +84,7 @@ ...@@ -83,7 +84,7 @@
clearable clearable
> >
</gl-input> </gl-input>
</gl-form-item> </gl-form-item> -->
<gl-form-item label=" "> <gl-form-item label=" ">
<gl-button <gl-button
:size="size" :size="size"
...@@ -108,6 +109,12 @@ ...@@ -108,6 +109,12 @@
高级查询 高级查询
</gl-button> </gl-button>
</el-popover> </el-popover>
<gl-button
:size="size"
style="margin-left: 10px;"
icon="el-icon-edit"
@click="handleClose"
>设备发货导入</gl-button>
</gl-form-item> </gl-form-item>
</gl-form> </gl-form>
<gl-table <gl-table
...@@ -124,6 +131,72 @@ ...@@ -124,6 +131,72 @@
layout="total, ->, prev, pager, next, jumper" layout="total, ->, prev, pager, next, jumper"
:total="pager.total" :total="pager.total"
></gl-pagination> ></gl-pagination>
<el-dialog
title="导入发货明细"
:visible.sync="dialogVisible"
width="50%"
:show-close="showClose"
>
<gl-form
label-width="100px"
v-loading="dialogLoading"
>
<div style="margin-left: 20px;">请导入设备明细,导入字段:设备号SN、卡号、设备类型,</div>
<gl-form-item label="导入数据:">
<el-input
style="width: calc(100% - 200px);"
v-model="fileName"
></el-input>
<el-upload
style="display: inline-block;"
class="upload-excel m-l10"
action=""
:multiple="false"
:show-file-list="false"
:http-request="httpRequest"
accept="csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
>
<el-button
:size="size"
type="primary"
>选择文件</el-button>
</el-upload>
<el-button
style="margin-left: 10px;"
:size="size"
type="primary"
@click="importFile"
>导入数据</el-button>
<div
style="margin-left: 0;"
class="tips-text"
>{{error}}</div>
</gl-form-item>
<gl-form-item label="">
<a
style="color: #409EFF;"
href="https://img01.glsx.com.cn/weapp/resource/oss/发货明细模板.xlsx"
>请下载“发货明细”模板</a>
</gl-form-item>
</gl-form>
<span
slot="footer"
class="dialog-footer"
>
<el-button
@click="handleClose"
:loading="dialogLoading"
>取 消</el-button>
<el-button
type="primary"
@click="handleClose"
:loading="dialogLoading"
>确 定</el-button>
</span>
</el-dialog>
</div> </div>
</template> </template>
...@@ -179,16 +252,22 @@ export default { ...@@ -179,16 +252,22 @@ export default {
else return '' else return ''
} }
}, },
{ // {
label: '发往客户', // label: '发往客户',
prop: 'settle_merchant' // prop: 'settle_merchant'
}, // },
{ {
label: '发货月份', label: '发货月份',
prop: 'device_time' prop: 'device_delivery_time'
} }
] ]
} },
dialogVisible: false,
fileName: '',
importData: [],
error: '',
dialogLoading: false,
showClose: false
} }
}, },
...@@ -207,7 +286,7 @@ export default { ...@@ -207,7 +286,7 @@ export default {
params.deviceSn = searcher.deviceSn params.deviceSn = searcher.deviceSn
params.simNo = searcher.simNo params.simNo = searcher.simNo
params.deviceType = searcher.deviceType params.deviceType = searcher.deviceType
params.settleMerchant = searcher.settleMerchant // params.settleMerchant = searcher.settleMerchant
} }
this.getList(params) this.getList(params)
}, },
...@@ -255,6 +334,73 @@ export default { ...@@ -255,6 +334,73 @@ export default {
}, },
hidePop() { hidePop() {
this.disabled = false this.disabled = false
},
handleClose() {
this.dialogVisible = !this.dialogVisible
if (!this.dialogVisible) this.fileName = ''
},
httpRequest(e) {
console.log(e)
const _this = this
this.fileName = e.file.name
var rABS = false
const f = e.file
if (!f) return false
else if (!/\.(xls|xlsx)$/.test(f.name.toLowerCase())) {
this.$message.error('上传格式不正确,请上传xls或者xlsx格式')
return false
}
var reader = new FileReader()
FileReader.prototype.readAsBinaryString = function(f) {
var binary = ''
var rABS = false
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' })
else wb = XLSX.read(binary, { type: 'binary' })
outdata = XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]], { defval: '' })
console.log(outdata)
_this.error = ''
if (outdata.length > 0) {
for (var i in outdata[0]) {
if (!(i == '设备号SN' || i == '卡号' || i == '设备类型')) {
_this.error = '导入文件的字段与模板字段不一致'
return false
}
}
_this.importData = outdata
} else {
_this.error = '导入文件数据为空'
}
// 导入文件数据部分为空
}
reader.readAsArrayBuffer(f)
}
if (rABS) reader.readAsArrayBuffer(f)
else reader.readAsBinaryString(f)
},
importFile() {
const params = this.importData
this.dialogLoading = true
request.req(devicesMethods.shipImport, { params }).then(res => {
console.log(res)
this.dialogLoading = false
if (res) {
this.handleClose()
this.$message({
message: '导入成功',
type: 'success'
})
} else {
this.$message.error('导入失败,文件中的数据存在空值')
}
})
} }
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!