设置小程序可见标签和设置企微可见标签

master
382696293@qq.com 2 years ago
parent f7ba814037
commit e257ecef7f

@ -1,9 +1,12 @@
package com.flossom.system.service.impl; package com.flossom.system.service.impl;
import java.util.Arrays;
import java.util.List; import java.util.List;
import com.flossom.common.core.domain.entity.SysTag;
import com.flossom.common.core.domain.entity.WxInstrument; import com.flossom.common.core.domain.entity.WxInstrument;
import com.flossom.common.core.domain.req.WxInstrumentReq; import com.flossom.common.core.domain.req.WxInstrumentReq;
import com.flossom.common.core.mapper.SysTagMapper;
import com.flossom.common.core.mapper.WxInstrumentMapper; import com.flossom.common.core.mapper.WxInstrumentMapper;
import com.flossom.common.core.utils.DateUtils; import com.flossom.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -22,6 +25,9 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
@Autowired @Autowired
private WxInstrumentMapper wxInstrumentMapper; private WxInstrumentMapper wxInstrumentMapper;
@Autowired
private SysTagMapper sysTagMapper;
/** /**
* *
* *
@ -69,6 +75,31 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
*/ */
@Override @Override
public int updateWxInstrument(WxInstrument wxInstrument) { public int updateWxInstrument(WxInstrument wxInstrument) {
// 处理小程序标签和企微标签
if (wxInstrument.getMiniTagIds() != null) {
List<String> tagIdList = Arrays.asList(wxInstrument.getMiniTagIds().split(","));
StringBuilder tagNames = new StringBuilder();
for (int i = 0; i < tagIdList.size(); i++) {
SysTag sysTag = sysTagMapper.selectDeptById(Long.valueOf(tagIdList.get(i)));
tagNames.append(sysTag.getTagName());
if (i < tagIdList.size() - 1) {
tagNames.append(",");
}
}
wxInstrument.setMiniTagNames(tagNames.toString());
}
if (wxInstrument.getWecomTagIds() != null) {
List<String> tagIdList = Arrays.asList(wxInstrument.getWecomTagIds().split(","));
StringBuilder tagNames = new StringBuilder();
for (int i = 0; i < tagIdList.size(); i++) {
SysTag sysTag = sysTagMapper.selectDeptById(Long.valueOf(tagIdList.get(i)));
tagNames.append(sysTag.getTagName());
if (i < tagIdList.size() - 1) {
tagNames.append(",");
}
}
wxInstrument.setWecomTagNames(tagNames.toString());
}
wxInstrument.setUpdateTime(DateUtils.getNowDate()); wxInstrument.setUpdateTime(DateUtils.getNowDate());
return wxInstrumentMapper.updateWxInstrument(wxInstrument); return wxInstrumentMapper.updateWxInstrument(wxInstrument);
} }

@ -42,3 +42,25 @@ export function delInstrument(id) {
method: 'delete' method: 'delete'
}) })
} }
/* 获取小程序标签树 */
export function getMiniProgramTagTree() {
return request({
url: '/system/tagInfo/tagTree',
method: 'get',
params: {
type: 1
}
})
}
/* 获取企微标签树 */
export function getWecomTagTree() {
return request({
url: '/system/tagInfo/tagTree',
method: 'get',
params: {
type: 2
}
})
}

@ -102,13 +102,15 @@
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="editMiniProgramTags(scope.row)"
>设置小程序可见标签 >设置小程序可见标签
</el-button> </el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
>设置微信可见标签 @click="editWecomTags(scope.row)"
>设置企微可见标签
</el-button> </el-button>
<el-button <el-button
size="mini" size="mini"
@ -368,7 +370,7 @@
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item label="扫机身码" prop="isScanCode"> <el-form-item label="扫机身码" prop="isScanCode">
<el-switch v-model="form.isScanCode" active-value="1" inactive-value="0" active-color="#13ce66" <el-switch v-model="form.isScanCode" :active-value="1" :inactive-value="0" active-color="#13ce66"
inactive-color="#DCDCDC"> inactive-color="#DCDCDC">
</el-switch> </el-switch>
</el-form-item> </el-form-item>
@ -421,15 +423,61 @@
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<!-- 编辑小程序可见标签 -->
<el-dialog title="编辑小程序可见标签" :visible.sync="miniProgramTag.visible" width="50%">
<el-form ref="miniProgramTag" :model="miniProgramTag" label-width="150px">
<el-row>
<el-col :span="100">
<el-form-item label="小程序标签" prop="selectTagList" label-width="100px">
<treeselect v-model="miniProgramTag.selectTagList" :options="miniProgramTag.optionTree" :multiple="true"
:show-count="true" placeholder="请选择小程序标签" :disable-branch-nodes="true"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="miniProgramTag.visible = false"> </el-button>
<el-button type="primary" @click="submitMiniProgramTagList"> </el-button>
</div>
</el-dialog>
<!-- 编辑企微可见标签 -->
<el-dialog title="编辑企微可见标签" :visible.sync="wecomTag.visible" width="50%">
<el-form :model="wecomTag" label-width="150px">
<el-row>
<el-col :span="100">
<el-form-item label="小程序标签" prop="tagIdArray" label-width="100px">
<treeselect v-model="wecomTag.selectTagList" :options="wecomTag.optionTree" :multiple="true"
:show-count="true" placeholder="请选择小程序标签" :disable-branch-nodes="true"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="wecomTag.visible = false"> </el-button>
<el-button type="primary" @click="submitWecomTagList"> </el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import {listInstrument, getInstrument, delInstrument, addInstrument, updateInstrument} from "@/api/system/instrument"; import {
listInstrument,
getInstrument,
delInstrument,
addInstrument,
updateInstrument,
getMiniProgramTagTree, getWecomTagTree
} from "@/api/system/instrument";
import {getToken} from "@/utils/auth"; import {getToken} from "@/utils/auth";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default { export default {
name: "Instrument", name: "Instrument",
components: {Treeselect},
data() { data() {
return { return {
// //
@ -512,6 +560,20 @@ export default {
uploadHide: false, uploadHide: false,
fileList: [], fileList: [],
}, },
/* 小程序可见标签 */
miniProgramTag: {
userId: null,
selectTagList: null,
visible: false,
optionTree: [],
},
/* 企微可见标签 */
wecomTag: {
userId: null,
selectTagList: null,
visible: false,
optionTree: [],
},
// //
form: {}, form: {},
// //
@ -611,7 +673,7 @@ export default {
iotVersion: null, iotVersion: null,
iotUpgradeData: null, iotUpgradeData: null,
isScanCode: 0, isScanCode: 0,
isPurchase: null, isPurchase: 0,
shoppingAppid: null, shoppingAppid: null,
shoppingPath: null, shoppingPath: null,
bluetoothConnecting: null, bluetoothConnecting: null,
@ -764,12 +826,11 @@ export default {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.id != null) { if (this.form.id != null) {
this.$modal.msgSuccess("修改成功"); updateInstrument(this.form).then(response => {
// updateInstrument(this.form).then(response => { this.$modal.msgSuccess("修改成功");
// this.$modal.msgSuccess(""); this.open = false;
// this.open = false; this.getList();
// this.getList(); });
// });
} else { } else {
addInstrument(this.form).then(response => { addInstrument(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
@ -923,12 +984,57 @@ export default {
this.form.model = "WL200"; this.form.model = "WL200";
} }
}, },
/* 是否购买切换 */
isPurchaseChang() { isPurchaseChang() {
if (this.form.isPurchase == 0) { if (this.form.isPurchase == 0) {
this.form.shoppingAppid = null; this.form.shoppingAppid = null;
this.form.shoppingPath = null; this.form.shoppingPath = null;
} }
} },
/* 设置小程序可见标签 */
editMiniProgramTags(row) {
//
getMiniProgramTagTree().then(Response => {
this.miniProgramTag.optionTree = Response.data
this.miniProgramTag.visible = true;
if (row.miniTagIds != null && row.miniTagIds.length > 0) {
this.miniProgramTag.selectTagList = row.miniTagIds.split(",").map(Number);
}
this.miniProgramTag.userId = row.id;
})
},
/* 设置企微可见标签 */
editWecomTags(row) {
//
getWecomTagTree().then(response => {
this.wecomTag.optionTree = response.data;
this.wecomTag.visible = true;
if (row.wecomTagIds != null && row.wecomTagIds.length > 0) {
this.wecomTag.selectTagList = row.wecomTagIds.split(",").map(Number);
}
this.wecomTag.userId = row.id;
});
},
/* 保存小程序标签 */
submitMiniProgramTagList() {
this.form.id = this.miniProgramTag.userId
this.form.miniTagIds = this.miniProgramTag.selectTagList.join(",")
updateInstrument(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.miniProgramTag.visible = false;
this.getList();
});
},
/* 保存企微标签 */
submitWecomTagList() {
this.form.id = this.wecomTag.userId
this.form.wecomTagIds = this.wecomTag.selectTagList.join(",")
updateInstrument(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.wecomTag.visible = false;
this.getList();
});
},
} }
}; };
</script> </script>

Loading…
Cancel
Save