<commit_before><template>
    <div>
        <section class="content-header">
            <h1>
                條碼列印
                <small>Barcode</small>
            </h1>
        </section>
        <section class="content">
            <div class="container-fluid">
                <div class="box">
                    <div class="box-body col-lg-offset-7">
        <div class="dataTables_wrapper form-inline dt-bootstrap">
            <input type="button" v-on:click="printBarcode()" value="列印"/>
            <input type="button" v-on:click="genrateBarcode()" value="產生"/>
            <input type="button" v-on:click="getBarcode()" value="取得資料"/>
            Total: {{ count }} <br>
            Backup: <input type="number" v-model="backup"/>

        </div>
        <div id="print_parts" style="height: 29.5cm; width: 21cm; position: absolute;left: 0;top: 0;bottom: 0; padding-top: 5px;">
            <div v-for="i in count"
                 style="height: 2.48cm; width: 4.2cm; float: left; text-align: center;">
                <img v-bind:id="'barcode'+i"/>
            </div>
        </div>

    </div>
                </div>
            </div>
        </section>
    </div>
</template>
<script>
    export default {
        data: function () {
            return {
                config: [],
                barcode: [],
                count: 0,
                backup: 10,
            }
        },
        computed: {},
        methods: {
            initConfig: function () {
//                var self = this;
//                self.config = {
//                    height: 29.7,
//                    width: 21,
//                    box_height: 2.48,
//                    box_width: 4.2,
//                }
            },
            printBarcode: function (printlist) {
                var value = $('#print_parts')[0].outerHTML;
                var printPage = window.open("", "Printing...", "");
                printPage.document.open();
                printPage.document.write("<HTML><head></head><BODY onload='window.print();window.close()'>");
                printPage.document.write(value);
                printPage.document.close("</BODY></HTML>");
            },
            genrateBarcode: function () {
                var self = this;
                for (var i = 1; i <= self.count; i++) {
                    JsBarcode('#barcode' + i, self.barcode[i-1], {
                        width: 1,
                        height: 25,
                    });
                }

            },
            getBarcode: function () {
                var self = this;
                axios.get(
                    '/api/barcode' + '?backup=' + self.backup
                ).then(response => {
                    var res = response.data.data;
                    self.barcode = res.barcode;
                    self.count = res.count;
                    console.log(response);
                }).catch(error => {
                    console.log(error);
                });
            }
        },
        created: function () {
            this.getBarcode();
//            this.initConfig();
        },
        watch: {}
    }
</script>
<commit_msg>update barcode style<commit_after><template>
    <div>
        <section class="content-header">
            <h1>
                條碼列印
                <small>Barcode</small>
            </h1>
        </section>
        <section class="content">
            <div class="container-fluid">
                <div class="box">
                    <div class="box-body col-lg-offset-7">
        <div class="dataTables_wrapper form-inline dt-bootstrap">
            <input type="button" v-on:click="printBarcode()" value="列印"/>
            <input type="button" v-on:click="genrateBarcode()" value="產生"/>
            <input type="button" v-on:click="getBarcode()" value="取得資料"/>
            Total: {{ count }} <br>
            Backup: <input type="number" v-model="backup"/> <br>
            Title: <input type="text" size="30" v-model="title">
        </div>
        <div id="print_parts" style="height: 29.5cm; width: 21cm; position: absolute;left: 0;top: 0;bottom: 0; padding-top: 5px;">
            <div v-for="i in count" style="height: 2.48cm; width: 4.2cm; float: left; text-align: center;">
                <div style="font-size: 8px; text-align:center; -webkit-transform : scale(0.7);">{{ title }}</div>
                <img style="border: solid 1px #000;" v-bind:id="'barcode'+i"/>
            </div>
        </div>

    </div>
                </div>
            </div>
        </section>
    </div>
</template>
<script>
    export default {
        data: function () {
            return {
                config: [],
                barcode: [],
                count: 0,
                backup: 10,
                title: 'MOPCON 場務組物流股'
            }
        },
        computed: {},
        methods: {
            initConfig: function () {
//                var self = this;
//                self.config = {
//                    height: 29.7,
//                    width: 21,
//                    box_height: 2.48,
//                    box_width: 4.2,
//                }
            },
            printBarcode: function (printlist) {
                var value = $('#print_parts')[0].outerHTML;
                var printPage = window.open("", "Printing...", "");
                printPage.document.open();
                printPage.document.write("<HTML><head></head><BODY onload='window.print();window.close()'>");
                printPage.document.write(value);
                printPage.document.close("</BODY></HTML>");
            },
            genrateBarcode: function () {
                var self = this;
                for (var i = 1; i <= self.count; i++) {
                    JsBarcode('#barcode' + i, self.barcode[i-1], {
                        width: 1,
                        height: 25,
                        fontSize: 12
                    });
                }

            },
            getBarcode: function () {
                var self = this;
                axios.get(
                    '/api/barcode' + '?backup=' + self.backup
                ).then(response => {
                    var res = response.data.data;
                    self.barcode = res.barcode;
                    self.count = res.count;
                    console.log(response);
                }).catch(error => {
                    console.log(error);
                });
            }
        },
        created: function () {
            this.getBarcode();
//            this.initConfig();
        },
        watch: {}
    }
</script>

{'fraction_non_alphanumeric': 0.15050520283516816, 'fraction_numerical': 0.012516965766852661, 'mean_word_length': 1.1758530183727034, 'pattern_counts': {'":': 0, '<': 85, '<?xml version=': 0, '>': 87, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5525103', 'n_tokens_mistral': 1936, 'n_tokens_neox': 1806, 'n_words': 355}