镇公司收集任务

This commit is contained in:
zmj 2023-11-07 23:41:56 +08:00
parent 4192e6cbfd
commit 28729caa81
2 changed files with 106 additions and 48 deletions

View File

@ -1,12 +1,13 @@
<template> <template>
<view class="personnel_list"> <view class="personnel_list">
<u-tabs style="background-color: #fff;" :list="tabLists" @click="changeTypeCurrent" lineColor='#0022C7' <u-tabs style="background-color: #0022C7;" :list="tabLists" @click="changeTypeCurrent" lineColor='white'
lineWidth='40' inactiveStyle='color:#0022C7' activeStyle="color:#0022C7"></u-tabs> lineWidth='100' inactiveStyle='color:white' activeStyle="color:white"></u-tabs>
<view class="" style="height: 20rpx;"> <view class="" style="height: 20rpx;">
</view> </view>
<view class="card" v-for="(item,index) in gatherList" :key="index" v-show="page==1" <view class="card" v-for="(item,index) in gatherList" :key="item.id" v-if="page==1&&item.planting"
@click="navgo(`/subpkg/townTask/townGather?type=plant&task_id=${task_id}&index=${index}`)"> @click="navgo(`/subpkg/townTask/townGather?type=plant&task_id=${task_id}&index=${index}`)">
<view class="card_head"> <view class="card_head">
<view class=""> <view class="">
养植信息 养植信息
@ -15,7 +16,7 @@
点击查看 点击查看
</view> </view>
</view> </view>
<view class="card_content" @click="navgo(`/subpkg/townTask/townGather?type=supply&task_id=${task_id}`)"> <view class="card_content">
<view class="" style="margin-bottom: 20rpx;"> <view class="" style="margin-bottom: 20rpx;">
法人姓名: {{item.planting[0].entityName}} 法人姓名: {{item.planting[0].entityName}}
</view> </view>
@ -24,7 +25,8 @@
</view> </view>
</view> </view>
</view> </view>
<view class="card" v-for="(item,index) in gatherList" :key="index" v-show="page==2"> <view class="card" v-for="(item,index) in gatherList" :key="index" v-if="page==2&&item.supply"
@click="navgo(`/subpkg/townTask/townGather?type=supply&task_id=${task_id}&index=${index}`)">
<view class="card_head"> <view class="card_head">
<view class=""> <view class="">
批发商信息 批发商信息
@ -83,15 +85,19 @@
} }
}, },
onShow() {
townMasterTask3List({
id: this.task_id
}).then(res => {
this.gatherList = res.data.template_info.extend.purchase_sales_info
})
},
onLoad(option) { onLoad(option) {
this.task_id = option.task_id this.task_id = option.task_id
townMasterTask3List({ townMasterTask3List({
id: option.task_id id: option.task_id
}).then(res => { }).then(res => {
this.gatherList = res.data.template_info.extend.purchase_sales_info this.gatherList = res.data.template_info.extend.purchase_sales_info
}) })
// townTask3List() // townTask3List()
}, },
@ -104,6 +110,7 @@
}, },
navgo(url) { navgo(url) {
this.show = false
uni.navigateTo({ uni.navigateTo({
url url
}) })

View File

@ -1,5 +1,5 @@
<template> <template>
<view class="content"> <view class="content" v-if="flag">
<view class="tit"> <view class="tit">
<text v-if="page">养殖信息</text> <text v-if="page">养殖信息</text>
<text v-else>镇批发商信息收集表</text> <text v-else>镇批发商信息收集表</text>
@ -179,7 +179,7 @@
<u--textarea :disabled="readonly" v-model="formData.familyNotes" autoHeight placeholder="请输入" <u--textarea :disabled="readonly" v-model="formData.familyNotes" autoHeight placeholder="请输入"
border="surround" count></u--textarea> border="surround" count></u--textarea>
</u-form-item> </u-form-item>
<u-button type="primary" text="提交" @click="confirm1" color="#0122C7"></u-button> <u-button v-if="!readonly" type="primary" text="提交" @click="confirm1" color="#0122C7"></u-button>
</u--form> </u--form>
</view> </view>
<!-- 镇批发商信息收集表 --> <!-- 镇批发商信息收集表 -->
@ -190,8 +190,7 @@
<u--input :readonly="readonly" v-model="formData1.storeName" placeholder="请输入店铺名称"></u--input> <u--input :readonly="readonly" v-model="formData1.storeName" placeholder="请输入店铺名称"></u--input>
</u-form-item> </u-form-item>
<u-form-item labelWidth="auto" label="经营类型" required prop="type" borderBottom> <u-form-item labelWidth="auto" label="经营类型" required prop="type" borderBottom>
<u--input :readonly="readonly" v-model="formData1.type" placeholder="请输入经营类型" <u--input :readonly="readonly" v-model="formData1.type" placeholder="请输入经营类型"></u--input>
type="number"></u--input>
</u-form-item> </u-form-item>
<u-form-item labelWidth="auto" label="店主姓名" required prop="shopkeeperName" borderBottom> <u-form-item labelWidth="auto" label="店主姓名" required prop="shopkeeperName" borderBottom>
<u--input :readonly="readonly" v-model="formData1.shopkeeperName" placeholder="请输入店主姓名"></u--input> <u--input :readonly="readonly" v-model="formData1.shopkeeperName" placeholder="请输入店主姓名"></u--input>
@ -344,13 +343,16 @@
<view class="" style="height: 20rpx;"> <view class="" style="height: 20rpx;">
</view> </view>
<u-button type="primary" text="提交" @click="confirm" color="#0122C7"></u-button> <u-button v-if="!readonly" type="primary" text="提交" @click="confirm" color="#0122C7"></u-button>
</u--form> </u--form>
</view> </view>
</view> </view>
<view class="" v-else>
<u-loading-page></u-loading-page>
</view>
</template> </template>
<script> <script>
@ -371,6 +373,7 @@
}, },
data() { data() {
return { return {
flag: false,
page: 1, page: 1,
taskId: "", taskId: "",
readonly: false, readonly: false,
@ -454,38 +457,31 @@
} }
}, },
onLoad(option) { onLoad(option) {
this.taskId = option.task_id
if (option.type == 'supply') this.page = 0 if (option.type == 'supply') this.page = 0
if (option.index) { if (option.index) {
townMasterTask3List({ townMasterTask3List({
id: option.task_id id: option.task_id
}).then(res => { }).then(res => {
this.formData = res.data.template_info.extend.purchase_sales_info[option[index]].planting[0] this.readonly = true
this.formData1 = res.data.template_info.extend.purchase_sales_info[option[index]].supply[0] this.flag = true
console.log(res.data.template_info.extend.purchase_sales_info[0].supply[0]) if (option.type == 'supply') {
this.formData1 = res.data.template_info.extend.purchase_sales_info[option.index]?.supply[0]
} else {
this.formData = res.data.template_info.extend.purchase_sales_info[option.index]?.planting[
0]
}
}) })
} }
// } // }
this.flag = true
this.taskId = option.task_id
}, },
created() { created() {
this.initRules(); this.initRules();
// if (this.$props.readonly && this.$props.datas) {
// this.formData = this.$props.datas;
// let keys = Object.keys(this.formData);
// keys.forEach(item => {
// if (!isNaN(this.formData[item]) && this.formData[item] != '' && this.formData[item] != null &&
// this
// .formData[item] != undefined) {
// parseFloat(this.formData[item]) != 'NaN' ? this.formData[item] = parseFloat(this.formData[
// item]) : null;
// }
// })
// }
}, },
computed: { computed: {
@ -506,6 +502,7 @@
return !white.includes(item); return !white.includes(item);
}) })
arr.forEach(key => { arr.forEach(key => {
this.rules[key] = { this.rules[key] = {
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
this.$refs.breedingForm.clearValidate(rule.field); this.$refs.breedingForm.clearValidate(rule.field);
@ -513,6 +510,25 @@
}, },
trigger: ['change', 'blur'] trigger: ['change', 'blur']
} }
if (key == 'phone') {
console.log("phone")
this.rules[key] = [{
required: true,
message: '请输入手机号',
trigger: ['change', 'blur'],
},
{
validator: (rule, value, callback) => {
return uni.$u.test.mobile(value);
},
message: '手机号码不正确',
trigger: ['blur'],
}
]
}
}) })
arr1.forEach(key => { arr1.forEach(key => {
this.rules1[key] = { this.rules1[key] = {
@ -522,6 +538,25 @@
}, },
trigger: ['change', 'blur'] trigger: ['change', 'blur']
} }
if (key == 'shopkeeperPhone') {
this.rules1[key] = [{
required: true,
message: '请输入手机号',
trigger: ['change', 'blur'],
},
{
validator: (rule, value, callback) => {
return uni.$u.test.mobile(value);
},
message: '手机号码不正确',
trigger: ['blur'],
}
]
}
}) })
}, },
// //
@ -542,20 +577,36 @@
this.formData[data.value] = e.detail.value; this.formData[data.value] = e.detail.value;
}, },
async commit() { async commit() {
await townMasterTask3Commit({ if (this.page) {
id: Number(this.taskId), await townMasterTask3Commit({
purchase_sales_info: { id: Number(this.taskId),
planting: [{ purchase_sales_info: {
...this.formData planting: [{
}], ...this.formData
supply: [{ }],
...this.formData1
}] }
} })
}) setTimeout(() => {
setTimeout(() => { uni.navigateBack()
uni.navigateBack() }, 1000)
}, 1000)
} else {
await townMasterTask3Commit({
id: Number(this.taskId),
purchase_sales_info: {
supply: [{
...this.formData1
}],
}
})
setTimeout(() => {
uni.navigateBack()
}, 1000)
}
}, },
async nextFormFn() { async nextFormFn() {