20261008
This commit is contained in:
@@ -0,0 +1,334 @@
|
||||
<template>
|
||||
<el-card shadow="never">
|
||||
<p class="text-main font-bold mb-20">加工商状态: {{
|
||||
(isNaN(factoryStatus) || factoryStatus === -1) ? '未提交审核' : (factoryStatus === 0 ? '审核中' : (factoryStatus === 1 ? '审核通过' : `审核不通过:${refuseReason}`))
|
||||
}}</p>
|
||||
<p class="text-main font-bold mb-20" v-if="factoryStatus === 0">
|
||||
温馨提示:审核中不能修改内容,如有数据变更审核通过后再次修改提交。
|
||||
</p>
|
||||
<el-form ref="form" :model="form" label-width="140px">
|
||||
<el-divider>
|
||||
<span class="text-50 text-main font-bold">工厂信息</span>
|
||||
</el-divider>
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="成立年限" required>
|
||||
<el-input v-model="form.year" placeholder="请输入成立年限" type="number"
|
||||
:readonly="factoryStatus === 0">
|
||||
<template #append>年</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="年产值" required>
|
||||
<el-input v-model="form.yearsIncome" placeholder="请输入年产值" type="number"
|
||||
:readonly="factoryStatus === 0">
|
||||
<template #append>万元</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="10" class="mt-20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="员工人数" required>
|
||||
<el-input v-model="form.employeeNum" placeholder="请输入员工人数" type="number"
|
||||
:readonly="factoryStatus === 0">
|
||||
<template #append>人</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="流水线数量" required>
|
||||
<el-input v-model="form.flowNum" placeholder="请输入流水线数量" type="number"
|
||||
:readonly="factoryStatus === 0">
|
||||
<template #append>条</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="10" class="mt-20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="厂房归属" required>
|
||||
<el-input v-model="form.blongTo" placeholder="请输入厂房归属" :readonly="factoryStatus === 0"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="厂房面积" required>
|
||||
<el-input v-model="form.size" placeholder="请输入厂房面积" :readonly="factoryStatus === 0">
|
||||
<template #append>平方米</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="所在地" required>
|
||||
<el-cascader :options="options" :props="{label: 'name', value: 'code'}" v-model="addressRegion"
|
||||
clearable :disabled="factoryStatus === 0"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="主营类别" required>
|
||||
<el-select multiple v-model="form.mainSpotCategory" style="width: 100%">
|
||||
<el-option v-for="(item, index) in goodsCate" :key="index" :value="item.name">{{ item.name }}</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="主营工艺和业务范围">
|
||||
<el-input v-model="form.mainProcess" placeholder="请输入主营工艺和业务范围"
|
||||
:readonly="factoryStatus === 0"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="服务信息">
|
||||
<el-input v-model="form.serviceInfo" placeholder="请输入服务信息" type="textarea"
|
||||
:readonly="factoryStatus === 0"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="视频">
|
||||
<vk-data-upload v-model="form.video" list-type="text"
|
||||
accept="video/*">
|
||||
</vk-data-upload>
|
||||
</el-form-item>
|
||||
<el-divider>
|
||||
<span class="text-50 text-main font-bold">设备信息</span>
|
||||
</el-divider>
|
||||
<el-row :gutter="10" class="p-20 bg-gray-light">
|
||||
<el-col :span="3">
|
||||
<p class="text-center">设备名称</p>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<p class="text-center">设备数量({{ deviceNum }}台)</p>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<p class="text-center">设备来源</p>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<p class="text-center">设备类型</p>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<p class="text-center">品牌</p>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<p class="text-center">型号</p>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<p class="text-center">投产年限</p>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<p class="text-center">特点描述</p>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="10" class="p-20 bg-gray-light pos-r" v-for="(item, index) in form.deviceList" :key="index">
|
||||
<el-col :span="3">
|
||||
<el-input v-model="form.deviceList[index].name" placeholder="设备名称"
|
||||
:readonly="factoryStatus === 0"/>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<el-input v-model="form.deviceList[index].num" placeholder="设备数量" type="number"
|
||||
:readonly="factoryStatus === 0"/>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<el-select v-model="form.deviceList[index].source" placeholder="请选择设备来源"
|
||||
:disabled="factoryStatus === 0">
|
||||
<el-option v-for="item in deviceSource" :key="item" :label="item" :value="item"/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<el-select v-model="form.deviceList[index].type" placeholder="请选择设备类型"
|
||||
:disabled="factoryStatus === 0">
|
||||
<el-option v-for="item in deviceType" :key="item" :label="item" :value="item"/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<el-input v-model="form.deviceList[index].brand" placeholder="品牌"
|
||||
:readonly="factoryStatus === 0"/>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<el-input v-model="form.deviceList[index].model" placeholder="型号"
|
||||
:readonly="factoryStatus === 0"/>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<el-input v-model="form.deviceList[index].year" placeholder="投产年限" type="number"
|
||||
:readonly="factoryStatus === 0"/>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<el-input v-model="form.deviceList[index].desc" placeholder="特点描述"
|
||||
:readonly="factoryStatus === 0"/>
|
||||
</el-col>
|
||||
<i class="el-icon-remove pointer text-main text-40 pos-a" style="right: -10px; top: 20px"
|
||||
@click="remove(index)" v-if="factoryStatus !== 0"/>
|
||||
</el-row>
|
||||
<div class="mt-20 text-center">
|
||||
<el-button type="text" @click.native="addDevice" v-if="factoryStatus !== 0">添加设备</el-button>
|
||||
</div>
|
||||
<el-divider>
|
||||
<span class="text-50 text-main font-bold">工厂实景</span>
|
||||
</el-divider>
|
||||
<vk-data-upload v-model="form.album" :limit="userLevel.factoryPicNum"
|
||||
:disabled="factoryStatus === 0"></vk-data-upload>
|
||||
<div class="mt-20 text-center">
|
||||
<el-button type="primary" @click.native="submit" v-if="factoryStatus !== 0">提交</el-button>
|
||||
</div>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import provinces from "@/uni_modules/vk-uview-ui/libs/address/provinces.json";
|
||||
import citys from "@/uni_modules/vk-uview-ui/libs/address/citys.json";
|
||||
|
||||
export default {
|
||||
name: "factory",
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
year: null,
|
||||
yearsIncome: null,
|
||||
employeeNum: null,
|
||||
flowNum: null,
|
||||
blongTo: null,
|
||||
size: null,
|
||||
addressRegion: {
|
||||
province: null,
|
||||
city: null,
|
||||
},
|
||||
mainProcess: null,
|
||||
serviceInfo: null,
|
||||
video: '',
|
||||
deviceList: [],
|
||||
album: [],
|
||||
mainSpotCategory: [],
|
||||
},
|
||||
options: [],
|
||||
addressRegion: [],
|
||||
deviceSource: ['国产', '进口'],
|
||||
deviceType: ['生产设备', '维护设备'],
|
||||
userLevel: {
|
||||
factoryPicNum: 0
|
||||
},
|
||||
factoryStatus: parseInt(vk.getVuex('$user.userInfo.factoryStatus')),
|
||||
refuseReason: '',
|
||||
goodsCate: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
addDevice() {
|
||||
this.form.deviceList.push({
|
||||
name: null,
|
||||
num: null,
|
||||
source: null,
|
||||
type: null,
|
||||
brand: null,
|
||||
model: null,
|
||||
year: null,
|
||||
desc: null
|
||||
})
|
||||
},
|
||||
getGoodsCate() {
|
||||
vk.callFunction({
|
||||
url: 'client/process/category/pub/getList',
|
||||
success: (res) => {
|
||||
this.goodsCate = res.data
|
||||
}
|
||||
});
|
||||
},
|
||||
remove(index) {
|
||||
this.form.deviceList.splice(index, 1)
|
||||
},
|
||||
async getUserLevelInfo() {
|
||||
const res = await vk.callFunction({
|
||||
url: "client/userLevel/kh/getInfoByUser",
|
||||
})
|
||||
if (res) {
|
||||
if (!res.data) {
|
||||
this.$message({
|
||||
type: 'error',
|
||||
message: '请先完成认证'
|
||||
})
|
||||
setTimeout(() => {
|
||||
this.$emit('done', 'fadada')
|
||||
}, 1000)
|
||||
return
|
||||
}
|
||||
this.userLevel.factoryPicNum = res.factoryPicNum
|
||||
}
|
||||
},
|
||||
async submit() {
|
||||
if (!this.form.year) return this.$message.error('请输入投产年限')
|
||||
if (!this.form.yearsIncome) return this.$message.error('请输入年收入')
|
||||
if (!this.form.employeeNum) return this.$message.error('请选输入员工人数')
|
||||
if (!this.form.flowNum) return this.$message.error('请输入流水线数量')
|
||||
if (!this.form.blongTo) return this.$message.error('请输入厂房归属')
|
||||
if (!this.form.size) return this.$message.error('请输入厂房面积')
|
||||
if (this.addressRegion.length === 0) return this.$message.error('请选择所在地')
|
||||
if (this.form.deviceList.length === 0) return this.$message.error('请添加设备信息')
|
||||
if (this.form.mainSpotCategory.length === 0) return this.$message.error('请选择主营类别')
|
||||
// if (this.form.album.length === 0) return this.$message.error('请上传工厂实景图')
|
||||
const province = provinces.find(item => item.code === this.addressRegion[0])
|
||||
const city = province.children.find(item => item.code === this.addressRegion[1])
|
||||
const addressRegion = {
|
||||
province: {
|
||||
code: province.code,
|
||||
name: province.name,
|
||||
},
|
||||
city: {
|
||||
code: city.code,
|
||||
name: city.name,
|
||||
}
|
||||
}
|
||||
await vk.callFunction({
|
||||
url: "client/factory/kh/addUpdate",
|
||||
data: {
|
||||
year: this.form.year,
|
||||
yearsIncome: this.form.yearsIncome,
|
||||
employeeNum: this.form.employeeNum,
|
||||
flowNum: this.form.flowNum,
|
||||
blongTo: this.form.blongTo,
|
||||
size: this.form.size,
|
||||
addressRegion,
|
||||
mainProcess: this.form.mainProcess,
|
||||
serviceInfo: this.form.serviceInfo,
|
||||
deviceList: this.form.deviceList,
|
||||
album: this.form.album,
|
||||
video: this.form.video,
|
||||
mainSpotCategory: this.form.mainSpotCategory,
|
||||
}
|
||||
})
|
||||
this.$message.success('提交成功')
|
||||
this.factoryStatus = 0
|
||||
},
|
||||
async getInfo() {
|
||||
const res = await vk.callFunction({
|
||||
url: "client/factory/kh/getInfo",
|
||||
})
|
||||
if (res) {
|
||||
for (let key in this.form) this.form[key] = res[key]
|
||||
this.addressRegion = [res.addressRegion.province.code, res.addressRegion.city.code]
|
||||
if (res.status === 2) this.refuseReason = res.refuseReason
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.options = provinces.map(item => {
|
||||
item.children = [];
|
||||
return item
|
||||
})
|
||||
this.options.forEach((province, index) => {
|
||||
citys[index].forEach(city => {
|
||||
this.options[index].children.push(city)
|
||||
})
|
||||
})
|
||||
this.getGoodsCate()
|
||||
this.getUserLevelInfo()
|
||||
vk.userCenter.getCurrentUserInfo({
|
||||
success: (data) => {
|
||||
const factoryStatus = parseInt(data.userInfo.factoryStatus)
|
||||
this.factoryStatus = (isNaN(factoryStatus) || factoryStatus === -1) ? -1 : factoryStatus
|
||||
if (this.factoryStatus > -1) this.getInfo()
|
||||
}
|
||||
})
|
||||
},
|
||||
computed: {
|
||||
deviceNum() {
|
||||
let num = 0
|
||||
this.form.deviceList.forEach(item => {
|
||||
if (item.num && !isNaN(parseInt(item.num))) num += parseInt(item.num)
|
||||
})
|
||||
return num
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user