优化公共组件

This commit is contained in:
陈裕财
2024-07-13 14:30:35 +08:00
parent 0fc1a02dc5
commit 4e98bef166
10 changed files with 40 additions and 127 deletions

2
.env
View File

@@ -64,7 +64,7 @@ VITE_WF_OPEN=false
#
# 登录相关如果后端启用oauth2,则返回 oauth2client 如果后端不启用oauth2,后端账户使用mdp-lcode服务则返回 lcode ,如果使用mdp-sys提供服务则返回sys
VITE_CTX_LOGIN=lcode
VITE_CTX_LOGIN=oauth2client
# 项目管理子系统
VITE_CTX_XM=xm

View File

@@ -110,7 +110,7 @@ export default {
},
onTreeConfirm(row){
this.$refs['select'].onTableDataSelect(this.multiple?[row]:row)
this.$refs['select'].onTableDataSelect(row)
this.$refs['tableDialog'].close()
},
onChange2(row){
@@ -120,7 +120,7 @@ export default {
},
onChange(val){
this.$emit("change", val);
this.$emit("input",val);
this.$emit("update:modelValue",val);
},
onClear(){
this.$emit("clear");

View File

@@ -88,13 +88,17 @@ import DeptTree from './DeptTree.vue';//下拉框数据查询
this.$refs['select'].onTableDataSelect(this.multiple?[row]:row)
},
onTreeConfirm(row){
this.$refs['select'].onTableDataSelect(this.multiple?row:[row])
onTreeConfirm(row){
if(!row||(this.multiple==true&&row.length==0)){
//this.myVal=null
return;
}
this.$refs['select'].onTableDataSelect(row)
this.$refs['tableDialog'].close()
},
onChange2(row){
this.$emit("selected", row);
this.$emit("selected", row); //兼容旧的代码,以后要作废,尽量少监听此事件
this.$emit("change2", row);
},
onChange(val){

View File

@@ -88,7 +88,7 @@
},
onConfirm(row){
this.$refs['select'].onTableDataSelect(this.multiple?[row]:row)
this.$refs['select'].onTableDataSelect(row)
this.$refs['tableDialog'].close()
},
onChange2(row){

View File

@@ -287,6 +287,7 @@
}
},
onTableDataSelect(tableDatas){
debugger
if(!tableDatas||tableDatas.length==0){
return;
}

View File

@@ -91,7 +91,6 @@
},
onChange(val){
this.$emit("change", val);
this.$emit("input",val);
},
onClear(){
this.$emit("clear");

View File

@@ -89,7 +89,6 @@ export default {
},
onChange(val){
this.$emit("change", val);
this.$emit("input",val);
},
onClear(){
this.$emit("clear");

View File

@@ -88,7 +88,6 @@
},
onChange(val){
this.$emit("change", val);
this.$emit("input",val);
},
onClear(){
this.$emit("clear");

View File

@@ -30,7 +30,7 @@
label=" 产品总控"
v-model="editForm.admUserid"
:init-name="editForm.admUsername"
@change="editSomeFields(editForm, 'admUserid', $event)"
@change2="editSomeFields(editForm, 'admUserid', $event)"
/>
</el-form-item>
</el-col>
@@ -40,7 +40,7 @@
label=" 产品经理"
v-model="editForm.pmUserid"
:init-name="editForm.pmUsername"
@change="editSomeFields(editForm, 'pmUserid', $event)"
@change2="editSomeFields(editForm, 'pmUserid', $event)"
/>
</el-form-item>
</el-col>
@@ -50,7 +50,7 @@
label=" 副经理、助理"
v-model="editForm.assUserid"
:init-name="editForm.assUsername"
@change="editSomeFields(editForm, 'assUserid', $event)"
@change2="editSomeFields(editForm, 'assUserid', $event)"
/>
</el-form-item>
</el-col>
@@ -150,42 +150,30 @@
<script>
import util from '@/components/mdp-ui/js/util';//全局公共库
import {
import {
editXmProductSomeFields,
addXmProduct,
editXmProductSomeFields,
createProductCode
} from "@/api/xm/core/xmProduct";
import { mapState } from 'pinia'
import { useUserStore } from '@/store/modules/user'
import { useXmStore2 } from '@/store/modules/xm'
import { MdpFormMixin } from '@/components/mdp-ui/mixin/MdpFormMixin';
export default {
mixins: [MdpFormMixin],
computed: {
...mapState(useUserStore,["userInfo", "roles"]),
},
props: ["xmProduct", "visible"],
watch: {
xmProduct: {
handler() {
this.editForm = this.xmProduct;
this.editFormBak = { ...this.editForm };
handler() {
this.initCurrData()
},
deep: true,
},
visible: function (visible) {
if (visible == true) {
this.initData();
this.initQxCode();
//从新打开页面时某些数据需要重新加载,可以在这里添加
}
},
},
},
data() {
return {
dicts: { xmProductPstatus: [] }, //下拉选择框的所有静态数据 params=[{categoryId:'0001',itemCode:'sex'}] 返回结果 {'sex':[{optionValue:'1',optionName:'男',seqOrder:'1',fp:'',isDefault:'0'},{optionValue:'2',optionName:'女',seqOrder:'2',fp:'',isDefault:'0'}]}
load: { list: false, add: false, del: false, edit: false }, //查询中...
editFormRules: {
},
//新增界面数据 产品表
@@ -224,43 +212,7 @@ export default {
del: "",
ltime: "",
showOut:'1'
},
editFormBak: {
id: "",
productName: "",
branchId: "",
remark: "",
version: "",
pmUserid: "",
pmUsername: "",
ctime: "",
deptid: "",
pstatus: "",
startTime: "",
endTime: "",
deptName: "",
admUserid: "",
admUsername: "",
assUserid: "",
assUsername: "",
bizProcInstId: "",
bizFlowState: "",
isTpl: "",
baselineId: "",
baseTime: "",
code: "",
pbudgetWorkload: "",
pbudgetAmount: "",
pmenuBudgetWorkload: "",
pmenuBudgetAmount: "",
budgetCtrl: "",
phaseBudgetCtrl: "",
phaseActCtrl: "",
locked: "",
del: "",
ltime: "",
showOut:'1'
},
},
/**
权限码0,1,2,3,4,5,67,8,9逗号分割
共10位,不定长暂时只启用前6个位
@@ -281,26 +233,19 @@ export default {
menuTransmit:'1',//0-不控制1任务指派及crud必须检查用户的上下级关系
iterationScope:'2',//0-代表不限制,1-同组织2-同项目组默认3-同小组
iterationTransmit:'1',//0-不控制1任务指派及crud必须检查用户的上下级关系
},
/**begin 在下面加自定义属性,记得补上面的一个逗号**/
/**end 在上面加自定义属性**/
},
apis:{
editSomeFields: editXmProductSomeFields
}
}; //end return
}, //end data
methods: {
// 取消按钮点击 父组件监听@cancel="editFormVisible=false" 监听
handleCancel: function () {
this.$refs["editForm"].resetFields();
this.$emit("cancel");
methods: {
afterEditSomeFields(res,isOk,params,row){
if(isOk){
useXmStore2().setXmProduct(this.editForm)
}
},
editSomeFields(row, fieldName, $event) {
if(this.opType==='add'){
return;
}
let params = {};
params["ids"] = [row].map((i) => i.id);
editSomeFieldsCheck(row, fieldName, $event,params) {
if (fieldName == "admUserid") {
params["admUserid"] = $event.userid;
params["admUsername"] = $event.username;
@@ -315,34 +260,13 @@ export default {
} else {
params[fieldName] = $event;
}
var func = editXmProductSomeFields;
func(params)
.then((res) => {
let tips = res.tips;
if (tips.isOk) {
this.editFormBak = [...this.editForm];
Object.assign(this.editForm, params);
useXmStore2().setXmProduct(this.editForm)
this.$emit("edit-fields", params);
} else {
Object.assign(this.editForm, this.editFormBak);
this.initQxCode()
this.$notify({
position: "bottom-left",
showClose: true,
message: tips.msg,
type: tips.isOk ? "success" : "error",
});
}
})
.catch((e) => Object.assign(this.editForm, this.editFormBak));
return true;
},
initData(){
this.editForm=Object.assign(this.editForm,this.xmProduct)
this.editFormBak={...this.editForm}
initCurrData(){
this.editForm=Object.assign(this.editForm,this.xmProduct)
this.initQxCode();
},
initQxCode(){
@@ -379,19 +303,6 @@ export default {
}
}
},
/**end 在上面加自定义方法**/
}, //end method
components: {
},
mounted() {
this.initData();
this.initQxCode();
/**在下面写其它函数***/
}, //end mounted
},
};
</script>
<style lang="scss" scoped>
</style>

View File

@@ -45,11 +45,11 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
},
*/
['/api/m1/xm']: {
['/api/xm']: {
target: 'http://localhost:7067',
ws: false,
changeOrigin: true,
rewrite: (path) => path.replace(new RegExp(`^/api/m1/xm`), '/'),
rewrite: (path) => path.replace(new RegExp(`^/api/xm`), '/'),
},
['/api']: {
target: 'https://www.qingqinkj.com',