119 lines
3.6 KiB
Vue
119 lines
3.6 KiB
Vue
<!-- 供应商 -->
|
|
<template>
|
|
<view class="container">
|
|
<scroll-view scroll-y style="padding-bottom: 180rpx;background-color: #fff;">
|
|
<uni-forms v-model="form" label-width="150rpx" ref="customForm" :rules="customRules">
|
|
<ticketd :ticket_="form.ticket_"></ticketd>
|
|
<uni-forms-item label="供应商名称" required>
|
|
<uni-easyinput v-model="form.name" placeholder="请输入供应商名称" :disabled="mode=='show'"/>
|
|
</uni-forms-item>
|
|
<uni-forms-item label="物料分类" required>
|
|
<uni-easyinput v-model="form.material_type" placeholder="请输入物料分类" :disabled="mode=='show'"/>
|
|
</uni-forms-item>
|
|
<uni-forms-item label="物料名称" required>
|
|
<uni-easyinput v-model="form.material_name" placeholder="请输入物料名称" :disabled="mode=='show'"/>
|
|
</uni-forms-item>
|
|
<uni-forms-item label="调查表" required>
|
|
<uni-file-picker limit="1" file-mediatype="all" v-model="form.survery_form" @success="(e)=>{uploadSuccess('1', e)}"></uni-file-picker>
|
|
</uni-forms-item>
|
|
<uni-forms-item label="营业执照" required>
|
|
<uni-file-picker limit="1" file-mediatype="all" v-model="form.business_license" @success="uploadSuccess('2')"></uni-file-picker>
|
|
</uni-forms-item>
|
|
<uni-forms-item label="质量证书" required>
|
|
<uni-file-picker limit="1" file-mediatype="all" v-model="form.quality_certificate" @success="uploadSuccess('3')"></uni-file-picker>
|
|
</uni-forms-item>
|
|
</uni-forms>
|
|
</scroll-view>
|
|
<view class="footer_fixed">
|
|
<button v-if="mode=='edit'" size="mini" @click="handleDel" :loading="saveLoading" :disabled="saveLoading" type="warn">
|
|
删除
|
|
</button>
|
|
<ticketd_b v-if="form.ticket_" :t_id="form.id" :ticket_="form.ticket_"
|
|
:ticket_data="ticket_data" @success="()=>{uni.navigateBack()}" ref="ticketd_b"></ticketd_b>
|
|
<button v-else size="mini" @click="handleSave" :loading="saveLoading" :disabled="saveLoading" type="primary">
|
|
提交审批
|
|
</button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import ticketd_b from "../wf/ticketd_b.vue"
|
|
import ticketd from "../wf/ticketd.vue"
|
|
import {actStateEnum} from "@/utils/enum.js"
|
|
export default {
|
|
components: { ticketd_b, ticketd },
|
|
data(){
|
|
return{
|
|
saveLoading: false,
|
|
mode:"add",
|
|
t_id: null,
|
|
form:{
|
|
name:"",
|
|
material_type:"",
|
|
material_name:"",
|
|
},
|
|
userInfo:{},
|
|
type:0,
|
|
header:"",
|
|
customRules: {
|
|
filename: {
|
|
rules: [{
|
|
required: true,
|
|
errorMessage: '姓名不能为空'
|
|
}]
|
|
},
|
|
age: {
|
|
rules: [{
|
|
required: true,
|
|
errorMessage: '年龄不能为空'
|
|
}]
|
|
},
|
|
},
|
|
}
|
|
},
|
|
async onLoad(options) {
|
|
let that = this;
|
|
that.mode = options.mode?options.mode:'show';
|
|
that.t_id = options.t_id?options.t_id:null;
|
|
if(that.mode != "add"){
|
|
if(that.t_id) {
|
|
that.form = await that.$api.supplierauditItem(that.t_id);
|
|
if(that.form.ticket_.state_.type == 1 && that.form.create_by == uni.getStorageSync("userInfo").id ) {
|
|
that.mode = "edit";
|
|
}else{
|
|
that.mode = "show";
|
|
}
|
|
}
|
|
}
|
|
},
|
|
methods:{
|
|
uploadSuccess(type, e){
|
|
console.log('type', type, e);
|
|
console.log('form.material_type',this.form.material_type)
|
|
},
|
|
async handleSave(id){
|
|
let that = this;
|
|
that.$refs.customForm.validate().then(res => {
|
|
|
|
}).catch(err => {
|
|
console.log('err', err);
|
|
})
|
|
let res = await that.$api.supplierauditCreate(that.form)
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.uni-data-checklist .checklist-group .checklist-box{
|
|
margin: 10px 0!important;
|
|
}
|
|
.flex_file_picker>.uni-file-picker__files{
|
|
flex-direction: row;
|
|
}
|
|
.flex_file_picker{
|
|
width: 90px;
|
|
flex: none;
|
|
}
|
|
</style> |