import wPicker from '@/components/w-picker/w-picker.vue';

export default {
	data() {
	return {
		cross: '',
		ruleForm: {
			dancifenlei: '',
		},
		// 登陆用户信息
		user: {},
		ro: {
			dancifenlei: false,
		},
	}
	},
	components: {
		wPicker
	},
	computed: {
		baseUrl() {
			return this.$base.url;
		},
		
		
	},
	async onLoad(options) {
		let table = uni.getStorageSync('nowTable');
		// 获取用户信息
		let res = await this.$api.session(table);
		this.user = res.data;
		
		// ss读取
		
		
		// 如果有登陆,获取登陆后保存的userid
		this.ruleForm.userid = uni.getStorageSync('userid');
		if (options.refid) {
			// 如果上一级页面传递了refid,获取改refid数据信息
			this.ruleForm.refid = options.refid;
			this.ruleForm.nickname = uni.getStorageSync('nickname');
		}
		// 如果是更新操作
		if (options.id) {
			this.ruleForm.id = options.id;
			// 获取信息
			res = await this.$api.info('dancifenlei', this.ruleForm.id);
			this.ruleForm = res.data;
		}
		// 跨表
		this.cross = options.cross;
		if(options.cross){
			var obj = uni.getStorageSync('crossObj');
			for (var o in obj){
				if(o=='dancifenlei'){
				this.ruleForm.dancifenlei = obj[o];
				this.ro.dancifenlei = true;
				continue;
				}
			}
		}
		this.styleChange()
	},
	methods: {
		styleChange() {
			this.$nextTick(()=>{ 
				// document.querySelectorAll('.app-update-pv .cu-form-group .uni-input-input').forEach(el=>{ 
				//   el.style.backgroundColor = this.addUpdateForm.input.content.backgroundColor 
				// }) 
			}) 
		},
		
		// 多级联动参数
		
		
		getUUID () {
			return new Date().getTime();
		},
		async onSubmitTap() {
		
		
		//跨表计算判断
			//更新跨表属性
		       var crossuserid;
		       var crossrefid;
		       var crossoptnum;
			if(this.cross){
				var statusColumnName = uni.getStorageSync('statusColumnName');
				var statusColumnValue = uni.getStorageSync('statusColumnValue');
				if(statusColumnName!='') {
					var obj = uni.getStorageSync('crossObj');
					if(!statusColumnName.startsWith('[')) {
						for (var o in obj){
							if(o==statusColumnName){
								obj[o] = statusColumnValue;
							}
							
						}
						var table = uni.getStorageSync('crossTable');
						await this.$api.update(`${table}`, obj);
					} else {
					       crossuserid=Number(uni.getStorageSync('userid'));
					       crossrefid=obj['id'];
					       crossoptnum=uni.getStorageSync('statusColumnName');
					       crossoptnum=crossoptnum.replace(/[/,'').replace(/]/,'');
					}
				}
			}
			if(crossrefid && crossuserid) {
				this.ruleForm.crossuserid=crossuserid;
				this.ruleForm.crossrefid=crossrefid;
				let params = {
					page: 1,
					limit:10,
					crossuserid:crossuserid,
					crossrefid:crossrefid,
				}
				let res = await this.$api.list('dancifenlei', params);
				if (res.data.total >= crossoptnum) {
					this.$utils.msg(uni.getStorageSync('tips'));
					return false;
				} else {
					//跨表计算
					if(this.ruleForm.id){
						await this.$api.update('dancifenlei', this.ruleForm);
					}else{
						await this.$api.add('dancifenlei', this.ruleForm);
					}
					this.$utils.msgBack('提交成功');
				}
			} else {
				//跨表计算
				if(this.ruleForm.id){
						await this.$api.update('dancifenlei', this.ruleForm);
					}else{
						await this.$api.add('dancifenlei', this.ruleForm);
					}
				this.$utils.msgBack('提交成功');
			}
		},
		optionsChange(e) {
			this.index = e.target.value
		},
		bindDateChange(e) {
			this.date = e.target.value
		},
		getDate(type) {
			const date = new Date();
			let year = date.getFullYear();
			let month = date.getMonth() + 1;
			let day = date.getDate();
			if (type === 'start') {
				year = year - 60;
			} else if (type === 'end') {
				year = year + 2;
			}
			month = month > 9 ? month : '0' + month;;
			day = day > 9 ? day : '0' + day;
			return `${year}-${month}-${day}`;
		},
		toggleTab(str) {
			this.$refs[str].show();
		}
	}
}

为什么单词本分类需要跨表运算?

无法确定具体原因,需要更多上下文和业务逻辑信息才能确定为什么单词本分类需要跨表运算。

单词本分类管理 - 添加/编辑

原文地址: https://www.cveoy.top/t/topic/gM4C 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录