|
|
@@ -29,6 +29,15 @@
|
|
|
@click="openEdit(null)"
|
|
|
>新增</el-button
|
|
|
>
|
|
|
+
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ class="ele-btn-icon"
|
|
|
+ @click="batchDelete"
|
|
|
+ >批量删除</el-button
|
|
|
+ >
|
|
|
</template>
|
|
|
|
|
|
<template v-slot:routingVersion="{ row }">
|
|
|
@@ -51,7 +60,7 @@
|
|
|
@chooseCategory="chooseCategory"
|
|
|
></chooseCategoryList>
|
|
|
|
|
|
- <choose-goods ref="chooseGoodsRef" @chooseGoods="chooseGoods"></choose-goods>
|
|
|
+ <choose-goods ref="chooseGoodsRef" @allGoods="allGoods"></choose-goods>
|
|
|
</ele-modal>
|
|
|
</template>
|
|
|
|
|
|
@@ -71,6 +80,12 @@
|
|
|
selection: [],
|
|
|
|
|
|
columns: [
|
|
|
+ {
|
|
|
+ width: 45,
|
|
|
+ type: 'selection',
|
|
|
+ columnKey: 'selection',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
{
|
|
|
prop: 'categoryLevelCode',
|
|
|
label: '物品分类编码',
|
|
|
@@ -231,6 +246,69 @@
|
|
|
acc[key] = this.deepCopy(obj[key], hash);
|
|
|
return acc;
|
|
|
}, result);
|
|
|
+ },
|
|
|
+
|
|
|
+ allGoods(goodsList) {
|
|
|
+ let categoryList = [];
|
|
|
+ goodsList.forEach((item) => {
|
|
|
+ if (!item.children) {
|
|
|
+ categoryList.push(this.deepCopy(item));
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ categoryList.forEach((item) => {
|
|
|
+ item.routingId = this.routeData.id;
|
|
|
+ item.routingVersion = this.routeData.version;
|
|
|
+ item.routingName = this.routeData.name;
|
|
|
+ item.routingCode = this.routeData.code;
|
|
|
+ item.categoryLevelCode = item.code;
|
|
|
+ item.categoryLevelId = item.id;
|
|
|
+ item.categoryLevelName = item.name;
|
|
|
+ item.type = this.type;
|
|
|
+ });
|
|
|
+ route
|
|
|
+ .batchSaveCategory(categoryList)
|
|
|
+ .then(() => {
|
|
|
+ this.$message.success('保存成功');
|
|
|
+ this.$refs.table.reload();
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.$message.error('保存失败');
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ batchDelete() {
|
|
|
+ if (this.selection.length == 0) {
|
|
|
+ this.$message.warning('请选择需要删除的数据');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const messageTitle =
|
|
|
+ this.type == 1
|
|
|
+ ? '此操将删除该分类所绑定的工艺路线, 是否继续?'
|
|
|
+ : '此操将删除该物品所绑定的工艺路线, 是否继续?';
|
|
|
+
|
|
|
+ this.$confirm(messageTitle, '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ let ids = [];
|
|
|
+ this.selection.forEach((item) => {
|
|
|
+ ids.push(item.id);
|
|
|
+ });
|
|
|
+ route
|
|
|
+ .deteleRoutingCategory(ids)
|
|
|
+ .then(() => {
|
|
|
+ this.$message.success('删除成功');
|
|
|
+ this.$refs.table.reload();
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.$message.error('删除失败');
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
}
|
|
|
}
|
|
|
};
|