dataadmin-med.vue 10.6 KB
<template>
    <div class="container resource close-left-menu">

        <div class="pop-banner clearfix">
            <div class="operate-btns">
                <a v-link="{path:'/dataadminMedDetail'}" href="javascript:" class="fbtn fb-add">新增</a>
                <a v-link="{path:'/exportMde'}" href="javascript:;" class="fbtn fb-download" @click="">批量导入</a>
            </div>
            <h3 class="current-module">药品主数据维护</h3>
        </div>

        <div class="pd-form fast-search-form">
            <div class="group-row">
                <div class="form-group">
                    <label for="cn15" class="label">药品名称</label>
                    <div class="control">
                        <input type="text" value="" id="cn16" v-model='search.goodsname' placeholder="药品名称"></div>
                </div>
                <div class="form-group">
                    <label for="cn11" class="label">药品编码</label>
                    <div class="control">
                        <input type="text" value="" id="cn11" v-model='search.goodscode ' placeholder=药品编码></div>
                </div>
            </div>
            <div class="group-row">
                <div class="form-group">
                    <label for="cn12" class="label">生产厂商</label>
                    <div class="control">
                        <input type="text" value="" id="cn12" v-model='search.producer' placeholder="生产厂商"></div>
                </div>
                <div class="form-group">
                    <label for="cn13" class="label">注册证号</label>
                    <div class="control">
                        <input type="text" value="" id="cn13" v-model='search.registkey' placeholder=注册证号></div>
                </div>
            </div>
            <div class="group-row t-right">
                <button class="fast-search-form-btn btn-d btn-d-lg btn-d-activate btn-d-circle" @click="getData(true)">查 询
                </button>
            </div>
        </div>


        <div class="fheader no-bottom">
            <h4 class="no-l-icon">商品资料</h4>
        </div>
        <table class="itable itable-thead-13px itable-bordertop itable-td-long-text">
            <thead>
            <tr>
                <th class="w50">序号</th>
                <th class="w200">商品编码</th>
                <th class="w200">商品名称</th>
                <th class="w80">规格</th>
                <th class="w200">生产厂商</th>
                <th class="w100">注册证号/批准文号</th>
                <th class="w100">商品大类</th>
                <th class="w100">生产来源</th>
                <th class="w50">计量单位</th>
                <th class="w100">操作</th>
            </tr>
            </thead>
            <tbody>
            <tr v-for="goods in productList">
                <td>{{$index + 1}}</td>
                <td>{{goods.goodscode}}</td>
                <td class="t-left pr10">{{goods.goodsname}}</td>
                <td>{{goods.goodsspec}}</td>
                <td>{{goods.producer}}</td>
                <td>{{goods.registkey}}</td>
                <td>{{goods.goodscate|GOODSCATE}}</td>
                <td>{{goods.importedflag|IMPORTEDFLAG}}</td>
                <td>{{goods.unitstyle}}</td>
                <td>
                    <div>
                        <a v-link="{path: '/dataadminMedDetail/' + goods.guid}" href="javascript:;"
                           class="btn-d btn-d-activate   ml-10 text-color-custom">明细</a>
                        <!--<a @click="deleteGood(goods.guid)" href="javascript:;"-->
                        <!--class="btn-d btn-d-activate   ml-10 text-color-custom">删除</a>-->
                    </div>
                </td>
            </tr>
            </tbody>
        </table>
        <pagination-n
                @page-change="getData"
                :classs="['m-20-0']"
                :page-no.sync="search.page"
                :total-pages.sync="search.totalPages">
        </pagination-n>
    </div>
</template>
<script>
    module.exports = {
        data: function () {
            return {
                readonly: "disabled",
                state: [{
                    value: "Y",
                    label: "启用"
                }, {
                    value: "S",
                    label: "停用"
                }, {
                    value: "E",
                    label: "作废"
                }],
                importedflag: [{
                    value: "1",
                    label: "国产"
                }, {
                    value: "2",
                    label: "进口"
                },],
                showDetail: false,
                searchDM: {
                    bigUintStyle: '',
                    bigUintQty: '',
                    goodsName: '',
                    goodsSpec: '',
                    id: '',
                    importedFlag: '',
                    minUnitStyle: '',
                    producer: '',
                    productGuid: '',
                    productionAddress: '',
                    registKey: '',
                    from: 0,
                },
                disabled: true,
                displayMfyAdd: false,
                productList: [],
                unProductList: [],
                goodList: [],
                good: {},
                search: {
                    pageSize: 50,
                    page: 1,
                    totalPages: 0,
                    goodscode: '',
                    goodsname: '',
                    producer: '',
                    registkey: '',
                    guid: '',
                    productguid: '',
                },


            }
        },
        methods: {
            getData: function (val) {
                var self = this;
                if(val){
                    self.search.page=1;
                }
                Ajax.post('/dataadmin/getmfmsdgoods', self.search).then(function (response) {
                    var data = response.data.data;
                    if (response.data.errorCode == 0) {
                        console.log(response.data.errorCode)
                        self.$set('productList', data.list);
                        self.search.totalPages = data.totalPages;
                        self.search.pageNo = data.pageNo;
                    }
                })
            },
            detail: function (ind) {
                this.good = this.productList[ind];
                this.good.lengths = this.productList[ind].length;

            },
            addGood: function () {
                var self = this;
                self.$set('good', {});
                self.good.state = "Y";
                self.good.importedflag = "1";
                self.$set('disabled', false);
                self.$set('disabledForUpdate', true);
                self.$set('disabledForAdd', false);
                self.$set('disabledForDelete', true);
                self.$set('disabledForSave', false);
                self.$set('disabledForStopDestroy', false);

            },
            closeDialog: function () {
                this.$set('showDetail', false);
            },
            updateGood: function () {
                var self = this;
                self.$set('disabled', false);
                self.$set('disabledForUpdate', false);
                self.$set('disabledForAdd', false);
                self.$set('disabledForDelete', false);
                self.$set('disabledForSave', false);
                self.$set('disabledForStopDestroy', false);
            },
            saveGoods: function () {
                var self = this;
                if (!self.good.goodscode) {
                    layer.msg('请输入商品编码');
                }
                this.good.length = this.good.lengths;
                Ajax.post('/dataadmin/addupdmfmsdgoods', self.good)
                    .then(function (response) {
                        var data = response.data;
                        if (data.errorCode == 0) {
                            self.MessageBox({title: '提示', message: '保存成功!', type: 'alert'}, function (action) {
                                self.$set('disabled', true);
                                self.getData();
                            });
                        } else {
                            layer.msg(data.message);
                        }
                    })
            },
            deleteGood: function (guid) {
                var self = this;
                console.log(guid)
                Ajax.post('/dataadmin/delmfmsdgoods', {
                    guid: guid
                })
                    .then(function (response) {
                        var data = response.data;
                        if (data.errorCode == 0) {
                            self.MessageBox({title: '提示', message: '删除成功', type: 'alert'}, function (action) {
                                self.getData();
                                self.good = '';
                            });
                        } else {
                            layer.msg(response.data.message);
                        }
                    })
            },
            // 业务状态
            changeStatus: function (state) {
                var self = this;
                // state代码说明:Y=有效,S=停用,N=作废
                Ajax.post('/dataadmin/updmfmsdgoodsstate/', {
                    guid: self.good.guid,
                    state: state,
                }).then(function (response) {
                    var data = response.data;
                    if (data.errorCode == 0) {
                        self.MessageBox({title: '提示', message: '更新成功', type: 'alert'}, function (action) {
                            if (action == 'confirm') {
                                self.good = data.data;
                                self.good.lengths = self.good.length;
                                self.getData();
                            }
                        })
                    } else {
                        layer.msg(response.data.message);
                    }
                });
            },
        },
        route: {
            activate: function () {
                this.search = {
                    pageSize: 50,
                    page: 1,
                    totalPages: 0,
                    goodscode: '',
                    goodsname: '',
                    producer: '',
                    registkey: '',
                    guid: '',
                    productguid: '',
                }
                this.good = '';
                this.getData();
            }
        }
    };
</script>