From a76c5c86ac9af71da45bf78c825a2c7aa843b4c8 Mon Sep 17 00:00:00 2001 From: jiangping <jp@doumee.com> Date: 星期五, 26 一月 2024 15:35:54 +0800 Subject: [PATCH] Revert "Mr.Shi" --- platform/src/components/business/OperaCategoryWindow.vue | 251 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 251 insertions(+), 0 deletions(-) diff --git a/platform/src/components/business/OperaCategoryWindow.vue b/platform/src/components/business/OperaCategoryWindow.vue new file mode 100644 index 0000000..e70b3a3 --- /dev/null +++ b/platform/src/components/business/OperaCategoryWindow.vue @@ -0,0 +1,251 @@ +<template> + <GlobalWindow :title="title" :visible.sync="visible" :confirm-working="isWorking" @confirm="confirm" width="900px"> + <el-form :model="form" ref="form" label-width="120px" label-suffix="锛�" :rules="rules" v-loading="isUploading"> + <el-form-item label="绫诲埆鍚嶇О" prop="name"> + <el-input v-model="form.name" placeholder="璇疯緭鍏ョ被鍒悕绉帮紝涓嶈秴杩�6涓瓧" maxlength="6" v-trim /> + </el-form-item> + <el-form-item label="鍥炬爣" prop="imgurl"> + <UploadAvatarImage :file="{ 'imgurlfull': form.imgfullurl, 'imgurl': form.imgurl }" + :uploadData="{ folder: 'category_img' }" @uploadSuccess="uploadReverseSuccess" @uploadEnd="isUploading = false" + @uploadBegin="isUploading = true" /> + 鍙兘涓婁紶鍥剧墖鏍煎紡锛宲ng鏍煎紡锛屽缓璁昂瀵�120*120px + </el-form-item> + <el-form-item label="鍔犱环绯绘暟" prop="priceRate"> + <!-- <el-input v-model="form.priceRate" placeholder="鍦ㄤ含涓滈噰璐环鍩虹涓婏紝骞冲彴鐨勫姞浠风郴鏁�" v-trim /> --> + <el-input-number v-model="form.priceRate" controls-position="right" :min="0.1" :step="0.1"></el-input-number> + </el-form-item> + <el-form-item label="鎺掑簭鐮�(鍗囧簭)" prop="sortnum"> + <el-input v-model="form.sortnum" type="number" placeholder="璇疯緭鍏ユ帓搴忕爜锛屽崌搴忓睍绀�" v-trim /> + </el-form-item> + + </el-form> + <div class="param-table" > + <div class="title-contant"> + <div class="title">鍙傛暟灞炴�ч厤缃�</div> + <div class="sub-title">閰嶇疆褰撳墠绫诲埆鐨勪骇鍝佸弬鏁板悕</div> + </div> + <el-table :data="form.baseCateParamList" stripe border > + <el-table-column prop="" label="鍙傛暟鍚�" min-width="200px" align="center"> + <template slot-scope="{row}"> + <el-input v-model="row.name" placeholder="璇疯緭鍏ュ弬鏁板悕" v-trim /> + </template> + </el-table-column> + <el-table-column label="鎿嶄綔" width="100" align="center"> + <template slot-scope="{row, $index}"> + <el-button type="text" style="color: red" + @click="form.baseCateParamList.splice($index, 1)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + <el-button style="color: #2E68EC; margin-top: 10px;" @click="addParam" icon="el-icon-plus">鏂板</el-button> + </div> + </GlobalWindow> +</template> + +<script> +import BaseOpera from '@/components/base/BaseOpera' +import GlobalWindow from '@/components/common/GlobalWindow' +import UploadAvatarImage from '@/components/common/UploadAvatarImage.vue' +import { create, updateById } from '@/api/business/category.js' +export default { + name: 'OperaCategoryWindow', + extends: BaseOpera, + components: { GlobalWindow, UploadAvatarImage }, + data() { + return { + action: process.env.VUE_APP_API_PREFIX + '/public/upload', + isUploading: false, + // 琛ㄥ崟鏁版嵁 + form: { + id: null, + name: '', + imgurl: '', + imgfullurl: '', + priceRate: '1.2', + sortnum: '', + + // attrFirst: '', + // attrFirst1: '', + baseCateParamList: [], + // attrSecond: '', + // attrSecond1: '', + // attrSecondList: [], + + // parameter: '', + paramList: [] + + }, + // 楠岃瘉瑙勫垯 + rules: { + name: [ + { required: true, message: '涓嶈兘涓虹┖', trigger: 'blur' } + ] + }, + dialogVisible: false + } + }, + created() { + this.config({ + api: '/business/category', + 'field.id': 'id' + }) + }, + methods: { + open(title, target) { + this.title = title + this.visible = true + // 鏂板缓 + if (target == null) { + this.$nextTick(() => { + this.$refs.form.resetFields() + this.form.imgfullurl = '' + this.form.baseCateParamList = [{name:''}] + this.form.paramList = [{name:''}] + this.form[this.configData['field.id']] = null + }) + return + } + // 缂栬緫 + this.$nextTick(() => { + for (const key in this.form) { + this.form[key] = target[key] + } + this.form.baseCateParamList = this.form.baseCateParamList || [] + }) + }, + addParam () { + this.form.baseCateParamList.push({ name: '' }) + }, + changeInput (type, index) { + if (type === 1) { + if (!this.form.budgetList[index].minamount) return + if (!/^[0-9]*[1-9][0-9]*$/.test(this.form.budgetList[index].minamount)) { + this.$message.warning({ + type: 'warning', + message: '棰勭畻鍙兘杈撳叆姝f暣鏁�' + }) + this.form.budgetList[index].minamount = '' + } + } else { + if (!this.form.budgetList[index].maxamount) return + if (!/^[0-9]*[1-9][0-9]*$/.test(this.form.budgetList[index].maxamount)) { + this.$message.warning({ + type: 'warning', + message: '棰勭畻鍙兘杈撳叆姝f暣鏁�' + }) + this.form.budgetList[index].maxamount = '' + } + } + }, + + confirm() { + this.$refs.form.validate((valid) => { + if (valid) { + this.isWorking = true + if (!this.form.id) { + create(this.form) + .then(() => { + this.visible = false + this.$tip.apiSuccess('鏂板缓鎴愬姛') + this.$emit('success') + }) + .catch(e => { + this.$tip.apiFailed(e) + }) + .finally(() => { + this.isWorking = false + }) + } else { + updateById(this.form) + .then(() => { + this.visible = false + this.$tip.apiSuccess('缂栬緫鎴愬姛') + this.$emit('success') + }) + .catch(e => { + this.$tip.apiFailed(e) + }) + .finally(() => { + this.isWorking = false + }) + } + } else { + return false; + } + }); + }, + close(index, type) { + if (type === 1) { + this.form.attrFirstList.splice(index, 1) + } else if (type === 2) { + this.form.attrSecondList.splice(index, 1) + } else if (type === 3) { + this.form.paramList.splice(index, 1) + } + }, + confirmVal(type) { + if (type === 1) { + if (!this.form.attrFirst1) return + this.form.attrFirstList.push({ name: this.form.attrFirst1 }) + this.form.attrFirst1 = '' + } else if (type === 2) { + if (!this.form.attrSecond1) return + this.form.attrSecondList.push({ name: this.form.attrSecond1 }) + this.form.attrSecond1 = '' + } else if (type === 3) { + if (!this.form.parameter) return + this.form.paramList.push({ name: this.form.parameter }) + this.form.parameter = '' + } + }, + add() { + this.form.budgetList.push({ minamount: '', maxamount: '' }) + }, + begin() { + this.isUploading = true + }, + end() { + this.isUploading = false + }, + // 涓婁紶鍥剧墖 + uploadReverseSuccess(file) { + this.form.imgurl = file.imgurl; + this.form.imgfullurl = file.imgurlfull; + }, + dele(i) { + if (this.form.budgetList.length === 1) return + this.form.budgetList.splice(i, 1) + } + } +} +</script> + +<style lang="scss" scoped> +.param-table { + //width: 70%; + margin-top: 40px; + + .title-contant { + display: flex; + align-items: baseline; + margin-bottom: 10px; + .title { + font-weight: 600; + font-size: 20px; + margin-right: 15px; + } + .sub-title { + font-size: 14px; + } + } +} +::v-deep .el-form-item__content { + .el-input { + width: 300px; + } + .el-input-number { + text-align: left; + width: 300px; + } +} +</style> \ No newline at end of file -- Gitblit v1.9.3