<template>
|
<basic-container class="code-total" style=" height: 100%">
|
<!-- 编码规则信息展示区域 -->
|
<basic-container class="code-rule-container">
|
<p
|
style="
|
margin-top: -5px;
|
margin-bottom: 4px;
|
font-weight: 570;
|
font-size: 19px;
|
color: #0e2d5f;
|
"
|
>
|
编码规则
|
</p>
|
<avue-crud
|
ref="crud"
|
v-model="ruleForm"
|
:before-open="beforeOpen"
|
:data="data"
|
:option="optionRule"
|
:page.sync="page"
|
:permission="permissionList"
|
:table-loading="loading"
|
class="code-rule-crud"
|
@row-click="codeRuleRowClick"
|
@row-update="rowUpdate"
|
@row-save="rowSave"
|
@search-change="searchChange"
|
@search-reset="searchReset"
|
@selection-change="selectionChange"
|
@current-change="currentChange"
|
@size-change="sizeChange"
|
@refresh-change="refreshChange"
|
@on-load="onLoad"
|
>
|
<!-- 表格内操作按钮 -->
|
<template slot="menu" slot-scope="scope">
|
<el-button v-if="permissionList.editBtn && (scope.row.lcStatus == 'Editing' ? true : false)"
|
icon="el-icon-edit"
|
plain
|
size="small"
|
type="text"
|
@click="openEdit(scope.row)"
|
>编 辑
|
</el-button>
|
<el-button v-if="permissionList.releaseBtn && (scope.row.lcStatus == 'Editing' ? true : false)"
|
:loading="releadDisabled"
|
icon="el-icon-position"
|
plain
|
size="small"
|
type="text"
|
@click="enableOrDeactivatse(scope.row.oid, 'release')"
|
>发 布
|
</el-button>
|
<el-button v-if="permissionList.deactivateBtn && (scope.row.lcStatus == 'Released' ? true : false)"
|
icon="el-icon-video-pause"
|
plain
|
size="small"
|
type="text"
|
@click="enableOrDeactivatse(scope.row.oid, 'disable')"
|
>停 用
|
</el-button>
|
<el-button v-if="permissionList.enableBtn && (scope.row.lcStatus == 'Disabled' ? true : false)"
|
icon="el-icon-video-play"
|
plain
|
size="small"
|
type="text"
|
@click="enableOrDeactivatse(scope.row.oid, 'enable')"
|
>启 用
|
</el-button>
|
</template>
|
<!-- 表格上方按钮区域 -->
|
<template slot="menuLeft" slot-scope="scope">
|
<el-button v-if="permissionList.rulDelBtn"
|
icon="el-icon-delete"
|
plain
|
size="small"
|
type="danger"
|
@click="handleDelete"
|
>
|
删 除
|
</el-button>
|
<el-button v-if="permissionList.advancedQueryBtn"
|
icon="el-icon-search"
|
plain
|
size="small"
|
type="primary"
|
@click="openAdvancedQuery('codeRule')">
|
高级查询
|
</el-button>
|
<el-button v-if="permissionList.cloneBtn"
|
icon="icon-kelong"
|
plain
|
size="small"
|
@click="openCodeRuleDialog"
|
>
|
克 隆
|
</el-button>
|
<el-button v-if="permissionList.otherCloneBtn"
|
icon="icon-lianjiekelong"
|
plain
|
size="small"
|
style="font-size: 12px"
|
@click="openOtherCodeRuleDialog"
|
>
|
从其他规则中克隆码段
|
</el-button>
|
<el-button v-if="permissionList.usescopeBtn"
|
icon="el-icon-s-help"
|
plain
|
size="small"
|
@click="handleRange"
|
>
|
使用范围
|
</el-button>
|
<el-button v-if="permissionList.clearBtn"
|
icon="icon-qingkong"
|
plain
|
size="small"
|
@click="clearAllCodeSec"
|
>
|
清空码值
|
</el-button>
|
<el-button v-if="permissionList.escapeOwnerBtn"
|
icon="el-icon-guide"
|
plain
|
size="small"
|
@click="escapeOwner"
|
>
|
转移所有者
|
</el-button>
|
<el-button v-if="permissionList.maxSerialnumBtn"
|
icon="el-icon-data-analysis"
|
plain
|
size="small"
|
@click="maxSerialNum"
|
>
|
最大流水号
|
</el-button>
|
</template>
|
</avue-crud>
|
</basic-container>
|
|
<!-- 高级查询对话框 -->
|
<advanced-query
|
:ref="advancedQueryParam.ref"
|
:options="advancedQueryParam.options"
|
:visible.sync="advancedQueryParam.advancedQuerySettingBox"
|
@echoContion="echoSeniorContionMap"
|
>
|
</advanced-query>
|
|
<!-- 以下是编码规则相关对话框 -->
|
<el-dialog
|
:visible.sync="codeRangeSettingBox"
|
append-to-body
|
class="avue-dialog avue-dialog--top"
|
style="height: 100vh"
|
title="编码规则使用范围"
|
top="-3%"
|
width="800px"
|
>
|
<avue-crud
|
:data="useRangeData"
|
:option="dialogeOption"
|
:table-loading="dialogLoading"
|
style="margin-top: -40px"
|
@refresh-change="refreshUseRangeChange"
|
>
|
</avue-crud>
|
</el-dialog>
|
|
<!-- 编码规则,克隆对话框 -->
|
<clone-rule-dialog
|
:ruleData="selectionList[0]"
|
:visible.sync="cloneSettingBox"
|
@refreshRuleTable="onLoad">
|
</clone-rule-dialog>
|
|
<!-- 编码规则,从其他规则克隆对话框 -->
|
<clone-other-basic-sec-dialog
|
:quiltCloneCodeRule="selectionList[0]"
|
:visible.sync="cloneOtherCodeRuleSettingBox"
|
@refreshRuleTable="onLoad">
|
</clone-other-basic-sec-dialog>
|
|
<!-- 编码规则,转移所有者对话框 -->
|
<el-dialog
|
:visible.sync="escapeOwnerVisible"
|
append-to-body
|
class="avue-dialog avue-dialog--top"
|
title="转移所有者"
|
width="30%"
|
>
|
<el-select v-model="ruleOwner" class="selects" placeholder="请选择">
|
<el-option
|
v-for="item in ruleAdminUserList"
|
:key="item.VALUE"
|
:label="item.LABLE"
|
:value="item.VALUE"
|
class="seloption"
|
>
|
</el-option>
|
</el-select>
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="escapeOwnerVisible = false">取 消</el-button>
|
<el-button type="primary" @click="escapeOwnerConfirm">确 定</el-button>
|
</span>
|
</el-dialog>
|
|
<!-- 最大流水号对话框 -->
|
<max-serialnum-dialog
|
:ruleOid="maxSerial.ruleOid"
|
:visible.sync="maxSerial.visible"
|
></max-serialnum-dialog>
|
|
<!-- 基础码段展示区域 -->
|
<basic-container class="code-basicsec-container">
|
<p
|
style="margin-top: -5px;
|
margin-bottom: 4px;
|
font-weight: 570;
|
font-size: 19px;
|
color: #0e2d5f;">
|
码段管理
|
</p>
|
<avue-crud
|
ref="crudBasic"
|
:data="basicData"
|
:option="optionBasic"
|
:permission="basicPermissionList"
|
:table-loading="loadingBasic"
|
class="code-basic-crud"
|
@row-click="codeBasicSecRowClick"
|
@search-change="basicSearchChange"
|
@search-reset="basicSearchReset"
|
@selection-change="selectionBasicChange"
|
@refresh-change="refreshChangeBasicSec"
|
>
|
<!-- 基础码段表格内操作按钮 -->
|
<template slot="menu" slot-scope="scope">
|
<el-button v-if="basicPermissionList.viewBtn && currentRuleLcStatus != 'Editing'"
|
icon="el-icon-view"
|
plain
|
size="small"
|
type="text"
|
@click="openBasicDialog('view', scope.row)"
|
>查看
|
</el-button>
|
<el-button v-if="basicPermissionList.editBtn && currentRuleLcStatus === 'Editing'"
|
icon="el-icon-edit"
|
plain
|
size="small"
|
type="text"
|
@click="openBasicDialog('edit', scope.row)"
|
>编辑
|
</el-button>
|
<el-button
|
v-if="basicPermissionList.basicMgrBtn && (scope.row.secType === 'codeclassifysec' || scope.row.secType == 'codefixedsec')"
|
icon="el-icon-setting"
|
plain
|
size="small"
|
type="text"
|
@click="openBasicSecCodeValueMgr(scope.row)"
|
>码值管理
|
</el-button>
|
<el-button v-if="basicPermissionList.basicMoveupBtn && scope.row.orderNum > 1"
|
icon="el-icon-arrow-up"
|
plain
|
size="small"
|
type="text"
|
@click="upOrderNum(scope.row)"
|
>上移
|
</el-button>
|
<el-button v-if="basicPermissionList.basicDownBtn"
|
icon="el-icon-arrow-down"
|
plain
|
size="small"
|
type="text"
|
@click="downOrderNum(scope.row)"
|
>下移
|
</el-button>
|
</template>
|
|
<!-- 基础码段表格左上方按钮区域 -->
|
<template slot="menuLeft" slot-scope="scope">
|
<el-button v-if="basicPermissionList.addBtn"
|
:disabled="selectionList.length <= 0"
|
icon="el-icon-plus"
|
size="small"
|
type="primary"
|
@click="openAddBasicCodeSec"
|
>
|
新 增
|
</el-button>
|
<el-button v-if="basicPermissionList.basicDelBtn"
|
:disabled="selectionList.length <= 0"
|
icon="el-icon-delete"
|
plain
|
size="small"
|
type="danger"
|
@click="deleteBasicCode(scope.row)"
|
>
|
删 除
|
</el-button>
|
<el-button v-if="basicPermissionList.basicAdvancedQueryBtn"
|
:disabled="selectionList.length <= 0"
|
icon="el-icon-search"
|
plain
|
size="small"
|
type="primary"
|
@click="openAdvancedQuery('codeBasicSec')"
|
>
|
高级查询
|
</el-button>
|
</template>
|
</avue-crud>
|
</basic-container>
|
|
<!-- 码段码值管理对话框 -->
|
<el-dialog
|
:visible.sync="isShowBasicSecCodeValueMgr"
|
:width="isShowFixedForm ? '69vw' : '50vw'"
|
append-to-body
|
class="avue-dialog avue-dialog--top"
|
destroy-on-close
|
style="height: 110vh"
|
title="码段码值管理"
|
top="-3%"
|
@close="clearFixedOrClassifyForm('close')"
|
>
|
<!-- 分类码段码值管理 -->
|
<el-row v-show="!isShowFixedForm">
|
<el-col :span="11">
|
<basic-container style="overflow:hidden">
|
<div
|
class="box classify_value_box"
|
style="height: 60vh; margin-bottom: -40px"
|
>
|
<basic-container>
|
<div class="abox">
|
<avue-tree
|
:data="classifyValueTreeData"
|
:option="classisyValueTreeOption"
|
style="height: calc(60vh - 100px);"
|
@node-click="classisyValueTreeOnodeClick"
|
/>
|
</div>
|
</basic-container>
|
</div>
|
<div
|
style="
|
margin-top: 20px;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
"
|
>
|
<el-button
|
class="button"
|
icon="el-icon-arrow-up"
|
size="mini"
|
type="primary"
|
@click="codeClassifyValueOpetion('up')"
|
>上移
|
</el-button>
|
<el-button
|
class="button"
|
icon="el-icon-arrow-down"
|
size="mini"
|
type="primary"
|
@click="codeClassifyValueOpetion('down')"
|
>下移
|
</el-button>
|
</div>
|
</basic-container>
|
</el-col>
|
<el-col :span="13">
|
<basic-container>
|
<div class="box" style="height: 60vh; margin-bottom: -40px">
|
<el-form>
|
<el-form-item :label-width="50" label="码值:" required>
|
<el-input
|
v-model="codeClassifyForm.id"
|
style="width: 18vw"
|
></el-input>
|
</el-form-item>
|
<el-form-item :label-width="50" label="名称:" required>
|
<el-input
|
v-model="codeClassifyForm.name"
|
style="width: 18vw"
|
></el-input>
|
</el-form-item>
|
</el-form>
|
</div>
|
<div
|
style="
|
margin-top: 20px;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
"
|
>
|
<el-button
|
class="button"
|
icon="el-icon-circle-plus"
|
size="mini"
|
type="primary"
|
@click="addCodeSecValue('codeclassifyvaluesec')"
|
>添加
|
</el-button>
|
<el-button
|
:disabled="selectedFixedOrCodeclassifyValue == ''"
|
class="button"
|
icon="el-icon-edit-outline"
|
plain
|
size="mini"
|
type="success"
|
@click="editCodeSecValue('codeclassifyvaluesec')"
|
>修改
|
</el-button>
|
<el-button
|
:disabled="selectedFixedOrCodeclassifyValue == ''"
|
class="button"
|
icon="el-icon-close"
|
size="mini"
|
type="danger"
|
@click="delCodeSecValue('codeclassifyvaluesec')"
|
>删除
|
</el-button>
|
<el-button
|
class="button"
|
icon="el-icon-close"
|
plain
|
size="mini"
|
type="warning"
|
@click="clearFixedOrClassifyForm('codeclassifyvaluesec')"
|
>取消
|
</el-button>
|
</div>
|
</basic-container>
|
</el-col>
|
</el-row>
|
<!-- 固定码段码值管理 -->
|
<el-row v-show="isShowFixedForm">
|
<el-col :span="15">
|
<basic-container>
|
<div
|
class="box fixedbox"
|
style="height: 63vh; margin-bottom: -40px"
|
>
|
<avue-crud
|
ref="crudFixedValue"
|
:data="fixedValueData"
|
:option="fixedValueOption"
|
:table-loading="fixedValueOptionLoading"
|
class="fixed-avue-crud"
|
@row-click="selectedCodeValueRow"
|
>
|
<!-- 表格内按钮配置 -->
|
<template slot="menu" slot-scope="scope">
|
<el-button
|
icon="el-icon-arrow-up"
|
size="mini"
|
type="text"
|
@click="codeFixedValueOpetion('up', scope.row)"
|
>上移
|
</el-button>
|
<el-button
|
icon="el-icon-arrow-down"
|
size="mini"
|
type="text"
|
@click="codeFixedValueOpetion('down', scope.row)"
|
>下移
|
</el-button>
|
<el-button
|
icon="el-icon-minus"
|
size="mini"
|
type="text"
|
@click="codeFixedValueOpetion('remove', scope.row)"
|
>移除
|
</el-button>
|
</template>
|
</avue-crud>
|
</div>
|
<div style="margin-top: 10px">
|
<el-button
|
class="button"
|
icon="el-icon-success"
|
size="mini"
|
type="primary"
|
@click="saveCodeFixedOrClassifyValueOption('fixedValue')"
|
>保存
|
</el-button>
|
</div>
|
</basic-container>
|
</el-col>
|
<el-col :span="9">
|
<basic-container>
|
<div
|
class="box"
|
style="height: 63vh; margin-bottom: -40px; overflow: hidden"
|
>
|
<div style="overflow-y: auto; height: 58vh">
|
<el-form>
|
<el-form-item label="码值:" label-width="54px" required>
|
<el-input
|
v-model="codeFixdForm.id"
|
style="width: 19.5vw"
|
></el-input>
|
</el-form-item>
|
<el-form-item label="描述:" label-width="54px">
|
<el-input
|
v-model="codeFixdForm.description"
|
style="width: 19.5vw"
|
type="textarea"
|
></el-input>
|
</el-form-item>
|
</el-form>
|
</div>
|
</div>
|
<div
|
style="
|
margin-top: 10px;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
"
|
>
|
<el-button
|
:disabled="selectedFixedOrCodeclassifyValue != ''"
|
class="button"
|
icon="el-icon-circle-plus"
|
size="mini"
|
type="primary"
|
@click="addCodeSecValue('codefixedsec')"
|
>添加
|
</el-button>
|
<el-button
|
:disabled="selectedFixedOrCodeclassifyValue == ''"
|
class="button"
|
icon="el-icon-edit-outline"
|
plain
|
size="mini"
|
type="success"
|
@click="editCodeSecValue('codefixedsec')"
|
>修改
|
</el-button>
|
<el-button
|
:disabled="selectedFixedOrCodeclassifyValue == ''"
|
class="button"
|
icon="el-icon-close"
|
size="mini"
|
type="danger"
|
@click="delCodeSecValue('codefixedsec')"
|
>删除
|
</el-button>
|
<el-button
|
class="button"
|
icon="el-icon-close"
|
plain
|
size="mini"
|
type="warning"
|
@click="clearFixedOrClassifyForm('codefixedsec')"
|
>取消
|
</el-button>
|
</div>
|
</basic-container>
|
</el-col>
|
</el-row>
|
</el-dialog>
|
|
<!-- 基础码段新增相关对话框 -->
|
<el-dialog
|
:close-on-click-modal="false"
|
:title="basicSecDialogTitle"
|
:visible.sync="addBasicCodeSettingBox"
|
append-to-body
|
class="avue-dialog avue-dialog--top add-basicsec-dialog"
|
destroy-on-close
|
lock-scroll
|
style="height: 105vh"
|
top="-3%"
|
width="900px"
|
@close="clearBasicAddForm"
|
>
|
<!-- 第一层对话框,添加码段信息对话框中的内容 -->
|
<div class="add-basicsec-total">
|
<el-form :model="form" class="add-basicsec-form" :rules="rules" >
|
<span class="left">
|
<el-form-item
|
:label-width="leftFormLabelWidth"
|
label="码段编号:"
|
required
|
>
|
<el-input
|
ref="id"
|
v-model="form.id"
|
:readonly="basicSecOnlyRead"
|
></el-input>
|
</el-form-item>
|
|
<el-form-item
|
:label-width="leftFormLabelWidth"
|
label="码段名称:"
|
required
|
>
|
<el-input
|
ref="name"
|
v-model="form.name"
|
:readonly="basicSecOnlyRead"
|
></el-input>
|
</el-form-item>
|
|
<el-form-item
|
:label-width="leftFormLabelWidth"
|
label="码段类型:"
|
required
|
>
|
<el-select
|
v-model="form.secType"
|
:disabled="basicSecOnlyRead"
|
placeholder="请选择"
|
@change="changeSectypeFormItems(null)"
|
>
|
<el-option
|
v-for="item in enumParam.secTypeList"
|
:key="item.itemValue"
|
:label="item.itemName"
|
:value="item.itemValue"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
|
<el-form-item
|
:label-width="leftFormLabelWidth"
|
label="前缀:">
|
<el-input
|
v-model="form.prefixCode"
|
:readonly="basicSecOnlyRead"
|
></el-input>
|
</el-form-item>
|
|
<el-form-item
|
:label-width="leftFormLabelWidth"
|
label="后缀:">
|
<el-input
|
v-model="form.suffixCode"
|
:readonly="basicSecOnlyRead">
|
</el-input>
|
</el-form-item>
|
|
<el-form-item :label-width="leftFormLabelWidth" label="描述:">
|
<el-input
|
v-model="form.description"
|
:readonly="basicSecOnlyRead"
|
type="textarea"
|
></el-input>
|
</el-form-item>
|
|
<el-form-item
|
:label-width="leftFormLabelWidth"
|
label="是否流水依赖:"
|
>
|
<el-switch
|
v-model="form.serialDependFlag"
|
:disabled="basicSecOnlyRead"
|
style="margin-right: 20px"
|
></el-switch>
|
<!-- <el-input-number
|
v-show="form.serialDependFlag"
|
v-model="form.serialDependOrder"
|
:readonly="basicSecOnlyRead"
|
controls-position="right"
|
></el-input-number> -->
|
</el-form-item>
|
|
<el-form-item :label-width="leftFormLabelWidth" label="是否为空:">
|
<el-switch
|
v-model="form.nullableFlag"
|
:disabled="basicSecOnlyRead"
|
></el-switch>
|
</el-form-item>
|
</span>
|
<el-divider direction="vertical"></el-divider>
|
<span class="right">
|
<!-- 固定码段 -->
|
<div v-show="form.secType === 'codefixedsec' ? true : false">
|
<el-form-item
|
:label-width="rightFormLabelWidth"
|
label="码段长度类型:"
|
required
|
>
|
<el-select
|
v-model="form.codeSecLengthType"
|
:disabled="basicSecOnlyRead"
|
placeholder="请选择"
|
>
|
<el-option
|
v-for="item in enumParam.codeSecLengthType"
|
:key="item.itemValue"
|
:label="item.itemName"
|
:value="item.itemValue"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item
|
:label-width="rightFormLabelWidth"
|
label="码段的长度:"
|
required
|
>
|
<el-input
|
ref="codeSecLength"
|
v-model.number="form.codeSecLength"
|
:readonly="basicSecOnlyRead"
|
></el-input>
|
</el-form-item>
|
</div>
|
<!-- 属性码段 -->
|
<div v-show="form.secType === 'codeattrsec' ? true : false">
|
<el-form-item
|
:label-width="rightFormLabelWidth"
|
label="属性:"
|
required
|
>
|
<el-input
|
ref="referAttributeId"
|
v-model="form.referAttributeName"
|
:disabled="basicSecOnlyRead"
|
placeholder="请选择"
|
prefix-icon="el-icon-search"
|
readonly="true"
|
@focus="openAttrSelectOrGetValue('attr')"
|
>
|
<i
|
slot="suffix"
|
class="el-icon-circle-close"
|
style="cursor: pointer"
|
@click="clearAttrDataByIcon('attr')"
|
></i>
|
</el-input>
|
</el-form-item>
|
<el-form-item
|
:label-width="rightFormLabelWidth"
|
label="属性所在分类:"
|
>
|
<el-input v-model="form.referCodeClassifyOidName" disabled>
|
</el-input>
|
</el-form-item>
|
<el-form-item
|
:label-width="rightFormLabelWidth"
|
label="取值规则:"
|
>
|
<el-input
|
v-model="form.getValueClass"
|
:disabled="basicSecOnlyRead"
|
placeholder="请选择"
|
prefix-icon="el-icon-search"
|
readonly="true"
|
@focus="openAttrSelectOrGetValue('value')"
|
>
|
<i
|
slot="suffix"
|
class="el-icon-circle-close"
|
style="margin-right: 5px; cursor: pointer"
|
@click="clearAttrDataByIcon('value')"
|
></i>
|
</el-input>
|
</el-form-item>
|
</div>
|
<!-- 流水码段 -->
|
<div v-show="form.secType === 'codeserialsec' ? true : false">
|
<el-form-item
|
:label-width="rightFormLabelWidth"
|
label="码段的长度:"
|
required
|
>
|
<el-input
|
ref="seriaCodeSecLength"
|
v-model.number="form.codeSecLength"
|
:readonly="basicSecOnlyRead"
|
></el-input>
|
</el-form-item>
|
<el-form-item
|
:label-width="rightFormLabelWidth"
|
label="流水号的起始值:"
|
>
|
<el-input
|
ref="serialStart"
|
v-model.number="form.serialStart"
|
:readonly="basicSecOnlyRead"
|
></el-input>
|
</el-form-item>
|
<el-form-item
|
:label-width="rightFormLabelWidth"
|
label="流水的步长:"
|
>
|
<el-input
|
ref="serialStep"
|
v-model.number="form.serialStep"
|
:readonly="basicSecOnlyRead"
|
></el-input>
|
</el-form-item>
|
<el-form-item
|
:label-width="rightFormLabelWidth"
|
label="编码补位方式:"
|
required
|
>
|
<el-select
|
v-model="form.codeFillType"
|
:disabled="basicSecOnlyRead"
|
placeholder="请选择"
|
>
|
<el-option
|
v-for="item in enumParam.codeFillType"
|
:key="item.itemValue"
|
:label="item.itemName"
|
:value="item.itemValue"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item
|
v-if="form.codeFillType != 'code_fill_none'"
|
:label-width="rightFormLabelWidth"
|
label="补位时的字符:"
|
>
|
<el-select
|
v-model="form.codeFillSeparator"
|
:disabled="basicSecOnlyRead"
|
filterable
|
placeholder="请选择"
|
@blur="inputSelectBlur"
|
>
|
<el-option
|
v-for="item in enumParam.codeFillSeparator"
|
:key="item.dictKey"
|
:label="item.dictValue"
|
:value="item.dictValue"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item
|
:label-width="rightFormLabelWidth"
|
label="填充长度:"
|
required
|
>
|
<el-input
|
ref="codeFillLength"
|
v-model.number="form.codeFillLength"
|
:readonly="basicSecOnlyRead"
|
></el-input>
|
</el-form-item>
|
<el-form-item
|
:label-width="rightFormLabelWidth"
|
label="流水上限:"
|
required
|
>
|
<el-input
|
ref="codeFillLimit"
|
v-model.number="form.codeFillLimit"
|
:readonly="basicSecOnlyRead"
|
></el-input>
|
</el-form-item>
|
<el-form-item
|
:label-width="rightFormLabelWidth"
|
label="流水是否补码:"
|
required
|
>
|
<el-switch
|
v-model="form.codeFillFlag"
|
:disabled="basicSecOnlyRead"
|
></el-switch>
|
</el-form-item>
|
<el-form-item
|
:label-width="rightFormLabelWidth"
|
label="自定义的流水算法:"
|
>
|
<template>
|
<vciWebRefer
|
ref="refer"
|
:referConfig="this.referConfig || {}"
|
:display="true"
|
:value="form.customCodeSerialClass"
|
:text="form.customCodeSerialClassText"
|
:serialType="form.serialType"
|
@setReferValue="setReferValue"
|
></vciWebRefer>
|
</template>
|
|
|
</el-form-item>
|
</div>
|
<!-- 层级码段 -->
|
<div v-show="form.secType === 'codelevelsec' ? true : false">
|
<el-form-item
|
:label-width="rightFormLabelWidth"
|
label="层级类型:"
|
required
|
>
|
<el-select
|
v-model="form.codeLevelType"
|
:disabled="basicSecOnlyRead"
|
placeholder="请选择"
|
>
|
<el-option
|
v-for="item in enumParam.codeLevelType"
|
:key="item.itemValue"
|
:label="item.itemName"
|
:value="item.itemValue"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item
|
:label-width="rightFormLabelWidth"
|
label="层级的值:"
|
>
|
<el-input
|
ref="codeLevelValue"
|
v-model.number="form.codeLevelValue"
|
:readonly="basicSecOnlyRead"
|
></el-input>
|
</el-form-item>
|
<el-form-item
|
:label-width="rightFormLabelWidth"
|
label="字符截取类型:"
|
required
|
>
|
<el-select
|
v-model="form.valueCutType"
|
:disabled="basicSecOnlyRead"
|
placeholder="请选择"
|
@change="changeCutType($event)"
|
>
|
<el-option
|
v-for="item in enumParam.codeCutType"
|
:key="item.itemValue"
|
:label="item.itemName"
|
:value="item.itemValue"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item
|
v-if="form.valueCutType != 'code_cut_none'"
|
id="ShowOrHide"
|
:label-width="rightFormLabelWidth"
|
label="值截取长度:"
|
>
|
<el-input
|
ref="valueCutLength"
|
v-model.number="form.valueCutLength"
|
:readonly="basicSecOnlyRead"
|
></el-input>
|
</el-form-item>
|
<el-form-item
|
:label-width="rightFormLabelWidth"
|
label="取值类型:"
|
>
|
<el-select
|
v-model="form.codeGetValueType"
|
:disabled="basicSecOnlyRead"
|
placeholder="请选择"
|
>
|
<el-option
|
v-for="item in enumParam.codeGetValueType"
|
:key="item.itemValue"
|
:label="item.itemName"
|
:value="item.itemValue"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</div>
|
<!-- 引用码段 -->
|
<div v-show="form.secType === 'coderefersec' ? true : false">
|
<el-form-item
|
label="参照引用的业务类型:"
|
label-width="152px"
|
required
|
>
|
<el-input
|
ref="referBtmId"
|
v-model="form.referBtmName"
|
:disabled="basicSecOnlyRead"
|
placeholder="请选择"
|
prefix-icon="el-icon-search"
|
readonly="true"
|
@focus="openAttrSelectOrGetValue('referBtmId')"
|
>
|
<i
|
slot="suffix"
|
class="el-icon-circle-close"
|
style="margin-right: 5px; cursor: pointer"
|
@click="clearAttrDataByIcon('referBtmId')"
|
></i>
|
</el-input>
|
</el-form-item>
|
<el-form-item label="参照配置:" label-width="152px" required>
|
<el-input
|
ref="referConfig"
|
v-model="form.referConfig"
|
:disabled="basicSecOnlyRead"
|
placeholder="请选择"
|
prefix-icon="el-icon-search"
|
readonly="true"
|
@focus="openAttrSelectOrGetValue('referConfig')"
|
>
|
<i
|
slot="suffix"
|
class="el-icon-circle-close"
|
style="margin-right: 5px; cursor: pointer"
|
@click="clearAttrDataByIcon('referConfig')"
|
></i>
|
</el-input>
|
</el-form-item>
|
</div>
|
<!-- 日期码段 -->
|
<div v-show="form.secType === 'codedatesec' ? true : false">
|
<el-form-item
|
prop="Dateformat"
|
:label-width="rightFormLabelWidth"
|
label="日期格式:"
|
>
|
<el-input
|
ref="codeDateFormatStr"
|
v-model="form.codeDateFormatStr"
|
:readonly="basicSecOnlyRead"
|
></el-input>
|
</el-form-item>
|
</div>
|
<!-- 分类码段 -->
|
<div v-show="form.secType === 'codeclassifysec' ? true : false">
|
<el-form-item
|
:label-width="rightFormLabelWidth"
|
label="码段长度类型:"
|
required
|
>
|
<el-select
|
v-model="form.codeSecLengthType"
|
:disabled="basicSecOnlyRead"
|
placeholder="请选择"
|
>
|
<el-option
|
v-for="item in enumParam.codeSecLengthType"
|
:key="item.itemValue"
|
:label="item.itemName"
|
:value="item.itemValue"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item
|
:label-width="rightFormLabelWidth"
|
label="码段的长度:"
|
required
|
>
|
<el-input
|
ref="classCodeSecLength"
|
v-model.number="form.codeSecLength"
|
:readonly="basicSecOnlyRead"
|
></el-input>
|
</el-form-item>
|
<el-form-item
|
:label-width="rightFormLabelWidth"
|
label="是否自动分配分类值:"
|
>
|
<el-switch
|
v-model="form.matchClassifyValueFlag"
|
:disabled="basicSecOnlyRead"
|
></el-switch>
|
</el-form-item>
|
<el-form-item
|
:label-width="rightFormLabelWidth"
|
label="父分类码段:"
|
>
|
<el-input
|
v-model="form.parentClassifySecText"
|
:disabled="basicSecOnlyRead"
|
placeholder="请选择"
|
prefix-icon="el-icon-search"
|
readonly="true"
|
@focus="openAttrSelectOrGetValue('parentClassifySecOid')"
|
>
|
<i
|
slot="suffix"
|
class="el-icon-circle-close"
|
style="margin-right: 5px; cursor: pointer"
|
@click="clearAttrDataByIcon('parentClassifySecOid')"
|
></i>
|
</el-input>
|
</el-form-item>
|
</div>
|
<!-- 可变码段 -->
|
<div v-show="form.secType === 'codevariablesec' ? true : false">
|
<el-form-item
|
:label-width="rightFormLabelWidth"
|
label="码段的长度:"
|
required
|
>
|
<el-input
|
ref="varCodeSecLength"
|
v-model.number="form.codeSecLength"
|
:readonly="basicSecOnlyRead"
|
></el-input>
|
</el-form-item>
|
<el-form-item
|
:label-width="rightFormLabelWidth"
|
label="编码补位方式:"
|
required>
|
<el-select
|
v-model="form.codeFillType"
|
:disabled="basicSecOnlyRead"
|
placeholder="请选择"
|
>
|
<el-option
|
v-for="item in enumParam.codeFillType"
|
:key="item.itemValue"
|
:label="item.itemName"
|
:value="item.itemValue"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item
|
v-if="form.codeFillType != 'code_fill_none'"
|
:label-width="rightFormLabelWidth"
|
label="补位时的字符:"
|
>
|
<el-select
|
v-model="form.codeFillSeparator"
|
:disabled="basicSecOnlyRead"
|
filterable
|
placeholder="请选择"
|
@blur="inputSelectBlur"
|
>
|
<el-option
|
v-for="item in enumParam.codeFillSeparator"
|
:key="item.dictKey"
|
:label="item.dictValue"
|
:value="item.dictValue"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</div>
|
</span>
|
</el-form>
|
</div>
|
<!-- 第一层对话框的按钮和分隔线条 -->
|
<!-- <el-divider class="horizontal-line" direction="horizontal"></el-divider> -->
|
<div slot="footer" class="dialog-footer">
|
<el-button
|
:disabled="!showbtn"
|
:loading="isLoadingSecCodeAddBtn"
|
type="primary"
|
@click="saveOrEditBasicCode">保 存
|
</el-button>
|
<el-button @click="addBasicCodeSettingBox = false">取 消</el-button>
|
</div>
|
|
<!-- 第二层对话框,属性码段,属性选择对话框 -->
|
<el-dialog
|
:visible.sync="isShowSelectAttrOption"
|
append-to-body
|
class="avue-dialog avue-dialog--top"
|
style="height: 100%"
|
title="为【属性】选取值"
|
top="-3%"
|
width="78%"
|
>
|
<div style="overflow-y: auto; height: 60vh">
|
<el-row>
|
<!-- 左侧主题库分类树 -->
|
<el-col :span="5">
|
<div class="box">
|
<el-scrollbar
|
style="height: auto; border-bottom-right-radius: 8px"
|
>
|
<basic-container>
|
<div class="treeBox">
|
<avue-tree
|
:data="attrClassifyTreeData"
|
:option="treeOption"
|
@node-click="nodeClick"
|
/>
|
</div>
|
</basic-container>
|
</el-scrollbar>
|
</div>
|
</el-col>
|
<!-- 右侧表格显示区域 -->
|
<el-col span="19">
|
<basic-container>
|
<div class="bbox">
|
<avue-crud
|
:ref="selectAttrParams.ref"
|
:data="selectAttrParams.selectAttrData"
|
:option="selectAttrParams.attrOption"
|
:table-loading="selectAttrParams.selectAttrOptionLoading"
|
@search-change="selectAttrSearchChange"
|
@search-reset="searchAttrReset"
|
@row-click="selectionAttrRowClick"
|
@selection-change="selectionChangeAttr"
|
>
|
</avue-crud>
|
</div>
|
</basic-container>
|
</el-col>
|
</el-row>
|
</div>
|
<div slot="footer" class="dialog-footer">
|
<el-button type="primary" @click="selectedListClassifyLinkAttr">确 定</el-button>
|
<el-button @click="isShowSelectAttrOption = false">取 消</el-button>
|
</div>
|
</el-dialog>
|
|
<!-- 第二层对话框,属性码段,公式编辑框对话框组件 -->
|
<formula-editor
|
ref="formulaEditor"
|
:systemVariableTableData="formulaEditorParams.systemVariableTableData"
|
:thisSceneTableData="formulaEditorParams.thisSceneTableData"
|
:visible.sync="formulaEditorParams.formulaEditorSettingBox"
|
@updateFormulaContent="updateFormulaContent"
|
>
|
</formula-editor>
|
|
<!-- 第二层对话框,为【父分类码段】选取值对话框 -->
|
<el-dialog
|
:visible.sync="parentClsfyParams.isShowParentClassifySettingBox"
|
append-to-body
|
destroy-on-close
|
style="height: 150vh; margin-top: -13vh"
|
title="为【父分类码段】选取值"
|
width="65%"
|
>
|
<avue-crud
|
:ref="parentClsfyParams.ref"
|
:data="parentClsfyParams.parentClassifyData"
|
:option="parentClsfyParams.parentClassifyParentOption"
|
:page.sync="parentClsfyParams.parentClassifyDataPage"
|
:table-loading="parentClsfyParams.classifyDialogLoading"
|
@refresh-change="refreshParentClassifyDataChange"
|
@search-change="parentClassifySearchChange"
|
@search-reset="parentClassifySearchReset"
|
@row-click="parentClassifyRowClick"
|
@selection-change="parentClassifySelectionChange"
|
@current-change="parentClassifyCurrentChange"
|
@size-change="parentClassifySizeChange"
|
@on-load="parentClassifyOnLoad"
|
>
|
</avue-crud>
|
<div slot="footer" class="dialog-footer">
|
<el-button type="primary" @click="saveSelectedParentClassify"
|
>保 存
|
</el-button
|
>
|
<el-button
|
@click="parentClsfyParams.isShowParentClassifySettingBox = false"
|
>取 消
|
</el-button
|
>
|
</div>
|
</el-dialog>
|
|
<!-- 第二层对话框,为【参照引用的业务类型】选取值对话框 -->
|
<refer-btm-type-crud-dialog
|
:ref="referBtmDialogParams.ref"
|
:visible.sync="referBtmDialogParams.selectReferBtmSettingBox"
|
@echoReferBtmType="echoReferBtmType"
|
>
|
</refer-btm-type-crud-dialog>
|
|
<!-- 第二层对话框,参照配置组件 -->
|
<refer-config-dialog
|
:display="referConfigVisble"
|
:referConfigOption="referConfigOption"
|
@setReferConfigValue="setReferConfigValue"
|
>
|
</refer-config-dialog>
|
</el-dialog>
|
|
<!-- 自定义流水参照组件-->
|
|
|
</basic-container>
|
</template>
|
|
<script>
|
import {
|
gridCodeRule,
|
getDetail,
|
add,
|
update,
|
remove,
|
listUseRange,
|
updateStatus,
|
clearAllCode,
|
checkLikeCodeRule,
|
} from "@/api/code/mdmrule";
|
import {
|
gridCodeBasicSec,
|
downOrderNum,
|
upOrderNum,
|
deleteData,
|
editSave,
|
addSave,
|
refDataGridClassifySec,
|
} from "@/api/code/codebasic";
|
import {listClassifyLinkAttr} from "@/api/code/codeclassify";
|
import {
|
gridCodeFixedValue,
|
addSaveCodeFixedValue,
|
deleteCodeFixedValue,
|
editCodeFixedValue,
|
saveOrder,
|
} from "@/api/code/codeFixedValue";
|
import {
|
treeCodeClassifyValue,
|
addSaveCodeClassifyValue,
|
editCodeClassifyValue,
|
deleteCodeClassifyValue,
|
saveCodeClassifyValueOrder,
|
} from "@/api/code/codeClassifyValue";
|
import {getDictionary} from "@/api/omd/enum";
|
import {getDictionaryBiz} from "@/api/system/dictbiz";
|
import optionBasic from "@/const/code/codebasic";
|
import optionRule from "@/const/code/mdmrule";
|
import attrOption from "@/const/code/selectAttrOptionDialog";
|
import treeOption from "@/const/code/classifyTreeOptionDialog";
|
import classisyValueTreeOption from "@/const/code/classisyValueTreeDialog";
|
import parentClassifyParentOption from "@/const/code/parentClassifyParentOptionDialog";
|
import fixedValueOption from "@/const/code/fixedValueMgrDialog";
|
import {mapGetters} from "vuex";
|
import {getByRoleUserList} from "@/api/system/user";
|
import func from "@/util/func";
|
import secTypeEnum from '@/enumpack/CodeSecTypeEnum';
|
import vciWebRefer from "../../components/refer/vciWebRefer";
|
|
export default {
|
components: { vciWebRefer },
|
data() {
|
return {
|
rules: {
|
Dateformat: [
|
{
|
required: true,
|
trigger: 'blur',
|
validator: (rule, value, callback) => {
|
const Formats = ['yy', 'yyyy', 'yyyy-MM', 'yy-MM', 'yyyy-MM-dd','yy-MM-dd', 'yyyy-MM-dd HH:mm:ss', 'yy-MM-dd HH:mm:ss', 'HH:mm:ss'];
|
if (!Formats.includes(this.form.codeDateFormatStr)) {
|
return callback(new Error('请输入正确日期格式,例如yyyy-MM-dd(并区分大小写)!'));
|
}
|
callback();
|
}
|
}
|
]
|
},
|
referConfig:{
|
title: '自定义流水参照',
|
showField: 'customCodeSerialClassText',
|
field: 'customCodeSerialClass',
|
fieldMap: {
|
serialType:"serialType"
|
},
|
placeholder:'请选择自定义流水',
|
options: {
|
// 设置默认的属性
|
url: 'api/ubcs-code/codeSerialAlgorithmController/gridCodeSerialAlgorithm',
|
textField:'name',
|
valueField:'classFullName',
|
isMuti: false,
|
type: "grid",
|
method: 'get',
|
tableConfig: {
|
page: {
|
limit: 15,
|
page: 1
|
},
|
cols: [
|
{title: '算法编号', field: 'id', width: 200},
|
{title: '算法名称', field: 'name', width: 150},
|
{title: '类全路径', field: 'classFullName', width: 300},
|
{title: '类型', field: 'serialType', width: 300},
|
{title: '描述', field: 'description'}
|
],
|
queryColumns: [
|
// {field: 'id', title: '算法编号'},
|
// {field: 'name', title: '算法名称'}
|
]
|
}
|
}
|
},
|
crudOption: {...optionRule},
|
ruleForm: {},
|
query: {},
|
loading: true,
|
currentCodeRuleOid: "",
|
page: {
|
pageSize: 10,
|
currentPage: 1,
|
total: 0,
|
},
|
selectionList: [],
|
/*编码规则表格配置*/
|
optionRule: optionRule,
|
data: [],
|
currentRuleLcStatus: "",
|
|
/*克隆编码规则对话框控制变量*/
|
cloneSettingBox: false,
|
|
/*从其他规则克隆码段*/
|
cloneOtherCodeRuleSettingBox: false,
|
|
/** 转移所有者对话框 */
|
escapeOwnerVisible: false,
|
ruleAdminUserList: [], //规则管理员列表
|
ruleOwner: "", // 当前要转移给哪个规则管理员的ID
|
releadDisabled: false, // 避免规则发布重复提交
|
|
/*最大流水号*/
|
maxSerial: {
|
visible: false,
|
},
|
|
/*使用范围对话框显示控制*/
|
codeRangeSettingBox: false,
|
useRangeData: [],
|
dialogLoading: true,
|
/*使用范围对话框配置*/
|
dialogeOption: {
|
height: "auto",
|
calcHeight: 150,
|
tip: false,
|
searchShow: false,
|
searchMenuSpan: 6,
|
border: true,
|
index: true,
|
disablePage: false,
|
refreshBtn: false,
|
columnBtn: false,
|
viewBtn: false,
|
addBtn: false,
|
menu: false,
|
selection: false,
|
dialogClickModal: false,
|
align: "center",
|
dialogWidth: 400,
|
column: [
|
{
|
label: "分类编号",
|
prop: "id",
|
span: 24,
|
},
|
{
|
label: "分类名称",
|
prop: "name",
|
span: 24,
|
},
|
],
|
},
|
|
/*基础码段相关数据*/
|
optionBasic: optionBasic,
|
basicData: [],
|
loadingBasic: false,
|
selectionBasicList: [],
|
addBasicCodeSettingBox: false,
|
showbtn: false, //基础码段新增按钮是否禁用
|
isLoadingSecCodeAddBtn: false,
|
basicSecDialogTitle: "", //基础码段第一层对话框标题
|
basicSecOnlyRead: false, //新增基础码段表单是否只读
|
|
/** 码值管理相关数据 */
|
isShowBasicSecCodeValueMgr: false, //码段码值管理对话框
|
codefixedsecOrCodeclassifysec: "", //存放基础码段点击码值管理时的当前行id,用于保存码值时使用
|
selectedFixedOrCodeclassifyValue: "", //当前选中的码值数据
|
//固定码段码值表单
|
codeFixdForm: {
|
codeFixedSecOid: "",
|
description: "",
|
id: "",
|
},
|
isShowFixedForm: true, //true显示固定码段码值管理界面,false显示分类码段码值管理界面
|
fixedValueData: [], //固定码段码值表格数据
|
fixedValueOption: fixedValueOption, //表格配置
|
fixedValueOptionLoading: false, //加载表格的动态效果
|
fixedValueSelectList: [], //固定码段码值当前选中的行
|
|
//分类码段码值表单
|
codeClassifyForm: {
|
codeClassifySecOid: "",
|
id: "",
|
name: "",
|
oid: "",
|
},
|
classisyValueTreeOption: classisyValueTreeOption, //分类码段树相关配置项
|
classifyValueTreeData: [],
|
|
/* 为属性选取值窗口显示打开控制变量 */
|
isShowSelectAttrOption: false,
|
/* 为属性选值左侧树数据 */
|
attrClassifyTreeData: [],
|
treeOption: treeOption,
|
currentSelectTreeData: "", //当前选中的树节点
|
/* 为属性选值右侧表格相关数据 */
|
|
selectAttrParams: {
|
ref: "selectionAttrCrud",
|
attrOption: attrOption,
|
selectAttrData: [],
|
selectAttrOptionLoading: false,
|
selectionChangeAttrList: [],
|
selectAttrQeury: {},
|
},
|
|
// 属性码段,公式编辑框组件的本场景显示变量、与系统变量
|
formulaEditorParams: {
|
thisSceneTableData: [
|
{
|
formula: "${}",
|
desc: "",
|
},
|
],
|
systemVariableTableData: [
|
{
|
formula: "#CURRENTUSER.OID#",
|
desc: "当前用户的主键",
|
},
|
{
|
formula: "#CURRENTUSER.ID#",
|
desc: "当前用户的账户",
|
},
|
{
|
formula: "#CURRENTTIME#",
|
desc: "当前时间",
|
},
|
{
|
formula: "#CURRENTDATE#",
|
desc: "当前日期",
|
},
|
{
|
formula: "#CURRENTDATETIME#",
|
desc: "当前日期时间",
|
},
|
{
|
formula: "#CURRENTUSER_NAME#",
|
desc: "当前用户的姓名",
|
},
|
{
|
formula: "#CURRENTUSER.SECRETGRADE#",
|
desc: "当前用户密级",
|
},
|
{
|
formula: "#CURRENTUSER.IPSECRET#",
|
desc: "当前用户的IP密级",
|
},
|
{
|
formula: "#CURRENTUSER.BUSINESSUNIT#",
|
desc: "当前用户所属业务单元",
|
},
|
{
|
formula: "#CURRENTUSER.BUSINESSUNITNAME#",
|
desc: "当前用户所属业务单元名称",
|
},
|
{
|
formula: "#CURRENTUSER.GROUPOID#",
|
desc: "当前用户的部门主键",
|
},
|
{
|
formula: "#CURRENTUSER.GROUPNAME#",
|
desc: "当前用户所属部门名称",
|
},
|
{
|
formula: "#CURRENTUSER.EMAIL#",
|
desc: "当前用户邮件地址",
|
},
|
{
|
formula: "#CURRENTUSER.ROLENAME#",
|
desc: "当前用户所属角色名称",
|
},
|
],
|
formulaEditorSettingBox: false,
|
},
|
|
/* 父分类码段对话框 */
|
parentClsfyParams: {
|
ref: "crudParentClassify",
|
isShowParentClassifySettingBox: false, //父分类码段对话框显示控制
|
classifyDialogLoading: true, //表格数据加载提示
|
parentClassifyParentOption: parentClassifyParentOption, //表格配置
|
parentClassifyData: [], //表格数据
|
//分页参数配置
|
parentClassifyDataPage: {
|
pageSize: 10,
|
currentPage: 1,
|
total: 0,
|
},
|
parentClassifyQuery: {}, //查询条件
|
parentClassifySelectionList: [], //当前选中行
|
},
|
|
/** 参照引用的业务类型对话框相关数据 */
|
referBtmDialogParams: {
|
ref: "crudReferBtm",
|
selectReferBtmSettingBox: false,
|
},
|
|
/** 基础码段新增表单 */
|
form: {
|
id: "", //编号
|
name: "", //名称
|
secType: "codefixedsec", //码段类型
|
description: "", //描述
|
serialDependFlag: false, //是否流水依赖
|
//serialDependOrder: "", //流水依赖顺序
|
nullableFlag: false, //是否为空
|
prefixCode: "", //前缀
|
suffixCode: "", //后缀
|
displayFlag: false, //
|
componentCodeFlag: false, //是否参与编码
|
pkCodeRule: "", //所属编码规则
|
},
|
|
//枚举和可输可选查询
|
enumParam: {
|
secTypeList: [], //码段类型
|
codeSecLengthType: [], //码段长度类型
|
codeFillType: [], //编码补位方式
|
codeFillSeparator: [], //补位时的字符,可输可选内容
|
codeLevelType: [], //层级类型
|
codeCutType: [], //字符截取类型
|
codeGetValueType: [], //取值类型
|
},
|
|
//表单元素标签宽度
|
leftFormLabelWidth: "110px",
|
rightFormLabelWidth: "150px",
|
|
// 高级查询对话框相关参数
|
advancedQueryParam: {
|
ref: "advancedQuery",
|
advancedQuerySettingBox: false,
|
options: [],
|
currentOpen: "", //当前打开高级查询的窗口是
|
//conditionMapParams: {},
|
},
|
|
//引用码段中参照配置组件相关参数
|
referConfigOption: {},
|
referConfigVisble: false,
|
};
|
},
|
computed: {
|
...mapGetters(["permission"]),
|
permissionList() {
|
return {
|
// 编码规则相关按钮
|
addBtn: this.vaildData(this.permission.code_rule.code_rule_add, false),
|
//viewBtn: this.vaildData(this.permission.code_rule.code_rule_view, false),
|
rulDelBtn: this.vaildData(this.permission.code_rule.code_rule_delete, false),
|
editBtn: this.vaildData(this.permission.code_rule.code_rule_edit, false),
|
deactivateBtn: this.vaildData(this.permission.code_rule.code_rule_deactivate, false),
|
enableBtn: this.vaildData(this.permission.code_rule.code_rule_enable, false),
|
releaseBtn: this.vaildData(this.permission.code_rule.code_rule_release, false),
|
advancedQueryBtn: this.vaildData(this.permission.code_rule.code_rule_advanced_query, false),
|
cloneBtn: this.vaildData(this.permission.code_rule.code_rule_clone, false),
|
otherCloneBtn: this.vaildData(this.permission.code_rule.code_rule_other_clone, false),
|
usescopeBtn: this.vaildData(this.permission.code_rule.code_rule_usescope, false),
|
clearBtn: this.vaildData(this.permission.code_rule.code_rule_clear, false),
|
escapeOwnerBtn: this.vaildData(this.permission.code_rule.code_rule_escape_owner, false),
|
maxSerialnumBtn: this.vaildData(this.permission.code_rule.code_rule_max_serialnum, false),
|
};
|
},
|
basicPermissionList() {
|
return {
|
// 基础码段相关按钮
|
addBtn: this.vaildData(this.permission.code_rule.code_basic_add, false),
|
editBtn: this.vaildData(this.permission.code_rule.code_basic_edit, false),
|
viewBtn: this.vaildData(this.permission.code_rule.code_basic_view, false),
|
basicDelBtn: this.vaildData(this.permission.code_rule.code_basic_delete, false),
|
basicAdvancedQueryBtn: this.vaildData(this.permission.code_rule.code_basic_advanced_query, false),
|
basicMgrBtn: this.vaildData(this.permission.code_rule.code_basic_mgr, false),
|
basicMoveupBtn: this.vaildData(this.permission.code_rule.code_basic_moveup, false),
|
basicDownBtn: this.vaildData(this.permission.code_rule.code_basic_down, false),
|
}
|
},
|
},
|
watch: {},
|
mounted() {
|
this.loadTotalEnum();
|
},
|
// 解决表格错行问题
|
activated() {
|
this.$nextTick(() => {
|
this.$refs.crud.doLayout();
|
this.$refs.crudBasic.doLayout();
|
});
|
},
|
// 生命钩子函数
|
beforeDestroy() {
|
// 清除指定缓存
|
localStorage.removeItem('codeSecType');
|
localStorage.removeItem('codeSecLength');
|
localStorage.removeItem('codeFillType');
|
localStorage.removeItem('codeLevelType');
|
localStorage.removeItem('codeCutType');
|
localStorage.removeItem('codeGetValueType');
|
},
|
methods: {
|
//自定义流水失焦
|
setReferValue(data){
|
if(data.field){
|
this.form[data.field] = data.value || "";
|
this.form[data.showField] = data.text || "";
|
this.form.serialType = data.rawData[0].serialType || "";
|
|
}
|
},
|
/** 转移规则所有者对话框 */
|
escapeOwner() {
|
if (this.selectionList.length === 0) {
|
this.$message.warning("请选择一条编码规则!");
|
return;
|
}
|
this.escapeOwnerVisible = true;
|
getByRoleUserList("规则管理员").then((res) => {
|
this.ruleAdminUserList = res.data.data;
|
});
|
},
|
/** 确认转移所有者 */
|
escapeOwnerConfirm() {
|
if (!this.ruleOwner) {
|
this.$message.warning("请选择您要转移的规则管理员!");
|
return;
|
}
|
this.selectionList[0].owner = this.ruleOwner;
|
let data = this.selectionList[0];
|
update(data).then(
|
() => {
|
this.onLoad(this.page);
|
this.$message({
|
type: "success",
|
message: "规则转移成功!",
|
});
|
this.escapeOwnerVisible = false;
|
},
|
(error) => {
|
console.log(error);
|
}
|
);
|
},
|
|
/** 高级查询对话框组件,组件返回的值是condtionMap[field]形式的查询条件,保留了和之前一样的方式 */
|
echoSeniorContionMap(conditionMaps) {
|
//console.log(conditionMaps);
|
if (JSON.stringify(conditionMaps) != "{}") {
|
if (this.advancedQueryParam.currentOpen == "codeRule") {
|
this.query = conditionMaps;
|
// console.log(this.query);
|
this.onLoad(this.page);
|
} else {
|
this.sendGridCodeBasicSec(conditionMaps, true);
|
}
|
}
|
},
|
/* 公式编辑框内容改变,子组件编辑完公式之后内容回显时调用 */
|
updateFormulaContent(content) {
|
this.form.getValueClass = content;
|
},
|
/* 引用码段参照配置,子组件填完参照配置之后内容回显时调用 */
|
setReferConfigValue(content) {
|
this.form.referBtmId = content.referType || "";
|
this.form.referBtmName = content.referTypeName || content.referType;
|
//转换成JSON字符串进行父组件回显
|
let submitFormJson = JSON.stringify(content);
|
this.form.referConfig = submitFormJson || "";
|
// debugger;
|
},
|
/** 引用码段为【参照引用的业务类型】选取值之后的内容回显时调用 */
|
echoReferBtmType(content) {
|
// 实现回显
|
this.form.referBtmId = content.id || "";
|
this.form.referBtmName = content.name || content.id;
|
},
|
|
/** 父分类选择对话框,第二层嵌套对话框,及其相关方法 */
|
/** 保存当前父分类码段的选中行,并进行回显 */
|
saveSelectedParentClassify() {
|
if (this.parentClsfyParams.parentClassifySelectionList.length != 1) {
|
this.$message.warning("请选择一条数据!");
|
return false;
|
}
|
//参数值,实现回显
|
this.form.parentClassifySecOid =
|
this.parentClsfyParams.parentClassifySelectionList[0].oid;
|
this.form.parentClassifySecText =
|
this.parentClsfyParams.parentClassifySelectionList[0].name;
|
//清空当前选中的行
|
this.parentClassifySelectionClear();
|
this.parentClsfyParams.isShowParentClassifySettingBox = false;
|
},
|
parentClassifySearchReset() {
|
this.parentClsfyParams.parentClassifyQuery = {};
|
this.parentClassifyOnLoad(this.parentClsfyParams.parentClassifyDataPage);
|
},
|
parentClassifySearchChange(params, done) {
|
this.parentClsfyParams.parentClassifyQuery = params;
|
this.parentClsfyParams.parentClassifyDataPage.currentPage = 1;
|
this.parentClassifyOnLoad(this.page, params);
|
done();
|
},
|
parentClassifyRowClick(row) {
|
this.$refs[this.parentClsfyParams.ref].toggleSelection();
|
this.parentClsfyParams.parentClassifySelectionList = row;
|
this.$refs[this.parentClsfyParams.ref].setCurrentRow(row);
|
this.$refs[this.parentClsfyParams.ref].toggleRowSelection(row); //选中当前行
|
},
|
parentClassifySelectionChange(list) {
|
this.parentClsfyParams.parentClassifySelectionList = list;
|
this.$refs[this.parentClsfyParams.ref].setCurrentRow(
|
this.parentClsfyParams.parentClassifySelectionList[list.length - 1]
|
);
|
},
|
parentClassifySelectionClear() {
|
this.parentClsfyParams.parentClassifySelectionList = [];
|
this.$refs[this.parentClsfyParams.ref].toggleSelection();
|
},
|
parentClassifyCurrentChange(currentPage) {
|
this.parentClsfyParams.parentClassifyDataPage.currentPage = currentPage;
|
},
|
parentClassifySizeChange(pageSize) {
|
this.parentClsfyParams.parentClassifyDataPage.pageSize = pageSize;
|
},
|
refreshParentClassifyDataChange() {
|
this.parentClassifyOnLoad(
|
this.parentClsfyParams.parentClassifyDataPage,
|
this.parentClsfyParams.parentClassifyQuery
|
);
|
},
|
parentClassifyOnLoad(page, params = {}) {
|
let parentClsParam = this.parentClsfyParams;
|
parentClsParam.classifyDialogLoading = true;
|
let oid =
|
this.selectionList.length == 0
|
? this.form.pkCodeRule
|
: this.selectionList[0].oid;
|
let conditionMaps = {};
|
|
conditionMaps["conditionMap[pkCodeRule]"] = oid;
|
conditionMaps["conditionMap[oid_notequal]"] = this.form.oid;
|
refDataGridClassifySec(
|
page.currentPage,
|
page.pageSize,
|
conditionMaps
|
).then((res) => {
|
const data = res.data.data;
|
parentClsParam.parentClassifyDataPage.total = data.total;
|
parentClsParam.parentClassifyData = data.records;
|
parentClsParam.classifyDialogLoading = false;
|
this.parentClassifySelectionClear();
|
});
|
},
|
|
/** 打开属性选取值,第二层嵌套对话框,及其相关方法 */
|
/** 获取当前被选中树节点的oid */
|
nodeClick(data) {
|
this.currentSelectTreeData = data;
|
this.loadlistClassifyLinkAttr();
|
},
|
/** 加载分类连接属性表格数据 */
|
loadlistClassifyLinkAttr() {
|
let attrParam = this.selectAttrParams;
|
this.selectAttrParams.selectAttrOptionLoading = true;
|
let conditionMaps = {};
|
if (attrParam.selectAttrQeury) {
|
Object.keys(attrParam.selectAttrQeury).forEach((key) => {
|
conditionMaps["conditionMap[" + key + "]"] =
|
attrParam.selectAttrQeury[key].trim();
|
});
|
}
|
conditionMaps["conditionMap[codeClassifyOid]"] =
|
this.currentSelectTreeData.oid;
|
conditionMaps["conditionMap[btmTypeOid]"] =
|
this.currentSelectTreeData.btmTypeOid;
|
listClassifyLinkAttr(conditionMaps).then((res) => {
|
const data = res.data;
|
this.$nextTick(() => {
|
this.$refs[attrParam.ref].doLayout();
|
});
|
this.selectAttrParams.selectAttrData = data.data;
|
this.selectAttrParams.selectAttrOptionLoading = false;
|
// 将搜索框内容置空
|
this.selectAttrParams.selectAttrQeury = {};
|
});
|
},
|
/** 点击搜索后触发该事件 */
|
selectAttrSearchChange(params, done) {
|
this.selectAttrParams.selectAttrQeury = params;
|
//console.log(params); //这儿需要改
|
this.loadlistClassifyLinkAttr();
|
done();
|
},
|
/** 为属性选值界面,单击表格行时触发该事件 */
|
selectionAttrRowClick(row) {
|
this.$refs[this.selectAttrParams.ref].toggleSelection();
|
this.selectAttrParams.selectionChangeAttrList = row;
|
this.$refs[this.selectAttrParams.ref].setCurrentRow(row);
|
this.$refs[this.selectAttrParams.ref].toggleRowSelection(row); //选中当前行
|
},
|
/** 属性取值当前选中行发生变化时触发 */
|
selectionChangeAttr(list) {
|
this.selectAttrParams.selectionChangeAttrList = list;
|
this.$refs[this.selectAttrParams.ref].setCurrentRow(
|
this.selectAttrParams.selectionChangeAttrList[list.length - 1]
|
);
|
},
|
/** 重置位属性选取值表格的搜索框之后的回调 */
|
searchAttrReset() {
|
this.selectAttrParams.selectAttrQeury = {};
|
this.loadlistClassifyLinkAttr();
|
},
|
/** 为属性选取值之后的回显 */
|
selectedListClassifyLinkAttr() {
|
if (this.selectAttrParams.selectionChangeAttrList.length != 1) {
|
this.$message.warning("请选择一条数据!");
|
return false;
|
}
|
const attr = this.selectAttrParams.selectionChangeAttrList[0];
|
//调用子组件并传递当前选中的参数值,实现回显
|
this.form = Object.assign({}, this.form, {
|
referAttributeId: attr.id || "",
|
referAttributeName: attr.name || attr.id,
|
referCodeClassifyOid: this.currentSelectTreeData.key || "",
|
referCodeClassifyOidName: this.currentSelectTreeData.title || "",
|
});
|
this.isShowSelectAttrOption = false;
|
},
|
|
/** 基础码段表中的码值管理的相关方法 */
|
/** 码值管理弹窗控制*/
|
openBasicSecCodeValueMgr(row) {
|
//当前为固定码段码值管理码值管理
|
if (row.secType === "codefixedsec") {
|
this.isShowFixedForm = true;
|
this.loadFixedValueTableData(row);
|
} else {
|
//分类码段
|
this.isShowFixedForm = false;
|
this.loadClassifyValueData(row);
|
}
|
this.codefixedsecOrCodeclassifysec = row;
|
this.isShowBasicSecCodeValueMgr = true;
|
},
|
/** 加载固定码段码值表数据*/
|
loadFixedValueTableData(row) {
|
this.fixedValueOptionLoading = true;
|
gridCodeFixedValue(1, -1, {codeFixedSecOid: row.oid}).then((res) => {
|
this.fixedValueData = res.data.data.records;
|
this.fixedValueOptionLoading = false;
|
});
|
},
|
/** 单击固定码段的码值表中行时触发的事件*/
|
selectedCodeValueRow(row) {
|
this.selectedFixedOrCodeclassifyValue = row;
|
this.codeFixdForm.id = row.id;
|
this.codeFixdForm.description = row.description;
|
this.codeFixdForm.codeFixedSecOid = row.codefixedsecoid;
|
},
|
/** 新增码值*/
|
addCodeSecValue(condition) {
|
if (condition === "codefixedsec") {
|
if (!this.tipsCodeSecValueMessage(this.codeFixdForm.id)) {
|
return;
|
}
|
this.codeFixdForm.codeFixedSecOid = this.codefixedsecOrCodeclassifysec.oid;
|
addSaveCodeFixedValue(this.codeFixdForm).then(
|
() => {
|
this.loadFixedValueTableData({
|
oid: this.codefixedsecOrCodeclassifysec.oid,
|
});
|
this.clearFixedOrClassifyForm("codefixedsec");
|
this.$refs.crudFixedValue.refreshTable();
|
this.$refs.crudFixedValue.doLayout();
|
this.$message({
|
type: "success",
|
message: "操作成功!",
|
});
|
},
|
(error) => {
|
window.console.log(error);
|
}
|
);
|
} else {
|
if (!this.tipsCodeSecValueMessage(this.codeClassifyForm.id)) {
|
return;
|
}
|
this.codeClassifyForm.codeClassifySecOid =
|
this.codefixedsecOrCodeclassifysec.oid;
|
addSaveCodeClassifyValue(this.codeClassifyForm).then(
|
() => {
|
this.loadClassifyValueData({
|
oid: this.codefixedsecOrCodeclassifysec.oid,
|
});
|
this.clearFixedOrClassifyForm("codeclassifyvaluesec");
|
this.$message({
|
type: "success",
|
message: "操作成功!",
|
});
|
},
|
(error) => {
|
this.$confirm(error, {
|
confirmButtonText: "确定",
|
type: "error",
|
});
|
}
|
);
|
}
|
},
|
/** 清空码值表单 */
|
clearFixedOrClassifyForm(condition) {
|
//点击取消时清空表单与当前选中的码值,并禁用按钮
|
this.selectedFixedOrCodeclassifyValue = "";
|
if (condition === "close") {
|
this.codeFixdForm = this.$options.data().codeFixdForm;
|
this.codeClassifyForm = this.$options.data().codeClassifyForm;
|
}
|
if (condition === "codefixedsec") {
|
this.codeFixdForm.description = "";
|
this.codeFixdForm.codeFixedSecOid = "";
|
} else {
|
this.codeClassifyForm = this.$options.data().codeClassifyForm;
|
}
|
},
|
/** 添加或修改码值之前对码值长度根据规则进行校验 */
|
tipsCodeSecValueMessage(id) {
|
if (id.trim() == "") {
|
this.$message.warning("码值不能为空!");
|
return false;
|
}
|
if (id.trim().length > this.codefixedsecOrCodeclassifysec.codeSecLength) {
|
this.$message.warning(
|
"码值长度不能大于" + this.codefixedsecOrCodeclassifysec.codeSecLength
|
);
|
return false;
|
}
|
return true;
|
},
|
/** 修改码值 */
|
editCodeSecValue(condition) {
|
if (condition == "codefixedsec") {
|
if (!this.tipsCodeSecValueMessage(this.codeFixdForm.id)) {
|
return;
|
}
|
//以前是直接把当前选中行的所有数据都进行提交,但其实只需要传输一些必要参数即可,这儿做了修改,需要传其他参数的请自行添加
|
let editData = {
|
oid: this.selectedFixedOrCodeclassifyValue.oid,
|
ts: new Date().getTime(),
|
description: this.codeFixdForm.description,
|
id: this.codeFixdForm.id,
|
codeFixedSecOid:
|
this.selectedFixedOrCodeclassifyValue.codefixedsecoid,
|
};
|
editCodeFixedValue(editData).then(
|
() => {
|
this.loadFixedValueTableData({
|
oid: this.codefixedsecOrCodeclassifysec.oid,
|
});
|
this.$message({
|
type: "success",
|
message: "操作成功!",
|
});
|
},
|
(error) => {
|
window.console.log(error);
|
}
|
);
|
} else {
|
if (!this.tipsCodeSecValueMessage(this.codeClassifyForm.id)) {
|
return;
|
}
|
this.codeClassifyForm.oid =
|
this.selectedFixedOrCodeclassifyValue.attributes.oid;
|
// 分类码段,子分类和父分类之间不能相互更改
|
if (
|
this.checkClassUpdate(
|
this.codefixedsecOrCodeclassifysec.oid,
|
this.codeClassifyForm.codeClassifySecOid
|
)
|
) {
|
return;
|
}
|
this.$delete(this.codeClassifyForm, "parentClassifyValueOid");
|
editCodeClassifyValue(this.codeClassifyForm).then(
|
() => {
|
this.loadClassifyValueData({
|
oid: this.codefixedsecOrCodeclassifysec.oid,
|
});
|
this.$message({
|
type: "success",
|
message: "操作成功!",
|
});
|
},
|
(error) => {
|
window.console.log(error);
|
}
|
);
|
}
|
},
|
/** 删除码值 */
|
delCodeSecValue(condition) {
|
//固定码段码值删除
|
if (condition == "codefixedsec") {
|
//console.log(this.selectedFixedOrCodeclassifyValue.oid);
|
this.$confirm("是否删除这条数据?如果被引用将不能被删除!", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning",
|
})
|
.then(() => {
|
let ts = new Date(
|
this.selectedFixedOrCodeclassifyValue.ts
|
).getTime();
|
return deleteCodeFixedValue({
|
oid: this.selectedFixedOrCodeclassifyValue.oid,
|
ts: ts,
|
});
|
})
|
.then(() => {
|
this.selectedFixedOrCodeclassifyValue = "";
|
this.loadFixedValueTableData({
|
oid: this.codefixedsecOrCodeclassifysec.oid,
|
});
|
this.clearFixedOrClassifyForm("codefixedsec");
|
this.$message({
|
type: "success",
|
message: "操作成功!",
|
});
|
});
|
} else {
|
if (
|
this.checkClassUpdate(
|
this.codefixedsecOrCodeclassifysec.oid,
|
this.codeClassifyForm.codeClassifySecOid
|
)
|
) {
|
return;
|
}
|
//分类码段码值删除
|
this.$confirm("是否删除这条数据?如果被引用将不能被删除!", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning",
|
})
|
.then(() => {
|
let ts = new Date(
|
this.selectedFixedOrCodeclassifyValue.ts
|
).getTime();
|
return deleteCodeClassifyValue({
|
oid: this.selectedFixedOrCodeclassifyValue.oid,
|
ts: ts,
|
});
|
})
|
.then(() => {
|
this.selectedFixedOrCodeclassifyValue = "";
|
this.loadClassifyValueData({
|
oid: this.codefixedsecOrCodeclassifysec.oid,
|
});
|
this.clearFixedOrClassifyForm("codeclassifyvalue");
|
this.$message({
|
type: "success",
|
message: "操作成功!",
|
});
|
});
|
}
|
},
|
/** 对固定码值表进行:上移、下移、移除操作*/
|
codeFixedValueOpetion(condition, row) {
|
//console.log(this.fixedValueData[row.$index].orderNum);
|
const index = row.$index;
|
if (condition == "up") {
|
//对ordeNum排序字段进行调整
|
this.fixedValueData[index].orderNum =
|
this.fixedValueData[index].orderNum - 1;
|
this.fixedValueData[index - 1].orderNum =
|
this.fixedValueData[index].orderNum + 1;
|
//当下标减去1小于0或者orderNum字段减去1小于0的时候不执行上移操作
|
if (index - 1 < 0 || this.fixedValueData[row.$index].orderNum - 1 < 0) {
|
return;
|
}
|
//调整数组值顺序
|
let tempOption = this.fixedValueData[index - 1];
|
this.$set(this.fixedValueData, index - 1, this.fixedValueData[index]);
|
this.$set(this.fixedValueData, index, tempOption);
|
|
//console.log(this.fixedValueData);
|
} else if (condition == "down") {
|
//对ordeNum排序字段进行调整
|
this.fixedValueData[index].orderNum =
|
this.fixedValueData[index].orderNum + 1;
|
this.fixedValueData[index + 1].orderNum =
|
this.fixedValueData[index].orderNum - 1;
|
//调整数组值顺序
|
let tempOption = this.fixedValueData[index + 1];
|
this.$set(this.fixedValueData, index + 1, this.fixedValueData[index]);
|
this.$set(this.fixedValueData, index, tempOption);
|
} else {
|
for (let i = index + 1; i < this.fixedValueData.length - 1; i++) {
|
//console.log(this.fixedValueData[i].orderNum);
|
this.fixedValueData[i].orderNum = this.fixedValueData[i].orderNum - 1;
|
//console.log(this.fixedValueData[i].orderNum);
|
}
|
this.$delete(this.fixedValueData, index);
|
}
|
//console.log(this.fixedValueData);
|
},
|
/** 对分类码值表进行:上移、下移、移除操作*/
|
codeClassifyValueOpetion(condition) {
|
if (
|
this.checkClassUpdate(
|
this.codefixedsecOrCodeclassifysec.oid,
|
this.codeClassifyForm.codeClassifySecOid
|
)
|
) {
|
return;
|
}
|
//此处涉及到深浅拷贝问题,但是执行上下移保存操作之后会重新加载treedata,所以影响不大
|
let currentTreeList = this.getCodeClassifyValueTreeData();
|
let saveData = [];
|
// console.log(currentTreeList.treeList);
|
if (condition == "up") {
|
if (currentTreeList.index - 1 >= 0) {
|
// 调整顺序
|
saveData[0] =
|
currentTreeList.treeList[currentTreeList.index].attributes;
|
saveData[1] =
|
currentTreeList.treeList[currentTreeList.index - 1].attributes;
|
saveData[0].orderNum = parseInt(saveData[0].orderNum) - 1;
|
saveData[1].orderNum = parseInt(saveData[1].orderNum) + 1;
|
this.saveCodeFixedOrClassifyValueOption("classifyValue", saveData);
|
}
|
} else {
|
if (currentTreeList.index + 1 < currentTreeList.treeList.length) {
|
// 调整顺序
|
saveData[0] =
|
currentTreeList.treeList[currentTreeList.index].attributes;
|
saveData[1] =
|
currentTreeList.treeList[currentTreeList.index + 1].attributes;
|
saveData[0].orderNum = parseInt(saveData[0].orderNum) + 1;
|
saveData[1].orderNum = parseInt(saveData[1].orderNum) - 1;
|
this.saveCodeFixedOrClassifyValueOption("classifyValue", saveData);
|
}
|
}
|
},
|
/** 选中被调整顺序的两个树的节点*/
|
getCodeClassifyValueTreeData() {
|
const currentNodeTreeData = this.selectedFixedOrCodeclassifyValue;
|
/**考虑几种情况,第一种当前上移|下移操作已经是边界,
|
不需要要做处理,第二种当前为树根节点,第三种当前为叶子节点
|
*/
|
//说明是根节点,直接找再判断是否是边界值
|
if (currentNodeTreeData.parentId.trim() == "") {
|
return this.findTreeIndex(
|
this.classifyValueTreeData,
|
currentNodeTreeData.oid,
|
true
|
);
|
} else {
|
//说明不是根节点,先找到父节点再找到子节点,判断是否是边界值
|
return this.findTreeIndex(
|
this.classifyValueTreeData,
|
currentNodeTreeData.parentId,
|
false
|
);
|
}
|
},
|
/**
|
* 找前一个和后一个元素
|
* @treeList 查找的数组
|
* @conditionOid 用来查找判断的条件
|
* @isTreeRoot 是否父节点
|
* @rreturn 返回相邻的节点
|
*/
|
findTreeIndex(treeList, conditionOid, isTreeRoot) {
|
for (let index = 0; index < treeList.length; index++) {
|
if (treeList[index].oid == conditionOid) {
|
if (isTreeRoot) {
|
let resData = {
|
index: index,
|
treeList: treeList,
|
};
|
return resData;
|
} else {
|
return this.findTreeIndex(
|
this.classifyValueTreeData[index].children,
|
this.selectedFixedOrCodeclassifyValue.oid,
|
true
|
);
|
}
|
}
|
}
|
},
|
/** 上移下移等操作的保存*/
|
async saveCodeFixedOrClassifyValueOption(condition, editOrderNumdata) {
|
//保存对固定码段码值的上移下移移出等操作
|
if (condition == "fixedValue") {
|
let data = {
|
codeFixedSecOid: this.codefixedsecOrCodeclassifysec.oid,
|
dtoList: JSON.stringify(this.fixedValueData),
|
};
|
saveOrder(data).then(
|
() => {
|
//执行完保存之后将当前选中的对象清空
|
this.selectedFixedOrCodeclassifyValue = "";
|
this.$message({
|
type: "success",
|
message: "保存成功!",
|
});
|
},
|
(error) => {
|
window.console.log(error);
|
}
|
);
|
} else {
|
//保存对分类码值码段码值的上移下移移出等操作
|
await saveCodeClassifyValueOrder({
|
codeClassifySecOid: this.codefixedsecOrCodeclassifysec.oid,
|
dtoList: JSON.stringify(editOrderNumdata),
|
}).then(
|
() => {
|
this.$message({
|
type: "success",
|
message: "保存成功!",
|
});
|
},
|
(error) => {
|
window.console.log(error);
|
}
|
);
|
this.loadClassifyValueData({
|
oid: this.codefixedsecOrCodeclassifysec.oid,
|
});
|
}
|
},
|
/** 分类码值树data加载*/
|
loadClassifyValueData(row) {
|
//console.log(row);
|
let condtionData = {
|
queryAllLevel: true,
|
loadType: "all",
|
multipleSelect: false,
|
isMuti: false,
|
isQueryAllColumn: true,
|
"conditionMap[codeclassifysecoid]": row.oid,
|
};
|
treeCodeClassifyValue(condtionData).then((res) => {
|
this.classifyValueTreeData = res.data;
|
//console.log(res.data);
|
});
|
},
|
/** 分类码值树单击时触发的事件*/
|
classisyValueTreeOnodeClick(node) {
|
//console.log(node);
|
this.selectedFixedOrCodeclassifyValue = node;
|
this.codeClassifyForm.codeClassifySecOid =
|
node.attributes.codeClassifySecOid;
|
this.codeClassifyForm.id = node.attributes.id;
|
this.codeClassifyForm.name = node.attributes.name;
|
this.codeClassifyForm.parentClassifyValueOid = node.attributes.oid;
|
// console.log(this.codeClassifyForm);
|
},
|
/**
|
* 分类码段码值,修改、删除、上下移之前,检查是否为子分类和父分类之间相互更改
|
* @currentRowClassOid 当前选中行oid
|
* @updateClassOid 要修改的分类码值oid
|
*/
|
checkClassUpdate(currentRowClassOid, updateClassOid) {
|
if (currentRowClassOid != updateClassOid) {
|
this.$message({
|
type: "error",
|
message: "操作失败【子分类与父分类之间不能相互修改码值】!",
|
});
|
}
|
return currentRowClassOid != updateClassOid;
|
},
|
|
/** 编码规则相关方法 */
|
/** 打开高级查询窗口 */
|
openAdvancedQuery(condition) {
|
if (condition == "codeRule") {
|
this.advancedQueryParam.options = [
|
{
|
data: [],
|
title: "编号",
|
fieldType: "text",
|
queryField: "id",
|
},
|
{
|
data: [],
|
title: "名称",
|
fieldType: "text",
|
queryField: "name",
|
},
|
{
|
data: [],
|
title: "描述",
|
fieldType: "text",
|
queryField: "description",
|
},
|
{
|
data: [],
|
title: "状态",
|
fieldType: "combox",
|
queryField: "lcStatus",
|
comboxKey: "codeSearchLCStatus",
|
},
|
{
|
data: [],
|
title: "所有者",
|
fieldType: "text",
|
queryField: "ownerText",
|
},
|
];
|
} else {
|
this.advancedQueryParam.options = [
|
{
|
data: [],
|
title: "码段编号",
|
fieldType: "text",
|
queryField: "id",
|
},
|
{
|
data: [],
|
title: "码段名称",
|
fieldType: "text",
|
queryField: "name",
|
},
|
{
|
data: [],
|
title: "描述",
|
fieldType: "text",
|
queryField: "description",
|
},
|
{
|
data: [],
|
title: "码段类型",
|
fieldType: "combox",
|
queryField: "secType",
|
comboxKey: "codeSecType",
|
},
|
];
|
}
|
this.advancedQueryParam.currentOpen = condition;
|
this.advancedQueryParam.advancedQuerySettingBox = true;
|
},
|
/** 查询使用范围*/
|
handleRange() {
|
if (!this.tipsMessage(this.selectionList)) {
|
return;
|
}
|
this.codeRangeSettingBox = true;
|
this.getRangeCodeList();
|
},
|
/** 加载使用范围列表*/
|
getRangeCodeList() {
|
this.dialogLoading = true;
|
if (this.selectionList[0].oid == null) {
|
this.$message.error("未获取到参数!");
|
}
|
|
listUseRange(this.selectionList[0].oid).then((res) => {
|
this.useRangeData = res.data.data;
|
//console.log(this.useRangeData);
|
this.dialogLoading = false;
|
});
|
},
|
/** 刷新使用范围列表*/
|
refreshUseRangeChange() {
|
this.getRangeCodeList();
|
},
|
/** 修改规则状态:启用、停用、发布 */
|
updateStatus(oid, update) {
|
updateStatus({oid: oid, ts: new Date().getTime, update: update}).then(
|
() => {
|
this.releadDisabled = false;
|
this.onLoad(this.page);
|
this.$message({
|
type: "success",
|
message: "操作成功!",
|
});
|
},
|
(error) => {
|
window.console.log(error);
|
}
|
);
|
},
|
/** 发布编码规则 */
|
async enableOrDeactivatse(oid, update) {
|
if (update === "release") {
|
this.releadDisabled = true;
|
// 避免用户重复点击按钮
|
await checkLikeCodeRule(oid)
|
.then((res) => {
|
//console.log(res)
|
if (res.data.data.success) {
|
this.updateStatus(oid, update);
|
} else {
|
this.$confirm(res.data.data.msg, "提示", {
|
distinguishCancelAndClose: true,
|
confirmButtonText: "继续发布",
|
cancelButtonText: "取消",
|
}).then(() => {
|
this.updateStatus(oid, update);
|
this.releadDisabled = false;
|
}).catch((action) => {
|
this.$message({
|
type: "info",
|
message: "取消发布!",
|
});
|
this.releadDisabled = false;
|
});
|
}
|
}).catch((error) => {
|
this.releadDisabled = false;
|
});
|
this.releadDisabled = false;
|
} else {
|
this.updateStatus(oid, update);
|
}
|
},
|
/** 打开编码规则克隆对话框*/
|
openCodeRuleDialog() {
|
if (!this.tipsMessage(this.selectionList)) {
|
return;
|
}
|
this.cloneSettingBox = true;
|
},
|
/** 打开从其他编码规则中克隆码段对话框*/
|
openOtherCodeRuleDialog() {
|
if (!this.tipsMessage(this.selectionList)) {
|
return;
|
}
|
if (this.selectionList[0].lcStatus != "Editing") {
|
this.$message.warning("编码规则已被引用,不允许编辑!");
|
return;
|
}
|
this.cloneOtherCodeRuleSettingBox = true;
|
},
|
|
/** 清空码值*/
|
clearAllCodeSec() {
|
if (this.selectionList.length == 0) {
|
this.$message.warning("没有选择数据!");
|
return;
|
}
|
if (this.selectionList.length != 1) {
|
this.$message.warning("每次只能选择一条数据!");
|
return;
|
}
|
let currentData = this.selectionList[0];
|
this.$confirm("确定要清空码值?如果清空将不能被恢复,请谨慎!", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning",
|
})
|
.then(() => {
|
let ts = new Date(currentData.ts).getTime();
|
return clearAllCode({oid: currentData.oid, ts: ts});
|
})
|
.then(() => {
|
this.this.onLoad(this.page);
|
this.$message({
|
type: "success",
|
message: "操作成功!",
|
});
|
});
|
},
|
/** 添加*/
|
rowSave(row, done, loading) {
|
add(row).then(
|
() => {
|
this.onLoad(this.page);
|
this.$message({
|
type: "success",
|
message: "操作成功!",
|
});
|
done();
|
},
|
(error) => {
|
loading();
|
window.console.log(error);
|
}
|
);
|
},
|
openEdit(row) {
|
this.$refs.crud.rowEdit(row, row.$index);
|
},
|
/** 修改*/
|
rowUpdate(row, index, done, loading) {
|
row.ts = new Date().getTime;
|
update(row).then(
|
() => {
|
this.onLoad(this.page);
|
this.$message({
|
type: "success",
|
message: "操作成功!",
|
});
|
done();
|
},
|
(error) => {
|
loading();
|
console.log(error);
|
}
|
);
|
},
|
/** 删除*/
|
handleDelete() {
|
if (!this.tipsMessage(this.selectionList)) {
|
return;
|
}
|
this.$confirm("确定将选择数据删除?", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning",
|
})
|
.then(() => {
|
// 只支持每次单条记录删除
|
let oid = this.selectionList[0].oid;
|
let ts = new Date(this.selectionList[0].ts).getTime();
|
return remove({oid: oid, ts: ts});
|
})
|
.then(() => {
|
this.onLoad(this.page);
|
this.$message({
|
type: "success",
|
message: "操作成功!",
|
});
|
this.$refs.crud.toggleSelection();
|
});
|
},
|
// 打开修改*/
|
beforeOpen(done, type) {
|
if (["edit", "view"].includes(type)) {
|
getDetail(this.ruleForm.oid).then((res) => {
|
this.ruleForm = res.data.data;
|
});
|
}
|
done();
|
},
|
// 编码规则快速查询重置
|
searchReset() {
|
this.query = {};
|
this.onLoad(this.page);
|
},
|
// 编码规则快速查询searchChange
|
searchChange(params, done) {
|
this.page.currentPage = 1;
|
// 多个conditionMap这样传参,快速查询默认采用模糊查询
|
let requestData = {};
|
if (params) {
|
Object.keys(params).forEach((key) => {
|
requestData["conditionMap" + "[" + key + "_like]"] =
|
params[key].trim();
|
});
|
}
|
this.query = requestData;
|
this.onLoad(this.page, this.query);
|
// console.log( this.findObject(this.optionRule.column,'id'))
|
// console.log(this.crudOption.column[0])
|
// this.crudOption.column && this.crudOption.column.length > 0
|
// ? (this.crudOption.column[0].value = '')
|
// : null;
|
done();
|
},
|
/** 编码规则当前选中行变化的时候触发*/
|
selectionChange(list) {
|
this.selectionList = list;
|
//当前选中行为空的时候就将码段管理表格数据置空,并禁用相关功能
|
if (this.selectionList.length <= 0) {
|
this.hideBasicTable(false);
|
}
|
if (this.selectionList.length > 0) {
|
this.$refs.crud.setCurrentRow(this.selectionList[list.length - 1]);
|
this.currentCodeRuleOid = this.selectionList[list.length - 1].oid;
|
this.currentRuleLcStatus = this.selectionList[list.length - 1].lcStatus;
|
this.loadBasic(this.selectionList[list.length - 1]);
|
}
|
},
|
/** 单击编码规则实现行选择*/
|
codeRuleRowClick(row) {
|
// console.log(this.currentRuleLcStatus);
|
this.$refs.crud.toggleSelection();
|
this.$refs.crud.toggleRowSelection(row); //选中当前行
|
},
|
selectionClear() {
|
this.selectionList = [];
|
this.$refs.crud.toggleSelection();
|
},
|
currentChange(currentPage) {
|
this.page.currentPage = currentPage;
|
},
|
sizeChange(pageSize) {
|
this.page.pageSize = pageSize;
|
},
|
refreshChange() {
|
this.onLoad(this.page, this.query);
|
},
|
onLoad(page, params = {}) {
|
this.loading = true;
|
gridCodeRule(
|
page.currentPage,
|
page.pageSize,
|
Object.assign({}, params, this.query),
|
).then((res) => {
|
//console.log(res.data);
|
const data = res.data.data;
|
this.page.total = data.total;
|
this.data = data.records;
|
this.loading = false;
|
// 查询的值为空时,要将码段管理相关的内容禁用
|
if (data.records.length <= 0) {
|
this.hideBasicTable(false);
|
return;
|
}
|
this.loadBasic(this.data[0]);
|
this.$nextTick(() => {
|
this.$refs.crud.toggleRowSelection(this.data[0]);
|
this.$refs.crud.setCurrentRow(this.data[0]);
|
});
|
this.selectionList = data.records[0];
|
//this.selectionClear();
|
});
|
},
|
|
/** 基础码段相关方法 */
|
/** 防止打开过编辑窗口之后表单中存在值,所以需要清空,并初始化form表单属性*/
|
clearBasicAddForm() {
|
this.form = this.$options.data().form;
|
//this.isLoadingSecCodeAddBtn = false;
|
// this.changeSectypeFormItems(null);
|
},
|
/** 打开新增窗口*/
|
openAddBasicCodeSec() {
|
if (!this.tipsMessage(this.selectionList)) {
|
return;
|
}
|
if (this.selectionList[0].lcStatus != "Editing") {
|
this.$message.warning('编码规则状态不是"编辑中",不允许编辑码段!');
|
return;
|
}
|
this.openBasicDialog("add", null);
|
this.loadCodeSecType();
|
},
|
/** 打开新增或编辑基础码段对话框*/
|
openBasicDialog(condition, row) {
|
//console.log(row);
|
if (condition == "add") {
|
this.basicSecDialogTitle = "添加码段信息";
|
this.showbtn = true;
|
this.basicSecOnlyRead = false;
|
} else if (condition == "edit") {
|
if (this.selectionList.length != 1) {
|
this.$message.warning("请选择一条编码规则数据!");
|
return;
|
}
|
this.basicSecDialogTitle = "修改码段信息";
|
this.showbtn = true;
|
this.basicSecOnlyRead = false;
|
} else {
|
this.basicSecDialogTitle = "查看码段信息";
|
this.showbtn = false;
|
this.basicSecOnlyRead = true;
|
}
|
//console.log(this.form);
|
//为form绑定值
|
this.changeSectypeFormItems(condition == "add" ? null : row);
|
this.addBasicCodeSettingBox = true;
|
},
|
/** 新增基础码段*/
|
async saveOrEditBasicCode() {
|
this.isLoadingSecCodeAddBtn = true;
|
if (
|
this.selectionList[0].oid == null ||
|
this.selectionList[0].oid == ""
|
) {
|
this.$message.warning("缺失必要参数,请重新选择编码规则后再试!");
|
return;
|
}
|
this.form.pkCodeRule = this.selectionList[0].oid;
|
if (this.form.oid == "" || this.form.oid == null) {
|
if (this.checkForm()) {
|
await addSave(this.form).then(
|
() => {
|
this.$message({
|
type: "success",
|
message: "操作成功!",
|
});
|
console.log(this.form)
|
// 关闭对话框
|
this.addBasicCodeSettingBox = false;
|
// 点击新增基础码段,关闭窗口之后触发重新加载
|
this.loadBasic(this.selectionList[0]);
|
},
|
(error) => {
|
window.console.log(error);
|
}
|
);
|
}
|
} else {
|
// 可能参照引用的业务类型会发生改变所以这儿直接对referConfig的json进行改变
|
if (
|
this.form.referConfig === "coderefersec" ||
|
this.form.referConfig != undefined
|
) {
|
let referConfig = JSON.parse(this.form.referConfig);
|
referConfig.referType = this.form.referBtmId;
|
referConfig.referTypeName = this.form.referBtmName;
|
this.form.referConfig = JSON.stringify(referConfig);
|
// let referValueInfo = JSON.parse(this.form.referValueInfo);
|
// referValueInfo.referType = this.form.referBtmId;
|
}
|
let oldBasicSec = this.selectionBasicList.at(-1);
|
let secType = this.form.secType;
|
Vue.set(this.form, 'isClearValue', false);
|
if ((oldBasicSec.secType == "codefixedsec" || oldBasicSec.secType === "codeclassifysec") && oldBasicSec.secType != secType) {
|
await this.$confirm("码段类型由【" + oldBasicSec.secTypeText + "】,修改为" + "【" + secTypeEnum.getTextByValue(secType) + "】,请问是否需要清空关联的码值?", "提示", {
|
distinguishCancelAndClose: true,
|
closeOnClickModal: false,
|
confirmButtonText: "清空码值",
|
cancelButtonText: "保留码值",
|
}).then(() => {
|
// 清空码值
|
this.form.isClearValue = true;
|
}).catch(action => {
|
this.form.isClearValue = false;
|
});
|
}
|
await editSave(this.form).then(
|
() => {
|
this.$message({
|
type: "success",
|
message: "操作成功!",
|
});
|
this.loadBasic(this.selectionList[0]);
|
// 关闭对话框
|
this.addBasicCodeSettingBox = false;
|
},
|
(error) => {
|
window.console.log(error);
|
}
|
);
|
}
|
// 取消保存按钮加载效果
|
this.isLoadingSecCodeAddBtn = false;
|
},
|
/** 因为elementui的表单校验设置不上所以采用判断的方式来做表单检验方式*/
|
checkForm() {
|
let form = this.form;
|
//console.log(form);
|
const regNumber = /^[0-9]+\.{0,1}[0-9]*$/; //数字或小数正则校验
|
const regPos = /^[0-9]*[1-9][0-9]*$/; //非负整数正则校验
|
const tipsMsg = "必填项不能为空";
|
if (form.id == "") {
|
this.$message.warning("(码段编号)" + tipsMsg);
|
this.$refs.id.$el.querySelector("input").focus();
|
return false;
|
}
|
if (form.name == "") {
|
this.$message.warning("(码段名称)" + tipsMsg);
|
this.$refs.name.$el.querySelector("input").focus();
|
return false;
|
}
|
if (form.secType == "") {
|
this.$message.warning("(码段类型)" + tipsMsg);
|
this.$refs.secType.$el.querySelector("select").focus();
|
return false;
|
}
|
if (form.secType === "codefixedsec") {
|
//固定码段
|
if (form.codeSecLengthType == "") {
|
this.$message.warning("(码段长度类型)" + tipsMsg);
|
// this.$refs.codeSecLengthType.$el.querySelector('select').focus();
|
return false;
|
}
|
if (form.codeSecLength == "") {
|
this.$message.warning("(码段长度)" + tipsMsg);
|
this.$refs.codeSecLength.$el.querySelector("input").focus();
|
return false;
|
}
|
if (!regNumber.test(form.codeSecLength)) {
|
this.$message.warning("码段的长度必须为数字值");
|
this.$refs.codeSecLength.$el.querySelector("input").focus();
|
return false;
|
}
|
} else if (this.form.secType === "codeattrsec") {
|
//属性码段
|
if (form.referAttributeId == "") {
|
this.$message.warning("(属性)" + tipsMsg);
|
this.$refs.referAttributeId.$el.querySelector("input").focus();
|
return false;
|
}
|
} else if (this.form.secType === "codeserialsec") {
|
//console.log(form.codeFillType);
|
//流水码段
|
if (form.codeSecLength == "") {
|
this.$message.warning("(码段的长度)" + tipsMsg);
|
this.$refs.seriaCodeSecLength.$el.querySelector("input").focus();
|
return false;
|
}
|
if (!regNumber.test(form.codeSecLength)) {
|
this.$message.warning("码段的长度必须为数字值");
|
this.$refs.seriaCodeSecLength.$el.querySelector("input").focus();
|
return false;
|
}
|
if (!regNumber.test(form.serialStart)) {
|
this.$message.warning("流水号的起始值必须为数字值");
|
this.$refs.serialStart.$el.querySelector("input").focus();
|
return false;
|
}
|
if (!regNumber.test(form.serialStep)) {
|
this.$message.warning("流水的步长必须为数字值");
|
this.$refs.serialStep.$el.querySelector("input").focus();
|
return false;
|
}
|
if (form.codeFillType == "") {
|
this.$message.warning("(编码补位方式)" + tipsMsg);
|
return false;
|
}
|
if (form.codeFillType != "不补位" && form.codeFillSeparator == "") {
|
this.$message.warning(
|
"当补位方式为左补位或者右补位的时候,补位字符不能为空"
|
);
|
return false;
|
}
|
if (form.codeFillLength == "") {
|
this.$message.warning("填充长度不能为空");
|
this.$refs.codeFillLength.$el.querySelector("input").focus();
|
return false;
|
}
|
if (!regNumber.test(form.codeFillLength)) {
|
this.$message.warning("填充长度必须为数字值");
|
this.$refs.codeFillLength.$el.querySelector("input").focus();
|
return false;
|
}
|
if (form.codeFillLimit == "") {
|
this.$message.warning("(流水上限)" + tipsMsg);
|
this.$refs.codeFillLimit.$el.querySelector("input").focus();
|
return false;
|
}
|
if (!regNumber.test(form.codeFillLimit)) {
|
this.$message.warning("流水上限必须为数字值");
|
this.$refs.codeFillLimit.$el.querySelector("input").focus();
|
return false;
|
}
|
// if(form.codeFillFlag == '' || ){
|
// this.$message.warning('(流水是否补码)'+tipsMsg);
|
// return false;
|
// }
|
} else if (this.form.secType === "codelevelsec") {
|
//层级码段
|
if (form.codeLevelType == "") {
|
this.$message.warning("(层级类型)" + tipsMsg);
|
return false;
|
}
|
if (
|
form.codeLevelType != "code_level_min" &&
|
!regNumber.test(form.codeLevelValue)
|
) {
|
this.$message.warning("(层级的值)只能填写数字");
|
this.$refs.codeLevelValue.$el.querySelector("input").focus();
|
return false;
|
}
|
if (form.valueCutType == "") {
|
this.$message.warning("(字符截取类型)" + tipsMsg);
|
// this.$refs.valueCutType.$el.querySelector('select').focus();
|
return false;
|
}
|
if (
|
form.valueCutType != "code_cut_none" &&
|
!regPos.test(form.valueCutLength)
|
) {
|
this.$message.warning("(值截取长度)只能填写正整数");
|
this.$refs.valueCutLength.$el.querySelector("input").focus();
|
return false;
|
}
|
} else if (this.form.secType === "coderefersec") {
|
//引用码段
|
if (form.referBtmId == "") {
|
this.$message.warning("(参照引用的业务类型)" + tipsMsg);
|
this.$refs.referBtmId.$el.querySelector("input").focus();
|
return false;
|
}
|
if (form.referConfig == "") {
|
this.$message.warning("(参照配置)" + tipsMsg);
|
this.$refs.referConfig.$el.querySelector("input").focus();
|
return false;
|
}
|
} else if (this.form.secType === "codedatesec") {
|
//日期码段
|
if (form.codeDateFormatStr == "") {
|
this.$message.warning("(日期格式)" + tipsMsg);
|
this.$refs.codeDateFormatStr.$el.querySelector("input").focus();
|
return false;
|
}
|
} else if (this.form.secType === "codeclassifysec") {
|
//分类码段
|
if (form.codeSecLengthType == "") {
|
this.$message.warning("(码段长度类型)" + tipsMsg);
|
return false;
|
}
|
if (form.codeSecLength == "") {
|
this.$message.warning("(码段长度)" + tipsMsg);
|
this.$refs.classCodeSecLength.$el.querySelector("input").focus();
|
return false;
|
}
|
if (!regNumber.test(form.codeSecLength)) {
|
this.$message.warning("码段的长度必须为数字值");
|
this.$refs.classCodeSecLength.$el.querySelector("input").focus();
|
return false;
|
}
|
} else if (this.form.secType === "codevariablesec") {
|
//可变码段
|
if (form.codeSecLength == "") {
|
this.$message.warning("(码段长度)" + tipsMsg);
|
this.$refs.varCodeSecLength.$el.querySelector("input").focus();
|
return false;
|
}
|
if (!regNumber.test(form.codeSecLength)) {
|
this.$message.warning("码段的长度必须为数字值");
|
this.$refs.classCodeSecLength.$el.querySelector("input").focus();
|
return false;
|
}
|
if (form.codeFillType == "") {
|
this.$message.warning("(编码补位方式)" + tipsMsg);
|
return false;
|
}
|
// console.log(form);
|
if (
|
form.codeFillType != "code_fill_none" &&
|
form.codeFillSeparator == ""
|
) {
|
this.$message.warning(
|
"当补位方式为左补位或者右补位的时候,补位字符不能为空"
|
);
|
return false;
|
}
|
}
|
return true;
|
},
|
/** 判断数据是否选择以及只能选择单条数据*/
|
tipsMessage(list) {
|
if (list.length != 1) {
|
this.$message.warning("请选择一条数据!");
|
return false;
|
}
|
return true;
|
},
|
/** 基础码段删除*/
|
deleteBasicCode() {
|
if (!this.tipsMessage(this.selectionBasicList)) {
|
return;
|
}
|
if (this.selectionList.at(-1).lcStatus != "Editing") {
|
this.$message.warning('编码规则状态不是"编辑中",不允许删除码段!');
|
return;
|
}
|
let oid = this.selectionBasicList[0].oid;
|
this.$confirm("是否删除这条数据?如果被引用将不能被删除!", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning",
|
})
|
.then(() => {
|
let ts = new Date(this.selectionBasicList[0].ts).getTime();
|
return deleteData({oid: oid, ts: ts});
|
})
|
.then(() => {
|
this.loadBasic({
|
oid:
|
this.currentCodeRuleOid == null || this.currentCodeRuleOid == ""
|
? this.selectionList[0].oid
|
: this.currentCodeRuleOid,
|
});
|
this.$message({
|
type: "success",
|
message: "操作成功!",
|
});
|
this.$refs.crudBasic.toggleSelection();
|
});
|
},
|
/** 点击触发加载基础码段信息*/
|
loadBasic(row) {
|
this.loadingBasic = true;
|
// console.log(row.oid);
|
if (row != "" || row != null) {
|
//存储当前关联的编码规则相关信息
|
this.currentCodeRuleOid = row.oid;
|
this.currentRuleLcStatus = row.lcStatus;
|
this.sendGridCodeBasicSec({pkCodeRule: row.oid}, false);
|
}
|
},
|
/** 发送加载基础码段的请求*/
|
sendGridCodeBasicSec(condition, isAdancedQuery /** 是否高级查询 */) {
|
// 如果当前基础码段表中的搜索按钮被隐藏,就需要在此开启
|
if (
|
this.selectionList.length >= 0 &&
|
!this.$refs.crudBasic.option.column[0].search
|
) {
|
this.hideBasicTable(true);
|
}
|
let conditionMaps = {};
|
if (condition && !isAdancedQuery) {
|
Object.keys(condition).forEach((key) => {
|
conditionMaps["conditionMap[" + key + "]"] = condition[key].trim();
|
});
|
}
|
if (isAdancedQuery) {
|
condition["conditionMap[pkCodeRule]"] =
|
this.currentCodeRuleOid == null || this.currentCodeRuleOid == ""
|
? this.selectionList[0].oid
|
: this.currentCodeRuleOid;
|
}
|
gridCodeBasicSec(1, -1, isAdancedQuery ? condition : conditionMaps).then(
|
(res) => {
|
const data = res.data.data;
|
this.basicData = data.records;
|
this.loadingBasic = false;
|
}
|
);
|
},
|
/** 基础码段选中时触发*/
|
selectionBasicChange(list) {
|
this.selectionBasicList = list;
|
this.$refs.crudBasic.setCurrentRow(
|
this.selectionBasicList[list.length - 1]
|
);
|
},
|
/** 基础码段被单击表格行时触发*/
|
codeBasicSecRowClick(row) {
|
this.$refs.crudBasic.toggleSelection();
|
this.selectionBasicList = row;
|
this.$refs.crudBasic.setCurrentRow(row);
|
this.$refs.crudBasic.toggleRowSelection(row); //选中当前行
|
},
|
basicSearchChange(params, done) {
|
this.sendGridCodeBasicSec(
|
Object.assign(params, {
|
pkCodeRule: this.selectionList[this.selectionList.length - 1].oid,
|
}),
|
false
|
);
|
done();
|
},
|
basicSearchReset() {
|
this.sendGridCodeBasicSec(
|
{pkCodeRule: this.selectionList[this.selectionList.length - 1].oid},
|
false
|
);
|
},
|
/** 上移下移基础码段*/
|
async upOrderNum(row) {
|
if (!this.tipsMessage(this.selectionList)) {
|
return;
|
}
|
if (this.selectionList[0].lcStatus != "Editing") {
|
this.$message.warning(
|
"只有编码规则的状态是 [编辑中] 的时候,才能调整码段顺序!"
|
);
|
return;
|
}
|
if (row.oid == null || row.oid == "") {
|
this.$message.warning("未获取到必填参数!");
|
return;
|
}
|
await upOrderNum(row.oid).then(() => {
|
this.loadBasic(this.selectionList[0]);
|
this.$message({
|
type: "success",
|
message: "操作成功!",
|
});
|
});
|
},
|
downOrderNum(row) {
|
//console.log(row.oid);
|
if (!this.tipsMessage(this.selectionList)) {
|
return;
|
}
|
let codeRuleOid = this.selectionList[0].oid;
|
if (this.selectionList[0].lcStatus != "Editing") {
|
this.$message.warning(
|
"只有编码规则的状态是 [编辑中] 的时候,才能调整码段顺序!"
|
);
|
return;
|
}
|
if (row.oid == null || row.oid == "") {
|
this.$message.warning("未获取到必填参数!");
|
return;
|
}
|
downOrderNum(row.oid).then(() => {
|
this.loadBasic({oid: codeRuleOid});
|
this.$message({
|
type: "success",
|
message: "操作成功!",
|
});
|
});
|
},
|
/** 基础码段刷新时查询*/
|
refreshChangeBasicSec() {
|
this.loadBasic(this.selectionList.at(-1));
|
},
|
/** 操作基础码段中搜索清空等按钮的显示/隐藏*/
|
hideBasicTable(hideBoolean) {
|
this.$refs.crudBasic.option.refreshBtn = hideBoolean;
|
this.$refs.crudBasic.option.column[0].search = hideBoolean;
|
this.$refs.crudBasic.option.column[1].search = hideBoolean;
|
if (!hideBoolean) {
|
this.selectionList = [];
|
this.basicData = [];
|
}
|
},
|
changeCutType(value) {
|
if (value != "code_cut_none") {
|
if (this.form.valueCutLength == "") {
|
this.form.valueCutLength = 1;
|
}
|
} else {
|
this.form.valueCutLength = "";
|
}
|
},
|
|
/** 第一层对话框相关方法 */
|
/** 打开二层对话框方法*/
|
openAttrSelectOrGetValue(condition) {
|
if (condition === "attr") {
|
this.isShowSelectAttrOption = true;
|
this.loadlistClassifyLinkAttr();
|
} else if (condition === "value") {
|
//打开公式编辑框,第二层嵌套对话框
|
//this.$refs.formulaEditor.isShowformulaEdit = true;
|
this.formulaEditorParams.formulaEditorSettingBox = true;
|
} else if (condition === "parentClassifySecOid") {
|
this.parentClsfyParams.isShowParentClassifySettingBox = true;
|
} else if (condition === "referBtmId") {
|
this.referBtmDialogParams.selectReferBtmSettingBox = true;
|
// 调用子组件刷新表格数据
|
this.$refs[this.referBtmDialogParams.ref].referBtmOnLoad();
|
} else if (condition === "referConfig") {
|
this.referConfigVisble = true;
|
this.referConfigOption = {
|
referBtmName: this.form.referBtmName,
|
referBtmId: this.form.referBtmId,
|
referConfig: this.form.referConfig || "",
|
};
|
this.$refs.referConfig.$el.querySelector("input").blur();
|
}
|
},
|
|
/** 点击输入框的×号,清空输入框中的内容*/
|
clearAttrDataByIcon(condition) {
|
if (condition === "attr") {
|
this.form.referAttributeName = "";
|
this.form.referAttributeId = "";
|
this.form.referCodeClassifyOid = "";
|
this.form.referCodeClassifyOidName = "";
|
} else if (condition === "value") {
|
this.form.getValueClass = "";
|
} else if (condition === "parentClassifySecOid") {
|
this.form.parentClassifySecOid = "";
|
} else if (condition === "referBtmId") {
|
this.form.referBtmId = "";
|
this.form.referBtmName = "";
|
this.form.referConfig = "";
|
} else if (condition === "referConfig") {
|
this.form.referConfig = "";
|
}
|
},
|
/** 补位时的字符,实现可输可选*/
|
inputSelectBlur(e) {
|
if (e.target.value) {
|
this.form.codeFillSeparator = e.target.value;
|
}
|
},
|
/** 码段类型改变时,增加对应的form表单中的属性*/
|
changeSectypeFormItems(row) {
|
console.log(row)
|
if (
|
func.isEmpty(this.enumParam.secTypeList) ||
|
this.enumParam.secTypeList.length == 0
|
) {
|
this.loadCodeSecType();
|
}
|
this.form = {
|
oid: row != null ? row.oid : this.form.oid,
|
id: row != null ? row.id : this.form.id, //编号,
|
name: row != null ? row.name : this.form.name, //名称
|
secType: row != null ? row.secType : this.form.secType, //码段类型
|
description: row != null ? row.description : this.form.description, //描述
|
serialDependFlag: this.isNullJsonBoolean(row, this.form, 'serialDependFlag'), //是否流水依赖
|
//serialDependOrder: row != null ? row.serialDependOrder : this.form.serialDependOrder, //流水依赖顺序
|
nullableFlag: this.isNullJsonBoolean(row, this.form, 'nullableFlag'), //是否为空
|
displayFlag: this.isNullJsonBoolean(row, this.form, 'displayFlag'),
|
componentCodeFlag: this.isNullJsonBoolean(row, this.form, 'componentCodeFlag'), //是否参与编码
|
pkCodeRule: row != null ? row.pkCodeRule : this.form.pkCodeRule, //所属编码规则
|
prefixCode: row != null ? row.prefixCode : this.form.prefixCode, //前缀
|
suffixCode: row != null ? row.suffixCode : this.form.suffixCode, //后缀
|
// customCodeSerialClass: row != null ? row.customCodeSerialClass : this.form.customCodeSerialClass
|
};
|
if (this.form.secType === "codefixedsec") {
|
//固定码段
|
this.form = Object.assign({}, this.form, {
|
codeSecLength:
|
row != null && row.codeSecLength != "" ? row.codeSecLength : "",
|
codeSecLengthType:
|
row != null && row.codeSecLengthType != ""
|
? row.codeSecLengthType
|
: "code_sec_length_variable",
|
});
|
this.loadCodeSecLength();
|
} else if (this.form.secType === "codeattrsec") {
|
//属性码段
|
this.form = Object.assign({}, this.form, {
|
referCodeClassifyOid:
|
row != null && row.referCodeClassifyOid != ""
|
? row.referCodeClassifyOid
|
: "", //属性id
|
referCodeClassifyOidName:
|
row != null && row.referCodeClassifyOidName != ""
|
? row.referCodeClassifyOidName
|
: "", //属性所在分类
|
referAttributeId:
|
row != null && row.referAttributeId != ""
|
? row.referAttributeId
|
: "", //属性编号
|
referAttributeName:
|
row != null && row.referAttributeName != ""
|
? row.referAttributeName
|
: "", //属性
|
getValueClass:
|
row != null && row.getValueClass != "" ? row.getValueClass : "", //取值规则
|
});
|
} else if (this.form.secType === "codeserialsec") {
|
//流水码段
|
this.form = Object.assign({}, this.form, {
|
codeSecLength:
|
row != null && row.codeSecLength != "" ? row.codeSecLength : "", //码段的长度
|
serialStart:
|
row != null && row.serialStart != "" ? row.serialStart : 1, //流水号起始值
|
serialStep: row != null && row.serialStep != "" ? row.serialStep : 1, //流水的步长
|
codeFillType: row != null && row.codeFillType != ""
|
? row.codeFillType
|
: "code_fill_left", //编码补位方式
|
// codeFillSeparatorSelect: row!=null&&row.codeFillSeparatorSelect != '' ? row.codeFillSeparatorSelect:0, //补位时的字符,选中的下拉框的下标
|
codeFillSeparator:
|
row != null && row.codeFillSeparator != ""
|
? row.codeFillSeparator
|
: "0", //补位时的字符
|
codeFillLength:
|
row != null && row.codeFillLength != "" ? row.codeFillLength : "", //填充长度
|
codeFillLimit:
|
row != null && row.codeFillLimit != "" ? row.codeFillLimit : "", //流水上限
|
codeFillFlag:
|
row != null && row.codeFillFlag != ""
|
? row.codeFillFlag == "true"
|
? true
|
: false
|
: false, //流水是否补码
|
customCodeSerialClass:
|
row != null && row.customCodeSerialClass != ""
|
? row.customCodeSerialClass
|
: "", //自定义流水算法
|
});
|
this.loadCodeFillType();
|
this.loadCodeFillSeparator();
|
} else if (this.form.secType === "codelevelsec") {
|
//层级码段
|
this.form = Object.assign({}, this.form, {
|
codeLevelType:
|
row != null && row.codeLevelType != ""
|
? row.codeLevelType
|
: "code_level_min", //层级类型 枚举查询
|
codeLevelValue:
|
row != null && row.codeLevelValue != "" ? row.codeLevelValue : "", //层级的值
|
valueCutType:
|
row != null && row.valueCutType != ""
|
? row.valueCutType
|
: "code_cut_none", //字符截取类型 枚举查询
|
valueCutLength:
|
row != null && row.valueCutLength != "" ? row.valueCutLength : "", //
|
codeGetValueType:
|
row != null && row.codeGetValueType != ""
|
? row.codeGetValueType
|
: "code_get_value_all_up", //取值类型 枚举查询
|
});
|
this.loadCodeLevelType();
|
this.loadCodeCutType();
|
this.loadCodeGetValueType();
|
} else if (this.form.secType === "coderefersec") {
|
//引用码段
|
this.form = Object.assign({}, this.form, {
|
referBtmId: row != null && row.referBtmId != "" ? row.referBtmId : "", //参照引用的业务类型,的id
|
referBtmName:
|
row != null && row.referBtmName != "" ? row.referBtmName : "", //参照引用的业务类型
|
referConfig:
|
row != null && row.referConfig != "" ? row.referConfig : "", //参照配置
|
referValueInfo:
|
row != null && row.referValueInfo != "" ? row.referValueInfo : "", //参照配置
|
});
|
} else if (this.form.secType === "codedatesec") {
|
//日期码段
|
this.form = Object.assign({}, this.form, {
|
codeDateFormatStr:
|
row != null && row.codeDateFormatStr != ""
|
? row.codeDateFormatStr
|
: "", //日期格式
|
});
|
} else if (this.form.secType === "codeclassifysec") {
|
//分类码段
|
this.form = Object.assign({}, this.form, {
|
codeSecLengthType:
|
row != null && row.codeSecLengthType != ""
|
? row.codeSecLengthType
|
: "code_sec_length_variable", //码段长度类型
|
codeSecLength:
|
row != null && row.codeSecLength != "" ? row.codeSecLength : "", //码段的长度
|
matchClassifyValueFlag:
|
row != null && row.matchClassifyValueFlag != ""
|
? row.matchClassifyValueFlag == "true"
|
? true
|
: false
|
: false, //是否自动匹配值
|
parentClassifySecOid:
|
row != null && row.parentClassifySecOid != ""
|
? row.parentClassifySecOid
|
: "", //父分类码段选中的id
|
parentClassifySecText:
|
row != null && row.parentClassifySecText != ""
|
? row.parentClassifySecText
|
: "", //父分类码段
|
});
|
this.loadCodeSecLength();
|
} else if (this.form.secType === "codevariablesec") {
|
//可变码段
|
this.form = Object.assign({}, this.form, {
|
codeSecLength:
|
row != null && row.codeSecLength != "" ? row.codeSecLength : "", //码段的长度
|
codeFillType:
|
row != null && row.codeFillType != ""
|
? row.codeFillType
|
: "code_fill_left", //编码部位方式,枚举查询
|
// codeFillSeparatorSelect: row!=null&&row.codeFillSeparatorSelect != '' ? row.codeFillSeparatorSelect:0, //选中的补位时的字符的下标
|
codeFillSeparator:
|
row != null && row.codeFillSeparator != ""
|
? row.codeFillSeparator
|
: "0", //补位时的字符,可输可选查询
|
});
|
this.loadCodeFillType();
|
this.loadCodeFillSeparator();
|
}
|
},
|
// 判断Boolean值是否为空,并且对str类型布尔值进行转换
|
isNullJsonBoolean(row, form, attr) {
|
//console.log(row[attr],form[attr]);
|
if (row != null) {
|
return JSON.parse(row[attr]);
|
} else {
|
return form[attr];
|
}
|
},
|
/** 第一次请求的枚举数据放缓存*/
|
getLocalStorageEnum(enumKey) {
|
let enumCach = JSON.parse(localStorage.getItem(enumKey));
|
if (enumCach == null) {
|
getDictionary({code: enumKey}).then((res) => {
|
enumCach = res.data.data;
|
localStorage.setItem(enumKey, JSON.stringify(res.data.data));
|
});
|
}
|
return enumCach;
|
},
|
/** 统一加载所有枚举查询,主要是为避免切换码段类型时还未加载完成的情况*/
|
loadTotalEnum() {
|
this.loadCodeSecType();
|
this.loadCodeSecLength();
|
this.loadCodeFillType();
|
this.loadCodeFillSeparator();
|
this.loadCodeLevelType();
|
this.loadCodeCutType();
|
this.loadCodeGetValueType();
|
},
|
/** 枚举和可输可选内容查询 */
|
loadCodeSecType() {
|
this.enumParam.secTypeList = this.getLocalStorageEnum("codeSecType") || [];
|
this.loadCodeSecLength();
|
},
|
loadCodeSecLength() {
|
this.enumParam.codeSecLengthType = this.getLocalStorageEnum("codeSecLength") || [];
|
},
|
loadCodeFillType() {
|
this.enumParam.codeFillType = this.getLocalStorageEnum("codeFillType") || [];
|
},
|
loadCodeFillSeparator() {
|
//let enumCach = JSON.parse(localStorage.getItem("codeFillSeparator"));
|
//if (enumCach == null) {
|
getDictionaryBiz({code: "codeFillSeparator"}).then((res) => {
|
this.enumParam.codeFillSeparator = res.data.data;
|
//console.log(this.enumParam.codeFillSeparator);
|
localStorage.setItem(
|
"codeFillSeparator",
|
JSON.stringify(res.data.data)
|
);
|
});
|
//}
|
},
|
loadCodeLevelType() {
|
this.enumParam.codeLevelType = this.getLocalStorageEnum("codeLevelType") || [];
|
},
|
loadCodeCutType() {
|
this.enumParam.codeCutType = this.getLocalStorageEnum("codeCutType") || [];
|
},
|
loadCodeGetValueType() {
|
this.enumParam.codeGetValueType = this.getLocalStorageEnum("codeGetValueType") || [];
|
},
|
// 最大流水号
|
maxSerialNum() {
|
if (this.selectionList.length <= 0) {
|
this.$message.warning("请选择一条编码规则!");
|
return;
|
}
|
if (this.selectionList.length > 1) {
|
this.$message.warning("只能选择一条编码规则!");
|
return;
|
}
|
this.maxSerial.visible = true;
|
this.maxSerial.ruleOid = this.selectionList[0]["oid"];
|
},
|
},
|
};
|
</script>
|
|
<style>
|
[class^="icon-"] {
|
font-size: 12px !important;
|
}
|
|
.code-rule-crud > .avue-crud__search,
|
.code-basic-crud > .avue-crud__search {
|
margin-bottom: -15px;
|
}
|
|
.clone-input-textarea > .el-form-item__content {
|
width: 495px;
|
}
|
|
.clone-avue-crud > .el-card > .el-card__body > .avue-crud__menu {
|
display: none !important;
|
}
|
|
.fixed-avue-crud > .el-card > .el-card__body > .avue-crud__menu {
|
display: none !important;
|
}
|
|
.other-clone-codebasic-crud > .el-card > .el-card__body > .avue-crud__menu {
|
display: none !important;
|
}
|
|
.other-clone-coderule-crud > .el-card > .el-card__body > .avue-crud__menu {
|
display: none !important;
|
}
|
|
.el-table--small .el-table__cell {
|
padding: 3px 0;
|
}
|
|
.classify_value_box > .el-scrollbar {
|
height: 95%;
|
}
|
|
.basic-container > .el-card > .el-card__body {
|
margin: -10px 0;
|
}
|
|
.code-basicsec-container {
|
padding: 1px 6px;
|
}
|
|
.horizontal-line {
|
/* margin-top: 19px !important; */
|
margin-bottom: -20px !important;
|
width: 100%;
|
height: 2px;
|
}
|
|
.el-card__body > .treeBox {
|
height: 56vh;
|
}
|
|
.el-col-5 > .box {
|
height: 56vh;
|
}
|
|
.operator_,
|
filter,
|
.layui-btn {
|
width: 60px;
|
}
|
|
.left > .el-form-item > .el-form-item__content > .el-input-number {
|
width: 120px;
|
}
|
|
.left
|
> .el-form-item
|
> .el-form-item__content
|
> .el-input-number
|
> .el-input
|
> .el-input__inner {
|
width: 120px;
|
}
|
|
.el-col > .el-card > .el-card__header {
|
background: rgb(213 231 239);
|
border-radius: inherit;
|
}
|
|
/** 新增码段 */
|
.add-basicsec-dialog > .el-dialog > .el-dialog__body {
|
padding: 20px 20px 4px;
|
margin-bottom: 30px;
|
}
|
|
.add-basicsec-total {
|
width: 100%;
|
height: 500px;
|
}
|
|
.add-basicsec-total .el-input__inner,
|
.add-basicsec-total .el-textarea__inner {
|
width: 220px;
|
}
|
|
.add-basicsec-total > .add-basicsec-form {
|
display: flex;
|
flex-direction: row;
|
width: 100%;
|
height: 100%;
|
align-items: center;
|
justify-content: space-around;
|
}
|
|
.add-basicsec-form > .el-divider--vertical {
|
width: 2px;
|
height: 78%;
|
position: absolute;
|
top: 50%;
|
left: 50%;
|
transform: translate(-50%, -50%);
|
}
|
|
.left {
|
/* float: left; */
|
width: 45%;
|
height: 100%;
|
}
|
|
.right {
|
/* float: right; */
|
margin-right: 2vw;
|
height: 100%;
|
width: auto;
|
}
|
|
.add-basicsec-form > .left > .el-form-item,
|
.add-basicsec-form > .right > div > .el-form-item {
|
margin-bottom: 12px;
|
}
|
|
/* 对话框底部按钮边框样式 */
|
.el-dialog__footer {
|
/* width: 100%; */
|
border-top: 1px solid #e9e7e7;
|
padding: 5px 10px 10px;
|
}
|
|
.seloption {
|
margin-left: 10px;
|
}
|
|
/* .code-total > .basic-container__card {
|
height: 100%;
|
} */
|
|
</style>
|