Browse Source

页面优化, 同步到ERP

master
zhanyunjiu 3 years ago
parent
commit
eb67cb8cd1
  1. 8
      src/api/farm/crop.js
  2. 29
      src/views/farm/crop/index.vue
  3. 2
      src/views/farm/task/index.vue
  4. 16
      src/views/farm/taskCate/index.vue

8
src/api/farm/crop.js

@ -52,3 +52,11 @@ export function exportCropExcel(query) {
responseType: 'blob'
})
}
//获得ERP Material 列表
export function getMaterialList(){
return request({
url: '/farm/crop/getMaterialList',
method: 'get',
})
}

29
src/views/farm/crop/index.vue

@ -42,6 +42,13 @@
</template>
</el-table-column>
<el-table-column label="当前库存" align="center" prop="stock" />
<el-table-column label="ERP物料id" align="center" prop="materialId" />
<el-table-column label="ERP物料名字" align="center">
<template slot-scope="scope">
<span v-if="scope.row.materialId"> {{materialList.find(t=>t.id == scope.row.materialId ).name}} </span>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
@ -72,6 +79,15 @@
<el-form-item label="当前库存" prop="stock">
<el-input v-model="form.stock" placeholder="请输入当前库存" />
</el-form-item>
<el-form-item label="ERP物料id" prop="materialId">
<el-select v-model="form.materialId" filterable placeholder="请先选择ERP物料">
<el-option v-for="item in materialList" :key="item.id" :label="item.name" :value="item.id">
{{ item.name }}
</el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
@ -82,7 +98,7 @@
</template>
<script>
import { createCrop, updateCrop, deleteCrop, getCrop, getCropPage, exportCropExcel } from "@/api/farm/crop";
import { createCrop, updateCrop, deleteCrop, getCrop, getCropPage, exportCropExcel, getMaterialList } from "@/api/farm/crop";
import ImageUpload from '@/components/ImageUpload';
import Editor from '@/components/Editor';
@ -123,7 +139,9 @@ export default {
rules: {
name: [{ required: true, message: "物料名不能为空", trigger: "blur" }],
stock: [{ required: true, message: "当前库存不能为空", trigger: "blur" }],
}
},
materialList :[]
};
},
created() {
@ -141,8 +159,14 @@ export default {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
this.getErpMaterial();
});
},
getErpMaterial(){
getMaterialList().then(res =>{
this.materialList = res;
})
},
/** 取消按钮 */
cancel() {
this.open = false;
@ -155,6 +179,7 @@ export default {
name: undefined,
images: undefined,
stock: undefined,
materialId: undefined,
};
this.resetForm("form");
},

2
src/views/farm/task/index.vue

@ -376,7 +376,7 @@ export default {
};
},
created() {
this.getList(),
// this.getList(),
this.getTaskCateList();
this.getAreasList();
this.getProjectList();

16
src/views/farm/taskCate/index.vue

@ -35,7 +35,15 @@
:tree-props="{children: 'children', hasChildren: 'hasChildren'}">
<el-table-column prop="id" label="id" sortable width="180"></el-table-column>
<el-table-column prop="name" label="名" sortable width="180"></el-table-column>
<el-table-column prop="unit" label="单位" sortable width="180"></el-table-column>
<el-table-column prop="unit" label="单位" sortable width="80"></el-table-column>
<el-table-column prop="synchronizeErp" label="是否同步到ERP" align="center" sortable="180">
<template slot-scope="scope">
<el-button type="success" v-if="!scope.row.synchronizeErp"></el-button>
<el-button type="danger" v-if="scope.row.synchronizeErp"></el-button>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
@ -148,17 +156,17 @@ export default {
if(filterList.length == 0){
//
this.list.forEach(t => {
oneList.push({id:one.id, name:one.name, unit:one.unit, createTime:one.createTime, children:twoList});
oneList.push({id:one.id, name:one.name, unit:one.unit, createTime:one.createTime, synchronizeErp:one.synchronizeErp, children:twoList});
})
}else{
filterList.forEach((one) => {
let twoList = [];
this.list.forEach((two) => {
if(one.id == two.parentId){
twoList.push({id:two.id, name:two.name, unit:two.unit, createTime:two.createTime})
twoList.push({id:two.id, name:two.name, unit:two.unit, synchronizeErp:two.synchronizeErp, createTime:two.createTime})
}
})
oneList.push({id:one.id, name:one.name, unit:one.unit, createTime:one.createTime, children:twoList});
oneList.push({id:one.id, name:one.name, unit:one.unit, createTime:one.createTime, synchronizeErp:one.synchronizeErp, children:twoList});
})
}

Loading…
Cancel
Save