|
@@ -3,6 +3,9 @@
|
|
|
<el-row type="flex">
|
|
<el-row type="flex">
|
|
|
<cl-refresh-btn />
|
|
<cl-refresh-btn />
|
|
|
<cl-add-btn />
|
|
<cl-add-btn />
|
|
|
|
|
+ <!-- <el-button type="primary" size="mini" @click="visible_import = true"
|
|
|
|
|
+ >批量导入</el-button
|
|
|
|
|
+ > -->
|
|
|
<cl-multi-delete-btn />
|
|
<cl-multi-delete-btn />
|
|
|
<demo-query-is_expire />
|
|
<demo-query-is_expire />
|
|
|
<cl-flex1 />
|
|
<cl-flex1 />
|
|
@@ -20,6 +23,7 @@
|
|
|
}
|
|
}
|
|
|
]"
|
|
]"
|
|
|
></cl-search-key>
|
|
></cl-search-key>
|
|
|
|
|
+ <demo-adv-computer-search />
|
|
|
</el-row>
|
|
</el-row>
|
|
|
|
|
|
|
|
<el-row>
|
|
<el-row>
|
|
@@ -37,7 +41,9 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<template #slot-renew="{ scope }">
|
|
<template #slot-renew="{ scope }">
|
|
|
- <el-button type="text" size="mini" @click="renew(scope.row)">续费</el-button>
|
|
|
|
|
|
|
+ <el-button type="text" size="mini" @click="switchRenew(scope.row)"
|
|
|
|
|
+ >续费</el-button
|
|
|
|
|
+ >
|
|
|
</template>
|
|
</template>
|
|
|
<template #slot-renting-out="{ scope }">
|
|
<template #slot-renting-out="{ scope }">
|
|
|
<el-button
|
|
<el-button
|
|
@@ -58,9 +64,7 @@
|
|
|
>
|
|
>
|
|
|
</template>
|
|
</template>
|
|
|
<template #slot-delete="{ scope }">
|
|
<template #slot-delete="{ scope }">
|
|
|
- <el-button type="text" size="mini" @click="deleteNum(scope.row)"
|
|
|
|
|
- >下架</el-button
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ <el-button type="text" size="mini" @click="offShelf(scope.row)">下架</el-button>
|
|
|
</template>
|
|
</template>
|
|
|
</cl-table>
|
|
</cl-table>
|
|
|
</el-row>
|
|
</el-row>
|
|
@@ -212,6 +216,108 @@
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
</cl-dialog>
|
|
</cl-dialog>
|
|
|
|
|
+ <cl-dialog title="租机续费" v-model="visible_renew">
|
|
|
|
|
+ <el-form ref="elForm" :model="renewForm" 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="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>
|
|
|
|
|
+ </cl-dialog>
|
|
|
|
|
+ <cl-dialog
|
|
|
|
|
+ title="批量导入租机信息"
|
|
|
|
|
+ v-model="visible_import"
|
|
|
|
|
+ :props="{
|
|
|
|
|
+ modal: true,
|
|
|
|
|
+ customClass: 'cl-chat__dialog',
|
|
|
|
|
+ 'append-to-body': true,
|
|
|
|
|
+ 'close-on-click-modal': false,
|
|
|
|
|
+ 'close-on-press-escape': false
|
|
|
|
|
+ }"
|
|
|
|
|
+ >
|
|
|
|
|
+ <div class="el-div">
|
|
|
|
|
+ <h3 class="v-line-icon">批量导入租机信息</h3>
|
|
|
|
|
+ <el-form
|
|
|
|
|
+ ref="elForm"
|
|
|
|
|
+ :model="importForm"
|
|
|
|
|
+ size="mini"
|
|
|
|
|
+ label-width="100px"
|
|
|
|
|
+ :disabled="saving"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-form-item label="选择文件" prop="">
|
|
|
|
|
+ <el-col :span="12">
|
|
|
|
|
+ <cl-upload
|
|
|
|
|
+ v-model="importForm.urls"
|
|
|
|
|
+ accept=".xls,.xlsx"
|
|
|
|
|
+ list-type="text"
|
|
|
|
|
+ :limi="1"
|
|
|
|
|
+ limit-size="10"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-button size="small" type="primary">点击上传</el-button>
|
|
|
|
|
+ <div slot="tip" class="el-upload__tip" style="color: #ff4200">
|
|
|
|
|
+ Tips: 只能上传.xls,.xlsx文件,且不超过10M
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <!-- <el-alert :title="reqFlag.error" v-if="reqFlag.errorTips" type="error" show-icon :closable="false"> </el-alert> -->
|
|
|
|
|
+ </cl-upload>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item>
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ size="mini"
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ :disabled="saving"
|
|
|
|
|
+ @click="batchImport"
|
|
|
|
|
+ >
|
|
|
|
|
+ 确定导入
|
|
|
|
|
+ <i class="el-icon-upload el-icon--right"></i>
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </cl-dialog>
|
|
|
</cl-crud>
|
|
</cl-crud>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -221,16 +327,17 @@ import { defineComponent, inject, reactive, ref } from "vue";
|
|
|
import QueryIsExpire from "../components/query-is_expire.vue";
|
|
import QueryIsExpire from "../components/query-is_expire.vue";
|
|
|
import shuyouRentComputerListSelect from "../components/shuyouRentComputerList-select.vue";
|
|
import shuyouRentComputerListSelect from "../components/shuyouRentComputerList-select.vue";
|
|
|
import dayjs from "dayjs";
|
|
import dayjs from "dayjs";
|
|
|
-import { ElMessage } from "element-plus";
|
|
|
|
|
|
|
+import { ElMessage, ElMessageBox, ElLoading } from "element-plus";
|
|
|
import { useRefs } from "/@/core";
|
|
import { useRefs } from "/@/core";
|
|
|
-import { floor } from "lodash";
|
|
|
|
|
|
|
+import AdvSearch from "../components/adv-search-computer.vue";
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
|
name: "rent-computer",
|
|
name: "rent-computer",
|
|
|
|
|
|
|
|
components: {
|
|
components: {
|
|
|
"demo-query-is_expire": QueryIsExpire,
|
|
"demo-query-is_expire": QueryIsExpire,
|
|
|
- "demo-select-rentComputerList": shuyouRentComputerListSelect
|
|
|
|
|
|
|
+ "demo-select-rentComputerList": shuyouRentComputerListSelect,
|
|
|
|
|
+ "demo-adv-computer-search": AdvSearch
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
setup() {
|
|
setup() {
|
|
@@ -240,6 +347,10 @@ export default defineComponent({
|
|
|
const form = reactive<any>({
|
|
const form = reactive<any>({
|
|
|
relevance: 1
|
|
relevance: 1
|
|
|
});
|
|
});
|
|
|
|
|
+ const importForm = reactive<any>({
|
|
|
|
|
+ urls: ""
|
|
|
|
|
+ });
|
|
|
|
|
+ const saving = ref<boolean>(false);
|
|
|
// 表单值
|
|
// 表单值
|
|
|
const replaceNumForm = reactive<any>({
|
|
const replaceNumForm = reactive<any>({
|
|
|
pc_num_old: "",
|
|
pc_num_old: "",
|
|
@@ -261,8 +372,16 @@ export default defineComponent({
|
|
|
rent_end: dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss"),
|
|
rent_end: dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss"),
|
|
|
addList: []
|
|
addList: []
|
|
|
});
|
|
});
|
|
|
|
|
+ const renewForm = reactive<any>({
|
|
|
|
|
+ pc_num: "",
|
|
|
|
|
+ pc_id: 0,
|
|
|
|
|
+ day: 0,
|
|
|
|
|
+ rent_renew: dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss")
|
|
|
|
|
+ });
|
|
|
const visible_replaceNum = ref<boolean>(false);
|
|
const visible_replaceNum = ref<boolean>(false);
|
|
|
const visible_rentingOut = ref<boolean>(false);
|
|
const visible_rentingOut = ref<boolean>(false);
|
|
|
|
|
+ const visible_renew = ref<boolean>(false);
|
|
|
|
|
+ const visible_import = ref<boolean>(false);
|
|
|
let cardList = ref<any[]>([]);
|
|
let cardList = ref<any[]>([]);
|
|
|
const rent_end = ref<string>("");
|
|
const rent_end = ref<string>("");
|
|
|
|
|
|
|
@@ -373,6 +492,7 @@ export default defineComponent({
|
|
|
prop: "rent_end",
|
|
prop: "rent_end",
|
|
|
label: "到期时间",
|
|
label: "到期时间",
|
|
|
span: 8,
|
|
span: 8,
|
|
|
|
|
+ value: new Date(),
|
|
|
component: {
|
|
component: {
|
|
|
name: "el-date-picker",
|
|
name: "el-date-picker",
|
|
|
props: {
|
|
props: {
|
|
@@ -604,14 +724,14 @@ export default defineComponent({
|
|
|
align: "left",
|
|
align: "left",
|
|
|
minWidth: 120
|
|
minWidth: 120
|
|
|
},
|
|
},
|
|
|
- {
|
|
|
|
|
- prop: "rent_price_used",
|
|
|
|
|
- label: "已产生租金",
|
|
|
|
|
- sortable: "true",
|
|
|
|
|
- headerAlign: "left",
|
|
|
|
|
- align: "left",
|
|
|
|
|
- minWidth: 120
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ // {
|
|
|
|
|
+ // prop: "rent_price_used",
|
|
|
|
|
+ // label: "已产生租金",
|
|
|
|
|
+ // sortable: "true",
|
|
|
|
|
+ // headerAlign: "left",
|
|
|
|
|
+ // align: "left",
|
|
|
|
|
+ // minWidth: 120
|
|
|
|
|
+ // },
|
|
|
{
|
|
{
|
|
|
prop: "directorNameList",
|
|
prop: "directorNameList",
|
|
|
label: "使用人",
|
|
label: "使用人",
|
|
@@ -693,7 +813,7 @@ export default defineComponent({
|
|
|
}) {
|
|
}) {
|
|
|
scope.rent_end = new Date(
|
|
scope.rent_end = new Date(
|
|
|
Date.parse(scope.rent_start) +
|
|
Date.parse(scope.rent_start) +
|
|
|
- 1 * 24 * 60 * 60 * 1000 * (parseInt(scope.rent_duration) - 1)
|
|
|
|
|
|
|
+ 1 * 24 * 60 * 60 * 1000 * parseInt(scope.rent_duration)
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
// 计算退租剩余时间
|
|
// 计算退租剩余时间
|
|
@@ -711,8 +831,56 @@ export default defineComponent({
|
|
|
);
|
|
);
|
|
|
// console.log(scope.day);
|
|
// console.log(scope.day);
|
|
|
}
|
|
}
|
|
|
|
|
+ // 计算续费时间
|
|
|
|
|
+ function calculateRenewDay(scope: { rent_renew: string; day: number }) {
|
|
|
|
|
+ if (Date.parse(rent_end.value) >= Date.parse(scope.rent_renew)) {
|
|
|
|
|
+ scope.rent_renew = rent_end.value;
|
|
|
|
|
+ ElMessage.error("续费时间不能小于到期时间");
|
|
|
|
|
+ }
|
|
|
|
|
+ scope.day = Math.ceil(
|
|
|
|
|
+ parseInt(
|
|
|
|
|
+ (Date.parse(scope.rent_renew) - Date.parse(rent_end.value)) /
|
|
|
|
|
+ (24 * 60 * 60 * 1000) +
|
|
|
|
|
+ ""
|
|
|
|
|
+ )
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+ // 拉起续费弹窗
|
|
|
|
|
+ async function switchRenew(rowData: any) {
|
|
|
|
|
+ renewForm.pc_num = rowData.pc_num;
|
|
|
|
|
+ renewForm.pc_id = rowData.id;
|
|
|
|
|
+ renewForm.rent_renew = rowData.rent_end;
|
|
|
|
|
+ renewForm.day = 0;
|
|
|
|
|
+ rent_end.value = rowData.rent_end;
|
|
|
|
|
+ if (visible_renew.value == false) {
|
|
|
|
|
+ visible_renew.value = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
// 续费
|
|
// 续费
|
|
|
- async function renew(rowData) {}
|
|
|
|
|
|
|
+ async function renew(rowData: { pc_num: any; pc_id: any; rent_renew: any; day: any }) {
|
|
|
|
|
+ let doForm = {
|
|
|
|
|
+ pc_num: rowData.pc_num,
|
|
|
|
|
+ pc_id: rowData.pc_id,
|
|
|
|
|
+ rent_renew: rowData.rent_renew,
|
|
|
|
|
+ day: rowData.day
|
|
|
|
|
+ };
|
|
|
|
|
+ service.shuyouRentComputer
|
|
|
|
|
+ .renew(doForm)
|
|
|
|
|
+ .then((data: any) => {
|
|
|
|
|
+ // console.log(data);
|
|
|
|
|
+ if (data.code == 1) {
|
|
|
|
|
+ visible_renew.value = false;
|
|
|
|
|
+ ElMessage.success(data.message);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ElMessage.error(data.message);
|
|
|
|
|
+ }
|
|
|
|
|
+ // console.log('刷新页面')
|
|
|
|
|
+ refs.value.crud.refresh();
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch((err: string) => {
|
|
|
|
|
+ ElMessage.error(err);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
// 拉起退租弹窗
|
|
// 拉起退租弹窗
|
|
|
async function switchRentingOut(rowData: any) {
|
|
async function switchRentingOut(rowData: any) {
|
|
|
cardList.value = [];
|
|
cardList.value = [];
|
|
@@ -756,7 +924,7 @@ export default defineComponent({
|
|
|
service.shuyouRentComputer
|
|
service.shuyouRentComputer
|
|
|
.rentingOut(doForm)
|
|
.rentingOut(doForm)
|
|
|
.then((data: any) => {
|
|
.then((data: any) => {
|
|
|
- console.log(data);
|
|
|
|
|
|
|
+ // console.log(data);
|
|
|
if (data.code == 1) {
|
|
if (data.code == 1) {
|
|
|
visible_rentingOut.value = false;
|
|
visible_rentingOut.value = false;
|
|
|
ElMessage.success(data.message);
|
|
ElMessage.success(data.message);
|
|
@@ -820,7 +988,73 @@ export default defineComponent({
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
// 删除/下架
|
|
// 删除/下架
|
|
|
- async function deleteNum(rowData) {}
|
|
|
|
|
|
|
+ async function offShelf(rowData: { is_expire: number; pc_num: string; id: any }) {
|
|
|
|
|
+ if (rowData.is_expire != 1) {
|
|
|
|
|
+ ElMessage.warning("机器未到期,禁止下架!!!");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ let doForm = {
|
|
|
|
|
+ pc_id: rowData.id
|
|
|
|
|
+ };
|
|
|
|
|
+ console.log(doForm);
|
|
|
|
|
+ ElMessageBox.confirm("确定要下架编号为" + rowData.pc_num + "的租机吗?", "租机下架", {
|
|
|
|
|
+ dangerouslyUseHTMLString: true,
|
|
|
|
|
+ type: "warning"
|
|
|
|
|
+ })
|
|
|
|
|
+ .then(() => {
|
|
|
|
|
+ service.shuyouRentComputer
|
|
|
|
|
+ .offShelf(doForm)
|
|
|
|
|
+ .then((data: any) => {
|
|
|
|
|
+ // console.log(data);
|
|
|
|
|
+ if (data.code == 1) {
|
|
|
|
|
+ ElMessage.success(data.message);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ElMessage.error(data.message);
|
|
|
|
|
+ }
|
|
|
|
|
+ refs.value.crud.refresh();
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch((err: string) => {
|
|
|
|
|
+ ElMessage.error(err);
|
|
|
|
|
+ });
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(() => null);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 批量导入
|
|
|
|
|
+ async function batchImport() {
|
|
|
|
|
+ saving.value = true;
|
|
|
|
|
+ const loading = ElLoading.service({
|
|
|
|
|
+ lock: true,
|
|
|
|
|
+ text: "上传中,请勿关闭此页面...",
|
|
|
|
|
+ spinner: "el-icon-loading",
|
|
|
|
|
+ background: "rgba(0, 0, 0, 0.7)"
|
|
|
|
|
+ });
|
|
|
|
|
+ console.log(importForm.urls);
|
|
|
|
|
+ const params = {
|
|
|
|
|
+ fileaddress: importForm.urls
|
|
|
|
|
+ };
|
|
|
|
|
+ await service.shuyouRentComputer
|
|
|
|
|
+ .batchImport(params)
|
|
|
|
|
+ .then((data) => {
|
|
|
|
|
+ console.log(data);
|
|
|
|
|
+ visible_import.value = false;
|
|
|
|
|
+ loading.close();
|
|
|
|
|
+ // if (data.code == -1) {
|
|
|
|
|
+ // ElMessage.success(data.message);
|
|
|
|
|
+ // } else {
|
|
|
|
|
+ // ElMessage.success(data.message);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // ElMessageBox.alert(data.message, "提示", {
|
|
|
|
|
+ // confirmButtonText: "关闭"
|
|
|
|
|
+ // });
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch((err: string) => {
|
|
|
|
|
+ loading.close();
|
|
|
|
|
+ ElMessageBox.alert(err, "提示", {
|
|
|
|
|
+ confirmButtonText: "关闭"
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+ saving.value = false;
|
|
|
|
|
+ }
|
|
|
// 监听
|
|
// 监听
|
|
|
// watch(
|
|
// watch(
|
|
|
// () => form,
|
|
// () => form,
|
|
@@ -847,7 +1081,7 @@ export default defineComponent({
|
|
|
renew,
|
|
renew,
|
|
|
rentingOut,
|
|
rentingOut,
|
|
|
replaceNum,
|
|
replaceNum,
|
|
|
- deleteNum,
|
|
|
|
|
|
|
+ offShelf,
|
|
|
switchReplaceNum,
|
|
switchReplaceNum,
|
|
|
switchRentingOut,
|
|
switchRentingOut,
|
|
|
visible_replaceNum,
|
|
visible_replaceNum,
|
|
@@ -856,7 +1090,15 @@ export default defineComponent({
|
|
|
rentingOutForm,
|
|
rentingOutForm,
|
|
|
addCardMsg,
|
|
addCardMsg,
|
|
|
deleteCardMsg,
|
|
deleteCardMsg,
|
|
|
- cardList
|
|
|
|
|
|
|
+ cardList,
|
|
|
|
|
+ visible_renew,
|
|
|
|
|
+ renewForm,
|
|
|
|
|
+ switchRenew,
|
|
|
|
|
+ calculateRenewDay,
|
|
|
|
|
+ visible_import,
|
|
|
|
|
+ importForm,
|
|
|
|
|
+ saving,
|
|
|
|
|
+ batchImport
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|