|
@@ -57,43 +57,52 @@ export default {
|
|
|
watch: {},
|
|
|
methods: {
|
|
|
//
|
|
|
- changeMaterialName(prop) {
|
|
|
- const { row } = prop;
|
|
|
- const { puOrg, customer, supplier } = this.params;
|
|
|
- const { tax: taxName, unitName, code: materialCode } = row;
|
|
|
- // task 1
|
|
|
- tax(taxName).then((res) => {
|
|
|
- const { ntaxrate } = res;
|
|
|
- row.tax = ntaxrate === "0E-8" ? "0.000000" : (ntaxrate * 1).toFixed(6);
|
|
|
- });
|
|
|
- // task 2
|
|
|
- unit(unitName).then((res) => {
|
|
|
- const { id, code, name } = res;
|
|
|
- row.unit = id;
|
|
|
- row.unitCode = code;
|
|
|
- row.unitName = name;
|
|
|
- row.puUnit = id;
|
|
|
- row.puUnitCode = code;
|
|
|
- row.puUnitName = name;
|
|
|
- });
|
|
|
- // task 3
|
|
|
- currency("人民币").then((res) => {
|
|
|
- const { id, code, name } = res;
|
|
|
- row.currency = id;
|
|
|
- row.currencyCode = code;
|
|
|
- row.currencyName = name;
|
|
|
- });
|
|
|
- // task 4
|
|
|
- fetchExist({ puOrg, customer, supplier, materialCode }).then((res) => {
|
|
|
- const { recentlyPrice, isApprovalFirst, isPriceAdjustment } = res;
|
|
|
- row.recentlyPrice = recentlyPrice;
|
|
|
- if (isApprovalFirst) {
|
|
|
- row.isApprovalFirst = isApprovalFirst == 0 ? "Y" : "N";
|
|
|
- }
|
|
|
- if (isPriceAdjustment) {
|
|
|
- row.isPriceAdjustment = isPriceAdjustment == 0 ? "Y" : "N";
|
|
|
- }
|
|
|
- });
|
|
|
+ async changeMaterialName(prop) {
|
|
|
+ const { selectData } = prop;
|
|
|
+ const {
|
|
|
+ puOrg,
|
|
|
+ customer,
|
|
|
+ supplier,
|
|
|
+ currency,
|
|
|
+ currencyCode,
|
|
|
+ currencyName,
|
|
|
+ } = this.params;
|
|
|
+ if (selectData.length) {
|
|
|
+ this.params[this.tabName].splice(-1);
|
|
|
+ }
|
|
|
+ for (const item of selectData) {
|
|
|
+ const { tax: taxName, unitName, code: materialCode } = item;
|
|
|
+ // task 1
|
|
|
+ const { ntaxrate } = await tax(taxName);
|
|
|
+ // task 2
|
|
|
+ const {
|
|
|
+ id: puUnit,
|
|
|
+ code: puUnitCode,
|
|
|
+ name: puUnitName,
|
|
|
+ } = await unit(unitName);
|
|
|
+ // task 3
|
|
|
+ const {
|
|
|
+ recentlyPrice = "0",
|
|
|
+ isApprovalFirst = "N",
|
|
|
+ isPriceAdjustment = "N",
|
|
|
+ } = await fetchExist({ puOrg, customer, supplier, materialCode });
|
|
|
+ await this.onRowAdd(this.tabName, {
|
|
|
+ ...item,
|
|
|
+ currency: currency,
|
|
|
+ currencyCode: currencyCode,
|
|
|
+ currencyName: currencyName,
|
|
|
+ unit: puUnit,
|
|
|
+ unitCode: puUnitCode,
|
|
|
+ unitName: puUnitName,
|
|
|
+ puUnit: puUnit,
|
|
|
+ puUnitCode: puUnitCode,
|
|
|
+ puUnitName: puUnitName,
|
|
|
+ recentlyPrice,
|
|
|
+ isApprovalFirst,
|
|
|
+ isPriceAdjustment,
|
|
|
+ tax: Number(ntaxrate === "0E-8" ? 0 : ntaxrate).toFixed(6),
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
//
|
|
|
async onOpen() {
|
|
@@ -103,15 +112,11 @@ export default {
|
|
|
deptName: puDeptName,
|
|
|
name: buyer,
|
|
|
nickName: buyerName,
|
|
|
- orgId: puOrg,
|
|
|
- orgName: puOrgName,
|
|
|
} = this.$store.state.user;
|
|
|
const { id, code, name } = await currency("人民币");
|
|
|
this.params.currency = id;
|
|
|
this.params.currencyCode = code;
|
|
|
this.params.currencyName = name;
|
|
|
- this.params.puOrg = puOrg;
|
|
|
- this.params.puOrgName = puOrgName;
|
|
|
this.params.buyer = buyer;
|
|
|
this.params.buyerName = buyerName;
|
|
|
this.params.puDept = puDept;
|
|
@@ -124,7 +129,7 @@ export default {
|
|
|
this.params = this.$init.params([...TabColumns, ...TableColumns]);
|
|
|
},
|
|
|
//
|
|
|
- async onRowAdd(prop) {
|
|
|
+ async onRowAdd(prop, pushParams = {}) {
|
|
|
const {
|
|
|
$notify,
|
|
|
TabColumns,
|
|
@@ -142,6 +147,7 @@ export default {
|
|
|
this.params[prop].push({
|
|
|
delFlag: "0",
|
|
|
...this.$init.params(TableColumns),
|
|
|
+ ...pushParams,
|
|
|
});
|
|
|
},
|
|
|
//
|
|
@@ -216,16 +222,6 @@ export default {
|
|
|
label-position="right"
|
|
|
style="padding: 20px"
|
|
|
>
|
|
|
- <template slot="puOrgName" slot-scope="scope">
|
|
|
- <component
|
|
|
- v-bind="scope.attr"
|
|
|
- v-model="scope.row[scope.item.key]"
|
|
|
- :size="$attrs.size"
|
|
|
- :source.sync="scope.row"
|
|
|
- @change="changePuOrgName({ ...scope, select: $event })"
|
|
|
- >
|
|
|
- </component
|
|
|
- ></template>
|
|
|
</el-super-form>
|
|
|
<el-tabs v-model="tabName" style="padding: 0 20px 20px">
|
|
|
<el-tab-pane
|
|
@@ -235,39 +231,41 @@ export default {
|
|
|
:name="item.key"
|
|
|
lazy
|
|
|
>
|
|
|
- <el-super-table
|
|
|
- v-model="params[item.key]"
|
|
|
- :dict="dict"
|
|
|
- :ref="tabName"
|
|
|
- :columns="columns"
|
|
|
- :size="$attrs.size"
|
|
|
- >
|
|
|
- <template slot="materialName" slot-scope="scope">
|
|
|
- <component
|
|
|
- v-bind="scope.attr"
|
|
|
- v-model="scope.row[scope.item.key]"
|
|
|
- :size="$attrs.size"
|
|
|
- :source.sync="scope.row"
|
|
|
- @change="changeMaterialName(scope)"
|
|
|
- >
|
|
|
- </component>
|
|
|
- </template>
|
|
|
- <el-table-column fixed="right" label="操作" width="100">
|
|
|
- <template slot="header" slot-scope="scope">
|
|
|
- <el-button :size="$attrs.size" @click="onRowAdd(tabName)">
|
|
|
- 新增
|
|
|
- </el-button>
|
|
|
- </template>
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-button
|
|
|
+ <div v-loading="loading" style="height: 600px; display: flex">
|
|
|
+ <el-super-table
|
|
|
+ v-model="params[item.key]"
|
|
|
+ :dict="dict"
|
|
|
+ :ref="tabName"
|
|
|
+ :columns="columns"
|
|
|
+ :size="$attrs.size"
|
|
|
+ >
|
|
|
+ <template slot="materialName" slot-scope="scope">
|
|
|
+ <component
|
|
|
+ v-bind="scope.attr"
|
|
|
+ v-model="scope.row[scope.item.key]"
|
|
|
:size="$attrs.size"
|
|
|
- @click.native.prevent="onRowRemove(tabName, scope)"
|
|
|
+ :source.sync="scope.row"
|
|
|
+ @change="changeMaterialName({ ...scope, selectData: $event })"
|
|
|
>
|
|
|
- 删除
|
|
|
- </el-button>
|
|
|
+ </component>
|
|
|
</template>
|
|
|
- </el-table-column>
|
|
|
- </el-super-table>
|
|
|
+ <el-table-column fixed="right" label="操作" width="100">
|
|
|
+ <template slot="header" slot-scope="scope">
|
|
|
+ <el-button :size="$attrs.size" @click="onRowAdd(tabName)">
|
|
|
+ 新增
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ :size="$attrs.size"
|
|
|
+ @click.native.prevent="onRowRemove(tabName, scope)"
|
|
|
+ >
|
|
|
+ 删除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-super-table>
|
|
|
+ </div>
|
|
|
</el-tab-pane>
|
|
|
</el-tabs>
|
|
|
</el-drawer>
|