|
@@ -273,7 +273,9 @@
|
|
|
}
|
|
|
// 添加新规格
|
|
|
doComfirm() {
|
|
|
- if (!this.normsValue || !this.norms) return (this as any).$message({ type: "warning", message: '请添加完整的规格!' })
|
|
|
+ this.normsValue = this.normsValue.trim();
|
|
|
+ this.norms = this.norms.trim();
|
|
|
+ if (!this.normsValue || !this.norms) return (this as any).$message({ type: "warning", message: '请添加完整的规格!' });
|
|
|
let obj : any = {
|
|
|
title: this.norms,
|
|
|
field: this.norms + '_field_name',
|
|
@@ -292,26 +294,22 @@
|
|
|
query.attributeValue = JSON.stringify(this.tableConfig)
|
|
|
this.dialogFormVisible = false;
|
|
|
console.log(query);
|
|
|
-
|
|
|
+ let loading = this.$loading({ target: '.main-container' });
|
|
|
if (this.popTitle === '新增') {
|
|
|
api.saveList(query, 'maindataMaterialAttribute').then((res : any) => {
|
|
|
if (res.code === 200) {
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: this.popTitle + '成功!'
|
|
|
- });
|
|
|
+ this.$message.success('新增成功');
|
|
|
this.getDataList();
|
|
|
- } else this.failHandle(res)
|
|
|
+ loading.close();
|
|
|
+ } else this.$message.error(res.msg);
|
|
|
})
|
|
|
} else if (this.popTitle === '编辑') {
|
|
|
api.updateList(query, 'maindataMaterialAttribute').then((res : any) => {
|
|
|
if (res.code === 200) {
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: this.popTitle + '成功!'
|
|
|
- });
|
|
|
+ this.$message.success('编辑成功');
|
|
|
this.getDataList();
|
|
|
- } else this.failHandle(res)
|
|
|
+ loading.close();
|
|
|
+ } else this.$message.error(res.msg);
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -332,6 +330,7 @@
|
|
|
this.getPageList(query)
|
|
|
}
|
|
|
getPageList(query : any) {
|
|
|
+ let loading = this.$loading({ target: '.main-container' });
|
|
|
api.pageList(query, 'maindataMaterialAttribute').then((res : any) => {
|
|
|
if (res.code === 200) {
|
|
|
(this.$refs.moduleView as any).setTableValue(res.data.records);
|
|
@@ -340,7 +339,8 @@
|
|
|
pageSize: res.data.size, //每页条数
|
|
|
total: res.data.total //总条数
|
|
|
};
|
|
|
- (this.$refs.moduleView as any).setPage(page)
|
|
|
+ (this.$refs.moduleView as any).setPage(page);
|
|
|
+ loading.close();
|
|
|
} else this.$message.error(res.msg);
|
|
|
})
|
|
|
}
|
|
@@ -355,10 +355,10 @@
|
|
|
this.popTitle = '新增'
|
|
|
this.dialogFormVisible = true;
|
|
|
this.radio = 0
|
|
|
- this.tableConfig = []
|
|
|
- setTimeout(() => {
|
|
|
- if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue({});
|
|
|
- }, 0)
|
|
|
+ this.tableConfig = [];
|
|
|
+ this.$nextTick(() => {
|
|
|
+ if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue();
|
|
|
+ });
|
|
|
}
|
|
|
// 打开编辑
|
|
|
openEdit(e : any) {
|
|
@@ -367,9 +367,9 @@
|
|
|
this.dialogFormVisible = true;
|
|
|
this.radio = e.status
|
|
|
this.tableConfig = JSON.parse(e.attributeValue);
|
|
|
- setTimeout(() => {
|
|
|
+ this.$nextTick(() => {
|
|
|
if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue(e);
|
|
|
- }, 0)
|
|
|
+ })
|
|
|
}
|
|
|
// 工具栏删除
|
|
|
onDelete() {
|
|
@@ -390,18 +390,10 @@
|
|
|
api.deleteList({ ids: ids }, 'maindataMaterialAttribute').then((res : any) => {
|
|
|
if (res.code === 200) {
|
|
|
this.getDataList();
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '删除成功!'
|
|
|
- });
|
|
|
- } else this.failHandle(res)
|
|
|
+ this.$message.success('删除成功');
|
|
|
+ } else this.$message.error(res.msg);
|
|
|
})
|
|
|
- }).catch(() => {
|
|
|
- this.$message({
|
|
|
- type: 'info',
|
|
|
- message: '已取消删除'
|
|
|
- });
|
|
|
- });
|
|
|
+ }).catch(() => this.$message.info('已取消删除'));
|
|
|
}
|
|
|
// 操作删除
|
|
|
doDelete2(item : any) {
|
|
@@ -414,26 +406,15 @@
|
|
|
api.deleteList({ ids: item.id }, 'maindataMaterialAttribute').then((res : any) => {
|
|
|
if (res.code === 200) {
|
|
|
this.getDataList();
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '删除成功!'
|
|
|
- });
|
|
|
- } else this.failHandle(res)
|
|
|
+ this.$message.success('删除成功');
|
|
|
+ } else this.$message.error(res.msg);
|
|
|
})
|
|
|
- }).catch(() => {
|
|
|
- this.$message({
|
|
|
- type: 'info',
|
|
|
- message: '已取消删除'
|
|
|
- });
|
|
|
- });
|
|
|
+ }).catch(() => this.$message.info('已取消删除'));
|
|
|
}
|
|
|
// 刷新/重置
|
|
|
onRefresh() {
|
|
|
- let loading = this.$loading({ target: '.main-container' });
|
|
|
(this as any).$refs.moduleView.clearSearch();
|
|
|
- (this as any).$refs.sideTree.request();
|
|
|
- this.getPageList({});
|
|
|
- loading.close();
|
|
|
+ this.getDataList();
|
|
|
}
|
|
|
//导出
|
|
|
onExport() {
|
|
@@ -441,14 +422,8 @@
|
|
|
let query = (this.$refs.moduleView as any).getQuery();
|
|
|
(this as any).$download(urlArr + '/export', {
|
|
|
...query
|
|
|
- }, urlArr[urlArr.length - 1] + `_${new Date().getTime()}.xlsx`)
|
|
|
+ }, urlArr[urlArr.length - 1] + `_${new Date().getTime()}.xlsx`);
|
|
|
}
|
|
|
- // 运行错误
|
|
|
- failHandle(err : any) {
|
|
|
- let msg = err.msg ? err.msg : '运行错误!';
|
|
|
- this.$message.error(msg)
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|