UNPKG

ttk-app-core

Version:
505 lines (501 loc) 23.2 kB
import moment from 'moment' export function getMeta() { return { name: 'root', component: 'Form', className: '{{data.form.assetPropertyId == data.consts.ASSETTYPE_immaterialAssets ? "app-asset-management immaterialAssets" : "app-asset-management fixedAssets"}}', children: { name: 'mail', component: 'Spin', tip: '数据加载中...', spinning: '{{data.other.loading}}', children: [{ name: 'header', component: '::div', className: 'app-asset-management-header', children: [{ name: 'form', component: '::div', className: 'app-asset-management-header-revenue', children: [{ name: 'name', component: 'Form.Item', className: 'codeAndNameItem', label: '资产名称', children: [{ name: 'name', component: '::span', className: 'codeAndName', title: '{{data.other.initData && (data.other.initData.code + " " +data.other.initData.name)}}', children: '{{data.other.initData && (data.other.initData.code + " " +data.other.initData.name)}}' }] },{ name: 'origValue', component: 'Form.Item', label: '资产原值', children: [{ name: 'origValue', component: '::span', children: '{{data.other.initData && data.other.initData.origValue && $addThousandsPosition((data.other.initData.origValue).toFixed(2))}}' }] },{ name: 'accuDepreciation', component: 'Form.Item', label: '累计折旧/摊销', children: [{ name: 'origValue', component: '::span', children: '{{$getAccuDepreciation(data.other.initData, true)}}' //children: '{{(data.other.initData && data.other.initData.accuDepreciation) ? (data.other.initData.accuDepreciation).toFixed(2) : (0).toFixed(2)}}' }] },{ name: 'revenue', component: 'Form.Item', label: '资产净值', children: [{ name: 'revenue', component: '::span', children: '{{$getRevenue(data.other.initData, true)}}' //children: '{{(data.other.initData && data.other.initData.origValue && data.other.initData.accuDepreciation) ? ' + //'(data.other.initData.origValue-data.other.initData.accuDepreciation).toFixed(2) : (0).toFixed(2)}}' }] }] }] },{ name: 'content', component: '::div', className: 'app-asset-management-content', children: [{ name: 'assetDisposeDate', component: 'Form.Item', label: '处置日期', required: true, children: [{ name: 'assetDisposeDate', component: 'DatePicker', disabled: '{{data.other.isView}}', value: '{{$stringToMoment(data.form.assetDisposeDate)}}', onChange: "{{function(d){$assetDisposeDateChange('data.form.assetDisposeDate',$momentToString(d,'YYYY-MM-DD'))}}}", disabledDate: '{{function(value){return $disabledDisposeDate(value)}}}', }] }, { name: 'assetDisposeType', component: 'Form.Item', label: '处置类型', required: true, children: [{ name: 'project', component: 'Select', showSearch: false, disabled: '{{data.other.isView}}', value: '{{data.form.assetDisposeType && data.form.assetDisposeType.id}}', onChange: `{{function(v){$assetDisposeType('data.form.assetDisposeType',data.other.assetDisposeType.filter(function(o){return o.id == v})[0])}}}`, children: { name: 'option', component: 'Select.Option', value: '{{data.other.assetDisposeType && data.other.assetDisposeType[_rowIndex].id }}', children: '{{data.other.assetDisposeType && data.other.assetDisposeType[_rowIndex].name }}', _power: 'for in data.other.assetDisposeType' } }] }, { name: 'netProfitLoss', component: 'Form.Item', className: '{{data.form.assetPropertyId == data.consts.ASSETTYPE_immaterialAssets ? "top-border" : ""}}', label: '处置净损益', children: [{ name: 'netProfitLoss', component: 'Input.Number', className: 'right-item', disabled: true, value: '{{data.form.netProfitLosse && $addThousandsPosition((data.form.netProfitLosse).toFixed(2))}}', onBlur: "{{function(e){$fieldChange('data.form.netProfitLoss',e)}}}" }] }, { name: 'prompt', component: '::span', className: '{{data.form.assetPropertyId == data.consts.ASSETTYPE_immaterialAssets ? "prompt top-border" : "prompt"}}', //children: '提示:处置净损益 = 收入合计 - 支出合计 - (原值-累计折旧)' }, { name: 'assetDisposeTab', component: '::div', _visible: '{{data.form.assetPropertyId != data.consts.ASSETTYPE_immaterialAssets}}', className: 'app-asset-management-content-tab', children: [{ name: 'tabNav', component: 'Tabs', activeKey: '{{data.other.assetDisposeTabId}}', onChange: "{{function(e){$assetDisposeTabChange('data.other.assetDisposeTabId',e)}}}", children: [{ name: "option", component: 'Tabs.TabPane', tab: [{ name: 'tab', component: '::div', children: '{{ data.other.assetDisposeTab && data.other.assetDisposeTab[_rowIndex].name }}' }], key: "{{ data.other.assetDisposeTab && data.other.assetDisposeTab[_rowIndex].id }}", _power: 'for in data.other.assetDisposeTab' }] }] }, { name: 'contentLeft', component: '::div', _visible: '{{!(data.other.isIntangibleAssets && data.form.assetDisposeType && data.form.assetDisposeType.id == "5100050002") && data.other.tabType == "1"}}', className: '{{(data.other.isIntangibleAssets && data.form.assetDisposeType && data.form.assetDisposeType.id == "5100050001") ? "app-asset-management-content-left intangible-assets" :"app-asset-management-content-left"}}', children: [{ name: 'saleTaxIncome', component: 'Form.Item', _visible: '{{!(data.form.assetDisposeType && data.form.assetDisposeType.id == "5100050002")}}', label: '出售收入(含税)', children: [{ name: 'saleTaxIncome', component: 'Input.Number', className: 'right-item', precision: 2, maxlength: '10', disabled: '{{(data.form.assetDisposeType && data.form.assetDisposeType.id == "5100050002") || data.other.isView}}', value: '{{data.form.saleTaxIncome && $addThousandsPosition((data.form.saleTaxIncome).toFixed(2))}}', onBlur: "{{function(e){$getSaleTaxIncome('data.form.saleTaxIncome','saleTaxIncome',e)}}}" }] }, { name: 'incomeInvoiceType', component: 'Form.Item', label: '票据类型', _visible: '{{!(data.form.assetDisposeType && data.form.assetDisposeType.id == "5100050002")}}', children: [{ name: 'project', component: 'Select', showSearch: false, disabled: '{{(data.form.assetDisposeType && data.form.assetDisposeType.id == "5100050002") || data.other.isView || !(data.form.saleTaxIncome>0)}}', value: '{{data.form.incomeInvoiceType && data.form.incomeInvoiceType.id}}', onChange: `{{function(v){$incomeInvoiceChange('data.form.incomeInvoiceType',data.other.invoiceTypeIncome.filter(function(o){return o.id == v})[0])}}}`, children: { name: 'option', component: 'Select.Option', value: '{{data.other.invoiceTypeIncome && data.other.invoiceTypeIncome[_rowIndex].id }}', children: '{{data.other.invoiceTypeIncome && data.other.invoiceTypeIncome[_rowIndex].name }}', _power: 'for in data.other.invoiceTypeIncome' } }] }, { name: 'taxRate', component: 'Form.Item', label: '税率', _visible: '{{!(data.form.assetDisposeType && data.form.assetDisposeType.id == "5100050002")}}', //required: true, children: [{ name: 'project', component: 'Select', showSearch: false, dropdownClassName:'taxSelect', disabled: '{{(data.form.assetDisposeType && data.form.assetDisposeType.id == "5100050002") || data.other.isView || !(data.form.saleTaxIncome>0)}}', value: '{{(data.form.taxRate && data.form.saleTaxIncome>0) ? data.form.taxRate.id : ""}}', onChange: `{{function(v){$fieldChange('data.form.taxRate',data.other.taxRate.filter(function(o){return o.id == v})[0]); $saleIncome('taxRate', data.other.taxRate.filter(function(o){return o.id == v})[0]);}}}`, children: { name: 'option', component: 'Select.Option', title: '{{data.other.taxRate && data.other.taxRate[_rowIndex].name }}', value: '{{data.other.taxRate && data.other.taxRate[_rowIndex].id }}', children: '{{data.other.taxRate && data.other.taxRate[_rowIndex].name }}', _power: 'for in data.other.taxRate' } }] }, { name: 'tax', component: 'Form.Item', label: '税额', _visible: '{{!(data.form.assetDisposeType && data.form.assetDisposeType.id == "5100050002")}}', children: [{ name: 'tax', component: 'Input.Number', className: 'right-item', disabled: true, value: '{{data.form.tax && $addThousandsPosition((data.form.tax).toFixed(2))}}', onBlur: "{{function(e){$fieldChange('data.form.tax',e)}}}" }] }, { name: 'saleIncome', component: 'Form.Item', label: '出售收入(不含税)', _visible: '{{!(data.form.assetDisposeType && data.form.assetDisposeType.id == "5100050002")}}', children: [{ name: 'saleIncome', component: 'Input.Number', className: 'right-item', disabled: true, value: '{{data.form.saleIncome && $addThousandsPosition((data.form.saleIncome).toFixed(2))}}', onBlur: "{{function(e){$fieldChange('data.form.saleIncome',e)}}}" }] }, { name: 'receivableAccount', component: 'Form.Item', required: '{{data.form.saleTaxIncome>0 ? true : false}}', validateStatus: "{{(data.other.error.receivableAccount && data.form.saleTaxIncome>0) ?'error':'success'}}", help: '{{data.form.saleTaxIncome>0 ? data.other.error.receivableAccount : ""}}', label: '出售收入账户', _visible: '{{!(data.form.assetDisposeType && data.form.assetDisposeType.id == "5100050002")}}', children: [{ name: 'receivableAccount', component: 'Select', showSearch: false, disabled: '{{(data.form.assetDisposeType && data.form.assetDisposeType.id == "5100050002") || data.other.isView || !(data.form.saleTaxIncome>0) }}', value: '{{data.form.receivableAccount && data.form.receivableAccount.id}}', onChange: `{{function(v){$fieldChange('data.form.receivableAccount',data.other.baBankAccountSale.filter(function(o){return o.id == v})[0])}}}`, children: { name: 'option', component: 'Select.Option', value: '{{data.other.baBankAccountSale && data.other.baBankAccountSale[_rowIndex].id }}', children: '{{data.other.baBankAccountSale && data.other.baBankAccountSale[_rowIndex].name }}', _power: 'for in data.other.baBankAccountSale' } }] }, { name: 'insuranceClaims', component: 'Form.Item', _visible: '{{!(data.other.isIntangibleAssets && data.form.assetDisposeType && data.form.assetDisposeType.id == "5100050001")}}', label: '保险理赔', children: [{ name: 'insuranceClaims', component: 'Input.Number', className: 'right-item', precision: 2, maxlength: '10', disabled: '{{data.other.isView}}', value: '{{data.form.insuranceClaims && $addThousandsPosition((data.form.insuranceClaims).toFixed(2))}}', onBlur: "{{function(e){$getSaleTaxIncome('data.form.insuranceClaims','insuranceClaims',e)}}}" }] }, { name: 'insuranceClaimsAccount', component: 'Form.Item', _visible: '{{!(data.other.isIntangibleAssets && data.form.assetDisposeType && data.form.assetDisposeType.id == "5100050001")}}', required: '{{data.form.insuranceClaims>0 ? true : false}}', validateStatus: "{{(data.other.error.insuranceClaimsAccount && data.form.insuranceClaims>0) ?'error':'success'}}", help: '{{data.form.insuranceClaims>0 ? data.other.error.insuranceClaimsAccount : ""}}', label: '保险理赔账户', children: [{ name: 'insuranceClaimsAccount', component: 'Select', showSearch: false, disabled: '{{data.other.isView || !(data.form.insuranceClaims>0)}}', value: '{{data.form.insuranceClaimsAccount && data.form.insuranceClaimsAccount.id}}', onChange: `{{function(v){$fieldChange('data.form.insuranceClaimsAccount',data.other.baBankAccountSale.filter(function(o){return o.id == v})[0])}}}`, children: { name: 'option', component: 'Select.Option', value: '{{data.other.baBankAccountSale && data.other.baBankAccountSale[_rowIndex].id }}', children: '{{data.other.baBankAccountSale && data.other.baBankAccountSale[_rowIndex].name }}', _power: 'for in data.other.baBankAccountSale' } }] }, { name: 'incomeTotal', component: 'Form.Item', _visible: '{{!(data.other.isIntangibleAssets && data.form.assetDisposeType && data.form.assetDisposeType.id == "5100050001")}}', label: '收入合计(不含税)', children: [{ name: 'incomeTotal', component: 'Input.Number', className: 'right-item', disabled: true, value: '{{data.form.incomeTotal && $addThousandsPosition((data.form.incomeTotal).toFixed(2))}}', onBlur: "{{function(e){$fieldChange('data.form.incomeTotal',e)}}}" }] }] }, { name: 'contentRight', component: '::div', className: 'app-asset-management-content-right', _visible: '{{!data.other.isIntangibleAssets && data.other.tabType == "2"}}', children: [{ name: 'cleaningTaxUp', component: 'Form.Item', label: '清理费用(含税)', children: [{ name: 'cleaningTaxUp', component: 'Input.Number', className: 'right-item', precision: 2, maxlength: '10', disabled: '{{data.other.isView}}', value: '{{data.form.cleaningTaxUp && $addThousandsPosition((data.form.cleaningTaxUp).toFixed(2))}}', onBlur: "{{function(e){$getCleaningTaxUp('data.form.cleaningTaxUp','cleaningTaxUp',e)}}}" }] }, { name: 'invoiceType', component: 'Form.Item', label: '票据类型', children: [{ name: 'project', component: 'Select', showSearch: false, disabled: '{{data.other.isView || !(data.form.cleaningTaxUp>0)}}', value: '{{data.form.invoiceType && data.form.invoiceType.id}}', onChange: `{{function(v){$invoiceTypeChange('data.form.invoiceType',data.other.invoiceTypeOut.filter(function(o){return o.id == v})[0])}}}`, children: { name: 'option', component: 'Select.Option', value: '{{data.other.invoiceTypeOut && data.other.invoiceTypeOut[_rowIndex].id }}', children: '{{data.other.invoiceTypeOut && data.other.invoiceTypeOut[_rowIndex].name }}', _power: 'for in data.other.invoiceTypeOut' } }] },{ name: 'isAuthenIdentify', component: '::div', _visible: '{{data.other.isAuthentication}}', className: 'tax', children: [{ name: 'isAuthentication', component: 'Form.Item', label: '认证', children: [{ name: 'isAuthentication', component: 'Checkbox', disabled: '{{data.other.isView}}', checked: '{{data.form.isAuthentication}}', onChange: `{{function(e){$authenticationChange('data.form.isAuthentication', e.target.checked)}}}` }] },{ name: 'identifyPeriod', component: 'Form.Item', label: '认证月份', children: [{ name: 'identifyPeriod', component: 'DatePicker.MonthPicker', disabled: true, //'{{!data.form.isAuthentication || data.other.isView}}', value: '{{$stringToMoment(data.form.identifyPeriod)}}', onChange: "{{function(d){$sf('data.form.identifyPeriod',$momentToString(d,'YYYY-MM'))}}}", }] }] },{ name: 'inputTaxRate', component: 'Form.Item', label: '税率', //required: true, _visible: '{{data.other.taxRateVisible}}', children: [{ name: 'project', component: 'Select', dropdownClassName:'taxSelect', showSearch: false, disabled: '{{data.other.isView || !(data.form.cleaningTaxUp>0)}}', value: '{{ (data.form.cleaningTaxUp>0 && data.form.inputTaxRate) ? data.form.inputTaxRate.id : ""}}', onChange: `{{function(v){$fieldChange('data.form.inputTaxRate',data.other.clearTaxRate.filter(function(o){return o.id == v})[0]); $cleaningUp('inputTaxRate', data.other.clearTaxRate.filter(function(o){return o.id == v})[0]);}}}`, children: { name: 'option', component: 'Select.Option', title: '{{data.other.clearTaxRate && data.other.clearTaxRate[_rowIndex].name }}', value: '{{data.other.clearTaxRate && data.other.clearTaxRate[_rowIndex].id }}', children: '{{data.other.clearTaxRate && data.other.clearTaxRate[_rowIndex].name }}', _power: 'for in data.other.clearTaxRate' } }] }, { name: 'inputTax', component: 'Form.Item', label: '税额', _visible: '{{data.other.inputTaxVisible}}', children: [{ name: 'inputTax', component: 'Input.Number', className: 'right-item', disabled: true, value: '{{data.form.inputTax && $addThousandsPosition((data.form.inputTax).toFixed(2))}}', onBlur: "{{function(e){$fieldChange('data.form.inputTax',e)}}}" }] }, { name: 'cleaningUp', component: 'Form.Item', label: '清理费用(不含税)', children: [{ name: 'cleaningUp', component: 'Input.Number', className: 'right-item', disabled: true, value: '{{data.form.cleaningUp && $addThousandsPosition((data.form.cleaningUp).toFixed(2))}}', onBlur: "{{function(e){$fieldChange('data.form.cleaningUp',e)}}}" }] }, { name: 'expenditureAccount', component: 'Form.Item', required: '{{data.form.expenditureTotal>0 ? true : false}}', validateStatus: "{{(data.other.error.expenditureAccount && data.form.expenditureTotal>0) ?'error':'success'}}", help: '{{(data.other.error.expenditureAccount && data.form.expenditureTotal>0) ? data.other.error.expenditureAccount : ""}}', label: '支出账户', children: [{ name: 'project', component: 'Select', showSearch: false, disabled: '{{data.other.isView || !(data.form.cleaningTaxUp>0)}}', value: '{{data.form.expenditureAccount && data.form.expenditureAccount.id}}', onChange: `{{function(v){$fieldChange('data.form.expenditureAccount',data.other.baBankAccountExpend.filter(function(o){return o.id == v})[0])}}}`, children: { name: 'option', component: 'Select.Option', value: '{{data.other.baBankAccountExpend && data.other.baBankAccountExpend[_rowIndex].id }}', children: '{{data.other.baBankAccountExpend && data.other.baBankAccountExpend[_rowIndex].name }}', _power: 'for in data.other.baBankAccountExpend' } }] }, { name: 'expenditureTotal', component: 'Form.Item', label: '支出合计(不含税)', children: [{ name: 'expenditureTotal', component: 'Input.Number', className: 'right-item', disabled: true, value: '{{data.form.expenditureTotal && $addThousandsPosition((data.form.expenditureTotal).toFixed(2))}}', onBlur: "{{function(e){$fieldChange('data.form.expenditureTotal',e)}}}" }] }] }, { name: 'memo', component: 'Form.Item', label: '备注', className: 'memo', validateStatus: "{{data.other.error.memo?'error':'success'}}", help: '{{data.other.error.memo}}', children: [{ name: 'memo', component: 'Input', disabled: '{{data.other.isView}}', value: '{{data.form.memo}}', onChange: "{{function(e){$fieldChange('data.form.memo',e.target.value)}}}" }] }] }] } } } export function getInitState(option) { return { data: { form: { assetDisposeDate: moment().format('YYYY-MM-DD'), identifyPeriod: moment().format('YYYY-MM'), isAuthentication: true }, systemDate: {}, other: { error: {}, loading: false, isOk: true, isAuthentication: false, taxRateVisible:true, inputTaxVisible:true, assetDisposeTabId: 1+'', tabType: "1", assetDisposeTab: [{ id: 1, name: '收入项目' },{ id: 2, name: '支出项目' }], } } } }