diff --git a/src/components/Editor/index.vue b/src/components/Editor/index.vue
index 6bb5a18..c964efb 100644
--- a/src/components/Editor/index.vue
+++ b/src/components/Editor/index.vue
@@ -172,11 +172,11 @@ export default {
// 获取富文本组件实例
let quill = this.Quill;
// 如果上传成功
- if (res.code == 200) {
+ if (res.code == 0) {
// 获取光标所在位置
let length = quill.getSelection().index;
// 插入图片 res.url为服务器返回的图片地址
- quill.insertEmbed(length, "image", process.env.VUE_APP_BASE_API + res.fileName);
+ quill.insertEmbed(length, "image", res.data.fileName);
// 调整光标到最后
quill.setSelection(length + 1);
} else {
diff --git a/src/views/farm/discuss/index.vue b/src/views/farm/discuss/index.vue
index b53216e..39e0400 100644
--- a/src/views/farm/discuss/index.vue
+++ b/src/views/farm/discuss/index.vue
@@ -50,14 +50,25 @@
{{convertTask(scope.row.taskId)}}
+
+
+ {{resouceConvert(scope.row.resources)}}
+
+
-
+
+
+
+
+ {{countTotalHour(scope.row.workingHours, scope.row.joinNumber)}}
+
-
+
-
+
-
+
+ 添加资源
+
+
+
+
+ 删除
+
-
+
-
+
+
+
+
@@ -146,7 +167,7 @@
新增活动只能选择进行中的项目下的进行中的任务
- 执行人只能从项目的成员中选择
+
提交活动后,任务自动变成已完成,并新增执行人的工时
如果任务类型是采收, 则会将采收数量同步到ERP对应物料数量
@@ -165,6 +186,8 @@ import { getProjectPage } from "@/api/farm/project";
import { getTaskPage } from "@/api/farm/task";
import { getTaskCatePage } from "@/api/farm/taskCate";
import { getCpUserPage } from "@/api/system/cpUser";
+import { getResourceTypePage } from "@/api/farm/resourceType";
+import { getResourcePage } from "@/api/farm/resource";
export default {
name: "Discuss",
@@ -176,6 +199,10 @@ export default {
return {
//活动规则
dialogVisible: false,
+ //采收input
+ canInput : true,
+ //项目、任务能否选择
+ canSelect: false,
// 遮罩层
loading: true,
// 导出遮罩层
@@ -199,7 +226,7 @@ export default {
taskId: null,
content: null,
images: null,
- // resources: null,
+ resources: null,
},
// 表单参数
form: {
@@ -215,7 +242,11 @@ export default {
selectTaskList:[], //对应项目的任务
taskCateList:[],
cpUserList:[], //所有cpUser
- selectCpUserList:[] //参与人
+ selectCpUserList:[], //参与人
+
+ resourceTypeList:[],
+ resourceList:[],
+ twoList: []
};
},
@@ -270,6 +301,27 @@ export default {
draft:false,
}).then(res=>{
this.taskList = res.data.list;
+ this.getResourceTypeList();
+ })
+ },
+ /*资源类型 */
+ getResourceTypeList(){
+ getResourceTypePage({
+ pageNo: 1,
+ pageSize: 400
+ }).then(res =>{
+ this.resourceTypeList = res.data.list;
+ this.getResourceList();
+ })
+ },
+ /*资源 */
+ getResourceList(){
+ getResourcePage({
+ pageNo: 1,
+ pageSize: 400
+ }).then(res => {
+ this.resourceList = res.data.list;
+ this.twoRescoure();
this.getList();
})
},
@@ -299,7 +351,11 @@ export default {
taskId: undefined,
content: undefined,
images: undefined,
+ resources: [],
+ recoveryNumber:undefined
};
+ this.canInput = true,
+ this.canSelect = false,
this.resetForm("form");
},
/** 搜索按钮操作 */
@@ -316,7 +372,7 @@ export default {
/** 新增按钮操作 */
handleAdd() {
this.reset();
- // this.twoRescoure();
+ this.twoRescoure();
this.projectList = this.projectList.filter(item => item.state == 'STARTING');
this.open = true;
this.title = "添加农场任务讨论";
@@ -324,7 +380,8 @@ export default {
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
- // this.twoRescoure();
+ this.canSelect = true;
+ this.twoRescoure();
const id = row.id;
getDiscuss(id).then(response => {
this.form = response.data;
@@ -425,16 +482,12 @@ export default {
this.form.recoveryNumber = null;
let task = this.taskList.filter(task => task.id == row)[0];
let taskCate = this.taskCateList.filter(cate => cate.id == task.taskCateName)[0];
-
- var reco = document.getElementById("recoveryNumber");
-
if(taskCate.synchronizeErp){
//采收数量可编辑
- reco.removeAttribute("disabled");
-
+ this.canInput = false;
}else{
//采收数量不可编辑
- reco.setAttribute("disabled", true);
+ this.canInput = true;
}
},
//展示项目名
@@ -446,8 +499,44 @@ export default {
convertTask(taskId){
let task = this.taskList.filter(item => item.id == taskId)[0];
return task.taskName +"/\n"+ task.taskMsg;
+ },
+ resouceConvert(resources){
+ if(resources != undefined){
+ let resouceMsg = "";
+ resources.forEach(item =>{
+ let typeName = this.resourceTypeList.filter(type => type.id == item.resourceId[0])[0];
+ let resName = this.resourceList.filter(name => name.id == item.resourceId[1])[0];
+ resouceMsg += typeName.name +"/" + resName.name +":" + item.num +"\n";
+ })
+ return resouceMsg;
+ }
+ },
+ addResource(){
+ let resourceTmp = {num:1}
+ this.form.resources = this.form.resources.concat(resourceTmp)
+ },
+ deleteResource(item){
+ this.form.resources = this.form.resources.filter(res => res!=item)
+ },
+ twoRescoure() {
+ let firstList = [];
+ this.resourceTypeList.forEach((type) => {
+ let secondList = [];
+ this.resourceList.forEach((res) => {
+ if (res.resourceType == type.id) {
+ secondList.push({ value: res.id, label: res.name });
+ }
+ })
+ firstList.push({ value: type.id, label: type.name, children: secondList });
+ })
+ this.twoList = firstList;
+ },
+ //计算总工时
+ countTotalHour(hour, number){
+ if(hour != undefined && number != undefined){
+ return (hour * number).toFixed(1);
+ }
}
-
}
};
diff --git a/src/views/farm/task/index.vue b/src/views/farm/task/index.vue
index d03f4d0..318e553 100644
--- a/src/views/farm/task/index.vue
+++ b/src/views/farm/task/index.vue
@@ -50,13 +50,13 @@
-
+
@@ -130,7 +130,7 @@
{{scope.row.taskMsg}}
-
+
@@ -213,13 +213,20 @@
-
+
+