|
|
|
|
@ -5,21 +5,24 @@
|
|
|
|
|
<block v-for="(item,index) in course_forms">
|
|
|
|
|
<u-form-item :label="item.name" :prop="item.field"
|
|
|
|
|
:required="item.rule?item.rule.indexOf('required')!==-1:false">
|
|
|
|
|
<block v-if="item.edit_input==='text'">
|
|
|
|
|
<!-- <block v-if="item.field==='introduce'
|
|
|
|
|
|| item.field==='company_product' || item.field==='company_introduce'">
|
|
|
|
|
<u-input type="textarea" :placeholder="item.help?item.help:'请输入'" v-model="item.value" />
|
|
|
|
|
<block v-if="item.edit_input==='text'">
|
|
|
|
|
<!-- <block v-if="item.field==='introduce'
|
|
|
|
|
|| item.field==='company_product' || item.field==='company_introduce'">
|
|
|
|
|
<u-input type="textarea" :placeholder="item.help?item.help:'请输入'" v-model="item.value" />
|
|
|
|
|
</block> -->
|
|
|
|
|
<u-input :type="item.field==='introduce'||
|
|
|
|
|
item.field==='company_fund'|| item.field==='company_product'||
|
|
|
|
|
<u-input v-if="item.field==='company_name'"
|
|
|
|
|
@click="showCompanySelector = true" type="select" v-model="item.value" border :placeholder="item.help?item.help:'请选择公司名称'" />
|
|
|
|
|
|
|
|
|
|
<u-input v-else :type="item.field==='introduce'||
|
|
|
|
|
item.field==='company_fund'|| item.field==='company_product'||
|
|
|
|
|
item.field==='company_introduce'?'textarea':'text'" maxlength="9999" :placeholder="item.help?item.help:'请输入'" v-model="item.value" />
|
|
|
|
|
</block>
|
|
|
|
|
<block v-if="item.edit_input==='textarea'">
|
|
|
|
|
<!-- <block v-if="item.field==='introduce'
|
|
|
|
|
|| item.field==='company_product' || item.field==='company_introduce'">
|
|
|
|
|
<u-input type="textarea" :placeholder="item.help?item.help:'请输入'" v-model="item.value" />
|
|
|
|
|
</block> -->
|
|
|
|
|
<u-input :type="'textarea'" maxlength="9999" :placeholder="item.help?item.help:'请输入'" v-model="item.value" />
|
|
|
|
|
</block>
|
|
|
|
|
<block v-if="item.edit_input==='textarea'">
|
|
|
|
|
<!-- <block v-if="item.field==='introduce'
|
|
|
|
|
|| item.field==='company_product' || item.field==='company_introduce'">
|
|
|
|
|
<u-input type="textarea" :placeholder="item.help?item.help:'请输入'" v-model="item.value" />
|
|
|
|
|
</block> -->
|
|
|
|
|
<u-input :type="'textarea'" maxlength="9999" :placeholder="item.help?item.help:'请输入'" v-model="item.value" />
|
|
|
|
|
</block>
|
|
|
|
|
<block v-else-if="item.edit_input==='radio'">
|
|
|
|
|
<u-input :placeholder="item.help?item.help:'请选择'" v-model="item.value" :type="'select'"
|
|
|
|
|
@ -62,7 +65,8 @@
|
|
|
|
|
<u-picker @confirm="dateConfirm" mode="time" v-model="dateShow" :params="dateParams"></u-picker>
|
|
|
|
|
<!-- 日期时间 -->
|
|
|
|
|
<u-picker @confirm="dateTimeConfirm" mode="time" v-model="dateTimeShow" :params="dateTimeParams"></u-picker>
|
|
|
|
|
|
|
|
|
|
<!-- 公司选择器 -->
|
|
|
|
|
<company-selector v-model="showCompanySelector" @confirm="handleCompanyConfirm"></company-selector>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
@ -71,7 +75,11 @@
|
|
|
|
|
import {
|
|
|
|
|
ROOTPATH as baseUrl
|
|
|
|
|
} from "@/common/config.js"
|
|
|
|
|
import CompanySelector from '@/components/company-selector/company-selector.vue'
|
|
|
|
|
export default {
|
|
|
|
|
components: {
|
|
|
|
|
CompanySelector
|
|
|
|
|
},
|
|
|
|
|
props: {
|
|
|
|
|
course_forms: {
|
|
|
|
|
type: Array,
|
|
|
|
|
@ -82,6 +90,7 @@
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
showCompanySelector: false,
|
|
|
|
|
submitForm: {},
|
|
|
|
|
now_fileld: 0, // 当前所操作的 filed index值
|
|
|
|
|
// 单选
|
|
|
|
|
@ -130,6 +139,45 @@
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
// 处理公司选择确认事件
|
|
|
|
|
handleCompanyConfirm(company) {
|
|
|
|
|
console.log('选中的公司:', company);
|
|
|
|
|
this.course_forms.map(item1 => {
|
|
|
|
|
if (item1.field === 'company_name') {
|
|
|
|
|
this.$set(item1,'value',company.enterpriseName||'')
|
|
|
|
|
}
|
|
|
|
|
if (item1.field === 'company_date') {
|
|
|
|
|
this.$set(item1,'value',company.startDate||'')
|
|
|
|
|
}
|
|
|
|
|
if (item1.field === 'company_product') {
|
|
|
|
|
this.$set(item1,'value',company.businessScope||'')
|
|
|
|
|
}
|
|
|
|
|
if (item1.field === 'company_type') {
|
|
|
|
|
const company_type = company.tagList && Array.isArray(company.tagList)?company.tagList.join(','):''
|
|
|
|
|
const _arr = company_type.split(',')
|
|
|
|
|
this.$set(item1,'value',company_type)
|
|
|
|
|
item1.select_item.forEach(item2 => {
|
|
|
|
|
console.log("item2",item2)
|
|
|
|
|
// 检查 item.value 是否存在于数组 b 中
|
|
|
|
|
const exists = _arr.includes(item2.value);
|
|
|
|
|
// 根据检查结果设置 checked 属性
|
|
|
|
|
item2.checked = exists;
|
|
|
|
|
this.$set(item2,'checked',exists)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (item1.field === 'company_area') {
|
|
|
|
|
this.$set(item1,'value',company.country||'')
|
|
|
|
|
}
|
|
|
|
|
if (item1.field === 'company_address') {
|
|
|
|
|
this.$set(item1,'value',company.address||'')
|
|
|
|
|
}
|
|
|
|
|
if (item1.field === 'is_yuanhe') {
|
|
|
|
|
this.$set(item1,'value',company.isYhInvested?'是':'否')
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
console.log("this.course_forms",this.course_forms)
|
|
|
|
|
},
|
|
|
|
|
// 单选
|
|
|
|
|
showSelect(item, index) {
|
|
|
|
|
this.selectList = item.select_item
|
|
|
|
|
@ -170,38 +218,38 @@
|
|
|
|
|
onUploaded(lists, name, item) {
|
|
|
|
|
let arr = []
|
|
|
|
|
let arrid = []
|
|
|
|
|
console.log("lists---", lists, item)
|
|
|
|
|
if(lists.length>0){
|
|
|
|
|
this.course_forms.map(item1 => {
|
|
|
|
|
if (item1.field === item.field) {
|
|
|
|
|
this.$set(item1,'fileListArr',lists)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
this.course_forms.map(item1 => {
|
|
|
|
|
if (item1.field === item.field) {
|
|
|
|
|
this.$set(item1,'fileListArr',[])
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
console.log("lists---", lists, item)
|
|
|
|
|
if(lists.length>0){
|
|
|
|
|
this.course_forms.map(item1 => {
|
|
|
|
|
if (item1.field === item.field) {
|
|
|
|
|
this.$set(item1,'fileListArr',lists)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
this.course_forms.map(item1 => {
|
|
|
|
|
if (item1.field === item.field) {
|
|
|
|
|
this.$set(item1,'fileListArr',[])
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onRemove(index, lists, name, item) {
|
|
|
|
|
let arr = []
|
|
|
|
|
let arrid = []
|
|
|
|
|
if(lists.length>0){
|
|
|
|
|
// item.fileListArr = lists
|
|
|
|
|
|
|
|
|
|
this.course_forms.map(item1 => {
|
|
|
|
|
if (item1.field === item.field) {
|
|
|
|
|
this.$set(item1,'fileListArr',lists)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
this.course_forms.map(item1 => {
|
|
|
|
|
if (item1.field === item.field) {
|
|
|
|
|
this.$set(item1,'fileListArr',[])
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
let arrid = []
|
|
|
|
|
if(lists.length>0){
|
|
|
|
|
// item.fileListArr = lists
|
|
|
|
|
|
|
|
|
|
this.course_forms.map(item1 => {
|
|
|
|
|
if (item1.field === item.field) {
|
|
|
|
|
this.$set(item1,'fileListArr',lists)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
this.course_forms.map(item1 => {
|
|
|
|
|
if (item1.field === item.field) {
|
|
|
|
|
this.$set(item1,'fileListArr',[])
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 提交
|
|
|
|
|
@ -258,29 +306,29 @@
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 文件上传处理
|
|
|
|
|
if(item.edit_input==='files'){
|
|
|
|
|
let valueArr = []
|
|
|
|
|
let fileListArr = []
|
|
|
|
|
console.log("item.fileListArr",item.fileListArr)
|
|
|
|
|
if(item.fileListArr && item.fileListArr.length>0){
|
|
|
|
|
item.fileListArr.map(f=>{
|
|
|
|
|
if(f.response){
|
|
|
|
|
valueArr.push(f.response.url.replace(baseUrl, ''))
|
|
|
|
|
fileListArr.push(f.response)
|
|
|
|
|
}else{
|
|
|
|
|
valueArr.push(f.url.replace(baseUrl, ''))
|
|
|
|
|
fileListArr.push(f)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
item.fileListArr = []
|
|
|
|
|
}
|
|
|
|
|
item.value = valueArr.join(",")
|
|
|
|
|
item.fileList = fileListArr
|
|
|
|
|
console.log("submit---",valueArr,fileListArr)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 文件上传处理
|
|
|
|
|
if(item.edit_input==='files'){
|
|
|
|
|
let valueArr = []
|
|
|
|
|
let fileListArr = []
|
|
|
|
|
console.log("item.fileListArr",item.fileListArr)
|
|
|
|
|
if(item.fileListArr && item.fileListArr.length>0){
|
|
|
|
|
item.fileListArr.map(f=>{
|
|
|
|
|
if(f.response){
|
|
|
|
|
valueArr.push(f.response.url.replace(baseUrl, ''))
|
|
|
|
|
fileListArr.push(f.response)
|
|
|
|
|
}else{
|
|
|
|
|
valueArr.push(f.url.replace(baseUrl, ''))
|
|
|
|
|
fileListArr.push(f)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
item.fileListArr = []
|
|
|
|
|
}
|
|
|
|
|
item.value = valueArr.join(",")
|
|
|
|
|
item.fileList = fileListArr
|
|
|
|
|
console.log("submit---",valueArr,fileListArr)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
if (errorCount > 0) {
|
|
|
|
|
|