| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582 |
- import { CtableClass, WtableClass } from '@/utils/CtableClass'
- import { clone, Vuehttp } from '@/utils/tools'
- import {formatDate} from "@/utils/date"
- export const AddressMode = {
- data() {
- return {
- IslookOrUpdate: 'update',
- chooseItem: {}, // 当前已选择的对象
- currentPage: 1,
- swtichType: '公司地址'// 当前是公司地址还是收货地址
- }
- },
- computed: {
- headArr() {
- return ['联系人', '联系地址', '联系电话', '操作', '']
- },
- StyleWidth() {
- return [180, 524, 170, 164, 124]
- },
- controlArray() {
- return [['编辑', 'updateItem'],['删除', 'deteleItem']]
- },
- swtichText() {
- return ['公司地址', '仓储地址']
- },
- getServerOrclient() { //当前是客户中心还是服务商中心
- return this.$route.path.indexOf('clientPage') > -1 ? 'client' : 'server'
- },
- getHttpResource() {
- // 后台取回来的数据源
- return this.$store.state.address.Addresslist.data.content.content
- },
- totalElements() {
- return this.$store.state.address.Addresslist.data.content.totalElements
- },
- tableData() {
- return CtableClass(this.getHttpResource, ['name', ['地址','detailAddress','area'], 'telephone', '操作', ['设为默认', 'num']] )
- },
- getAddressType() {
- return this.getServerOrclient === 'client' ?
- (this.swtichType === '公司地址' ? 101 : 104) : (this.swtichType === '公司地址' ? 100 : 104)
- },
- AlertTitle() {
- return this.IslookOrUpdate === 'add' ? '新增公司地址' : (this.IslookOrUpdate === 'update' ? '修改公司地址' : '查看公司地址')
- }
- },
- methods: {
- deteleItem(index) {
- // 删除事件需要重新走 刷新数据的方法
- let item = clone(this.getHttpResource[index])
- this.$confirm('此操作将永久删除该条信息, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.$http.delete(`/common/address/id?id=${item.id}`).then(res => {
- if (res.data.code !== 1) {
- this.$message.error(res.data.message)
- } else {
- this.$message({
- message: '删除成功',
- type: 'success'
- })
- this.handleCurrentChange(1)
- }
- })
- }).catch(() => {
- });
- },
- updateItem(index) {
- this.IslookOrUpdate = 'update'
- this.chooseItem = clone(this.getHttpResource[index])
- this.$refs.addressAlert.show(this.chooseItem)
- },
- setAutoFn(index) {
- // 设置事件需要重新走 刷新数据的方法
- let id = this.getHttpResource[index].id
- Vuehttp({ id: id }, '/common/address/default').then(res => {
- if (res.data.code !== 1) {
- this.$message.error(res.data.message)
- } else {
- this.$message({
- message: '设置成功',
- type: 'success'
- })
- this.handleCurrentChange(1)
- }
- })
- },
- // 切换视图
- swtichClick(index) {
- this.swtichType = this.swtichText[index]
- this.handleCurrentChange(1)
- },
- addAddress() {
- this.IslookOrUpdate = 'add'
- this.chooseItem = {
- name: '',
- telephone: '',
- detailAddress: '',
- araa: '',
- num: 0
- }
- this.$refs.addressAlert.show(this.chooseItem)
- },
- clickTwo(index) {
- this.IslookOrUpdate = 'look'
- this.chooseItem = clone(this.getHttpResource[index])
- this.$refs.addressAlert.show(this.chooseItem)
- },
- handleCurrentChange(page) {
- this.currentPage = page
- this.$store.dispatch('address/getAddressList', {page: this.currentPage, count: 10, type: this.getAddressType})
- },
- // 关闭编辑查看弹窗
- closeAlert(_tp, item) {
- if (_tp === 'save') {
- let params
- let url = this.IslookOrUpdate === 'add' ? '/common/address/persist' : '/common/address/update'
- if (this.IslookOrUpdate === 'add') {
- params = {
- params: {
- area: item.area,
- telephone: item.telephone,
- name: item.name,
- detailAddress: item.detailAddress,
- },
- type: this.getAddressType,
- isDefault: item.num === 1
- }
- } else {
- params = {
- json: JSON.stringify(item),
- isDefault: item.num === 1
- }
- }
- Vuehttp(params,url).then(res => {
- if (res.data.code !== 1) {
- this.$message.error(res.data.message)
- } else {
- this.$refs.addressAlert.hide()
- this.handleCurrentChange(1)
- }
- })
- } else {
- this.$refs.addressAlert.hide()
- }
- }
- }
- }
- export const DocumentsMode = {
- layout: 'default',
- middleware: 'authenticated',
- data () {
- return {
- clickData: '',
- hasMultiple: true,
- selectData: [],
- isDialogTitle: false,
- dialogInfo: '',
- isDialog: false,
- pageParams: {
- page: 1,
- count: 10,
- },
- pickerOptions: {
- shortcuts: [{
- text: '最近一周',
- onClick(picker) {
- const end = new Date();
- const start = new Date();
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
- picker.$emit('pick', [start, end]);
- }
- }, {
- text: '最近一个月',
- onClick(picker) {
- const end = new Date();
- const start = new Date();
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
- picker.$emit('pick', [start, end]);
- }
- }, {
- text: '最近三个月',
- onClick(picker) {
- const end = new Date();
- const start = new Date();
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
- picker.$emit('pick', [start, end]);
- }
- }],
- disabledDate (time) {
- // 大于等于今天
- return time.getTime() >= Date.now()
- }
- },
- searchKey: '',
- dataTime: [],
- files: {},
- selectedArr: [] // 选中的数据
- }
- },
- computed: {
- thead () {
- return this.urlLink.route === 'clientPage' ? [
- {id: 'checkbox', name: '全选', width:60, type: 'string'},
- {id: 'csid', name: '系统编号', width:120, type: 'string'},
- {id: 'applyTime', name: '报关日期', width:165, type: 'date'},
- {id: 'commissionCompany', name: '委托公司', width:142, type: 'string'},
- {id: 'status', name: '状态', width:80, type: 'string'},
- {id: 'csid1', name: '进出口岸', width:95, type: 'string'},
- {id: 'totalAmount', name: '总件数', width:105, type: 'string'},
- {id: 'totalGrossWeight', name: '总毛重', width:98, type: 'string'},
- {id: 'currency', name: '币种', width:70, type: 'string'},
- {id: 'totalPrice', name: '总金额', width:106, type: 'string'},
- {id: 'csid2', name: '对账', width:115, type: 'string'}] : [
- {id: 'checkbox', name: '全选', width:60, type: 'string'},
- {id: 'csid', name: '系统编号', width:120, type: 'string'},
- {id: 'applyTime', name: '报关日期', width:165, type: 'date'},
- {id: 'commissionCompanySimplify', name: '委托公司', width:142, type: 'string'},
- {id: 'status', name: '状态', width:80, type: 'string'},
- {id: 'csid1', name: '进出口岸', width:95, type: 'string'},
- {id: 'totalAmount', name: '总件数', width:105, type: 'string'},
- {id: 'totalGrossWeight', name: '总毛重', width:98, type: 'string'},
- {id: 'currency', name: '币种', width:70, type: 'string'},
- {id: 'totalPrice', name: '总金额', width:106, type: 'string'},
- {id: 'csid2', name: '对账', width:115, type: 'string'}]
- },
- sheetList () {
- return this.urlLink.route === 'clientPage' ? this.$store.state.clientSheet.list.data.content : this.$store.state.severSheet.list.data.content
- },
- data () {
- return WtableClass(JSON.parse(JSON.stringify(this.sheetList.content)), this.thead)
- },
- urlLink () {
- if (this.$route.path.indexOf('clientPage') > -1) {
- return {getData: 'loadClientSheetInfo', route: 'clientPage'}
- } else {
- return {getData: 'loadSeverSheetInfo', route: 'severPage'}
- }
- },
- selectId () {
- let ids = []
- this.selectData.forEach((value) => {
- ids.push(value.id)
- })
- return ids ? ids.join('-') : ''
- }
- },
- methods: {
- // 时间格式化
- formatDate (type) {
- return formatDate(new Date(type), 'yyyy-MM-dd hh:mm:ss')
- },
- // 添加文件
- upload (e, type) {
- this.files[type] = e
- },
- // 删除选择文件
- closeFile (e, type) {
- delete this.files[type]
- },
- // 分页调整数据
- pageEvent (type) {
- this.pageParams.page = type
- let params = {}
- params.page = type
- params.count = this.pageParams.count
- if (this.searchKey) {
- params.keyword = this.searchKey
- }
- if (this.dataTime) {
- params.startTime = this.dataTime[0]
- params.endTime = this.dataTime[1]
- }
- this.$store.dispatch(this.urlLink.getData, params)
- },
- // 搜索
- searchClick () {
- this.pageEvent(1)
- },
- // 表格选中数据
- clickEvent (type) {
- this.clickData = type
- },
- // 表格选中是否有多选
- multipleEvent (type, list) {
- this.hasMultiple = type
- this.selectData = list
- if (this.urlLink.route !== 'clientPage') {
- this.selectedArr = list
- }
- },
- // 新增
- addEvent () {
- this.$router.push('/' + this.urlLink.route +'/entrustApply')
- },
- // 编辑
- editEvent () {
- if (this.hasMultiple) {
- this.$message({
- message: '请选择一条信息!',
- type: 'error'
- })
- } else {
- this.$router.push('/' + this.urlLink.route +'/entrustApply?id=' + this.clickData.id)
- }
- },
- //导入事件
- importClick () {
- this.isDialog = true
- this.dialogInfo = '导入'
- },
- // 供应商导入事件
- materialImportClick () {
- if (this.selectData.length === 0) {
- this.$message({
- message: '至少选择一条信息!',
- type: 'error'
- })
- } else {
- this.isDialog = true
- this.dialogInfo = '供应商导入'
- }
- },
- // 导入文件保存
- saveEvent () {
- if (this.dialogInfo === '导入') {
- this.bomSave()
- }
- if (this.dialogInfo === '供应商导入') {
- this.materialImport()
- }
- },
- // 确认弹窗的关闭
- closeTitle () {
- this.isDialogTitle = false
- this.dialogInfo = ''
- },
- // 确认弹窗确认操作
- enterInfo () {
- if (this.dialogInfo === '删除') {
- this.deleteEvent()
- } else if (this.dialogInfo === '作废') {
- this.cancellationEvent()
- }
- },
- // 删除点击弹窗
- deleteClick () {
- if (this.selectData.length === 0) {
- this.$message({
- message: '至少选择一条信息!',
- type: 'error'
- })
- } else {
- this.isDialogTitle = true
- this.dialogInfo = '删除'
- }
- },
- // 删除处理事件
- deleteEvent () {
- let params = new FormData()
- params.append('ids', this.selectId)
- let config = {
- headers: {'Content-Type': 'multipart/form-data'}
- }
- this.$http.post('/CommissionSheet/delete', params, config)
- .then(res => {
- this.closeTitle()
- if (res.data.success) {
- this.$message({
- message: res.data.message,
- type: 'success'
- })
- this.searchClick()
- } else {
- this.$message({
- message: res.data.message,
- type: 'error'
- })
- }
- })
- },
- // 查看
- lookEvent () {
- if (this.hasMultiple) {
- this.$message({
- message: '请选择一条信息!',
- type: 'error'
- })
- } else {
- this.lookEventDbl(this.clickData)
- }
- },
- // 作废点击弹窗
- cancellationClick () {
- if (this.selectData.length === 0) {
- this.$message({
- message: '至少选择一条信息!',
- type: 'error'
- })
- } else {
- this.isDialogTitle = true
- this.dialogInfo = '作废'
- }
- },
- // 作废
- cancellationEvent () {
- let params = new FormData()
- params.append('ids', this.selectId)
- let config = {
- headers: {'Content-Type': 'multipart/form-data'}
- }
- this.$http.post('/CommissionSheet/abandoned', params, config)
- .then(res => {
- this.closeTitle()
- if (res.data.success) {
- this.$message({
- message: res.data.message,
- type: 'success'
- })
- this.searchClick()
- } else {
- this.$message({
- message: res.data.message,
- type: 'error'
- })
- }
- })
- },
- // 导出委托单
- exportEntrust () {
- if (this.selectData.length === 0) {
- this.$message({
- message: '至少选择一条信息!',
- type: 'error'
- })
- } else {
- window.location.href = '/CommissionSheet/batchDown?ids=' + this.selectId
- }
- },
- // 复制
- copyEvent () {
- if (this.selectData.length === 0) {
- this.$message({
- message: '至少选择一条信息!',
- type: 'error'
- })
- } else {
- let params = new FormData()
- params.append('ids', this.selectId)
- let config = {
- headers: {'Content-Type': 'multipart/form-data'}
- }
- this.$http.post('/CommissionSheet/copy', params, config)
- .then(res => {
- if (res.data.success) {
- this.$message({
- message: '复制信息成功!',
- type: 'success'
- })
- this.searchClick()
- } else {
- this.$message({
- message: res.data.message,
- type: 'error'
- })
- }
- })
- }
- },
- // 供应商资料导入
- materialImport () {
- let params = new FormData()
- params.append('ids', this.selectId)
- for (let i in this.files) {
- if (i !== 'sheet') {
- params.append(i, this.files[i])
- }
- }
- let config = {
- headers: {'Content-Type': 'multipart/form-data'}
- }
- this.$http.post('/CommissionSheet/facilitator/upload', params, config)
- .then(res => {
- if (res.data.success) {
- this.isDialog = false
- this.$message({
- message: '供应商资料导入成功!',
- type: 'success'
- })
- this.searchClick()
- } else {
- this.$message({
- message: res.data.message,
- type: 'error'
- })
- }
- })
- .catch(()=> {
- this.$message({
- message: '请检查网络是否正常!',
- type: 'error'
- })
- })
- },
- // 表格双击事件
- lookEventDbl (type) {
- this.$router.push('/' + this.urlLink.route +'/' + type.id)
- },
- // 下载模板信息
- downBom () {
- window.location.href = '/CommissionSheet/template'
- },
- // 清除选中文件
- closeFile (e, type) {
- delete this.files[type]
- },
- // bom取消
- closebom () {
- this.isDialog = false
- this.dialogInfo = ''
- if (this.$refs.sheetUpload) {
- this.$refs.sheetUpload.closeClick()
- }
- this.$refs.contactUpload.closeClick()
- this.$refs.billUpload.closeClick()
- this.$refs.packagelistUpload.closeClick()
- },
- // bom表单文件导入
- bomSave () {
- if (!this.files.sheet) {
- this.$message({
- message: '委托报关单为必选择项,请选择文件!',
- type: 'error'
- })
- } else {
- let params = new FormData()
- for (let i in this.files) {
- params.append(i, this.files[i])
- }
- let config = {
- headers: {'Content-Type': 'multipart/form-data'}
- }
- let _this = this
- this.$http.post('/CommissionSheet/upload', params, config)
- .then(res => {
- if (res.data.code === 1) {
- this.isDialog = false
- this.$message({
- message: '信息保存成功!',
- type: 'success'
- })
- this.$store.dispatch(this.urlLink.getData, {count: 10, page: 1})
- } else if (res.data.code === 4) {
- this.$message({
- message: '信息保存成功,但信息不符合逻辑,需要再次修改!',
- type: 'error'
- })
- setTimeout(() => {
- _this.$router.push('/' + this.urlLink.route + '/entrustApply?id=' + res.data.content.id)
- }, 300)
- } else {
- this.$message({
- message: res.data.message,
- type: 'error'
- })
- }
- })
- .catch(() => {
- this.$message({
- message: '请检查网络是否正常!',
- type: 'error'
- })
- })
- }
- }
- }
- }
|