| | |
| | | <el-button type="text" |
| | | size="small" |
| | | icon="el-icon-edit" |
| | | v-show="scope.row.lcStatusText=='编辑中' ? true:false" |
| | | v-show="scope.row.lcStatus=='Editing' ? true:false" |
| | | plain |
| | | @click="openEdit(scope.row)">编 辑 |
| | | </el-button> |
| | | <el-button type="text" |
| | | size="small" |
| | | icon="el-icon-position" |
| | | v-show="scope.row.lcStatusText=='编辑中' ? true:false" |
| | | v-show="scope.row.lcStatus=='Editing' ? true:false" |
| | | plain |
| | | @click="enableOrDeactivatse(scope.row.oid,'release')">发 布 |
| | | </el-button> |
| | | <el-button type="text" |
| | | size="small" |
| | | v-show="scope.row.lcStatusText=='已发布' ? true:false" |
| | | v-show="scope.row.lcStatus=='Released' ? true:false" |
| | | icon="el-icon-video-pause" |
| | | plain |
| | | @click="enableOrDeactivatse(scope.row.oid,'disable')">停 用 |
| | | </el-button> |
| | | <el-button type="text" |
| | | size="small" |
| | | v-show="scope.row.lcStatusText=='停用' ? true:false" |
| | | v-show="scope.row.lcStatus=='Disabled' ? true:false" |
| | | icon="el-icon-video-play" |
| | | plain |
| | | @click="enableOrDeactivatse(scope.row.oid,'enable')">启 用 |
| | |
| | | :table-loading="loadingBasic" |
| | | :data="basicData" |
| | | :permission="permissionList" |
| | | @refresh-change="refreshChange"> |
| | | @selection-change="selectionBasicChange" |
| | | @refresh-change="refreshChangeBasicSec"> |
| | | |
| | | <!-- 基础码段表格内操作按钮 --> |
| | | <template slot="menu" slot-scope="scope"> |
| | | |
| | | <el-button type="text" |
| | | size="small" |
| | | icon="icon-shangyi" |
| | | v-show="scope.row.lcStatus != 'Editing' ? true:false" |
| | | plain |
| | | @click="openEdit(scope.row)">查 看 |
| | | </el-button> |
| | | |
| | | <el-button type="text" |
| | | size="small" |
| | | icon="icon-shangyi" |
| | | v-show="scope.row.lcStatus == 'Editing' ? true:false" |
| | | plain |
| | | @click="openEdit(scope.row)">编 辑 |
| | | </el-button> |
| | | |
| | | <el-button type="text" |
| | | size="small" |
| | | icon="icon-shangyi" |
| | | v-show="scope.row.secType == 'codeclassifysec' || scope.row.secType == 'codefixedsec' ? true:false" |
| | | plain |
| | | @click="openEdit(scope.row)">码值管理 |
| | | </el-button> |
| | | |
| | | <el-button type="text" |
| | | size="small" |
| | | icon="icon-shangyi" |
| | | v-show="scope.row.orderNum > 1 ? true:false" |
| | | plain |
| | | @click="upOrderNum(scope.row)">上 移 |
| | | </el-button> |
| | | |
| | | <el-button type="text" |
| | | size="small" |
| | | icon="icon-xiayi" |
| | | plain |
| | | @click="downOrderNum(scope.row)">下 移 |
| | | </el-button> |
| | | |
| | | </template> |
| | | |
| | | <!-- 基础码段表格左上方按钮区域 --> |
| | | <template slot="menuLeft" slot-scope="scope"> |
| | | <el-button type="primary" |
| | | size="small" |
| | | icon="el-icon-plus" |
| | | @click="addBasicCodeSec">新 增 |
| | | </el-button> |
| | | <el-button type="danger" |
| | | size="small" |
| | | icon="el-icon-delete" |
| | | plain |
| | | @click="deleteBasicCode(scope.row)">删 除 |
| | | </el-button> |
| | | </template> |
| | | |
| | | </avue-crud> |
| | | </basic-container> |
| | | |
| | | <!-- 基础编码规则对话框 @closed="closeRefresh"--> |
| | | <el-dialog title="添加码段信息" |
| | | append-to-body |
| | | :visible.sync="addBasicCodeSettingBox" |
| | | width="780px" |
| | | style=" margin-top: -8vh;" |
| | | destroy-on-close> |
| | | <add-basic-code ref='addBasicChild'></add-basic-code> |
| | | <el-divider direction="horizontal"></el-divider> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button @click="addBasicCodeSettingBox = false">取 消</el-button> |
| | | <el-button type="primary" @click="saveBasicCode">保 存</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | </basic-container> |
| | | |
| | |
| | | |
| | | <script> |
| | | import { gridCodeRule, getDetail, add, update, remove, listUseRange, updateStatus } from "@/api/code/mdmrule"; |
| | | import { gridCodeBasicSec } from "@/api/code/codebasic"; |
| | | import { gridCodeBasicSec, downOrderNum, upOrderNum, deleteData, editSave, getObjectByOid, listDataByOids, refDataGrid} from "@/api/code/codebasic"; |
| | | import optionBasic from "@/const/code/codebasic"; |
| | | import optionRule from "@/const/code/mdmrule"; |
| | | import {mapGetters} from "vuex"; |
| | |
| | | form: {}, |
| | | query: {}, |
| | | loading: true, |
| | | |
| | | currentCodeRuleOid: '', |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | |
| | | //基础码段展示 |
| | | basicData:[], |
| | | loadingBasic: true, |
| | | |
| | | selectionBasicList: [], |
| | | addBasicCodeSettingBox: false, |
| | | |
| | | /*使用范围对话框控制*/ |
| | | codeRangeSettingBox: false, |
| | | useRangeData: [], |
| | |
| | | }, |
| | | }, |
| | | methods: { |
| | | //点击出发加载基础码段信息 |
| | | |
| | | // 打开新增窗口 |
| | | addBasicCodeSec(){ |
| | | if(!this.tipsMessage(this.selectionList)){ |
| | | return; |
| | | } |
| | | if(this.selectionList[0].lcStatus != 'Editing'){ |
| | | this.$message.warning('编码规则状态不是"编辑中",不允许编辑码段!'); |
| | | return; |
| | | } |
| | | this.addBasicCodeSettingBox = true; |
| | | this.$nextTick(() => { |
| | | this.$refs.addBasicChild.loadCodeSecType(); |
| | | }) |
| | | }, |
| | | // 新增基础码段 |
| | | saveBasicCode(){ |
| | | if(this.selectionList[0].oid == null){ |
| | | this.$message.warning('缺失必要参数,请重新选择编码规则后重试!'); |
| | | return; |
| | | } |
| | | this.$refs.addBasicChild.addSave(this.selectionList[0].oid); |
| | | // 关闭窗口 |
| | | this.addBasicCodeSettingBox = false |
| | | // 点击新增基础码段之后关闭窗口之后触发重新加载 |
| | | this.loadBasic(this.selectionList[0]); |
| | | }, |
| | | // 判断数据是否选择以及只能选择单条数据 |
| | | tipsMessage(list){ |
| | | if(list.length != 1){ |
| | | this.$message.warning("请选择一条编码规则数据!"); |
| | | return false; |
| | | } |
| | | return true; |
| | | }, |
| | | // 基础码段删除 |
| | | deleteBasicCode(){ |
| | | if(!this.tipsMessage(this.selectionBasicList)){ |
| | | return; |
| | | } |
| | | let oid = this.selectionBasicList[0].oid; |
| | | this.$confirm("是否删除这条数据?如果被引用将不能被删除!", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | let ts = this.selectionBasicList[0].ts; |
| | | return deleteData({"oid": oid,"ts": ts}); |
| | | }) |
| | | .then(() => { |
| | | this.loadBasic({"oid":this.currentCodeRuleOid == null ? this.selectionList[0].oid:this.currentCodeRuleOid}); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | //this.$refs.crud.toggleSelection(); |
| | | }); |
| | | }, |
| | | // 点击触发加载基础码段信息 |
| | | loadBasic(row){ |
| | | this.loadingBasic = true; |
| | | //console.log(row.oid); |
| | | this.currentCodeRuleOid = row.oid; |
| | | gridCodeBasicSec(1, -1, {"pkCodeRule":row.oid}).then(res => { |
| | | const data = res.data.data; |
| | | this.basicData = data.records; |
| | | //console.log(this.basicData); |
| | | this.loadingBasic = false; |
| | | }); |
| | | |
| | | }, |
| | | |
| | | //查询使用范围 |
| | | handleRange(){ |
| | | if (this.selectionList.length === 0) { |
| | | this.$message.warning("请选择至少一条数据!"); |
| | | selectionBasicChange(list) { |
| | | this.selectionBasicList = list; |
| | | //console.log(this.selectionBasicList); |
| | | }, |
| | | // 上移下移基础码段 |
| | | upOrderNum(row){ |
| | | //console.log(row.oid); |
| | | if(!this.tipsMessage(this.selectionList)){ |
| | | return; |
| | | } |
| | | if (this.selectionList.length > 1) { |
| | | this.$message.warning("每次只能选择一条数据!"); |
| | | 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; |
| | | } |
| | | upOrderNum(row.oid).then(() => { |
| | | this.loadBasic({"oid":codeRuleOid}); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | }) |
| | | }, |
| | | downOrderNum(row){ |
| | | //console.log(row.oid); |
| | | if(!this.tipsMessage(this.selectionList)){ |
| | | return; |
| | | } |
| | | let codeRuleOid = this.selectionList[0].oid; |
| | | //console.log(this.selectionList); |
| | | 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({"oid":this.currentCodeRuleOid == null ? this.selectionList[0].oid:this.currentCodeRuleOid}); |
| | | }, |
| | | // 查询使用范围 |
| | | handleRange(){ |
| | | if(!this.tipsMessage(this.selectionList)){ |
| | | return; |
| | | } |
| | | this.codeRangeSettingBox = true; |
| | |
| | | refreshUseRangeChange(){ |
| | | this.getRangeCodeList(); |
| | | }, |
| | | //启用与停用 |
| | | // 启用与停用 |
| | | enableOrDeactivatse(oId,update){ |
| | | updateStatus({"oid":oId,"ts":new Date().getTime,"update":update}).then(() => { |
| | | this.onLoad(this.page); |
| | |
| | | window.console.log(error); |
| | | }); |
| | | }, |
| | | //克隆 |
| | | // 克隆 |
| | | cloneCodeSetting() { |
| | | if (this.selectionList.length === 0) { |
| | | this.$message.warning("请选择至少一条数据!"); |
| | |
| | | localStorage.setItem("cloneOid",this.selectionList[0].oid) |
| | | this.cloneSettingBox = true; |
| | | }, |
| | | |
| | | // 添加 |
| | | rowSave(row, done, loading) { |
| | | add(row).then(() => { |
| | |
| | | }, |
| | | // 删除 |
| | | handleDelete() { |
| | | if (this.selectionList.length === 0) { |
| | | this.$message.warning("请选择至少一条数据"); |
| | | return; |
| | | } |
| | | if (this.selectionList.length > 1) { |
| | | this.$message.warning("每次只能选择一条数据"); |
| | | if(!this.tipsMessage(this.selectionList)){ |
| | | return; |
| | | } |
| | | this.$confirm("确定将选择数据删除?", { |
| | |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | let ts = new Date().getTime(); |
| | | // 只支持每次单条记录删除 |
| | | let oid = this.selectionList[0].oid |
| | | let oid = this.selectionList[0].oid; |
| | | let ts = this.selectionList[0].ts; |
| | | return remove({oid: oid,ts: ts}); |
| | | }) |
| | | .then(() => { |
| | |
| | | this.$refs.crud.toggleSelection(); |
| | | }); |
| | | }, |
| | | //打开修改 |
| | | // 打开修改 |
| | | beforeOpen(done, type) { |
| | | if (["edit", "view"].includes(type)) { |
| | | getDetail(this.form.oid).then(res => { |
| | |
| | | }, |
| | | selectionChange(list) { |
| | | this.selectionList = list; |
| | | if(this.selectionList.length > 0){ |
| | | this.currentCodeRuleOid = this.selectionList [list.length-1]; |
| | | this.loadBasic(this.selectionList[list.length-1]); |
| | | } |
| | | }, |
| | | selectionClear() { |
| | | this.selectionList = []; |
| | |
| | | </script> |
| | | |
| | | <style> |
| | | .icon-lianjiekelong { |
| | | font-size: 12px; |
| | | } |
| | | |
| | | .el-divider--horizontal { |
| | | margin-top: 19px !important; |
| | | margin-bottom: -20px !important; |
| | | height: 2px; |
| | | margin: 0; |
| | | } |
| | | |
| | | |
| | | </style> |