diff --git a/src/components/base-table/popup.vue b/src/components/base-table/popup.vue
index c2268c5..f161283 100644
--- a/src/components/base-table/popup.vue
+++ b/src/components/base-table/popup.vue
@@ -18,11 +18,13 @@
v-for="(item, i) in columsList"
:key="i"
>
-
+
+
+
diff --git a/src/components/search-form/components/ApiSelect1.vue b/src/components/search-form/components/ApiSelect1.vue
index c373886..1f41657 100644
--- a/src/components/search-form/components/ApiSelect1.vue
+++ b/src/components/search-form/components/ApiSelect1.vue
@@ -48,6 +48,7 @@ export default {
data() {
return {
show: false,
+ isFirstLoad: true,
options: [],
}
},
@@ -103,7 +104,9 @@ export default {
this.$emit('options-change', this.getOptions)
},
handleConfirm(e) {
+ if (!e.length) return
const { value } = e[0]
+ if (value == null) return
this.$emit('change', value)
this.$emit('input', value)
},
@@ -111,5 +114,13 @@ export default {
return typeof fn === 'function'
},
},
+ watch: {
+ params: {
+ handler() {
+ !this.isFirstLoad && this.fetch()
+ },
+ deep: true,
+ },
+ },
}
diff --git a/src/components/search-form/components/Picker.vue b/src/components/search-form/components/Picker.vue
new file mode 100644
index 0000000..4d9644e
--- /dev/null
+++ b/src/components/search-form/components/Picker.vue
@@ -0,0 +1,84 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/components/search-form/components/SearchItem.vue b/src/components/search-form/components/SearchItem.vue
index 3c83a05..349cfbb 100644
--- a/src/components/search-form/components/SearchItem.vue
+++ b/src/components/search-form/components/SearchItem.vue
@@ -3,6 +3,7 @@
diff --git a/src/components/search-form/components/Select1.vue b/src/components/search-form/components/Select1.vue
new file mode 100644
index 0000000..2ab3b1c
--- /dev/null
+++ b/src/components/search-form/components/Select1.vue
@@ -0,0 +1,122 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/pages.json b/src/pages.json
index 4054be9..b8f638c 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -229,6 +229,38 @@
"enablePullDownRefresh": false,
"navigationStyle":"custom"
}
+ },{
+ "path" : "pages/crop/town-crop",
+ "style" :
+ {
+ "navigationBarTitleText": "城镇农作物",
+ "enablePullDownRefresh": false,
+ "navigationStyle":"custom"
+ }
+ },{
+ "path" : "pages/crop/basics-crop",
+ "style" :
+ {
+ "navigationBarTitleText": "基地农作物",
+ "enablePullDownRefresh": false,
+ "navigationStyle":"custom"
+ }
+ },{
+ "path" : "pages/yield/town-yield",
+ "style" :
+ {
+ "navigationBarTitleText": "城镇产量",
+ "enablePullDownRefresh": false,
+ "navigationStyle":"custom"
+ }
+ },{
+ "path" : "pages/yield/basics-yield",
+ "style" :
+ {
+ "navigationBarTitleText": "基地产量",
+ "enablePullDownRefresh": false,
+ "navigationStyle":"custom"
+ }
}
],
"globalStyle": {
diff --git a/src/pages/basics/components/basics-edit.vue b/src/pages/basics/components/basics-edit.vue
index c569a47..01f2446 100644
--- a/src/pages/basics/components/basics-edit.vue
+++ b/src/pages/basics/components/basics-edit.vue
@@ -166,9 +166,9 @@ export default {
const params = { ...this.form, type: 1 }
if (this.isEdit) {
- this.onUpdate(params)
+ await this.onUpdate(params)
} else {
- this.onCreate(params)
+ await this.onCreate(params)
}
this.$emit('confirm')
},
@@ -206,7 +206,6 @@ export default {
watch: {
data: {
handler(val) {
- console.log(val)
if (val) {
this.setDefaultForm(val)
}
diff --git a/src/pages/crop/basics-crop.vue b/src/pages/crop/basics-crop.vue
new file mode 100644
index 0000000..dafb633
--- /dev/null
+++ b/src/pages/crop/basics-crop.vue
@@ -0,0 +1,237 @@
+
+
+
+
+ 新增
+
+
+
+
+
+
+
+
+
+
+
+
+ 名称:{{ item.name }}
+
+ 单位:{{ item.unit }}
+ 是否是结点:{{ item.is_end ? '是' : '否' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/crop/components/basics-edit.vue b/src/pages/crop/components/basics-edit.vue
index c569a47..2efc7bf 100644
--- a/src/pages/crop/components/basics-edit.vue
+++ b/src/pages/crop/components/basics-edit.vue
@@ -7,59 +7,63 @@
-
-
-
-
-
-
-
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -77,41 +81,22 @@
import { http } from '@/api/index.js'
import ApiSelect from '@/components/search-form/components/ApiSelect1.vue'
import ApiCheckbox from '@/components/search-form/components/ApiCheckbox.vue'
-const industrySelectOption = {
+const categorySelectOption = {
api: async (e) => {
- const { data } = await http.get('/api/keywords-industry', {
+ const { data } = await http.get('/api/keywords-crops-cate', {
params: e,
})
return data.data
},
labelField: 'name',
- valueField: 'key',
+ valueField: 'id',
}
const parentSelectOption = {
- api: async (e) => {
- const { data } = await http.get('/api/agricultural-basic', {
- params: {
- type: 2,
- },
- })
- console.log(data)
- return data.data
- },
- labelField: 'name',
- valueField: 'id',
-}
-const cropsSelectOption = {
api: async (e) => {
const { data } = await http.get('/api/crops', {
- params: { type: 'all', crop_type: 1 },
- })
- console.log(data)
- return data.data.map((e) => {
- return {
- ...e,
- disabled: e.is_end === 0,
- }
+ params: e,
})
+ return data.data.filter(({ is_end }) => is_end != 1)
},
labelField: 'name',
valueField: 'id',
@@ -123,6 +108,10 @@ export default {
type: Object,
default: () => {},
},
+ crop_type: {
+ type: Number,
+ default: 2,
+ },
},
components: {
ApiSelect,
@@ -132,50 +121,66 @@ export default {
isEdit() {
return !!this.data
},
+ parentSelectOption() {
+ return {
+ ...parentSelectOption,
+ params: {
+ type: 'all',
+ crop_type: this.crop_type,
+ category: this.form.category_id,
+ },
+ }
+ },
},
data() {
return {
- industrySelectOption,
- parentSelectOption,
- cropsSelectOption,
+ categorySelectOption,
+
form: {
id: '',
- is_blank: false,
- blank_url: '',
- industry_key: '',
+ category_id: '',
name: '',
- sort: 0,
- person: '',
- areas: '',
- cultivated: '',
- workforce: '',
parent_id: '',
- crops_ids: [],
- address: '',
- description: '',
- address_lng: '',
- address_lat: '',
+ unit: '',
+ is_end: false,
+ extends: [
+ {
+ name: '',
+ unit: '',
+ },
+ ],
},
}
},
methods: {
+ addDomain() {
+ this.form.extends.push({
+ name: '',
+ unit: '',
+ })
+ },
+ removeDomain(index) {
+ this.form.extends.splice(index, 1)
+ },
+ handleParentChange(e) {
+ // this.form.parent_id = ''
+ },
handleCancel() {
this.$emit('cancel')
},
async handleSubmit() {
- const params = { ...this.form, type: 1 }
-
+ const params = { ...this.form, crop_type: this.crop_type }
if (this.isEdit) {
- this.onUpdate(params)
+ await this.onUpdate(params)
} else {
- this.onCreate(params)
+ await this.onCreate(params)
}
this.$emit('confirm')
},
async onUpdate(params) {
try {
- await this.$http.put(`/api/agricultural-basic/${params.id}`, params)
+ await this.$http.put(`/api/crops/${params.id}`, params)
this.$u.toast('操作成功')
} catch ({ data }) {
data && this.$u.toast(data?.message)
@@ -184,23 +189,28 @@ export default {
async onCreate(params) {
try {
- await this.$http.post('/api/agricultural-basic', params)
+ await this.$http.post('/api/crops', params)
this.$u.toast('操作成功')
} catch ({ data }) {
data && this.$u.toast(data?.message)
}
},
- setDefaultForm(data) {
- Object.keys(data).forEach((key) => {
- const value = data[key]
- if (key == 'blank_url') {
- this.form.is_blank = data[key] ? true : false
- } else if (key == 'crops') {
- this.form.crops_ids = value.map((e) => e.id)
+ async setDefaultForm(e) {
+ const { data } = await this.$http.get(`/api/crops/${e.id}`)
+ const { data: resData } = data
+
+ Object.keys(e).forEach((key) => {
+ let value = e[key]
+ if (key == 'is_end') value = value == 1
+ if (key == 'extends') {
+ if (value.length == 0) value = [{ name: '', unit: '' }]
}
if (this.form[key] !== undefined) this.form[key] = value
})
+
+ this.form.category_id = resData?.category?.id
+ this.form.parent_id = resData?.parent_id > 0 ? resData?.parent_id : null
},
},
watch: {
diff --git a/src/pages/crop/town-crop.vue b/src/pages/crop/town-crop.vue
index f65d2b3..53891ac 100644
--- a/src/pages/crop/town-crop.vue
+++ b/src/pages/crop/town-crop.vue
@@ -1,6 +1,6 @@
-
+
新增
@@ -32,21 +32,12 @@
>
- 基地名称:{{ item.name }}
- 农业类型:{{ item.industry_label }}
-
-
-
-
-
- 基地面积
- 种养殖面积
- 就业人数
-
-
- {{ item.areas }}
- {{ item.cultivated }}
- {{ item.workforce }}
+ 名称:{{ item.name }}
+
+ 单位:{{ item.unit }}
+ 是否是结点:{{ item.is_end ? '是' : '否' }}
@@ -61,9 +52,20 @@
:data="currentData"
@onEdit="handleEdit"
@onDel="handleDel"
- >
+ >
+
+
-
+
{
- return text ? '是' : '否'
+ return text == 1 ? '是' : '否'
},
},
- {
- title: '排序',
- dataIndex: 'sort',
- },
- {
- title: '基地负责人',
- dataIndex: 'person',
- },
- {
- title: '基地农作物',
- dataIndex: 'crops',
- format: (arr) => {
- return arr?.map((e) => e.name).join(',') ?? ''
- },
- },
- {
- title: '基地经度',
- dataIndex: 'address_lng',
- },
- {
- title: '基地纬度',
- dataIndex: 'address_lat',
- },
- {
- title: '基地地址',
- dataIndex: 'address',
- },
- {
- title: '基地面积',
- dataIndex: 'areas',
- },
- {
- title: '种养殖面积',
- dataIndex: 'cultivated',
- },
- {
- title: '基地就业人数',
- dataIndex: 'workforce',
- },
- {
- title: '基地描述',
- dataIndex: 'description',
- },
+ // {
+ // title: '',
+ // dataIndex: 'extends',
+ // },
]
export default {
mixins: [MescrollMixin],
@@ -191,23 +154,6 @@ export default {
placeholder: '请输入名称',
},
},
- {
- field: 'type',
- label: '农业类型',
- component: 'ApiSelect',
- componentProps: ({ formActionType }) => {
- return {
- api: async (e) => {
- const { data } = await http.get('/api/keywords-industry', {
- params: e,
- })
- return data.data
- },
- labelField: 'name',
- valueField: 'id',
- }
- },
- },
],
}
},
@@ -221,12 +167,13 @@ export default {
...this.filterParmas,
page: num,
per_page: size,
- type: 1,
+ type: 'all',
+ crop_type: 2,
})
},
async getData(e) {
try {
- const { data } = await http.get(`/api/agricultural-basic`, {
+ const { data } = await http.get(`/api/crops`, {
params: e,
})
if (e.page == 1) this.dataList = []
@@ -265,7 +212,7 @@ export default {
success: async (res) => {
if (res.confirm) {
try {
- await this.$http.delete(`/api/agricultural-basic/${item.id}`)
+ await this.$http.delete(`/api/crops/${item.id}`)
this.mescroll.resetUpScroll()
this.baseShow = false
} catch ({ data }) {
diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue
index c08d5a3..70b708b 100644
--- a/src/pages/index/index.vue
+++ b/src/pages/index/index.vue
@@ -100,9 +100,11 @@ export default {
children: [
{
label: '城镇农作物',
+ url: '/pages/crop/town-crop',
},
{
label: '基地农作物',
+ url: '/pages/crop/basics-crop',
},
],
},
@@ -112,9 +114,11 @@ export default {
children: [
{
label: '城镇产量',
+ url: '/pages/yield/town-yield',
},
{
label: '基地产量',
+ url: '/pages/yield/basics-yield',
},
],
},
diff --git a/src/pages/yield/basics-yield.vue b/src/pages/yield/basics-yield.vue
new file mode 100644
index 0000000..5de350a
--- /dev/null
+++ b/src/pages/yield/basics-yield.vue
@@ -0,0 +1,281 @@
+
+
+
+
+ 新增
+
+
+
+
+
+
+
+
+
+
+
+
+ 街镇名称:{{ item.base_name }}
+ 农作物名称:{{ item.crop_name }}
+
+
+
+
+
+ 产量
+ 产值
+ 耕种面积
+
+
+ {{ item.yield }}
+ {{ item.output }}
+ {{ item.cultivated }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/yield/components/basics-edit.vue b/src/pages/yield/components/basics-edit.vue
new file mode 100644
index 0000000..d3d8b56
--- /dev/null
+++ b/src/pages/yield/components/basics-edit.vue
@@ -0,0 +1,193 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 取消
+
+ 保存
+
+
+
+
+
diff --git a/src/pages/yield/town-yield.vue b/src/pages/yield/town-yield.vue
new file mode 100644
index 0000000..669cfe6
--- /dev/null
+++ b/src/pages/yield/town-yield.vue
@@ -0,0 +1,280 @@
+
+
+
+
+ 新增
+
+
+
+
+
+
+
+
+
+
+
+
+ 街镇名称:{{ item.base_name }}
+ 农作物名称:{{ item.crop_name }}
+
+
+
+
+
+ 产量
+ 产值
+ 耕种面积
+
+
+ {{ item.yield }}
+ {{ item.output }}
+ {{ item.cultivated }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+