|
|
@@ -2,7 +2,7 @@
|
|
|
* @Author: 倚楼听风雨 18408246387@163.com
|
|
|
* @Date: 2022-11-16 17:16:17
|
|
|
* @LastEditors: 倚楼听风雨 18408246387@163.com
|
|
|
- * @LastEditTime: 2023-02-01 09:58:23
|
|
|
+ * @LastEditTime: 2023-02-20 11:58:25
|
|
|
* @FilePath: \log-server-web\src\view\logComputer\list_computer_distinct.vue
|
|
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
|
-->
|
|
|
@@ -44,12 +44,22 @@
|
|
|
<el-option label="明日到期" value="2" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="是否下架">
|
|
|
+ <el-form-item label="使用人">
|
|
|
+ <el-select v-model="searchInfo.director_name" size="small">
|
|
|
+ <el-option
|
|
|
+ v-for="item in directorOptions"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <!-- <el-form-item label="是否下架">
|
|
|
<el-select v-model="searchInfo.is_off_shelf" size="small">
|
|
|
<el-option label="否" value="0" />
|
|
|
<el-option label="是" value="1" />
|
|
|
</el-select>
|
|
|
- </el-form-item>
|
|
|
+ </el-form-item> -->
|
|
|
<el-form-item>
|
|
|
<el-button
|
|
|
size="small"
|
|
|
@@ -86,6 +96,25 @@
|
|
|
>
|
|
|
<el-button size="small" type="primary" icon="upload">导入</el-button>
|
|
|
</el-upload>
|
|
|
+ <el-button
|
|
|
+ icon="delete"
|
|
|
+ size="small"
|
|
|
+ type="danger"
|
|
|
+ :disabled="!apis.length"
|
|
|
+ style="margin-left: 10px"
|
|
|
+ @click="deletesMenu()"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ <!-- <el-popover v-model="deleteVisible" placement="top" width="160">
|
|
|
+ <p>确定要删除吗?</p>
|
|
|
+ <div style="text-align: right; margin-top: 8px;">
|
|
|
+ <el-button size="small" type="primary" link @click="deleteVisible = false">取消</el-button>
|
|
|
+ <el-button size="small" type="primary" @click="onDelete">确定</el-button>
|
|
|
+ </div>
|
|
|
+ <template #reference>
|
|
|
+ <el-button icon="delete" size="small" :disabled="!apis.length" style="margin-left: 10px;" @click="deleteVisible = true">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-popover> -->
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="row center">
|
|
|
@@ -104,7 +133,7 @@
|
|
|
<el-table-column
|
|
|
align="left"
|
|
|
label="供应商"
|
|
|
- min-width="100"
|
|
|
+ min-width="70"
|
|
|
prop="shop_name"
|
|
|
/>
|
|
|
<!-- <el-table-column
|
|
|
@@ -162,6 +191,12 @@
|
|
|
prop="rent_duration"
|
|
|
/>
|
|
|
<el-table-column
|
|
|
+ align="left"
|
|
|
+ label="使用人"
|
|
|
+ min-width="80"
|
|
|
+ prop="director_name"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
align="center"
|
|
|
label="是否到期"
|
|
|
min-width="100"
|
|
|
@@ -191,10 +226,10 @@
|
|
|
>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column
|
|
|
+ <!-- <el-table-column
|
|
|
align="center"
|
|
|
label="是否下架"
|
|
|
- min-width="150"
|
|
|
+ min-width="100"
|
|
|
prop="is_off_shelf"
|
|
|
>
|
|
|
<template #default="scope">
|
|
|
@@ -207,7 +242,7 @@
|
|
|
>
|
|
|
<el-button v-else size="small" type="success" plain>否</el-button>
|
|
|
</template>
|
|
|
- </el-table-column>
|
|
|
+ </el-table-column> -->
|
|
|
<el-table-column
|
|
|
align="left"
|
|
|
label="TD号"
|
|
|
@@ -235,8 +270,9 @@
|
|
|
<el-table-column
|
|
|
align="left"
|
|
|
label="备注"
|
|
|
- min-width="50"
|
|
|
+ min-width="250"
|
|
|
prop="remark"
|
|
|
+ show-overflow-tooltip
|
|
|
/>
|
|
|
<el-table-column
|
|
|
align="left"
|
|
|
@@ -244,7 +280,7 @@
|
|
|
min-width="150"
|
|
|
prop="update_time"
|
|
|
/>
|
|
|
- <el-table-column align="left" fixed="right" label="操作" width="300">
|
|
|
+ <el-table-column align="left" fixed="right" label="操作" width="380">
|
|
|
<template #default="scope">
|
|
|
<el-button
|
|
|
size="small"
|
|
|
@@ -259,6 +295,32 @@
|
|
|
type="primary"
|
|
|
link
|
|
|
icon="edit"
|
|
|
+ @click="switchRenew(scope.row)"
|
|
|
+ >续费</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ v-if="scope.row.is_expire != 1"
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ link
|
|
|
+ icon="edit"
|
|
|
+ @click="switchRentingOut(scope.row)"
|
|
|
+ >退租</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ v-if="scope.row.is_expire != 1"
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ link
|
|
|
+ icon="edit"
|
|
|
+ @click="switchReplaceNum(scope.row)"
|
|
|
+ >换编号</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ link
|
|
|
+ icon="edit"
|
|
|
@click="editMenu(scope.row.id)"
|
|
|
>编辑</el-button
|
|
|
>
|
|
|
@@ -332,6 +394,18 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="使用人" prop="director_name">
|
|
|
+ <el-select v-model="form.director_name" size="small">
|
|
|
+ <el-option
|
|
|
+ v-for="item in directorOptions"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
</el-row>
|
|
|
<el-row :gutter="10">
|
|
|
<el-col :span="6">
|
|
|
@@ -398,13 +472,13 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- <el-row :gutter="10">
|
|
|
+ <!-- <el-row :gutter="10">
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="是否下架" prop="is_off_shelf">
|
|
|
<el-switch v-model="form.is_off_shelf" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- </el-row>
|
|
|
+ </el-row> -->
|
|
|
<el-row :gutter="10">
|
|
|
<el-col :span="20">
|
|
|
<el-form-item label="备注" prop="remark">
|
|
|
@@ -428,6 +502,220 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
+ <el-dialog title="租机续费" v-model="visible_renew">
|
|
|
+ <el-form :model="renewForm" size="default" label-width="100px">
|
|
|
+ <el-row>
|
|
|
+ <el-form-item label="警告:" prop="">
|
|
|
+ <el-col :span="24">
|
|
|
+ <p style="color: red; font-size: larger">请勿随意操作!!!</p>
|
|
|
+ </el-col>
|
|
|
+ </el-form-item>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-form-item label="租机编号" prop="pc_num">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-input
|
|
|
+ v-model="renewForm.pc_num"
|
|
|
+ placeholder="租机编号"
|
|
|
+ :disabled="true"
|
|
|
+ ></el-input>
|
|
|
+ </el-col>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="续费时间" prop="rent_renew">
|
|
|
+ <el-col>
|
|
|
+ <el-date-picker
|
|
|
+ v-model="renewForm.rent_renew"
|
|
|
+ format="YYYY-MM-DD HH:mm:ss"
|
|
|
+ type="datetime"
|
|
|
+ :style="{ width: '100%' }"
|
|
|
+ placeholder="请选择日期"
|
|
|
+ clearable
|
|
|
+ @change="calculateRenewDay(renewForm)"
|
|
|
+ ></el-date-picker>
|
|
|
+ </el-col>
|
|
|
+ </el-form-item>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-form-item label="续费天数" prop="">
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-tag :key="renewForm.day" type="warning" effect="light">
|
|
|
+ {{ renewForm.day }}
|
|
|
+ </el-tag>
|
|
|
+ </el-col>
|
|
|
+ </el-form-item>
|
|
|
+ </el-row>
|
|
|
+ <el-divider />
|
|
|
+ <el-form-item>
|
|
|
+ <el-button size="small" @click="visible_renew = false"
|
|
|
+ >取消</el-button
|
|
|
+ >
|
|
|
+ <el-button type="primary" size="small" @click="renew(renewForm)"
|
|
|
+ >提交</el-button
|
|
|
+ >
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </el-dialog>
|
|
|
+ <!--退租-->
|
|
|
+ <el-dialog title="租机退租" v-model="visible_rentingOut">
|
|
|
+ <el-form
|
|
|
+ ref="elForm"
|
|
|
+ :model="rentingOutForm"
|
|
|
+ size="medium"
|
|
|
+ label-width="100px"
|
|
|
+ >
|
|
|
+ <el-row>
|
|
|
+ <el-form-item label="警告:" prop="">
|
|
|
+ <el-col :span="24">
|
|
|
+ <p style="color: red; font-size: larger">请勿随意操作!!!</p>
|
|
|
+ </el-col>
|
|
|
+ </el-form-item>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-form-item label="租机编号" prop="pc_num">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-input
|
|
|
+ v-model="rentingOutForm.pc_num"
|
|
|
+ placeholder="租机编号"
|
|
|
+ :disabled="true"
|
|
|
+ ></el-input>
|
|
|
+ </el-col>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="退租时间" prop="rent_end">
|
|
|
+ <el-col>
|
|
|
+ <el-date-picker
|
|
|
+ v-model="rentingOutForm.rent_end"
|
|
|
+ format="YYYY-MM-DD HH:mm:ss"
|
|
|
+ type="datetime"
|
|
|
+ :style="{ width: '100%' }"
|
|
|
+ placeholder="请选择日期"
|
|
|
+ clearable
|
|
|
+ @change="calculateRentDay(rentingOutForm)"
|
|
|
+ ></el-date-picker>
|
|
|
+ </el-col>
|
|
|
+ </el-form-item>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-form-item label="剩余天数" prop="">
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-tag :key="rentingOutForm.day" type="warning" effect="light">
|
|
|
+ {{ rentingOutForm.day }}
|
|
|
+ </el-tag>
|
|
|
+ </el-col>
|
|
|
+ </el-form-item>
|
|
|
+ </el-row>
|
|
|
+ <el-row
|
|
|
+ ><el-col :span="12" style="margin-left: 30px"
|
|
|
+ ><el-button size="small" @click="addCardMsg()"
|
|
|
+ >匀时间</el-button
|
|
|
+ ></el-col
|
|
|
+ ></el-row
|
|
|
+ >
|
|
|
+ <el-row>
|
|
|
+ <div class="container-scrollbar">
|
|
|
+ <el-scrollbar max-height="200px">
|
|
|
+ <el-row
|
|
|
+ :gutter="24"
|
|
|
+ v-for="(item, index) in cardList"
|
|
|
+ :key="index"
|
|
|
+ >
|
|
|
+ <el-col :span="10">
|
|
|
+ <el-form-item label="租机编号">
|
|
|
+ <el-input v-model="item.pc_num"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="增加天数">
|
|
|
+ <el-input v-model="item.add_day"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="2" v-if="cardList.length !== 1">
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ circle
|
|
|
+ icon="delete"
|
|
|
+ @click="deleteCardMsg(index)"
|
|
|
+ ></el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-scrollbar>
|
|
|
+ </div>
|
|
|
+ </el-row>
|
|
|
+ <el-divider />
|
|
|
+ <el-form-item>
|
|
|
+ <el-button size="small" @click="visible_rentingOut = false"
|
|
|
+ >取消</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ @click="rentingOut(rentingOutForm)"
|
|
|
+ >提交</el-button
|
|
|
+ >
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </el-dialog>
|
|
|
+ <!--租机编号更换-->
|
|
|
+ <el-dialog title="租机编号更换" v-model="visible_replaceNum">
|
|
|
+ <el-form
|
|
|
+ ref="elForm"
|
|
|
+ :model="replaceNumForm"
|
|
|
+ size="medium"
|
|
|
+ label-width="100px"
|
|
|
+ >
|
|
|
+ <el-row>
|
|
|
+ <el-form-item label="警告:" prop="">
|
|
|
+ <el-col :span="24">
|
|
|
+ <p style="color: red; font-size: larger">
|
|
|
+ 请勿随意更换,会影响租机续费
|
|
|
+ </p>
|
|
|
+ </el-col>
|
|
|
+ </el-form-item>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-form-item label="供应商:" prop="shop_name">
|
|
|
+ <el-col :span="24">
|
|
|
+ <p>
|
|
|
+ <span style="color: red; font-size: larger">{{
|
|
|
+ replaceNumForm.shop_name
|
|
|
+ }}</span
|
|
|
+ >, 只可更改为同一供应商的编号
|
|
|
+ </p>
|
|
|
+ </el-col>
|
|
|
+ </el-form-item>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-form-item label="原租机编号" prop="pc_num_old">
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-input
|
|
|
+ v-model="replaceNumForm.pc_num_old"
|
|
|
+ placeholder="原租机编号"
|
|
|
+ :disabled="true"
|
|
|
+ ></el-input>
|
|
|
+ </el-col>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="更换编号" prop="pc_num_new">
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-input
|
|
|
+ v-model="replaceNumForm.pc_num_new"
|
|
|
+ placeholder="更换编号"
|
|
|
+ ></el-input>
|
|
|
+ </el-col>
|
|
|
+ </el-form-item>
|
|
|
+ </el-row>
|
|
|
+ <el-divider />
|
|
|
+ <el-form-item>
|
|
|
+ <el-button size="small" @click="visible_replaceNum = false"
|
|
|
+ >取消</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ @click="replaceNum(replaceNumForm)"
|
|
|
+ >提交</el-button
|
|
|
+ >
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -447,13 +735,19 @@ import {
|
|
|
addRentComputer,
|
|
|
editRentComputer,
|
|
|
deleteRentComputerById,
|
|
|
+ deleteRentComputerByIds,
|
|
|
+ renewRentComputer,
|
|
|
+ replaceNumRentComputer,
|
|
|
+ rentingOutRentComputer,
|
|
|
} from "@/api/rentComputer";
|
|
|
+import { getDirectorList } from "@/api/responsiblePerson";
|
|
|
import { useUserStore } from "@/pinia/modules/user";
|
|
|
import { toSQLLine } from "@/utils/stringFun";
|
|
|
import { ref } from "vue";
|
|
|
import { ElMessage, ElMessageBox } from "element-plus";
|
|
|
import { formatDate } from "@/utils/format";
|
|
|
import { downloadTemplate } from "@/api/excel";
|
|
|
+import dayjs from "dayjs";
|
|
|
|
|
|
const apis = ref([]);
|
|
|
const form = ref({
|
|
|
@@ -472,6 +766,7 @@ const form = ref({
|
|
|
remark: "",
|
|
|
is_expire: -1,
|
|
|
is_off_shelf: -1,
|
|
|
+ director_name: "",
|
|
|
});
|
|
|
const rules = ref({
|
|
|
pc_num: [{ required: true, message: "请输入电脑编号", trigger: "blur" }],
|
|
|
@@ -496,11 +791,201 @@ let spanArr = [];
|
|
|
const searchInfo = ref({});
|
|
|
const computerNum = ref("");
|
|
|
const shopOptions = ref();
|
|
|
+const directorOptions = ref();
|
|
|
const setMealOptions = ref();
|
|
|
const defaultTime = ref(new Date(2000, 1, 1, 12, 0, 0));
|
|
|
const path = ref(import.meta.env.VITE_BASE_API);
|
|
|
const userStore = useUserStore();
|
|
|
+const visible_renew = ref(false);
|
|
|
+const visible_rentingOut = ref(false);
|
|
|
+const visible_replaceNum = ref(false);
|
|
|
+const rent_end = ref("");
|
|
|
+const renewForm = ref({
|
|
|
+ pc_num: "",
|
|
|
+ pc_id: 0,
|
|
|
+ day: 0,
|
|
|
+ rent_renew: dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss"),
|
|
|
+});
|
|
|
+const rentingOutForm = ref({
|
|
|
+ pc_num: "",
|
|
|
+ pc_id: 0,
|
|
|
+ day: 0,
|
|
|
+ rent_end: dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss"),
|
|
|
+ addList: [],
|
|
|
+});
|
|
|
+const replaceNumForm = ref({
|
|
|
+ pc_num_old: "",
|
|
|
+ pc_num_new: "",
|
|
|
+ shop_id: 0,
|
|
|
+ shop_name: "",
|
|
|
+});
|
|
|
+let cardList = ref([]);
|
|
|
|
|
|
+// 计算租机到期时间
|
|
|
+const calculateRentDuration = async (scope) => {
|
|
|
+ scope.rent_end = new Date(
|
|
|
+ Date.parse(scope.rent_start) +
|
|
|
+ 1 * 24 * 60 * 60 * 1000 * parseInt(scope.rent_duration)
|
|
|
+ );
|
|
|
+};
|
|
|
+// 计算退租剩余时间
|
|
|
+function calculateRentDay(scope) {
|
|
|
+ if (Date.parse(rent_end.value) < Date.parse(scope.rent_end)) {
|
|
|
+ scope.rent_end = rent_end.value;
|
|
|
+ ElMessage.error("退租时间不能大于到期时间");
|
|
|
+ }
|
|
|
+ scope.day = Math.ceil(
|
|
|
+ parseInt(
|
|
|
+ (Date.parse(rent_end.value) - Date.parse(scope.rent_end)) /
|
|
|
+ (24 * 60 * 60 * 1000) +
|
|
|
+ ""
|
|
|
+ )
|
|
|
+ );
|
|
|
+ // console.log(scope.day);
|
|
|
+}
|
|
|
+// 计算续费时间
|
|
|
+function calculateRenewDay(scope) {
|
|
|
+ if (Date.parse(rent_end.value) >= Date.parse(scope.rent_renew)) {
|
|
|
+ scope.rent_renew = rent_end.value;
|
|
|
+ ElMessage.error("续费时间不能小于到期时间");
|
|
|
+ visible_renew.value = false;
|
|
|
+ }
|
|
|
+ scope.day = Math.ceil(
|
|
|
+ parseInt(
|
|
|
+ (Date.parse(scope.rent_renew) - Date.parse(rent_end.value)) /
|
|
|
+ (24 * 60 * 60 * 1000) +
|
|
|
+ ""
|
|
|
+ )
|
|
|
+ );
|
|
|
+}
|
|
|
+// 拉起续费弹窗
|
|
|
+async function switchRenew(rowData) {
|
|
|
+ // console.log(rowData);
|
|
|
+ renewForm.value.pc_num = rowData.pc_num;
|
|
|
+ renewForm.value.pc_id = rowData.id;
|
|
|
+ renewForm.value.rent_renew = rowData.rent_end;
|
|
|
+ renewForm.value.day = 0;
|
|
|
+ rent_end.value = rowData.rent_end;
|
|
|
+ // console.log(renewForm);
|
|
|
+ if (visible_renew.value == false) {
|
|
|
+ visible_renew.value = true;
|
|
|
+ }
|
|
|
+}
|
|
|
+// 续费
|
|
|
+async function renew(rowData) {
|
|
|
+ let doForm = {
|
|
|
+ pc_num: rowData.pc_num,
|
|
|
+ pc_id: rowData.pc_id,
|
|
|
+ rent_renew: dayjs(new Date(rowData.rent_renew)).format(
|
|
|
+ "YYYY-MM-DD HH:mm:ss"
|
|
|
+ ),
|
|
|
+ day: rowData.day,
|
|
|
+ };
|
|
|
+ // renewRentComputer
|
|
|
+ const data = await renewRentComputer(doForm);
|
|
|
+ if (data.code == 0) {
|
|
|
+ visible_renew.value = false;
|
|
|
+ ElMessage.success(data.msg);
|
|
|
+ getTableData();
|
|
|
+ } else {
|
|
|
+ ElMessage.error(data.msg);
|
|
|
+ }
|
|
|
+}
|
|
|
+// 拉起退租弹窗
|
|
|
+async function switchRentingOut(rowData) {
|
|
|
+ cardList.value = [];
|
|
|
+ rentingOutForm.value.pc_num = rowData.pc_num;
|
|
|
+ rentingOutForm.value.pc_id = rowData.id;
|
|
|
+ rentingOutForm.value.rent_end = dayjs(new Date(rowData.rent_end)).format(
|
|
|
+ "YYYY-MM-DD HH:mm:ss"
|
|
|
+ );
|
|
|
+ rentingOutForm.value.day = 0;
|
|
|
+ rent_end.value = rowData.rent_end;
|
|
|
+ if (visible_rentingOut.value == false) {
|
|
|
+ visible_rentingOut.value = true;
|
|
|
+ }
|
|
|
+}
|
|
|
+function addCardMsg() {
|
|
|
+ let hasFlag = false;
|
|
|
+ for (let i = 0; i < cardList.value.length; i++) {
|
|
|
+ if (
|
|
|
+ cardList.value[i].pc_num == "" ||
|
|
|
+ cardList.value[i].add_day == undefined
|
|
|
+ ) {
|
|
|
+ hasFlag = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (hasFlag == true) {
|
|
|
+ ElMessage.error("有未填写项");
|
|
|
+ } else {
|
|
|
+ cardList.value.push({
|
|
|
+ pc_id: "",
|
|
|
+ add_day: null,
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|
|
|
+function deleteCardMsg(index) {
|
|
|
+ cardList.value.splice(index, 1);
|
|
|
+}
|
|
|
+// 退租
|
|
|
+async function rentingOut(rowData) {
|
|
|
+ var numDay = 0;
|
|
|
+ let AddList = [];
|
|
|
+ cardList.value.forEach((e) => {
|
|
|
+ numDay += e.add_day;
|
|
|
+ let temp = {
|
|
|
+ pc_num: e.pc_num,
|
|
|
+ add_day: Number(e.add_day),
|
|
|
+ };
|
|
|
+ AddList.push(temp);
|
|
|
+ });
|
|
|
+ if (numDay != rowData.day) {
|
|
|
+ ElMessage.error("匀时间天数错误!!!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let doForm = {
|
|
|
+ pc_id: rowData.pc_id,
|
|
|
+ rent_end: dayjs(new Date(rowData.rent_end)).format("YYYY-MM-DD HH:mm:ss"),
|
|
|
+ add_list: AddList,
|
|
|
+ };
|
|
|
+
|
|
|
+ const data = await rentingOutRentComputer(doForm);
|
|
|
+ // console.log(data)
|
|
|
+ if (data.code == 0) {
|
|
|
+ visible_rentingOut.value = false;
|
|
|
+ ElMessage.success(data.msg);
|
|
|
+ getTableData();
|
|
|
+ } else {
|
|
|
+ // ElMessage.error(data.msg);
|
|
|
+ }
|
|
|
+}
|
|
|
+// 拉起换编号弹窗
|
|
|
+async function switchReplaceNum(rowData) {
|
|
|
+ replaceNumForm.value.pc_num_old = rowData.pc_num;
|
|
|
+ replaceNumForm.value.shop_id = rowData.shop_id;
|
|
|
+ replaceNumForm.value.shop_name = rowData.shop_name;
|
|
|
+ if (visible_replaceNum.value == false) {
|
|
|
+ visible_replaceNum.value = true;
|
|
|
+ }
|
|
|
+}
|
|
|
+// 换编
|
|
|
+async function replaceNum(rowData) {
|
|
|
+ let doForm = {
|
|
|
+ pc_num_old: rowData.pc_num_old,
|
|
|
+ pc_num_new: rowData.pc_num_new,
|
|
|
+ shop_id: rowData.shop_id,
|
|
|
+ };
|
|
|
+ const data = await replaceNumRentComputer(doForm);
|
|
|
+ // console.log(data)
|
|
|
+ if (data.code == 0) {
|
|
|
+ visible_replaceNum.value = false;
|
|
|
+ ElMessage.success(data.msg);
|
|
|
+ getTableData();
|
|
|
+ } else {
|
|
|
+ // ElMessage.error(data.msg);
|
|
|
+ }
|
|
|
+}
|
|
|
const downloadExcelTemplate = () => {
|
|
|
downloadTemplate("RentComputerTemplate.xlsx");
|
|
|
};
|
|
|
@@ -553,7 +1038,7 @@ const sortChange = ({ prop, order }) => {
|
|
|
// 搜索
|
|
|
const onSubmit = () => {
|
|
|
page.value = 1;
|
|
|
- pageSize.value = 10;
|
|
|
+ pageSize.value = 20;
|
|
|
|
|
|
if (typeof searchInfo.value.set_meal_id != "undefined") {
|
|
|
searchInfo.value.set_meal_id = Number(searchInfo.value.set_meal_id);
|
|
|
@@ -565,7 +1050,7 @@ const onSubmit = () => {
|
|
|
searchInfo.value.is_off_shelf = Number(searchInfo.value.is_off_shelf);
|
|
|
}
|
|
|
|
|
|
- console.log(searchInfo);
|
|
|
+ // console.log(searchInfo);
|
|
|
|
|
|
getTableData();
|
|
|
};
|
|
|
@@ -623,14 +1108,20 @@ const getSelectList = async () => {
|
|
|
});
|
|
|
});
|
|
|
setMealOptions.value = setMealList;
|
|
|
-};
|
|
|
-
|
|
|
-// 计算租机到期时间
|
|
|
-const calculateRentDuration = async (scope) => {
|
|
|
- scope.rent_end = new Date(
|
|
|
- Date.parse(scope.rent_start) +
|
|
|
- 1 * 24 * 60 * 60 * 1000 * parseInt(scope.rent_duration)
|
|
|
- );
|
|
|
+ //游戏负责人列表===============================
|
|
|
+ const directorRes = await getDirectorList({
|
|
|
+ page: 1,
|
|
|
+ pageSize: 999,
|
|
|
+ });
|
|
|
+ let directorList = [
|
|
|
+ { value: "ALL", label: "所有机器" },
|
|
|
+ { value: "", label: "未使用" },
|
|
|
+ ];
|
|
|
+ const data3 = directorRes.data.list;
|
|
|
+ data3.forEach((e) => {
|
|
|
+ directorList.push({ value: e.name, label: e.name });
|
|
|
+ });
|
|
|
+ directorOptions.value = directorList;
|
|
|
};
|
|
|
|
|
|
// 查询
|
|
|
@@ -752,6 +1243,7 @@ const editMenu = async (id) => {
|
|
|
dialogTitle.value = "编辑租机";
|
|
|
const res = await getRentComputerById({ id });
|
|
|
form.value = res.data;
|
|
|
+ // console.log(form.value);
|
|
|
if (form.value.is_off_shelf == 1) {
|
|
|
form.value.is_off_shelf = true;
|
|
|
} else {
|
|
|
@@ -767,6 +1259,32 @@ const closeDialog = () => {
|
|
|
initForm();
|
|
|
dialogFormVisible.value = false;
|
|
|
};
|
|
|
+// 批量删除菜单
|
|
|
+const deletesMenu = async () => {
|
|
|
+ ElMessageBox.confirm("确定批量删除所选吗?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ })
|
|
|
+ .then(async () => {
|
|
|
+ const ids = apis.value.map((item) => item.id);
|
|
|
+ // console.log(ids);
|
|
|
+ const res = await deleteRentComputerByIds({ ids });
|
|
|
+ if (res.code === 0) {
|
|
|
+ ElMessage({
|
|
|
+ type: "success",
|
|
|
+ message: "删除成功!",
|
|
|
+ });
|
|
|
+ getTableData();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ ElMessage({
|
|
|
+ type: "info",
|
|
|
+ message: "已取消删除",
|
|
|
+ });
|
|
|
+ });
|
|
|
+};
|
|
|
// 删除菜单
|
|
|
const deleteMenu = async (id) => {
|
|
|
ElMessageBox.confirm("确定删除?", "提示", {
|