|
@@ -1,8 +1,5 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="ele-body">
|
|
<div class="ele-body">
|
|
|
- <!-- <el-card shadow="never" v-loading="loading"> -->
|
|
|
|
|
- <!-- 数据表格 -->
|
|
|
|
|
- <!-- :rules="[]" -->
|
|
|
|
|
<el-form ref="form" :model="form" label-width="100px" class="create-form">
|
|
<el-form ref="form" :model="form" label-width="100px" class="create-form">
|
|
|
<ele-pro-table
|
|
<ele-pro-table
|
|
|
ref="tableRef2"
|
|
ref="tableRef2"
|
|
@@ -34,7 +31,6 @@
|
|
|
@change="typeIdChange(scope.row, scope.$index)"
|
|
@change="typeIdChange(scope.row, scope.$index)"
|
|
|
:disabled="schemeTableTool(scope.row)"
|
|
:disabled="schemeTableTool(scope.row)"
|
|
|
>
|
|
>
|
|
|
- <!-- :disabled="type == 'view' || scope.row.isApply == 1" -->
|
|
|
|
|
<el-option
|
|
<el-option
|
|
|
v-for="item in typeIdList"
|
|
v-for="item in typeIdList"
|
|
|
:key="item.value"
|
|
:key="item.value"
|
|
@@ -42,8 +38,9 @@
|
|
|
:value="item.value"
|
|
:value="item.value"
|
|
|
></el-option>
|
|
></el-option>
|
|
|
</el-select>
|
|
</el-select>
|
|
|
- </el-form-item> </template
|
|
|
|
|
- ><template v-slot:feeType="scope">
|
|
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template v-slot:feeType="scope">
|
|
|
<el-form-item
|
|
<el-form-item
|
|
|
style="margin-bottom: 20px"
|
|
style="margin-bottom: 20px"
|
|
|
:prop="'tableList.' + scope.$index + '.feeType'"
|
|
:prop="'tableList.' + scope.$index + '.feeType'"
|
|
@@ -54,7 +51,6 @@
|
|
|
class="w100"
|
|
class="w100"
|
|
|
:disabled="schemeTableTool(scope.row)"
|
|
:disabled="schemeTableTool(scope.row)"
|
|
|
>
|
|
>
|
|
|
- <!-- :disabled="type == 'view' || scope.row.isApply == 1" -->
|
|
|
|
|
<el-option
|
|
<el-option
|
|
|
v-for="item in feeTypeList"
|
|
v-for="item in feeTypeList"
|
|
|
:key="item.value"
|
|
:key="item.value"
|
|
@@ -90,15 +86,11 @@
|
|
|
trigger: ['blur', 'change']
|
|
trigger: ['blur', 'change']
|
|
|
}"
|
|
}"
|
|
|
>
|
|
>
|
|
|
- <!--:disabled="type == 'view' || scope.row.typeId == 2" -->
|
|
|
|
|
<el-input
|
|
<el-input
|
|
|
:disabled="type == 'view' || scope.row.typeId == 2"
|
|
:disabled="type == 'view' || scope.row.typeId == 2"
|
|
|
v-model="scope.row.name"
|
|
v-model="scope.row.name"
|
|
|
style="width: calc(100% - 62px)"
|
|
style="width: calc(100% - 62px)"
|
|
|
></el-input>
|
|
></el-input>
|
|
|
- <!-- scope.row.typeId == 2 &&
|
|
|
|
|
- scope.row.isApply != 1 &&
|
|
|
|
|
- type == 'edit'-->
|
|
|
|
|
<el-button
|
|
<el-button
|
|
|
v-if="chooseShow(scope)"
|
|
v-if="chooseShow(scope)"
|
|
|
size="small"
|
|
size="small"
|
|
@@ -162,7 +154,6 @@
|
|
|
type="number"
|
|
type="number"
|
|
|
:min="1"
|
|
:min="1"
|
|
|
></el-input>
|
|
></el-input>
|
|
|
- <!-- :disabled="type == 'view' || scope.row.isApply == 1" -->
|
|
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</template>
|
|
</template>
|
|
|
<template v-slot:measureUnit="scope">
|
|
<template v-slot:measureUnit="scope">
|
|
@@ -194,7 +185,6 @@
|
|
|
></el-input>
|
|
></el-input>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</template>
|
|
</template>
|
|
|
- <!-- 现在如果是查主数据的话 还可以选择仓库 -->
|
|
|
|
|
<template v-slot:warehouseId="scope">
|
|
<template v-slot:warehouseId="scope">
|
|
|
<el-form-item
|
|
<el-form-item
|
|
|
v-if="scope.row.typeId == '2'"
|
|
v-if="scope.row.typeId == '2'"
|
|
@@ -202,20 +192,19 @@
|
|
|
:prop="'tableList.' + scope.$index + '.warehouseId'"
|
|
:prop="'tableList.' + scope.$index + '.warehouseId'"
|
|
|
>
|
|
>
|
|
|
<el-select
|
|
<el-select
|
|
|
- v-if="obtain == '主数据'"
|
|
|
|
|
|
|
+ v-if="obtain == '主数据' || obtain == '售后'"
|
|
|
v-model="scope.row.warehouseId"
|
|
v-model="scope.row.warehouseId"
|
|
|
placeholder="请选择仓库"
|
|
placeholder="请选择仓库"
|
|
|
class="w100"
|
|
class="w100"
|
|
|
:disabled="schemeTableTool(scope.row)"
|
|
:disabled="schemeTableTool(scope.row)"
|
|
|
|
|
+ @change="handleWarehouseChange(scope.row, scope.$index, $event)"
|
|
|
>
|
|
>
|
|
|
<el-option
|
|
<el-option
|
|
|
v-for="item in scope.row.warehouseList"
|
|
v-for="item in scope.row.warehouseList"
|
|
|
- @click="warehouseChange(item, scope.row, scope.$index)"
|
|
|
|
|
:key="item.warehouseId"
|
|
:key="item.warehouseId"
|
|
|
:label="item.warehouseName"
|
|
:label="item.warehouseName"
|
|
|
:value="item.warehouseId"
|
|
:value="item.warehouseId"
|
|
|
></el-option>
|
|
></el-option>
|
|
|
- <!-- :disabled="type == 'view' || scope.row.isApply == 1" -->
|
|
|
|
|
</el-select>
|
|
</el-select>
|
|
|
<el-input
|
|
<el-input
|
|
|
v-model="scope.row.warehouseName"
|
|
v-model="scope.row.warehouseName"
|
|
@@ -233,11 +222,10 @@
|
|
|
placeholder="请选择仓库"
|
|
placeholder="请选择仓库"
|
|
|
class="w100"
|
|
class="w100"
|
|
|
:disabled="schemeTableTool(scope.row)"
|
|
:disabled="schemeTableTool(scope.row)"
|
|
|
|
|
+ @change="handleWarehouseChange(scope.row, scope.$index, $event)"
|
|
|
>
|
|
>
|
|
|
- <!-- :disabled="type == 'view' || scope.row.isApply == 1" -->
|
|
|
|
|
<el-option
|
|
<el-option
|
|
|
v-for="item in scope.row.warehouseList"
|
|
v-for="item in scope.row.warehouseList"
|
|
|
- @click="warehouseChange(item, scope.row, scope.$index)"
|
|
|
|
|
:key="item.warehouseId"
|
|
:key="item.warehouseId"
|
|
|
:label="item.warehouseName"
|
|
:label="item.warehouseName"
|
|
|
:value="item.warehouseId"
|
|
:value="item.warehouseId"
|
|
@@ -254,7 +242,6 @@
|
|
|
@click="del(row, $index)"
|
|
@click="del(row, $index)"
|
|
|
>删除</el-link
|
|
>删除</el-link
|
|
|
>
|
|
>
|
|
|
- <!-- v-if="type != 'view' && row.isApply != 1 && source != '报工信息'" -->
|
|
|
|
|
</template>
|
|
</template>
|
|
|
<template v-slot:headerName="{ column }">
|
|
<template v-slot:headerName="{ column }">
|
|
|
<span class="is-required">{{ column.label }}</span>
|
|
<span class="is-required">{{ column.label }}</span>
|
|
@@ -269,7 +256,6 @@
|
|
|
itemType="5"
|
|
itemType="5"
|
|
|
:isFirstRefreshTable="true"
|
|
:isFirstRefreshTable="true"
|
|
|
></product-list>
|
|
></product-list>
|
|
|
- <!-- <applyForSpare ref="edit" :inlet="1" /> -->
|
|
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -284,18 +270,15 @@ import productList from '@/BIZComponents/product-list.vue';
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
components: {
|
|
components: {
|
|
|
- // applyForSpare,
|
|
|
|
|
AssetsDialog,
|
|
AssetsDialog,
|
|
|
productList
|
|
productList
|
|
|
},
|
|
},
|
|
|
props: {
|
|
props: {
|
|
|
type: '',
|
|
type: '',
|
|
|
- // 数据来源
|
|
|
|
|
source: {
|
|
source: {
|
|
|
default: '',
|
|
default: '',
|
|
|
type: String
|
|
type: String
|
|
|
},
|
|
},
|
|
|
- // 表格权限操作 状态
|
|
|
|
|
state: {
|
|
state: {
|
|
|
default: '',
|
|
default: '',
|
|
|
type: String
|
|
type: String
|
|
@@ -310,7 +293,7 @@ export default {
|
|
|
},
|
|
},
|
|
|
hideFeeType: {
|
|
hideFeeType: {
|
|
|
type: Boolean,
|
|
type: Boolean,
|
|
|
- default: false // 默认显示
|
|
|
|
|
|
|
+ default: false
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
data() {
|
|
data() {
|
|
@@ -324,7 +307,8 @@ export default {
|
|
|
feeTypeList: [
|
|
feeTypeList: [
|
|
|
{ label: '收入', value: '1' },
|
|
{ label: '收入', value: '1' },
|
|
|
{ label: '支出', value: '2' }
|
|
{ label: '支出', value: '2' }
|
|
|
- ]
|
|
|
|
|
|
|
+ ],
|
|
|
|
|
+ currentIndex: -1
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
@@ -364,10 +348,8 @@ export default {
|
|
|
slot: 'feeType',
|
|
slot: 'feeType',
|
|
|
minWidth: 150,
|
|
minWidth: 150,
|
|
|
showOverflowTooltip: true,
|
|
showOverflowTooltip: true,
|
|
|
-
|
|
|
|
|
show: !this.hideFeeType
|
|
show: !this.hideFeeType
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
{
|
|
{
|
|
|
prop: 'name',
|
|
prop: 'name',
|
|
|
label: '名称',
|
|
label: '名称',
|
|
@@ -460,7 +442,6 @@ export default {
|
|
|
}
|
|
}
|
|
|
];
|
|
];
|
|
|
},
|
|
},
|
|
|
- // 选择按钮显示
|
|
|
|
|
chooseShow() {
|
|
chooseShow() {
|
|
|
return (scope) => {
|
|
return (scope) => {
|
|
|
if (this.source == '配件回收') {
|
|
if (this.source == '配件回收') {
|
|
@@ -473,8 +454,6 @@ export default {
|
|
|
return flag;
|
|
return flag;
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
- // 添加 按钮显示权限
|
|
|
|
|
buttonJud() {
|
|
buttonJud() {
|
|
|
if (this.source == '派单进来') {
|
|
if (this.source == '派单进来') {
|
|
|
return true;
|
|
return true;
|
|
@@ -482,7 +461,6 @@ export default {
|
|
|
let flag = this.type != 'view' && this.source != '报工信息';
|
|
let flag = this.type != 'view' && this.source != '报工信息';
|
|
|
return flag;
|
|
return flag;
|
|
|
},
|
|
},
|
|
|
- // 方案列表删除权限
|
|
|
|
|
schemeOperate() {
|
|
schemeOperate() {
|
|
|
return (row) => {
|
|
return (row) => {
|
|
|
if (this.source == '配件回收') {
|
|
if (this.source == '配件回收') {
|
|
@@ -493,14 +471,12 @@ export default {
|
|
|
return flag;
|
|
return flag;
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
- // 方案表格操作权限
|
|
|
|
|
schemeTableTool() {
|
|
schemeTableTool() {
|
|
|
return (row) => {
|
|
return (row) => {
|
|
|
let flag = this.type == 'view' || row.isApply == 1;
|
|
let flag = this.type == 'view' || row.isApply == 1;
|
|
|
return flag;
|
|
return flag;
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
- // input输入权限
|
|
|
|
|
inputOperate() {
|
|
inputOperate() {
|
|
|
return (row) => {
|
|
return (row) => {
|
|
|
let flag = this.type == 'view' || row.isApply == 1;
|
|
let flag = this.type == 'view' || row.isApply == 1;
|
|
@@ -555,7 +531,7 @@ export default {
|
|
|
const defaultFeeType = row.typeId === '5' ? '2' : '1';
|
|
const defaultFeeType = row.typeId === '5' ? '2' : '1';
|
|
|
let obj = {
|
|
let obj = {
|
|
|
typeId: row.typeId,
|
|
typeId: row.typeId,
|
|
|
- feeType: defaultFeeType, // 这里根据typeId动态设置默认值
|
|
|
|
|
|
|
+ feeType: defaultFeeType,
|
|
|
code: '',
|
|
code: '',
|
|
|
name: '',
|
|
name: '',
|
|
|
categoryModel: '',
|
|
categoryModel: '',
|
|
@@ -572,7 +548,6 @@ export default {
|
|
|
}
|
|
}
|
|
|
this.$set(this.form.tableList, index, obj);
|
|
this.$set(this.form.tableList, index, obj);
|
|
|
},
|
|
},
|
|
|
- // spareParts 组件的 getValidate 方法
|
|
|
|
|
getValidate() {
|
|
getValidate() {
|
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
|
this.$refs.form.validate((valid, obj) => {
|
|
this.$refs.form.validate((valid, obj) => {
|
|
@@ -600,9 +575,6 @@ export default {
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
async addEquipment(row, index) {
|
|
async addEquipment(row, index) {
|
|
|
- // const res = await parameterGetByCode({
|
|
|
|
|
- // code: 'after_sales_accessory_source'
|
|
|
|
|
- // });
|
|
|
|
|
this.currentIndex = index;
|
|
this.currentIndex = index;
|
|
|
if (this.obtain == '仓库') {
|
|
if (this.obtain == '仓库') {
|
|
|
this.$refs.productListRef.open('', index, '0');
|
|
this.$refs.productListRef.open('', index, '0');
|
|
@@ -614,30 +586,34 @@ export default {
|
|
|
return this.form.tableList;
|
|
return this.form.tableList;
|
|
|
},
|
|
},
|
|
|
async setTableValue(val) {
|
|
async setTableValue(val) {
|
|
|
- const tableList = JSON.parse(JSON.stringify(val));
|
|
|
|
|
- for (let i = 0; i < tableList.length; i++) {
|
|
|
|
|
- const item = tableList[i];
|
|
|
|
|
- item.feeType = (item.feeType || '1').toString();
|
|
|
|
|
- item.categoryCode = item.categoryCode || item.code;
|
|
|
|
|
- item.categoryName = item.categoryName || item.name;
|
|
|
|
|
- if (item.typeId == 2) {
|
|
|
|
|
- const warehouseList = await getIdWarehouseList({ categoryId: item.categoryId });
|
|
|
|
|
- item.warehouseList = warehouseList;
|
|
|
|
|
- if (item.warehouseId) {
|
|
|
|
|
- const matchedWarehouse = warehouseList.find(wh => wh.warehouseId === item.warehouseId);
|
|
|
|
|
- if (matchedWarehouse) {
|
|
|
|
|
- item.warehouseName = matchedWarehouse.warehouseName; // 同步仓库名
|
|
|
|
|
|
|
+ const tableList = JSON.parse(JSON.stringify(val));
|
|
|
|
|
+ for (let i = 0; i < tableList.length; i++) {
|
|
|
|
|
+ const item = tableList[i];
|
|
|
|
|
+ item.feeType = (item.feeType || '1').toString();
|
|
|
|
|
+ item.categoryCode = item.categoryCode || item.code;
|
|
|
|
|
+ item.categoryName = item.categoryName || item.name;
|
|
|
|
|
+ if (item.typeId == 2) {
|
|
|
|
|
+ const warehouseList = await getIdWarehouseList({
|
|
|
|
|
+ categoryId: item.categoryId
|
|
|
|
|
+ });
|
|
|
|
|
+ item.warehouseList = warehouseList;
|
|
|
|
|
+ if (item.warehouseId) {
|
|
|
|
|
+ const matchedWarehouse = warehouseList.find(
|
|
|
|
|
+ (wh) => wh.warehouseId === item.warehouseId
|
|
|
|
|
+ );
|
|
|
|
|
+ if (matchedWarehouse) {
|
|
|
|
|
+ item.warehouseName = matchedWarehouse.warehouseName;
|
|
|
|
|
+ }
|
|
|
|
|
+ item.warehouseNum = await getWarehouseOutStock({
|
|
|
|
|
+ warehouseId: item.warehouseId,
|
|
|
|
|
+ code: item.categoryCode
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- item.warehouseNum = await getWarehouseOutStock({
|
|
|
|
|
- warehouseId: item.warehouseId,
|
|
|
|
|
- code: item.categoryCode
|
|
|
|
|
- });
|
|
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- this.$set(this.form, 'tableList', tableList);
|
|
|
|
|
- this.calculatePrice();
|
|
|
|
|
-},
|
|
|
|
|
|
|
+ this.$set(this.form, 'tableList', tableList);
|
|
|
|
|
+ this.calculatePrice();
|
|
|
|
|
+ },
|
|
|
totalCountChange(index, data, name) {
|
|
totalCountChange(index, data, name) {
|
|
|
data[name] = data[name].replace(/[^\d]/g, '').replace(/^0+/, '') || '0';
|
|
data[name] = data[name].replace(/[^\d]/g, '').replace(/^0+/, '') || '0';
|
|
|
let row = this.form.tableList[index];
|
|
let row = this.form.tableList[index];
|
|
@@ -656,7 +632,6 @@ export default {
|
|
|
clearList() {
|
|
clearList() {
|
|
|
this.form.tableList = [];
|
|
this.form.tableList = [];
|
|
|
},
|
|
},
|
|
|
- // 计算汇总价格 ***
|
|
|
|
|
calculatePrice() {
|
|
calculatePrice() {
|
|
|
let totlal = 0;
|
|
let totlal = 0;
|
|
|
this.form.tableList.map((el) => (totlal += el.settlementPrice));
|
|
this.form.tableList.map((el) => (totlal += el.settlementPrice));
|
|
@@ -676,7 +651,6 @@ export default {
|
|
|
...data[0],
|
|
...data[0],
|
|
|
feeType: feeType
|
|
feeType: feeType
|
|
|
};
|
|
};
|
|
|
- // 用合并后的新对象更新行数据
|
|
|
|
|
this.$set(this.form.tableList, this.currentIndex, newRow);
|
|
this.$set(this.form.tableList, this.currentIndex, newRow);
|
|
|
this.$set(
|
|
this.$set(
|
|
|
this.form.tableList[this.currentIndex],
|
|
this.form.tableList[this.currentIndex],
|
|
@@ -712,13 +686,20 @@ export default {
|
|
|
this.$set(this.form.tableList[this.currentIndex], 'typeId', '2');
|
|
this.$set(this.form.tableList[this.currentIndex], 'typeId', '2');
|
|
|
this.$forceUpdate();
|
|
this.$forceUpdate();
|
|
|
},
|
|
},
|
|
|
- async warehouseChange(item, row, index) {
|
|
|
|
|
- this.$set(
|
|
|
|
|
- this.form.tableList[index],
|
|
|
|
|
- 'warehouseName',
|
|
|
|
|
- item.warehouseName
|
|
|
|
|
|
|
+ // 处理仓库选择变更
|
|
|
|
|
+ async handleWarehouseChange(row, index, warehouseId) {
|
|
|
|
|
+ const selectedWarehouse = row.warehouseList.find(
|
|
|
|
|
+ item => item.warehouseId === warehouseId
|
|
|
);
|
|
);
|
|
|
|
|
+ if (selectedWarehouse) {
|
|
|
|
|
+ await this.warehouseChange(selectedWarehouse, row, index);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ // 仓库变更后更新库存
|
|
|
|
|
+ async warehouseChange(item, row, index) {
|
|
|
|
|
+ this.$set(this.form.tableList[index], 'warehouseName', item.warehouseName);
|
|
|
this.$set(this.form.tableList[index], 'warehouseId', item.warehouseId);
|
|
this.$set(this.form.tableList[index], 'warehouseId', item.warehouseId);
|
|
|
|
|
+ // 重新调用库存查询接口
|
|
|
this.$set(
|
|
this.$set(
|
|
|
this.form.tableList[index],
|
|
this.form.tableList[index],
|
|
|
'warehouseNum',
|
|
'warehouseNum',
|