🌈 style: 删除console.log

This commit is contained in:
砂糖
2025-08-13 16:39:47 +08:00
parent 08168aba15
commit 53d57e4ccd
20 changed files with 305 additions and 212 deletions

View File

@@ -18,8 +18,8 @@ export default {
this.$store.dispatch('category/getProductMap');
this.$store.dispatch('category/getRawMaterialMap');
this.$store.dispatch('category/getBomMap');
this.$store.dispatch('finance/getFinancialAccounts');
}
console.log(this.$store)
},
metaInfo() {
return {

View File

@@ -0,0 +1,46 @@
<template>
<el-select v-model="_value" placeholder="请选择">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</template>
<script>
import { mapGetters } from 'vuex';
export default {
name: 'AmountSelect',
computed: {
...mapGetters(['financialAccounts']),
_value: {
get() {
return this.value;
},
set(value) {
this.$emit('input', value);
}
}
},
props: {
value: {
type: String,
default: ''
}
},
data() {
return {
options: [],
}
},
mounted() {
this.getFinancialAccounts();
},
methods: {
getFinancialAccounts() {
this.options = this.financialAccounts.map(item => ({
label: item.accountName,
value: item.accountId
}));
},
}
}
</script>

View File

@@ -52,7 +52,6 @@ export default {
},
mounted() {
this.options = this.rawMaterialList;
console.log(this.options, this.rawMaterialList);
},
computed: {
...mapGetters(['rawMaterialList'])

View File

@@ -63,7 +63,6 @@ export default {
productId: {
handler(newVal) {
const res = this.productMap[this.productId] ? this.productMap[this.productId] : {};
console.log(res)
this.product = res;
},
immediate: true

View File

@@ -48,7 +48,6 @@ export default {
materialId: {
handler: function (newVal) {
const res = this.materialMap[this.materialId] ? this.materialMap[this.materialId] : {};
console.log(res)
this.material = res;
},
immediate: true

View File

@@ -44,7 +44,6 @@ export default {
}
this.vditor = new Vditor('vditor', config);
if (this.readonly) {
console.log(this.vditor)
this.vditor.vditor.disabled()
}
},

View File

@@ -18,6 +18,7 @@ const getters = {
sidebarRouters:state => state.permission.sidebarRouters,
productList: state => state.category.productList,
rawMaterialList: state => state.category.rawMaterialList,
bomMap: state => state.category.bomMap
bomMap: state => state.category.bomMap,
financialAccounts: state => state.finance.financialAccounts,
}
export default getters

View File

@@ -7,6 +7,7 @@ import tagsView from './modules/tagsView'
import permission from './modules/permission'
import settings from './modules/settings'
import category from './modules/category'
import finance from './modules/finance'
import getters from './getters'
Vue.use(Vuex)
@@ -19,7 +20,8 @@ const store = new Vuex.Store({
tagsView,
permission,
settings,
category
category,
finance
},
getters
})

View File

@@ -0,0 +1,26 @@
import { listAccount } from "@/api/finance/account";
const state = {
financialAccounts: [],
}
const mutations = {
SET_FINANCIAL_ACCOUNTS(state, financialAccounts) {
state.financialAccounts = financialAccounts;
},
}
const actions = {
getFinancialAccounts({ commit }) {
listAccount().then(response => {
commit('SET_FINANCIAL_ACCOUNTS', response.data);
});
}
}
export default {
namespaced: true,
state,
mutations,
actions
}

View File

@@ -6,15 +6,12 @@
<el-input v-model="form.docNo" placeholder="请输入凭证编号" />
</el-form-item>
<el-form-item label="单据日期" prop="docDate">
<el-date-picker clearable
v-model="form.docDate"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
<el-date-picker clearable v-model="form.docDate" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择单据日期">
</el-date-picker>
</el-form-item>
<el-form-item label="关联订单ID" prop="relatedOrderId">
<el-input v-model="form.relatedOrderId" placeholder="请输入关联订单ID" />
<el-form-item label="关联订单" prop="orderId">
<el-input v-model="form.orderId" placeholder="请输入关联订单" />
</el-form-item>
</el-form>
</el-row>
@@ -29,29 +26,19 @@
</el-table-column>
<el-table-column prop="accountingId" label="会计科目">
<template slot-scope="scope">
<el-input v-model="scope.row.accountingId" placeholder="请输入会计科目" @change="handleRowChange(scope.row)" />
<amount-select v-model="scope.row.accountId" placeholder="请输入会计科目" @change="handleRowChange(scope.row)" />
</template>
</el-table-column>
<el-table-column prop="debitAmount" label="借方金额">
<template slot-scope="scope">
<el-input
v-model.number="scope.row.debitAmount"
type="number"
placeholder="0.00"
@input="handleDebitInput(scope.row)"
@change="handleRowChange(scope.row)"
/>
<el-input v-model.number="scope.row.debitAmount" type="number" placeholder="0.00"
@input="handleDebitInput(scope.row)" @change="handleRowChange(scope.row)" />
</template>
</el-table-column>
<el-table-column prop="creditAmount" label="贷方金额">
<template slot-scope="scope">
<el-input
v-model.number="scope.row.creditAmount"
type="number"
placeholder="0.00"
@input="handleCreditInput(scope.row)"
@change="handleRowChange(scope.row)"
/>
<el-input v-model.number="scope.row.creditAmount" type="number" placeholder="0.00"
@input="handleCreditInput(scope.row)" @change="handleRowChange(scope.row)" />
</template>
</el-table-column>
<el-table-column prop="remark" label="备注">
@@ -61,12 +48,8 @@
</el-table-column>
<el-table-column label="操作" width="100">
<template slot-scope="scope">
<el-button
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.$index)"
:disabled="tableData.length <= 1"
>
<el-button type="text" icon="el-icon-delete" @click="handleDelete(scope.$index)"
:disabled="tableData.length <= 1">
删除
</el-button>
</template>
@@ -96,193 +79,232 @@
</template>
<script>
export default {
data() {
return {
form: {
docNo: undefined,
docDate: undefined,
relatedOrderId: undefined
},
tableData: [{
summary: '',
accountingId: '',
debitAmount: 0,
creditAmount: 0,
remark: ''
}]
}
},
computed: {
// 借方总额和贷方总额(过滤空行)
debitAmount() {
return this.tableData.reduce((total, item) => {
// 只计算有内容的行
if (this.isRowNotEmpty(item)) {
return total + (Number(item.debitAmount) || 0);
}
return total;
}, 0);
import AmountSelect from '@/components/KLPService/AmountSelect/index.vue';
export default {
components: {
AmountSelect
},
data() {
return {
form: {
docNo: undefined,
docDate: undefined,
orderId: undefined
},
creditAmount() {
return this.tableData.reduce((total, item) => {
if (this.isRowNotEmpty(item)) {
return total + (Number(item.creditAmount) || 0);
}
return total;
}, 0);
},
// 大写金额
amountInWords() {
// 如果借贷相等则正常显示,不相等则显示借贷不相等
if (Math.abs(this.debitAmount - this.creditAmount) < 0.01) {
return this.numberToChinese(this.debitAmount);
} else {
return '借贷不相等';
tableData: [{
summary: '',
accountingId: '',
debitAmount: 0,
creditAmount: 0,
remark: ''
}]
}
},
computed: {
// 借方总额和贷方总额(过滤空行)
debitAmount() {
return this.tableData.reduce((total, item) => {
// 只计算有内容的行
if (this.isRowNotEmpty(item)) {
return total + (Number(item.debitAmount) || 0);
}
}
return total;
}, 0);
},
methods: {
// 判断行是否有内容
isRowNotEmpty(row) {
return row.summary || row.accountingId ||
(row.debitAmount && row.debitAmount > 0) ||
(row.creditAmount && row.creditAmount > 0) ||
row.remark;
},
// 处理借方金额输入
handleDebitInput(row) {
// 如果借方金额有值,则清空贷方金额
if (row.debitAmount && row.debitAmount > 0) {
if (row.creditAmount && row.creditAmount > 0) {
this.$message.warning('借方和贷方金额不能同时填写,已自动清空贷方金额');
row.creditAmount = 0;
}
creditAmount() {
return this.tableData.reduce((total, item) => {
if (this.isRowNotEmpty(item)) {
return total + (Number(item.creditAmount) || 0);
}
},
// 处理贷方金额输入
handleCreditInput(row) {
// 如果贷方金额有值,则清空借方金额
return total;
}, 0);
},
// 大写金额
amountInWords() {
// 如果借贷相等则正常显示,不相等则显示借贷不相等
if (Math.abs(this.debitAmount - this.creditAmount) < 0.01) {
return this.numberToChinese(this.debitAmount);
} else {
return '借贷不相等';
}
}
},
methods: {
// 判断行是否有内容
isRowNotEmpty(row) {
return row.summary || row.accountingId ||
(row.debitAmount && row.debitAmount > 0) ||
(row.creditAmount && row.creditAmount > 0) ||
row.remark;
},
// 处理借方金额输入
handleDebitInput(row) {
// 如果借方金额有值,则清空贷方金额
if (row.debitAmount && row.debitAmount > 0) {
if (row.creditAmount && row.creditAmount > 0) {
if (row.debitAmount && row.debitAmount > 0) {
this.$message.warning('借方和贷方金额不能同时填写,已自动清空借方金额');
row.debitAmount = 0;
}
this.$message.warning('借方和贷方金额不能同时填写,已自动清空贷方金额');
row.creditAmount = 0;
}
},
// 处理行数据变化
handleRowChange(row) {
// 检查最后一行是否有内容,如果有则添加新的空行
}
},
// 处理贷方金额输入
handleCreditInput(row) {
// 如果贷方金额有值,则清空借方金额
if (row.creditAmount && row.creditAmount > 0) {
if (row.debitAmount && row.debitAmount > 0) {
this.$message.warning('借方和贷方金额不能同时填写,已自动清空借方金额');
row.debitAmount = 0;
}
}
},
// 处理行数据变化
handleRowChange(row) {
// 检查最后一行是否有内容,如果有则添加新的空行
const lastRow = this.tableData[this.tableData.length - 1];
if (this.isRowNotEmpty(lastRow)) {
this.addEmptyRow();
}
},
// 添加空行
addEmptyRow() {
this.tableData.push({
summary: '',
accountingId: '',
debitAmount: 0,
creditAmount: 0,
remark: ''
});
},
// 删除行
handleDelete(index) {
this.tableData.splice(index, 1);
// 确保至少保留一个空行
if (this.tableData.length === 0) {
this.addEmptyRow();
} else {
// 检查最后一行是否为空,如果不为空则添加新的空行
const lastRow = this.tableData[this.tableData.length - 1];
if (this.isRowNotEmpty(lastRow)) {
this.addEmptyRow();
}
},
// 添加空行
addEmptyRow() {
this.tableData.push({
summary: '',
accountingId: '',
debitAmount: 0,
creditAmount: 0,
remark: ''
});
},
// 删除行
handleDelete(index) {
this.tableData.splice(index, 1);
// 确保至少保留一个空行
if (this.tableData.length === 0) {
this.addEmptyRow();
}
},
// 数字转中文大写金额
numberToChinese(num) {
if (num === 0) return '零元整';
const digits = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
const units = ['', '拾', '佰', '仟', '万', '拾', '佰', '仟', '亿', '拾', '佰', '仟'];
const decimals = ['', '分'];
// 处理整数和小数部分
const parts = num.toFixed(2).split('.');
const integerPart = parts[0];
const decimalPart = parts[1];
let result = '';
// 处理整数部分
for (let i = 0; i < integerPart.length; i++) {
const digit = parseInt(integerPart[i]);
const position = integerPart.length - i - 1;
if (digit !== 0) {
result += digits[digit] + units[position];
} else {
// 检查最后一行是否为空,如果不为空则添加新的空行
const lastRow = this.tableData[this.tableData.length - 1];
if (this.isRowNotEmpty(lastRow)) {
this.addEmptyRow();
// 处理零的情况
if (position % 4 === 0) { // 万或亿的位置
result += units[position];
}
// 避免连续多个零
if (!result.endsWith('零')) {
result += digits[digit];
}
}
},
// 数字转中文大写金额
numberToChinese(num) {
if (num === 0) return '零元整';
const digits = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
const units = ['', '拾', '佰', '仟', '万', '拾', '佰', '仟', '亿', '拾', '佰', '仟'];
const decimals = ['角', ''];
// 处理整数和小数部分
const parts = num.toFixed(2).split('.');
const integerPart = parts[0];
const decimalPart = parts[1];
let result = '';
// 处理整数部分
for (let i = 0; i < integerPart.length; i++) {
const digit = parseInt(integerPart[i]);
const position = integerPart.length - i - 1;
if (digit !== 0) {
result += digits[digit] + units[position];
} else {
// 处理零的情况
if (position % 4 === 0) { // 万或亿的位置
result += units[position];
}
// 避免连续多个零
if (!result.endsWith('零')) {
result += digits[digit];
}
}
}
result += '元';
// 处理小数部分
if (decimalPart === '00') {
result += '整';
} else {
if (decimalPart[0] !== '0') {
result += digits[parseInt(decimalPart[0])] + decimals[0];
}
result += '元';
// 处理小数部分
if (decimalPart === '00') {
result += '整';
} else {
if (decimalPart[0] !== '0') {
result += digits[parseInt(decimalPart[0])] + decimals[0];
}
if (decimalPart[1] !== '0') {
result += digits[parseInt(decimalPart[1])] + decimals[1];
}
if (decimalPart[1] !== '0') {
result += digits[parseInt(decimalPart[1])] + decimals[1];
}
// 处理以零开头的情况
return result.replace(/^零+/, '');
},
handleCreate() {
// 验证所有行的借贷金额是否符合规则
const invalidRows = this.tableData.findIndex(row => {
return this.isRowNotEmpty(row) &&
row.debitAmount > 0 &&
row.creditAmount > 0;
});
if (invalidRows !== -1) {
this.$message.error('存在同时填写借方和贷方金额的行,请检查');
}
// 处理以零开头的情况
return result.replace(/^零+/, '');
},
handleCreate() {
// 验证所有行的借贷金额是否符合规则
const invalidRows = this.tableData.findIndex(row => {
return this.isRowNotEmpty(row) &&
row.debitAmount > 0 &&
row.creditAmount > 0;
});
// 凭证编号,单据日期和关联订单必填
if (!this.form.docNo) {
this.$message.error('凭证编号必填');
return;
}
if (!this.form.docDate) {
this.$message.error('单据日期必填');
return;
}
if (!this.form.orderId) {
this.$message.error('关联订单必填');
return;
}
if (invalidRows !== -1) {
this.$message.error('存在同时填写借方和贷方金额的行,请检查');
return;
}
// 过滤掉空行后提交
const validData = this.tableData.filter(row => this.isRowNotEmpty(row));
if (validData.length === 0) {
this.$message.warning('请至少填写一行凭证数据');
return;
}
// 所有的科目必须填写
const accountIds = validData.map(row => row.accountId);
if (accountIds.some(id => !id)) {
this.$message.error('请填写所有会计科目');
return;
}
// 每一行至少包含借方或贷方金额
const hasDebitOrCredit = validData.some(row => row.debitAmount > 0 || row.creditAmount > 0);
if (!hasDebitOrCredit) {
this.$message.error('请至少填写一行借方或贷方金额');
return;
}
// 借贷必须相同
if (this.debitAmount !== this.creditAmount) {
this.$message.error('借方和贷方金额必须相同');
return;
}
// 过滤掉空行后提交
const validData = this.tableData.filter(row => this.isRowNotEmpty(row));
if (validData.length === 0) {
this.$message.warning('请至少填写一行凭证数据');
return;
}
console.log('表单数据:', this.form);
console.log('表单数据:', this.form, this.debitAmount, this.creditAmount);
console.log('表格数据:', validData);
// 这里可以添加提交逻辑

View File

@@ -357,9 +357,14 @@ export default {
payableId: this.payForm.payableId,
paidAmount: this.payForm.amount
}
this.buttonLoading = true;
updatePaidAmount(payload).then(response => {
this.$modal.msgSuccess("付款成功");
})
this.payOpen = false;
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
}
}
};

View File

@@ -357,6 +357,7 @@ export default {
receivableId: this.receiveForm.receivableId,
paidAmount: this.receiveForm.amount
}
this.buttonLoading = true;
updatePaidAmount(payload).then(response => {
this.$modal.msgSuccess("收款成功");
this.receiveOpen = false;

View File

@@ -136,6 +136,7 @@ export default {
this.$store.dispatch('category/getProductMap');
this.$store.dispatch('category/getRawMaterialMap');
this.$store.dispatch('category/getBomMap');
this.$store.dispatch('finance/getFinancialAccounts');
this.$router.push({ path: this.redirect || "/" }).catch(() => { });
}).catch(() => {
this.loading = false;

View File

@@ -355,7 +355,6 @@ export default {
});
},
handleAddBom(bom) {
console.log('回调触发', bom)
this.bomId = bom.bomId;
this.getList();
},

View File

@@ -355,7 +355,6 @@ export default {
});
},
handleAddBom(bom) {
console.log('回调触发', bom)
this.bomId = bom.bomId;
this.getList();
},

View File

@@ -47,7 +47,6 @@ export default {
orderId: this.orderId,
orderStatus: this.EOrderStatus.PRODUCTIONING,
}).then(response => {
console.log("状态变更成功")
this.$emit('confirm', submitData)
})

View File

@@ -489,7 +489,6 @@ export default {
},
handleUploadQualityCertificate(row) {
this.uploadQualityCertificateOpen = true;
console.log(row, 'row');
this.uploadQualityCertificateInfo = row;
}
}

View File

@@ -122,7 +122,6 @@ export default {
this.$store.dispatch('category/getBomMap');
this.$store.dispatch('category/getRawMaterialMap');
} else if (this.uploadQualityCertificateForm.qualityCertificateType === 3) {
console.log('创建新物料');
// 创建一个新的BOM
const bom = await addBom({
bomName: 'N' + new Date().getTime(),

View File

@@ -140,9 +140,8 @@
</el-dialog>
<el-dialog
:title="title"
title="视频播放"
:visible.sync="openVideo"
width="800px"
v-loading="loading"
element-loading-text="正在加载视频流..."
@close="handleCloseVideo"

View File

@@ -253,7 +253,6 @@ export default {
procInsId: row.procInsId
}
})
console.log(row);
},
/** 取消流程申请 */
handleStop(row){