|
@@ -0,0 +1,310 @@
|
|
|
+<template>
|
|
|
+ <j-modal
|
|
|
+ :title="title"
|
|
|
+ width="100%"
|
|
|
+ :visible="visible"
|
|
|
+ :confirmLoading="confirmLoading"
|
|
|
+ :keyboard="false"
|
|
|
+ :forceRender="true"
|
|
|
+ v-bind:prefixNo="prefixNo"
|
|
|
+ fullscreen
|
|
|
+ switchFullscreen
|
|
|
+ @cancel="handleCancel"
|
|
|
+ :id="prefixNo"
|
|
|
+ style="top: 20px; height: 95%"
|
|
|
+ >
|
|
|
+ <template slot="footer">
|
|
|
+ <a-button v-if="!approvalIsReadonly" :loading="confirmLoading" @click="submitApproval(2)">审核不通过</a-button>
|
|
|
+ <a-button type="primary" v-if="!approvalIsReadonly" :loading="confirmLoading" @click="submitApproval(1)">审核通过</a-button>
|
|
|
+ <a-button key="back" v-if="approvalIsReadonly" @click="handleCancel">取消</a-button>
|
|
|
+ </template>
|
|
|
+ <a-spin :spinning="confirmLoading">
|
|
|
+ <a-form-model :model="model" ref="form" :rules="rules" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
|
|
+ <a-row class="form-row" :gutter="24" type="flex">
|
|
|
+ <a-col :xl="6" :lg="8" :md="12" :sm="24" >
|
|
|
+ <a-form-model-item label="货物条码" prop="number">
|
|
|
+ <a-input disabled placeholder="自动生成" v-model="model.number" />
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :xl="6" :lg="8" :md="12" :sm="24" >
|
|
|
+ <a-form-model-item label="货物名称" prop="name">
|
|
|
+ <a-input disabled placeholder="自动生成" v-model="model.name" />
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :xl="6" :lg="8" :md="12" :sm="24" >
|
|
|
+ <a-form-model-item label="规格" prop="standard" >
|
|
|
+ <a-input placeholder="请输入" disabled v-model="model.standard" />
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :xl="6" :lg="8" :md="12" :sm="24" >
|
|
|
+ <a-form-model-item label="库位" prop="position">
|
|
|
+ <a-input placeholder="请输入" disabled v-model="model.position" />
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :xl="6" :lg="8" :md="12" :sm="24" >
|
|
|
+ <a-form-model-item label="单位" prop="commodityUnit">
|
|
|
+ <a-select placeholder="请选择" :disabled="approvalIsReadonly&&nodeOrder==1" style="width: 150px" v-model="model.commodityUnit" :options="unitList"></a-select>
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :xl="6" :lg="8" :md="12" :sm="24" >
|
|
|
+ <a-form-model-item label="类别" prop="categoryId">
|
|
|
+ <a-tree-select
|
|
|
+ v-model="model.categoryId"
|
|
|
+ :disabled="approvalIsReadonly&&nodeOrder==1"
|
|
|
+ style="width: 100%"
|
|
|
+ :dropdownStyle="{ maxHeight: '200px', overflow: 'auto' }"
|
|
|
+ allow-clear
|
|
|
+ :treeData="categoryTree"
|
|
|
+ placeholder="请选择类别"
|
|
|
+ >
|
|
|
+ </a-tree-select>
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :xl="6" :lg="8" :md="12" :sm="24" >
|
|
|
+ <a-form-model-item label="默认采购价" prop="defaultPurchaseDecimal">
|
|
|
+ <a-input placeholder="请输入" :disabled="approvalIsReadonly&&nodeOrder==1" v-model="model.defaultPurchaseDecimal" />
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :xl="6" :lg="8" :md="12" :sm="24" >
|
|
|
+ <a-form-model-item label="默认销售价" prop="defaultWholesaleDecimal">
|
|
|
+ <a-input placeholder="请输入" :disabled="approvalIsReadonly&&nodeOrder==1" v-model="model.defaultWholesaleDecimal" />
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :xl="6" :lg="8" :md="12" :sm="24">
|
|
|
+ <a-form-model-item
|
|
|
+ label="图片"
|
|
|
+ >
|
|
|
+ <img v-for="(url,i) in fileList" :key="i" :src="url" alt="" style="margin: 0 10px 10px 0;display: inline-block;width: 100px;height: 100px;" />
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </a-form-model>
|
|
|
+ <!-- 审批历史 -->
|
|
|
+ <section v-if="approvalId">
|
|
|
+ <h4 class="block-title">审批历史</h4>
|
|
|
+ <a-table
|
|
|
+ size="middle"
|
|
|
+ bordered
|
|
|
+ rowKey="id"
|
|
|
+ :pagination="false"
|
|
|
+ :loading="approval.loading"
|
|
|
+ :columns="approval.columns"
|
|
|
+ :rowClassName="rowClassName"
|
|
|
+ :dataSource="approval.dataSource"
|
|
|
+ :scroll="{ x: '100%' }"
|
|
|
+ ></a-table>
|
|
|
+ <a-textarea :rows="1" placeholder="审核备注" v-model="auditComment" v-if="!approvalIsReadonly" style="margin-top: 8px" />
|
|
|
+ </section>
|
|
|
+ </a-spin>
|
|
|
+ </j-modal>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import {
|
|
|
+ queryMaterialCategoryTreeList,
|
|
|
+} from '@/api/api'
|
|
|
+import { getAction, postAction } from '@/api/manage'
|
|
|
+import { mapGetters } from 'vuex'
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: 'PdaFlowModal',
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ labelCol: {
|
|
|
+ xs: { span: 24 },
|
|
|
+ sm: { span: 9 },
|
|
|
+ },
|
|
|
+ wrapperCol: {
|
|
|
+ xs: { span: 24 },
|
|
|
+ sm: { span: 15 },
|
|
|
+ },
|
|
|
+ visible: false,
|
|
|
+ categoryTree: [],
|
|
|
+ unitList: [],
|
|
|
+ confirmLoading: false,
|
|
|
+ prefixNo: 'PDAWHSP',
|
|
|
+ action: '',
|
|
|
+ title: '',
|
|
|
+ rules: {
|
|
|
+ categoryId: [{ required: true, message: '请选择类别!' }],
|
|
|
+ commodityUnit: [{ required: true, message: '请选择单位!' }],
|
|
|
+ defaultWholesaleDecimal: [{ required: true, message: '请输入默认销售价!' }],
|
|
|
+ defaultPurchaseDecimal: [{ required: true, message: '请输入默认采购价!' }],
|
|
|
+ },
|
|
|
+ model: {},
|
|
|
+ fileList:[],
|
|
|
+ // 审批历史
|
|
|
+ nodeOrder: null,
|
|
|
+ approvalId: null, //审批id
|
|
|
+ approvalIsReadonly: false,
|
|
|
+ approval:{
|
|
|
+ loading:false,
|
|
|
+ columns:[
|
|
|
+ { title: '审核时间', dataIndex: 'auditTime' },
|
|
|
+ { title: '审核环节', dataIndex: 'nodeOrder',customRender(text,record,index){
|
|
|
+ if(index===0){
|
|
|
+ return text
|
|
|
+ }
|
|
|
+ return `审批节点${text}`
|
|
|
+ } },
|
|
|
+ { title: '审批人', dataIndex: 'auditorName' },
|
|
|
+ { title: '审核动作', dataIndex: 'auditResult',customRender(text,record,index){
|
|
|
+ if(index===0){
|
|
|
+ return text
|
|
|
+ }
|
|
|
+ if(text==1){
|
|
|
+ return '审批通过'
|
|
|
+ }else if(text==2){
|
|
|
+ return '审批不通过'
|
|
|
+ }
|
|
|
+ return ''
|
|
|
+ } },
|
|
|
+ { title: '备注', dataIndex: 'auditComment' },
|
|
|
+ ],
|
|
|
+ dataSource:[]
|
|
|
+ },
|
|
|
+ auditComment: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapGetters(['username']),
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ loadTreeData() {
|
|
|
+ let that = this
|
|
|
+ let params = {}
|
|
|
+ params.id = ''
|
|
|
+ queryMaterialCategoryTreeList(params).then((res) => {
|
|
|
+ if (res) {
|
|
|
+ that.categoryTree = []
|
|
|
+ for (let i = 0; i < res.length; i++) {
|
|
|
+ let temp = res[i]
|
|
|
+ that.categoryTree.push(temp)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ loadUnitListData() {
|
|
|
+ let that = this
|
|
|
+ let params = {}
|
|
|
+ getAction('/unit/getAllList', params).then((res) => {
|
|
|
+ if (res) {
|
|
|
+ that.unitList = res.data.map(item => ({
|
|
|
+ title: item.name,
|
|
|
+ value: item.name,
|
|
|
+ }))
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleOpen(number){
|
|
|
+ this.visible = true
|
|
|
+ if(number){
|
|
|
+ this.getDetail(number)
|
|
|
+ }
|
|
|
+ this.loadTreeData()
|
|
|
+ this.loadUnitListData()
|
|
|
+ },
|
|
|
+ edit(number) {
|
|
|
+ this.action = 'edit'
|
|
|
+ this.handleOpen(number)
|
|
|
+ },
|
|
|
+ add(){
|
|
|
+ this.action = 'add'
|
|
|
+ this.$set(this.model,'taskStatus',0)
|
|
|
+ this.handleOpen()
|
|
|
+ },
|
|
|
+ lookDetail(number,approvalRow=null){
|
|
|
+ this.action = 'detail'
|
|
|
+ this.handleOpen(number)
|
|
|
+ //审批历史
|
|
|
+ if(approvalRow&&approvalRow.id){
|
|
|
+ this.approvalId = approvalRow.id
|
|
|
+ this.nodeOrder = approvalRow.nodeOrder
|
|
|
+ getAction('/audit/auditHistory',{id:approvalRow.id}).then(res => {
|
|
|
+ const list = res.data
|
|
|
+ list.unshift({
|
|
|
+ auditTime: approvalRow.submitTime,
|
|
|
+ nodeOrder: '开始',
|
|
|
+ auditorName: approvalRow.initiatorName,
|
|
|
+ auditResult: '提交审批',
|
|
|
+ auditComment: '',
|
|
|
+ })
|
|
|
+ this.approval.dataSource = list
|
|
|
+ console.log('approvalRow=====',approvalRow)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getDetail(number){
|
|
|
+ const url = '/materialInput/detail/' + number
|
|
|
+ getAction(url).then((res) => {
|
|
|
+ this.model = res.data
|
|
|
+ this.fileList = res.data.imgName?res.data.imgName.split(','):[]
|
|
|
+ })
|
|
|
+ },
|
|
|
+ close(){
|
|
|
+ this.visible = false
|
|
|
+ this.$refs.form.resetFields()
|
|
|
+ this.action = ''
|
|
|
+ this.model = {}
|
|
|
+ this.$emit('close')
|
|
|
+ // 审批
|
|
|
+ this.approvalId = null
|
|
|
+ this.auditComment = ''
|
|
|
+ this.approval.dataSource = []
|
|
|
+ this.approvalIsReadonly = false
|
|
|
+ },
|
|
|
+ handleCancel() {
|
|
|
+ this.close()
|
|
|
+ },
|
|
|
+ rowClassName(record,index){
|
|
|
+ if(this.username===record.auditorName){
|
|
|
+ return 'red-row'
|
|
|
+ }
|
|
|
+ return ''
|
|
|
+ },
|
|
|
+ toApproval(status){
|
|
|
+ const params = {
|
|
|
+ id: this.approvalId,
|
|
|
+ status,
|
|
|
+ auditComment: this.auditComment
|
|
|
+ }
|
|
|
+ this.confirmLoading = true
|
|
|
+ postAction('/audit/setStatus',params).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ if(res.code===200){
|
|
|
+ this.$message.success(res.msg)
|
|
|
+ this.handleCancel()
|
|
|
+ this.$emit('ok')
|
|
|
+ }else{
|
|
|
+ this.$message.error(res.data.message)
|
|
|
+ }
|
|
|
+ }).finally(() => {
|
|
|
+ this.confirmLoading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 提交审核
|
|
|
+ submitApproval(status){
|
|
|
+ if(this.nodeOrder==1&&status==1){
|
|
|
+ this.$refs.form.validate(async (flag, values) => {
|
|
|
+ if(flag){
|
|
|
+ const res = await postAction('/materialInput/update',{...this.model})
|
|
|
+ if(res.code===200){
|
|
|
+ this.toApproval(status)
|
|
|
+ }else{
|
|
|
+ this.$message.error(res.data||'操作失败')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ this.toApproval(status)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+::v-deep .red-row{
|
|
|
+ color: #f5222d;
|
|
|
+}
|
|
|
+</style>
|