|
|
@@ -70,7 +70,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import { saveBomTreeList, bomCategoryUpdate } from '@/api/material/BOM.js';
|
|
|
+ import { saveBomTreeList, bomCategoryUpdate, hasNewVersion } from '@/api/material/BOM.js';
|
|
|
import { getCode } from '@/api/codeManagement/index.js';
|
|
|
export default {
|
|
|
data() {
|
|
|
@@ -145,7 +145,7 @@
|
|
|
this.formData = {
|
|
|
code: this.categoryObj.code,
|
|
|
name: this.categoryObj.name,
|
|
|
- versions: this.categoryObj.versions,
|
|
|
+ versions: 'V'+this.categoryObj.versions+'.0',
|
|
|
status: this.categoryObj.status,
|
|
|
id: this.categoryObj.id
|
|
|
};
|
|
|
@@ -166,8 +166,13 @@
|
|
|
},
|
|
|
|
|
|
handleSave() {
|
|
|
- this.$refs.form.validate((valid) => {
|
|
|
+ this.$refs.form.validate(async (valid) => {
|
|
|
if (valid) {
|
|
|
+ if(!this.isEdit) {
|
|
|
+ let isHas = await this.hasVersionFn();
|
|
|
+ if (!isHas) return;
|
|
|
+ }
|
|
|
+
|
|
|
let param = {
|
|
|
...this.formData,
|
|
|
categoryId: this.categoryId,
|
|
|
@@ -183,7 +188,39 @@
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
- }
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ hasVersionFn() {
|
|
|
+ return new Promise((resolve) => {
|
|
|
+ let param = {
|
|
|
+ categoryId: this.categoryId,
|
|
|
+ bomType: this.categoryObj.bomType
|
|
|
+ };
|
|
|
+ hasNewVersion(param).then((res) => {
|
|
|
+ if(res.data == 1) {
|
|
|
+ this.$confirm('已经草稿版本存在,是否覆盖?', '提示', {
|
|
|
+ confirmButtonText: '覆盖',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ resolve(true);
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ resolve(false);
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ } else {
|
|
|
+ resolve(true);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
}
|
|
|
};
|
|
|
</script>
|