Merge pull request 'test' (#2) from hh/Glass-ERP-Vue:test into test
Reviewed-on: http://82.157.76.162:3000/Big-Data-Lab/Glass-ERP-Vue/pulls/2
This commit is contained in:
commit
634d700862
|
@ -0,0 +1,299 @@
|
||||||
|
<template>
|
||||||
|
<a-card :bordered="false">
|
||||||
|
<!-- 查询区域 -->
|
||||||
|
<div class="table-page-search-wrapper">
|
||||||
|
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
||||||
|
<a-row :gutter="24">
|
||||||
|
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||||
|
<a-form-item label="审批状态">
|
||||||
|
<j-dict-select-tag placeholder="请选择审批状态" v-model="queryParam.demandStatus"
|
||||||
|
dictCode="procurement_approval_status" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||||
|
<a-form-item label="采购类别">
|
||||||
|
<j-dict-select-tag placeholder="请选择审批状态" v-model="queryParam.procurementCategory"
|
||||||
|
dictCode="purchasing_categories" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||||
|
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
||||||
|
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
|
||||||
|
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
|
||||||
|
</span>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-form>
|
||||||
|
</div>
|
||||||
|
<!-- 查询区域-END -->
|
||||||
|
|
||||||
|
<a-table ref="table" size="middle" :scroll="{ x: true }" bordered rowKey="id" :columns="columns"
|
||||||
|
:dataSource="dataSource" :pagination="ipagination" :loading="loading"
|
||||||
|
:rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" class="j-table-force-nowrap"
|
||||||
|
@change="handleTableChange">
|
||||||
|
|
||||||
|
<template slot="htmlSlot" slot-scope="text, record, index">
|
||||||
|
<a-button @click="handleButtonClick(record)">详情</a-button>
|
||||||
|
</template>
|
||||||
|
<template slot="imgSlot" slot-scope="text,record">
|
||||||
|
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
|
||||||
|
<img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt=""
|
||||||
|
style="max-width:80px;font-size: 12px;font-style: italic;" />
|
||||||
|
</template>
|
||||||
|
<template slot="fileSlot" slot-scope="text">
|
||||||
|
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
|
||||||
|
<a-button v-else :ghost="true" type="primary" icon="download" size="small" @click="downloadFile(text)">
|
||||||
|
下载
|
||||||
|
</a-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<span slot="action" slot-scope="text, record" v-if="record.isReceiving == 0">
|
||||||
|
<a-button v-if="record.demandStatus == 3" type="primary" @click="pass(record)">通过</a-button>
|
||||||
|
<a-button v-else-if="record.demandStatus == 2" type="primary" @click="openNoPassModal(record)">不通过</a-button>
|
||||||
|
<div v-else>
|
||||||
|
<a-button type="primary" @click="pass(record)">通过</a-button>
|
||||||
|
<a-divider type="vertical" />
|
||||||
|
<a-button type="primary" @click="openNoPassModal(record)">不通过</a-button>
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
|
<span v-else>
|
||||||
|
<a>已被接单,不可修改</a>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</a-table>
|
||||||
|
<a-modal title="采购内容详情" :visible="see" @ok="handleOk" @cancel="handleOk">
|
||||||
|
<a-table :columns="contentColumns" :dataSource="content" rowKey="name"></a-table>
|
||||||
|
</a-modal>
|
||||||
|
|
||||||
|
<a-modal title="不通过原因" :visible="noPassSee" @ok="noPassOk" @cancel="noPassCancel">
|
||||||
|
<a-textarea v-model="tempRecord.auditResults" placeholder="请输入不通过原因" />
|
||||||
|
</a-modal>
|
||||||
|
|
||||||
|
<purchase-request-modal ref="modalForm" @ok="modalFormOk"></purchase-request-modal>
|
||||||
|
</a-card>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import '@/assets/less/TableExpand.less'
|
||||||
|
import { mixinDevice } from '@/utils/mixin'
|
||||||
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
||||||
|
import PurchaseRequestModal from './modules/PurchaseRequestModal.vue'
|
||||||
|
import { filterMultiDictText } from '@/components/dict/JDictSelectUtil'
|
||||||
|
import { postAction } from '@/api/manage'
|
||||||
|
import { USER_INFO } from "@/store/mutation-types"
|
||||||
|
import Vue from 'vue'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'PurchaseRequestList',
|
||||||
|
mixins: [JeecgListMixin, mixinDevice],
|
||||||
|
components: {
|
||||||
|
PurchaseRequestModal
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
description: '采购表管理页面',
|
||||||
|
// 表头
|
||||||
|
see: false,
|
||||||
|
noPassSee: false,
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
title: '审批状态',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'demandStatus_dictText'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '审核结果',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'auditResults'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '申请人',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'createBy_dictText'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '申请日期',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'createTime'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '需求编号',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'requirementNumber',
|
||||||
|
customRender: (text, record, index) => {
|
||||||
|
//如果为空则不加前缀
|
||||||
|
if (text == null || text == '') {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
return 'HL-' + text
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '申请部门',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'sysOrgCode'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '采购类别',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'procurementCategory_dictText'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '采购方向',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'procurementDirection'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '采购内容',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'procurementContent',
|
||||||
|
scopedSlots: { customRender: 'htmlSlot' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '采购预算',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'procurementBudget'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '附件',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'annex',
|
||||||
|
scopedSlots: { customRender: 'fileSlot' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
dataIndex: 'action',
|
||||||
|
align: "center",
|
||||||
|
fixed: "right",
|
||||||
|
width: 147,
|
||||||
|
scopedSlots: { customRender: 'action' }
|
||||||
|
}
|
||||||
|
],
|
||||||
|
url: {
|
||||||
|
list: "/Try/purchaseRequest/list",
|
||||||
|
edit: "/Try/purchaseRequest/edit",
|
||||||
|
delete: "/Try/purchaseRequest/delete",
|
||||||
|
deleteBatch: "/Try/purchaseRequest/deleteBatch",
|
||||||
|
exportXlsUrl: "/Try/purchaseRequest/exportXls",
|
||||||
|
importExcelUrl: "Try/purchaseRequest/importExcel",
|
||||||
|
},
|
||||||
|
dictOptions: {},
|
||||||
|
superFieldList: [],
|
||||||
|
content: [
|
||||||
|
{
|
||||||
|
name: '',
|
||||||
|
number: '',
|
||||||
|
unit: '',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
contentColumns: [
|
||||||
|
{
|
||||||
|
title: '名称',
|
||||||
|
dataIndex: 'name',
|
||||||
|
key: 'name',
|
||||||
|
width: 200
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '数量',
|
||||||
|
dataIndex: 'number',
|
||||||
|
key: 'number',
|
||||||
|
width: 80
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '单位',
|
||||||
|
dataIndex: 'unit',
|
||||||
|
key: 'unit',
|
||||||
|
width: 80
|
||||||
|
}
|
||||||
|
],
|
||||||
|
//暂存表单
|
||||||
|
tempRecord: {},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getSuperFieldList();
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
importExcelUrl: function () {
|
||||||
|
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
initDictConfig() {
|
||||||
|
},
|
||||||
|
openNoPassModal(record) {
|
||||||
|
this.noPassSee = true
|
||||||
|
this.tempRecord = Object.assign({}, record);
|
||||||
|
this.tempRecord.auditResults = '';
|
||||||
|
},
|
||||||
|
noPassOk() {
|
||||||
|
this.noPassSee = false
|
||||||
|
//保存的逻辑
|
||||||
|
let record = Object.assign({}, this.tempRecord);
|
||||||
|
record.demandStatus = 3;
|
||||||
|
record.approvedBy = Vue.ls.get(USER_INFO).username;
|
||||||
|
record.auditResults = this.tempRecord.auditResults;
|
||||||
|
postAction(this.url.edit, record).then(res => {
|
||||||
|
if (res.success) {
|
||||||
|
this.$message.success('重新审批成功');
|
||||||
|
this.loadData();
|
||||||
|
} else {
|
||||||
|
this.$message.error(res.message);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
noPassCancel() {
|
||||||
|
this.noPassSee = false
|
||||||
|
},
|
||||||
|
handleOk() {
|
||||||
|
this.see = false
|
||||||
|
},
|
||||||
|
handleButtonClick(record) {
|
||||||
|
this.see = true
|
||||||
|
if (record.procurementContent == null || record.procurementContent == '') {
|
||||||
|
this.content = {
|
||||||
|
name: '',
|
||||||
|
number: '',
|
||||||
|
unit: '',
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.content = JSON.parse(record.procurementContent)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getSuperFieldList() {
|
||||||
|
let fieldList = [];
|
||||||
|
fieldList.push({ type: 'sel_user', value: 'createBy', text: '申请人' })
|
||||||
|
fieldList.push({ type: 'datetime', value: 'createTime', text: '申请日期' })
|
||||||
|
fieldList.push({ type: 'string', value: 'requirementNumber', text: '需求编号', dictCode: '' })
|
||||||
|
fieldList.push({ type: 'string', value: 'sysOrgCode', text: '申请部门', dictCode: '' })
|
||||||
|
fieldList.push({ type: 'int', value: 'demandStatus', text: '需求状态', dictCode: 'procurement_approval_status' })
|
||||||
|
fieldList.push({ type: 'sel_user', value: 'updateBy', text: '审批人' })
|
||||||
|
fieldList.push({ type: 'datetime', value: 'updateTime', text: '更新日期' })
|
||||||
|
fieldList.push({ type: 'int', value: 'procurementCategory', text: '采购类别', dictCode: 'purchasing_categories' })
|
||||||
|
fieldList.push({ type: 'string', value: 'procurementDirection', text: '采购方向', dictCode: '' })
|
||||||
|
fieldList.push({ type: 'Text', value: 'procurementContent', text: '采购内容', dictCode: '' })
|
||||||
|
fieldList.push({ type: 'string', value: 'procurementBudget', text: '采购预算', dictCode: '' })
|
||||||
|
fieldList.push({ type: 'string', value: 'annex', text: '附件', dictCode: '' })
|
||||||
|
fieldList.push({ type: 'Text', value: 'auditResults', text: '审核结果', dictCode: '' })
|
||||||
|
this.superFieldList = fieldList
|
||||||
|
},
|
||||||
|
pass(record) {
|
||||||
|
record.demandStatus = 2;
|
||||||
|
record.approvedBy = Vue.ls.get(USER_INFO).username;
|
||||||
|
record.auditResults = '通过';
|
||||||
|
postAction(this.url.edit, record).then(res => {
|
||||||
|
if (res.success) {
|
||||||
|
this.$message.success('重新提交成功');
|
||||||
|
this.loadData();
|
||||||
|
} else {
|
||||||
|
this.$message.error(res.message);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
@import '~@assets/less/common.less';
|
||||||
|
</style>
|
|
@ -0,0 +1,103 @@
|
||||||
|
<template>
|
||||||
|
<a-spin :spinning="confirmLoading">
|
||||||
|
<j-form-container :disabled="formDisabled">
|
||||||
|
<a-form-model ref="form" :model="model" slot="detail">
|
||||||
|
<a-row>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-model-item label="审核结果" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="auditResults">
|
||||||
|
<a-textarea v-model="model.auditResults" placeholder="请输入审核结果"></a-textarea>
|
||||||
|
</a-form-model-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-form-model>
|
||||||
|
</j-form-container>
|
||||||
|
</a-spin>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import { httpAction, getAction } from '@/api/manage'
|
||||||
|
import { validateDuplicateValue } from '@/utils/util'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'PurchaseRequestForm',
|
||||||
|
components: {
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
//表单禁用
|
||||||
|
disabled: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
required: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
model: {
|
||||||
|
},
|
||||||
|
labelCol: {
|
||||||
|
xs: { span: 24 },
|
||||||
|
sm: { span: 5 },
|
||||||
|
},
|
||||||
|
wrapperCol: {
|
||||||
|
xs: { span: 24 },
|
||||||
|
sm: { span: 16 },
|
||||||
|
},
|
||||||
|
confirmLoading: false,
|
||||||
|
url: {
|
||||||
|
add: "/Try/purchaseRequest/add",
|
||||||
|
edit: "/Try/purchaseRequest/edit",
|
||||||
|
queryById: "/Try/purchaseRequest/queryById"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
formDisabled() {
|
||||||
|
return this.disabled
|
||||||
|
},
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
//备份model原始值
|
||||||
|
this.modelDefault = JSON.parse(JSON.stringify(this.model));
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
add() {
|
||||||
|
this.edit(this.modelDefault);
|
||||||
|
},
|
||||||
|
edit(record, id) {
|
||||||
|
this.model = Object.assign({}, record);
|
||||||
|
this.visible = true;
|
||||||
|
console.log(id)
|
||||||
|
},
|
||||||
|
submitForm() {
|
||||||
|
const that = this;
|
||||||
|
// 触发表单验证
|
||||||
|
this.$refs.form.validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
that.confirmLoading = true;
|
||||||
|
let httpurl = '';
|
||||||
|
let method = '';
|
||||||
|
if (!this.model.id) {
|
||||||
|
httpurl += this.url.add;
|
||||||
|
method = 'post';
|
||||||
|
} else {
|
||||||
|
httpurl += this.url.edit;
|
||||||
|
method = 'put';
|
||||||
|
}
|
||||||
|
httpAction(httpurl, this.model, method).then((res) => {
|
||||||
|
if (res.success) {
|
||||||
|
that.$message.success(res.message);
|
||||||
|
that.$emit('ok');
|
||||||
|
} else {
|
||||||
|
that.$message.warning(res.message);
|
||||||
|
}
|
||||||
|
}).finally(() => {
|
||||||
|
that.confirmLoading = false;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -0,0 +1,84 @@
|
||||||
|
<template>
|
||||||
|
<a-drawer
|
||||||
|
:title="title"
|
||||||
|
:width="width"
|
||||||
|
placement="right"
|
||||||
|
:closable="false"
|
||||||
|
@close="close"
|
||||||
|
destroyOnClose
|
||||||
|
:visible="visible">
|
||||||
|
<purchase-request-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></purchase-request-form>
|
||||||
|
<div class="drawer-footer">
|
||||||
|
<a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button>
|
||||||
|
<a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button>
|
||||||
|
</div>
|
||||||
|
</a-drawer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import PurchaseRequestForm from './PurchaseRequestForm.vue'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'PurchaseRequestModal',
|
||||||
|
components: {
|
||||||
|
PurchaseRequestForm
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
title:"操作",
|
||||||
|
width:800,
|
||||||
|
visible: false,
|
||||||
|
disableSubmit: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
add () {
|
||||||
|
this.visible=true
|
||||||
|
this.$nextTick(()=>{
|
||||||
|
this.$refs.realForm.add();
|
||||||
|
})
|
||||||
|
},
|
||||||
|
edit (record) {
|
||||||
|
this.visible=true
|
||||||
|
this.$nextTick(()=>{
|
||||||
|
this.$refs.realForm.edit(record);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
close () {
|
||||||
|
this.$emit('close');
|
||||||
|
this.visible = false;
|
||||||
|
},
|
||||||
|
submitCallback(){
|
||||||
|
this.$emit('ok');
|
||||||
|
this.visible = false;
|
||||||
|
},
|
||||||
|
handleOk () {
|
||||||
|
this.$refs.realForm.submitForm();
|
||||||
|
},
|
||||||
|
handleCancel () {
|
||||||
|
this.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
/** Button按钮间距 */
|
||||||
|
.ant-btn {
|
||||||
|
margin-left: 30px;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
.drawer-footer{
|
||||||
|
position: absolute;
|
||||||
|
bottom: -8px;
|
||||||
|
width: 100%;
|
||||||
|
border-top: 1px solid #e8e8e8;
|
||||||
|
padding: 10px 16px;
|
||||||
|
text-align: right;
|
||||||
|
left: 0;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 0 0 2px 2px;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,60 @@
|
||||||
|
<template>
|
||||||
|
<j-modal
|
||||||
|
:title="title"
|
||||||
|
:width="width"
|
||||||
|
:visible="visible"
|
||||||
|
switchFullscreen
|
||||||
|
@ok="handleOk"
|
||||||
|
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
|
||||||
|
@cancel="handleCancel"
|
||||||
|
cancelText="关闭">
|
||||||
|
<purchase-request-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></purchase-request-form>
|
||||||
|
</j-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import PurchaseRequestForm from './PurchaseRequestForm.vue'
|
||||||
|
export default {
|
||||||
|
name: 'PurchaseRequestModal',
|
||||||
|
components: {
|
||||||
|
PurchaseRequestForm
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
title:'',
|
||||||
|
width:800,
|
||||||
|
visible: false,
|
||||||
|
disableSubmit: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
add () {
|
||||||
|
this.visible=true
|
||||||
|
this.$nextTick(()=>{
|
||||||
|
this.$refs.realForm.add();
|
||||||
|
})
|
||||||
|
},
|
||||||
|
edit (record) {
|
||||||
|
this.visible=true
|
||||||
|
this.$nextTick(()=>{
|
||||||
|
this.$refs.realForm.edit(record);
|
||||||
|
})
|
||||||
|
},
|
||||||
|
close () {
|
||||||
|
this.$emit('close');
|
||||||
|
this.visible = false;
|
||||||
|
},
|
||||||
|
handleOk () {
|
||||||
|
this.$refs.realForm.submitForm();
|
||||||
|
},
|
||||||
|
submitCallback(){
|
||||||
|
this.$emit('ok');
|
||||||
|
this.visible = false;
|
||||||
|
},
|
||||||
|
handleCancel () {
|
||||||
|
this.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -0,0 +1,118 @@
|
||||||
|
<template>
|
||||||
|
<a-card title="订单接收" :bordered="false">
|
||||||
|
<a-collapse v-model:activeKey="activeKey" accordion>
|
||||||
|
<a-collapse-panel v-for="(item, index) in dataList" :key="index.toString()">
|
||||||
|
<template slot="header">
|
||||||
|
<div style="font-size: 18px; font-weight: bold;">
|
||||||
|
采购订单号:HL-{{ item.requirementNumber }} 部门:{{ item.sysOrgCode }}
|
||||||
|
采购方向:{{ item.procurementDirection }}
|
||||||
|
<a-button style="float: right;" @click="receiveData(item)">接收</a-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<div>
|
||||||
|
<a-descriptions title="订单详情" bordered>
|
||||||
|
<a-descriptions-item label="申请人">{{ item.createBy_dictText }}</a-descriptions-item>
|
||||||
|
<a-descriptions-item label="申请时间">{{ item.createTime }}</a-descriptions-item>
|
||||||
|
<a-descriptions-item label="申请部门">{{ item.sysOrgCode }}</a-descriptions-item>
|
||||||
|
<a-descriptions-item label="采购类型">{{ item.procurementCategory_dictText }}</a-descriptions-item>
|
||||||
|
<a-descriptions-item label="采购预算" :span="3">{{ item.procurementBudget }}</a-descriptions-item>
|
||||||
|
<a-descriptions-item label="审批人" :span="3">{{ item.approvedBy_dictText }}</a-descriptions-item>
|
||||||
|
<a-descriptions-item label="采购详情">
|
||||||
|
<div v-for="(item2, index2) in item.procurementContent" :key="index2.toString()">
|
||||||
|
<a-row>
|
||||||
|
<a-col :span="2">{{ item2.name }}</a-col>
|
||||||
|
<a-col :span="2">{{ item2.number }}{{ item2.unit }}</a-col>
|
||||||
|
</a-row>
|
||||||
|
</div>
|
||||||
|
</a-descriptions-item>
|
||||||
|
</a-descriptions>
|
||||||
|
</div>
|
||||||
|
</a-collapse-panel>
|
||||||
|
</a-collapse>
|
||||||
|
|
||||||
|
<a-modal title="填写接收备注" :visible="receive" @ok="receiveOk" @cancel="receiveCancel">
|
||||||
|
<a-textarea v-model="auditResults" placeholder="请输入接收备注" />
|
||||||
|
</a-modal>
|
||||||
|
|
||||||
|
</a-card>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getAction, postAction } from '@/api/manage'
|
||||||
|
import { USER_INFO } from "@/store/mutation-types"
|
||||||
|
import Vue from 'vue'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'PurchaseOrderConfirmationList',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
description: '采购订单确认管理页面',
|
||||||
|
dataList: [],
|
||||||
|
activeKey: [],
|
||||||
|
url: {
|
||||||
|
list: "/Try/purchaseRequest/waitForReceiveList",
|
||||||
|
acceptReceiving: "Try/purchaseOrderConfirmation/acceptReceiving",
|
||||||
|
},
|
||||||
|
receive: false,
|
||||||
|
tempNO: '',
|
||||||
|
auditResults: '',
|
||||||
|
username: Vue.ls.get(USER_INFO).username,
|
||||||
|
sysOrgCode: Vue.ls.get(USER_INFO).orgCode,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
list: function () {
|
||||||
|
return `${window._CONFIG['domianURL']}/${this.url.list}`;
|
||||||
|
},
|
||||||
|
acceptReceiving: function () {
|
||||||
|
return `${window._CONFIG['domianURL']}/${this.url.acceptReceiving}`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getdata();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
receiveData(item) {
|
||||||
|
this.tempNO = item.requirementNumber;
|
||||||
|
this.receive = true;
|
||||||
|
},
|
||||||
|
receiveOk() {
|
||||||
|
let data = {
|
||||||
|
associationNumber: this.tempNO,
|
||||||
|
receiver: this.username,
|
||||||
|
notes: this.auditResults,
|
||||||
|
receivingTime: new Date(),
|
||||||
|
}
|
||||||
|
postAction(this.acceptReceiving, data).then(res => {
|
||||||
|
//如果为200,则获取数据
|
||||||
|
if (res.code == 200) {
|
||||||
|
this.$message.success('接收成功');
|
||||||
|
this.getdata();
|
||||||
|
} else {
|
||||||
|
this.$message.error(res.message);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.receive = false;
|
||||||
|
},
|
||||||
|
receiveCancel() {
|
||||||
|
this.receive = false;
|
||||||
|
},
|
||||||
|
getdata() {
|
||||||
|
getAction(this.list, {}).then(res => {
|
||||||
|
//如果为200,则获取数据
|
||||||
|
if (res.code == 200) {
|
||||||
|
this.dataList = res.result.records;
|
||||||
|
this.activeKey = [0];
|
||||||
|
//将其procurementContent转为json
|
||||||
|
this.dataList.forEach(item => {
|
||||||
|
item.procurementContent = JSON.parse(item.procurementContent);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.$message.error(res.message);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -0,0 +1,290 @@
|
||||||
|
<template>
|
||||||
|
<a-card :bordered="false">
|
||||||
|
<!-- 查询区域 -->
|
||||||
|
<div class="table-page-search-wrapper">
|
||||||
|
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
||||||
|
<a-row :gutter="24">
|
||||||
|
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||||
|
<a-form-item label="审批状态">
|
||||||
|
<j-dict-select-tag placeholder="请选择审批状态" v-model="queryParam.demandStatus"
|
||||||
|
dictCode="procurement_approval_status" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||||
|
<a-form-item label="采购类别">
|
||||||
|
<j-dict-select-tag placeholder="请选择审批状态" v-model="queryParam.procurementCategory"
|
||||||
|
dictCode="purchasing_categories" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||||
|
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
||||||
|
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
|
||||||
|
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
|
||||||
|
</span>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-form>
|
||||||
|
</div>
|
||||||
|
<!-- 查询区域-END -->
|
||||||
|
|
||||||
|
<!-- 操作按钮区域 -->
|
||||||
|
<div class="table-operator">
|
||||||
|
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
|
||||||
|
|
||||||
|
<!-- 高级查询区域 -->
|
||||||
|
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||||
|
<a-menu slot="overlay">
|
||||||
|
<a-menu-item key="1" @click="batchDel"><a-icon type="delete" />删除</a-menu-item>
|
||||||
|
</a-menu>
|
||||||
|
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
|
||||||
|
</a-dropdown>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- table区域-begin -->
|
||||||
|
<div>
|
||||||
|
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
|
||||||
|
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">
|
||||||
|
{{ selectedRowKeys.length }}</a>项
|
||||||
|
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
|
||||||
|
</div>
|
||||||
|
<a-table ref="table" size="middle" :scroll="{ x: true }" bordered rowKey="id" :columns="columns"
|
||||||
|
:dataSource="dataSource" :pagination="ipagination" :loading="loading"
|
||||||
|
:rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" class="j-table-force-nowrap"
|
||||||
|
@change="handleTableChange">
|
||||||
|
|
||||||
|
<template slot="htmlSlot" slot-scope="text, record, index">
|
||||||
|
<a-button @click="handleButtonClick(record)">详情</a-button>
|
||||||
|
</template>
|
||||||
|
<template slot="imgSlot" slot-scope="text,record">
|
||||||
|
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
|
||||||
|
<img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt=""
|
||||||
|
style="max-width:80px;font-size: 12px;font-style: italic;" />
|
||||||
|
</template>
|
||||||
|
<template slot="fileSlot" slot-scope="text">
|
||||||
|
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
|
||||||
|
<a-button v-else :ghost="true" type="primary" icon="download" size="small" @click="downloadFile(text)">
|
||||||
|
下载
|
||||||
|
</a-button>
|
||||||
|
</template>
|
||||||
|
<span slot="action" slot-scope="text, record" v-if="record.demandStatus == 3">
|
||||||
|
<a @click="handleEdit(record)">编辑</a>
|
||||||
|
<a-divider type="vertical" />
|
||||||
|
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
|
||||||
|
<a>删除</a>
|
||||||
|
</a-popconfirm>
|
||||||
|
<a-divider type="vertical" v-if="record.demandStatus == 3" />
|
||||||
|
<a-button type="primary" v-if="record.demandStatus == 3" @click="reSubmit(record)">重新提交</a-button>
|
||||||
|
</span>
|
||||||
|
<span v-else-if="record.demandStatus == 2">
|
||||||
|
<a>已通过申请不可修改</a>
|
||||||
|
</span>
|
||||||
|
<span v-else-if="record.demandStatus == 1">
|
||||||
|
<a>审核中不可修改</a>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</a-table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<a-modal title="采购内容详情" :visible="see" @ok="handleOk" @cancel="handleOk">
|
||||||
|
<a-table :columns="contentColumns" :dataSource="content" rowKey="name"></a-table>
|
||||||
|
</a-modal>
|
||||||
|
|
||||||
|
<purchase-request-modal ref="modalForm" @ok="modalFormOk"></purchase-request-modal>
|
||||||
|
</a-card>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import '@/assets/less/TableExpand.less'
|
||||||
|
import { mixinDevice } from '@/utils/mixin'
|
||||||
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
||||||
|
import PurchaseRequestModal from './modules/PurchaseRequestModal.vue'
|
||||||
|
import { postAction } from '@/api/manage'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'PurchaseRequestList',
|
||||||
|
mixins: [JeecgListMixin, mixinDevice],
|
||||||
|
components: {
|
||||||
|
PurchaseRequestModal
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
description: '采购表管理页面',
|
||||||
|
// 表头
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
title: '审批状态',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'demandStatus_dictText'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '审批人',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'approvedBy_dictText'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '审核结果',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'auditResults'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '需求编号',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'requirementNumber',
|
||||||
|
customRender: (text, record, index) => {
|
||||||
|
//如果为空则不加前缀
|
||||||
|
if (text == null || text == '') {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
return 'HL-' + text
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '申请日期',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'createTime'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '采购类别',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'procurementCategory_dictText',
|
||||||
|
customRender: (text, record, index) => {
|
||||||
|
//如果为空则不加前缀
|
||||||
|
if (text == null || text == '') {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
return 'HL-' + text
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '采购方向',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'procurementDirection',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '采购内容',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'procurementContent',
|
||||||
|
scopedSlots: { customRender: 'htmlSlot' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '采购预算',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'procurementBudget'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '附件',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'annex',
|
||||||
|
scopedSlots: { customRender: 'fileSlot' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
dataIndex: 'action',
|
||||||
|
align: "center",
|
||||||
|
fixed: "right",
|
||||||
|
width: 147,
|
||||||
|
scopedSlots: { customRender: 'action' }
|
||||||
|
}
|
||||||
|
],
|
||||||
|
see: false,
|
||||||
|
url: {
|
||||||
|
list: "/Try/purchaseRequest/selfList",
|
||||||
|
delete: "/Try/purchaseRequest/delete",
|
||||||
|
deleteBatch: "/Try/purchaseRequest/deleteBatch",
|
||||||
|
exportXlsUrl: "/Try/purchaseRequest/exportXls",
|
||||||
|
importExcelUrl: "Try/purchaseRequest/importExcel",
|
||||||
|
reSubmit: "/Try/purchaseRequest/reSubmit",
|
||||||
|
},
|
||||||
|
content: [
|
||||||
|
{
|
||||||
|
name: '',
|
||||||
|
number: '',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
contentColumns: [
|
||||||
|
{
|
||||||
|
title: '名称',
|
||||||
|
dataIndex: 'name',
|
||||||
|
key: 'name',
|
||||||
|
width: 200
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '数量',
|
||||||
|
dataIndex: 'number',
|
||||||
|
key: 'number',
|
||||||
|
width: 80
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '单位',
|
||||||
|
dataIndex: 'unit',
|
||||||
|
key: 'unit',
|
||||||
|
width: 80
|
||||||
|
}
|
||||||
|
],
|
||||||
|
dictOptions: {},
|
||||||
|
superFieldList: [],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getSuperFieldList();
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
importExcelUrl: function () {
|
||||||
|
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
|
||||||
|
},
|
||||||
|
importExcelUrl: function () {
|
||||||
|
return `${window._CONFIG['domianURL']}/${this.url.reSubmit}`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
initDictConfig() {
|
||||||
|
},
|
||||||
|
handleOk() {
|
||||||
|
this.see = false
|
||||||
|
},
|
||||||
|
handleButtonClick(record) {
|
||||||
|
this.see = true
|
||||||
|
if (record.procurementContent == null || record.procurementContent == '') {
|
||||||
|
this.content = {
|
||||||
|
name: '',
|
||||||
|
number: '',
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.content = JSON.parse(record.procurementContent)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getSuperFieldList() {
|
||||||
|
let fieldList = [];
|
||||||
|
fieldList.push({ type: 'sel_user', value: 'createBy', text: '申请人' })
|
||||||
|
fieldList.push({ type: 'datetime', value: 'createTime', text: '申请日期' })
|
||||||
|
fieldList.push({ type: 'string', value: 'requirementNumber', text: '需求编号', dictCode: '' })
|
||||||
|
fieldList.push({ type: 'string', value: 'sysOrgCode', text: '申请部门', dictCode: '' })
|
||||||
|
fieldList.push({ type: 'int', value: 'demandStatus', text: '审批状态', dictCode: 'procurement_approval_status' })
|
||||||
|
fieldList.push({ type: 'sel_user', value: 'updateBy', text: '审批人' })
|
||||||
|
fieldList.push({ type: 'datetime', value: 'updateTime', text: '更新日期' })
|
||||||
|
fieldList.push({ type: 'int', value: 'procurementCategory', text: '采购类别', dictCode: 'purchasing_categories' })
|
||||||
|
fieldList.push({ type: 'string', value: 'procurementDirection', text: '采购方向', dictCode: '' })
|
||||||
|
fieldList.push({ type: 'Text', value: 'procurementContent', text: '采购内容', dictCode: '' })
|
||||||
|
fieldList.push({ type: 'string', value: 'procurementBudget', text: '采购预算', dictCode: '' })
|
||||||
|
fieldList.push({ type: 'string', value: 'annex', text: '附件', dictCode: '' })
|
||||||
|
fieldList.push({ type: 'Text', value: 'auditResults', text: '审核结果', dictCode: '' })
|
||||||
|
this.superFieldList = fieldList
|
||||||
|
},
|
||||||
|
reSubmit(record) {
|
||||||
|
postAction(this.url.reSubmit, record).then(res => {
|
||||||
|
if (res.success) {
|
||||||
|
this.$message.success('重新提交成功');
|
||||||
|
this.loadData();
|
||||||
|
} else {
|
||||||
|
this.$message.error(res.message);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
@import '~@assets/less/common.less';
|
||||||
|
</style>
|
|
@ -0,0 +1,202 @@
|
||||||
|
<template>
|
||||||
|
<a-spin :spinning="confirmLoading">
|
||||||
|
<j-form-container :disabled="formDisabled">
|
||||||
|
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
|
||||||
|
<a-row>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-model-item label="采购类别" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="procurementCategory">
|
||||||
|
<j-dict-select-tag type="list" v-model="model.procurementCategory" dictCode="purchasing_categories"
|
||||||
|
placeholder="请选择采购类别" />
|
||||||
|
</a-form-model-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-model-item label="采购方向" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="procurementDirection">
|
||||||
|
<a-input v-model="model.procurementDirection" placeholder="请输入采购方向"></a-input>
|
||||||
|
</a-form-model-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-model-item label="采购内容" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||||
|
<!-- 循环渲染 content 数组中的每个对象 -->
|
||||||
|
<div v-for="(item, index) in content" :key="index">
|
||||||
|
<a-row :gutter="16">
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-input v-model="item.name" placeholder="物品名称" />
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="6">
|
||||||
|
<a-input v-model="item.number" placeholder="数量" />
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="6">
|
||||||
|
<a-input v-model="item.unit" placeholder="单位" />
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="2">
|
||||||
|
<!-- 通过点击按钮触发新增行 -->
|
||||||
|
<a-icon type="plus-circle" @click="addRow(index)" />
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="2">
|
||||||
|
<!-- 通过点击按钮触发删除行 -->
|
||||||
|
<a-icon type="minus-circle" @click="removeRow(index)" />
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</div>
|
||||||
|
</a-form-model-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-model-item label="采购预算" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="procurementBudget">
|
||||||
|
<a-input v-model="model.procurementBudget" placeholder="请输入采购预算"></a-input>
|
||||||
|
</a-form-model-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-model-item label="附件" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="annex">
|
||||||
|
<j-upload v-model="model.annex"></j-upload>
|
||||||
|
</a-form-model-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24" style="display:none">
|
||||||
|
<a-form-model-item label="申请人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="annex">
|
||||||
|
<j-upload v-model="model.createBy"></j-upload>
|
||||||
|
</a-form-model-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24" style="display:none">
|
||||||
|
<a-form-model-item label="申请部门" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="annex">
|
||||||
|
<j-upload v-model="model.sysOrgCode"></j-upload>
|
||||||
|
</a-form-model-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-form-model>
|
||||||
|
</j-form-container>
|
||||||
|
</a-spin>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import { httpAction, getAction } from '@/api/manage'
|
||||||
|
import { USER_INFO } from "@/store/mutation-types"
|
||||||
|
import Vue from 'vue'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'PurchaseRequestForm',
|
||||||
|
components: {
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
//表单禁用
|
||||||
|
disabled: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
required: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
model: {
|
||||||
|
createBy: Vue.ls.get(USER_INFO).username,
|
||||||
|
sysOrgCode: Vue.ls.get(USER_INFO).orgCode,
|
||||||
|
},
|
||||||
|
labelCol: {
|
||||||
|
xs: { span: 24 },
|
||||||
|
sm: { span: 5 },
|
||||||
|
},
|
||||||
|
wrapperCol: {
|
||||||
|
xs: { span: 24 },
|
||||||
|
sm: { span: 16 },
|
||||||
|
},
|
||||||
|
confirmLoading: false,
|
||||||
|
validatorRules: {
|
||||||
|
procurementCategory: [
|
||||||
|
{ required: true, message: '请输入采购类别!' },
|
||||||
|
],
|
||||||
|
procurementDirection: [
|
||||||
|
{ required: true, message: '请输入采购方向!' },
|
||||||
|
],
|
||||||
|
procurementContent: [
|
||||||
|
{ required: true, message: '请输入采购内容!' },
|
||||||
|
],
|
||||||
|
procurementBudget: [
|
||||||
|
{ required: true, message: '请输入采购预算!' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
url: {
|
||||||
|
add: "/Try/purchaseRequest/add",
|
||||||
|
edit: "/Try/purchaseRequest/edit",
|
||||||
|
queryById: "/Try/purchaseRequest/queryById",
|
||||||
|
},
|
||||||
|
content: [
|
||||||
|
{
|
||||||
|
name: '',
|
||||||
|
number: '',
|
||||||
|
unit: '',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
formDisabled() {
|
||||||
|
return this.disabled
|
||||||
|
},
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
//备份model原始值
|
||||||
|
this.modelDefault = JSON.parse(JSON.stringify(this.model));
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
add() {
|
||||||
|
this.edit(this.modelDefault);
|
||||||
|
},
|
||||||
|
addRow(index) {
|
||||||
|
this.content.splice(index + 1, 0, {
|
||||||
|
name: '',
|
||||||
|
number: '',
|
||||||
|
unit: '',
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 移除指定索引位置的行
|
||||||
|
removeRow(index) {
|
||||||
|
//如果只有一行了,则不允许删除
|
||||||
|
if (this.content.length === 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.content.splice(index, 1);
|
||||||
|
},
|
||||||
|
edit(record) {
|
||||||
|
this.model = Object.assign({}, record);
|
||||||
|
//判断procurementContent是否为空,如果为空则新建
|
||||||
|
console.log(this.model.procurementContent)
|
||||||
|
if (this.model.procurementContent != undefined && this.model.procurementContent != null) {
|
||||||
|
this.content = JSON.parse(this.model.procurementContent);
|
||||||
|
}
|
||||||
|
console.log(this.content)
|
||||||
|
this.visible = true;
|
||||||
|
},
|
||||||
|
submitForm() {
|
||||||
|
//将content数组封装为JSON字符串赋予model.procurementContent
|
||||||
|
this.model.procurementContent = JSON.stringify(this.content);
|
||||||
|
//修改采购内容
|
||||||
|
const that = this;
|
||||||
|
// 触发表单验证
|
||||||
|
this.$refs.form.validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
that.confirmLoading = true;
|
||||||
|
let httpurl = '';
|
||||||
|
let method = '';
|
||||||
|
if (!this.model.id) {
|
||||||
|
httpurl += this.url.add;
|
||||||
|
method = 'post';
|
||||||
|
} else {
|
||||||
|
httpurl += this.url.edit;
|
||||||
|
method = 'put';
|
||||||
|
}
|
||||||
|
httpAction(httpurl, this.model, method).then((res) => {
|
||||||
|
if (res.success) {
|
||||||
|
that.$message.success(res.message);
|
||||||
|
that.$emit('ok');
|
||||||
|
} else {
|
||||||
|
that.$message.warning(res.message);
|
||||||
|
}
|
||||||
|
}).finally(() => {
|
||||||
|
that.confirmLoading = false;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -0,0 +1,84 @@
|
||||||
|
<template>
|
||||||
|
<a-drawer
|
||||||
|
:title="title"
|
||||||
|
:width="width"
|
||||||
|
placement="right"
|
||||||
|
:closable="false"
|
||||||
|
@close="close"
|
||||||
|
destroyOnClose
|
||||||
|
:visible="visible">
|
||||||
|
<purchase-request-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></purchase-request-form>
|
||||||
|
<div class="drawer-footer">
|
||||||
|
<a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button>
|
||||||
|
<a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button>
|
||||||
|
</div>
|
||||||
|
</a-drawer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import PurchaseRequestForm from './PurchaseRequestForm.vue'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'PurchaseRequestModal',
|
||||||
|
components: {
|
||||||
|
PurchaseRequestForm
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
title:"操作",
|
||||||
|
width:800,
|
||||||
|
visible: false,
|
||||||
|
disableSubmit: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
add () {
|
||||||
|
this.visible=true
|
||||||
|
this.$nextTick(()=>{
|
||||||
|
this.$refs.realForm.add();
|
||||||
|
})
|
||||||
|
},
|
||||||
|
edit (record) {
|
||||||
|
this.visible=true
|
||||||
|
this.$nextTick(()=>{
|
||||||
|
this.$refs.realForm.edit(record);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
close () {
|
||||||
|
this.$emit('close');
|
||||||
|
this.visible = false;
|
||||||
|
},
|
||||||
|
submitCallback(){
|
||||||
|
this.$emit('ok');
|
||||||
|
this.visible = false;
|
||||||
|
},
|
||||||
|
handleOk () {
|
||||||
|
this.$refs.realForm.submitForm();
|
||||||
|
},
|
||||||
|
handleCancel () {
|
||||||
|
this.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
/** Button按钮间距 */
|
||||||
|
.ant-btn {
|
||||||
|
margin-left: 30px;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
.drawer-footer{
|
||||||
|
position: absolute;
|
||||||
|
bottom: -8px;
|
||||||
|
width: 100%;
|
||||||
|
border-top: 1px solid #e8e8e8;
|
||||||
|
padding: 10px 16px;
|
||||||
|
text-align: right;
|
||||||
|
left: 0;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 0 0 2px 2px;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,60 @@
|
||||||
|
<template>
|
||||||
|
<j-modal
|
||||||
|
:title="title"
|
||||||
|
:width="width"
|
||||||
|
:visible="visible"
|
||||||
|
switchFullscreen
|
||||||
|
@ok="handleOk"
|
||||||
|
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
|
||||||
|
@cancel="handleCancel"
|
||||||
|
cancelText="关闭">
|
||||||
|
<purchase-request-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></purchase-request-form>
|
||||||
|
</j-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import PurchaseRequestForm from './PurchaseRequestForm.vue'
|
||||||
|
export default {
|
||||||
|
name: 'PurchaseRequestModal',
|
||||||
|
components: {
|
||||||
|
PurchaseRequestForm
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
title:'',
|
||||||
|
width:800,
|
||||||
|
visible: false,
|
||||||
|
disableSubmit: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
add () {
|
||||||
|
this.visible=true
|
||||||
|
this.$nextTick(()=>{
|
||||||
|
this.$refs.realForm.add();
|
||||||
|
})
|
||||||
|
},
|
||||||
|
edit (record) {
|
||||||
|
this.visible=true
|
||||||
|
this.$nextTick(()=>{
|
||||||
|
this.$refs.realForm.edit(record);
|
||||||
|
})
|
||||||
|
},
|
||||||
|
close () {
|
||||||
|
this.$emit('close');
|
||||||
|
this.visible = false;
|
||||||
|
},
|
||||||
|
handleOk () {
|
||||||
|
this.$refs.realForm.submitForm();
|
||||||
|
},
|
||||||
|
submitCallback(){
|
||||||
|
this.$emit('ok');
|
||||||
|
this.visible = false;
|
||||||
|
},
|
||||||
|
handleCancel () {
|
||||||
|
this.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
Loading…
Reference in New Issue