diff --git a/package.json b/package.json
index 043f49b..67fc1b7 100644
--- a/package.json
+++ b/package.json
@@ -42,6 +42,7 @@
"@babel/parser": "^7.7.4",
"@riophae/vue-treeselect": "0.4.0",
"ant-design-vue": "1.5.2",
+ "area-data": "^5.0.6",
"axios": "0.24.0",
"bpmn-js-token-simulation": "^0.10.0",
"cache-loader": "^2.0.1",
@@ -100,7 +101,7 @@
"bpmn-js": "8.9.0",
"bpmn-js-properties-panel": "0.46.0",
"chalk": "4.1.0",
- "compression-webpack-plugin": "5.0.2",
+ "compression-webpack-plugin": "^5.0.2",
"connect": "3.6.6",
"eslint": "7.15.0",
"eslint-config-airbnb-base": "^14.0.0",
diff --git a/src/views/farm/task/index.vue b/src/views/farm/task/index.vue
index e271561..87ff3b7 100644
--- a/src/views/farm/task/index.vue
+++ b/src/views/farm/task/index.vue
@@ -1,29 +1,29 @@
+.el-table .cell {
+ white-space: pre-line;
+}
+
-
+
-
+
-
+
-
+
-
+
搜索
@@ -35,11 +35,11 @@
新增
+ v-hasPermi="['farm:task:create']">新增
- 导出
+ 导出
@@ -47,46 +47,47 @@
-
+
- {{projectList.find(t=>t.id == scope.row.projectId ).name}}
+ {{ projectList.find(t => t.id == scope.row.projectId).name }}
-
+
- {{cpUserList.find(t=>t.id == scope.row.mainPerson ).name}}
+ {{ cpUserList.find(t => t.id == scope.row.mainPerson).name }}
-
-
+
+
-
+
- {{cropList.find(t=>t.id == scope.row.cropId ).name}}
+ {{ cropList.find(t => t.id == scope.row.cropId).name }}
-
+
- {{cateOneList.find(t=>t.id == scope.row.taskCateId ).name}}
+ {{ cateOneList.find(t => t.id == scope.row.taskCateId).name }}
-
+
- {{cateTwoList.find(t=>t.id == scope.row.taskCateName ).name}}
+ {{ cateTwoList.find(t => t.id == scope.row.taskCateName).name }}
-
+
+
+ {{resouceConvert(scope.row.resources)}}
+
+
-
-
-
-
+
+
+
+
@@ -108,157 +109,102 @@
修改
+ v-hasPermi="['farm:task:update']">修改
删除
+ v-hasPermi="['farm:task:delete']">删除
+ @pagination="getList" />
-
-
- {{item.name}}
+
+
+ {{ item.name }}
-
-
- {{item.name}}
+
+
+ {{ item.name }}
-
-
- {{item.name}}
+
+
+ {{ item.name }}
-
+
-
-
- {{item.name}}
+
+
+ {{ item.name }}
-
+
-
-
- {{item.name}}
+
+
+ {{ item.name }}
-
-
- {{item.name}}
+
+
+ {{ item.name }}
-
-
-
-
-
-
-
-
-
-
-
- {{item.pValue}}/{{item.value}}
-
-
-
-
-
-
-
-
+ 主要按钮
+
+ ziyuanxuanze(item,index,obj)">
+
+
+
+
-
+
-
+
-
+
@@ -277,12 +223,12 @@ import { createTask, updateTask, deleteTask, getTask, getTaskPage, getTaskSearch
import ImageUpload from '@/components/ImageUpload';
import Editor from '@/components/Editor';
import { getResourcePage } from "@/api/farm/resource";
-import { getProjectPage} from "@/api/farm/project";
-import { getCropPage} from "@/api/farm/crop";
-import { getResourceTypePage} from "@/api/farm/resourceType";
-import { getTaskCatePage} from "@/api/farm/taskCate";
-import { getCpUserPage} from "@/api/system/cpUser";
-import { getAreaPage} from "@/api/farm/area";
+import { getProjectPage } from "@/api/farm/project";
+import { getCropPage } from "@/api/farm/crop";
+import { getResourceTypePage } from "@/api/farm/resourceType";
+import { getTaskCatePage } from "@/api/farm/taskCate";
+import { getCpUserPage } from "@/api/system/cpUser";
+import { getAreaPage } from "@/api/farm/area";
import { values } from 'min-dash';
@@ -326,7 +272,8 @@ export default {
workingHours: null
},
// 表单参数
- form: {},
+ form: {
+ },
// 表单校验
rules: {
projectId: [{ required: true, message: "不能为空", trigger: "blur" }],
@@ -340,32 +287,31 @@ export default {
planEndTime: [{ required: true, message: "不能为空", trigger: "blur" }],
weight: [{ required: true, message: "不能为空", trigger: "blur" }],
},
- resourceList:[],
- selectResourceList:[],
- projectList:[],
- cropList:[],
+ resourceList: [],
+ selectResourceList: [],
+ projectList: [],
+ cropList: [],
- resourceTypeList:[],
- resourceNumberList:[],
+ resourceTypeList: [],
+ resourceNumberList: [],
- twoList:[],
+ twoList: [],
props: { multiple: true },
- cpUserList:[],
- executorPerson:[],
-
- taskCateAllList:[], //未组装的
- taskCateList:[], //组装好的
+ cpUserList: [],
+ executorPerson: [],
- cateOneList:[],
- cateTwoList:[],
- formR:{},
+ taskCateAllList: [], //未组装的
+ taskCateList: [], //组装好的
- areasList:[],
- assemAreaList:[],
- areasParentList:[],
- areasSonList:[],
+ cateOneList: [],
+ cateTwoList: [],
+ formR: {},
+ areasList: [],
+ assemAreaList: [],
+ areasParentList: [],
+ areasSonList: [],
};
},
created() {
@@ -378,19 +324,39 @@ export default {
this.getAreasList();
},
methods: {
- getAreasList(){
+ resouceConvert(resources){
+ let rnameArr = this.resourceList.filter(s=>{
+ if (resources.length > 0){
+ return resources[0].resourceId.indexOf(s.id)>= 0;
+ }
+ } );
+ let rname = "";
+ rnameArr.forEach(s=>{
+ rname += s.name + "-";
+ })
+ return rname;
+ },
+ ziyuanxuanze(item,index,obj){
+ this.form.resource[index].reource = obj[1];
+ console.log(this.form.resource);
+ },
+ addResource(){
+ let resourceTmp = {reource:0,num:1}
+ this.form.resources = this.form.resources.concat(resourceTmp)
+ },
+ getAreasList() {
getAreaPage({
pageNo: 1,
pageSize: 100
- }).then(res =>{
+ }).then(res => {
this.areasList = res.data.list;
})
},
- getTaskCateList(){
+ getTaskCateList() {
getTaskCatePage({
pageNo: 1,
pageSize: 100
- }).then(res=>{
+ }).then(res => {
this.taskCateList = res.data.list;
this.taskCateAllList = res.data.list;
@@ -400,55 +366,55 @@ export default {
let cateFirstList = [];
catefilterList.forEach(one => {
let cateSecondList = [];
- this.taskCateList.forEach(two =>{
+ this.taskCateList.forEach(two => {
if (one.id == two.parentId) {
- cateSecondList.push({value: two.id, label: two.name})
+ cateSecondList.push({ value: two.id, label: two.name })
}
})
- cateFirstList.push({value: one.id, label: one.name, children: cateSecondList})
+ cateFirstList.push({ value: one.id, label: one.name, children: cateSecondList })
});
this.taskCateList = cateFirstList;
})
},
- getCpUserList(){
+ getCpUserList() {
getCpUserPage({
pageNo: 1,
pageSize: 100
- }).then(res=>{
+ }).then(res => {
this.cpUserList = res.data.list;
})
},
- getCropList(){
+ getCropList() {
getCropPage({
pageNo: 1,
pageSize: 100
- }).then(res=>{
+ }).then(res => {
this.cropList = res.data.list;
})
},
- getProjectList(){
+ getProjectList() {
getProjectPage({
pageNo: 1,
pageSize: 100
- }).then(res=>{
+ }).then(res => {
this.projectList = res.data.list;
})
},
/**查询资源*/
- getResource(){
+ getResource() {
getResourcePage({
pageNo: 1,
pageSize: 10,
- }).then(res=>{
+ }).then(res => {
this.resourceList = res.data.list;
this.getList();
})
},
- getResourceTypeList(){
+ getResourceTypeList() {
getResourceTypePage({
pageNo: 1,
pageSize: 100
- }).then(res=>{
+ }).then(res => {
this.resourceTypeList = res.data.list;
})
},
@@ -457,61 +423,49 @@ export default {
this.loading = true;
// this.assemArea();
// 处理查询参数
- let params = {...this.queryParams};
+ let params = { ...this.queryParams };
this.addBeginAndEndTime(params, this.dateRangePlanStartTime, 'planStartTime');
this.addBeginAndEndTime(params, this.dateRangePlanEndTime, 'planEndTime');
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
// 执行查询
getTaskPage(params).then(response => {
- //1 循环list
- response.data.list.forEach(element => {
- if(element.images != null){
- //有图片转json
- element.images = JSON.parse(element.images);
- }else{
- //无图片给个空
- element.images = [];
- }
- //2 循环每个list对象的resource
- element.resources = JSON.parse(element.resources);
- let resourceName = '';
- element.resources.forEach((inn) =>{
- //3 每个resouce循环比较 resourceList,取得名字
- this.resourceList.forEach((resource) =>{
- if(inn == resource.id){
- resourceName += (resource.name + "、\n");
+ //1 循环list
+ response.data.list.forEach(element => {
+ if (element.images != null) {
+ //有图片转json
+ element.images = JSON.parse(element.images);
+ } else {
+ //无图片给个空
+ element.images = [];
+ }
+
+
+ element.executorPerson = JSON.parse(element.executorPerson);
+ let executorName = '';
+ element.executorPerson.forEach((exe) => {
+ this.cpUserList.forEach((cp) => {
+ if (exe == cp.id) {
+ executorName += (cp.name + "、\n");
}
- }
- )
- })
- element.resources = resourceName;
-
- element.executorPerson = JSON.parse(element.executorPerson);
- let executorName = '';
- element.executorPerson.forEach((exe)=>{
- this.cpUserList.forEach((cp)=>{
- if(exe == cp.id){
- executorName += (cp.name +"、\n");
- }
+ })
})
- })
- element.executorPerson = executorName;
+ element.executorPerson = executorName;
- if (element.areas != null) {
+ if (element.areas != null) {
element.areas = JSON.parse(element.areas);
let areaName = "";
- element.areas.forEach(item =>{
- let p = this.areasList.filter(t => t.id == item[0])[0].name;
- let s = this.areasList.filter(t => t.id == item[1])[0].name;
- areaName += p +"/" + s +"、\n";
+ element.areas.forEach(item => {
+ let p = this.areasList.filter(t => t.id == item[0])[0].name;
+ let s = this.areasList.filter(t => t.id == item[1])[0].name;
+ areaName += p + "/" + s + "、\n";
})
element.areas = areaName;
- }
- });
- this.list = response.data.list;
- this.total = response.data.total;
- this.loading = false;
+ }
+ });
+ this.list = response.data.list;
+ this.total = response.data.total;
+ this.loading = false;
});
this.twoRescoure();
},
@@ -519,26 +473,26 @@ export default {
getSearchList() {
this.loading = true;
// 处理查询参数
- let params = {...this.queryParams};
+ let params = { ...this.queryParams };
this.addBeginAndEndTime(params, this.dateRangePlanStartTime, 'planStartTime');
this.addBeginAndEndTime(params, this.dateRangePlanEndTime, 'planEndTime');
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
// 执行查询
getTaskSearchPage(params).then(response => {
response.data.list.forEach(element => {
- if(element.images != null){
+ if (element.images != null) {
element.images = JSON.parse(element.images);
- }else{
+ } else {
element.images = [];
}
element.resources = JSON.parse(element.resources);
let resourceName = '';
- element.resources.forEach((inn) =>{
- this.resourceList.forEach((resource) =>{
- if(inn == resource.id){
- resourceName += (resource.name + "、\n");
- }
+ element.resources.forEach((inn) => {
+ this.resourceList.forEach((resource) => {
+ if (inn == resource.id) {
+ resourceName += (resource.name + "、\n");
}
+ }
)
})
element.resources = resourceName;
@@ -560,7 +514,7 @@ export default {
id: undefined,
taskCateId: undefined,
taskCateName: undefined,
- resources: undefined,
+ resources: [],
images: undefined,
planStartTime: undefined,
planEndTime: undefined,
@@ -570,7 +524,7 @@ export default {
cropNum: undefined,
mainPerson: undefined,
executorPerson: undefined,
- workingHours: undefined
+ workingHours: undefined,
};
this.resetForm("form");
},
@@ -606,13 +560,13 @@ export default {
const id = row.id;
getTask(id).then(response => {
this.form = response.data;
- if(response.data.resources != null){
+ if (response.data.resources != null) {
let resourceArr = JSON.parse(response.data.resources);
this.form.resources = resourceArr;
this.selectResourceList = resourceArr;
}
- if(response.data.images != null){
+ if (response.data.images != null) {
let imagesArr = JSON.parse(response.data.images);
this.form.images = imagesArr;
}
@@ -637,7 +591,6 @@ export default {
return;
}
//资源转json
- this.form.resources = JSON.stringify(this.selectResourceList);
this.form.executorPerson = JSON.stringify(this.executorPerson);
this.form.areas = JSON.stringify(this.form.areas);
//图片转json
@@ -671,17 +624,17 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
- this.$modal.confirm('是否确认删除农场项目编号为"' + id + '"的数据项?').then(function() {
- return deleteTask(id);
- }).then(() => {
- this.getList();
- this.$modal.msgSuccess("删除成功");
- }).catch(() => {});
+ this.$modal.confirm('是否确认删除农场项目编号为"' + id + '"的数据项?').then(function () {
+ return deleteTask(id);
+ }).then(() => {
+ this.getList();
+ this.$modal.msgSuccess("删除成功");
+ }).catch(() => { });
},
/** 导出按钮操作 */
handleExport() {
// 处理查询参数
- let params = {...this.queryParams};
+ let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
this.addBeginAndEndTime(params, this.dateRangePlanStartTime, 'planStartTime');
@@ -689,82 +642,56 @@ export default {
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
// 执行导出
this.$modal.confirm('是否确认导出所有农场项目数据项?').then(() => {
- this.exportLoading = true;
- return exportTaskExcel(params);
- }).then(response => {
- this.$download.excel(response, '${table.classComment}.xls');
- this.exportLoading = false;
- }).catch(() => {});
+ this.exportLoading = true;
+ return exportTaskExcel(params);
+ }).then(response => {
+ this.$download.excel(response, '${table.classComment}.xls');
+ this.exportLoading = false;
+ }).catch(() => { });
},
- 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});
+ 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 });
+ }
})
- this.twoList = firstList;
+ firstList.push({ value: type.id, label: type.name, children: secondList });
+ })
+ this.twoList = firstList;
},
- changeCateOne(row){
- this.cateTwoList = this.taskCateAllList.filter(t => t.parentId == row);
+ changeCateOne(row) {
+ this.cateTwoList = this.taskCateAllList.filter(t => t.parentId == row);
},
- changeResources(row){
- let selectROW = this.$refs['chooseR'].getCheckedNodes();
- if (row.length == 0) {
- this.resourceNumberList = [];
- return ;
- }
- if (selectROW.filter(t=>t.hasChildren).length == 0) {
- //节点数量为0 清除待填数据
- this.resourceNumberList = [];
- }
-
- selectROW.forEach(item =>{
- if(!item.hasChildren){
- //没有腹肌才算
- let obj = {
- pId: item.parent.data.value,
- pValue: item.parent.data.label,
- id:item.data.value,
- value: item.data.label
- };
- var index = this.resourceNumberList.findIndex(item => item.id === obj.id);
- if(index == -1){
- this.resourceNumberList.push(obj);
+
+ assemArea() {
+ let parentLsit = this.areasList.filter(t => t.parentId == 0);
+ let sonList = this.areasList.filter(s => s.parentId != 0);
+
+ let firstList = [];
+ parentLsit.forEach(p => {
+ this.areasParentList.push(p);
+ let secondList = [];
+ sonList.forEach(s => {
+ if (p.id == s.parentId) {
+ this.areasSonList.push(s);
+ secondList.push({ value: s.id, label: s.name });
}
- }
- })
- },
- assemArea(){
- let parentLsit = this.areasList.filter(t => t.parentId == 0);
- let sonList = this.areasList.filter(s => s.parentId != 0);
-
- let firstList = [];
- parentLsit.forEach(p => {
- this.areasParentList.push(p);
- let secondList = [];
- sonList.forEach(s => {
- if (p.id == s.parentId) {
- this.areasSonList.push(s);
- secondList.push({value:s.id, label:s.name});
- }
- })
- firstList.push({value: p.id, label:p.name, children: secondList})
})
- this.assemAreaList = firstList;
+ firstList.push({ value: p.id, label: p.name, children: secondList })
+ })
+ this.assemAreaList = firstList;
},
- changeProject(row){
+ changeProject(row) {
this.form.areas = null;
this.assemArea();
let projectArea = JSON.parse(this.projectList.filter(project => project.id == row)[0].areas);
- let filterArr = [];
- this.assemAreaList.forEach(t=>{
- projectArea.forEach(a=>{
+ let filterArr = [];
+ this.assemAreaList.forEach(t => {
+ projectArea.forEach(a => {
if (a == t.value) {
filterArr.push(t);
}
diff --git a/vue.config.js b/vue.config.js
index e573601..6505a61 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -77,12 +77,12 @@ module.exports = {
},
plugins: [
// http://doc.ruoyi.vip/ruoyi-vue/other/faq.html#使用gzip解压缩静态文件
- new CompressionPlugin({
- test: /\.(js|css|html)?$/i, // 压缩文件格式
- filename: '[path].gz[query]', // 压缩后的文件名
- algorithm: 'gzip', // 使用gzip压缩
- minRatio: 0.8 // 压缩率小于1才会压缩
- })
+ // new CompressionPlugin({
+ // test: /\.(js|css|html)?$/i, // 压缩文件格式
+ // filename: '[path].gz[query]', // 压缩后的文件名
+ // algorithm: 'gzip', // 使用gzip压缩
+ // minRatio: 0.8 // 压缩率小于1才会压缩
+ // })
],
},
chainWebpack(config) {
@@ -138,6 +138,13 @@ module.exports = {
inline: /runtime\..*\.js$/
}])
.end()
+
+ config.plugin('compressionPlugin').use(new CompressionPlugin({
+ test: /\.(js|css|less)$/, // 匹配文件名
+ threshold: 10240, // 对超过10k的数据压缩
+ deleteOriginalAssets: true // 删除源文件
+ }))
+
config
.optimization.splitChunks({
chunks: 'all',