|
@@ -12,6 +12,25 @@
|
|
|
</module-view>
|
|
|
</div>
|
|
|
<!-- 新增/编辑弹窗 -->
|
|
|
+ <el-dialog :title="popTitle+'机构商品分类'" :visible.sync="dialogFormVisible2" width="30%">
|
|
|
+ <by-form :propConfig="addConfig2" ref="addFormId2">
|
|
|
+ <template v-slot:logo>
|
|
|
+ <el-upload :limit='1' :action="baseURL+'/file/upload'" list-type="picture-card"
|
|
|
+ :on-preview="handlePictureCardPreview" :on-remove="handleRemove">
|
|
|
+ <i class="el-icon-plus"></i>
|
|
|
+ </el-upload>
|
|
|
+ </template>
|
|
|
+ <template v-slot:status class="clearfix">
|
|
|
+ <el-radio class="fl" style="margin-top: 8px;" v-model="radio" :label="0">正常</el-radio>
|
|
|
+ <el-radio class="fl" style="margin-top: 8px;" v-model="radio" :label="1">禁用</el-radio>
|
|
|
+ </template>
|
|
|
+ </by-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="dialogFormVisible2 = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="confirm2">确 定</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ <!-- 新增/编辑弹窗 -->
|
|
|
<el-dialog :title="popTitle+'机构商品分类'" :visible.sync="dialogFormVisible" width="30%">
|
|
|
<by-form :propConfig="addConfig" ref="addFormId">
|
|
|
<template v-slot:logo>
|
|
@@ -44,6 +63,8 @@
|
|
|
popTitle : any = ''
|
|
|
radio : any = 0
|
|
|
dialogFormVisible : boolean = false
|
|
|
+ dialogFormVisible2 : boolean = false
|
|
|
+ datlis : boolean = true
|
|
|
treeConfig = {
|
|
|
attr: {
|
|
|
retConfig: {
|
|
@@ -192,6 +213,7 @@
|
|
|
labelWidth: '70px',
|
|
|
prop: 'parentName',
|
|
|
component: 'select-tree',
|
|
|
+ slot: true,
|
|
|
compConfig: {
|
|
|
attr: {
|
|
|
label: 'name',
|
|
@@ -247,6 +269,57 @@
|
|
|
],
|
|
|
]
|
|
|
}
|
|
|
+ addConfig2 = {
|
|
|
+ attr: {
|
|
|
+ size: 'small',
|
|
|
+ rules: {
|
|
|
+ name: [{
|
|
|
+ required: true, message: '请输入名称', trigger: 'blur'
|
|
|
+ }],
|
|
|
+ }
|
|
|
+ },
|
|
|
+ columns: [
|
|
|
+ [
|
|
|
+ {
|
|
|
+ labelWidth: '70px',
|
|
|
+ span: 23,
|
|
|
+ label: '名称',
|
|
|
+ prop: 'name',
|
|
|
+ component: 'by-input',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ labelWidth: '70px',
|
|
|
+ span: 23,
|
|
|
+ label: '简称',
|
|
|
+ slot: true,
|
|
|
+ prop: 'shortName',
|
|
|
+ component: 'by-input',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ labelWidth: '70px',
|
|
|
+ span: 23,
|
|
|
+ label: '状态',
|
|
|
+ slot: true,
|
|
|
+ prop: 'status',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ labelWidth: '70px',
|
|
|
+ span: 23,
|
|
|
+ label: '备注',
|
|
|
+ slot: true,
|
|
|
+ prop: 'remark',
|
|
|
+ component: 'by-input',
|
|
|
+ compConfig: {
|
|
|
+ attr: {
|
|
|
+ size: 'mini',
|
|
|
+ placeholder: '请输入备注',
|
|
|
+ type: 'textarea'
|
|
|
+ },
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ ]
|
|
|
+ }
|
|
|
mounted() {
|
|
|
this.timer = setInterval(() => {
|
|
|
this.getDataList()
|
|
@@ -278,12 +351,38 @@
|
|
|
(this as any).$refs.addFormId.validate().then(() => {
|
|
|
let query = (this as any).$refs.addFormId.getValue();
|
|
|
query.status = this.radio;
|
|
|
- this.dialogFormVisible = false;
|
|
|
if (this.popTitle === '新增') {
|
|
|
api.saveList(query, 'maindataMaterialOrganizationCategory').then((res : any) => {
|
|
|
if (res.code === 200) {
|
|
|
this.$message.success(this.popTitle + '成功!');
|
|
|
(this as any).$refs.sideTree.request();
|
|
|
+ this.dialogFormVisible = false;
|
|
|
+ this.getDataList();
|
|
|
+ } else this.$message.error(res.msg);
|
|
|
+ }).catch(() => {});
|
|
|
+ } else if (this.popTitle === '编辑') {
|
|
|
+ api.updateList(query, 'maindataMaterialOrganizationCategory').then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$message.success(this.popTitle + '成功!');
|
|
|
+ (this as any).$refs.sideTree.request();
|
|
|
+ this.dialogFormVisible = false;
|
|
|
+ this.getDataList();
|
|
|
+ } else this.$message.error(res.msg);
|
|
|
+ }).catch(() => {});
|
|
|
+ }
|
|
|
+ }).catch(() => {});
|
|
|
+ }
|
|
|
+ confirm2() {
|
|
|
+ (this as any).$refs.addFormId2.validate().then(() => {
|
|
|
+ let query = (this as any).$refs.addFormId2.getValue();
|
|
|
+ query.status = this.radio;
|
|
|
+ if (this.popTitle === '新增') {
|
|
|
+ query.parentId = 0;
|
|
|
+ api.saveList(query, 'maindataMaterialOrganizationCategory').then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$message.success(this.popTitle + '成功!');
|
|
|
+ (this as any).$refs.sideTree.request();
|
|
|
+ this.dialogFormVisible2 = false;
|
|
|
this.getDataList();
|
|
|
} else this.$message.error(res.msg);
|
|
|
}).catch(() => {});
|
|
@@ -292,6 +391,7 @@
|
|
|
if (res.code === 200) {
|
|
|
this.$message.success(this.popTitle + '成功!');
|
|
|
(this as any).$refs.sideTree.request();
|
|
|
+ this.dialogFormVisible2 = false;
|
|
|
this.getDataList();
|
|
|
} else this.$message.error(res.msg);
|
|
|
}).catch(() => {});
|
|
@@ -318,6 +418,9 @@
|
|
|
api.pageList(query, 'maindataMaterialOrganizationCategory').then((res : any) => {
|
|
|
loading.close();
|
|
|
if (res.code === 200) {
|
|
|
+ if(res.data.records.length==0){
|
|
|
+ this.datlis = false
|
|
|
+ }
|
|
|
(this.$refs.moduleView as any).setTableValue(res.data.records);
|
|
|
let page = {
|
|
|
pageNo: res.data.current, //当前页
|
|
@@ -335,12 +438,16 @@
|
|
|
// 打开新增
|
|
|
onAdd() {
|
|
|
this.popTitle = '新增'
|
|
|
- this.dialogFormVisible = true;
|
|
|
this.radio = 0
|
|
|
- setTimeout(() => {
|
|
|
- (this as any).$refs.addFormId.setValue();
|
|
|
- (this as any).$refs.addFormId.$refs['parentName--comp'][0].request();
|
|
|
- }, 0)
|
|
|
+ if(!this.datlis){
|
|
|
+ this.dialogFormVisible2 = true;
|
|
|
+ }else{
|
|
|
+ this.dialogFormVisible = true;
|
|
|
+ setTimeout(() => {
|
|
|
+ (this as any).$refs.addFormId.setValue();
|
|
|
+ (this as any).$refs.addFormId.$refs['parentName--comp'][0].request();
|
|
|
+ }, 0)
|
|
|
+ }
|
|
|
}
|
|
|
// 打开编辑
|
|
|
openEdit(e : any) {
|
|
@@ -351,14 +458,21 @@
|
|
|
if (res.code === 200) {
|
|
|
let data = res.data;
|
|
|
this.radio = data.status;
|
|
|
- api.single({ id: data.parentId }, 'maindataMaterialOrganizationCategory').then((v : any) => {
|
|
|
+ if(data.parentId!=0){
|
|
|
+ api.single({ id: data.parentId }, 'maindataMaterialOrganizationCategory').then((v : any) => {
|
|
|
+ loading.close();
|
|
|
+ if (v.code === 200) {
|
|
|
+ console.log(data.parentId)
|
|
|
+ data.parentName = v.data.name;
|
|
|
+ this.dialogFormVisible = true;
|
|
|
+ setTimeout(() => { (this as any).$refs.addFormId.setValue(data) }, 0);
|
|
|
+ }
|
|
|
+ }).catch(() => loading.close());
|
|
|
+ }else{
|
|
|
loading.close();
|
|
|
- if (v.code === 200) {
|
|
|
- data.parentName = v.data.name;
|
|
|
- this.dialogFormVisible = true;
|
|
|
- setTimeout(() => { (this as any).$refs.addFormId.setValue(data) }, 0);
|
|
|
- }
|
|
|
- }).catch(() => loading.close());
|
|
|
+ this.dialogFormVisible2 = true;
|
|
|
+ setTimeout(() => { (this as any).$refs.addFormId2.setValue(data) }, 0);
|
|
|
+ }
|
|
|
}
|
|
|
}).catch(() => loading.close());
|
|
|
}
|