UNPKG

ttk-app-core

Version:
267 lines (264 loc) 8.45 kB
export function getMeta() { return { name: 'root', component: 'Layout', className: 'app-card-inventory', children: { name: 'form', component: 'Form', className: 'app-card-inventory-form', children: [ { name: 'propertyItem', component: 'Form.Item', label: '存货及服务分类', className: 'app-card-inventory-form-sort', required: true, validateStatus: '{{data.other.error.property?\'error\':\'success\'}}', help: '{{data.other.error.property}}', children: { name: 'property', component: 'Select', showSearch: false, optionFilterProp: 'children', value: '{{data.form.property&&JSON.stringify(data.form.property)}}', onChange: '{{$propertyChange}}', children: { name: 'selectItem', component: 'Select.Option', value: '{{JSON.stringify(data.other.property[_rowIndex])}}', children: '{{data.other.property[_rowIndex].name}}', _power: 'for in data.other.property' } } }, { name: 'propertyDetailItem', component: 'Form.Item', label: '明细分类', required: true, _visible: '{{data.isProperty}}', validateStatus: '{{data.other.error.propertyDetail?\'error\':\'success\'}}', help: '{{data.other.error.propertyDetail}}', children: { name: 'property', component: 'Select', showSearch: false, optionFilterProp: 'children', value: '{{data.form.propertyDetail&&JSON.stringify(data.form.propertyDetail)}}', onChange: '{{$propertyDetailChange}}', children: { name: 'selectItem', component: 'Select.Option', value: '{{JSON.stringify(data.other.propertyDetailFilter[_rowIndex])}}', children: '{{data.other.propertyDetailFilter[_rowIndex].name}}', _power: 'for in data.other.propertyDetailFilter' } } }, { name: 'line', component: 'Layout', className: 'title', children: [{ name: 'info', className: 'info', component: '::span', children: '存货信息' }, { name: 'line', className: 'line', component: '::span', children: '' }] }, { name: 'codeItem', component: 'Form.Item', label: '存货编码', required: true, validateStatus: '{{data.other.error.code?\'error\':\'success\'}}', help: '{{data.other.error.code}}', children: { name: 'code', component: 'Input', // maxlength: '50', value: '{{data.form.code}}', onChange: '{{function(e){$sf(\'data.form.code\',e.target.value);$changeCheck("code")}}}' } }, { name: 'nameItem', component: 'Form.Item', label: '存货名称', required: true, validateStatus: '{{data.other.error.name?\'error\':\'success\'}}', help: '{{data.other.error.name}}', children: { name: 'name', component: 'Input', // maxlength: '100', value: '{{data.form.name}}', onChange: `{{function(e){$sf('data.form.name',e.target.value);$changeCheck("name")}}}` } }, { name: 'sizeItem', component: 'Form.Item', label: '规格型号', validateStatus: '{{data.other.error.specification?\'error\':\'success\'}}', help: '{{data.other.error.specification}}', children: { name: 'specification', component: 'Input', // maxlength: '50', value: '{{data.form.specification}}', onChange: '{{function(e){$sf(\'data.form.specification\',e.target.value);$changeCheck("specification")}}}' } }, { name: 'unitItem', component: 'Form.Item', label: '计量单位', required: true, validateStatus: '{{data.other.error.unit?\'error\':\'success\'}}', help: '{{data.other.error.unit}}', children: { name: 'unit', component: 'Select', showSearch: false, optionFilterProp: 'children', value: '{{data.form.unit&&data.form.unit.id}}', onChange: `{{function(v){$fieldChange('data.form.unit',data.other.unit.filter(function(data){return data.id == v})[0])}}}`, dropdownClassName: 'app-card-inventory-unitDropdown', dropdownFooter: { name: 'add', component: 'Button', type: 'primary', style: { width: '100%', borderRadius: '0' }, onClick: '{{$addUnit}}', children: '新增单位' }, children: { name: 'selectItem', component: 'Select.Option', value: '{{data.other.unit[_rowIndex].id}}', children: '{{data.other.unit[_rowIndex].name}}', _power: 'for in data.other.unit' } } }, { name: 'taxRateItem', component: 'Form.Item', label: '税率', required: true, validateStatus: '{{data.other.error.rate?\'error\':\'success\'}}', help: '{{data.other.error.rate}}', children: { name: 'rate', component: 'Select', showSearch: false, optionFilterProp: 'children', value: '{{data.form.rate&&data.form.rate.id}}', onChange: `{{function(v){$fieldChange('data.form.rate',data.other.rate.filter(function(data){return data.id == v})[0])}}}`, dropdownClassName: 'app-card-inventory-taxDropdown', children: { name: 'selectItem', component: 'Select.Option', value: '{{data.other.rate[_rowIndex].id}}', children: '{{data.other.rate[_rowIndex].name}}', _power: 'for in data.other.rate' } } }, { name: 'name', component: '::div', style: { width: '50px', display: 'inline-block' } }, { name: 'taxClassificationCodeItem', component: 'Form.Item', label: '税收分类编码', children: { name: 'property', component: 'Select', className: 'app-card-inventory-taxCode', allowClear: true, value: '{{data.form.taxClassificationId}}', placeholder: '输入关键字搜索', disabled: '{{!data.form.property}}', notFoundContent: '{{$taxNotFound()}}', getPopupContainer: '{{function(){return document.querySelector(".app-card-inventory")}}}', filterOption: false, dropdownMatchSelectWidth: false, dropdownClassName: 'app-card-inventory-taxCodeDropdown', onSearch: '{{$fetchUser}}', onChange: '{{$tacChange}}', children: '{{$taxOption()}}' } }, { name: 'taxClassificationNameItem', component: 'Form.Item', label: '税收分类名称', children: { name: 'taxClassificationName', component: 'Input', disabled: true, maxlength: '50', value: '{{data.form.taxClassificationName}}', onChange: '{{function(e){$sf(\'data.form.taxClassificationName\',e.target.value)}}}' } }, { name: 'revenueType', component: 'Form.Item', label: '收入类型', children: { name: 'revenueType', component: 'Select', showSearch: false, value: '{{data.form.revenueType && data.form.revenueType.id}}', onChange: `{{function(v){$fieldChange('data.form.revenueType',data.other.revenueType.filter(function(data){return data.id == v})[0])}}}`, children: { name: 'selectItem', component: 'Select.Option', value: '{{data.other.revenueType[_rowIndex].id}}', children: '{{data.other.revenueType[_rowIndex].name}}', _power: 'for in data.other.revenueType' }, dropdownFooter: { name: 'add', component: 'Button', type: 'primary', style: { width: '100%', borderRadius: '0' }, onClick: '{{$addRevenueType}}', children: '新增收入类型' } } }, { name: 'statusItem', component: 'Form.Item', label: '停用', children: [{ name: 'isEnable', component: 'Checkbox', checked: '{{!data.form.isEnable}}', onChange: '{{function(e){$sf(\'data.form.isEnable\',!e.target.checked)}}}' }] }] } }; } export function getInitState() { return { data: { form: { code: '', name: '', isEnable: true }, isProperty: false, other: { revenueType: [], error: {} }, taxCode: { data: [], value: [], fetching: false } } }; }