123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362 |
- <template>
- <a-modal
- :title="title"
- :width="1800"
- :visible="visible"
- :maskClosable="false"
- :confirmLoading="confirmLoading"
- @ok="handleOk"
- @cancel="handleCancel">
- <a-spin :spinning="confirmLoading">
- <!-- 主表单区域 -->
- <a-form :form="form">
- <a-row>
- <a-col :span="16">
- <a-form-item label="标题" :labelCol="{ span: 3 }" :wrapperCol="{ span: 21 }">
- <a-input v-decorator="[ 'title', validatorRules.title]" placeholder="请输入标题"></a-input>
- </a-form-item>
- </a-col>
- <a-col :span="8">
- <a-form-item label="单据号" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-input v-decorator="[ 'inNo', validatorRules.inNo]" placeholder="请输入单据号"></a-input>
- </a-form-item>
- </a-col>
- <a-col :span="8">
- <a-form-item label="创建人" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-input v-decorator="[ 'creater', validatorRules.creater]" placeholder="请输入创建人" disabled></a-input>
- </a-form-item>
- </a-col>
- <a-col :span="8">
- <a-form-item label="创建部门" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-input v-decorator="[ 'createrDept', validatorRules.createrDept]" placeholder="请输入创建部门" disabled></a-input>
- </a-form-item>
- </a-col>
- <a-col :span="8">
- <a-form-item label="创建时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <j-date placeholder="请选择创建时间" v-decorator="[ 'createDate']" :showTime="true" dateFormat="YYYY-MM-DD HH:mm:ss" :trigger-change="true" style="width: 100%" disabled/>
- </a-form-item>
- </a-col>
- <a-col :span="8">
- <a-form-item label="入库人" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <j-popup
- v-decorator="['operator', validatorRules.operator]"
- :trigger-change="true"
- org-fields="realname,depart_name"
- dest-fields="operator,operatorDept"
- code="user_dept"
- @callback="popupCallback"/>
- </a-form-item>
- </a-col>
- <a-col :span="8">
- <a-form-item label="入库部门" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-input v-decorator="[ 'operatorDept', validatorRules.operatorDept]" placeholder="请输入入库部门" disabled></a-input>
- </a-form-item>
- </a-col>
- <a-col :span="8">
- <a-form-item label="入库日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <j-date placeholder="请选择入库日期" v-decorator="[ 'operatorDate', validatorRules.operatorDate]" :showTime="true" dateFormat="YYYY-MM-DD HH:mm:ss" :trigger-change="true" style="width: 100%"/>
- </a-form-item>
- </a-col>
- </a-row>
- </a-form>
- <!-- 子表单区域 -->
- <a-tabs v-model="activeKey" @change="handleChangeTabs">
- <a-tab-pane tab="固定资产入库明细" :key="refKeys[0]" :forceRender="true">
- <j-editable-table
- :ref="refKeys[0]"
- :loading="assetInDetailTable.loading"
- :columns="assetInDetailTable.columns"
- :dataSource="assetInDetailTable.dataSource"
- :maxHeight="300"
- :rowNumber="false"
- :rowSelection="true"
- :actionButton="true"/>
- </a-tab-pane>
-
- </a-tabs>
- </a-spin>
- </a-modal>
- </template>
- <script>
- import pick from 'lodash.pick'
- import { FormTypes,getRefPromise } from '@/utils/JEditableTableUtil'
- import { JEditableTableMixin } from '@/mixins/JEditableTableMixin'
- import { validateDuplicateValue } from '@/utils/util'
- import JDate from '@/components/jeecg/JDate'
- import moment from 'moment'
- export default {
- name: 'AssetInModal',
- mixins: [JEditableTableMixin],
- components: {
- JDate,
- },
- data() {
- return {
- labelCol: {
- span: 6
- },
- wrapperCol: {
- span: 16
- },
- labelCol2: {
- span: 3
- },
- wrapperCol2: {
- span: 20
- },
- // 新增时子表默认添加几行空数据
- addDefaultRowNum: 1,
- validatorRules: {
- title: {rules: [
- ]},
- inNo: {rules: [
- ]},
- creater: {rules: [
- ]},
- createrDept: {rules: [
- ]},
- operator: {rules: [
- {required: true, message: '请选择入库人 !'},
- ]},
- operatorDept: {rules: [
- ]},
- operatorDate: {rules: [
- {required: true, message: '请选择入库日期 !'},
- ]},
- },
- refKeys: ['assetInDetail', ],
- tableKeys:['assetInDetail', ],
- activeKey: 'assetInDetail',
- // 固定资产入库明细
- assetInDetailTable: {
- loading: false,
- dataSource: [],
- columns: [
- {
- title: '资产编号',
- key: 'assetNumber',
- type: FormTypes.input,
- width:"200px",
- placeholder: '请输入${title}',
- defaultValue: '',
- },
- {
- title: '资产名称',
- key: 'assetName',
- type: FormTypes.input,
- width:"200px",
- placeholder: '请输入${title}',
- defaultValue: '',
- },
- {
- title: '资产类别',
- key: 'assetsCategory',
- type: FormTypes.input,
- width:"200px",
- type: FormTypes.select,
- options: [ // 下拉选项
- { title: '办公家具', value: '办公家具' },
- { title: '办公设备', value: '办公设备' },
- { title: '不动产', value: '不动产' },
- { title: '车辆', value: '车辆' },
- { title: '其他', value: '其他' },
- ],
- },
- {
- title: '品牌',
- key: 'brand',
- type: FormTypes.input,
- width:"200px",
- placeholder: '请输入${title}',
- defaultValue: '',
- },
- {
- title: '单位名称',
- key: 'unitName',
- type: FormTypes.input,
- width:"200px",
- placeholder: '请输入${title}',
- defaultValue: '',
- },
- {
- title: '规格型号',
- key: 'model',
- type: FormTypes.input,
- width:"200px",
- placeholder: '请输入${title}',
- defaultValue: '',
- },
- {
- title: '计量单位',
- key: 'unit',
- type: FormTypes.input,
- width:"200px",
- placeholder: '请输入${title}',
- defaultValue: '',
- },
- {
- title: '数量',
- key: 'quantity',
- type: FormTypes.input,
- width:"200px",
- placeholder: '请输入${title}',
- defaultValue: '',
- },
- {
- title: '金额',
- key: 'amount',
- type: FormTypes.input,
- width:"200px",
- placeholder: '请输入${title}',
- defaultValue: '',
- validateRules: [
- { pattern: /^\d+(\.\d{1,2})?$/, message: '请输入金额(保留两位小数)' },
- ]
- },
- {
- title: '使用年限',
- key: 'exp',
- type: FormTypes.input,
- width:"200px",
- placeholder: '请输入${title}',
- defaultValue: '',
- },
- {
- title: '购置日期',
- key: 'purhcaseDate',
- type: FormTypes.date,
- width:"200px",
- placeholder: '请输入${title}',
- defaultValue: '',
- },
- {
- title: '入库日期',
- key: 'inDate',
- type: FormTypes.date,
- width:"200px",
- placeholder: '请输入${title}',
- defaultValue: '',
- },
- {
- title: '存放地点',
- key: 'place',
- type: FormTypes.input,
- width:"200px",
- placeholder: '请输入${title}',
- defaultValue: '',
- },
- {
- title: '使用人',
- key: 'user',
- type: FormTypes.popup,
- popupCode:"user_dept",
- destFields:"user,userDept,state",
- orgFieldse:"realname,depart_name,state",
- width:"200px",
- placeholder: '请输入${title}',
- defaultValue: '',
- },
- {
- title: '使用部门',
- key: 'userDept',
- type: FormTypes.input,
- width:"200px",
- placeholder: '请输入${title}',
- defaultValue: '',
- disabled:true
- },
- {
- title: '资产状态',
- key: 'state',
- type: FormTypes.input,
- width:"200px",
- placeholder: '请输入${title}',
- defaultValue: '闲置',
- disabled:true
- },
- {
- title: '备注',
- key: 'remark',
- type: FormTypes.input,
- width:"200px",
- placeholder: '请输入${title}',
- defaultValue: '',
- },
- {
- title: '附件',
- key: 'attachment',
- type: FormTypes.file,
- token:true,
- responseName:"message",
- width:"200px",
- placeholder: '请选择文件',
- defaultValue: '',
- },
- ]
- },
- url: {
- add: "/oa/assetIn/add",
- edit: "/oa/assetIn/edit",
- assetInDetail: {
- list: '/oa/assetIn/queryAssetInDetailByMainId'
- },
- }
- }
- },
- methods: {
- init(){
- this.$nextTick(() => {
- this.form.setFieldsValue({
- creater: this.$store.getters.userInfo.realname,
- createrDept: this.$store.getters.userInfo.deptName,
- createDate: moment().format('YYYY-MM-DD HH:mm:ss')
- })
- })
- },
- getAllTable() {
- let values = this.tableKeys.map(key => getRefPromise(this, key))
- return Promise.all(values)
- },
- /** 调用完edit()方法之后会自动调用此方法 */
- editAfter() {
- let fieldval = pick(this.model,'title','inNo','creater','createrDept','operator','operatorDept','operatorDate')
- this.$nextTick(() => {
- this.form.setFieldsValue(fieldval)
- })
- // 加载子表数据
- if (this.model.id) {
- let params = { id: this.model.id }
- this.requestSubTableData(this.url.assetInDetail.list, params, this.assetInDetailTable)
- }
- },
- /** 整理成formData */
- classifyIntoFormData(allValues) {
- let main = Object.assign(this.model, allValues.formValue)
- return {
- ...main, // 展开
- assetInDetailList: allValues.tablesValue[0].values,
- }
- },
- validateError(msg){
- this.$message.error(msg)
- },
- popupCallback(row){
- this.form.setFieldsValue(pick(row,'title','inNo','creater','createrDept','operator','operatorDept','operatorDate'))
- },
- }
- }
- </script>
- <style scoped>
- </style>
|