Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

文件转换异常,规则:emitsOptions,文件:/Users/zhangsan/workspace/MCP_Vue3/src/commonModal/BillModal.vue Error: replace failed: export default {name: "BillModal" #228

Open
sjkmuninj opened this issue Jun 15, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@sjkmuninj
Copy link

transform in progress: [------------------------------------------------------------------------------------] 3/1250 文件转换异常,规则:emitsOptions,文件:/Users/zhangsan/workspace/MCP_Vue3/src/commonModal/BillModal.vue Error: replace failed: export default {name: "BillModal",
components: {BkEmpty},
title: "这里是页面或组件名字",
mixins:[commonMixin, searchMixin],
props:{
fkCompId:{
type:String,
required:true
},
single:Boolean,
options: {
type:Object,
default(){
return {};
}
},
billType:{//1 卖卡 2 收银
type:Number,
default(){
return null;
},
validator: function(value) {
if(value==null || value ==undefined){
return true;
}
return [1, 2].includes(value);
}
}
},
data() {
return {
visibleModel:true,
keyword:"",
typeId:"",
discountTypeId:"",
cooperateId:"",
empJoinFlag:0,
fkMemberId:null,
searchObj:{
empJoinFlag:0,
keyword:"",
typeId:"",
discountTypeId:"",
cooperateId:"",
fkMemberId:null
},
page:1,
hasMore:true,
onLoading:false,
list:[],
selectedRowId:undefined,
selectedRow:undefined,
selectedRows:[],
selectedRowKeys:[],
tableOption:{
indeterminate:false,
checkAll:false
},
columnObj: {
code: {text: "单号", key: "billNo", col:1},
showCreateTime: {text: "单据日期", key: "showCreateTime", col:1},
showStatus: {text: "状态", key: "showStatus", col:1},
name: {text: "项目", key: "projects", col:3},
totalPrice: {text: "金额", key: "totalPrice", align:"right", col:1}
}
};
},
created() {
},
mounted() {
this.changeQueryComp(this.fkCompId);
let{keyword="", fkMemberId} = this.options;
if(!isEmptyStrict(keyword)){
this.searchObj.keyword = keyword;
}
if(!isEmptyStrict(fkMemberId)){
this.searchObj.fkMemberId = fkMemberId;
}
this.visibleModel = true;
this.search();
},
methods: {
/**
* 双击选中
* @param item
/
dblClick(item){
this.visibleModel = false;
let tmp ={
idList:[item.id],
list:[item]
};
this.$emit("ok", tmp);
},
/
*
* 确认
/
success() {
this.visibleModel = false;
let{selectedRowKeys, selectedRows, selectedRowId, selectedRow, single} = this;
let tmp ={
idList:[],
list:[]
};
if(single){
selectedRowId && tmp.idList.push(selectedRowId);
selectedRowId && tmp.list.push(selectedRow);
}else{
tmp ={
idList:selectedRowKeys,
list:selectedRows
};
}
this.$emit("ok", tmp);
},
/
*
* 取消
/
cancel(){
this.visibleModel = false;
this.$emit("hide");
},
/
*
* 重置搜索条件
/
resetSearch(){
this.searchObj={
keyword:"",
typeId:"",
discountTypeId:"",
cooperateId:""
};
},
resetCheckAll(){
let {selectedRowKeys} = this;
this.tableOption.indeterminate = selectedRowKeys.length>0 && this.list.length>0 && selectedRowKeys.length!==this.list.length;//重置半选状态
this.tableOption.checkAll = selectedRowKeys.length!==0 && selectedRowKeys.length===this.list.length;
},
/
*
* 搜索
/
search() {
Object.assign(this, this.searchObj, {page:1, list:[], hasMore:true, onLoading:false});
this.loadList();
},
/
*
* 加载页码
*/
loadList(){
let {onLoading, page:pageNum, keyword, billType, fkCompId, fkMemberId} = this;
if(onLoading){
return;
}
this.onLoading = true;
queryBillList({fkCompId, keyword, fkMemberId, billType, pageNum}).then((res)=>{
this.onLoading = false;
let{data} = res;
if(data && data.success){
let{list, hasNextPage} = data.result;

            for(let item of list){
                item.totalPrice = `${this.currencySign} ${item.totalPrice}`;
                item.showCreateTime = new Date(item.createTime).format(Date.DATETIME);

                if(item.id && this.selectedRowKeys.indexOf(item.id)!==-1 || this.selectedRowId===item.id){
                    item.selected = true;
                }
            }

            this.list = [...this.list, ...list];
            this.hasMore = hasNextPage;
            this.resetCheckAll();
            if(pageNum===1 && hasNextPage){
                this.page++;
                this.loadList();
            }
        }else{
            requestFail(res, "项目资料获取失败,请重试");
        }
    }, requestError);
},
/**
 * 手动全选/取消全选
 */
selectAll(){
    let keyList=[];
    let list = [];
    let oriList = this.list;
    for(let item of oriList){
        item.selected = this.tableOption.checkAll;
        keyList.push(item.id);
    }

    if(this.tableOption.checkAll){
        list = [...oriList];
    }else{
        keyList=[];
    }
    this.list = Object.deepClone(oriList);
    this.selectedRowKeys = keyList;//缓存选择的key
    this.selectedRows = list;//缓存选择的行
    this.tableOption.indeterminate = false;//重置半选状态
},
selectItem(item, type){
    type!=="line" && item['selected'] = !item.selected;
    if(!this.single){
        let{selectedRowKeys, selectedRows} = this;
        let index = selectedRowKeys.indexOf(item.id);
        if(!item.selected){
            item['selected'] = true;
            selectedRowKeys.push(item.id);
            selectedRows.push(item);
        }else{
            item['selected'] = false;
            selectedRowKeys.splice(index, 1);
            selectedRows.splice(index, 1);
        }
        Object.assign(this, {selectedRowKeys, selectedRows});
        this.tableOption.indeterminate = selectedRowKeys.length>0 && this.list.length>0 && selectedRowKeys.length!==this.list.length;//重置半选状态
        this.tableOption.checkAll = selectedRowKeys.length!==0 && selectedRowKeys.length===this.list.length;
    }else{
        /* this.selectedRowId = item.id;
           this.selectedRow = item; */
        if(this.selectedRow){
            if(this.selectedRow.id===item.id){
                item['selected'] = false;

                this.selectedRowId = undefined;
                this.selectedRow = undefined;
            }else{
                this.selectedRow['selected'] = undefined;
                item.selected = true;
                this.selectedRowId = item.id;
                this.selectedRow = item;
            }
        }else{
            item['selected'] = true;
            this.selectedRowId = item.id;
            this.selectedRow = item;
        }
    }
},
scroll(){
    let {hasMore, onLoading} = this;
    if (canLoadMore(event, 150) && hasMore && !onLoading) {
        this.page++;
        this.loadList();
    }
}

},
emits:['ok','hide']
} cannot be parsed!
at /Users/zhangsan/.nvm/versions/node/v16.16.0/lib/node_modules/gogocode-cli/node_modules/gogocode/src/js-core/core.js:283:31
at Array.forEach ()
at Object.replaceSelBySel (/Users/zhangsan/.nvm/versions/node/v16.16.0/lib/node_modules/gogocode-cli/node_modules/gogocode/src/js-core/core.js:196:22)
at AST.replace (/Users/zhangsan/.nvm/versions/node/v16.16.0/lib/node_modules/gogocode-cli/node_modules/gogocode/src/Ast.js:421:19)
at appendEmitsProp (/Users/zhangsan/.nvm/versions/node/v16.16.0/lib/node_modules/gogocode-plugin-vue/utils/scriptUtils.js:140:19)
at Object.module.exports [as rule] (/Users/zhangsan/.nvm/versions/node/v16.16.0/lib/node_modules/gogocode-plugin-vue/src/emits-option.js:57:9)
at /Users/zhangsan/.nvm/versions/node/v16.16.0/lib/node_modules/gogocode-plugin-vue/index.js:42:28
at Array.reduce ()
at transform (/Users/zhangsan/.nvm/versions/node/v16.16.0/lib/node_modules/gogocode-plugin-vue/index.js:37:37)
at /Users/zhangsan/.nvm/versions/node/v16.16.0/lib/node_modules/gogocode-cli/src/commands/transform.js:194:22

@sjkmuninj sjkmuninj added the bug Something isn't working label Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant