您的位置:首页 > 其它

工作框架各种使用整理 -- 展示数据列表并做update

2016-07-26 16:12 459 查看
<!--ProductCategory.xml-->

<?xml version="1.0" encoding="UTF-8"?>
<screen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://moqui.org/xsd/xml-screen-2.0.xsd"
default-menu-title="ProductCategory" default-menu-index="1">

<subscreens default-item="ProductCategoryList"/>

<widgets>
<subscreens-panel id="productCategory-panel" type="popup" title="ProductCategory"/>
</widgets>
</screen>


<!--ProductCategoryList.xml-->

<?xml version="1.0" encoding="UTF-8"?>
<screen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://moqui.org/xsd/xml-screen-2.0.xsd"
default-menu-title="ProductCategoryList" default-menu-index="1">

<transition name="editProductCategoryContent"><default-response url="../EditProductCategoryContent"/></transition>

<actions>
<entity-find entity-name="mantle.product.category.ProductCategory" list="productCategoryList">
<search-form-inputs />
</entity-find>
</actions>
<widgets>
<form-list name="ListProductCategory" list="productCategoryList">
<field name="productCategoryId">
<default-field>
<link url="editProductCategoryContent" text="${productCategoryId}"/>
</default-field>
</field>
<auto-fields-entity entity-name="mantle.product.category.ProductCategory" field-type="find-display" include="nonpk"/>
</form-list>
</widgets>
</screen>


<!--EditProductCategoryContent.xml-->

<?xml version="1.0" encoding="UTF-8"?>
<screen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://moqui.org/xsd/xml-screen-2.0.xsd"
default-menu-title="ProductCategoryList" default-menu-index="1">
<parameter name="productCategoryId" required="true"/>

<transition name="updateProductCategoryContent"><service-call name="update#mantle.product.category.ProductCategoryContent"/>
<default-response url="."/></transition>
<transition name="deleteProductCategoryContent"><service-call name="delete#mantle.product.category.ProductCategoryContent"/>
<default-response url="."/></transition>

<transition name="uploadProductCategoryContent">
<actions><script><![CDATA[
import org.moqui.context.ResourceReference
org.moqui.context.ExecutionContext ec = context.ec

org.apache.commons.fileupload.FileItem contentFile = context.contentFile
String fileName = contentFile.getName()
ec.logger.info("Uploading file [${fileName}] for ProductCategory [${productCategoryId}] in repository [${repositoryName}] with content type [${categoryContentTypeEnumId}] and locale [${locale}]")

// String contentLocation = "content://${repositoryName}/mantle/ProductCategory/${productCategoryId}/content/${fileName}"
String contentLocation = "dbresource://mantle/productCategory/${productCategoryId}/content/${fileName}"
ResourceReference newRr = ec.resource.getLocationReference(contentLocation)
InputStream fileStream = contentFile.getInputStream()
newRr.putStream(fileStream)
fileStream.close()

ec.service.sync().name("create", "mantle.product.category.ProductCategoryContent").parameters([productCategoryId: productCategoryId,
contentLocation: contentLocation, categoryContentTypeEnumId: categoryContentTypeEnumId, locale: locale]).call()
]]></script></actions>
<default-response url="."/>
</transition>

<actions>
<entity-find entity-name="mantle.product.category.ProductCategoryContent" list="productCategoryContentList">
<econdition field-name="productCategoryId" from="productCategoryId"/>
<order-by field-name="contentLocation"/>
</entity-find>
</actions>
<widgets>
<container>
<container-dialog id="UploadCategoryContentDialog" button-text="Upload Content">
<form-single name="UploadCategoryProductContent" transition="uploadProductCategoryContent">
<field name="productCategoryId"><default-field><hidden/></default-field></field>
<field name="contentFile"><default-field><file/></default-field></field>
<field name="categoryContentTypeEnumId"><default-field>
<drop-down><entity-options>
<entity-find entity-name="moqui.basic.Enumeration">
<econdition field-name="enumTypeId" value="ProductCategoryContentType"/>
<order-by field-name="description"/>
</entity-find>
</entity-options></drop-down>
</default-field></field>
<field name="locale"><default-field><text-line size="6"/></default-field></field>
<field name="submitButton"><default-field><submit confirmation="Really Add?"/></default-field></field>
</form-single>
</container-dialog>
</container>
<form-list name="ListProductCategoryContent" transition="updateProductCategoryContent" list="productCategoryContentList">
<field name="productCategoryContentId"><default-field><display/></default-field></field>
<field name="productCategoryId"><default-field><display/></default-field></field>
<field name="contentLocation"><default-field title="Location"><display/></default-field></field>
<field name="categoryContentTypeEnumId"><default-field title="Content Type">
<drop-down><entity-options><entity-find entity-name="moqui.basic.Enumeration">
<econdition field-name="enumTypeId" value="ProductCategoryContentType"/>
<order-by field-name="description"/>
</entity-find></entity-options></drop-down>
</default-field></field>
<field name="locale"><default-field><text-line size="6"/></default-field></field>
<field name="submitButton"><default-field title="Update"><submit/></default-field></field>
<field name="deleteLink">
<default-field title=" ">
<!-- the parameters for this will be auto-mapped: productId, contentLocation -->
<link url="deleteProductCategoryContent" text="Delete" confirmation="Really Delete?"/>
</default-field>
</field>
</form-list>

</widgets>
</screen>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: