瀏覽代碼

init

newStyle
wangxiaohua 3 年之前
父節點
當前提交
5c84716643
共有 5 個檔案被更改,包括 355 行新增331 行删除
  1. +1
    -0
      package.json
  2. +69
    -0
      src/api/modules/http.js
  3. +277
    -327
      src/views/Template/Pinspeakwords.vue
  4. +6
    -2
      src/views/Template/PinspeakwordsList.vue
  5. +2
    -2
      vue.config.js

+ 1
- 0
package.json 查看文件

@@ -40,6 +40,7 @@
"vue-json-tree-view": "^2.1.4",
"vue-quill-editor": "3.0.6",
"vue-router": "^3.0.2",
"vuedraggable": "^2.24.3",
"vuex": "^3.0.1"
},
"devDependencies": {


+ 69
- 0
src/api/modules/http.js 查看文件

@@ -249,3 +249,72 @@ export function templatedel(query) {
})
}


//销讲词编辑分数
export function templatedelfindByTempId(query) {
return request({
url: '/autoSR/template/findByTempId',
method:'get',
params:query
})
}


//销讲词模板编辑后保存
export function templategeaddTemplate(data) {
return request({
url: '/autoSR/marketing/addTemplate',
method:'post',
data
})
}


//销讲词模板
export function templategetMarketingTree(query) {
return request({
url: '/autoSR/marketing/getMarketingTree',
method:'get',
params:query
})
}

//销讲词模板添加一二三级
export function templategeadd(data) {
return request({
url: 'autoSR/marketing/add',
method:'post',
data
})
}

//删除销讲词模板一二三级
export function templategedel(query) {
return request({
url: '/autoSR/marketing/del',
method:'get',
params:query
})
}


//编辑销讲词模板一二三级
export function templategeupdate(query) {
return request({
url: 'autoSR/marketing/update',
method:'get',
params:query
})
}


//销讲词模板一二三级排序
export function templategeupdateSort(data) {
return request({
url: 'autoSR/marketing/updateSort',
method:'post',
data
})
}



+ 277
- 327
src/views/Template/Pinspeakwords.vue 查看文件

@@ -20,40 +20,31 @@
</div>
<input ref="input" style="display:none" value='${tempId}' />

<!-- <el-tree ref="tree"
<el-tree ref="tree"
:data="treeList"
:default-checked-keys="defaultCheck" show-checkbox node-key="id"
default-expand-all :check-on-click-node="true" :expand-on-click-node="false"
draggable :allow-drop="allowDrop" :allow-drag="allowDrag"
@node-drop="Peerdrag">
default-expand-all :check-on-click-node="true" :expand-on-click-node="false"
draggable :allow-drop="allowDrop" :allow-drag="allowDrag"
@node-drop="Peerdrag">
<span class="custom-tree-node" slot-scope="{ node, data }">
<span> <b v-if="data.sign==0 && data.houseId==''" style="color: red">*</b> {{ node.label }}</span>

<span> <b v-if="data.sign==0 && data.houseId==null" style="color: red">*</b> {{ node.label }}</span>
<span>
<el-button style="color:red;" v-if="node.level==1" type="text" size="mini" @click.stop="() => append(node,data)">
添加子类
</el-button>
<span v-if="data.houseId!=''">
<el-button v-if="node.level==2" type="text" size="mini" @click.stop="() => append1(node,data)"> 添加子类 </el-button>
<el-button type="text" size="mini" @click.stop="() => remove(node,data)"> 删除 </el-button>
<el-button type="text" size="mini" @click.stop="() => ddeditor(node,data)"> 编辑 </el-button>
<el-button style="color:red;" v-if="node.level==1" type="text" size="mini" @click.stop="() => append(node,data)">添加子类</el-button>
<span v-if="data.houseId!=null">
<el-button v-if="node.level==2" type="text" size="mini" @click.stop="() => append1(node,data)"> 添加子类 </el-button>
<el-button type="text" size="mini" @click.stop="() => remove(node,data)"> 删除 </el-button>
<el-button type="text" size="mini" @click.stop="() => ddeditor(node,data)"> 编辑 </el-button>
</span>
<el-button v-if="data.sign!==1" type="text" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</el-button>
<el-button v-if="data.sign!=1" type="text" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</el-button>
</span>
</span>
</el-tree> -->
</el-tree>


<div class="update-btn">
<el-button type="primary" size="mini" @click="getCheckedNode">获取选中节点</el-button>
</div>
<!-- 删除确认弹框 -->
<el-dialog title="提示" :visible.sync="dialogVisible" width="30%">
<span>确定删除该条内容吗</span>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="checkDelete">确 定</el-button>
</span>
</el-dialog>
<!-- 新增弹框 -->
<!-- 新增弹框 -->
<el-dialog title="新增" :visible.sync="dialogFormVisible">
<el-form :model="addForm">
<el-row :gutter="20">
@@ -75,10 +66,23 @@
<el-button type="primary" @click="addSubmit">确 定</el-button>
</div>
</el-dialog>




<!-- 删除确认弹框 -->
<el-dialog title="提示" :visible.sync="dialogVisible" width="30%">
<span>确定删除该条内容吗</span>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="checkDelete">确 定</el-button>
</span>
</el-dialog>

</div>

<!-- 评分 -->
<!-- <div class="content-right">
<div class="content-right">
<el-row>
<el-col :span="20">
(提示:拖拽大类可以排序)
@@ -96,7 +100,7 @@
<div style="border: 2px dashed #CCCCCC;margin-top: 30px;padding:6px;border-radius: 6px;font-size: 14px;"
v-for="(item,index) in newlist" :key="item.id">
<div style="display: flex;align-items: center;height: 40px;">
<div >{{item.name}}:</div>
<div >{{item.name||''}}:</div>
<div>
<el-input @input="inputYiji($event,index)" style="width: 100px;" v-model.number="item.fraction" type="number" size="mini" ></el-input>
</div>
@@ -106,7 +110,7 @@
</div>
<div class="erji" style="margin-left: 30px;" v-for="(asd,idx) in item.children" :key="idx">
<div style="display: flex;align-items: center;height: 40px;">
<div>{{asd.name}}:</div>
<div>{{asd.name||''}}:</div>
<div>

<el-input @input="inputBlur($event,index,idx)" style="width: 100px;" v-model.number="asd.fraction" type="number" size="mini" ></el-input>
@@ -118,7 +122,7 @@
</div>
<div class="sanji" style="width: 900px;" >
<div style="display: flex;align-items: center;height: 40px;" v-for="(sanji,indx) in asd.children" :key="indx">
<div style="width:85% ;margin-left: 30px;">{{sanji.name}}</div>
<div style="width:85% ;margin-left: 30px;">{{sanji.name||''}}</div>
<div style="margin-left: 10px;">
<el-button type="info" size="mini" @click="Deletethelevel(index,idx,indx,sanji)">删除</el-button>
</div>
@@ -126,12 +130,12 @@
</div>
</div>
</div>
</draggable> -->
</draggable>

<!-- <div style="display: flex;align-items: center;margin-top:30px;" v-if="">
<div style="display: flex;align-items: center;margin-top:30px;">
<el-button type="primary" size="mini" @click="cancel">取消</el-button>
<el-button style="margin-left: 30px;" type="primary" size="mini" @click="submitForm">保存</el-button>
</div> -->
</div>

</div>
<!--?编辑弹框?-->
@@ -153,6 +157,7 @@
</template>

<script>
import draggable from 'vuedraggable'
export default {
data() {
return {
@@ -188,8 +193,12 @@ export default {
addid: null, // 新增的节点id(接口生成)
deleteId: null, // 要删除的表单节点的ID
disabledcet: false,
Templateid:'',
};
},
components: {
draggable,
},
created() {
this.allTreeListId = []; // 存储的当前树图所有的接单的ID集合,如:[1,3,4,6,7]
this.noIds = []; // 左侧树没有,但右侧有的数据
@@ -198,11 +207,8 @@ export default {
},
mounted() {
var isnull=this.$route.query.flag;
console.log(isnull);
// this.setInitCheck()
//获取楼盘
this.getHouse()

this.Templateid=isnull.id;
this.setInitCheck()
},
computed: {
dragOptions() {
@@ -218,13 +224,12 @@ export default {
// 楼盘选择
selectChange(e) {
this.houseId = e;
this.getTreeData();
this.templategetMarketingTree();
},
// 获取楼盘下拉的数据
getHouse() {
this.$api.api.findHouseByUser().then((res) => {
if (res.data.res == 1) {
this.houseList = res.data.obj.map((item) => {
this.houseList = res.data.map((item) => {
return {
value: item.id,
label: item.propertyName,
@@ -233,48 +238,97 @@ export default {
if (this.houseId == "") {
this.houseId = this.houseList[0].value;
}
// this.getTreeData();
}
this.templategetMarketingTree()
})
},
// 获取楼盘下拉的数据
getHouse2() {
axios({
url: `${jypath}/template/getHouse`,
method: "get",
params: {},
}).then((res) => {
if (res.data.res === 1) {
this.houseList = res.data.obj.map((item) => {
return {
value: item.id,
label: item.propertyName,
};
});
this.getTreeData();
}
});
//获取模板
templategetMarketingTree(){
let parmest={
houseId:this.houseId,
}
this.$api.http.templategetMarketingTree(parmest).then((res) => {
console.log(res);
let data = res.data;
data = JSON.stringify(data).replace(/name/g, "label");
data = JSON.parse(data);
this.treeList = data;
this.getAllTreeListId(this.treeList);
})
},
// 递归获取所有的ID
getAllTreeListId(arr) {
const setSelected = (arr) => {
arr.forEach((item) => {
this.allTreeListId.push(item.id);
if (item.children) {
setSelected(item.children);
}
});
};
setSelected(arr);
},
// getMarketingTree 获取层级树
getTreeData() {
axios({
url: `${jypath}/marketing/getMarketingTree?houseId=` + this.houseId,
method: "get",
params: {
// houseId: this.house
},
}).then((res) => {
if (res.data.res === 1) {
this.treeList = res.data.obj;
let data = res.data.obj;
data = JSON.stringify(data).replace(/name/g, "label");
data = JSON.parse(data);
// ------获取选中的节点
getCheckedNode() {
let res = this.$refs.tree.getCheckedKeys().concat(this.$refs.tree.getHalfCheckedKeys());
console.log(res)
let arr = [];
let arr1 = JSON.parse(JSON.stringify(this.treeList));

this.treeList = data;
this.getAllTreeListId(this.treeList);
}
res.forEach((resd, index) => {
var arrarys = this.familyTree(arr1, resd);
arr.push(arrarys[0]);
});

arr.forEach((item, index) => {
item.name = item.label;
this.nodelist.push(item);
});
this.listCheckedchaifen();
},
// 树图,设置初始选中值及分数回显--编辑跳转过来的
setInitCheck() {
if(this.Templateid==''){
//获取楼盘
this.getHouse();
}else{
this.disabledcet = true;
let parmest={
tempId:this.Templateid,
}
this.$api.http.templatedelfindByTempId(parmest).then((res) => {
this.houseId = res.data.houseId;
this.checklist = res.data.list;
this.nodelist = res.data.list;
this.getHouse2();
this.checklist.forEach((item) => {
this.rateMap.set(item.id, item.fraction); // map维护分数
this.sortMap.set(item.id, item.sort); // 排序维护
if (item.pid !== 0) {
this.defaultCheck.push(item.id);
}
});
console.log(this.newlist,"99999999999999999999999999")
this.listCheckedchaifen();

})
}

},
// 获取楼盘下拉的数据
getHouse2() {
this.$api.api.findHouseByUser().then((res) => {
this.houseList = res.data.map((item) => {
return {
value: item.id,
label: item.propertyName,
};
});
this.templategetMarketingTree()
})
},



inputYiji(e, index) {
if (e < 0) {
this.$message({
@@ -321,198 +375,17 @@ export default {
}
}
},
//编辑提交
submiadd() {
var that = this;
axios({
url: `${jypath}/marketing/update`,
method: "get",
params: {
name: that.frosasd.name,
id: that.frosasd.id,
},
}).then((res) => {
if (res.data.res == 1) {
that.treeList.forEach((item, index) => {
if (item.id == that.frosasd.id) {
that.treeList[index].label = that.frosasd.name;
that.isshowage = false;
that.$message({
message: "修改成功",
type: "success",
});
return;
} else {
item.children.forEach((asd, indexesd) => {
if (asd.id == that.frosasd.id) {
that.treeList[index].children[indexesd].label =
that.frosasd.name;
that.isshowage = false;
that.$message({
message: "修改成功",
type: "success",
});
return;
} else {
asd.children.forEach((zxc, indexzxc) => {
if (zxc.id == that.frosasd.id) {
that.treeList[index].children[indexesd].children[
indexzxc
].label = that.frosasd.name;
that.isshowage = false;
that.$message({
message: "修改成功",
type: "success",
});
return;
}
});
}
});
}
});
} else {
this.$message({
message: "修改失败",
type: "error",
});
}
});
},
//编辑
ddeditor(node, data) {
this.frosasd.name = data.label;
this.frosasd.id = data.id;
this.isshowage = true;
},

submicll() {
this.isshowage = false;
},
//拖拽排序
Peerdrag(before) {
let arr = [];

this.treeList.forEach((item, index) => {
if (before.data.pid == item.pid) {
arr.push(item);
} else {
if (item.children.length == 0) {
return;
} else {
item.children.forEach((ite, inde) => {
if (before.data.pid == ite.pid) {
arr.push(ite);
} else {
if (ite.children.length == 0) {
return;
} else {
ite.children.forEach((it, ins) => {
if (before.data.pid == it.pid) {
arr.push(it);
}
});
}
}
});
}
}
});
arr.forEach((item, index) => {
item.sort = index;
});

let params = {
list: [],
};
params.list = arr.map((item) => {
return {
id: item.id,
sort: item.sort,
};
});
this.dragSort(params.list);
},
//排序提交
dragSort(list) {
axios({
url: `${jypath}/marketing/updateSort`,
method: "post",
data: {
children: list,
},
}).then((res) => {});
},
//控制那个可拖拽节点
allowDrag(draggingNode, dropNode, type) {
if (draggingNode.data.sign == 0) {
return false;
} else {
return true;
}
},
//同级节点才可以拖拽
allowDrop(draggingNode, dropNode, type) {
if (draggingNode.level === dropNode.level) {
if (draggingNode.parent.id === dropNode.parent.id) {
// 向上拖拽 || 向下拖拽
return type === "prev" || type === "next";
}
} else {
// 不同级进行处理
return false;
}
},

// 树图,设置初始选中值及分数回显--编辑跳转过来的
setInitCheck() {
if (this.$refs.input.value) {
console.log("zolemang");
this.disabledcet = true;
axios({
url: `${jypath}/template/findByTempId`,
method: "get",
params: {
tempId: this.$refs.input.value,
},
}).then((res) => {
if (res.data.res === 1) {
this.houseId = res.data.obj.houseId;
this.checklist = res.data.obj.list;
this.nodelist = res.data.obj.list;
this.getHouse2();
this.checklist.forEach((item) => {
this.rateMap.set(item.id, item.fraction); // map维护分数
this.sortMap.set(item.id, item.sort); // 排序维护
if (item.pid !== 0) {
this.defaultCheck.push(item.id);
}
});
this.listCheckedchaifen();
}
});
} else {
//获取楼盘
this.getHouse();
}
},
// 拖拽变化事件
onDragCallback(evt) {
this.newlist.forEach((item, index) => {
item.sort = index + 1;
});
},
// 递归获取所有的ID
getAllTreeListId(arr) {
const setSelected = (arr) => {
arr.forEach((item) => {
this.allTreeListId.push(item.id);
if (item.children) {
setSelected(item.children);
}
});
};
setSelected(arr);
},
//删除评分大类
Deletecategories(item, index) {
if (this.newlist[index].children.length == 0) {
@@ -580,26 +453,6 @@ export default {
});
},
//删除评分同时删除this.nodelist里的单数据

// ------获取选中的节点
getCheckedNode() {
let res = this.$refs.tree
.getCheckedKeys()
.concat(this.$refs.tree.getHalfCheckedKeys());
let arr = [];
let arr1 = JSON.parse(JSON.stringify(this.treeList));

res.forEach((resd, index) => {
var arrarys = this.familyTree(arr1, resd);
arr.push(arrarys[0]);
});

arr.forEach((item, index) => {
item.name = item.label;
this.nodelist.push(item);
});
this.listCheckedchaifen();
},
//拆分数据
listCheckedchaifen() {
let arr = [];
@@ -872,29 +725,89 @@ export default {

this.saveRate(params);
},
// 评分保存 addTemplate 新增模板
// 评分保存 新增模板
saveRate(params) {
if (this.$refs.input.value) {
params.tempId = this.$refs.input.value;
if (this.Templateid!='') {
params.tempId = this.Templateid;
}
axios({
url: `${jypath}/marketing/addTemplate`,
method: "post",
data: params,
}).then((res) => {
if (res.data.res === 1) {
this.$message({
message: "保存成功",
type: "success",
});
window.history.back();
this.$api.http.templategeaddTemplate(params).then((res) => {
this.$message({
message: "保存成功",
type: "success",
});
window.history.back();
})
},


//拖拽排序
Peerdrag(before) {
let arr = [];
this.treeList.forEach((item, index) => {
if (before.data.pid == item.pid) {
arr.push(item);
} else {
this.$message({
message: res.data.resMsg,
type: "warning",
});
if (item.children.length == 0) {
return;
} else {
item.children.forEach((ite, inde) => {
if (before.data.pid == ite.pid) {
arr.push(ite);
} else {
if (ite.children.length == 0) {
return;
} else {
ite.children.forEach((it, ins) => {
if (before.data.pid == it.pid) {
arr.push(it);
}
});
}
}
});
}
}
});
arr.forEach((item, index) => {
item.sort = index;
});

let params = {
list: [],
};
params.list = arr.map((item) => {
return {
id: item.id,
sort: item.sort,
};
});
this.dragSort(params.list);
},
//排序提交
dragSort(list) {
this.$api.http.templategeupdateSort({children:list}).then((res) => {

})
},
//控制那个可拖拽节点
allowDrag(draggingNode, dropNode, type) {
if (draggingNode.data.sign == 0) {
return false;
} else {
return true;
}
},
//同级节点才可以拖拽
allowDrop(draggingNode, dropNode, type) {
if (draggingNode.level === dropNode.level) {
if (draggingNode.parent.id === dropNode.parent.id) {
// 向上拖拽 || 向下拖拽
return type === "prev" || type === "next";
}
} else {
// 不同级进行处理
return false;
}
},
// 添加二级小类节点入口
append(node, data) {
@@ -934,39 +847,37 @@ export default {
},
// 新增的节点保存
addNode() {
axios({
url: `${jypath}/marketing/add`,
method: "post",
data: {
this.$api.http.templategeadd({
pid: this.pid,
name: this.addForm.name,
houseId: this.houseId,
},
}).then((res) => {
if (res.data.res === 1) {
sign:1
}).then((res) => {
if (this.level == 0) {
// 大类
let newNode = {
id: res.data.obj,
id: res.data,
sign: 1,
pid: 0,
sort: this.treeList.length + 1,
label: this.addForm.name,
fraction: "",
children: [],
houseId: this.houseId,
};
this.treeList.push(newNode);
this.allTreeListId.push(res.data.obj);
} else if (this.level == 1) {
// 二级
let newChild = {
id: res.data.obj,
id: res.data,
pid: this.pid,
sign: 1,
fraction: "",
sort: null,
label: this.addForm.name,
children: [],
houseId: this.houseId,
};

this.treeList.forEach((item, index) => {
@@ -974,20 +885,16 @@ export default {
item.children.push(newChild);
}
});

/* if (!this.treeData.children) {
this.$set(this.treeData, 'children', []);
}
this.treeData.children.push(newChild); */
this.allTreeListId.push(res.data.obj);
} else {
let newChilds = {
id: res.data.obj,
id: res.data,
sign: 1,
fraction: "",
pid: this.pid,
sort: null,
label: this.addForm.name,
houseId: this.houseId,
};
this.treeList.forEach((item, index) => {
item.children.forEach((ite, inde) => {
@@ -996,25 +903,70 @@ export default {
}
});
});
/* if (!this.treeData.children) {
this.$set(this.treeData, 'children', []);
}
this.treeData.children.push(newChilds); */
this.allTreeListId.push(res.data.obj);
}
}
});
})
},
//编辑提交
submiadd() {
var that = this;
let parmest={
name: that.frosasd.name,
id: that.frosasd.id,
}
this.$api.http.templategeupdate(parmest).then((res) => {
that.treeList.forEach((item, index) => {
if (item.id == that.frosasd.id) {
that.treeList[index].label = that.frosasd.name;
that.isshowage = false;
that.$message({
message: "修改成功",
type: "success",
});
return;
} else {
item.children.forEach((asd, indexesd) => {
if (asd.id == that.frosasd.id) {
that.treeList[index].children[indexesd].label =
that.frosasd.name;
that.isshowage = false;
that.$message({
message: "修改成功",
type: "success",
});
return;
} else {
asd.children.forEach((zxc, indexzxc) => {
if (zxc.id == that.frosasd.id) {
that.treeList[index].children[indexesd].children[
indexzxc
].label = that.frosasd.name;
that.isshowage = false;
that.$message({
message: "修改成功",
type: "success",
});
return;
}
});
}
});
}
});
})
},
//编辑
ddeditor(node, data) {
this.frosasd.name = data.label;
this.frosasd.id = data.id;
this.isshowage = true;
},
// 删除自定义的节点
checkDelete() {
axios({
url: `${jypath}/marketing/del`,
method: "post",
params: {
id: this.deleteId,
},
}).then((res) => {
if (res.data.res === 1) {
let parmest={
id: this.deleteId,
}
this.$api.http.templategedel(parmest).then((res) => {
this.treeList.forEach((item, index) => {
if (item.id == this.deleteId) {
this.treeList.splice(index, 1);
@@ -1037,13 +989,11 @@ export default {
});
this.deleteChildren.splice(this.deleteIndex, 1);
this.dialogVisible = false;
//this.getCheckedNode();
let index = this.allTreeListId.findIndex((d) => d === this.deleteId);
if (index > -1) {
this.allTreeListId.splice(index, 1);
}
}
});
})
},
remove(node, data) {
if (node.level == 3) {


+ 6
- 2
src/views/Template/PinspeakwordsList.vue 查看文件

@@ -274,8 +274,12 @@ export default {
this.$router.push({ path: "/Template/Pinspeakwords", query: { flag: Userrecord } });
},
//添加
editor(){

editorinfo(){
let Userrecord={
id:'',
houseId:this.projectId,
}
this.$router.push({ path: "/Template/Pinspeakwords", query: { flag: Userrecord } });
},

},


+ 2
- 2
vue.config.js 查看文件

@@ -3,8 +3,8 @@
* https://cli.vuejs.org/zh/config/
*/
// const url = 'http://pigx-gateway'
const url = 'http://39.97.167.65:9999' //测试
// const url = 'http://192.168.31.160:9999' //长龙
// const url = 'http://39.97.167.65:9999' //测试
const url = 'http://192.168.31.160:9999' //长龙
// const url = 'http://192.168.31.129:9999' //嘉豪
// const url = 'http://192.168.31.100:9999' //王笑



Loading…
取消
儲存