更新打印

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

View File

@ -3,7 +3,7 @@
<div class="page-body"> <div class="page-body">
<a-button type="primary" icon="eye" @click="preView"> <a-button type="primary" icon="eye" @click="preView">
预览 打印预览
</a-button> </a-button>
<h2> {{ title }}</h2> <h2> {{ title }}</h2>
<!-- <vxe-form :data="formOptions.data" ref="xForm" :title-width="formOptions.titleWidth"--> <!-- <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 XEUtils from 'xe-utils' // xe-utils
import printPreview from './preview' import printPreview from './preview'
import providers from './providers' import providers from './providers'
import {mapState} from "vuex";
let hiprintTemplate; let hiprintTemplate;
export default { export default {
@ -233,6 +234,7 @@ export default {
}, },
computed: { computed: {
...mapState('account', ['project', 'company']), // ,
desc() { desc() {
return this.$t('editPageDesc') return this.$t('editPageDesc')
}, },
@ -568,12 +570,28 @@ export default {
let hiprintTemplate = new hiPrint.PrintTemplate({ let hiprintTemplate = new hiPrint.PrintTemplate({
template: templates template: templates
}); });
//hiprintTemplate.print({}); //hiprintTemplate.print({});
let {width} = this.curPaper 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,7 +2,7 @@
<div class="page-body"> <div class="page-body">
<vxe-form :data="formOptions.data" ref="xForm" :title-width="formOptions.titleWidth" <vxe-form :data="formOptions.data" ref="xForm" :title-width="formOptions.titleWidth"
:title-align="formOptions.titleAlign" :rules="formOptions.rules" :items="formOptions.items" titleColon> :title-align="formOptions.titleAlign" :rules="formOptions.rules" :items="formOptions.items" titleColon>
</vxe-form> </vxe-form>
<div class="footerbar"> <div class="footerbar">
@ -24,8 +24,7 @@ export default {
type: String, type: String,
default: "edit" default: "edit"
}, },
dataId: { dataId: {}
}
}, },
@ -67,17 +66,38 @@ export default {
rules: { rules: {
out_stock: [ out_stock: [
{ required: true, message: '请输入出库数量' } {required: true, message: '请输入出库数量'}
] ]
}, },
// //
items: [ 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: 'stock',
{ field: 'out_time', dataRule: { type: 'timestamp' }, title: '出库时间', span: 12, itemRender: { name: '$input' , props: { type: "date" }} }, dataRule: {type: 'number'},
{ field: 'bill_date', dataRule: { type: 'timestamp' }, title: '单据日期', span: 12, itemRender: { name: '$input', props: { type: "date" } } }, 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, title: '出库人', span: 12,
@ -94,7 +114,7 @@ export default {
textField: "name", textField: "name",
listdataFieldName: 'MesStaff', listdataFieldName: 'MesStaff',
dataUrl: `${BASE_URL.BASE_URL}/MesStaff/v1/mes/staff/list`, dataUrl: `${BASE_URL.BASE_URL}/MesStaff/v1/mes/staff/list`,
onDataChanged: ({ data }) => { onDataChanged: ({data}) => {
console.log(data) console.log(data)
this.pageOptions.formOptions.data.warehouse_mobile = data.phone; this.pageOptions.formOptions.data.warehouse_mobile = data.phone;
} }
@ -104,46 +124,47 @@ export default {
}, },
{ {
title: '业务员', span: 12, title: '业务员', span: 12,
field: 'salesman_name', field: 'salesman_name',
dataRule: { dataRule: {
fromField: "id", fromField: "id",
saveField: "salesman_uid" saveField: "salesman_uid"
}, },
itemRender: { itemRender: {
name: 'MkFormDataSelector', props: { name: 'MkFormDataSelector', props: {
params: { params: {
dataType: "string", dataType: "string",
valueField: "id", valueField: "id",
textField: "name", textField: "name",
listdataFieldName: 'MesStaff', listdataFieldName: 'MesStaff',
dataUrl: `${BASE_URL.BASE_URL}/MesStaff/v1/mes/staff/list`, dataUrl: `${BASE_URL.BASE_URL}/MesStaff/v1/mes/staff/list`,
onDataChanged: ({ data }) => { onDataChanged: ({data}) => {
console.log(data) console.log(data)
this.pageOptions.formOptions.data.warehouse_mobile = data.phone; this.pageOptions.formOptions.data.warehouse_mobile = data.phone;
}
} }
} }
} }
}, }
},
{
field: 'check_time',
dataRule: {type: 'timestamp'},
title: '验货时间',
span: 12,
itemRender: {name: '$input', props: {type: "date"}}
},
{ 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: '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: 'contact', title: '联系人', span: 12, itemRender: { name: '$input' } }, {field: 'remark', title: '备注', span: 24, itemRender: {name: '$textarea'}},
{ 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({ this.$mk.post({
url: this.actions.get, url: this.actions.get,
loading: "加载中...", loading: "加载中...",
data: { id: this.$mk.toBigInt(dataId) }, data: {id: this.$mk.toBigInt(dataId)},
useBigInt: true useBigInt: true
}).then(a => { }).then(a => {
@ -197,14 +218,11 @@ export default {
} }
}, },
// //
methods: { methods: {
// id // id
getDataId() { getDataId() {
let dataId = this.dataId; let dataId = this.dataId;
@ -226,30 +244,26 @@ export default {
back() { back() {
this.$emit("callback", {success:true}); this.$emit("callback", {success: true});
}, },
// //
ok() { ok() {
let save = () => { let save = () => {
let postdata = Object.assign({}, this.formOptions.data); 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(); postdata.stock_pos_id = this.getDataId_BigInt();
// //
this.$mk.post({ this.$mk.post({
url: this.actions.save, url: this.actions.save,
@ -266,7 +280,6 @@ export default {
}, 500); }, 500);
} else { } else {
this.$mk.error(a.msg || a.message); this.$mk.error(a.msg || a.message);
} }
@ -278,9 +291,8 @@ export default {
}; };
// //
this.$mk.validateForm({ form: this.$refs.xForm }).then(() => { // this.$mk.validateForm({form: this.$refs.xForm}).then(() => { //
save(); // save(); //
@ -300,9 +312,7 @@ export default {
}, },
// //
watch: { watch: {}
}
}; };
</script> </script>

View File

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

View File

@ -47,9 +47,6 @@ export default {
this.visible = false this.visible = false
}, },
show(hiprintTemplate, printData, width = '210') { show(hiprintTemplate, printData, width = '210') {
console.log("hiprintTemplate:", hiprintTemplate)
console.log("hiprintTemplate.getHtml(printData):", hiprintTemplate.getHtml())
console.log("printData:", printData)
this.visible = true this.visible = true
this.spinning = true this.spinning = true
this.width = hiprintTemplate.editingPanel ? hiprintTemplate.editingPanel.width : width; this.width = hiprintTemplate.editingPanel ? hiprintTemplate.editingPanel.width : width;