From 4a2835ddadb796c69f180097b95f971dbab4687d Mon Sep 17 00:00:00 2001 From: ludc Date: 星期三, 13 九月 2023 09:09:14 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- Source/UBCS-WEB/src/components/code-dialog-page/cloneRuleDialog.vue | 223 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 223 insertions(+), 0 deletions(-) diff --git a/Source/UBCS-WEB/src/components/code-dialog-page/cloneRuleDialog.vue b/Source/UBCS-WEB/src/components/code-dialog-page/cloneRuleDialog.vue new file mode 100644 index 0000000..c58274e --- /dev/null +++ b/Source/UBCS-WEB/src/components/code-dialog-page/cloneRuleDialog.vue @@ -0,0 +1,223 @@ +<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: { + // 鐩戝惉鐖剁粍浠朵紶鐨勭獥鍙f樉绀洪殣钘忕殑鍊硷紝浠ュ強鍊肩殑鍥炲~ + 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> \ No newline at end of file -- Gitblit v1.9.3