| | |
| | | ref="formLabelAlign" |
| | | > |
| | | <el-form-item label="农产品名称" prop="productName"> |
| | | <el-input v-model="formLabelAlign.productName"></el-input> |
| | | <el-input maxlength="40" v-model="formLabelAlign.productName"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="开具日期" prop="createTime"> |
| | | <el-date-picker |
| | |
| | | ></el-date-picker> |
| | | </el-form-item> |
| | | <el-form-item label="重量/数量" prop="weight"> |
| | | <el-input v-model="formLabelAlign.weight"></el-input> |
| | | <el-input maxlength="9" v-model="formLabelAlign.weight"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="联系方式" prop="phone"> |
| | | <el-input v-model="formLabelAlign.phone"></el-input> |
| | | <el-input maxlength="14" v-model="formLabelAlign.phone"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="产地" prop="space"> |
| | | <el-input v-model="formLabelAlign.space"></el-input> |
| | | <el-input maxlength="50" v-model="formLabelAlign.space"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="合格证编号" prop="certificationCode"> |
| | | <el-input v-model="formLabelAlign.certificationCode"></el-input> |
| | | <el-input maxlength="45" v-model="formLabelAlign.certificationCode"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="承诺依据" prop="according"> |
| | | <el-checkbox-group |
| | |
| | | </el-checkbox-group> |
| | | </el-form-item> |
| | | <el-form-item label="是否绑定溯源" prop="bind"> |
| | | <el-switch v-model="isBind" active-text="是" inactive-text="否"> |
| | | <el-switch v-model="isBind" active-text="是" inactive-text="否" @change="OnAutoStart"> |
| | | </el-switch> |
| | | </el-form-item> |
| | | </el-form> |
| | |
| | | <el-button type="primary" @click="next" v-if="isBind">{{ |
| | | tip |
| | | }}</el-button> |
| | | <el-button type="primary" @click="submit" v-if="isBtn">提 交</el-button> |
| | | <el-button type="primary" @click="submits" v-if="!isBtn">提 交</el-button> |
| | | <!-- <el-button type="primary" @click="submit" v-if="isBtn">提 交</el-button> --> |
| | | <el-button type="primary" @click="submit0" v-if="!isBind">提 交</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </template> |
| | |
| | | import { save } from "@/api/traceability/traceability"; |
| | | import { getList } from "@/api/farmplant/recovery"; |
| | | import { getStrainList } from "@/api/farmplant/strain"; |
| | | import { getLandList } from "@/api/land/land"; |
| | | import { getLandList,selectRecoveryLandList } from "@/api/land/land"; |
| | | export default { |
| | | data() { |
| | | return { |
| | |
| | | tip: "下一步", |
| | | isShow: false, |
| | | isBind: false, |
| | | isBtn: true, |
| | | isBtn: 1, |
| | | wtjc: false, |
| | | zwjc: true, |
| | | nbjc: false, |
| | |
| | | radio: "1", |
| | | title: "创建溯源码", |
| | | form: {}, |
| | | farm:{}, |
| | | formLabelAlign: { |
| | | productName: "", |
| | | createTime: "", |
| | |
| | | visible: false, |
| | | rules: { |
| | | productName: [ |
| | | { required: true, message: "请输入产品名称", trigger: "blur" }, |
| | | { required: true, message: "请输入产品名称", trigger: ["blur","change"] }, |
| | | ], |
| | | createTime: [ |
| | | { |
| | |
| | | weight: [ |
| | | { |
| | | required: true, |
| | | message: "请输入联系重置/数量", |
| | | message: "请输入数量", |
| | | trigger: "change", |
| | | }, |
| | | ], |
| | |
| | | trigger: "change", |
| | | }, |
| | | ], |
| | | space: [{ required: true, message: "请输入产地", trigger: "change" }], |
| | | space: [{ required: true, message: "请输入产地", trigger: ["blur","change"], }], |
| | | certificationCode: [ |
| | | { required: true, message: "请输入合格证编号", trigger: "blur" }, |
| | | { required: true, message: "请输入合格证编号", trigger:["blur","change"], }, |
| | | ], |
| | | }, |
| | | page: { |
| | |
| | | column: [ |
| | | { |
| | | label: "采收品种", |
| | | prop: "strainName", |
| | | }, |
| | | { |
| | | label: "采收品种", |
| | | prop: "strainId", |
| | | search: true, |
| | | searchSpan: 4, |
| | | span: 12, |
| | | type: "tree", |
| | | hide:true, |
| | | dicData: [], |
| | | props: { |
| | | label: "strainName", |
| | |
| | | { |
| | | required: true, |
| | | message: "请输入采收品种", |
| | | trigger: "blur", |
| | | trigger: ["blur","change"], |
| | | }, |
| | | ], |
| | | disabled: true, |
| | |
| | | ], |
| | | }, |
| | | { |
| | | label:"操作人", |
| | | prop:"realName" |
| | | }, |
| | | { |
| | | label: "操作人", |
| | | prop: "operator", |
| | | type: "tree", |
| | | dicData: [], |
| | | hide:true, |
| | | props: { |
| | | label: "realName", |
| | | value: "id", |
| | |
| | | computed: { |
| | | ...mapState({ |
| | | userInfo: (state) => state.user.userInfo, |
| | | $farmId: state => state.user.$farmId, |
| | | }), |
| | | }, |
| | | methods: { |
| | |
| | | cnChange(data) { |
| | | this.zwcn = data; |
| | | }, |
| | | //创建溯源码 |
| | | submit() { |
| | | var that = this; |
| | | submit0(){ |
| | | if (this.isBind) { |
| | | this.formLabelAlign["bind"] = "0"; |
| | | } else { |
| | | this.formLabelAlign["bind"] = "1"; |
| | | } |
| | | |
| | | if(this.isBtn==1){ |
| | | this.submit(); |
| | | } |
| | | if(this.isBtn==3){ |
| | | this.submits(); |
| | | } |
| | | }, |
| | | //创建溯源码 |
| | | submit() { |
| | | var that = this; |
| | | that.formLabelAlign['tenantId'] = this.userInfo.tenant_id; |
| | | that.formLabelAlign['deptId'] = this.$farmId; |
| | | this.$refs["formLabelAlign"].validate((valid) => { |
| | | if (valid) { |
| | | that.formLabelAlign.createTime = |
| | |
| | | save(that.formLabelAlign).then( |
| | | () => { |
| | | that.$emit("refreshOnLoad"); |
| | | that.$refs.formLabelAlign.resetFields(); |
| | | that.close(); |
| | | that.visible = false; |
| | | that.isBtn = 1; |
| | | that.$refs.formLabelAlign.resetFields(); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | |
| | | } |
| | | }); |
| | | }, |
| | | //是否绑定溯源码绑定事件 |
| | | OnAutoStart(e){ |
| | | if(e){ |
| | | this.isBtn = 2; |
| | | }else{ |
| | | this.isBtn = 1; |
| | | } |
| | | }, |
| | | //创建溯源码 |
| | | submits() { |
| | | var that = this; |
| | |
| | | return; |
| | | } |
| | | if (this.selectionList.length ==1) { |
| | | that.formLabelAlign['code'] = this.selectionList[0].code; |
| | | that.formLabelAlign['recoveryId'] = this.selectionList[0].id; |
| | | that.formLabelAlign['bind'] = '0'; |
| | | } |
| | | that.formLabelAlign['tenantId'] = this.userInfo.tenant_id; |
| | | that.formLabelAlign['deptId'] = this.$farmId; |
| | | //新增 |
| | | save(that.formLabelAlign).then( |
| | | () => { |
| | | that.$emit("refreshOnLoad"); |
| | | that.visible = false; |
| | | that.isBtn = 1; |
| | | that.close(); |
| | | this.$message({ |
| | | type: "success", |
| | |
| | | //清除数据,状态回归 |
| | | this.isShow = false; |
| | | this.isBind = false; |
| | | this.isBtn = true; |
| | | this.isBtn = 1; |
| | | this.wtjc = false; |
| | | this.zwjc = true; |
| | | this.nbjc = false; |
| | |
| | | //修改按钮状态 |
| | | this.isShow = true; |
| | | this.isBind = false; |
| | | this.isBtn = false; |
| | | this.isBtn = 3; |
| | | //initFormData |
| | | that.initFormData(); |
| | | } else { |
| | |
| | | //初始化表格数据 |
| | | initFormData(){ |
| | | var that = this; |
| | | // //获取农地数据 |
| | | // getLandList(this.userInfo.user_id).then((res)=>{ |
| | | // if(res.data.code==200){ |
| | | // var landIdcolumn = that.findObject(that.option.column,"landId"); |
| | | // that.landList = res.data.data; |
| | | // landIdcolumn.dicData = res.data.data; |
| | | // } |
| | | // }) |
| | | //获取农地数据 |
| | | getLandList(this.userInfo.user_id).then((res)=>{ |
| | | selectRecoveryLandList(this.$farmId).then((res)=>{ |
| | | if(res.data.code==200){ |
| | | var landIdcolumn = that.findObject(that.option.column,"landId"); |
| | | that.landList = res.data.data; |
| | |
| | | }, |
| | | selectionChange(list) { |
| | | this.selectionList = list; |
| | | console.log(this.selectionList, 123456789); |
| | | }, |
| | | selectionClear() { |
| | | this.selectionList = []; |
| | |
| | | }, |
| | | onLoad(page, params = {}) { |
| | | this.loading = true; |
| | | params["farmId"] = this.$farmId |
| | | getList( |
| | | page.currentPage, |
| | | page.pageSize, |