|
@@ -1,29 +1,94 @@
|
|
|
<template>
|
|
|
- <div class="checkDetail pagePadding">
|
|
|
+ <div class="checkDetail pagePadding" v-loading="loading">
|
|
|
<div
|
|
|
style="width: 100%"
|
|
|
v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
|
|
|
>
|
|
|
+ <div class="tr" style="padding: 10px 0; height: 50px">
|
|
|
+ <span class="fl" style="padding: 3px 0 0 3px">盘点详情</span>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ plain
|
|
|
+ :size="'mini'"
|
|
|
+ @click="statusConfirm('1', '发起审核流程')"
|
|
|
+ v-if="status === '0' && powers.some((item) => item == '012')"
|
|
|
+ >发起审核流程
|
|
|
+ </el-button>
|
|
|
+
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ :size="'mini'"
|
|
|
+ @click="statusConfirm('-2', '导出盘点商品')"
|
|
|
+ v-if="status === '1' && powers.some((item) => item == '019')"
|
|
|
+ >导出盘点商品
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ @click="statusConfirm('0', '取消审核流程')"
|
|
|
+ plain
|
|
|
+ :size="'mini'"
|
|
|
+ v-if="status === '1' && powers.some((item) => item == '014')"
|
|
|
+ >取消审核流程</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ @click="statusConfirm('-1', '作废该条信息')"
|
|
|
+ type="danger"
|
|
|
+ plain
|
|
|
+ :size="'mini'"
|
|
|
+ v-if="
|
|
|
+ (status === '0' || status === '1') &&
|
|
|
+ powers.some((item) => item == '015')
|
|
|
+ "
|
|
|
+ >作废该条信息</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+
|
|
|
<add-edit
|
|
|
- style="width: 100%"
|
|
|
- v-if="$route.query.id"
|
|
|
- :id="$route.query.id"
|
|
|
- />
|
|
|
- <result-uplod
|
|
|
- style="width: 100%"
|
|
|
- v-if="$route.query.id"
|
|
|
- :id="$route.query.id"
|
|
|
- />
|
|
|
- <exam-form
|
|
|
- v-if="$route.query.id"
|
|
|
- style="width: 100%"
|
|
|
- :statusList="statusList"
|
|
|
- :disabled="false"
|
|
|
- :isMust="true"
|
|
|
- @searchChange="examForm"
|
|
|
+ :newTime="newTime"
|
|
|
+ v-if="newTime !== ''"
|
|
|
+ :sitem="sitem"
|
|
|
+ :id="queryId"
|
|
|
+ @refresh="initData()"
|
|
|
/>
|
|
|
- <button @click="addGood">添加商品</button>
|
|
|
- <search-stock-good-modal :code="code" :showModel="showModel1" />
|
|
|
+
|
|
|
+ <el-collapse
|
|
|
+ v-if="
|
|
|
+ status == '3' ||
|
|
|
+ (status == '1' && powers.some((item) => item == '017')) ||
|
|
|
+ (status == '2' && powers.some((item) => item == '018'))
|
|
|
+ "
|
|
|
+ v-model="activeNames"
|
|
|
+ @change="handleChange"
|
|
|
+ >
|
|
|
+ <el-collapse-item
|
|
|
+ v-if="
|
|
|
+ status == '3' ||
|
|
|
+ (status == '1' && powers.some((item) => item == '017')) ||
|
|
|
+ (status == '2' && powers.some((item) => item == '018'))
|
|
|
+ "
|
|
|
+ title="盘点结果记录"
|
|
|
+ name="1"
|
|
|
+ >
|
|
|
+ <result-uplod
|
|
|
+ :newTime="newTime"
|
|
|
+ :sitem="sitem"
|
|
|
+ :id="queryId"
|
|
|
+ @refresh="initData()"
|
|
|
+ />
|
|
|
+ </el-collapse-item>
|
|
|
+ <el-collapse-item
|
|
|
+ v-if="status == '2' && powers.some((item) => item == '018')"
|
|
|
+ title="盘点审核"
|
|
|
+ name="2"
|
|
|
+ >
|
|
|
+ <exam-form
|
|
|
+ :statusList="statusList"
|
|
|
+ :newTime="newTime"
|
|
|
+ :disabled="false"
|
|
|
+ :isMust="false"
|
|
|
+ @searchChange="examForm"
|
|
|
+ />
|
|
|
+ </el-collapse-item>
|
|
|
+ </el-collapse>
|
|
|
</div>
|
|
|
<div v-else>
|
|
|
<no-auth></no-auth>
|
|
@@ -33,10 +98,11 @@
|
|
|
<script>
|
|
|
import mixinPage from "@/mixins/elPaginationHandle";
|
|
|
import resToken from "@/mixins/resToken";
|
|
|
-// import statusList from "@/assets/js/statusList";
|
|
|
import asyncRequest from "@/apis/service/stock/check/detail";
|
|
|
import addEdit from "./components/addEdit";
|
|
|
import resultUplod from "./components/resultUplod";
|
|
|
+import { getToken } from "@/utils/auth";
|
|
|
+import urlConfig from "@/apis/url-config";
|
|
|
import { mapGetters } from "vuex";
|
|
|
|
|
|
export default {
|
|
@@ -62,208 +128,194 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- code: "WSM9f0r211019102112",
|
|
|
- showModel1: false,
|
|
|
+ activeNames: ["0", "1", "2", "3", "4"],
|
|
|
sitem: null,
|
|
|
- // 状态
|
|
|
- statusOptions: [
|
|
|
- { id: "0", label: "禁用" },
|
|
|
- { id: "1", label: "启用" },
|
|
|
- ],
|
|
|
- // statusList: statusList,
|
|
|
- statusList: [
|
|
|
- {
|
|
|
- value: "1",
|
|
|
- label: "label1",
|
|
|
- },
|
|
|
- {
|
|
|
- value: "2",
|
|
|
- label: "label2",
|
|
|
- },
|
|
|
- {
|
|
|
- value: "3",
|
|
|
- label: "label3",
|
|
|
- },
|
|
|
- ],
|
|
|
+ status: "",
|
|
|
+ newTime: "",
|
|
|
+ fileUrl: urlConfig.baseURL,
|
|
|
loading: true,
|
|
|
- showModel: false,
|
|
|
- isDetail: false,
|
|
|
- modelId: 0,
|
|
|
- parmValue: {
|
|
|
- name: "", // 业务员名字
|
|
|
- username: "", // 账号
|
|
|
- status: "", //
|
|
|
- page: 1, // 页码
|
|
|
- size: 15, // 每页显示条数
|
|
|
- },
|
|
|
- tableData: [],
|
|
|
- passwordModel: false,
|
|
|
- passwordModelId: 0,
|
|
|
- isPasswordDetail: false,
|
|
|
- // 表格 - 数据
|
|
|
- tableData: [],
|
|
|
- // 表格 - 参数
|
|
|
- table: {
|
|
|
- stripe: true,
|
|
|
- border: true,
|
|
|
- _defaultHeader_: ["setcol"],
|
|
|
- },
|
|
|
- // 表格 - 分页
|
|
|
- pageInfo: {
|
|
|
- size: 15,
|
|
|
- curr: 1,
|
|
|
- total: 0,
|
|
|
- },
|
|
|
- // 表格 - 列参数
|
|
|
- columns: [
|
|
|
- {
|
|
|
- prop: "nickname",
|
|
|
- label: "真实姓名",
|
|
|
- },
|
|
|
- {
|
|
|
- prop: "role_name",
|
|
|
- label: "角色名称",
|
|
|
- },
|
|
|
- {
|
|
|
- prop: "mobile",
|
|
|
- label: "联系电话",
|
|
|
- },
|
|
|
- {
|
|
|
- prop: "email",
|
|
|
- label: "邮箱",
|
|
|
- },
|
|
|
- {
|
|
|
- prop: "status",
|
|
|
- label: "状态",
|
|
|
- _slot_: "status",
|
|
|
- width: "80px",
|
|
|
- },
|
|
|
- {
|
|
|
- prop: "addtime",
|
|
|
- label: "创建时间",
|
|
|
- sortable: true,
|
|
|
- },
|
|
|
- {
|
|
|
- prop: "",
|
|
|
- label: "操作",
|
|
|
- fixed: "right",
|
|
|
- _noset_: true,
|
|
|
- _slot_: "operation",
|
|
|
- },
|
|
|
- ],
|
|
|
+ queryId: "",
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
|
- console.log(this.$route.query.id);
|
|
|
-
|
|
|
- // this.searchList();
|
|
|
+ this.status = "";
|
|
|
+ this.queryId = this.$route.query.id;
|
|
|
+ this.initData();
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
- examForm(e) {
|
|
|
- console.log(e);
|
|
|
- },
|
|
|
- addGood() {
|
|
|
- this.showModel1 = true;
|
|
|
- // console.log();
|
|
|
- },
|
|
|
- restSearch() {
|
|
|
- // 表格 - 分页
|
|
|
- this.pageInfo = {
|
|
|
- size: 15,
|
|
|
- curr: 1,
|
|
|
- total: 0,
|
|
|
- };
|
|
|
- this.parmValue = {
|
|
|
- name: "", // 业务员名字
|
|
|
- username: "", // 账号
|
|
|
- status: "", //
|
|
|
- page: 1, // 页码
|
|
|
- size: 15, // 每页显示条数
|
|
|
- };
|
|
|
- this.searchList();
|
|
|
- },
|
|
|
-
|
|
|
- openModal(id, isDetail, sitem) {
|
|
|
- this.showModel = true;
|
|
|
- this.modelId = id;
|
|
|
- this.isDetail = isDetail;
|
|
|
- this.sitem = sitem;
|
|
|
+ async initData() {
|
|
|
+ this.loading = true;
|
|
|
+ const res = await asyncRequest.detail({ id: this.queryId });
|
|
|
+ if (res && res.code === 0 && res.data) {
|
|
|
+ this.sitem = res.data;
|
|
|
+ this.status = this.sitem.status;
|
|
|
+ // this.activeNames = [this.status];
|
|
|
+ this.getNewTime();
|
|
|
+ } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
+ await this.logout();
|
|
|
+ } else {
|
|
|
+ this.$message.warning(res.message);
|
|
|
+ }
|
|
|
+ this.loading = false;
|
|
|
},
|
|
|
- async deleteById(id, status) {
|
|
|
- await this.$confirm("确定要作废申请?", {
|
|
|
+ async statusConfirm(status, message) {
|
|
|
+ await this.$confirm(`确定要${message}?`, {
|
|
|
confirmButtonText: "确定",
|
|
|
cancelButtonText: "取消",
|
|
|
type: "warning",
|
|
|
})
|
|
|
.then(async () => {
|
|
|
- const model = {
|
|
|
- id: id,
|
|
|
- status: status === "1" ? "0" : "1",
|
|
|
- };
|
|
|
- const res = await asyncRequest.status(model);
|
|
|
- if (res && res.code === 0) {
|
|
|
- this.$notify.success({
|
|
|
- title: "删除成功",
|
|
|
- message: "",
|
|
|
- });
|
|
|
-
|
|
|
- this.routeGoto("check", {});
|
|
|
- } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
- await this.logout();
|
|
|
+ if (status === "-1") {
|
|
|
+ await this.deleteById(message);
|
|
|
+ } else if (status === "-2") {
|
|
|
+ await this.exportGood(message);
|
|
|
} else {
|
|
|
- this.$message.warning(res.message);
|
|
|
+ await this.setStatus(status, message);
|
|
|
}
|
|
|
})
|
|
|
.catch(() => {
|
|
|
console.log("取消");
|
|
|
});
|
|
|
},
|
|
|
- async searchList() {
|
|
|
- this.loading = true;
|
|
|
- const res = await asyncRequest.list(this.parmValue);
|
|
|
- if (res && res.code === 0 && res.data) {
|
|
|
- this.tableData = res.data.list;
|
|
|
- this.pageInfo.total = Number(res.data.count);
|
|
|
+ getNewTime() {
|
|
|
+ this.newTime = new Date().valueOf();
|
|
|
+ },
|
|
|
+ async exportGood(message) {
|
|
|
+ if (!this.loading) {
|
|
|
+ this.loading = true;
|
|
|
+ let httpType = `aplication/zip`;
|
|
|
+ let model = {
|
|
|
+ id: this.queryId,
|
|
|
+ token: getToken(),
|
|
|
+ };
|
|
|
+ axios({
|
|
|
+ method: "post",
|
|
|
+ url: urlConfig.baseURL + "admin/checkexport",
|
|
|
+ responseType: "blob",
|
|
|
+ data: model,
|
|
|
+ headers: {
|
|
|
+ Accept: httpType,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ if (res && res.status == 200 && res.data) {
|
|
|
+ let blob = new Blob([res.data], {
|
|
|
+ type: httpType,
|
|
|
+ });
|
|
|
+ let url = window.URL.createObjectURL(blob);
|
|
|
+ let aLink = document.createElement("a");
|
|
|
+ aLink.style.display = "none";
|
|
|
+ aLink.href = url;
|
|
|
+ aLink.setAttribute("download", `提成数据报表.zip`);
|
|
|
+ document.body.appendChild(aLink);
|
|
|
+ aLink.click();
|
|
|
+ document.body.removeChild(aLink); //下载完成移除元素
|
|
|
+ window.URL.revokeObjectURL(url); //释放掉blob对象
|
|
|
+
|
|
|
+ this.$message.success(message + `信息导出成功!`);
|
|
|
+ setTimeout(() => {
|
|
|
+ this.loading = false;
|
|
|
+ }, 500);
|
|
|
+ } else {
|
|
|
+ // this.$message.error(res.data.message);
|
|
|
+ setTimeout(() => {
|
|
|
+ this.loading = false;
|
|
|
+ }, 500);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ console.log(error);
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // if (!this.loading) {
|
|
|
+ // this.loading = true;
|
|
|
+ // let httpType = `aplication/zip`;
|
|
|
+ // let model = {
|
|
|
+ // id: this.queryId,
|
|
|
+ // token: getToken(),
|
|
|
+ // };
|
|
|
+ // axios({
|
|
|
+ // method: "post",
|
|
|
+ // url: this.fileUrl + "admin/checkexport",
|
|
|
+ // responseType: "blob",
|
|
|
+ // data: model,
|
|
|
+ // headers: {
|
|
|
+ // Accept: httpType,
|
|
|
+ // },
|
|
|
+ // })
|
|
|
+ // .then((res) => {
|
|
|
+ // if (res && res.status == 200 && res.data) {
|
|
|
+ // let blob = new Blob([res.data], {
|
|
|
+ // type: httpType,
|
|
|
+ // });
|
|
|
+ // let url = window.URL.createObjectURL(blob);
|
|
|
+ // let aLink = document.createElement("a");
|
|
|
+ // aLink.style.display = "none";
|
|
|
+ // aLink.href = url;
|
|
|
+ // aLink.setAttribute("download", `${message}.zip`);
|
|
|
+ // document.body.appendChild(aLink);
|
|
|
+ // aLink.click();
|
|
|
+ // document.body.removeChild(aLink); //下载完成移除元素
|
|
|
+ // window.URL.revokeObjectURL(url); //释放掉blob对象
|
|
|
+ // this.$message.success(message + `信息导出成功!`);
|
|
|
+ // setTimeout(() => {
|
|
|
+ // this.loading = false;
|
|
|
+ // }, 500);
|
|
|
+ // } else {
|
|
|
+ // this.$message.error(`信息导出失败!`);
|
|
|
+ // setTimeout(() => {
|
|
|
+ // this.loading = false;
|
|
|
+ // }, 500);
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // .catch((error) => {
|
|
|
+ // this.loading = false;
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ },
|
|
|
+ async deleteById(message) {
|
|
|
+ const res = await asyncRequest.delete({ id: this.queryId });
|
|
|
+ if (res && res.code === 0) {
|
|
|
+ this.$notify.success({
|
|
|
+ title: message + "成功!",
|
|
|
+ message: "",
|
|
|
+ });
|
|
|
+
|
|
|
+ this.routeGoto("check", {});
|
|
|
} else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
await this.logout();
|
|
|
} else {
|
|
|
- this.tableData = [];
|
|
|
- this.pageInfo.total = 0;
|
|
|
+ this.$message.warning(res.message);
|
|
|
}
|
|
|
- this.loading = false;
|
|
|
},
|
|
|
|
|
|
- async statusConfirm(id, status) {
|
|
|
- let str = status === "1" ? "禁用" : "启用";
|
|
|
- await this.$confirm("确定要改为" + str + "?", {
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消",
|
|
|
- type: "warning",
|
|
|
- })
|
|
|
- .then(async () => {
|
|
|
- this.loading = true;
|
|
|
- const model = {
|
|
|
- id: id,
|
|
|
- status: status === "1" ? "0" : "1",
|
|
|
- };
|
|
|
- const res = await asyncRequest.status(model);
|
|
|
- if (res && res.code === 0) {
|
|
|
- this.loading = false;
|
|
|
- this.$notify.success({
|
|
|
- title: "状态修改成功!",
|
|
|
- message: "",
|
|
|
- });
|
|
|
- await this.searchList();
|
|
|
- } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
- await this.logout();
|
|
|
- } else {
|
|
|
- this.$message.warning(res.message);
|
|
|
- }
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- console.log("取消");
|
|
|
+ async setStatus(status, message, remark) {
|
|
|
+ let model = {
|
|
|
+ id: this.queryId,
|
|
|
+ remark: remark || "",
|
|
|
+ status: status,
|
|
|
+ };
|
|
|
+ const res = await asyncRequest.status(model);
|
|
|
+ this.loading = false;
|
|
|
+ if (res && res.code === 0) {
|
|
|
+ this.$notify.success({
|
|
|
+ title: message + "成功!",
|
|
|
+ message: "",
|
|
|
});
|
|
|
+ this.initData();
|
|
|
+ } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
+ await this.logout();
|
|
|
+ } else {
|
|
|
+ this.$message.warning(res.message);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async examForm(e) {
|
|
|
+ if (!this.loading) {
|
|
|
+ let type = e.state === "1" ? "3" : "1";
|
|
|
+ await this.setStatus(type, "盘点审核", e.remark);
|
|
|
+ }
|
|
|
},
|
|
|
},
|
|
|
};
|