|
@@ -0,0 +1,697 @@
|
|
|
|
+<template>
|
|
|
|
+ <div class="plate">
|
|
|
|
+ <div class="top-con" v-if="!dialogFormVisible">
|
|
|
|
+ <div class="top">
|
|
|
|
+ <el-input v-model="boxName" placeholder="請輸入龕位名稱"></el-input>
|
|
|
|
+ <el-input v-model="boxSn" placeholder="請輸入龕位編碼"></el-input>
|
|
|
|
+ <el-select
|
|
|
|
+ style="width: 90px"
|
|
|
|
+ v-model="saleStatus"
|
|
|
|
+ placeholder="請選擇龕位狀態"
|
|
|
|
+ >
|
|
|
|
+ <el-option label="全部" value></el-option>
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="(item, i) in statusSelect"
|
|
|
|
+ :key="i"
|
|
|
|
+ :label="item.name"
|
|
|
|
+ :value="item.id"
|
|
|
|
+ ></el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ <el-button type="primary" @click="getList">查詢</el-button>
|
|
|
|
+ <el-button
|
|
|
|
+ @click="(dialogFormVisible = true), (editTitle = '新增')"
|
|
|
|
+ type="primary"
|
|
|
|
+ class="add"
|
|
|
|
+ >新增</el-button
|
|
|
|
+ >
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="body">
|
|
|
|
+ <template v-if="!dialogFormVisible">
|
|
|
|
+ <el-table height="65vh" :data="tableData" style="width: 100%">
|
|
|
|
+ <el-table-column
|
|
|
|
+ v-for="(item, idx) in data"
|
|
|
|
+ :key="idx"
|
|
|
|
+ :prop="item.prop"
|
|
|
|
+ :label="item.label"
|
|
|
|
+ :width="item.width"
|
|
|
|
+ >
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <img
|
|
|
|
+ style="width: 80px; height: 80px; border-radius: 50%"
|
|
|
|
+ v-if="item.prop === 'ico'"
|
|
|
|
+ :src="scope.row[item.prop]"
|
|
|
|
+ />
|
|
|
|
+ <span v-html="scope.row[item.prop] || '-'" v-else></span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="操作">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <span class="o-span" @click="show(scope.row, 'edit')">修改</span>
|
|
|
|
+ <span class="o-span del" @click="del(scope.row)">刪除</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ <div class="e-page">
|
|
|
|
+ <el-pagination
|
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
|
+ :current-page.sync="pageNum"
|
|
|
|
+ :page-size="size"
|
|
|
|
+ layout="sizes, prev, pager, next"
|
|
|
|
+ :page-sizes="[15, 50, 100, 500]"
|
|
|
|
+ @size-change="handleSizeChange"
|
|
|
|
+ :total="total"
|
|
|
|
+ ></el-pagination>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+
|
|
|
|
+ <template v-else>
|
|
|
|
+ <div class="add-con">
|
|
|
|
+ <el-form :model="form" :rules="rules" ref="niche">
|
|
|
|
+ <el-form-item
|
|
|
|
+ key="boxSn"
|
|
|
|
+ label="龕位編碼"
|
|
|
|
+ prop="boxSn"
|
|
|
|
+ :label-width="formLabelWidth"
|
|
|
|
+ >
|
|
|
|
+ <el-input
|
|
|
|
+ maxlength="20"
|
|
|
|
+ show-word-limit
|
|
|
|
+ v-model="form.boxSn"
|
|
|
|
+ placeholder="請輸入龕位編碼"
|
|
|
|
+ autocomplete="off"
|
|
|
|
+ ></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item
|
|
|
|
+ label="龕位名稱"
|
|
|
|
+ prop="boxName"
|
|
|
|
+ :label-width="formLabelWidth"
|
|
|
|
+ >
|
|
|
|
+ <el-input
|
|
|
|
+ maxlength="10"
|
|
|
|
+ show-word-limit
|
|
|
|
+ v-model="form.boxName"
|
|
|
|
+ placeholder="請輸入龕位名稱"
|
|
|
|
+ autocomplete="off"
|
|
|
|
+ ></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item
|
|
|
|
+ label="方位名稱"
|
|
|
|
+ prop="blockId"
|
|
|
|
+ :label-width="formLabelWidth"
|
|
|
|
+ >
|
|
|
|
+ <el-select v-model="form.blockId" placeholder="請選擇活動區域">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="(item, i) in posiList"
|
|
|
|
+ :key="i"
|
|
|
|
+ :label="item.positionName"
|
|
|
|
+ :value="item.positionId"
|
|
|
|
+ ></el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item
|
|
|
|
+ label="所屬墻面"
|
|
|
|
+ prop="wallId"
|
|
|
|
+ :label-width="formLabelWidth"
|
|
|
|
+ >
|
|
|
|
+ <el-select v-model="form.wallId" placeholder="請選擇活動區域">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="(item, i) in wallList"
|
|
|
|
+ :key="i"
|
|
|
|
+ :label="item.positionName"
|
|
|
|
+ :value="item.positionId"
|
|
|
|
+ ></el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+
|
|
|
|
+ <el-form-item
|
|
|
|
+ label="墻面橫列"
|
|
|
|
+ prop="xposition"
|
|
|
|
+ :label-width="formLabelWidth"
|
|
|
|
+ >
|
|
|
|
+ <el-select v-model="form.xposition" placeholder="請選擇活動區域">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="(item, i) in row_column.row"
|
|
|
|
+ :key="i"
|
|
|
|
+ :label="item"
|
|
|
|
+ :value="item"
|
|
|
|
+ ></el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+
|
|
|
|
+ <el-form-item
|
|
|
|
+ label="墻面縱列"
|
|
|
|
+ prop="yposition"
|
|
|
|
+ :label-width="formLabelWidth"
|
|
|
|
+ >
|
|
|
|
+ <el-select v-model="form.yposition" placeholder="請選擇活動區域">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="(item, i) in row_column.column"
|
|
|
|
+ :key="i"
|
|
|
|
+ :label="item"
|
|
|
|
+ :value="item"
|
|
|
|
+ ></el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ <el-form-item
|
|
|
|
+ label="龕位價格"
|
|
|
|
+ prop="price"
|
|
|
|
+ :label-width="formLabelWidth"
|
|
|
|
+ >
|
|
|
|
+ <el-input
|
|
|
|
+ oninput="value = (value.match(/^\d*(\.?\d{0,2})/g)[0])"
|
|
|
|
+ v-model="form.price"
|
|
|
|
+ placeholder="請輸入龕位價格"
|
|
|
|
+ autocomplete="off"
|
|
|
|
+ >
|
|
|
|
+ <span style="font-size:10px" slot="suffix">
|
|
|
|
+ HK$
|
|
|
|
+ </span>
|
|
|
|
+ </el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item
|
|
|
|
+ label="管理費"
|
|
|
|
+ prop="managementFee"
|
|
|
|
+ :label-width="formLabelWidth"
|
|
|
|
+ >
|
|
|
|
+ <div style="display:flex">
|
|
|
|
+ <el-select v-model="form.feeType" placeholder="請選擇收費類型" style="margin-right:10px">
|
|
|
|
+ <el-option label="按月收費" :value="1"></el-option>
|
|
|
|
+ <el-option label="按年收費" :value="2"></el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ <el-input
|
|
|
|
+ oninput="value = (value.match(/^\d*(\.?\d{0,2})/g)[0])"
|
|
|
|
+ v-model="form.managementFee"
|
|
|
|
+ placeholder="請輸入管理費"
|
|
|
|
+ autocomplete="off"
|
|
|
|
+ >
|
|
|
|
+ <span style="font-size:10px" slot="suffix">
|
|
|
|
+ HK$
|
|
|
|
+ </span>
|
|
|
|
+ </el-input>
|
|
|
|
+ </div>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item
|
|
|
|
+ label="龕位樣式"
|
|
|
|
+ prop="boxStylePic"
|
|
|
|
+ :label-width="formLabelWidth"
|
|
|
|
+ >
|
|
|
|
+ <el-upload
|
|
|
|
+ class="upload-demo"
|
|
|
|
+ :action="uploadUrl"
|
|
|
|
+ :show-file-list="false"
|
|
|
|
+ :on-success="handleStyleSuccess"
|
|
|
|
+ :before-upload="$beforeUpload"
|
|
|
|
+ :on-error="handleError"
|
|
|
|
+ >
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="form.boxStylePic"
|
|
|
|
+ v-show="false"
|
|
|
|
+ >
|
|
|
|
+ </el-input>
|
|
|
|
+ <el-button size="small" type="primary">點擊上傳</el-button>
|
|
|
|
+ <div slot="tip" class="el-upload__tip">
|
|
|
|
+ <div v-if="form.boxStylePic" class="thumb">
|
|
|
|
+ <img class="upl-img" :src="form.boxStylePic" alt="" />
|
|
|
|
+ <i
|
|
|
|
+ class="el-icon-delete"
|
|
|
|
+ @click="form.boxStylePic = ''"
|
|
|
|
+ ></i>
|
|
|
|
+ </div>
|
|
|
|
+ <p>1、支持png、jpg和gif圖片格式;</p>
|
|
|
|
+ <p>2、最大可上傳5M的圖片。</p>
|
|
|
|
+ <p>3、推薦大小:25 * 25 像素</p>
|
|
|
|
+ </div>
|
|
|
|
+ </el-upload>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item
|
|
|
|
+ label="龕位方位"
|
|
|
|
+ :label-width="formLabelWidth"
|
|
|
|
+ >
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="form.boxPositionPic"
|
|
|
|
+ v-show="false"
|
|
|
|
+ >
|
|
|
|
+ </el-input>
|
|
|
|
+ <el-upload
|
|
|
|
+ class="upload-demo"
|
|
|
|
+ :action="uploadUrl"
|
|
|
|
+ :show-file-list="false"
|
|
|
|
+ :on-success="handlePositionSuccess"
|
|
|
|
+ :before-upload="$beforeUpload"
|
|
|
|
+ :on-error="handleError"
|
|
|
|
+
|
|
|
|
+ >
|
|
|
|
+ <el-button size="small" type="primary">點擊上傳</el-button>
|
|
|
|
+ <div slot="tip" class="el-upload__tip">
|
|
|
|
+ <div v-if="form.boxPositionPic" class="thumb">
|
|
|
|
+ <img class="upl-img" :src="form.boxPositionPic" alt="" />
|
|
|
|
+ <i
|
|
|
|
+ class="el-icon-delete"
|
|
|
|
+ @click="form.boxPositionPic = ''"
|
|
|
|
+ ></i>
|
|
|
|
+ </div>
|
|
|
|
+ <p>1、支持png、jpg和gif圖片格式;</p>
|
|
|
|
+ <p>2、最大可上傳5M的圖片。</p>
|
|
|
|
+ </div>
|
|
|
|
+ </el-upload>
|
|
|
|
+ </el-form-item>
|
|
|
|
+
|
|
|
|
+ <el-form-item label="出售狀態" :label-width="formLabelWidth">
|
|
|
|
+ <el-radio-group v-model="form.saleStatus">
|
|
|
|
+ <el-radio :label="item.id" v-for="(item,i) in statusSelect" :key="i">{{item.name}}</el-radio>
|
|
|
|
+ </el-radio-group>
|
|
|
|
+ </el-form-item>
|
|
|
|
+
|
|
|
|
+ </el-form>
|
|
|
|
+ <div class="btn">
|
|
|
|
+ <el-button type="primary" @click="submitForm">保 存</el-button>
|
|
|
|
+ <el-button @click="cancel">取 消</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+<script>
|
|
|
|
+let XYposition = "";
|
|
|
|
+let BOXSN = "";
|
|
|
|
+
|
|
|
|
+export default {
|
|
|
|
+ data() {
|
|
|
|
+ let data = [
|
|
|
|
+ {
|
|
|
|
+ prop: "boxSn",
|
|
|
|
+ label: "龕位編碼",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ prop: "boxName",
|
|
|
|
+ label: "龕位名稱",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ prop: "blockName",
|
|
|
|
+ label: "方位名稱",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ prop: "wallName",
|
|
|
|
+ label: "所屬墻面",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ prop: "position",
|
|
|
|
+ label: "所屬位置",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ prop: "price",
|
|
|
|
+ label: "龕位價格(HK$)",
|
|
|
|
+ width: 180
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ prop: "managementFee",
|
|
|
|
+ label: "龕位管理費(HK$)",
|
|
|
|
+ width: 180
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ prop: "updateTime",
|
|
|
|
+ label: "修改日期",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ prop: "statusStr",
|
|
|
|
+ label: "預約狀態",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ prop: "saleStatusStr",
|
|
|
|
+ label: "出售狀態",
|
|
|
|
+ },
|
|
|
|
+ // {
|
|
|
|
+ // prop: "isShowStr",
|
|
|
|
+ // label: "顯示狀態",
|
|
|
|
+ // },
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ var checkBoxSn = (rule, value, callback) => {
|
|
|
|
+ if (!value) {
|
|
|
|
+ return callback(new Error("請填寫龕位編碼"));
|
|
|
|
+ } else if (BOXSN == value) {
|
|
|
|
+ return callback();
|
|
|
|
+ } else {
|
|
|
|
+ setTimeout(async () => {
|
|
|
|
+ await this.$http
|
|
|
|
+ .get(`/box/checkBoxSn?boxSn=${value}`)
|
|
|
|
+ .then((res) => {
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
+ res.data.used
|
|
|
|
+ ? callback(new Error("龕位編碼已存在"))
|
|
|
|
+ : callback();
|
|
|
|
+ } else {
|
|
|
|
+ this.$message({
|
|
|
|
+ type: "error",
|
|
|
|
+ message: res.msg,
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ var checkXY = (rule, value, callback) => {
|
|
|
|
+ if (!value) {
|
|
|
|
+ return callback(new Error(rule.msg));
|
|
|
|
+ }
|
|
|
|
+ else if (XYposition.x == this.form.xposition&&XYposition.y == this.form.yposition) {
|
|
|
|
+ return callback();
|
|
|
|
+ }
|
|
|
|
+ else if(this.form.xposition&&this.form.yposition){
|
|
|
|
+ setTimeout(async () => {
|
|
|
|
+ await this.$http
|
|
|
|
+ .get(`/box/checkBoxXYpos?wallId=${this.form.wallId}&xPosition=${this.form.xposition}&yPosition=${this.form.yposition}`)
|
|
|
|
+ .then((res) => {
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
+ res.data.used
|
|
|
|
+ ? callback(new Error(rule.t))
|
|
|
|
+ : callback();
|
|
|
|
+ } else {
|
|
|
|
+ this.$message({
|
|
|
|
+ type: "error",
|
|
|
|
+ message: res.msg,
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ callback();
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ let rules = {
|
|
|
|
+ boxSn: [{ required: true, validator: checkBoxSn, trigger: "blur" }],
|
|
|
|
+ boxName: [{ required: true, message: "請填寫龕位名稱", trigger: "blur" }],
|
|
|
|
+ blockId: [{ required: true, message: "請選擇所屬方位", trigger: "blur" }],
|
|
|
|
+ wallId: [{ required: true, message: "請選擇所屬墻面", trigger: "blur" }],
|
|
|
|
+ xposition: [{ required: true, validator: checkXY, t:'已存在龕位,請重新選擇', msg: "請選擇墻面橫列", trigger: "change" }],
|
|
|
|
+ yposition: [{ required: true, validator: checkXY, t:'已存在龕位,請重新選擇', msg: "請選擇墻面縱列", trigger: "change" }],
|
|
|
|
+ price: [{ required: true, message: "請填寫龕位價格", trigger: "blur" }],
|
|
|
|
+ managementFee: [
|
|
|
|
+ { required: true, message: "請填寫管理費價格", trigger: "blur" },
|
|
|
|
+ ],
|
|
|
|
+ boxStylePic: [
|
|
|
|
+ { required: true, message: "請上傳龕位樣式", trigger: "change" },
|
|
|
|
+ ]
|
|
|
|
+ };
|
|
|
|
+ return {
|
|
|
|
+ status: "",
|
|
|
|
+ statusSelect:[{
|
|
|
|
+ id:3,
|
|
|
|
+ name:'現貨'
|
|
|
|
+ },{
|
|
|
|
+ id:4,
|
|
|
|
+ name:'預售'
|
|
|
|
+ },{
|
|
|
|
+ id:5,
|
|
|
|
+ name:'轉售'
|
|
|
|
+ },{
|
|
|
|
+ id:2,
|
|
|
|
+ name:'已售'
|
|
|
|
+ },{
|
|
|
|
+ id:1,
|
|
|
|
+ name:'已預訂'
|
|
|
|
+ }],
|
|
|
|
+ data,
|
|
|
|
+ rules,
|
|
|
|
+ tableData: [],
|
|
|
|
+ fileList: [],
|
|
|
|
+ isChangeWall: true,
|
|
|
|
+ isChangeRC:true,
|
|
|
|
+ dialogFormVisible: false,
|
|
|
|
+ editTitle: "編輯",
|
|
|
|
+ boxName: "",
|
|
|
|
+ boxSn: "",
|
|
|
|
+ saleStatus: "",
|
|
|
|
+ form: {
|
|
|
|
+ boxSn: "",
|
|
|
|
+ boxName: "",
|
|
|
|
+ blockId: "",
|
|
|
|
+ blockName: "",
|
|
|
|
+ wallId: "",
|
|
|
|
+ wallName: "",
|
|
|
|
+ saleStatus: 3,
|
|
|
|
+ status: 0,
|
|
|
|
+ isShow: 1,
|
|
|
|
+ managementFee: "",
|
|
|
|
+ feeType:2,
|
|
|
|
+ price: "",
|
|
|
|
+ boxStylePic: "",
|
|
|
|
+ boxPositionPic: "",
|
|
|
|
+ yposition:'',
|
|
|
|
+ xposition:''
|
|
|
|
+ },
|
|
|
|
+ uploadUrl: this.$serverName + "sys/oss/upload",
|
|
|
|
+ formLabelWidth: "120px",
|
|
|
|
+ pageNum: 1,
|
|
|
|
+ size: 15,
|
|
|
|
+ total: 0,
|
|
|
|
+ posiList: [],
|
|
|
|
+ };
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ computed: {
|
|
|
|
+ wallList() {
|
|
|
|
+ let tmp = this.posiList.find((item) => {
|
|
|
|
+ return this.form.blockId == item.positionId;
|
|
|
|
+ });
|
|
|
|
+ return tmp ? tmp.childList : [];
|
|
|
|
+ },
|
|
|
|
+ row_column(){
|
|
|
|
+ let tmp = this.wallList.find((item) => {
|
|
|
|
+ return this.form.wallId == item.positionId;
|
|
|
|
+ });
|
|
|
|
+ return {
|
|
|
|
+ row:tmp?tmp.rowNum:0,
|
|
|
|
+ column:tmp?tmp.columnNum:0
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ watch: {
|
|
|
|
+ "form.blockId": function () {
|
|
|
|
+ if (this.isChangeWall) {
|
|
|
|
+ this.form.wallId = "";
|
|
|
|
+ }
|
|
|
|
+ this.isChangeWall = true;
|
|
|
|
+ },
|
|
|
|
+ "form.wallId": function () {
|
|
|
|
+ if (this.isChangeRC) {
|
|
|
|
+ this.form.xposition = "";
|
|
|
|
+ this.form.yposition = "";
|
|
|
|
+ }
|
|
|
|
+ this.isChangeRC = true;
|
|
|
|
+ },
|
|
|
|
+ pageNum(){
|
|
|
|
+ this.getList()
|
|
|
|
+ },
|
|
|
|
+ size(){
|
|
|
|
+ this.getList()
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ mounted() {
|
|
|
|
+ this.getPosiList();
|
|
|
|
+ this.getList();
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ handleSizeChange (val) {
|
|
|
|
+ this.size = val
|
|
|
|
+ },
|
|
|
|
+ handleCurrentChange (val) {
|
|
|
|
+ this.pageNum = val
|
|
|
|
+ },
|
|
|
|
+ reset(){
|
|
|
|
+ this.form = {
|
|
|
|
+ boxSn: "",
|
|
|
|
+ boxName: "",
|
|
|
|
+ blockId: "",
|
|
|
|
+ blockName: "",
|
|
|
|
+ wallId: "",
|
|
|
|
+ wallName: "",
|
|
|
|
+ saleStatus: 3,
|
|
|
|
+ status: 0,
|
|
|
|
+ isShow: 1,
|
|
|
|
+ managementFee: "",
|
|
|
|
+ feeType:2,
|
|
|
|
+ price: "",
|
|
|
|
+ boxStylePic: "",
|
|
|
|
+ boxPositionPic: "",
|
|
|
|
+ yposition:'',
|
|
|
|
+ xposition:''
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ cancel(){
|
|
|
|
+ this.dialogFormVisible = false
|
|
|
|
+ this.reset()
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ handleRemove(file, fileList) {
|
|
|
|
+ console.log(file, fileList);
|
|
|
|
+ },
|
|
|
|
+ handlePreview(file) {
|
|
|
|
+ console.log(file);
|
|
|
|
+ },
|
|
|
|
+ handleStyleSuccess(file) {
|
|
|
|
+ this.form.boxStylePic = file.link;
|
|
|
|
+ this.$__loading.close()
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ handlePositionSuccess(file) {
|
|
|
|
+ this.form.boxPositionPic = file.link;
|
|
|
|
+ this.$__loading.close()
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ del(item) {
|
|
|
|
+ this.$confirm("此操作將刪除該數據, 是否繼續?", "提示", {
|
|
|
|
+ confirmButtonText: "確定",
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
+ type: "warning"
|
|
|
|
+ })
|
|
|
|
+ .then(() => {
|
|
|
|
+ this.$http
|
|
|
|
+ .post(`/box/batchDelete?ids=${item.boxId}`, {})
|
|
|
|
+ .then((res) => {
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
+ this.$alert("刪除成功", "提示", {
|
|
|
|
+ confirmButtonText: "確定",
|
|
|
|
+ callback: () => {
|
|
|
|
+ this.reset()
|
|
|
|
+ this.getList();
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ this.$message({
|
|
|
|
+ type: "error",
|
|
|
|
+ message: res.msg,
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {
|
|
|
|
+ this.$message({
|
|
|
|
+ type: "info",
|
|
|
|
+ message: "已取消刪除",
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ async show(item) {
|
|
|
|
+ this.isChangeWall = false;
|
|
|
|
+ this.isChangeRC = false;
|
|
|
|
+
|
|
|
|
+ let result = await this.$http.get(`box/getDetail`, {
|
|
|
|
+ params: {
|
|
|
|
+ id: item.boxId,
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+ this.form = result.data;
|
|
|
|
+ this.dialogFormVisible = true;
|
|
|
|
+ this.editTitle = "編輯";
|
|
|
|
+ XYposition = {
|
|
|
|
+ x:this.form.xposition,
|
|
|
|
+ y:this.form.yposition
|
|
|
|
+ },
|
|
|
|
+ BOXSN = this.form.boxSn
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ async save() {
|
|
|
|
+ let url = this.editTitle != "編輯" ? "/box/add" : "/box/update";
|
|
|
|
+ let tmp = this.wallList.find(item=>item.positionId==this.form.wallId)
|
|
|
|
+ let tmp2 = this.posiList.find(item=>item.positionId==this.form.blockId)
|
|
|
|
+
|
|
|
|
+ this.form.wallName = tmp.positionName
|
|
|
|
+ this.form.blockName = tmp2.positionName
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ let result = await this.$http.post(url, {
|
|
|
|
+ ...this.form,
|
|
|
|
+ });
|
|
|
|
+ if (result.code == 0) {
|
|
|
|
+ this.$alert("操作成功", "提示", {
|
|
|
|
+ confirmButtonText: "確定",
|
|
|
|
+ callback: () => {
|
|
|
|
+ this.reset()
|
|
|
|
+ this.dialogFormVisible = false;
|
|
|
|
+ this.getList();
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+ }else{
|
|
|
|
+ this.$message({
|
|
|
|
+ type: "error",
|
|
|
|
+ message: result.msg,
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ submitForm() {
|
|
|
|
+ this.$refs.niche.validate((valid) => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ this.save();
|
|
|
|
+ } else {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ async getPosiList() {
|
|
|
|
+ let result = await this.$http.get(`box/position/getList`, {
|
|
|
|
+ params: {
|
|
|
|
+ name: "",
|
|
|
|
+ pageNum: 1,
|
|
|
|
+ pageSize: 1000,
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+ this.posiList = result.data.list;
|
|
|
|
+ },
|
|
|
|
+ async getList() {
|
|
|
|
+ let result = await this.$http.get(`/box/getOrQuery`, {
|
|
|
|
+ params: {
|
|
|
|
+ boxName: this.boxName,
|
|
|
|
+ boxSn: this.boxSn,
|
|
|
|
+ saleStatus: this.saleStatus,
|
|
|
|
+ pageNum: this.pageNum,
|
|
|
|
+ pageSize: this.size,
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ this.tableData = result.data.list.map((item) => {
|
|
|
|
+ item["isShowStr"] = item["isShow"] ? "顯示" : "不顯示";
|
|
|
|
+ item["saleStatusStr"] = this.$statusStr[item["saleStatus"]];
|
|
|
|
+ item["statusStr"] = this.$statusStr[item["status"]];
|
|
|
|
+
|
|
|
|
+ item["position"] = `橫列:第${item['xposition']||' - '}橫<br/>縱列:第${item['yposition']||' - '}列`;
|
|
|
|
+ return item;
|
|
|
|
+ });
|
|
|
|
+ this.total= result.data.totalNum
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+</script>
|
|
|
|
+
|
|
|
|
+<style lang="less" scoped>
|
|
|
|
+.thumb {
|
|
|
|
+ display: block;
|
|
|
|
+ margin: 10px 0;
|
|
|
|
+ position: relative;
|
|
|
|
+ width: 120px;
|
|
|
|
+ > img {
|
|
|
|
+ max-width: 120px;
|
|
|
|
+ }
|
|
|
|
+ &:hover {
|
|
|
|
+ .el-icon-delete {
|
|
|
|
+ display: block;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ .el-icon-delete {
|
|
|
|
+ position: absolute;
|
|
|
|
+ right: 5px;
|
|
|
|
+ top: 5px;
|
|
|
|
+ font-size: 20px;
|
|
|
|
+ cursor: pointer;
|
|
|
|
+ display: none;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+</style>
|