From 61734fc304e8d890a6bf8715bee9be203e0af9f0 Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周五, 06 9月 2024 10:21:05 +0800 Subject: [PATCH] 入库优化 --- yiqi_iwara-scada-web/src/api/modular/main/WorkPieceOutboundManage.js | 9 + yiqi_iwara-scada-web/src/views/main/WorkPieceOutboundRecord/editForm.vue | 125 +++++++++++++++ yiqi_iwara-scada-web/src/views/main/WorkPieceOutboundRecord/index.vue | 229 ++++++++++++++++++++++++++++ yiqi_iwara-scada-web/src/views/main/WorkPieceOutboundRecord/addForm.vue | 102 ++++++++++++ yiqi_iwara-scada-web/src/views/main/WorkPieceOutbound/index.vue | 12 5 files changed, 471 insertions(+), 6 deletions(-) diff --git a/yiqi_iwara-scada-web/src/api/modular/main/WorkPieceOutboundManage.js b/yiqi_iwara-scada-web/src/api/modular/main/WorkPieceOutboundManage.js index 471d6b6..680d19d 100644 --- a/yiqi_iwara-scada-web/src/api/modular/main/WorkPieceOutboundManage.js +++ b/yiqi_iwara-scada-web/src/api/modular/main/WorkPieceOutboundManage.js @@ -13,6 +13,15 @@ }) } +export function WorkPieceOutboundRecordPage (parameter) { + return axios({ + url: '/WorkPieceOutbound/pageForRecord', + method: 'get', + params: parameter + }) +} + + /** * 宸ヤ欢鍑哄簱淇℃伅鍒楄〃 * diff --git a/yiqi_iwara-scada-web/src/views/main/WorkPieceOutbound/index.vue b/yiqi_iwara-scada-web/src/views/main/WorkPieceOutbound/index.vue index 90ad060..ae62d89 100644 --- a/yiqi_iwara-scada-web/src/views/main/WorkPieceOutbound/index.vue +++ b/yiqi_iwara-scada-web/src/views/main/WorkPieceOutbound/index.vue @@ -15,12 +15,12 @@ </a-form-item> </a-col> <a-col :md="colMd" :sm="colSm"> - <a-form-item label="鍑哄簱浜�"> - <a-input v-model="queryParam.workPieceOutboundUserName" allow-clear placeholder="璇疯緭鍏ュ嚭搴撲汉" /> + <a-form-item label="鍏ュ簱浜�"> + <a-input v-model="queryParam.workPieceOutboundUserName" allow-clear placeholder="璇疯緭鍏ュ叆搴撲汉" /> </a-form-item> </a-col> <a-col :md="colMd" :sm="colSm"> - <a-form-item label="鍑哄簱鏃堕棿"> + <a-form-item label="鍏ュ簱鏃堕棿"> <a-range-picker style="width:100%" :show-time="{format:'HH:mm'}" v-model="queryParam.dates" format="YYYY-MM-DD HH:mm" /> </a-form-item> </a-col> @@ -144,13 +144,13 @@ // dataIndex: 'workPieceUnLineUserName' // }, { - title: '鍑哄簱鏃堕棿', + title: '鍏ュ簱鏃堕棿', align: 'center', sorter: true, dataIndex: 'workPieceOutboundTime' }, { - title: '鍑哄簱浜�', + title: '鍏ュ簱浜�', align: 'center', sorter: true, dataIndex: 'workPieceOutboundUserName' @@ -208,7 +208,7 @@ allRevoke() { this.$confirm({ title: '鎾ら攢纭', - content: '纭畾鎾ら攢閫変腑宸ヤ欢鍑哄簱淇℃伅锛�', + content: '纭畾鎾ら攢閫変腑宸ヤ欢鍏ュ簱淇℃伅锛�', onOk: () => { this.WorkPieceOutboundDelete(this.selectedRows) }, diff --git a/yiqi_iwara-scada-web/src/views/main/WorkPieceOutboundRecord/addForm.vue b/yiqi_iwara-scada-web/src/views/main/WorkPieceOutboundRecord/addForm.vue new file mode 100644 index 0000000..9b344e2 --- /dev/null +++ b/yiqi_iwara-scada-web/src/views/main/WorkPieceOutboundRecord/addForm.vue @@ -0,0 +1,102 @@ +锘�<template> + <a-modal + title="鏂板宸ヤ欢鍑哄簱淇℃伅" + :width="900" + :visible="visible" + :confirmLoading="confirmLoading" + @ok="handleSubmit" + @cancel="handleCancel"> + <a-spin :spinning="confirmLoading"> + <a-form :form="form"> + <a-form-item label="宸ヤ欢鍙�" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback> + <a-input placeholder="璇疯緭鍏ュ伐浠跺彿" v-decorator="['workPieceID', {rules: [{required: true, message: '璇疯緭鍏ュ伐浠跺彿锛�'}]}]" /> + </a-form-item> + <a-form-item label="OP80鎴愬搧鐮�" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback> + <a-input placeholder="璇疯緭鍏P80鎴愬搧鐮�" v-decorator="['oP80NewCode', {rules: [{required: true, message: '璇疯緭鍏P80鎴愬搧鐮侊紒'}]}]" /> + </a-form-item> + <a-form-item label="鍑哄簱鏃堕棿" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback> + <a-date-picker style="width: 100%" placeholder="璇烽�夋嫨鍑哄簱鏃堕棿" v-decorator="['workPieceOutboundTime',{rules: [{ required: true, message: '璇烽�夋嫨鍑哄簱鏃堕棿锛�' }]}]" @change="onChangeworkPieceOutboundTime"/> + </a-form-item> + <a-form-item label="鍑哄簱浜�" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback> + <a-date-picker style="width: 100%" placeholder="璇烽�夋嫨鍑哄簱浜�" v-decorator="['workPieceOutboundUser',{rules: [{ required: true, message: '璇烽�夋嫨鍑哄簱浜猴紒' }]}]" @change="onChangeworkPieceOutboundUser"/> + </a-form-item> + </a-form> + </a-spin> + </a-modal> +</template> + +<script> + import { + WorkPieceOutboundAdd + } from '@/api/modular/main/WorkPieceOutboundManage' + export default { + data () { + return { + labelCol: { + xs: { span: 24 }, + sm: { span: 5 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 15 } + }, + workPieceOutboundTimeDateString: '', + workPieceOutboundUserDateString: '', + visible: false, + confirmLoading: false, + form: this.$form.createForm(this) + } + }, + methods: { + // 鍒濆鍖栨柟娉� + add (record) { + this.visible = true + this.$nextTick(() => { + + }); + }, + /** + * 鎻愪氦琛ㄥ崟 + */ + handleSubmit () { + const { form: { validateFields } } = this + this.confirmLoading = true + validateFields((errors, values) => { + if (!errors) { + for (const key in values) { + if (typeof (values[key]) === 'object') { + values[key] = JSON.stringify(values[key]) + } + } + values.workPieceOutboundTime = this.workPieceOutboundTimeDateString + values.workPieceOutboundUser = this.workPieceOutboundUserDateString + WorkPieceOutboundAdd(values).then((res) => { + if (res.success) { + this.$message.success('鏂板鎴愬姛') + this.confirmLoading = false + this.$emit('ok', values) + this.handleCancel() + } else { + this.$message.error('鏂板澶辫触锛�' + JSON.stringify(res.message)) + } + }).finally((res) => { + this.confirmLoading = false + }) + } else { + this.confirmLoading = false + } + }) + }, + onChangeworkPieceOutboundTime(date, dateString) { + this.workPieceOutboundTimeDateString = dateString + }, + onChangeworkPieceOutboundUser(date, dateString) { + this.workPieceOutboundUserDateString = dateString + }, + handleCancel () { + this.form.resetFields() + this.visible = false + } + } + } +</script> diff --git a/yiqi_iwara-scada-web/src/views/main/WorkPieceOutboundRecord/editForm.vue b/yiqi_iwara-scada-web/src/views/main/WorkPieceOutboundRecord/editForm.vue new file mode 100644 index 0000000..d0bed47 --- /dev/null +++ b/yiqi_iwara-scada-web/src/views/main/WorkPieceOutboundRecord/editForm.vue @@ -0,0 +1,125 @@ +锘�<template> + <a-modal + title="缂栬緫宸ヤ欢鍑哄簱淇℃伅" + :width="900" + :visible="visible" + :confirmLoading="confirmLoading" + @ok="handleSubmit" + @cancel="handleCancel"> + <a-spin :spinning="confirmLoading"> + <a-form :form="form"> + <a-form-item label="宸ヤ欢鍙�" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback> + <a-input placeholder="璇疯緭鍏ュ伐浠跺彿" v-decorator="['workPieceID', {rules: [{required: true, message: '璇疯緭鍏ュ伐浠跺彿锛�'}]}]" /> + </a-form-item> + <a-form-item label="OP80鎴愬搧鐮�" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback> + <a-input placeholder="璇疯緭鍏P80鎴愬搧鐮�" v-decorator="['oP80NewCode', {rules: [{required: true, message: '璇疯緭鍏P80鎴愬搧鐮侊紒'}]}]" /> + </a-form-item> + <a-form-item label="鍑哄簱鏃堕棿" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback> + <a-date-picker style="width: 100%" placeholder="璇烽�夋嫨鍑哄簱鏃堕棿" v-decorator="['workPieceOutboundTime',{rules: [{ required: true, message: '璇烽�夋嫨鍑哄簱鏃堕棿锛�' }]}]" @change="onChangeworkPieceOutboundTime"/> + </a-form-item> + <a-form-item label="鍑哄簱浜�" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback> + <a-date-picker style="width: 100%" placeholder="璇烽�夋嫨鍑哄簱浜�" v-decorator="['workPieceOutboundUser',{rules: [{ required: true, message: '璇烽�夋嫨鍑哄簱浜猴紒' }]}]" @change="onChangeworkPieceOutboundUser"/> + </a-form-item> + <a-form-item v-show="false"><a-input v-decorator="['id']" /></a-form-item> + </a-form> + </a-spin> + </a-modal> +</template> + +<script> + import moment from 'moment' + import { + WorkPieceOutboundEdit + } from '@/api/modular/main/WorkPieceOutboundManage' + export default { + data () { + return { + Id: 0, + labelCol: { + xs: { span: 24 }, + sm: { span: 5 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 15 } + }, + record: {}, + workPieceOutboundTimeDateString: '', + workPieceOutboundUserDateString: '', + visible: false, + confirmLoading: false, + form: this.$form.createForm(this) + } + }, + methods: { + moment, + // 鍒濆鍖栨柟娉� + edit (record) { + this.visible = true; + this.Id = record.id; + this.$nextTick(() => { + }); + //娣卞害鎷疯礉 绉婚櫎VUE鐨勭洃鍚紝闃叉INDEX椤甸潰鍊煎彉鍔� + this.record = JSON.parse(JSON.stringify(record)) + this.$nextTick(() => { + this.form.setFieldsValue( + { + id: record.id, + workPieceID: record.workPieceID, + oP80NewCode: record.oP80NewCode + } + ) + }) + this.form.getFieldDecorator('workPieceOutboundTime', { initialValue: moment(record.workPieceOutboundTime, 'YYYY-MM-DD') }) + this.workPieceOutboundTimeDateString = moment(record.workPieceOutboundTime).format('YYYY-MM-DD') + this.form.getFieldDecorator('workPieceOutboundUser', { initialValue: moment(record.workPieceOutboundUser, 'YYYY-MM-DD') }) + this.workPieceOutboundUserDateString = moment(record.workPieceOutboundUser).format('YYYY-MM-DD') + }, + handleSubmit () { + const { form: { validateFields } } = this + this.confirmLoading = true + validateFields((errors, values) => { + if (!errors) { + for (const key in values) { + if (values[key] == null) continue + if (typeof (values[key]) === 'object') { + values[key] = JSON.stringify(values[key]) + this.record[key] = values[key] + } else { + this.record[key] = values[key] + } + } + values.workPieceOutboundTime = this.workPieceOutboundTimeDateString + this.record.workPieceOutboundTime = this.workPieceOutboundTimeDateString + values.workPieceOutboundUser = this.workPieceOutboundUserDateString + this.record.workPieceOutboundUser = this.workPieceOutboundUserDateString + WorkPieceOutboundEdit(this.record).then((res) => { + if (res.success) { + this.$message.success('缂栬緫鎴愬姛') + this.confirmLoading = false + this.$emit('ok', this.record) + this.handleCancel() + } else { + this.$message.error('缂栬緫澶辫触锛�' + JSON.stringify(res.message)) + } + }).finally((res) => { + this.confirmLoading = false + }) + }else{ + this.confirmLoading = false + } + }); + }, + onChangeworkPieceOutboundTime(date, dateString) { + this.workPieceOutboundTimeDateString = dateString + }, + onChangeworkPieceOutboundUser(date, dateString) { + this.workPieceOutboundUserDateString = dateString + }, + handleCancel () { + this.form.resetFields() + this.visible = false + } + } + } +</script> diff --git a/yiqi_iwara-scada-web/src/views/main/WorkPieceOutboundRecord/index.vue b/yiqi_iwara-scada-web/src/views/main/WorkPieceOutboundRecord/index.vue new file mode 100644 index 0000000..8d1e504 --- /dev/null +++ b/yiqi_iwara-scada-web/src/views/main/WorkPieceOutboundRecord/index.vue @@ -0,0 +1,229 @@ +锘�<template> + <div> + <a-card :bordered="false" :bodyStyle="tstyle"> + <div class="table-page-search-wrapper" v-if="hasPerm('WorkPieceOutbound:page')"> + <a-form layout="inline" :label-col="labelCol" :wrapper-col="wrapperCol"> + <a-row :gutter="gutter"> + <a-col :md="colMd" :sm="colSm"> + <a-form-item label="宸ヤ欢鍙�"> + <a-input v-model="queryParam.workPieceID" allow-clear placeholder="璇疯緭鍏ュ伐浠跺彿" /> + </a-form-item> + </a-col> + <a-col :md="colMd" :sm="colSm"> + <a-form-item label="鎴愬搧鐮�"> + <a-input v-model="queryParam.oP80NewCode" allow-clear placeholder="璇疯緭鍏ユ垚鍝佺爜" /> + </a-form-item> + </a-col> + <a-col :md="colMd" :sm="colSm"> + <a-form-item label="鎿嶄綔浜�"> + <a-input v-model="queryParam.workPieceOutboundUserName" allow-clear placeholder="璇疯緭鍏ユ搷浣滀汉" /> + </a-form-item> + </a-col> + <a-col :md="colMd" :sm="colSm"> + <a-form-item label="鎿嶄綔鏃堕棿"> + <a-range-picker style="width:100%" :show-time="{format:'HH:mm'}" v-model="queryParam.dates" format="YYYY-MM-DD HH:mm" /> + </a-form-item> + </a-col> + <template v-if="advanced"> + + </template> + + <a-col :md="colMd" :sm="colSm"> + <span class="table-page-search-submitButtons"> + <a-button type="primary" @click="$refs.table.refresh(true)">鏌ヨ</a-button> + <a-button style="margin-left: 8px" @click="() => (queryParam = {})">閲嶇疆</a-button> + <!-- <a @click="toggleAdvanced" style="margin-left: 8px"> + {{ advanced ? '鏀惰捣' : '灞曞紑' }} + <a-icon :type="advanced ? 'up' : 'down'" /> + </a> --> + </span> + </a-col> + </a-row> + </a-form> + </div> + </a-card> + <a-card :bordered="false"> + <s-table + ref="table" + :columns="columns" + :data="loadData" + :alert="true" + :rowKey="(record) => record.id" + :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" + > + </s-table> + <add-form ref="addForm" @ok="handleOk" /> + <edit-form ref="editForm" @ok="handleOk" /> + </a-card> + </div> +</template> +<script> +import { STable } from '@/components' +import moment from 'moment' +import { WorkPieceOutboundRecordPage, WorkPieceOutboundRevoke } from '@/api/modular/main/WorkPieceOutboundManage' +import addForm from './addForm.vue' +import editForm from './editForm.vue' +export default { + components: { + STable, + addForm, + editForm + }, + data() { + return { + gutter: 36, + colMd: 6, + colSm: 18, + labelCol: { + xs: { span: 24 }, + sm: { span: 8 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 15 } + }, + advanced: false, // 楂樼骇鎼滅储 灞曞紑/鍏抽棴 + queryParam: {}, + columns: [ + { + title: '搴忓彿', + width: '50px', + dataIndex: 'index', + key: 'index', + align: 'center', + customRender: (text, record, index) => `${index + 1}` + }, + { + title: '鎴愬搧鐮�', + align: 'center', + sorter: true, + dataIndex: 'oP80NewCode' + }, + { + title: '鎿嶄綔绫诲瀷', + align: 'center', + sorter: true, + dataIndex: 'operationType' + }, + // { + // title: '灏忚溅鐮�', + // align: 'center', + // sorter: true, + // dataIndex: 'carNo' + // }, + { + title: '宸ヤ欢鍙�', + align: 'center', + sorter: true, + dataIndex: 'workPieceID' + }, + // { + // title: '涓嬬嚎鏃堕棿', + // align: 'center', + // sorter: true, + // dataIndex: 'workPieceUnLineTime' + // }, + // { + // title: '涓嬬嚎浜�', + // align: 'center', + // sorter: true, + // dataIndex: 'workPieceUnLineUserName' + // }, + { + title: '鎿嶄綔鏃堕棿', + align: 'center', + sorter: true, + dataIndex: 'createdTime' + }, + { + title: '鎿嶄綔浜�', + align: 'center', + sorter: true, + dataIndex: 'createdUserName' + } + ], + tstyle: { 'padding-bottom': '0px', 'margin-bottom': '10px' }, + // 鍔犺浇鏁版嵁鏂规硶 蹇呴』涓� Promise 瀵硅薄 + loadData: (parameter) => { + return WorkPieceOutboundRecordPage(Object.assign(parameter, this.switchingDate())).then((res) => { + return res.data + }) + }, + selectedRowKeys: [], + selectedRows: [] + } + }, + created() { + if (this.hasPerm('WorkPieceOutbound:edit') || this.hasPerm('WorkPieceOutbound:delete')) { + // this.columns.push({ + // title: '鎿嶄綔', + // width: '150px', + // dataIndex: 'action', + // scopedSlots: { customRender: 'action' } + // }) + } + }, + methods: { + moment, + /** + * 鏌ヨ鍙傛暟缁勮 + */ + switchingDate() { + const dates = this.queryParam.dates + if (dates != null) { + this.queryParam.startTimeBeginTime = moment(dates[0]).format('YYYY-MM-DD HH:mm') + this.queryParam.startTimeEndTime = moment(dates[1]).format('YYYY-MM-DD HH:mm') + if (dates.length < 1) { + delete this.queryParam.startTimeBeginTime + delete this.queryParam.startTimeEndTime + } + } + const obj = JSON.parse(JSON.stringify(this.queryParam)) + return obj + }, + WorkPieceOutboundDelete(record) { + WorkPieceOutboundRevoke(record).then((res) => { + if (res.success) { + this.$message.success('鎾ら攢鎴愬姛') + this.$refs.table.refresh() + } else { + this.$message.error('鎾ら攢澶辫触') // + res.message + } + }) + }, + allRevoke() { + this.$confirm({ + title: '鎾ら攢纭', + content: '纭畾鎾ら攢閫変腑宸ヤ欢鍏ュ簱淇℃伅锛�', + onOk: () => { + this.WorkPieceOutboundDelete(this.selectedRows) + }, + onCancel() { + console.log('Cancel') + } + }) + }, + toggleAdvanced() { + this.advanced = !this.advanced + }, + onChangeworkPieceOutboundTime(date, dateString) { + this.workPieceOutboundTimeDateString = dateString + }, + handleOk() { + this.$refs.table.refresh() + }, + onSelectChange(selectedRowKeys, selectedRows) { + this.selectedRowKeys = selectedRowKeys + this.selectedRows = selectedRows + } + } +} +</script> +<style lang="less"> +.table-operator { + margin-bottom: 18px; +} +button { + margin-right: 8px; +} +</style> -- Gitblit v1.9.3