123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- <template>
- <view>
- <!--标题和返回-->
- <cu-custom :bgColor="NavBarColor" isBack :backRouterName="backRouteName">
- <block slot="backText">返回</block>
- <block slot="content">采购明细</block>
- </cu-custom>
- <!--表单区域-->
- <view>
- <form>
- <view class="cu-form-group">
- <view class="flex align-center">
- <view class="title"><text space="ensp">物料编号:</text></view>
- <input placeholder="请输入物料编号" v-model="model.materialNo"/>
- </view>
- </view>
- <view class="cu-form-group">
- <view class="flex align-center">
- <view class="title"><text space="ensp">物料名称:</text></view>
- <input placeholder="请输入物料名称" v-model="model.materialName"/>
- </view>
- </view>
- <view class="cu-form-group">
- <view class="flex align-center">
- <view class="title"><text space="ensp">单位:</text></view>
- <input placeholder="请输入单位" v-model="model.unit"/>
- </view>
- </view>
- <view class="cu-form-group">
- <view class="flex align-center">
- <view class="title"><text space="ensp">品牌:</text></view>
- <input placeholder="请输入品牌" v-model="model.brand"/>
- </view>
- </view>
- <view class="cu-form-group">
- <view class="flex align-center">
- <view class="title"><text space="ensp">规格型号:</text></view>
- <input placeholder="请输入规格型号" v-model="model.specification"/>
- </view>
- </view>
- <view class="cu-form-group">
- <view class="flex align-center">
- <view class="title"><text space="ensp">供应商:</text></view>
- <input placeholder="请输入供应商" v-model="model.supplier"/>
- </view>
- </view>
- <my-date label="申请时间:" v-model="model.applicationTime" placeholder="请输入申请时间"></my-date>
- <my-date label="期望供货时间:" fields="day" v-model="model.expectedDeliveryTime" placeholder="请输入期望供货时间"></my-date>
- <view class="cu-form-group">
- <view class="flex align-center">
- <view class="title"><text space="ensp">申请人:</text></view>
- <input placeholder="请输入申请人" v-model="model.applicant"/>
- </view>
- </view>
- <view class="cu-form-group">
- <view class="flex align-center">
- <view class="title"><text space="ensp">申请数量:</text></view>
- <input type="number" placeholder="请输入申请数量" v-model="model.quantity"/>
- </view>
- </view>
- <view class="cu-form-group">
- <view class="flex align-center">
- <view class="title"><text space="ensp">预计单价:</text></view>
- <input type="number" placeholder="请输入预计单价" v-model="model.expectedPrice"/>
- </view>
- </view>
- <view class="cu-form-group">
- <view class="flex align-center">
- <view class="title"><text space="ensp">实际单价:</text></view>
- <input type="number" placeholder="请输入实际单价" v-model="model.actualPrice"/>
- </view>
- </view>
- <view class="cu-form-group">
- <view class="flex align-center">
- <view class="title"><text space="ensp">到货量:</text></view>
- <input type="number" placeholder="请输入到货量" v-model="model.arrivalQuantity"/>
- </view>
- </view>
- <view class="cu-form-group">
- <view class="flex align-center">
- <view class="title"><text space="ensp">备注:</text></view>
- <input placeholder="请输入备注" v-model="model.remark"/>
- </view>
- </view>
- <view class="cu-form-group">
- <view class="flex align-center">
- <view class="title"><text space="ensp">申请单号:</text></view>
- <input placeholder="请输入申请单号" v-model="model.requestNo"/>
- </view>
- </view>
- <view class="padding">
- <button class="cu-btn block bg-blue margin-tb-sm lg" @click="onSubmit">
- <text v-if="loading" class="cuIcon-loading2 cuIconfont-spin"></text>提交
- </button>
- </view>
- </form>
- </view>
- </view>
- </template>
- <script>
- import myDate from '@/components/my-componets/my-date.vue'
- export default {
- name: "PurchaseDetailsForm",
- components:{ myDate },
- props:{
- formData:{
- type:Object,
- default:()=>{},
- required:false
- }
- },
- data(){
- return {
- CustomBar: this.CustomBar,
- NavBarColor: this.NavBarColor,
- loading:false,
- model: {},
- backRouteName:'index',
- url: {
- queryById: "/purchaseManage/purchaseDetails/queryById",
- add: "/purchaseManage/purchaseDetails/add",
- edit: "/purchaseManage/purchaseDetails/edit",
- },
- }
- },
- created(){
- this.initFormData();
- },
- methods:{
- initFormData(){
- if(this.formData){
- let dataId = this.formData.dataId;
- this.$http.get(this.url.queryById,{params:{id:dataId}}).then((res)=>{
- if(res.data.success){
- console.log("表单数据",res);
- this.model = res.data.result;
- }
- })
- }
- },
- onSubmit() {
- let myForm = {...this.model};
- this.loading = true;
- let url = myForm.id?this.url.edit:this.url.add;
- this.$http.post(url,myForm).then(res=>{
- console.log("res",res)
- this.loading = false
- this.$Router.push({name:this.backRouteName})
- }).catch(()=>{
- this.loading = false
- });
- }
- }
- }
- </script>
|