|
|
@@ -37,6 +37,11 @@
|
|
|
valueKey="taxRate"
|
|
|
@success="setAllTaxRateChange"
|
|
|
/>
|
|
|
+ <!-- 批量设置数量与单价:仅开发环境提供 -->
|
|
|
+ <setAllCountPrice
|
|
|
+ :disabled="tableBusy || !selection.length"
|
|
|
+ @success="setAllCountPriceChange"
|
|
|
+ />
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -668,6 +673,8 @@
|
|
|
import { changeCount, getAllPrice, getAllDiscountPrice, formatPrice } from '@/BIZComponents/setProduct.js';
|
|
|
import { queryHistoricalUnitPrice } from '@/api/purchasingManage/purchaseOrder';
|
|
|
import setAllValue from '@/BIZComponents/setAllValue.vue'; //批量修改
|
|
|
+ import setAllCountPrice from '@/BIZComponents/setAllCountPrice.vue'; //批量修改数量与单价
|
|
|
+ import { IS_DEV } from '@/config/setting'; //是否开发环境
|
|
|
const dayjs = require('dayjs');
|
|
|
|
|
|
export default {
|
|
|
@@ -707,7 +714,8 @@
|
|
|
productList,
|
|
|
billDetailDialog,
|
|
|
headList,
|
|
|
- setAllValue
|
|
|
+ setAllValue,
|
|
|
+ setAllCountPrice
|
|
|
},
|
|
|
computed: {
|
|
|
tableBusy() {
|
|
|
@@ -1222,6 +1230,41 @@
|
|
|
this.getNotaxSinglePrice();
|
|
|
});
|
|
|
},
|
|
|
+ /**
|
|
|
+ * 批量设置数量与单价:只作用于勾选的行,仅开发环境可用。
|
|
|
+ * 数量对应采购端的 purchaseCount,单价对应 singlePrice(含税单价),
|
|
|
+ * 写完只重算这几行,计量数量、总重、合计、折让、不含税单价同步更新。
|
|
|
+ */
|
|
|
+ setAllCountPriceChange({ count, singlePrice }) {
|
|
|
+ if (!IS_DEV || this.tableBusy) return;
|
|
|
+ const indexS = this.getSelectedIndexes();
|
|
|
+ if (!indexS.length) {
|
|
|
+ this.$message.warning('请先勾选需要设置的行');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ indexS.forEach((i) => {
|
|
|
+ const row = this.form.datasource[i];
|
|
|
+ if (!row) return;
|
|
|
+ if (count !== undefined && count !== null) {
|
|
|
+ this.$set(row, 'purchaseCount', count);
|
|
|
+ }
|
|
|
+ if (singlePrice !== undefined && singlePrice !== null) {
|
|
|
+ this.$set(row, 'singlePrice', singlePrice);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.recalculateTableOnce(indexS);
|
|
|
+ },
|
|
|
+ // 勾选行在数据源中的下标:按 row-key 匹配,不依赖 key 与下标一一对应
|
|
|
+ getSelectedIndexes() {
|
|
|
+ const keys = new Set(this.selection.map((item) => item.key));
|
|
|
+ const indexS = [];
|
|
|
+ this.form.datasource.forEach((row, index) => {
|
|
|
+ if (keys.has(row.key)) {
|
|
|
+ indexS.push(index);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return indexS;
|
|
|
+ },
|
|
|
formatPrice,
|
|
|
async getPurchaseSinglePrice(row) {
|
|
|
this.purchaseSinglePriceData = [];
|