¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <el-dialog |
| | | :close-on-click-modal="false" |
| | | :visible.sync="cloneSettingBox" |
| | | append-to-body |
| | | class="avue-dialog avue-dialog--top" |
| | | style="height: 100vh" |
| | | title="å
éç¼ç è§å" |
| | | top="-3%" |
| | | @close="closeCloneDialog" |
| | | width="800px"> |
| | | <div> |
| | | <el-row> |
| | | <el-form ref="form" :inline="true" :model="form" label-width="80px"> |
| | | <el-form-item label="ç¼å·" required> |
| | | <el-input v-model="cloneCodeRuleForm.id"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="åç§°" required> |
| | | <el-input v-model="cloneCodeRuleForm.name"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="便®" required> |
| | | <el-input v-model="cloneCodeRuleForm.accordingTo"></el-input> |
| | | </el-form-item> |
| | | <el-form-item class="clone-input-textarea" label="æè¿°"> |
| | | <el-input |
| | | v-model="cloneCodeRuleForm.description" |
| | | :autosize="{ minRows: 3, maxRows: 5 }" |
| | | type="textarea" |
| | | ></el-input> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-row> |
| | | <el-row> |
| | | <p |
| | | style=" |
| | | margin: 0 0px 16px 50%; |
| | | font-weight: 500; |
| | | font-size: 20px; |
| | | color: #000;"> |
| | | ç æ®µç®¡ç |
| | | </p> |
| | | <avue-crud |
| | | :data="cloneData" |
| | | :option="cloneOption" |
| | | :table-loading="cloneTableLoading" |
| | | class="clone-avue-crud"> |
| | | <template slot="menu" slot-scope="scope"> |
| | | <el-button |
| | | v-show="scope.row.orderNum > 1" |
| | | icon="el-icon-arrow-up" |
| | | plain |
| | | size="small" |
| | | type="text" |
| | | @click="upOrderNum(scope.row)" |
| | | >ä¸ç§» |
| | | </el-button> |
| | | <el-button |
| | | icon="el-icon-arrow-down" |
| | | plain |
| | | size="small" |
| | | type="text" |
| | | @click="downOrderNum(scope.row)" |
| | | >ä¸ç§» |
| | | </el-button> |
| | | </template> |
| | | </avue-crud> |
| | | </el-row> |
| | | </div> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="saveCloneCodeRule" :loading="cloneCodeRuleLoading">ä¿ å</el-button> |
| | | <el-button @click="cloneSettingBox = false">å æ¶</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script> |
| | | import cloneOption from "@/const/code/cloneOption"; |
| | | import {clone} from "@/api/code/mdmrule"; |
| | | import {downOrderNum, upOrderNum, gridCodeBasicSec} from "@/api/code/codebasic"; |
| | | export default { |
| | | name: "cloneRuleDialog", |
| | | props: { |
| | | // å¯¹è¯æ¡æ¾ç¤ºéèæ§å¶ |
| | | visible: { |
| | | type: "Boolean", |
| | | default: false, |
| | | }, |
| | | ruleData:{ |
| | | type: "Object", |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | cloneSettingBox: this.visible, |
| | | /*å
éç¼ç è§åå¯¹è¯æ¡æ§å¶åé*/ |
| | | cloneTableLoading: false, |
| | | cloneCodeRuleLoading: false, |
| | | cloneOption: cloneOption, |
| | | cloneData: [], |
| | | cloneCodeRuleForm: { |
| | | id: "", |
| | | name: "", |
| | | accordingTo: "", |
| | | description: "", |
| | | }, |
| | | }; |
| | | }, |
| | | watch: { |
| | | // çå¬ç¶ç»ä»¶ä¼ ççªå£æ¾ç¤ºéèçå¼ï¼ä»¥åå¼çåå¡« |
| | | visible() { |
| | | //console.log(this.visible); |
| | | if(this.visible){ |
| | | this.loadBasic(this.ruleData); |
| | | this.cloneCodeRuleForm.id = this.ruleData.id; |
| | | this.cloneCodeRuleForm.name = this.ruleData.name; |
| | | this.cloneCodeRuleForm.accordingTo = this.ruleData.accordingTo; |
| | | this.cloneCodeRuleForm.description = this.ruleData.description; |
| | | } |
| | | this.cloneSettingBox = this.visible; |
| | | }, |
| | | }, |
| | | methods: { |
| | | |
| | | //å
³éå¯¹è¯æ¡ |
| | | closeCloneDialog(){ |
| | | this.$emit('update:visible',false); |
| | | this.cloneData = []; |
| | | }, |
| | | /** ä¸ç§»ä¸ç§»åºç¡ç 段*/ |
| | | async upOrderNum(row) { |
| | | if (this.ruleData.lcStatus != "Editing") { |
| | | this.$message.warning( |
| | | "åªæç¼ç è§åçç¶ææ¯ [ç¼è¾ä¸] çæ¶åï¼æè½è°æ´ç 段顺åº!" |
| | | ); |
| | | return; |
| | | } |
| | | if (row.oid == null || row.oid == "") { |
| | | this.$message.warning("æªè·åå°å¿
å¡«åæ°!"); |
| | | return; |
| | | } |
| | | await upOrderNum(row.oid).then(() => { |
| | | this.loadBasic(this.ruleData); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "æä½æå!", |
| | | }); |
| | | }); |
| | | }, |
| | | downOrderNum(row) { |
| | | let codeRuleOid = this.ruleData.oid; |
| | | if (this.ruleData.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: "æä½æå!", |
| | | }); |
| | | }); |
| | | }, |
| | | /** ç¹å»è§¦åå è½½åºç¡ç 段信æ¯*/ |
| | | loadBasic(row) { |
| | | this.cloneTableLoading = true; |
| | | if (row != "" || row != null) { |
| | | let conditionMap = {}; |
| | | conditionMap["conditionMap[pkCodeRule]"] = row.oid.trim(); |
| | | gridCodeBasicSec(1, -1, conditionMap).then((res) => { |
| | | const data = res.data.data; |
| | | this.cloneData = data.records; |
| | | this.cloneTableLoading = false; |
| | | }); |
| | | } |
| | | }, |
| | | /** å
éç¼ç è§åä¿ååè½*/ |
| | | saveCloneCodeRule() { |
| | | this.cloneCodeRuleLoading = true; |
| | | let form = this.cloneCodeRuleForm; |
| | | if (form.id.trim() == "") { |
| | | this.$message.warning("ç¼å·ä¸è½ä¸ºç©º!"); |
| | | return; |
| | | } |
| | | if (form.name.trim() == "") { |
| | | this.$message.warning("ç å¼ä¸è½ä¸ºç©º!"); |
| | | return; |
| | | } |
| | | let data = Object.assign({}, form, { |
| | | oid: "", |
| | | createTime: new Date().getTime(), |
| | | ts: new Date(this.ruleData.ts).getTime(), |
| | | lcStatus: "Editing", |
| | | elements: this.cloneData, |
| | | }); |
| | | // console.log(data); |
| | | this.cloneCodeRuleLoading = true; |
| | | clone(data).then(() => { |
| | | this.cloneSettingBox = false; |
| | | // è°ç¨ç¶ç»ä»¶æ¹æ³éæ°å è½½ç æ®µè¡¨ |
| | | this.$emit('refreshRuleTable',{"currentPage":1,"pageSize":10}); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "æä½æå!", |
| | | }); |
| | | }, |
| | | (error) => { |
| | | window.console.log(error); |
| | | }); |
| | | }, |
| | | |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | |
| | | </style> |