更新打印

This commit is contained in:
zxx 2023-12-07 16:14:07 +08:00
parent bebcd47310
commit e3b4329138
5 changed files with 161 additions and 137 deletions

View File

@ -11,7 +11,7 @@
<a-form-item label="创建时间" :style="{ display: 'inline-block', width: 120 }">
</a-form-item>
<a-form-item :style="{ display: 'inline-block', width: 'calc(100% - 120px )' }">
<a-range-picker @change="onDateChange" />
<a-range-picker @change="onDateChange"/>
</a-form-item>
</template>
</vxe-form>
@ -23,9 +23,6 @@
</a-row>
<vxe-toolbar ref="xToolbar" custom>
<template #buttons>
<a-button type="primary" icon="delete" @click="pageDelete()">批量删除</a-button>
@ -36,7 +33,6 @@
<vxe-grid ref='xGrid' v-bind="gridOptions">
<template #role="{ row }">
<div v-if="row && row.user_role" class="roles">
<a-tag v-for="item in row.user_role" :key="row.id + '_' + item.id">{{ item.name }}</a-tag>
@ -44,8 +40,12 @@
</template>
<template #op="{ row }">
<div class="oplinks">
<a @click.stop="pageEdit(row)" title="编辑"><a-icon type="edit" /></a>
<a @click.stop="pageDelete(row)" title="删除"><a-icon type="delete" /></a>
<a @click.stop="pageEdit(row)" title="编辑">
<a-icon type="edit"/>
</a>
<a @click.stop="pageDelete(row)" title="删除">
<a-icon type="delete"/>
</a>
</div>
</template>
<template #op2="{ row }">
@ -69,7 +69,7 @@
</template>
<template #default>
<vxe-table ref="xRoleTable" show-overflow auto-resize height="300" :checkboxConfig="roleCheckboxConfig"
:rowConfig="{ isCurrent: true, isHover: true }" :data="roleData">
:rowConfig="{ isCurrent: true, isHover: true }" :data="roleData">
<vxe-column type="checkbox" width="50"></vxe-column>
<vxe-column field="name" title="角色名"></vxe-column>
<vxe-column field="desc" title="描述"></vxe-column>
@ -84,8 +84,8 @@
<template #default>
<!-- 显示设置权限 -->
<vxe-table show-overflow auto-resize height="500" row-id="id" ref="xPermissionTable" :data="permissionData"
:tree-config="{ transform: true, expandAll: true }"
:checkbox-config="{ reserve: true, highlight: true, trigger: 'row', labelField: 'nodeTitle' }">
:tree-config="{ transform: true, expandAll: true }"
:checkbox-config="{ reserve: true, highlight: true, trigger: 'row', labelField: 'nodeTitle' }">
<vxe-column type="checkbox" title="权限" width="400" tree-node></vxe-column>
<vxe-column field="desc" title="描述"></vxe-column>
</vxe-table>
@ -133,32 +133,31 @@ export default {
start_time: 0,
end_time: 0,
//
searchFormData: {
name: '',
nick_name: '',
},
searchRules: [
{ key: "name", mode: "like" },
{ key: "nick_name", mode: "like" }
{key: "name", mode: "like"},
{key: "nick_name", mode: "like"}
],
searchFormItems: [
{ field: 'name', title: '名称', span: 5, itemRender: { name: '$input', props: { placeholder: '请输入名称' } } },
{ field: 'nick_name', title: '昵称', span: 5, itemRender: { name: '$input', props: { placeholder: '请输入昵称' } } },
{ span: 8, slots: { default: 'date' } },
{field: 'name', title: '名称', span: 5, itemRender: {name: '$input', props: {placeholder: '请输入名称'}}},
{field: 'nick_name', 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: '重置'}}]
}
}
],
//
gridOptions: {
height: '100%',
@ -175,7 +174,7 @@ export default {
ajax: {
// queryreload
query: (options) => {
const { page, sorts } = options;
const {page, sorts} = options;
var params = {};
params.page = page.currentPage;
params.limit = page.pageSize;
@ -189,21 +188,21 @@ export default {
})
});
}
return this.loadData({ params });
return this.loadData({params});
}
}
},
columns: [
{ type: 'checkbox', width: '40' },
{ type: 'seq', width: 50 },
{ field: 'realname', sortable: true, title: '名称' },
{ field: 'nickname', sortable: true, title: '昵称', showHeaderOverflow: true },
{ field: 'email', sortable: true, title: 'email', showHeaderOverflow: true },
{ field: 'mobile', sortable: true, title: '电话', showHeaderOverflow: true },
{ title: '角色', slots: { default: 'role' }, width: 150 },
{ title: '角色设置', slots: { default: 'op2' }, width: 120 },
{ title: '自定义权限设置', slots: { default: 'op3' }, width: 120 },
{ title: '操作', slots: { default: 'op' }, width: 120 }
{type: 'checkbox', width: '40'},
{type: 'seq', width: 50},
{field: 'realname', sortable: true, title: '名称'},
{field: 'nickname', sortable: true, title: '昵称', showHeaderOverflow: true},
{field: 'email', sortable: true, title: 'email', showHeaderOverflow: true},
{field: 'mobile', sortable: true, title: '电话', showHeaderOverflow: true},
{title: '角色', slots: {default: 'role'}, width: 150},
{title: '角色设置', slots: {default: 'op2'}, width: 120},
{title: '自定义权限设置', slots: {default: 'op3'}, width: 120},
{title: '操作', slots: {default: 'op'}, width: 120}
]
}
};
@ -271,17 +270,19 @@ export default {
let row = this.$refs.xGrid.getCurrentRecord();
if (!row) {
let rows = this.$refs.xGrid.getCheckboxRecords();
if (rows && rows.length) { row = rows[0]; }
if (rows && rows.length) {
row = rows[0];
}
}
return row;
},
loadData({ params }) {
loadData({params}) {
params.start_time = this.start_time;
params.end_time = this.end_time;
return this.$mk.getPagedData({ url: this.actions.getList, data: params });
return this.$mk.getPagedData({url: this.actions.getList, data: params});
},
@ -293,7 +294,7 @@ export default {
title: "新增用户信息",
pageMode: "add",
dataId: 0,
callback: ({ success }) => {
callback: ({success}) => {
success && this.$refs.xGrid.commitProxy('query')
}
})
@ -311,12 +312,12 @@ export default {
title: "编辑用户信息",
pageMode: "edit",
dataId: row[this.keyName],
callback: ({ success }) => {
callback: ({success}) => {
success && this.$refs.xGrid.commitProxy('query')
}
})
},
saveRoleSetting({ adds, removes }) {
saveRoleSetting({adds, removes}) {
if (!adds.length && !removes.length) {
return;
}
@ -361,11 +362,11 @@ export default {
adds.push(row.id);
}
})
this.saveRoleSetting({ adds, removes });
this.saveRoleSetting({adds, removes});
});
},
savePermission({ adds, removes }) {
savePermission({adds, removes}) {
if (!adds.length && !removes.length) {
return;
}
@ -412,14 +413,13 @@ export default {
adds.push(row.permission_code);
}
})
this.savePermission({ adds, removes }); //
this.savePermission({adds, removes}); //
});
},
roleDataInit() { //
this.$mk.post({
url: this.actions.roleList,
data: {
}
data: {}
}).then(a => {
this.roleData = a.data.Role;
@ -431,8 +431,7 @@ export default {
this.$mk.post({
url: this.actions.permissionList,
data: {
}
data: {}
}).then(a => {
let arr = [];
a.data.BasePermission.forEach(item => {
@ -562,15 +561,10 @@ export default {
}
},
//
watch: {
}
watch: {}
};
</script>
<style scoped lang="less">
.page-body {
@ -581,7 +575,7 @@ export default {
.gridPanel {
height: calc(100vh - 430px);
}
</style>
</style>
<style>
.oplinks svg {

View File

@ -3,7 +3,7 @@
<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"-->
@ -213,6 +213,7 @@ import BASE_URL from '@/services/mes/api.js';
import XEUtils from 'xe-utils' // xe-utils
import printPreview from './preview'
import providers from './providers'
import {mapState} from "vuex";
let hiprintTemplate;
export default {
@ -233,6 +234,7 @@ export default {
},
computed: {
...mapState('account', ['project', 'company']), // ,
desc() {
return this.$t('editPageDesc')
},
@ -565,15 +567,31 @@ export default {
let hiPrint = this.$hiPrint
let data = require('./data2.json')
let templates = data
let hiprintTemplate = new hiPrint.PrintTemplate({
template: templates
});
template: templates
});
//hiprintTemplate.print({});
let {width} = this.curPaper
this.$refs.preView.show(hiprintTemplate, {}, width)
this.formOptions.data.table = [
{
"code": this.formOptions.data.product_detail.code,
"name": this.formOptions.data.product_detail.name,
"spec": this.formOptions.data.product_detail.spec,
"unit": this.formOptions.data.product_detail.unit,
"out_stock": this.formOptions.data.out_stock,
"price": this.formOptions.data.price,
"total_price": this.formOptions.data.total_price,
"remark": this.formOptions.data.remark,
}
]
this.formOptions.data.companyTitle = this.company.company_info.name + "送货单"
console.log("this.formOptions.data", this.formOptions.data)
this.$refs.preView.show(hiprintTemplate, this.formOptions.data, width)
},
},

View File

@ -2,8 +2,8 @@
<div class="page-body">
<vxe-form :data="formOptions.data" ref="xForm" :title-width="formOptions.titleWidth"
:title-align="formOptions.titleAlign" :rules="formOptions.rules" :items="formOptions.items" titleColon>
</vxe-form>
:title-align="formOptions.titleAlign" :rules="formOptions.rules" :items="formOptions.items" titleColon>
</vxe-form>
<div class="footerbar">
<a-button type="primary" @click="ok">确定</a-button>
@ -17,15 +17,14 @@
import BASE_URL from '@/services/mes/api.js';
export default {
components: {},
props: {
pageMode: {
type: String,
default: "edit"
},
dataId: {
}
dataId: {}
},
@ -67,17 +66,38 @@ export default {
rules: {
out_stock: [
{ required: true, message: '请输入出库数量' }
]
{required: true, message: '请输入出库数量'}
]
},
//
items: [
{ field: 'stock', dataRule: { type: 'number' }, title: '出库数量', span: 12, itemRender: { name: '$input' , props: { type: "number" }} },
{ field: 'out_type',title: '出库类型', span: 12, itemRender: { name: '$input' } },
{ field: 'out_time', dataRule: { type: 'timestamp' }, title: '出库时间', span: 12, itemRender: { name: '$input' , props: { type: "date" }} },
{ field: 'bill_date', dataRule: { type: 'timestamp' }, title: '单据日期', span: 12, itemRender: { name: '$input', props: { type: "date" } } },
{
field: 'stock',
dataRule: {type: 'number'},
title: '出库数量',
span: 12,
itemRender: {name: '$input', props: {type: "number"}}
},
{field: 'out_type', title: '出库类型', span: 12, itemRender: {name: '$input'}},
{
field: 'out_time',
dataRule: {type: 'timestamp'},
title: '出库时间',
span: 12,
itemRender: {name: '$input', props: {type: "date"}}
},
{
field: 'bill_date',
dataRule: {type: 'timestamp'},
title: '单据日期',
span: 12,
itemRender: {name: '$input', props: {type: "date"}}
},
{field: 'customer_name', title: '客户名称', span: 12, itemRender: {name: '$input'}},
{field: 'customer_phone', title: '客户电话', span: 12, itemRender: {name: '$input'}},
{field: 'customer_address', title: '客户地址', span: 12, itemRender: {name: '$input'}},
{
title: '出库人', span: 12,
@ -94,7 +114,7 @@ export default {
textField: "name",
listdataFieldName: 'MesStaff',
dataUrl: `${BASE_URL.BASE_URL}/MesStaff/v1/mes/staff/list`,
onDataChanged: ({ data }) => {
onDataChanged: ({data}) => {
console.log(data)
this.pageOptions.formOptions.data.warehouse_mobile = data.phone;
}
@ -104,46 +124,47 @@ export default {
},
{
title: '业务员', span: 12,
field: 'salesman_name',
dataRule: {
fromField: "id",
saveField: "salesman_uid"
},
itemRender: {
name: 'MkFormDataSelector', props: {
params: {
dataType: "string",
valueField: "id",
textField: "name",
listdataFieldName: 'MesStaff',
dataUrl: `${BASE_URL.BASE_URL}/MesStaff/v1/mes/staff/list`,
onDataChanged: ({ data }) => {
console.log(data)
this.pageOptions.formOptions.data.warehouse_mobile = data.phone;
}
title: '业务员', span: 12,
field: 'salesman_name',
dataRule: {
fromField: "id",
saveField: "salesman_uid"
},
itemRender: {
name: 'MkFormDataSelector', props: {
params: {
dataType: "string",
valueField: "id",
textField: "name",
listdataFieldName: 'MesStaff',
dataUrl: `${BASE_URL.BASE_URL}/MesStaff/v1/mes/staff/list`,
onDataChanged: ({data}) => {
console.log(data)
this.pageOptions.formOptions.data.warehouse_mobile = data.phone;
}
}
}
},
}
},
{ field: 'check_time', dataRule: { type: 'timestamp' }, title: '验货时间', span: 12, itemRender: { name: '$input', props: { type: "date" } } },
{ field: 'delivery_no', title: '发货单号', span: 12, itemRender: { name: '$input' } },
{
field: 'check_time',
dataRule: {type: 'timestamp'},
title: '验货时间',
span: 12,
itemRender: {name: '$input', props: {type: "date"}}
},
{ field: 'contact', title: '联系人', span: 12, itemRender: { name: '$input' } },
{ field: 'phone', title: '联系电话', span: 12, itemRender: { name: '$input' } },
{ field: 'remark', title: '备注', span: 24, itemRender: { name: '$textarea' } },
{field: 'delivery_no', title: '发货单号', span: 12, itemRender: {name: '$input'}},
{field: 'contact', title: '联系人', span: 12, itemRender: {name: '$input'}},
{field: 'phone', title: '联系电话', span: 12, itemRender: {name: '$input'}},
{field: 'remark', title: '备注', span: 24, itemRender: {name: '$textarea'}},
]
},
//
addModeItems: [
],
addModeItems: [],
};
@ -173,7 +194,7 @@ export default {
this.$mk.post({
url: this.actions.get,
loading: "加载中...",
data: { id: this.$mk.toBigInt(dataId) },
data: {id: this.$mk.toBigInt(dataId)},
useBigInt: true
}).then(a => {
@ -197,20 +218,17 @@ export default {
}
},
//
methods: {
// id
getDataId() {
let dataId = this.dataId;
if (this.$route && this.$route.params && this.$route.params.id) {
dataId = this.$route.params.id;
}
}
if (!dataId) {
dataId = 0;
}
@ -225,31 +243,27 @@ export default {
//
back() {
this.$emit("callback", {success:true});
},
this.$emit("callback", {success: true});
},
//
ok() {
let save = () => {
let postdata = Object.assign({}, this.formOptions.data);
//
this.$mk.formatFormData({ data: postdata, rules: this.formOptions.items });
this.$mk.formatFormData({data: postdata, rules: this.formOptions.items});
postdata.stock_pos_id = this.getDataId_BigInt();
//
this.$mk.post({
url: this.actions.save,
@ -266,7 +280,6 @@ export default {
}, 500);
} else {
this.$mk.error(a.msg || a.message);
}
@ -277,10 +290,9 @@ export default {
};
//
this.$mk.validateForm({ form: this.$refs.xForm }).then(() => { //
this.$mk.validateForm({form: this.$refs.xForm}).then(() => { //
save(); //
@ -297,12 +309,10 @@ export default {
this.back();
},
},
//
watch: {
}
watch: {}
};
</script>

View File

@ -19,7 +19,8 @@
"fontWeight": "700",
"textAlign": "center",
"hideTitle": true,
"title": "凤翔模具厂送货单",
"title": "送货单",
"field": "companyTitle",
"right": 420.75,
"bottom": 48.74609375,
"vCenter": 292.5,
@ -53,7 +54,8 @@
"top": 67.5,
"height": 9.75,
"width": 120,
"title": "客户名称:"
"title": "客户名称:",
"field": "customer_name"
},
"printElementType": {
"title": "文本",
@ -67,6 +69,7 @@
"height": 9.75,
"width": 120,
"title": "联系方式:",
"field": "customer_phone",
"right": 285.4921875,
"bottom": 82.5,
"vCenter": 225.4921875,
@ -82,8 +85,9 @@
"left": 287.5,
"top": 67.5,
"height": 9.75,
"width": 120,
"width": 320,
"title": "客户地址:",
"field": "customer_address",
"right": 408.24609375,
"bottom": 83.25,
"vCenter": 348.24609375,
@ -148,7 +152,7 @@
{
"width": 86.76923076923077,
"title": "商品编号",
"field": "data.product_stock_log.product_detail.code",
"field": "code",
"checked": true,
"columnId": "code",
"fixed": false,
@ -159,7 +163,7 @@
{
"width": 111.19956476421586,
"title": "商品名称",
"field": "data.product_stock_log.product_detail.name",
"field": "name",
"checked": true,
"columnId": "name",
"fixed": false,
@ -299,15 +303,16 @@
"left": 25,
"top": 197.5,
"height": 9.75,
"width": 120,
"title": "制单人:吴淑银",
"width": 320,
"title": "制单人",
"field": "create_name",
"right": 145.2421875,
"bottom": 207.24609375,
"vCenter": 85.2421875,
"hCenter": 202.37109375,
"coordinateSync": false,
"widthHeightSync": false,
"fontSize": 18,
"fontSize": 14,
"qrCodeLevel": 0
},
"printElementType": {
@ -317,7 +322,7 @@
},
{
"options": {
"left": 395,
"left": 450,
"top": 197.5,
"height": 9.75,
"width": 120,
@ -328,7 +333,7 @@
"hCenter": 200.12109375,
"coordinateSync": false,
"widthHeightSync": false,
"fontSize": 18,
"fontSize": 14,
"qrCodeLevel": 0
},
"printElementType": {
@ -338,7 +343,7 @@
},
{
"options": {
"left": 192.5,
"left": 320,
"top": 197.5,
"height": 9.75,
"width": 120,
@ -349,7 +354,7 @@
"hCenter": 202.125,
"coordinateSync": false,
"widthHeightSync": false,
"fontSize": 18,
"fontSize": 14,
"qrCodeLevel": 0
},
"printElementType": {

View File

@ -47,9 +47,6 @@ export default {
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;