<template>
|
<div>
|
<el-card style="margin: 10px;" class="affix-container" v-loading="loading">
|
<div>
|
<el-form size="default" label-width="170px">
|
<div style="display: flex;justify-content: space-between">
|
<div>
|
<b style="margin-right: 20px">
|
<el-icon style="color: var(--el-color-primary)">
|
<Setting/>
|
</el-icon>
|
{{ $t('menu.Config') }}
|
</b>
|
</div>
|
<div>
|
</div>
|
</div>
|
<el-divider :style="{'margin':'10px 0px'}"></el-divider>
|
<!-- purchase -->
|
<el-card style="margin-top: 10px ">
|
<div style="display: flex;justify-content: space-between">
|
<div>
|
<svg-icon name="contract_purchase" width="23" height="23" style="margin-right: 5px;margin-top: -5px;"
|
color=""/>
|
<b style="margin-right: 20px">
|
{{ $t('label.purchase_config') }}
|
</b>
|
</div>
|
<div>
|
|
</div>
|
</div>
|
<p style="color:var(--el-color-info); font-size: 12px;">
|
{{ $t('note.purchase_config_note') }}
|
</p>
|
|
<el-divider :style="{'margin':'10px 0px'}"></el-divider>
|
<el-row style="margin-top: 20px; padding-left: 100px;">
|
<el-col :span="8">
|
<el-switch v-model="switch_purchase_contract_remaining_day_value"
|
@change="onSubmit_S_PCRDV"
|
style="--el-switch-on-color: var(--el-color-primary); --el-switch-off-color: #e9e9eb"
|
:active-text="$t('label.switch_purchase_contract_remaining_day')"
|
size="default"/>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item :label="$t('label.purchase_contract_remaining_day')">
|
<el-input size="default" :prefix-icon="icon.Timer" maxlength="6" style="width: 100%"
|
@change="onSubmit_PCRDV"
|
:formatter="(value) => `${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')"
|
:parser="(value) => value.replace(/[^\d]/g, '')"
|
v-model="purchase_contract_remaining_day.value">
|
<template #append>{{ $t('unit.Days') }}</template>
|
</el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-divider :style="{'margin':'10px 0px'}"></el-divider>
|
<el-row style="margin-top: 20px; padding-left: 100px;">
|
<el-col :span="8">
|
<el-switch v-model="switch_purchase_shipment_remaining_day_value"
|
@change="onSubmit_S_PSRDV"
|
style="--el-switch-on-color: var(--el-color-primary); --el-switch-off-color: #e9e9eb"
|
:active-text="$t('label.switch_purchase_shipment_remaining_day')"
|
size="default"/>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item :label="$t('label.purchase_shipment_remaining_day')">
|
<el-input size="default" :prefix-icon="icon.Timer" maxlength="6" style="width: 100%"
|
@change="onSubmit_PSRDV"
|
:formatter="(value) => `${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')"
|
:parser="(value) => value.replace(/[^\d]/g, '')"
|
v-model="purchase_shipment_remaining_day.value">
|
<template #append>{{ $t('unit.Days') }}</template>
|
</el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-divider :style="{'margin':'10px 0px'}"></el-divider>
|
<el-row style="margin-top: 20px; padding-left: 100px;">
|
<el-col :span="8">
|
<el-switch v-model="switch_purchase_order_remaining_day_value"
|
@change="onSubmit_S_PORDV"
|
style="--el-switch-on-color: var(--el-color-primary); --el-switch-off-color: #e9e9eb"
|
:active-text="$t('label.switch_purchase_order_remaining_day')"
|
size="default"/>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item :label="$t('label.purchase_order_remaining_day')">
|
<el-input size="default" :prefix-icon="icon.Timer" maxlength="6" style="width: 100%"
|
@change="onSubmit_PORDV"
|
:formatter="(value) => `${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')"
|
:parser="(value) => value.replace(/[^\d]/g, '')"
|
v-model="purchase_order_remaining_day.value">
|
<template #append>{{ $t('unit.Days') }}</template>
|
</el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-card>
|
<!-- sale -->
|
<el-card style="margin-top: 10px ">
|
<div style="display: flex;justify-content: space-between">
|
<div>
|
<svg-icon name="contract_sale" width="23" height="23" style="margin-right: 5px;margin-top: -5px;"
|
color=""/>
|
<b style="margin-right: 20px">
|
{{ $t('label.sale_config') }}
|
</b>
|
</div>
|
<div>
|
|
</div>
|
</div>
|
<p style="color:var(--el-color-info); font-size: 12px;">
|
{{ $t('note.sale_config_note') }}
|
</p>
|
|
<el-divider :style="{'margin':'10px 0px'}"></el-divider>
|
<el-row style="margin-top: 20px; padding-left: 100px;">
|
<el-col :span="8">
|
<el-switch v-model="switch_sale_contract_remaining_day_value"
|
@change="onSubmit_S_SCRDV"
|
style="--el-switch-on-color: var(--el-color-primary); --el-switch-off-color: #e9e9eb"
|
:active-text="$t('label.switch_sale_contract_remaining_day')"
|
size="default"/>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item :label="$t('label.sale_contract_remaining_day')">
|
<el-input size="default" :prefix-icon="icon.Timer" maxlength="6" style="width: 100%"
|
@change="onSubmit_SCRDV"
|
:formatter="(value) => `${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')"
|
:parser="(value) => value.replace(/[^\d]/g, '')"
|
v-model="sale_contract_remaining_day.value">
|
<template #append>{{ $t('unit.Days') }}</template>
|
</el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-divider :style="{'margin':'10px 0px'}"></el-divider>
|
<el-row style="margin-top: 20px; padding-left: 100px;">
|
<el-col :span="8">
|
<el-switch v-model="switch_sale_shipment_remaining_day_value"
|
@change="onSubmit_S_SSRDV"
|
style="--el-switch-on-color: var(--el-color-primary); --el-switch-off-color: #e9e9eb"
|
:active-text="$t('label.switch_sale_shipment_remaining_day')"
|
size="default"/>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item :label="$t('label.sale_shipment_remaining_day')">
|
<el-input size="default" :prefix-icon="icon.Timer" maxlength="6" style="width: 100%"
|
@change="onSubmit_SSRDV"
|
:formatter="(value) => `${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')"
|
:parser="(value) => value.replace(/[^\d]/g, '')"
|
v-model="sale_shipment_remaining_day.value">
|
<template #append>{{ $t('unit.Days') }}</template>
|
</el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-divider :style="{'margin':'10px 0px'}"></el-divider>
|
<el-row style="margin-top: 20px; padding-left: 100px;">
|
<el-col :span="8">
|
<el-switch v-model="switch_sale_order_remaining_day_value"
|
@change="onSubmit_S_SORDV"
|
style="--el-switch-on-color: var(--el-color-primary); --el-switch-off-color: #e9e9eb"
|
:active-text="$t('label.switch_sale_order_remaining_day')"
|
size="default"/>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item :label="$t('label.sale_order_remaining_day')">
|
<el-input size="default" :prefix-icon="icon.Timer" maxlength="6" style="width: 100%"
|
@change="onSubmit_SORDV"
|
:formatter="(value) => `${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')"
|
:parser="(value) => value.replace(/[^\d]/g, '')"
|
v-model="sale_order_remaining_day.value">
|
<template #append>{{ $t('unit.Days') }}</template>
|
</el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-card>
|
<!-- warehouse -->
|
<el-card style="margin-top: 10px ">
|
<div style="display: flex;justify-content: space-between">
|
<div>
|
<svg-icon name="warehouse" width="23" height="23" style="margin-right: 5px;margin-top: -5px;"
|
color=""/>
|
<b style="margin-right: 20px">
|
{{ $t('label.warehouse_config') }}
|
</b>
|
</div>
|
<div>
|
|
</div>
|
</div>
|
<p style="color:var(--el-color-info); font-size: 12px;">
|
{{ $t('note.warehouse_config_note') }}
|
</p>
|
|
<el-divider :style="{'margin':'10px 0px'}"></el-divider>
|
<el-row style="margin-top: 20px; padding-left: 100px;">
|
<el-col :span="8">
|
<el-switch v-model="switch_warehouse_inventory_level_value"
|
@change="onSubmit_S_WILDV"
|
style="--el-switch-on-color: var(--el-color-primary); --el-switch-off-color: #e9e9eb"
|
:active-text="$t('label.switch_warehouse_inventory_level')"
|
size="default"/>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item :label="$t('label.warehouse_inventory_min_level')">
|
<el-input size="default" :prefix-icon="icon.Grid" maxlength="6" style="width: 100%"
|
@change="onSubmit_WIMINLV"
|
:formatter="(value) => `${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')"
|
:parser="(value) => value.replace(/[^\d]/g, '')"
|
v-model="warehouse_inventory_min_level.value">
|
<template #append>{{ $t('unit.t') }}</template>
|
</el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="7">
|
<el-form-item :label="$t('label.warehouse_inventory_max_level')">
|
<el-input size="default" :prefix-icon="icon.Grid" maxlength="6" style="width: 100%"
|
@change="onSubmit_WIMAXLV"
|
:formatter="(value) => `${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')"
|
:parser="(value) => value.replace(/[^\d]/g, '')"
|
v-model="warehouse_inventory_max_level.value">
|
<template #append>{{ $t('unit.t') }}</template>
|
</el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-divider :style="{'margin':'10px 0px'}"></el-divider>
|
<el-row style="margin-top: 20px; padding-left: 100px;">
|
<el-col :span="8">
|
<el-switch v-model="switch_warehouse_inventory_overstock_day_value"
|
@change="onSubmit_S_WIODV"
|
style="--el-switch-on-color: var(--el-color-primary); --el-switch-off-color: #e9e9eb"
|
:active-text="$t('label.switch_warehouse_inventory_overstock_day')"
|
size="default"/>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item :label="$t('label.warehouse_inventory_overstock_day')">
|
<el-input size="default" :prefix-icon="icon.Timer" maxlength="6" style="width: 100%"
|
@change="onSubmit_WIODV"
|
:formatter="(value) => `${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')"
|
:parser="(value) => value.replace(/[^\d]/g, '')"
|
v-model="warehouse_inventory_overstock_day.value">
|
<template #append>{{ $t('unit.Days') }}</template>
|
</el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-card>
|
<!-- financial -->
|
<el-card style="margin-top: 10px ">
|
<div style="display: flex;justify-content: space-between">
|
<div>
|
<svg-icon name="financial" width="23" height="23" style="margin-right: 5px;margin-top: -5px;"
|
color=""/>
|
<b style="margin-right: 20px">
|
{{ $t('label.financial_config') }}
|
</b>
|
</div>
|
<div>
|
|
</div>
|
</div>
|
<p style="color:var(--el-color-info); font-size: 12px;">
|
{{ $t('note.financial_config_note') }}
|
</p>
|
|
<el-divider :style="{'margin':'10px 0px'}"></el-divider>
|
<el-row style="margin-top: 20px; padding-left: 100px;">
|
<el-col :span="8">
|
<el-switch v-model="switch_financial_payment_remaining_day_value"
|
@change="onSubmit_S_FPRDV"
|
style="--el-switch-on-color: var(--el-color-primary); --el-switch-off-color: #e9e9eb"
|
:active-text="$t('label.switch_financial_payment_remaining_day')"
|
size="default"/>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item :label="$t('label.financial_payment_remaining_day')">
|
<el-input size="default" :prefix-icon="icon.Timer" maxlength="6" style="width: 100%"
|
@change="onSubmit_FPRDV"
|
:formatter="(value) => `${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')"
|
:parser="(value) => value.replace(/[^\d]/g, '')"
|
v-model="financial_payment_remaining_day.value">
|
<template #append>{{ $t('unit.Days') }}</template>
|
</el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-divider :style="{'margin':'10px 0px'}"></el-divider>
|
<el-row style="margin-top: 20px; padding-left: 100px;">
|
<el-col :span="8">
|
<el-switch v-model="switch_financial_collection_remaining_day_value"
|
@change="onSubmit_S_FCRDV"
|
style="--el-switch-on-color: var(--el-color-primary); --el-switch-off-color: #e9e9eb"
|
:active-text="$t('label.switch_financial_collection_remaining_day')"
|
size="default"/>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item :label="$t('label.financial_collection_remaining_day')">
|
<el-input size="default" :prefix-icon="icon.Timer" maxlength="6" style="width: 100%"
|
@change="onSubmit_FCRDV"
|
:formatter="(value) => `${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')"
|
:parser="(value) => value.replace(/[^\d]/g, '')"
|
v-model="financial_collection_remaining_day.value">
|
<template #append>{{ $t('unit.Days') }}</template>
|
</el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-card>
|
<!-- lanuage -->
|
<el-card style="margin-top: 10px ">
|
<div style="display: flex;justify-content: space-between">
|
<div>
|
<svg-icon name="language" width="23" height="23" style="margin-right: 5px;margin-top: -5px;"
|
color=""/>
|
<b style="margin-right: 20px">{{ $t('label.PreferredLanguages') }}</b>
|
</div>
|
<div>
|
<el-button size="default" :icon="icon.CirclePlus"
|
@click="newLanguageVisible = true">
|
{{ $t('button.AddLanguage') }}
|
</el-button>
|
</div>
|
</div>
|
<p style="color:var(--el-color-info); font-size: 12px;">
|
{{ $t('message.PreferredLanguagesNote') }}
|
</p>
|
<el-divider :style="{'margin':'10px 0px'}"></el-divider>
|
<el-row v-for="language in languages" style="margin-top: 10px;">
|
<el-col>
|
<div style="display: flex;justify-content: space-between">
|
<div>
|
<b style="margin-right: 20px">{{ language.value }}</b>
|
<p v-if="displayedLanguage===language.key"
|
style="color:var(--el-color-info); font-size: 12px;">
|
{{ $t('message.DefaultLanguagesNote') }}
|
</p>
|
</div>
|
<div>
|
<el-dropdown
|
size="default"
|
style="margin-left: 10px;margin-right: 10px;vertical-align: 1%">
|
<el-link type="primary" style="color: white; overflow: hidden">
|
<el-button @click="showAddLanguageView"><b>...</b></el-button>
|
</el-link>
|
<template #dropdown>
|
<el-dropdown-menu>
|
<el-dropdown-item>
|
<el-link :underline="false" style="margin: 5px"
|
type="primary" @click="displayLanguage(language)">
|
{{ $t('button.DisplayLanguage') }}
|
</el-link>
|
</el-dropdown-item>
|
<el-dropdown-item>
|
<el-link :underline="false" style="margin: 5px"
|
type="primary" @click="deleteLanguage(language)">
|
{{ $t('button.DeleteLanguage') }}
|
</el-link>
|
</el-dropdown-item>
|
</el-dropdown-menu>
|
</template>
|
</el-dropdown>
|
</div>
|
</div>
|
<el-divider :style="{'margin':'10px 0px'}"></el-divider>
|
</el-col>
|
</el-row>
|
</el-card>
|
</el-form>
|
</div>
|
</el-card>
|
<div v-dialogdrag>
|
<el-dialog id="newLanguageDialog"
|
v-model="newLanguageVisible"
|
:close-on-click-modal="false"
|
class="el-dialog-customer"
|
width="500px">
|
<template #header>
|
<el-row>
|
<el-col :span="12">
|
<el-icon style="font:normal bold 20px arial,sans-serif;vertical-align: -10%">
|
<plus/>
|
</el-icon>
|
<span style="margin-left: 10px; font:normal bold 20px arial,serif;">{{ $t('button.New') }}</span>
|
</el-col>
|
</el-row>
|
</template>
|
<el-card>
|
<el-form :model="language" size="default" :rules="languagerules" ref="newLanguageDialog"
|
label-width="100px">
|
<el-tabs>
|
<el-tab-pane :label="$t('label.BasicInformation')">
|
<el-row style="margin-top: 20px; padding-left: 100px;">
|
<el-col :span="21">
|
<el-form-item :label="$t('label.Code')" prop="key">
|
<el-input size="default" :prefix-icon="icon.Edit" maxlength="64"
|
v-model="language.key"></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="21">
|
<el-form-item :label="$t('label.Name')" prop="value">
|
<el-input size="default" :prefix-icon="icon.Edit" maxlength="64"
|
v-model="language.value"></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :style="{margin: '10px 0px 10px 0px'}">
|
<el-col :span="24">
|
<el-alert
|
type="warning"
|
:description="$t('message.AddLanguagesNote')"
|
:closable="false"
|
show-icon
|
></el-alert>
|
</el-col>
|
</el-row>
|
</el-tab-pane>
|
</el-tabs>
|
</el-form>
|
</el-card>
|
<template #footer>
|
<el-button type="primary" @click="addLanguage" :icon="icon.CircleCheck" size="default">
|
{{ $t('button.Submit') }}
|
</el-button>
|
<el-button type="danger" @click="newLanguageVisible = false" :icon="icon.CircleClose" size="default"
|
plain>
|
{{ $t('button.Close') }}
|
</el-button>
|
</template>
|
</el-dialog>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
|
import * as icon from '@element-plus/icons-vue'
|
import {onMounted, onBeforeUnmount, getCurrentInstance, reactive, toRefs, onActivated} from "vue";
|
import {
|
GetConfigs,
|
UpdateConfig,
|
CreateConfig,
|
DeleteConfig,
|
} from "@/api/admin/system"
|
import Cookies from "js-cookie";
|
import {useBasicInfoStore} from "@/store/basicInfo";
|
import * as elementplus from "element-plus";
|
import {parseToBoolean} from "@/utils/common";
|
|
export default {
|
name: "Config",
|
components: {},
|
setup() {
|
let {proxy} = getCurrentInstance();
|
const store = useBasicInfoStore()
|
const state = reactive({
|
//common properties
|
loading: false,
|
windowWidth: document.documentElement.clientWidth,
|
windowHeight: document.documentElement.clientHeight,
|
newLanguageVisible: false,
|
configs: [],
|
language: {
|
key: null,
|
value: null,
|
level: 0,
|
category: 'language',
|
},
|
selectedlanguage: null,
|
displayedLanguage: null,
|
languages: [],
|
languagerules: {
|
key: [{
|
required: true,
|
message: `${proxy.$t('message.IsRequired', {name: proxy.$t('label.Code')})}`,
|
}],
|
value: [{
|
required: true,
|
message: `${proxy.$t('message.IsRequired', {name: proxy.$t('label.Name')})}`,
|
trigger: 'blur'
|
}]
|
},
|
purchase_contract_remaining_day: {
|
key: "purchase_contract_remaining_day",
|
value: null,
|
level: 0,
|
category: 'purchase'
|
},
|
purchase_shipment_remaining_day: {
|
key: "purchase_shipment_remaining_day",
|
value: null,
|
level: 0,
|
category: 'purchase'
|
},
|
purchase_order_remaining_day: {key: "purchase_order_remaining_day", value: null, level: 0, category: 'purchase'},
|
sale_contract_remaining_day: {key: "sale_contract_remaining_day", value: null, level: 0, category: 'sale'},
|
sale_shipment_remaining_day: {key: "sale_shipment_remaining_day", value: null, level: 0, category: 'sale'},
|
sale_order_remaining_day: {key: "sale_order_remaining_day", value: null, level: 0, category: 'sale'},
|
warehouse_inventory_max_level: {
|
key: "warehouse_inventory_max_level",
|
value: null,
|
level: 0,
|
category: 'warehouse'
|
},
|
warehouse_inventory_min_level: {
|
key: "warehouse_inventory_min_level",
|
value: null,
|
level: 0,
|
category: 'warehouse'
|
},
|
warehouse_inventory_overstock_day: {
|
key: "warehouse_inventory_overstock_day",
|
value: null,
|
level: 0,
|
category: 'warehouse'
|
},
|
financial_payment_remaining_day: {
|
key: "financial_payment_remaining_day",
|
value: null,
|
level: 0,
|
category: 'financial'
|
},
|
financial_collection_remaining_day: {
|
key: "financial_collection_remaining_day",
|
value: null,
|
level: 0,
|
category: 'financial'
|
},
|
switch_purchase_contract_remaining_day: {
|
key: "switch_purchase_contract_remaining_day",
|
value: null,
|
level: 0,
|
category: 'purchase'
|
},
|
switch_purchase_shipment_remaining_day: {
|
key: "switch_purchase_shipment_remaining_day",
|
value: null,
|
level: 0,
|
category: 'purchase'
|
},
|
switch_purchase_order_remaining_day: {
|
key: "switch_purchase_order_remaining_day",
|
value: null,
|
level: 0,
|
category: 'purchase'
|
},
|
switch_sale_contract_remaining_day: {
|
key: "switch_sale_contract_remaining_day",
|
value: null,
|
level: 0,
|
category: 'sale'
|
},
|
switch_sale_shipment_remaining_day: {
|
key: "switch_sale_shipment_remaining_day",
|
value: null,
|
level: 0,
|
category: 'sale'
|
},
|
switch_sale_order_remaining_day: {
|
key: "switch_sale_order_remaining_day",
|
value: null,
|
level: 0,
|
category: 'sale'
|
},
|
switch_warehouse_inventory_level: {
|
key: "switch_warehouse_inventory_level",
|
value: null,
|
level: 0,
|
category: 'warehouse'
|
},
|
switch_warehouse_inventory_overstock_day: {
|
key: "switch_warehouse_inventory_overstock_day",
|
value: null,
|
level: 0,
|
category: 'warehouse'
|
},
|
switch_financial_payment_remaining_day: {
|
key: "switch_financial_payment_remaining_day",
|
value: null,
|
level: 0,
|
category: 'financial'
|
},
|
switch_financial_collection_remaining_day: {
|
key: "switch_financial_collection_remaining_day",
|
value: null,
|
level: 0,
|
category: 'financial'
|
},
|
switch_purchase_contract_remaining_day_value: false,
|
switch_purchase_shipment_remaining_day_value: false,
|
switch_purchase_order_remaining_day_value: false,
|
switch_sale_contract_remaining_day_value: false,
|
switch_sale_shipment_remaining_day_value: false,
|
switch_sale_order_remaining_day_value: false,
|
switch_warehouse_inventory_level_value: false,
|
switch_warehouse_inventory_overstock_day_value: false,
|
switch_financial_payment_remaining_day_value: false,
|
switch_financial_collection_remaining_day_value: false,
|
});
|
|
onMounted(() => {
|
Init();
|
});
|
onBeforeUnmount(() => {
|
|
});
|
onActivated(() => {
|
|
});
|
|
const Init = () => {
|
state.displayedLanguage = Cookies.get("language", {domain: WGURL.cookieDomain});
|
|
LoadData();
|
};
|
|
const getSearchCondition = () => {
|
let condition = {
|
permissionLevel: store.permissionLevel,
|
}
|
|
return condition;
|
};
|
const LoadData = () => {
|
state.loading = true;
|
let condition = getSearchCondition();
|
|
GetConfigs(condition).then(resp => {
|
state.loading = false;
|
if (resp.data) {
|
state.configs = resp.data.data;
|
if (state.configs && state.configs.length > 0) {
|
let c_01 = state.configs.filter(e => e.key === 'purchase_contract_remaining_day').shift();
|
c_01 ? state.purchase_contract_remaining_day = c_01 : CreateConfig(state.purchase_contract_remaining_day);
|
|
let c_02 = state.configs.filter(e => e.key === 'purchase_shipment_remaining_day').shift();
|
c_02 ? state.purchase_shipment_remaining_day = c_02 : CreateConfig(state.purchase_shipment_remaining_day);
|
|
let c_03 = state.configs.filter(e => e.key === 'purchase_order_remaining_day').shift();
|
c_03 ? state.purchase_order_remaining_day = c_03 : CreateConfig(state.purchase_order_remaining_day);
|
|
let c_04 = state.configs.filter(e => e.key === 'sale_contract_remaining_day').shift();
|
c_04 ? state.sale_contract_remaining_day = c_04 : CreateConfig(state.sale_contract_remaining_day);
|
|
let c_05 = state.configs.filter(e => e.key === 'sale_shipment_remaining_day').shift();
|
c_05 ? state.sale_shipment_remaining_day = c_05 : CreateConfig(state.sale_shipment_remaining_day);
|
|
let c_06 = state.configs.filter(e => e.key === 'sale_order_remaining_day').shift();
|
c_06 ? state.sale_order_remaining_day = c_06 : CreateConfig(state.sale_order_remaining_day);
|
|
let c_07 = state.configs.filter(e => e.key === 'warehouse_inventory_max_level').shift();
|
c_07 ? state.warehouse_inventory_max_level = c_07 : CreateConfig(state.warehouse_inventory_max_level);
|
|
let c_08 = state.configs.filter(e => e.key === 'warehouse_inventory_min_level').shift();
|
c_08 ? state.warehouse_inventory_min_level = c_08 : CreateConfig(state.warehouse_inventory_min_level);
|
|
let c_09 = state.configs.filter(e => e.key === 'warehouse_inventory_overstock_day').shift();
|
c_09 ? state.warehouse_inventory_overstock_day = c_09 : CreateConfig(state.warehouse_inventory_overstock_day);
|
|
let c_10 = state.configs.filter(e => e.key === 'financial_payment_remaining_day').shift();
|
c_10 ? state.financial_payment_remaining_day = c_10 : CreateConfig(state.financial_payment_remaining_day);
|
|
let c_11 = state.configs.filter(e => e.key === 'financial_collection_remaining_day').shift();
|
c_11 ? state.financial_collection_remaining_day = c_11 : CreateConfig(state.financial_collection_remaining_day);
|
|
let c_12 = state.configs.filter(e => e.key === 'switch_purchase_contract_remaining_day').shift();
|
c_12 ? state.switch_purchase_contract_remaining_day = c_12 : CreateConfig(state.switch_purchase_contract_remaining_day);
|
|
let c_13 = state.configs.filter(e => e.key === 'switch_purchase_shipment_remaining_day').shift();
|
c_13 ? state.switch_purchase_shipment_remaining_day = c_13 : CreateConfig(state.switch_purchase_shipment_remaining_day);
|
|
let c_14 = state.configs.filter(e => e.key === 'switch_purchase_order_remaining_day').shift();
|
c_14 ? state.switch_purchase_order_remaining_day = c_14 : CreateConfig(state.switch_purchase_order_remaining_day);
|
|
let c_15 = state.configs.filter(e => e.key === 'switch_sale_contract_remaining_day').shift();
|
c_15 ? state.switch_sale_contract_remaining_day = c_15 : CreateConfig(state.switch_sale_contract_remaining_day);
|
|
let c_16 = state.configs.filter(e => e.key === 'switch_sale_shipment_remaining_day').shift();
|
c_16 ? state.switch_sale_shipment_remaining_day = c_16 : CreateConfig(state.switch_sale_shipment_remaining_day);
|
|
let c_17 = state.configs.filter(e => e.key === 'switch_sale_order_remaining_day').shift();
|
c_17 ? state.switch_sale_order_remaining_day = c_17 : CreateConfig(state.switch_sale_order_remaining_day);
|
|
let c_18 = state.configs.filter(e => e.key === 'switch_warehouse_inventory_level').shift();
|
c_18 ? state.switch_warehouse_inventory_level = c_18 : CreateConfig(state.switch_warehouse_inventory_level);
|
|
let c_20 = state.configs.filter(e => e.key === 'switch_warehouse_inventory_overstock_day').shift();
|
c_20 ? state.switch_warehouse_inventory_overstock_day = c_20 : CreateConfig(state.switch_warehouse_inventory_overstock_day);
|
|
let c_21 = state.configs.filter(e => e.key === 'switch_financial_payment_remaining_day').shift();
|
c_21 ? state.switch_financial_payment_remaining_day = c_21 : CreateConfig(state.switch_financial_payment_remaining_day);
|
|
let c_22 = state.configs.filter(e => e.key === 'switch_financial_collection_remaining_day').shift();
|
c_22 ? state.switch_financial_collection_remaining_day = c_22 : CreateConfig(state.switch_financial_collection_remaining_day);
|
|
|
state.switch_purchase_contract_remaining_day_value = parseToBoolean(state.switch_purchase_contract_remaining_day.value);
|
state.switch_purchase_shipment_remaining_day_value = parseToBoolean(state.switch_purchase_shipment_remaining_day.value);
|
state.switch_purchase_order_remaining_day_value = parseToBoolean(state.switch_purchase_order_remaining_day.value);
|
state.switch_sale_contract_remaining_day_value = parseToBoolean(state.switch_sale_contract_remaining_day.value);
|
state.switch_sale_shipment_remaining_day_value = parseToBoolean(state.switch_sale_shipment_remaining_day.value);
|
state.switch_sale_order_remaining_day_value = parseToBoolean(state.switch_sale_order_remaining_day.value);
|
state.switch_warehouse_inventory_level_value = parseToBoolean(state.switch_warehouse_inventory_level.value);
|
state.switch_warehouse_inventory_overstock_day_value = parseToBoolean(state.switch_warehouse_inventory_overstock_day.value);
|
state.switch_financial_payment_remaining_day_value = parseToBoolean(state.switch_financial_payment_remaining_day.value);
|
state.switch_financial_collection_remaining_day_value = parseToBoolean(state.switch_financial_collection_remaining_day.value);
|
|
state.languages = state.configs.filter(e => e.category === 'language');
|
localStorage.setItem("languages", JSON.stringify(state.languages));
|
}
|
}
|
}).catch(err => {
|
console.error(err);
|
});
|
};
|
const addLanguage = () => {
|
proxy.$refs['newLanguageDialog'].validate(valid => {
|
if (valid) {
|
proxy.$confirm(`${proxy.$t('message.AreYouSureToSubmit')}`, `${proxy.$t('label.SystemConfirm')}`, {
|
confirmButtonText: `${proxy.$t('button.Yes')}`,
|
cancelButtonText: `${proxy.$t('button.No')}`,
|
type: 'warning',
|
center: true
|
}).then(() => {
|
const rLoading = proxy.openLoading("#newLanguageDialog");
|
CreateConfig(state.language)
|
.then(resp => {
|
if (resp.data && resp.data.code === 200) {
|
state.dialogVisible = false
|
LoadData()
|
} else {
|
proxy.$message.error({message: `${proxy.$t('message.' + resp.data.message)}`});
|
}
|
rLoading.close();
|
})
|
.catch(error => {
|
console.error(error);
|
proxy.$message.error({message: error});
|
});
|
}).catch((error) => {
|
console.error(error)
|
});
|
}
|
});
|
};
|
const displayLanguage = (data) => {
|
proxy.$confirm(`${proxy.$t('message.AreYouSureToSubmit')}`, `${proxy.$t('label.SystemConfirm')}`, {
|
confirmButtonText: `${proxy.$t('button.Yes')}`,
|
cancelButtonText: `${proxy.$t('button.No')}`,
|
confirmButtonClass: 'confirmButtonClass',
|
cancelButtonClass: 'cancelButtonClass',
|
type: 'warning',
|
center: true
|
}).then(() => {
|
let targetLang = state.languages.find(e => e.key === data.key);
|
let language = targetLang.key;
|
if (language) {
|
Cookies.set("language", language, {domain: WGURL.cookieDomain});
|
|
proxy.$confirm(`${proxy.$t('message.AreYouSureToReload')}`, `${proxy.$t('label.SystemConfirm')}`, {
|
confirmButtonText: `${proxy.$t('button.Yes')}`,
|
cancelButtonText: `${proxy.$t('button.No')}`,
|
type: 'warning',
|
center: true
|
}).then(() => {
|
window.history.go(0);
|
}).catch((error) => {
|
console.error(error)
|
})
|
}
|
}).catch((error) => {
|
console.error(error)
|
state.loading = false;
|
});
|
};
|
const deleteLanguage = (data) => {
|
proxy.$confirm(`${proxy.$t('message.AreYouSureToRemove')}`, `${proxy.$t('label.SystemConfirm')}`, {
|
confirmButtonText: `${proxy.$t('button.Yes')}`,
|
cancelButtonText: `${proxy.$t('button.No')}`,
|
confirmButtonClass: 'confirmButtonClass',
|
cancelButtonClass: 'cancelButtonClass',
|
type: 'warning',
|
center: true
|
}).then(() => {
|
state.loading = true;
|
DeleteConfig(data.id)
|
.then(resp => {
|
if (resp.data && resp.data.code === 200) {
|
LoadData()
|
} else {
|
state.loading = false;
|
proxy.$message.error({message: `${proxy.$t('message.' + resp.data.message)}`});
|
}
|
})
|
.catch(error => {
|
proxy.$message.error({message: error});
|
});
|
}).catch((error) => {
|
console.error(error)
|
state.loading = false;
|
});
|
};
|
const showAddLanguageView = () => {
|
}
|
const doUpdateConfig = (config) => {
|
state.loading = true;
|
UpdateConfig(config).then(resp => {
|
if (resp) {
|
if (resp.data && resp.data.code !== 200) {
|
elementplus.ElMessageBox.alert(
|
`${proxy.$t('message.' + resp.data.message)}`, '',
|
{confirmButtonText: 'OK', type: 'error',});
|
} else {
|
LoadData();
|
}
|
}
|
state.loading = false;
|
}).catch(err => {
|
console.error(err);
|
state.loading = false;
|
});
|
}
|
|
const onSubmit_PCRDV = (data) => {
|
state.purchase_contract_remaining_day.value = data;
|
doUpdateConfig(state.purchase_contract_remaining_day);
|
}
|
const onSubmit_PSRDV = (data) => {
|
state.purchase_shipment_remaining_day.value = data;
|
doUpdateConfig(state.purchase_shipment_remaining_day);
|
}
|
const onSubmit_PORDV = (data) => {
|
state.purchase_order_remaining_day.value = data;
|
doUpdateConfig(state.purchase_order_remaining_day);
|
}
|
const onSubmit_SCRDV = (data) => {
|
state.sale_contract_remaining_day.value = data;
|
doUpdateConfig(state.sale_contract_remaining_day);
|
}
|
const onSubmit_SSRDV = (data) => {
|
state.sale_shipment_remaining_day.value = data;
|
doUpdateConfig(state.sale_shipment_remaining_day);
|
}
|
const onSubmit_SORDV = (data) => {
|
state.sale_order_remaining_day.value = data;
|
doUpdateConfig(state.sale_order_remaining_day);
|
}
|
const onSubmit_WIMAXLV = (data) => {
|
state.warehouse_inventory_max_level.value = data;
|
doUpdateConfig(state.warehouse_inventory_max_level);
|
}
|
const onSubmit_WIMINLV = (data) => {
|
state.warehouse_inventory_min_level.value = data;
|
doUpdateConfig(state.warehouse_inventory_min_level);
|
}
|
const onSubmit_WIODV = (data) => {
|
state.warehouse_inventory_overstock_day.value = data;
|
doUpdateConfig(state.warehouse_inventory_overstock_day);
|
}
|
const onSubmit_FPRDV = (data) => {
|
state.financial_payment_remaining_day.value = data;
|
doUpdateConfig(state.financial_payment_remaining_day);
|
}
|
const onSubmit_FCRDV = (data) => {
|
state.financial_collection_remaining_day.value = data;
|
doUpdateConfig(state.financial_collection_remaining_day);
|
}
|
const onSubmit_S_PCRDV = (data) => {
|
state.switch_purchase_contract_remaining_day.value = data;
|
doUpdateConfig(state.switch_purchase_contract_remaining_day);
|
}
|
const onSubmit_S_PSRDV = (data) => {
|
state.switch_purchase_shipment_remaining_day.value = data;
|
doUpdateConfig(state.switch_purchase_shipment_remaining_day);
|
}
|
const onSubmit_S_PORDV = (data) => {
|
state.switch_purchase_order_remaining_day.value = data;
|
doUpdateConfig(state.switch_purchase_order_remaining_day);
|
}
|
const onSubmit_S_SCRDV = (data) => {
|
state.switch_sale_contract_remaining_day.value = data;
|
doUpdateConfig(state.switch_sale_contract_remaining_day);
|
}
|
const onSubmit_S_SSRDV = (data) => {
|
state.switch_sale_shipment_remaining_day.value = data;
|
doUpdateConfig(state.switch_sale_shipment_remaining_day);
|
}
|
const onSubmit_S_SORDV = (data) => {
|
state.switch_sale_order_remaining_day.value = data;
|
doUpdateConfig(state.switch_sale_order_remaining_day);
|
}
|
const onSubmit_S_WILDV = (data) => {
|
state.switch_warehouse_inventory_level.value = data;
|
doUpdateConfig(state.switch_warehouse_inventory_level);
|
}
|
const onSubmit_S_WIODV = (data) => {
|
state.switch_warehouse_inventory_overstock_day.value = data;
|
doUpdateConfig(state.switch_warehouse_inventory_overstock_day);
|
}
|
const onSubmit_S_FPRDV = (data) => {
|
state.switch_financial_payment_remaining_day.value = data;
|
doUpdateConfig(state.switch_financial_payment_remaining_day);
|
}
|
const onSubmit_S_FCRDV = (data) => {
|
state.switch_financial_collection_remaining_day.value = data;
|
doUpdateConfig(state.switch_financial_collection_remaining_day);
|
};
|
|
return {
|
...toRefs(state),
|
addLanguage,
|
displayLanguage,
|
deleteLanguage,
|
icon, parseToBoolean,
|
showAddLanguageView,
|
onSubmit_PCRDV,
|
onSubmit_PSRDV,
|
onSubmit_PORDV,
|
onSubmit_SCRDV,
|
onSubmit_SSRDV,
|
onSubmit_SORDV,
|
onSubmit_WIMAXLV,
|
onSubmit_WIMINLV,
|
onSubmit_WIODV,
|
onSubmit_FPRDV,
|
onSubmit_FCRDV,
|
onSubmit_S_PCRDV,
|
onSubmit_S_PSRDV,
|
onSubmit_S_PORDV,
|
onSubmit_S_SCRDV,
|
onSubmit_S_SSRDV,
|
onSubmit_S_SORDV,
|
onSubmit_S_WILDV,
|
onSubmit_S_WIODV,
|
onSubmit_S_FPRDV,
|
onSubmit_S_FCRDV
|
}
|
},
|
}
|
</script>
|
|
<style>
|
|
</style>
|