feat: 同步规格优化
This commit is contained in:
@@ -71,6 +71,7 @@ import contentConfig from "./config/content";
|
||||
import editModalConfig from "./config/edit";
|
||||
import searchConfig from "./config/search";
|
||||
import { returnOptionsLabel } from "./config/config";
|
||||
import { isSyncStatus } from "@/utils/index";
|
||||
|
||||
const {
|
||||
searchRef,
|
||||
@@ -87,6 +88,14 @@ const {
|
||||
handleFilterChange,
|
||||
} = usePage();
|
||||
|
||||
if (isSyncStatus()) {
|
||||
if( JSON.stringify(contentConfig.toolbar)?.indexOf("add") != -1){
|
||||
contentConfig.toolbar?.splice(0, 1)
|
||||
}
|
||||
if( JSON.stringify(contentConfig.cols[contentConfig.cols.length-1].operat)?.indexOf("edit") != -1){
|
||||
contentConfig.cols[contentConfig.cols.length-1].operat?.splice(0, 1)
|
||||
}
|
||||
}
|
||||
// 新增
|
||||
async function handleAddClick() {
|
||||
addModalRef.value?.setModalVisible();
|
||||
|
||||
@@ -29,6 +29,13 @@ const contentConfig: IContentConfig = {
|
||||
pk: "id",
|
||||
toolbar: [
|
||||
"add",
|
||||
{
|
||||
icon: "refresh",
|
||||
text: "同步",
|
||||
type: "danger",
|
||||
name: "sync",
|
||||
auth: "import",
|
||||
},
|
||||
{
|
||||
text: "入库",
|
||||
name: "ruku",
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
">
|
||||
<el-button type="primary" link @click="refAddHaocaiOpen(scope.row)">编辑</el-button>
|
||||
<el-button type="primary" link @click="refAddHaocaiOpen(scope.row)" v-if="!isSyncStatus()">编辑</el-button>
|
||||
<el-button link type="primary" @click="refAddHaocaiTakinShow(scope.row, 'consumables')">
|
||||
耗材盘点
|
||||
</el-button>
|
||||
@@ -89,12 +89,16 @@ import addHaocai from "./components/add-haocai.vue";
|
||||
import dataTongji from "./components/DataStatistics.vue";
|
||||
import addConsTakin from "./components/addConsTakin.vue";
|
||||
import consApi from "@/api/product/cons";
|
||||
import UserAPI from "@/api/product/index";
|
||||
|
||||
import type { IObject, IOperatData } from "@/components/CURD/types";
|
||||
import usePage from "@/components/CURD/usePage";
|
||||
import contentConfig from "./config/content";
|
||||
import editModalConfig from "./config/edit";
|
||||
import searchConfig from "./config/search";
|
||||
import { returnOptionsLabel } from "./config/config";
|
||||
import { isSyncStatus } from "@/utils/index";
|
||||
|
||||
const router = useRouter();
|
||||
const {
|
||||
searchRef,
|
||||
@@ -121,7 +125,20 @@ if (conName) {
|
||||
searchConfig.formItems[1].initialValue = conName;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(isSyncStatus())
|
||||
console.log(contentConfig)
|
||||
if (isSyncStatus()) {
|
||||
if( JSON.stringify(contentConfig.toolbar)?.indexOf("add") != -1){
|
||||
contentConfig.toolbar?.splice(0, 1)
|
||||
}
|
||||
if( JSON.stringify(contentConfig.cols[contentConfig.cols.length-1].operat)?.indexOf("delete") != -1){
|
||||
contentConfig.cols[contentConfig.cols.length-1].operat?.splice(2, 1)
|
||||
}
|
||||
}else {
|
||||
if( JSON.stringify(contentConfig.toolbar)?.indexOf("sync") != -1){
|
||||
contentConfig.toolbar?.splice(1, 1)
|
||||
}
|
||||
}
|
||||
//统计数据
|
||||
const gongjiData = reactive({ totalRow: 0 });
|
||||
function getTongji(params: IObject | undefined) {
|
||||
@@ -189,8 +206,13 @@ async function handleEditClick(row: IObject) {
|
||||
editModalRef.value?.setFormData({ ...row, url: [row.url] });
|
||||
}
|
||||
// 其他工具栏
|
||||
function handleToolbarClick(name: string) {
|
||||
async function handleToolbarClick(name: string) {
|
||||
console.log(name);
|
||||
if( name === 'sync' ){
|
||||
let res = await UserAPI.sync()
|
||||
ElMessage.success('操作成功,数据正在后台同步中...')
|
||||
return;
|
||||
}
|
||||
if (name === "category") {
|
||||
router.push({ path: "/inventory/classification" });
|
||||
return;
|
||||
|
||||
@@ -71,6 +71,7 @@ import contentConfig from "./config/content";
|
||||
import editModalConfig from "./config/edit";
|
||||
import searchConfig from "./config/search";
|
||||
import { returnOptionsLabel } from "./config/config";
|
||||
import { isSyncStatus } from "@/utils/index";
|
||||
|
||||
const {
|
||||
searchRef,
|
||||
@@ -86,7 +87,14 @@ const {
|
||||
handleSearchClick,
|
||||
handleFilterChange,
|
||||
} = usePage();
|
||||
|
||||
if (isSyncStatus()) {
|
||||
if( JSON.stringify(contentConfig.toolbar)?.indexOf("add") != -1){
|
||||
contentConfig.toolbar?.splice(0, 1)
|
||||
}
|
||||
if( JSON.stringify(contentConfig.cols[contentConfig.cols.length-1].operat)?.indexOf("edit") != -1){
|
||||
contentConfig.cols[contentConfig.cols.length-1].operat?.splice(0, 1)
|
||||
}
|
||||
}
|
||||
// 新增
|
||||
async function handleAddClick() {
|
||||
addModalRef.value?.setModalVisible();
|
||||
|
||||
Reference in New Issue
Block a user