diff --git a/yxt-as-ui/src/api/operation/claimstatement.js b/yxt-as-ui/src/api/operation/claimstatement.js index fe0d648a07..8c84cd2005 100644 --- a/yxt-as-ui/src/api/operation/claimstatement.js +++ b/yxt-as-ui/src/api/operation/claimstatement.js @@ -10,6 +10,22 @@ export default { headers: { 'Content-Type': 'application/json' } }) }, + update: function(data) { + return request({ + url: '/as/v1/AsBusclaimBill/update', + method: 'post', + data: data, + headers: { 'Content-Type': 'application/json' } + }) + }, + delBySids: function(data) { + return request({ + url: '/as/v1/AsBusclaimBill/delBySids', + method: 'DELETE', + data: data, + headers: { 'Content-Type': 'application/json' } + }) + }, downloadExcel: function() { return request({ url: '/as/v1/AsBusclaimBill/downloadExcel', @@ -19,5 +35,16 @@ export default { 'Content-Type': 'application/json' } }) + }, + excelList: function(data) { + return request({ + url: '/as/v1/AsBusclaimBill/excelList', + method: 'post', + data: data, + responseType: 'blob', // 表明返回服务器返回的数据类型 + headers: { + 'Content-Type': 'application/json' + } + }) } } diff --git a/yxt-as-ui/src/views/operation/claimstatement/claimstatement.vue b/yxt-as-ui/src/views/operation/claimstatement/claimstatement.vue index b61e99d24b..f4b3ed8d65 100644 --- a/yxt-as-ui/src/views/operation/claimstatement/claimstatement.vue +++ b/yxt-as-ui/src/views/operation/claimstatement/claimstatement.vue @@ -12,14 +12,37 @@ + + + - + + + + + + + + + + + + + + + + + + + + + @@ -48,8 +71,12 @@ + + + + @@ -57,12 +84,10 @@ - - - - + + + + @@ -142,6 +228,27 @@ export default { return { btndisabled: false, btnList: [ + { + type: 'primary', + size: 'small', + icon: 'edit', + btnKey: 'toEdit', + btnLabel: '编辑' + }, + { + type: 'danger', + size: 'small', + icon: 'del', + btnKey: 'doDel', + btnLabel: '删除' + }, + { + type: 'success', + size: 'small', + icon: 'export', + btnKey: 'doExport', + btnLabel: '导出' + }, { type: 'success', size: 'small', @@ -163,22 +270,27 @@ export default { tableKey: 0, list: [], sids: [], // 用于导出的时候保存已选择的SIDs + multipleSelection: [], state_list: [ { dictKey: '0', - dictValue: '审核中' + dictValue: '审核不通过' }, { dictKey: '1', - dictValue: '已通过' + dictValue: '未提报' }, { dictKey: '2', - dictValue: '未通过' + dictValue: '审核通过' }, { dictKey: '3', dictValue: '作废' + }, + { + dictKey: '4', + dictValue: '已驳回' } ], invoiceState_list: [ @@ -215,7 +327,16 @@ export default { params: { billNo: '', repairBillNo: '', + shClaimTypeValue: '', + entryTimeStart: '', + entryTimeEnd: '', + finishTimeStart: '', + finishTimeEnd: '', + settleTimeStart: '', + settleTimeEnd: '', state: '', + auditDateStart: '', + auditDateEnd: '', invoiceState: '', adjustState: '', createBySid: '', @@ -231,6 +352,21 @@ export default { }, headers: { token: window.sessionStorage.getItem('token') + }, + dialogVisibleByForm: false, + formobj: { + sid: '', + billNo: '', + vinNo: '', + claimHourAmount: '', + claimGoodsAmount: '', + claimOutAmount: '', + claimSubsidyAmount: '', + claimRescueAmount: '', + claimOtherAmount: '', + state: '', + auditDate: '', + policyDate: '' } } }, @@ -253,6 +389,15 @@ export default { btnHandle(btnKey) { console.log('XXXXXXXXXXXXXXX ' + btnKey) switch (btnKey) { + case 'toEdit': + this.toEdit() + break + case 'doDel': + this.doDel() + break + case 'doExport': + this.doExport() + break case 'doImport': this.doImport() break @@ -270,6 +415,7 @@ export default { aa.push(element.sid) }) this.sids = aa + this.multipleSelection = row }, // 表中序号 indexMethod(index) { @@ -307,7 +453,16 @@ export default { params: { billNo: '', repairBillNo: '', + shClaimTypeValue: '', + entryTimeStart: '', + entryTimeEnd: '', + finishTimeStart: '', + finishTimeEnd: '', + settleTimeStart: '', + settleTimeEnd: '', state: '', + auditDateStart: '', + auditDateEnd: '', invoiceState: '', adjustState: '', createBySid: '', @@ -316,10 +471,99 @@ export default { } this.getList() }, - doImport() { - this.dialogVisible = true - this.fileList = [] - this.uploadResultMesssage = '' + getNumber(val, limit) { + val = val.replace(/[^0-9.]/g, '') // 保留数字 + val = val.replace(/^00/, '0.') // 开头不能有两个0 + val = val.replace(/^\./g, '0.') // 开头为小数点转换为0. + val = val.replace(/\.{2,}/g, '.') // 两个以上的小数点转换成一个 + val = val.replace('.', '$#$').replace(/\./g, '').replace('$#$', '.'); // 只保留一个小数点 + /^0\d+/.test(val) ? val = val.slice(1) : '' // 两位以上数字开头不能为0 + const str = '^(\\d+)\\.(\\d{' + limit + '}).*$' + const reg = new RegExp(str) + if (limit === 0) { + // 不需要小数点 + val = val.replace(reg, '$1') + } else { + // 通过正则保留小数点后指定的位数 + val = val.replace(reg, '$1.$2') + } + return val + }, + toEdit() { + if (this.multipleSelection.length === 1) { + this.dialogVisibleByForm = true + this.formobj = { + sid: this.multipleSelection[0].sid, + billNo: this.multipleSelection[0].billNo, + vinNo: this.multipleSelection[0].vinNo, + claimHourAmount: this.multipleSelection[0].claimHourAmount, + claimGoodsAmount: this.multipleSelection[0].claimGoodsAmount, + claimOutAmount: this.multipleSelection[0].claimOutAmount, + claimSubsidyAmount: this.multipleSelection[0].claimSubsidyAmount, + claimRescueAmount: this.multipleSelection[0].claimRescueAmount, + claimOtherAmount: this.multipleSelection[0].claimOtherAmount, + state: this.multipleSelection[0].state, + auditDate: this.multipleSelection[0].auditDate, + policyDate: this.multipleSelection[0].policyDate + } + } else { + this.$message({ showClose: true, type: 'error', message: '请选择一条记录进行操作' }) + } + }, + FormByConfirm() { + req.update(this.formobj).then((resp) => { + if (resp.success) { + this.$message({ showClose: true, type: 'success', message: '操作成功' }) + this.getList() + this.FormByColse() + } + }) + }, + FormByColse() { + this.dialogVisibleByForm = false + this.formobj = { + sid: '', + billNo: '', + vinNo: '', + claimHourAmount: '', + claimGoodsAmount: '', + claimOutAmount: '', + claimSubsidyAmount: '', + claimRescueAmount: '', + claimOtherAmount: '', + state: '', + auditDate: '', + policyDate: '' + } + }, + doDel() { + if (this.sids.length === 0) { + this.$message({ showClose: true, type: 'error', message: '请选择至少一条记录进行删除操作' }) + return + } + const tip = '请确认是否删除所选 ' + this.sids.length + ' 条记录?' + this.$confirm(tip, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + const loading = this.$loading({ + lock: true, + text: 'Loading', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)' + }) + req.delBySids(this.sids).then(resp => { + if (resp.success) { + this.$message({ type: 'success', message: resp.msg, showClose: true }) + } + this.getList() + loading.close() + }).catch(e => { + loading.close() + }) + }).catch(() => { + }) }, downLoad() { const loading = this.$loading({ @@ -346,6 +590,36 @@ export default { loading.close() }) }, + doExport() { + const loading = this.$loading({ + lock: true, + text: 'Loading', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)' + }) + req.excelList(this.listQuery.params).then((resp) => { + loading.close() + const blob = new Blob([resp], { + type: 'application/vnd.ms-excel' + }) + const fileName = '厂家索赔单' + '.xls' + const elink = document.createElement('a') + elink.download = fileName + elink.style.display = 'nonde' + elink.href = URL.createObjectURL(blob) + document.body.appendChild(elink) + elink.click() + URL.revokeObjectURL(elink.href) + document.body.removeChild(elink) + }).catch(() => { + loading.close() + }) + }, + doImport() { + this.dialogVisible = true + this.fileList = [] + this.uploadResultMesssage = '' + }, handleChange(file) { this.uploadData.fileName = file.name }, @@ -376,4 +650,17 @@ export default { }