|
@@ -326,33 +326,50 @@ export default {
|
|
|
/**Split 结束 */
|
|
/**Split 结束 */
|
|
|
getDictItems(typeName) {
|
|
getDictItems(typeName) {
|
|
|
//--数据字典--
|
|
//--数据字典--
|
|
|
- this.$api.dict.findByLableName(typeName).then((response) => {
|
|
|
|
|
- this[typeName + "options"] = response.data; // 把获取到的数据赋给this.data
|
|
|
|
|
- }).catch((error) => {
|
|
|
|
|
- this[typeName + "options"] = [];
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- //--left tree begin-------
|
|
|
|
|
- findLeftTreeData: function () {
|
|
|
|
|
- // 获取数据
|
|
|
|
|
- this.$api.dept.findLeftDeptTree(this.peopledeptid).then(res => {
|
|
|
|
|
- this.ztreeNodes = res.data;
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- onZTreeCreated: function (ztreeObj) {
|
|
|
|
|
- this.ztreeObj = ztreeObj;
|
|
|
|
|
- // onCreated 中操作ztreeObj对象展开第一个节点
|
|
|
|
|
- ztreeObj.expandNode(ztreeObj.getNodes()[0], true);
|
|
|
|
|
- this.currentTreeNode = ztreeObj.getNodes()[0];
|
|
|
|
|
- },
|
|
|
|
|
- onZTreeClick: function (evt, treeId, treeNode) {
|
|
|
|
|
- // 点击事件
|
|
|
|
|
- console.log(evt.type, treeNode);
|
|
|
|
|
- this.currentTreeNode = treeNode;
|
|
|
|
|
- this.pageRequest.columnFilters.deptid.value = this.currentTreeNode.id;
|
|
|
|
|
- this.findPage();
|
|
|
|
|
- },
|
|
|
|
|
- //--left tree start-------
|
|
|
|
|
|
|
+ this.$api.dict.findByLableName(typeName).then((response)=>{
|
|
|
|
|
+ this[typeName + "options"] = response.data; // 把获取到的数据赋给this.data
|
|
|
|
|
+ }).catch((error)=>{
|
|
|
|
|
+ this[typeName + "options"] = [];
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ //--left tree begin-------
|
|
|
|
|
+ findLeftTreeData: function() {
|
|
|
|
|
+ // 获取数据
|
|
|
|
|
+ this.$api.dept.findTree().then((res) => {
|
|
|
|
|
+ this.treeDataRecursion(res.data, 2);
|
|
|
|
|
+ this.ztreeNodes = res.data;
|
|
|
|
|
+ });
|
|
|
|
|
+ this.$api.dept.findTree().then(res => {
|
|
|
|
|
+ this.ztreeNodes = res.data;
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ //树过滤五级机构递归
|
|
|
|
|
+ treeDataRecursion(data, num, one) {
|
|
|
|
|
+ data = data || this.ztreeNodes;
|
|
|
|
|
+ one = one || 0;
|
|
|
|
|
+ one++;
|
|
|
|
|
+ for (let i = 0; i < data.length; i++) {
|
|
|
|
|
+ if (data[i].comlevel == 5 && (data[i].managementSource != num)) {
|
|
|
|
|
+ data.splice(i, 1);
|
|
|
|
|
+ i = i - 1;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.treeDataRecursion(data[i].children, num, one);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ onZTreeCreated: function(ztreeObj) {
|
|
|
|
|
+ this.ztreeObj = ztreeObj;
|
|
|
|
|
+ // onCreated 中操作ztreeObj对象展开第一个节点
|
|
|
|
|
+ ztreeObj.expandNode(ztreeObj.getNodes()[0], true);
|
|
|
|
|
+ this.currentTreeNode=ztreeObj.getNodes()[0];
|
|
|
|
|
+ },
|
|
|
|
|
+ onZTreeClick: function(evt, treeId, treeNode) {
|
|
|
|
|
+ // 点击事件
|
|
|
|
|
+ this.currentTreeNode = treeNode;
|
|
|
|
|
+ this.pageRequest.columnFilters.deptid.value = this.currentTreeNode.id;
|
|
|
|
|
+ this.findPage();
|
|
|
|
|
+ },
|
|
|
|
|
+ //--left tree start-------
|
|
|
|
|
|
|
|
// 查询Start
|
|
// 查询Start
|
|
|
queryInfo(val) {
|
|
queryInfo(val) {
|
|
@@ -363,20 +380,65 @@ export default {
|
|
|
// 查询End
|
|
// 查询End
|
|
|
|
|
|
|
|
|
|
|
|
|
- // 右侧工具方法Start
|
|
|
|
|
- handleAddButton() {
|
|
|
|
|
- if (this.currentTreeNode == null) {
|
|
|
|
|
- return this.$message.info("请选择门店下团队");
|
|
|
|
|
- }
|
|
|
|
|
- this.activeTabs = 'first'
|
|
|
|
|
- // 查询机构信息
|
|
|
|
|
- this.$api.dept.getDeptById(this.currentTreeNode.id).then(res => {
|
|
|
|
|
- console.log(res.data);
|
|
|
|
|
- if ((res.data.deptType == 'D') && (res.data.id.indexOf('M') >= 0)) {
|
|
|
|
|
- this.$api.dept.getDeptById(res.data.parentId).then(result => {
|
|
|
|
|
- this.deptInfo = result.data;
|
|
|
|
|
- this.deptInfo.teamid = res.data.id;
|
|
|
|
|
- this.deptInfo.teamname = res.data.name;
|
|
|
|
|
|
|
+ // 右侧工具方法Start
|
|
|
|
|
+ handleAddButton(){
|
|
|
|
|
+ if(this.currentTreeNode == null ){
|
|
|
|
|
+ return this.$message.info("请选择门店下团队");
|
|
|
|
|
+ }
|
|
|
|
|
+ this.activeTabs = 'first'
|
|
|
|
|
+ // 查询机构信息
|
|
|
|
|
+ this.$api.dept.getDeptById(this.currentTreeNode.id).then(res => {
|
|
|
|
|
+ if((res.data.deptType =='D') && (res.data.id.indexOf('M')>=0)){
|
|
|
|
|
+ this.$api.dept.getDeptById(res.data.parentId).then(result => {
|
|
|
|
|
+ this.deptInfo = result.data;
|
|
|
|
|
+ this.deptInfo.teamid = res.data.id;
|
|
|
|
|
+ this.deptInfo.teamname = res.data.name;
|
|
|
|
|
+ this.dialogVisible = true;
|
|
|
|
|
+ })
|
|
|
|
|
+ }else{
|
|
|
|
|
+ return this.$message.info("请选择门店下团队");
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ handleDialogBefore(done) {
|
|
|
|
|
+ // 退出对话框之前确认提示
|
|
|
|
|
+ var that = this;
|
|
|
|
|
+ this.$confirm('确认关闭?')
|
|
|
|
|
+ .then(_ => {
|
|
|
|
|
+ done();
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(_ => {});
|
|
|
|
|
+ },
|
|
|
|
|
+ // 右侧工具方法End
|
|
|
|
|
+
|
|
|
|
|
+ // 右侧列表的方法Start
|
|
|
|
|
+ findPage(data) {
|
|
|
|
|
+ // 获取分页数据
|
|
|
|
|
+ if(data && data.pageRequest){
|
|
|
|
|
+ this.pageRequest.pageNum = data.pageRequest.pageNum;
|
|
|
|
|
+ this.pageRequest.pageSize = data.pageRequest.pageSize;
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$api.retail.findPage(this.pageRequest).then((res) => {
|
|
|
|
|
+ this.pageResult = res.data;
|
|
|
|
|
+ }).then(data != null ? data.callback : '')
|
|
|
|
|
+ },
|
|
|
|
|
+ //编辑
|
|
|
|
|
+ handleTableEdit(data) {
|
|
|
|
|
+ var deptid = data.row.deptid.split('D')[0];
|
|
|
|
|
+ this.$api.dept.getDeptById(deptid).then(res => {
|
|
|
|
|
+ if(res.code = 200){
|
|
|
|
|
+ this.deptInfo = res.data;
|
|
|
|
|
+ this.deptInfo.teamid = data.row.deptid;
|
|
|
|
|
+ this.deptInfo.teamname = data.row.deptname;
|
|
|
|
|
+ this.distributionForm = data.row;
|
|
|
|
|
+ // this.distributionForm.paytype = data.row.paytype.split(',');
|
|
|
|
|
+ this.retailSettingForm=[];
|
|
|
|
|
+ for(let i=0;i<data.row.retailtype;i++){
|
|
|
|
|
+ this.retailSettingForm.push({
|
|
|
|
|
+ retailLevel:(i+1),
|
|
|
|
|
+ retailRate:data.row['disrate'+(i+1)]
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
this.dialogVisible = true;
|
|
this.dialogVisible = true;
|
|
|
})
|
|
})
|
|
|
} else {
|
|
} else {
|
|
@@ -523,10 +585,24 @@ export default {
|
|
|
param.disrate2 = '';
|
|
param.disrate2 = '';
|
|
|
param.disrate3 = '';
|
|
param.disrate3 = '';
|
|
|
|
|
|
|
|
- for (let i = 0; i < this.retailSettingForm.length; i++) {
|
|
|
|
|
- console.log('disrate' + this.retailSettingForm[i].retailLevel)
|
|
|
|
|
- param['disrate' + this.retailSettingForm[i].retailLevel] = this.retailSettingForm[i].retailRate;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ for(let i=0;i<this.retailSettingForm.length;i++){
|
|
|
|
|
+ param['disrate'+this.retailSettingForm[i].retailLevel] = this.retailSettingForm[i].retailRate;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ this.$api.retail.saveRetail(param).then(res => {
|
|
|
|
|
+ if(res.code == 200){
|
|
|
|
|
+ this.$message.success("操作成功");
|
|
|
|
|
+ this.findPage()
|
|
|
|
|
+ this.dialogVisible = false;
|
|
|
|
|
+ }else{
|
|
|
|
|
+ this.$message.info("操作失败 "+res.msg);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }).catch(err=>{
|
|
|
|
|
+ this.$message.error("操作失败")
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ // 新增分销End
|
|
|
|
|
|
|
|
this.$api.retail.saveRetail(param).then(res => {
|
|
this.$api.retail.saveRetail(param).then(res => {
|
|
|
if (res.code == 200) {
|
|
if (res.code == 200) {
|