This commit is contained in:
zxx 2023-12-03 20:10:02 +08:00
parent c53295bdad
commit 2ff447e713
14 changed files with 3859 additions and 411 deletions

View File

@ -3,27 +3,30 @@
<vxe-pulldown class="edit-down-pulldown" ref="xDown" transfer>
<template>
<vxe-input class="edit-down-input" ref="inputx" :type="enalbedPopup ? 'search' : 'input'" v-model="textboxValue"
:readonly="readonly" @keyup="keyupEvent" @keydown="keydownEvent" :placeholder="placeholder" @click="clickEvent"
@suffix-click="suffixClick" @focus="onFocus" @search-click="popupEvent"></vxe-input>
:readonly="readonly" @keyup="keyupEvent" @keydown="keydownEvent" :placeholder="placeholder"
@click="clickEvent"
@suffix-click="suffixClick" @focus="onFocus" @search-click="popupEvent"></vxe-input>
<div style="margin-top: 10px;" v-if="buttons && buttons.length">
<a-icon v-for="(btn, index) in buttons" :key="index" @click="buttonClick(btn)" :type="btn.type"
:style="{ fontSize: '26px', color: '#08c' }"></a-icon>
:style="{ fontSize: '26px', color: '#08c' }"></a-icon>
</div>
</template>
<template #dropdown>
<vxe-grid :keyboard-config="{ isArrow: true }" auto-resize height="400" ref="xgrid"
:row-config="{ isCurrent: true, isHover: true }" :loading="loading" :pager-config="tablePage" :data="tableData"
:columns="tableColumn" :treeConfig="treeConfig" @cell-click="selectEvent" @page-change="pageChangeEvent">
:row-config="{ isCurrent: true, isHover: true }" :loading="loading" :pager-config="tablePage"
:data="tableData"
:columns="tableColumn" :treeConfig="treeConfig" @cell-click="selectEvent"
@page-change="pageChangeEvent">
</vxe-grid>
</template>
</vxe-pulldown>
<vxe-modal show-footer class-name="vxe-table--ignore-clear edit-popup-box" title="选择数据" :width="modalWidth"
:height="modalHeight" v-model="modalVisible" @confirm="confirmEvent">
:height="modalHeight" v-model="modalVisible" @confirm="confirmEvent">
<!-- vxe-modal 有以下属性
show-footer 显示底部按钮
width 宽度
@ -42,7 +45,6 @@
<script>
import BASE_URL from '@/services/base/api.js'; // api
export default {
name: 'MkFormDataSelector', //
@ -81,8 +83,8 @@ export default {
popupPageMode: '', //
tableColumn: [ //
{ field: 'name', title: '名称' }, //
{ field: 'code', title: '编码' } //
{field: 'name', title: '名称'}, //
{field: 'code', title: '编码'} //
],
treeConfig: null,
modalWidth: 800, //
@ -99,7 +101,7 @@ export default {
this.load() //
this.heightInit(); //
const { params } = this
const {params} = this
if (params.autoFocus) {
this.$nextTick(() => {
@ -113,23 +115,21 @@ export default {
beforeDestroy() {
},
watch: {
value() {
const { params } = this
value() {
const {params} = this
if (params.dataType == "string") {
this.textboxValue = this.value || "";
}
else if (params.dataType == "object") {
} else if (params.dataType == "object") {
if (this.value) {
this.textboxValue = this.getShowValue({ obj: this.value, path: params.textField });
this.textboxValue = this.getShowValue({obj: this.value, path: params.textField});
}
}
else if (this.value && this.value[1]) {
} else if (this.value && this.value[1]) {
this.textboxValue = this.value[1];
} else {
this.textboxValue = "";
}
},
params(){
params() {
console.log(this.params)
}
@ -137,7 +137,7 @@ export default {
methods: {
getShowValue({ obj, path }) {
getShowValue({obj, path}) {
const parts = path.split('.');
let value = obj;
for (let i = 0; i < parts.length; i++) {
@ -158,7 +158,7 @@ export default {
load() { //
const { params } = this //
const {params} = this //
if (params) { //
this.modelName = params.modelName; //
this.orderBy = params.orderBy; //
@ -188,23 +188,19 @@ export default {
if (params.dataType == "string") {
this.textboxValue = this.value || "";
}
else if (params.dataType == "object") {
} else if (params.dataType == "object") {
if (this.value) {
this.textboxValue = this.getShowValue({ obj: this.value, path: params.textField });
this.textboxValue = this.getShowValue({obj: this.value, path: params.textField});
}
}
else if (params && params.dataType == 'mapper') {
} else if (params && params.dataType == 'mapper') {
this.textboxValue = this.row[params.showField];
}
else if (this.value && this.value[1]) {
} else if (this.value && this.value[1]) {
this.textboxValue = this.value[1];
} else {
this.textboxValue = "";
}
let f = params.listdataFieldName || "Records";
this.getData().then(data => {
if ('Total' in data) {
@ -218,7 +214,7 @@ export default {
},
getData(key) { //
var params = Object.assign({}, this.params.actionParams || {}) //
var params = JSON.parse(JSON.stringify(this.params.actionParams || {}))
params.page = this.tablePage.currentPage; //
@ -247,15 +243,15 @@ export default {
},
clickEvent() { //
const { params } = this
const {params} = this
if (this.readonly) { //
return; //
}
if(params.isClickToLoad){
if (params.isClickToLoad) {
const cellValue = this.textboxValue;
let f = params.listdataFieldName || "Records";
this.loading = true
this.getData(cellValue).then(data => {
this.getData(cellValue).then(data => {
this.loading = false
if ('Total' in data) {
this.tablePage.total = data.Total;
@ -271,7 +267,7 @@ export default {
},
handleScanInput(event) {
const { params } = this
const {params} = this
const input = event.target;
const inputValue = input.value;
this.scanEntry = input.value;
@ -285,8 +281,8 @@ export default {
this.scanEntry = '';
}, 10);
if (params.scan) {
params.scan({ value: inputValue, input: input })
if (params.scan) {
params.scan({value: inputValue, input: input})
}
@ -295,13 +291,13 @@ export default {
},
keydownEvent(e) {
const { params } = this
const {params} = this
if (params.scan) {
this.handleScanInput(e.$event);
}
},
keyupEvent(e) {
const { params } = this
const {params} = this
if (this.readonly) {
return;
}
@ -311,7 +307,7 @@ export default {
}
if (keyCode == 40) {
this.$refs.xDown.showPanel()
const grid = this.$refs.xgrid;
const grid = this.$refs.xgrid;
if (!grid) return;
grid.focus();
@ -338,19 +334,17 @@ export default {
if (params.dataType == "string") {
this.$emit('input', "");
if (params.onDataChanged) {
params.onDataChanged({ value: "" })
params.onDataChanged({value: ""})
}
}
else if (params.dataType == "object") {
} else if (params.dataType == "object") {
this.$emit('input', null);
if (params.onDataChanged) {
params.onDataChanged({ value: null })
params.onDataChanged({value: null})
}
}
else {
} else {
this.$emit('input', ["", ""]);
if (params.onDataChanged) {
params.onDataChanged({ value: ["", ""] })
params.onDataChanged({value: ["", ""]})
}
}
@ -368,8 +362,8 @@ export default {
this.tableData = data[f];
})
},
onFocus(){
const { params } = this
onFocus() {
const {params} = this
if (params.focusToLoad) {
const cellValue = this.textboxValue;
let f = params.listdataFieldName || "Records";
@ -390,14 +384,14 @@ export default {
suffixClick() { //
this.$refs.xDown.togglePanel();
},
pageChangeEvent({ currentPage, pageSize }) { //
pageChangeEvent({currentPage, pageSize}) { //
this.tablePage.currentPage = currentPage
this.tablePage.pageSize = pageSize
this.loading = true
const { params } = this
const {params} = this
let f = params.listdataFieldName || "Records";
this.getData(this.lastKey).then(data => {
@ -411,59 +405,52 @@ export default {
})
},
selectEvent(e) { //
const { params } = this
const {params} = this
let textField = params.textField;
this.textboxValue = e.row[textField];
if (params.dataType == "string") {
this.$emit('input', e.row[textField]);
}
else if (params.dataType == "object") {
} else if (params.dataType == "object") {
this.$emit('input', e.row);
}
else if (params.dataType == 'mapper') {
} else if (params.dataType == 'mapper') {
if (params.showField) {
this.$emit('input', e.row[params.showField]);
}
}
else {
} else {
this.$emit('input', [e.row.ID, e.row[textField]]);
}
if (params.onDataChanged) {
params.onDataChanged({ value: [e.row.ID, e.row[textField]], data: e.row })
params.onDataChanged({value: [e.row.ID, e.row[textField]], data: e.row})
}
this.$refs.xDown.hidePanel()
},
popupEvent() {
popupEvent() {
this.modalVisible = true;
},
confirmEvent() {
const { params } = this
const {params} = this
let selectedRow = this.$refs.popup.getSelectdRow();
let textField = params.textField;
this.textboxValue = selectedRow[textField];
this.modalVisible = false;
if (params.dataType == "string") {
this.$emit('input', selectedRow[textField]);
}
else if (params.dataType == "object") {
} else if (params.dataType == "object") {
this.$emit('input', selectedRow);
}
else if (params.dataType == 'mapper') {
} else if (params.dataType == 'mapper') {
if (params.showField) {
this.$emit('input', selectedRow[params.showField]);
}
}
else {
} else {
this.$emit('input', [selectedRow.ID, selectedRow[textField]]);
}
if (params.onDataChanged) {
params.onDataChanged({ value: [selectedRow.ID, selectedRow[textField]], data: selectedRow })
params.onDataChanged({value: [selectedRow.ID, selectedRow[textField]], data: selectedRow})
}
}
}
@ -476,7 +463,6 @@ export default {
}
.edit-down-wrapper {
width: 600px;
height: 300px;

View File

@ -25,25 +25,21 @@
<!-- 基础信息 End -->
<!-- 料品属性 Start -->
<vxe-form :data="options.formOptions2.data" ref="xForm2" :title-width="options.formOptions2.titleWidth"
:title-align="options.formOptions2.titleAlign" :rules="options.formOptions2.rules"
:items="options.formOptions2.items" titleColon>
:title-align="options.formOptions2.titleAlign" :rules="options.formOptions2.rules"
:items="options.formOptions2.items" titleColon>
</vxe-form>
<!-- 料品属性 End -->
</a-tab-pane>
<!-- <a-tab-pane key="2" tab="料品自定义属性">-->
<!-- -->
<!-- <a-tab-pane key="2" tab="料品自定义属性">-->
<!-- -->
<!-- </a-tab-pane>-->
<!-- </a-tab-pane>-->
</a-tabs>
<div class="footerbar">
<a-button type="primary" @click="ok">确定</a-button>
<a-button @click="cancel">取消</a-button>
@ -64,8 +60,7 @@ export default {
type: String,
default: "edit"
},
dataId: {
}
dataId: {}
},
data() {
@ -202,8 +197,7 @@ export default {
isEdit: false,
//
formOptions: {
data: {
},
data: {},
//
titleWidth: 150,
//
@ -232,6 +226,7 @@ export default {
{ field: 'code', title: '编号', span: 12, itemRender: { name: '$input' } },
{ field: 'name', title: '名称', span: 12, itemRender: { name: '$input' } },
{ title: '分类', span: 12, slots: { default: 'sort_id' } },
{ field: 'price', title: '单价', dataRule: { type: 'number' }, span: 12, itemRender: { name: '$input', props: { type: "number" } } },
{ field: 'size', title: '尺寸', span: 12, itemRender: { name: '$input' } },
{
@ -423,34 +418,23 @@ export default {
},
]
},
//
addModeItems: [
],
addModeItems: [],
formOptions2Done: false,
formOptions2: {
data: {
},
data: {},
//
titleWidth: 150,
//
titleAlign: 'right',
//
rules: {
},
rules: {},
//
items: [
]
items: []
},
@ -499,11 +483,15 @@ export default {
a.data.attribute.forEach(item => {
let formItem = { field: '', title: '', span: 12, itemRender: {} };
let groupName = item.category.name;
if(groupName && !groupNames.filter(a=>a == groupName).length){
this.options.formOptions2.items.push({ span: 24, itemRender: { name:"MkFormInputShow" ,props:{ showType:"divider",header:groupName } },showTitle:false });
groupNames.push(groupName);
let groupName = item.category.name;
if (groupName && !groupNames.filter(a => a == groupName).length) {
this.options.formOptions2.items.push({
span: 24,
itemRender: { name: "MkFormInputShow", props: { showType: "divider", header: groupName } },
showTitle: false
});
groupNames.push(groupName);
}
formItem.field = "attr" + item.id;
@ -514,8 +502,7 @@ export default {
formItem.itemRender.name = "$input";
formData[formItem.field] = 0;
}
else if (item.typeName == "3" ||
} else if (item.typeName == "3" ||
item.typeName == "4" ||
item.typeName == "5") {
@ -523,16 +510,14 @@ export default {
formItem.itemRender.props = { type: "date" };
formData[formItem.field] = '';
}
else if (item.typeName == "6") {
} else if (item.typeName == "6") {
formItem.itemRender.name = "$select";
formItem.itemRender.options = getOptions(item.id);
if (!formItem.itemRender.options.length) {
return;
}
formData[formItem.field] = formItem.itemRender.options[0].value;
}
else if (item.typeName == "7") {
} else if (item.typeName == "7") {
formItem.itemRender.name = "$switch";
formItem.itemRender.props = { openLabel: '是', openValue: "true", closeValue: "false", closeLabel: '否' };
@ -565,9 +550,6 @@ export default {
dataInit() {
// id
let dataId = this.getDataId();
// id
@ -754,7 +736,7 @@ export default {
this.back();
}
}).catch((a) => { //
console.log("a.data.code"+a)
console.log("a.data.code" + a)
this.$mk.error(a.data.msg); //
});
@ -806,13 +788,11 @@ export default {
},
},
//
watch: {
}
watch: {}
};
</script>
<style scoped lang="less">
.page-body {
padding: 30px;

View File

@ -8,9 +8,7 @@ import BASE_URL from '@/services/mes/api.js';
export default {
i18n: require("./i18n"),
props: {
},
props: {},
data() {
return {
pageOptions: {}
@ -75,18 +73,18 @@ export default {
},
//
searchRules: [
{ key: "title", mode: "like" },
{ key: "desc", mode: "like" }
{key: "title", mode: "like"},
{key: "desc", mode: "like"}
],
//
searchFormItems: [ //
{ field: 'title', title: '标题', span: 5, itemRender: { name: '$input', props: { placeholder: '请输入标题' } } },
{ field: 'desc', title: '描述', span: 5, itemRender: { name: '$input', props: { placeholder: '请输入描述' } } },
{ span: 8, slots: { default: 'date' } }, //
{field: 'title', title: '标题', span: 5, itemRender: {name: '$input', props: {placeholder: '请输入标题'}}},
{field: 'desc', title: '描述', span: 5, itemRender: {name: '$input', props: {placeholder: '请输入描述'}}},
{span: 8, slots: {default: 'date'}}, //
{
align: 'right', span: 4, itemRender: { //
name: '$buttons', children: [{ props: { type: 'submit', content: '搜索', status: 'primary' } }, //
{ props: { type: 'reset', content: '重置' } }]
name: '$buttons', children: [{props: {type: 'submit', content: '搜索', status: 'primary'}}, //
{props: {type: 'reset', content: '重置'}}]
}
}
],
@ -99,31 +97,45 @@ export default {
id: 'datagrid_1', //
columns: [
{ type: 'checkbox', width: '40' }, //
{ type: 'seq', width: '40' }, //
{type: 'checkbox', width: '40'}, //
{type: 'seq', width: '40'}, //
{ title: '操作', slots: { default: 'op' }, width: 120 },
{title: '操作', slots: {default: 'op'}, width: 120},
// =============================== Start ===============================
{ field: 'code', sortable: true, title: '编码', width: 250 }, //
{ field: 'name', sortable: true, title: '名称', width: 250 },
{field: 'code', sortable: true, title: '编码', width: 250}, //
{field: 'name', sortable: true, title: '名称', width: 250},
{field: 'price', sortable: true, title: '单价(¥)', width: 120},
{field: 'spec', title: '规格型号', width: 150},
{field: 'size', title: '尺寸', width: 150},
{field: 'color', title: '颜色', width: 150},
{field: 'face', title: '花面', width: 150},
{field: 'molding', title: '成型方式', width: 150},
{field: 'production_type', title: '布产方式', width: 150},
{ field: 'spec', title: '规格型号', width: 150 },
{ field: 'size', title: '尺寸', width: 150 },
{ field: 'color', title: '颜色', width: 150 },
{ field: 'face', title: '花面', width: 150 },
{ field: 'molding', title: '成型方式', width: 150 },
{ field: 'production_type', title: '布产方式', width: 150 },
{field: 'theoretical_load', title: '理论装车量', width: 150},
{field: 'soil', title: '土质', width: 150},
{field: 'unit', title: '单位', width: 150},
{ field: 'theoretical_load', title: '理论装车量', width: 150 },
{ field: 'soil', title: '土质', width: 150 },
{ field: 'unit', title: '单位', width: 150 },
{ field: 'create_time', formatter: 'formatDate', width: 100, sortable: true, title: '创建时间', showHeaderOverflow: true }, //
{ field: 'update_time', formatter: 'formatDate', width: 100, sortable: true, title: '更新时间', showHeaderOverflow: true }, //
{
field: 'create_time',
formatter: 'formatDate',
width: 100,
sortable: true,
title: '创建时间',
showHeaderOverflow: true
}, //
{
field: 'update_time',
formatter: 'formatDate',
width: 100,
sortable: true,
title: '更新时间',
showHeaderOverflow: true
}, //
// =============================== Start ===============================
@ -143,9 +155,7 @@ export default {
},
watch: {
}
watch: {}
};
</script>

View File

@ -337,8 +337,9 @@ export default {
{ title: '操作', slots: { default: 'op' }, width: 120 },
// =============================== Start ===============================
{ field: 'code', sortable: true, title: '编码', width: 250 }, //
{ field: 'code', sortable: true, title: '编码', width: 100 }, //
{ field: 'name', sortable: true, title: '名称', width: 250 },
{ field: 'price', sortable: true, title: '单价(¥)', width: 120 },

View File

@ -123,10 +123,11 @@ export default {
{field: 'product_detail.image', slots: {default: 'column2'}, sortable: true, title: '料品图片', width: 100}, //
{field: 'product_detail.name', sortable: true, title: '料品名称', width: 250}, //
{field: 'product_detail.code', sortable: true, title: '料品编码', width: 120}, //
{field: 'product_detail.price', sortable: true, formatter: 'formatNumber', title: '单价(¥)', width: 120}, //
{field: 'stock', sortable: true, title: '库存数量', width: 100}, //
{field: 'product_detail.spec', sortable: true, title: '规格型号', width: 150}, //
{field: 'product_detail.size', sortable: true, title: '尺寸', width: 100}, //
{field: 'product_detail.color', sortable: true, title: '颜色', width: 100}, //
{field: 'stock', sortable: true, title: '库存数量', width: 100}, //
{slots: {default: 'column1'}, sortable: true, title: '操作', width: 160, fixed: "right"}, //

View File

@ -2,7 +2,13 @@
<basic-page-list :desc="desc" :options="pageOptions">
<template v-slot:column1="{ row }">
<a-button class="in" type="default" @click="LogDetail(row.id)">查看详情</a-button>
<a-button class="in" type="default" @click="LogDetail(row.id)">查看详情</a-button>
</template>
<template v-slot:column2="{ row }">
<img v-if="row.product_detail.image" style="width:50px;height:50px;" :src="row.product_detail.image"
@click.stop="$hevueImgPreview(row.product_detail.image)"/>
<span v-else></span>
</template>
</basic-page-list>
</template>
@ -13,9 +19,7 @@ import BASE_URL from '@/services/mes/api.js';
export default {
i18n: require("../i18n"),
props: {
},
props: {},
data() {
return {
pageOptions: {}
@ -70,25 +74,97 @@ export default {
//
searchFormData: {
title: '',
desc: '',
warehouse_id: '',
warehouse_pos_id: '',
},
//
searchRules: [
{ key: "materials", mode: "like" },
{ key: "warehouse", mode: "like" },
{ key: "warehouse_pos", mode: "like" }
{key: "materials", mode: "like"},
{key: "warehouse_id", mode: "="},
{key: "warehouse_pos_id", mode: "="}
],
//
searchFormItems: [ //
{ field: 'materials', title: '料品', span: 4, itemRender: { name: '$input', props: { placeholder: '请输入料品' } } },
{ field: 'warehouse', title: '仓库', span: 4, itemRender: { name: '$input', props: { placeholder: '请输入仓库' } } },
{ field: 'warehouse_pos', title: '库位', span: 4, itemRender: { name: '$input', props: { placeholder: '请输入库位' } } },
{ span: 8, slots: { default: 'date' } }, //
{
field: 'materials',
title: '料品',
span: 4,
itemRender: {name: '$input', props: {placeholder: '请输入料品'}}
}, {
title: '仓库', span: 5,
field: 'warehouse_id',
dataRule: {
fromField: "id",
saveField: "warehouse_id"
},
itemRender: {
name: 'MkFormDataSelector',
props: {
searchFieldNames: ["warehouse_title", "code"],
params: {
dataType: "object",
valueField: "id",
textField: "warehouse_title",
columns: [
{field: 'warehouse_title', title: '名称'},
{field: 'code', title: '编码'}
],
listdataFieldName: 'MesWarehouse',
dataUrl: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/list`,
onDataChanged: ({data}) => {
console.log(data)
// this.pageOptions.searchFormItems.data.warehouse_pos_detail = {};
// this.pageOptions.searchFormItems.data.warehouse_pos_id = null;
this.pageOptions.searchFormItems[2].itemRender.props.params.actionParams.search_rules[0].value = data.id.toString();
this.pageOptions.searchFormItems[2].itemRender.props.params = JSON.parse(JSON.stringify(this.pageOptions.searchFormItems[2].itemRender.props.params));
this.$forceUpdate(); //
}
}
}
}
},
// {
// title: '', span: 4,
// field: 'warehouse_pos_id',
// dataRule: {
// fromField: "id",
// saveField: "warehouse_pos_id"
// },
// itemRender: {
// name: 'MkFormDataSelector', props: {
// searchFieldNames: ["warehouse_id", "code"],
// params: {
// dataType: "object",
// valueField: "id",
// textField: "warehouse_location_name",
// columns: [
// {field: 'warehouse_location_name', title: ''},
// {field: 'code', title: ''}
// ],
// isClickToLoad: true,
// actionParams: {
// search_rules: [
// {
// column: "warehouse_id",
// mode: "=",
// value: "0"
// }
// ]
// },
//
// listdataFieldName: 'WarehouseLocation',
// dataUrl: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/list`
// }
// }
// }
// },
// {span: 8, slots: {default: 'date'}}, //
{
align: 'right', span: 4, itemRender: { //
name: '$buttons', children: [{ props: { type: 'submit', content: '搜索', status: 'primary' } }, //
{ props: { type: 'reset', content: '重置' } }]
name: '$buttons', children: [{props: {type: 'submit', content: '搜索', status: 'primary'}}, //
{props: {type: 'reset', content: '重置'}}]
}
}
],
@ -101,8 +177,8 @@ export default {
id: 'datagrid_1', //
columns: [
{ type: 'checkbox', width: '40' }, //
{ type: 'seq', width: '40' }, //
{type: 'checkbox', width: '40'}, //
{type: 'seq', width: '40'}, //
// "id,optional" validate:"" message:"" label:""` //
// "stock_pos_id,optional" validate:"" message:"" label:""` // ID
@ -136,27 +212,50 @@ export default {
//
// =============================== Start ===============================
{ field: 'id' , slots: { default: 'column1' }, sortable: true, title: '查看详情', width: 100 }, //
{ field: 'product_detail.name', sortable: true, title: '料品名称', width: 250 }, //
{ field: 'in_type', sortable: true, title: '入库类型', width: 100 }, //
{ field: 'in_stock', sortable: true, title: '入库数量', width: 100 }, //
{ field: 'stock', sortable: true, title: '剩余库存', width: 100 }, //
{ field: 'warehouse_idetail.name', sortable: true, title: '仓库', width: 150 }, //
{ field: 'warehouse_pos_idetail.name', sortable: true, title: '库位', width: 150 }, //
{ field: 'in_user_name', sortable: true, title: '入库人', width: 100 }, //
{ field: 'bill_date',formatter: 'formatDate', sortable: true, title: '单据日期', width: 100 }, //
{ field: 'business_type', sortable: true, title: '业务类型', width: 100 }, //
{ field: 'business_no', sortable: true, title: '业务单号', width: 100 }, //
{ field: 'out_type', sortable: true, title: '入库类型', width: 100 }, //
{ field: 'handler_name', sortable: true, title: '经手人', width: 100 }, //
{ field: 'check_user_name', sortable: true, title: '验货人', width: 100 }, //
{field: 'id', slots: {default: 'column1'}, sortable: true, title: '查看详情', width: 100}, //
{field: 'product_detail.image', slots: {default: 'column2'}, sortable: true, title: '料品图片', width: 100}, //
{field: 'product_detail.name', sortable: true, title: '料品名称', width: 250}, //
{field: 'product_detail.code', sortable: true, title: '料品编号', width: 100}, //
{field: 'in_type', sortable: true, title: '入库类型', width: 100}, //
{field: 'in_stock', sortable: true, title: '入库数量', width: 100}, //
{field: 'price', sortable: true, formatter: 'formatNumber', title: '单价(¥)', width: 120}, //
{field: 'total_price', sortable: true, formatter: 'formatNumber', title: '总价(¥)', width: 150}, //
{field: 'stock', sortable: true, title: '剩余库存', width: 100}, //
{field: 'warehouse_idetail.name', sortable: true, title: '仓库', width: 150}, //
{field: 'warehouse_pos_idetail.name', sortable: true, title: '库位', width: 150}, //
{field: 'in_user_name', sortable: true, title: '入库人', width: 100}, //
{field: 'bill_date', formatter: 'formatDate', sortable: true, title: '单据日期', width: 100}, //
{field: 'business_type', sortable: true, title: '业务类型', width: 100}, //
{field: 'business_no', sortable: true, title: '业务单号', width: 100}, //
{field: 'out_type', sortable: true, title: '入库类型', width: 100}, //
{field: 'handler_name', sortable: true, title: '经手人', width: 100}, //
{field: 'check_user_name', sortable: true, title: '验货人', width: 100}, //
{ field: 'in_time', formatter: 'formatDate', width: 100, sortable: true, title: '入库时间', showHeaderOverflow: true }, //
{ field: 'create_time', formatter: 'formatDate', width: 100, sortable: true, title: '创建时间', showHeaderOverflow: true }, //
{ field: 'update_time', formatter: 'formatDate', width: 100, sortable: true, title: '更新时间', showHeaderOverflow: true }, //
{
field: 'in_time',
formatter: 'formatDate',
width: 100,
sortable: true,
title: '入库时间',
showHeaderOverflow: true
}, //
{
field: 'create_time',
formatter: 'formatDate',
width: 100,
sortable: true,
title: '创建时间',
showHeaderOverflow: true
}, //
{
field: 'update_time',
formatter: 'formatDate',
width: 100,
sortable: true,
title: '更新时间',
showHeaderOverflow: true
}, //
// { field: 'stock_id', sortable: true, title: 'id', width: 250 }, // id
// =============================== Start ===============================
@ -182,15 +281,13 @@ export default {
});
},
LogDetail(id){
console.log("LogDetail:"+id)
this.$router.push('/MesStock/MesStockOutInLogDetail/'+id) //
LogDetail(id) {
console.log("LogDetail:" + id)
this.$router.push('/MesStock/MesStockOutInLogDetail/' + id) //
},
},
watch: {
},
watch: {},
};
</script>

View File

@ -1,6 +1,10 @@
<!-- 出入库记录 -->
<template>
<div class="page-body">
<a-button type="primary" icon="eye" @click="preView">
预览
</a-button>
<h2> {{ title }}</h2>
<!-- <vxe-form :data="formOptions.data" ref="xForm" :title-width="formOptions.titleWidth"-->
<!-- :title-align="formOptions.titleAlign" :rules="formOptions.rules" :items="formOptions.items" titleColon>-->
@ -23,23 +27,37 @@
{{ product_detail.code }}
</td>
</tr>
<tr class="table-row-2">
<th class="table-cell">
单价
</th>
<td class="table-cell" colspan="3">
{{ formOptions.data.price|formatNumber }}
</td>
<th class="table-cell">
总价
</th>
<td class="table-cell" colspan="6">
{{ formOptions.data.total_price|formatNumber }}
</td>
</tr>
<tr class="table-row-3" v-if="formOptions.data.out_time === 0">
<th class="table-cell">
入库数量
</th>
<td class="table-cell" colspan="3">
<td class="table-cell" colspan="2">
{{ formOptions.data.in_stock }}
</td>
<th class="table-cell">
单据日期
</th>
<td class="table-cell" colspan="3">
<td class="table-cell" colspan="2">
{{ formOptions.data.bill_date | formatDate }}
</td>
<th class="table-cell">
入库人员姓名
</th>
<td class="table-cell" colspan="3">
<td class="table-cell" colspan="4">
{{ formOptions.data.in_user_name }}
</td>
</tr>
@ -47,19 +65,19 @@
<th class="table-cell">
剩余库存数量
</th>
<td class="table-cell" colspan="3">
<td class="table-cell" colspan="2">
{{ formOptions.data.stock }}
</td>
<th class="table-cell">
入库类型
</th>
<td class="table-cell" colspan="3">
<td class="table-cell" colspan="2">
{{ formOptions.data.in_type }}
</td>
<th class="table-cell">
入库时间
</th>
<td class="table-cell" colspan="3">
<td class="table-cell" colspan="4">
{{ formOptions.data.in_time | formatDate }}
</td>
</tr>
@ -67,19 +85,19 @@
<th class="table-cell">
出库数量
</th>
<td class="table-cell" colspan="3">
<td class="table-cell" colspan="2">
{{ formOptions.data.out_stock }}
</td>
<th class="table-cell">
单据日期
</th>
<td class="table-cell" colspan="3">
<td class="table-cell" colspan="2">
{{ formOptions.data.bill_date | formatDate }}
</td>
<th class="table-cell">
出库人员姓名
</th>
<td class="table-cell" colspan="3">
<td class="table-cell" colspan="4">
{{ formOptions.data.out_user_name }}
</td>
</tr>
@ -87,20 +105,20 @@
<th class="table-cell">
剩余库存数量
</th>
<td class="table-cell" colspan="3">
<td class="table-cell" colspan="2">
{{ formOptions.data.stock }}
</td>
<th class="table-cell">
出库类型
</th>
<td class="table-cell" colspan="3">
<td class="table-cell" colspan="2">
{{ formOptions.data.out_type }}
</td>
<th class="table-cell">
出库时间
</th>
<td class="table-cell" colspan="3">
{{ formOptions.data.out_time | formatTime}}
<td class="table-cell" colspan="4">
{{ formOptions.data.out_time | formatTime }}
</td>
</tr>
<!-- <tr class="table-row-3">-->
@ -123,23 +141,44 @@
<!-- {{formOptions.data.salesman_name}}-->
<!-- </td>-->
<!-- </tr>-->
<tr class="table-row-3">
<th class="table-cell">
客户姓名
</th>
<td class="table-cell" colspan="1">
{{ formOptions.data.customer_name }}
</td>
<th class="table-cell">
客户联系电话
</th>
<td class="table-cell" colspan="2">
{{ formOptions.data.customer_phone }}
</td>
<th class="table-cell">
客户联系地址
</th>
<td class="table-cell" colspan="5">
{{ formOptions.data.customer_address }}
</td>
</tr>
<tr class="table-row-4">
<th class="table-cell">
验货时间
</th>
<td class="table-cell" colspan="2">
<td class="table-cell" colspan="1">
{{ formOptions.data.check_time | formatTime }}
</td>
<th class="table-cell">
发货单号
</th>
<td class="table-cell" colspan="2">
<td class="table-cell" colspan="1">
{{ formOptions.data.delivery_no }}
</td>
<th class="table-cell">
联系人
</th>
<td class="table-cell" colspan="2">
<td class="table-cell" colspan="1">
{{ formOptions.data.contact }}
</td>
<th class="table-cell">
@ -162,19 +201,24 @@
</div>
<!-- <zk-table-view />-->
<!-- <zk-table-view />-->
<!-- 预览 -->
<print-preview ref="preView"/>
</div>
</template>
<script>
import BASE_URL from '@/services/mes/api.js';
import XEUtils from 'xe-utils' // xe-utils
import printPreview from './preview'
import providers from './providers'
import XEUtils from 'xe-utils' // xe-utils
let hiprintTemplate;
export default {
i18n: require('../i18n'),
components: {},
components: {printPreview},
props: {
pageMode: {
type: String,
@ -183,6 +227,7 @@ export default {
dataId: {},
},
data() {
return this.optionsInit()
},
@ -211,11 +256,58 @@ export default {
currentConfigName: "",
// ID
currentBeid: 0,
addPageUrl: "/MesStock/MesStockAdd",
editPageUrl: "/MesStock/MesStockUpdate/",
listPageUrl: "/MesStock/MesStockList",
//
template: null,
//
mode: 0,
modeList: [],
//
curPaper: {
type: 'other',
width: 220,
height: 80
},
//
paperTypes: {
'A3': {
width: 420,
height: 296.6
},
'A4': {
width: 210,
height: 296.6
},
'A5': {
width: 210,
height: 147.6
},
'B3': {
width: 500,
height: 352.6
},
'B4': {
width: 250,
height: 352.6
},
'B5': {
width: 250,
height: 175.6
}
},
scaleValue: 1,
scaleMax: 5,
scaleMin: 0.5,
//
paperPopVisible: false,
paperWidth: '220',
paperHeight: '80',
lastjson: '',
uploadDefaultImg: null,
@ -243,8 +335,8 @@ export default {
//
isEdit: false,
title:"",
product_detail:{},
title: "",
product_detail: {},
//
formOptions: {
data: {
@ -337,7 +429,6 @@ export default {
pageData.formOptions = Object.assign({}, this.$mk.config.defaults.formOptions, pageData.formOptions);
return pageData;
},
@ -393,9 +484,98 @@ export default {
return dataId;
},
init() {
this.modeList = providers.map((e) => {
return {type: e.type, name: e.name, value: e.value}
})
this.changeMode()
},
changeMode() {
let {mode} = this
let provider = providers[mode]
this.$hiprint.init({
providers: [provider.f]
});
this.$hiprint.PrintElementTypeManager.build('.hiprintEpContainer', provider.value);
// let templates = this.$ls.get('KEY_TEMPLATES', {})
let data = require('./data.json')
let templates = data.value
console.log("templates:", templates)
let template = templates[provider.value] ? templates[provider.value] : {}
this.template = hiprintTemplate = new this.$hiprint.PrintTemplate({
template: template,
dataMode: 1, // 1:getJson getJsonTid 1
history: false, //
onDataChanged: (type, json) => {
console.log(type); // ()
console.log(json); // template
//
// hiprintTemplate.update(json)
// console.log(hiprintTemplate.historyList)
},
settingContainer: '#PrintElementOptionSetting',
paginationContainer: '.hiprint-printPagination'
});
hiprintTemplate.design('#hiprint-printTemplate');
// , zoomtrue
this.scaleValue = hiprintTemplate.editingPanel.scale || 1;
},
/**
* 设置纸张大小
* @param type [A3, A4, A5, B3, B4, B5, other]
* @param value {width,height} mm
*/
setPaper(type, value) {
try {
if (Object.keys(this.paperTypes).includes(type)) {
this.curPaper = {type: type, width: value.width, height: value.height}
hiprintTemplate.setPaper(value.width, value.height)
} else {
this.curPaper = {type: 'other', width: value.width, height: value.height}
hiprintTemplate.setPaper(value.width, value.height)
}
} catch (error) {
this.$message.error(`操作失败: ${error}`)
}
},
changeScale(big) {
let scaleValue = this.scaleValue;
if (big) {
scaleValue += 0.1;
if (scaleValue > this.scaleMax) scaleValue = 5;
} else {
scaleValue -= 0.1;
if (scaleValue < this.scaleMin) scaleValue = 0.5;
}
if (hiprintTemplate) {
// scaleValue: , false: (), true,
hiprintTemplate.zoom(scaleValue, true);
this.scaleValue = scaleValue;
}
},
otherPaper() {
let value = {}
value.width = this.paperWidth
value.height = this.paperHeight
this.paperPopVisible = false
this.setPaper('other', value)
},
preView() {
let hiPrint = this.$hiPrint
let data = require('./data.json')
let templates = data.value
console.log("templates:", templates)
let template = {}
let hiprintTemplate = new hiPrint.PrintTemplate({
template: template,
});
let {width} = this.curPaper
this.$refs.preView.show(hiprintTemplate, {}, width)
},
},
filters: {
formatDate(cellValue) {
if (!cellValue) {
@ -415,6 +595,13 @@ export default {
}
return XEUtils.toDateString(cellValue, 'yyyy-MM-dd HH:mm:ss')
},
// 2
formatNumber(cellValue) {
if (!cellValue) {
return '';
}
return cellValue.toFixed(2);
},
},
//

View File

@ -2,7 +2,13 @@
<basic-page-list :desc="desc" :options="pageOptions">
<template v-slot:column1="{ row }">
<a-button class="in" type="default" @click="LogDetail(row.id)">查看详情</a-button>
<a-button class="in" type="default" @click="LogDetail(row.id)">查看详情</a-button>
</template>
<template v-slot:column2="{ row }">
<img v-if="row.product_detail.image" style="width:50px;height:50px;" :src="row.product_detail.image"
@click.stop="$hevueImgPreview(row.product_detail.image)"/>
<span v-else></span>
</template>
</basic-page-list>
</template>
@ -13,9 +19,7 @@ import BASE_URL from '@/services/mes/api.js';
export default {
i18n: require("../i18n"),
props: {
},
props: {},
data() {
return {
pageOptions: {}
@ -68,27 +72,63 @@ export default {
end_time: 0, //
//
//
searchFormData: {
title: '',
desc: '',
warehouse_id: '',
warehouse_pos_id: '',
},
//
searchRules: [
{ key: "materials", mode: "like" },
{ key: "warehouse", mode: "like" },
{ key: "warehouse_pos", mode: "like" }
{key: "materials", mode: "like"},
{key: "warehouse_id", mode: "="},
{key: "warehouse_pos_id", mode: "="}
],
//
searchFormItems: [ //
{ field: 'materials', title: '料品', span: 4, itemRender: { name: '$input', props: { placeholder: '请输入料品' } } },
{ field: 'warehouse', title: '仓库', span: 4, itemRender: { name: '$input', props: { placeholder: '请输入仓库' } } },
{ field: 'warehouse_pos', title: '库位', span: 4, itemRender: { name: '$input', props: { placeholder: '请输入库位' } } },
{ span: 8, slots: { default: 'date' } }, //
{
field: 'materials',
title: '料品',
span: 4,
itemRender: {name: '$input', props: {placeholder: '请输入料品'}}
}, {
title: '仓库', span: 5,
field: 'warehouse_id',
dataRule: {
fromField: "id",
saveField: "warehouse_id"
},
itemRender: {
name: 'MkFormDataSelector',
props: {
searchFieldNames: ["warehouse_title", "code"],
params: {
dataType: "object",
valueField: "id",
textField: "warehouse_title",
columns: [
{field: 'warehouse_title', title: '名称'},
{field: 'code', title: '编码'}
],
listdataFieldName: 'MesWarehouse',
dataUrl: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/list`,
onDataChanged: ({data}) => {
console.log(data)
// this.pageOptions.searchFormItems.data.warehouse_pos_detail = {};
// this.pageOptions.searchFormItems.data.warehouse_pos_id = null;
this.pageOptions.searchFormItems[2].itemRender.props.params.actionParams.search_rules[0].value = data.id.toString();
this.pageOptions.searchFormItems[2].itemRender.props.params = JSON.parse(JSON.stringify(this.pageOptions.searchFormItems[2].itemRender.props.params));
this.$forceUpdate(); //
}
}
}
}
},
// {span: 8, slots: {default: 'date'}}, //
{
align: 'right', span: 4, itemRender: { //
name: '$buttons', children: [{ props: { type: 'submit', content: '搜索', status: 'primary' } }, //
{ props: { type: 'reset', content: '重置' } }]
name: '$buttons', children: [{props: {type: 'submit', content: '搜索', status: 'primary'}}, //
{props: {type: 'reset', content: '重置'}}]
}
}
],
@ -101,8 +141,8 @@ export default {
id: 'datagrid_1', //
columns: [
{ type: 'checkbox', width: '40' }, //
{ type: 'seq', width: '40' }, //
{type: 'checkbox', width: '40'}, //
{type: 'seq', width: '40'}, //
// "id,optional" validate:"" message:"" label:""` //
// "stock_pos_id,optional" validate:"" message:"" label:""` // ID
@ -136,27 +176,50 @@ export default {
//
// =============================== Start ===============================
{ field: 'id' , slots: { default: 'column1' }, sortable: true, title: '查看详情', width: 100 }, //
{ field: 'product_detail.name', sortable: true, title: '料品名称', width: 250 }, //
{ field: 'out_type', sortable: true, title: '出库类型', width: 100 }, //
{ field: 'out_stock', sortable: true, title: '出库数量', width: 100 }, //
{ field: 'stock', sortable: true, title: '剩余库存', width: 100 }, //
{ field: 'warehouse_idetail.name', sortable: true, title: '仓库', width: 150 }, //
{ field: 'warehouse_pos_idetail.name', sortable: true, title: '库位', width: 150 }, //
{ field: 'out_user_name', sortable: true, title: '出库人', width: 100 }, //
{ field: 'bill_date', formatter: 'formatDate',sortable: true, title: '单据日期', width: 100 }, //
{ field: 'business_type', sortable: true, title: '业务类型', width: 100 }, //
{ field: 'business_no', sortable: true, title: '业务单号', width: 100 }, //
{ field: 'out_type', sortable: true, title: '出库类型', width: 100 }, //
{ field: 'handler_name', sortable: true, title: '经手人', width: 100 }, //
{ field: 'check_user_name', sortable: true, title: '验货人', width: 100 }, //
{field: 'id', slots: {default: 'column1'}, sortable: true, title: '查看详情', width: 100}, //
{field: 'product_detail.image', slots: {default: 'column2'}, sortable: true, title: '料品图片', width: 100}, //
{field: 'product_detail.name', sortable: true, title: '料品名称', width: 250}, //
{field: 'product_detail.code', sortable: true, title: '料品编号', width: 100}, //
{field: 'out_type', sortable: true, title: '出库类型', width: 100}, //
{field: 'out_stock', sortable: true, title: '出库数量', width: 100}, //
{field: 'price', sortable: true, formatter: 'formatNumber', title: '单价(¥)', width: 120}, //
{field: 'total_price', sortable: true, formatter: 'formatNumber', title: '总价(¥)', width: 150}, //
{field: 'stock', sortable: true, title: '剩余库存', width: 100}, //
{field: 'warehouse_idetail.name', sortable: true, title: '仓库', width: 150}, //
{field: 'warehouse_pos_idetail.name', sortable: true, title: '库位', width: 150}, //
{field: 'out_user_name', sortable: true, title: '出库人', width: 100}, //
{field: 'bill_date', formatter: 'formatDate', sortable: true, title: '单据日期', width: 100}, //
{field: 'business_type', sortable: true, title: '业务类型', width: 100}, //
{field: 'business_no', sortable: true, title: '业务单号', width: 100}, //
{field: 'out_type', sortable: true, title: '出库类型', width: 100}, //
{field: 'handler_name', sortable: true, title: '经手人', width: 100}, //
{field: 'check_user_name', sortable: true, title: '验货人', width: 100}, //
{ field: 'out_time', formatter: 'formatDate', width: 100, sortable: true, title: '出库时间', showHeaderOverflow: true }, //
{ field: 'create_time', formatter: 'formatDate', width: 100, sortable: true, title: '创建时间', showHeaderOverflow: true }, //
{ field: 'update_time', formatter: 'formatDate', width: 100, sortable: true, title: '更新时间', showHeaderOverflow: true }, //
{
field: 'out_time',
formatter: 'formatDate',
width: 100,
sortable: true,
title: '出库时间',
showHeaderOverflow: true
}, //
{
field: 'create_time',
formatter: 'formatDate',
width: 100,
sortable: true,
title: '创建时间',
showHeaderOverflow: true
}, //
{
field: 'update_time',
formatter: 'formatDate',
width: 100,
sortable: true,
title: '更新时间',
showHeaderOverflow: true
}, //
// { field: 'stock_id', sortable: true, title: 'id', width: 250 }, // id
// =============================== Start ===============================
@ -183,15 +246,13 @@ export default {
},
LogDetail(id){
console.log("LogDetail:"+id)
this.$router.push('/MesStock/MesStockOutInLogDetail/'+id) //
LogDetail(id) {
console.log("LogDetail:" + id)
this.$router.push('/MesStock/MesStockOutInLogDetail/' + id) //
},
},
watch: {
},
watch: {},
};
</script>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,88 @@
<template>
<a-modal :visible="visible" :maskClosable="false"
@cancel="hideModal" :width="width+'mm'">
<a-spin :spinning="spinning" style="min-height: 100px">
<div id="preview_content_custom"></div>
</a-spin>
<template slot="title">
<a-space>
<div style="margin-right: 20px">打印预览</div>
<a-button :loading="waitShowPrinter" type="primary" icon="printer" @click.stop="print">打印</a-button>
<a-button type="primary" icon="printer" @click.stop="toPdf">pdf</a-button>
</a-space>
</template>
<template slot="footer">
<a-button key="close" type="info" @click="hideModal">
关闭
</a-button>
</template>
</a-modal>
</template>
<script>
export default {
name: "printPreview",
props: {},
data() {
return {
visible: false,
spinning: true,
waitShowPrinter: false,
// mm
width: 0,
//
hiprintTemplate: {},
//
printData: {}
}
},
computed: {},
watch: {},
created() {
},
mounted() {
},
methods: {
hideModal() {
this.visible = false
},
show(hiprintTemplate, printData, width = '210') {
console.log("hiprintTemplate:", hiprintTemplate)
console.log("hiprintTemplate.getHtml(printData):", hiprintTemplate.getHtml())
console.log("printData:", printData)
this.visible = true
this.spinning = true
this.width = hiprintTemplate.editingPanel ? hiprintTemplate.editingPanel.width : width;
this.hiprintTemplate = hiprintTemplate
this.printData = printData
setTimeout(() => {
// eslint-disable-next-line no-undef
$('#preview_content_custom').html(hiprintTemplate.getHtml(printData))
this.spinning = false
}, 500)
},
print() {
this.waitShowPrinter = true
this.hiprintTemplate.print(this.printData, {}, {
callback: () => {
this.waitShowPrinter = false
}
})
},
toPdf() {
this.hiprintTemplate.toPdf(this.printData, '打印预览pdf');
},
}
}
</script>
<style lang="less" scoped>
/deep/ .ant-modal-body {
padding: 0px;
}
/deep/ .ant-modal-content {
margin-bottom: 24px;
}
</style>

View File

@ -0,0 +1,342 @@
/* eslint-disable */
// 自定义设计元素1
export const aProvider = function (ops) {
var addElementTypes = function (context) {
context.removePrintElementTypes("aProviderModule"); // 移除已有的元素
context.addPrintElementTypes( // 添加新的元素
"aProviderModule",
[
new this.$hiPrint.PrintElementTypeGroup("基本数据", [
{
tid: 'aProviderModule.printDate', title: '打印时间', data: '2022-01-01 09:00', type: 'text',
options: {
field: 'printDate',
testData: '2022-01-01 09:00',
height: 16,
fontSize: 6.75,
fontWeight: "700",
textAlign: "left",
textContentVerticalAlign: "middle"
}
},
{
tid: 'aProviderModule.customer_name', title: '客户名称', data: '', type: 'text',
options: {
title: '客户名称:',
testData: '李四',
field: 'data.product_stock_log.customer_name',
height: 16,
fontSize: 12,
fontWeight: "700",
textAlign: "left",
textContentVerticalAlign: "middle"
}
},
{
tid: 'aProviderModule.customer_phone', title: '联系电话', data: '', type: 'text',
options: {
title: '联系电话:',
testData: '13800138000',
field: 'data.product_stock_log.customer_phone',
height: 16,
fontSize: 12,
fontWeight: "700",
textAlign: "left",
textContentVerticalAlign: "middle"
}
},
{
tid: 'aProviderModule.customer_address', title: '联系地址', data: '', type: 'text',
options: {
title: '联系地址:',
testData: '潮州市浮洋镇潮汕公路乌洋路段',
field: 'data.product_stock_log.customer_address',
height: 16,
fontSize: 12,
fontWeight: "700",
textAlign: "left",
textContentVerticalAlign: "middle"
}
},
{
tid: 'aProviderModule.code', title: '单据编号', data: '', type: 'text',
options: {
title: '单据编号:',
field: 'data.product_stock_log.code',
height: 16,
fontSize: 12,
fontWeight: "700",
textAlign: "left",
textContentVerticalAlign: "middle"
}
},
{
tid: 'aProviderModule.creater', title: '制单人', data: '吴淑银', type: 'text',
options: {
title: '制单人:',
testData: '张三',
field: 'data.product_stock_log.out_user_name',
height: 16,
fontSize: 16,
fontWeight: "700",
textAlign: "left",
textContentVerticalAlign: "middle"
}
},
{
tid: 'aProviderModule.signer', title: '送货人', data: '', type: 'text',
options: {
title: '送货人:',
height: 16,
fontSize: 16,
fontWeight: "700",
textAlign: "left",
textContentVerticalAlign: "middle"
}
},
{
tid: 'aProviderModule.signer', title: '收货人', data: '', type: 'text',
options: {
title: '收货人:',
height: 16,
fontSize: 16,
fontWeight: "700",
textAlign: "left",
textContentVerticalAlign: "middle"
}
},
]),
new hiprint.PrintElementTypeGroup("表格/其他", [
{
tid: 'aProviderModule.table', title: '出货单数据',
type: 'table',
options: {
field: 'data.table',
tableHeaderRepeat: 'first', // 表头重复方式
tableFooterRepeat: 'last', // 表尾重复方式
fields: [
{text: "商品编号", field: "code"},
{text: "商品名称", field: "name"},
{text: "规格", field: "spec"},
{text: "单位", field: "unit"},
{text: "数量", field: "stock"},
{text: "单价", field: "price"},
{text: "金额", field: "total_price"},
{text: "备注", field: "remark"}
],
},
editable: true, // 是否可编辑
columnDisplayEditable: true,//列显示是否能编辑
columnDisplayIndexEditable: true,//列顺序显示是否能编辑
columnTitleEditable: true,//列标题是否能编辑
columnResizable: true, //列宽是否能调整
columnAlignEditable: true,//列对齐是否调整
isEnableEditField: true, //编辑字段
isEnableContextMenu: true, //开启右键菜单 默认true
isEnableInsertRow: true, //插入行
isEnableDeleteRow: true, //删除行
isEnableInsertColumn: true, //插入列
isEnableDeleteColumn: true, //删除列
isEnableMergeCell: true, //合并单元格
columns: [
[
{
width: 84.61538461538461,
title: "商品编号",
field: "code",
columnId: "code",
checked: true,
fixed: false,
align: "center"
},
{
width: 108.43929187999774,
title: "商品名称",
field: "name",
columnId: "name",
checked: true,
fixed: false,
align: "center"
},
{
width: 57.83428900266546,
title: "规格",
field: "spec",
columnId: "spec",
checked: true,
fixed: false,
align: "center"
},
{
width: 71.59763313609467,
title: "单位",
field: "unit",
columnId: "unit",
checked: true,
fixed: false,
align: "center"
},
{
width: 60.58261265361857,
title: "数量",
field: "stock",
columnId: "stock",
checked: true,
fixed: false,
rowspan: 1,
colspan: 1,
align: "center"
},
{
width: 51.26221070690802,
title: "单价",
field: "price",
columnId: "price",
checked: true,
fixed: false,
rowspan: 1,
colspan: 1,
align: "center"
},
{
width: 43.3757167519991,
title: "金额",
field: "total_price",
columnId: "total_price",
checked: true,
fixed: false,
rowspan: 1,
colspan: 1,
align: "center"
},
{
width: 72.29286125333182,
title: "备注",
field: "remark",
columnId: "remark",
checked: true,
fixed: false,
rowspan: 1,
colspan: 1,
align: "center"
}
]
],
// 表格行样式
footerFormatter: function (options, rows, data, currentPageGridRowsData) {
// console.log("footerFormatter['options']:",options)
console.log("footerFormatter['rows']:", rows)
console.log("footerFormatter['data']:", data)
console.log("footerFormatter['currentPageGridRowsData']:", currentPageGridRowsData)
let total = 0;
currentPageGridRowsData.map((item, index) => {
total += item.total_price;
})
// 转换为大写
let digitUppercase = function (n) {
var fraction = ['角', '分'];
var digit = [
'零', '壹', '贰', '叁', '肆',
'伍', '陆', '柒', '捌', '玖'
];
var unit = [
['元', '万', '亿'],
['', '拾', '佰', '仟']
];
var head = n < 0 ? '欠' : '';
n = Math.abs(n);
var s = '';
for (var i = 0; i < fraction.length; i++) {
s += (digit[Math.floor(n * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
}
s = s || '整';
n = Math.floor(n);
for (var i = 0; i < unit[0].length && n > 0; i++) {
var p = '';
for (var j = 0; j < unit[1].length && n > 0; j++) {
p = digit[n % 10] + unit[1][j] + p;
n = Math.floor(n / 10);
}
s = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + s;
}
return head + s.replace(/(零.)*零元/, '元')
.replace(/(零.)+/g, '零')
.replace(/^整$/, '零元整');
}
// if (data && data['total_price']) {
// return `<td style="padding:0 10px" colspan="100">${'应收金额大写: ' + data['total_price']}</td>`
// }
return '<td style="padding:0 10px" colspan="100">应收金额大写: ' + digitUppercase(total) + '</td>'
},
},
]),
new hiprint.PrintElementTypeGroup("辅助",
[
// {tid: 'aProviderModule.logo', title: 'Logo', data: '', type: 'image'},
{
tid: 'aProviderModule.customText',
title: '文本',
customText: '自定义文本',
custom: true,
type: 'text'
},
{
tid: 'aProviderModule.longText', title: '长文本', type: 'longText', options: {
field: 'test.longText',
width: 200,
testData: '长文本分页/不分页测试'
},
},
{
tid: 'aProviderModule.hline',
title: '横线',
type: 'hline'
},
{
tid: 'aProviderModule.vline',
title: '竖线',
type: 'vline'
},
{
tid: 'aProviderModule.rect',
title: '矩形',
type: 'rect'
},
{
tid: 'aProviderModule.oval',
title: '椭圆',
type: 'oval'
},
{
tid: 'aProviderModule.barcode',
title: '条形码',
type: 'barcode',
},
{
tid: 'aProviderModule.qrcode',
title: '二维码',
type: 'qrcode',
}
])
]
);
};
return {
addElementTypes: addElementTypes
};
};
// type: 1供货商 2经销商
export default [{
name: 'A设计',
value: 'aProviderModule',
type: 1,
f: aProvider()
}]

View File

@ -29,7 +29,8 @@ export default {
data() {
return {
pageOptions: {},
warehouse_search: []
warehouse_search: [],
warehouse_id: null,
};
},
//
@ -84,7 +85,7 @@ export default {
end_time: 0, //
//
//
searchFormData: {
warehouse_id: '',
warehouse_pos_id: '',
@ -96,17 +97,13 @@ export default {
{key: "warehouse_pos_id", mode: "="}
],
//
searchFormItems: [ //
{
field: 'materials',
title: '料品',
span: 4,
itemRender: {name: '$input', props: {placeholder: '请输入料品'}}
},
{
}, {
title: '仓库', span: 5,
field: 'warehouse_id',
dataRule: {
@ -130,48 +127,16 @@ export default {
onDataChanged: ({data}) => {
console.log(data)
this.warehouse_search.clear();
this.warehouse_search = [{
column: "warehouse_id",
mode: "=",
value: data.id.toString()
}]
// this.pageOptions.searchFormItems.data.warehouse_pos_detail = {};
// this.pageOptions.searchFormItems.data.warehouse_pos_id = null;
this.pageOptions.searchFormItems[2].itemRender.props.params.actionParams.search_rules[0].value = data.id.toString();
this.pageOptions.searchFormItems[2].itemRender.props.params = JSON.parse(JSON.stringify(this.pageOptions.searchFormItems[2].itemRender.props.params));
this.$forceUpdate(); //
}
}
}
}
},
{
title: '仓位', span: 5,
field: 'warehouse_pos_id',
dataRule: {
fromField: "id",
saveField: "warehouse_pos_id"
},
itemRender: {
name: 'MkFormDataSelector', props: {
searchFieldNames: ["warehouse_id", "id"],
params: {
dataType: "object",
valueField: "id",
textField: "warehouse_location_name",
columns: [
{field: 'warehouse_location_name', title: '名称'},
{field: 'code', title: '编码'}
],
isClickToLoad: true,
actionParams: {
search_rules: this.warehouse_search
},
listdataFieldName: 'WarehouseLocation',
dataUrl: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/list`
}
}
}
},
{
align: 'right', span: 4, itemRender: { //
@ -202,11 +167,12 @@ export default {
{field: 'warehouse_pos_idetail.name', sortable: true, title: '库位', width: 120}, //
{field: 'product_detail.image', slots: {default: 'column2'}, sortable: true, title: '料品图片', width: 100}, //
{field: 'product_detail.name', sortable: true, title: '料品名称', width: 250}, //
{field: 'product_detail.code', sortable: true, title: '料品编号', width: 150}, //
{field: 'product_detail.code', sortable: true, title: '料品编号', width: 120}, //
{field: 'product_detail.price', sortable: true, title: '单价(¥)', width: 120}, //
{field: 'stock', sortable: true, title: '库存数量', width: 100}, //
{field: 'product_detail.spec', sortable: true, title: '规格型号', width: 150}, //
{field: 'product_detail.size', sortable: true, title: '尺寸', width: 100}, //
{field: 'product_detail.color', sortable: true, title: '颜色', width: 100}, //
{field: 'stock', sortable: true, title: '库存数量', width: 100}, //
{
field: 'create_time',
formatter: 'formatDate',

View File

@ -1,40 +1,92 @@
var config = {
printTagConfig:{
printTagConfig: {
"name": "标签信息",
"title": "标签信息",
"fields": [{
"name": "sequance",
"type": "string",
"title": "批次号"
"name": "sequance",
"type": "string",
"title": "批次号"
}, {
"name": "voucherdate",
"type": "string",
"title": "单据日期"
"name": "voucherdate",
"type": "string",
"title": "单据日期"
}, {
"name": "vouchercode",
"type": "string",
"title": "单据号"
"name": "vouchercode",
"type": "string",
"title": "单据号"
}, {
"name": "departmentName",
"type": "string",
"title": "生产车间"
"name": "departmentName",
"type": "string",
"title": "生产车间"
}, {
"name": "inventoryName",
"type": "string",
"title": "存货名称"
"name": "inventoryName",
"type": "string",
"title": "存货名称"
}, {
"name": "quantity",
"type": "string",
"title": "数量"
}]
},
printTagTemplate:{"panels":[{"index":0,"name":1,"height":70,"width":60,"paperHeader":4.5,"paperFooter":190.5,"printElements":[{"options":{"left":10.5,"top":28.5,"height":17,"width":142.5,"field":"sequance","fontSize":21.75,"fontWeight":"400","textAlign":"center","hideTitle":true,"title":"批次号","coordinateSync":false,"widthHeightSync":false,"qrCodeLevel":0,"right":153,"bottom":45.5,"vCenter":81.75,"hCenter":37,"lineHeight":27},"printElementType":{"title":"批次号","type":"text"}}],"paperNumberLeft":142.5,"paperNumberTop":199.5,"paperNumberDisabled":true}]}
"name": "quantity",
"type": "string",
"title": "数量"
}, {
"name": "table",
"type": "table",
"title": "table",
fields: [
{
"name": "inventoryName",
"type": "string",
"title": "存货名称"
}, {
"name": "quantity",
"type": "string",
"title": "数量"
}
};
]
}
]
},
printTagTemplate: {
"panels": [{
"index": 0,
"name": 1,
"height": 70,
"width": 60,
"paperHeader": 4.5,
"paperFooter": 190.5,
"printElements": [{
"options": {
"left": 10.5,
"top": 28.5,
"height": 17,
"width": 142.5,
"field": "sequance",
"fontSize": 21.75,
"fontWeight": "400",
"textAlign": "center",
"hideTitle": true,
"title": "批次号",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0,
"right": 153,
"bottom": 45.5,
"vCenter": 81.75,
"hCenter": 37,
"lineHeight": 27
}, "printElementType": {"title": "批次号", "type": "text"}
}],
"paperNumberLeft": 142.5,
"paperNumberTop": 199.5,
"paperNumberDisabled": true
}]
}
};
module.exports = config

View File

@ -14,11 +14,11 @@
<div slot="content">
<a-input-group compact style="margin: 10px 10px">
<a-input type="number" v-model="paperWidth" style=" width: 100px; text-align: center"
placeholder="宽(mm)" />
placeholder="宽(mm)"/>
<a-input style=" width: 30px; border-left: 0; pointer-events: none; backgroundColor: #fff"
placeholder="~" disabled />
placeholder="~" disabled/>
<a-input type="number" v-model="paperHeight" style="width: 100px; text-align: center; border-left: 0"
placeholder="高(mm)" />
placeholder="高(mm)"/>
</a-input-group>
<a-button type="primary" style="width: 100%" @click="otherPaper">确定</a-button>
</div>
@ -27,7 +27,8 @@
</a-button-group>
<a-button type="text" icon="zoom-out" @click="changeScale(false)"></a-button>
<a-input-number :value="scaleValue" :min="scaleMin" :max="scaleMax" :step="0.1" disabled style="width: 70px;"
:formatter="value => `${(value * 100).toFixed(0)}%`" :parser="value => value.replace('%', '')" />
:formatter="value => `${(value * 100).toFixed(0)}%`"
:parser="value => value.replace('%', '')"/>
<a-button type="text" icon="zoom-in" @click="changeScale(true)"></a-button>
<!-- 预览/打印 -->
<a-button-group>
@ -35,10 +36,10 @@
预览
</a-button>
<a-popconfirm title="是否确认清空?" okType="danger" okText="确定清空" @confirm="clearPaper">
<a-icon slot="icon" type="question-circle-o" style="color: red" />
<a-icon slot="icon" type="question-circle-o" style="color: red"/>
<a-button type="danger">
清空
<a-icon type="close" />
<a-icon type="close"/>
</a-button>
</a-popconfirm>
</a-button-group>
@ -68,7 +69,7 @@
</a-col>
</a-row>
<!-- 预览 -->
<print-preview ref="preView" />
<print-preview ref="preView"/>
</a-card>
</template>
@ -76,14 +77,15 @@
import printPreview from './preview'
import { hiprint } from "vue-plugin-hiprint";
import {hiprint} from "vue-plugin-hiprint";
import providers from './providers'
import printData from './print-data'
import $ from "jquery"
let hiprintTemplate;
export default {
name: "printCustom",
components: { printPreview },
components: {printPreview},
data() {
return {
template: null,
@ -139,7 +141,7 @@ export default {
let types = this.paperTypes
for (const key in types) {
let item = types[key]
let { width, height } = this.curPaper
let {width, height} = this.curPaper
if (item.width === width && item.height === height) {
type = key
}
@ -154,7 +156,7 @@ export default {
methods: {
init() {
this.modeList = providers.map((e) => {
return { type: e.type, name: e.name, value: e.value }
return {type: e.type, name: e.name, value: e.value}
})
this.changeMode()
},
@ -167,7 +169,7 @@ export default {
data.fields.forEach(field => {
if (field.type == "one2many" && field.fields) {
if ((field.type == "one2many" || field.type == "table") && field.fields) {
let subFields = [];
var columns = [];
@ -184,21 +186,21 @@ export default {
})
});
elements2.push(
{
tid: 'bProviderModule.' + field.name, title: field.title,
type: 'table',
options: {
field: field.name,
fields: subFields,
},
editable: true,
columnDisplayEditable: true,//
columnDisplayIndexEditable: true,//
columnTitleEditable: true,//
columnResizable: true, //
columnAlignEditable: true,//
columns: [columns]
});
{
tid: 'bProviderModule.' + field.name, title: field.title,
type: 'table',
options: {
field: field.name,
fields: subFields,
},
editable: true,
columnDisplayEditable: true,//
columnDisplayIndexEditable: true,//
columnTitleEditable: true,//
columnResizable: true, //
columnAlignEditable: true,//
columns: [columns]
});
return;
@ -224,46 +226,52 @@ export default {
context.removePrintElementTypes("aProviderModule");
context.addPrintElementTypes(
"aProviderModule", [
"aProviderModule", [
new hiprint.PrintElementTypeGroup("常规", elements),
new hiprint.PrintElementTypeGroup("常规", elements),
new hiprint.PrintElementTypeGroup("表格/其他", [
...elements2,
{ tid: 'bProviderModule.customText', title: '文本', customText: '自定义文本', custom: true, type: 'text' },
{
tid: 'bProviderModule.longText', title: '长文本', type: 'longText', options: {
field: 'test.longText',
width: 200,
testData: '长文本分页/不分页测试'
},
}
]),
new hiprint.PrintElementTypeGroup("表格/其他", [
...elements2,
{
tid: 'bProviderModule.customText',
title: '文本',
customText: '自定义文本',
custom: true,
type: 'text'
},
{
tid: 'bProviderModule.longText', title: '长文本', type: 'longText', options: {
field: 'test.longText',
width: 200,
testData: '长文本分页/不分页测试'
},
}
]),
new hiprint.PrintElementTypeGroup("辅助", [
{
tid: 'aProviderModule.hline',
title: '横线',
type: 'hline'
},
{
tid: 'aProviderModule.vline',
title: '竖线',
type: 'vline'
},
{
tid: 'aProviderModule.rect',
title: '矩形',
type: 'rect'
},
{
tid: 'aProviderModule.oval',
title: '椭圆',
type: 'oval'
}
])
]
new hiprint.PrintElementTypeGroup("辅助", [
{
tid: 'aProviderModule.hline',
title: '横线',
type: 'hline'
},
{
tid: 'aProviderModule.vline',
title: '竖线',
type: 'vline'
},
{
tid: 'aProviderModule.rect',
title: '矩形',
type: 'rect'
},
{
tid: 'aProviderModule.oval',
title: '椭圆',
type: 'oval'
}
])
]
);
};
return {
@ -272,7 +280,7 @@ export default {
},
changeMode() {
let { mode } = this
let {mode} = this
let provider = providers[mode]
console.log(provider)
hiprint.init({
@ -309,10 +317,10 @@ export default {
setPaper(type, value) {
try {
if (Object.keys(this.paperTypes).includes(type)) {
this.curPaper = { type: type, width: value.width, height: value.height }
this.curPaper = {type: type, width: value.width, height: value.height}
hiprintTemplate.setPaper(value.width, value.height)
} else {
this.curPaper = { type: 'other', width: value.width, height: value.height }
this.curPaper = {type: 'other', width: value.width, height: value.height}
hiprintTemplate.setPaper(value.width, value.height)
}
} catch (error) {
@ -342,21 +350,21 @@ export default {
this.setPaper('other', value)
},
preView() {
let { width } = this.curPaper
let {width} = this.curPaper
this.$refs.preView.show(hiprintTemplate, printData, width)
},
print() {
if (window.hiwebSocket.opened) {
const printerList = hiprintTemplate.getPrinterList();
console.log(printerList)
hiprintTemplate.print2(printData, { printer: '', title: 'hiprint测试打印' });
hiprintTemplate.print2(printData, {printer: '', title: 'hiprint测试打印'});
return
}
this.$message.error('客户端未连接,无法直接打印')
},
initDesigner({ config, template }) {
initDesigner({config, template}) {
if (!config || !config.fields || !config.fields.length) {
return;
@ -392,29 +400,29 @@ export default {
// , zoomtrue
this.scaleValue = hiprintTemplate.editingPanel.scale || 1;
},
setValue({ value, config }) {
setValue({value, config}) {
console.log(value, config)
var a4 = {
width: 210,
height: 296.6
};
this.curPaper = { type: value.PrintPage || "A4", width: value.Width || a4.width, height: value.Height || a4.height }
width: 210,
height: 296.6
};
this.curPaper = {type: value.PrintPage || "A4", width: value.Width || a4.width, height: value.Height || a4.height}
this.paperWidth = this.curPaper.width;
this.pagerHeight = this.curPaper.heigth;
let template = value.TemplateBody;
if(typeof(template) == 'string'){
if (typeof (template) == 'string') {
template = JSON.parse(template);
}
this.initDesigner({ template: template, config: config });
this.initDesigner({template: template, config: config});
},
getValue() {
let { width, height } = this.curPaper
let {width, height} = this.curPaper
return {
TemplateBody: hiprintTemplate.getJson(),
PrintPage: this.curPaperType,
@ -442,7 +450,7 @@ export default {
<style lang="less" scoped>
// build
/deep/ .hiprint-printElement-type>li>ul>li>a {
/deep/ .hiprint-printElement-type > li > ul > li > a {
padding: 4px 4px;
color: #1296db;
line-height: 1;
@ -451,7 +459,6 @@ export default {
}
//
.card-design {
overflow: hidden;