6 files added
3 files modified
| | |
| | | /** |
| | | * 销售订单状态跟踪表-卸货 |
| | | */ |
| | | const SO_BILL_TRACKING_UNLOAD = "C001-06"; |
| | | const SO_BILL_TRACKING_UNLOAD = "C001-06"; |
| | | |
| | | /** |
| | | * 附件 |
| | | */ |
| | | const ATTACHMENT = "C100"; |
| | | |
| | | } |
New file |
| | |
| | | <?php |
| | | |
| | | namespace Home\Controller; |
| | | |
| | | use Home\Common\FIdConst; |
| | | use Home\Service\AttachmentService; |
| | | use Home\Service\UserService; |
| | | |
| | | /** |
| | | * 附件Controller |
| | | * |
| | | * @author iem |
| | | * |
| | | */ |
| | | class AttachmentController extends PSIBaseController |
| | | { |
| | | /** |
| | | * 附件列表 |
| | | */ |
| | | public function attachmentList() |
| | | { |
| | | if (IS_POST) { |
| | | $us = new UserService(); |
| | | if (!$us->hasPermission(FIdConst::ATTACHMENT)) { |
| | | die("没有权限"); |
| | | } |
| | | |
| | | $linkTableName = I("post.linkTableName"); |
| | | $linkDataId = I("post.linkDataId"); |
| | | $params =array("linkTableName"=>$linkTableName,"linkDataId"=>$linkDataId); |
| | | $this->ajaxReturn((new AttachmentService())->attachmentList($params)); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | <?php |
| | | |
| | | namespace Home\DAO; |
| | | |
| | | use Home\Common\FIdConst; |
| | | |
| | | /** |
| | | * 附件 DAO |
| | | * |
| | | * @author iem |
| | | */ |
| | | class AttachmentDAO extends PSIBaseExDAO |
| | | { |
| | | |
| | | /** |
| | | * 附件列表 |
| | | * |
| | | * @param array $params |
| | | * @return array |
| | | */ |
| | | public function attachmentList($params) |
| | | { |
| | | $db = $this->db; |
| | | |
| | | $loginUserId = $params["loginUserId"]; |
| | | |
| | | // 查询条件 |
| | | $linkTableName = $params["linkTableName"]; |
| | | $linkDataId = $params["linkDataId"]; |
| | | |
| | | $sql = "select id,file_name,full_name,file_type,link_table_name,link_data_id,create_by,create_on,status |
| | | from t_c_attachment a |
| | | where (1 = 1) "; |
| | | $queryParams = []; |
| | | |
| | | $ds = new DataOrgDAO($db); |
| | | $rs = $ds->buildSQL(FIdConst::ATTACHMENT, "a", $loginUserId); |
| | | if ($rs) { |
| | | $sql .= " and " . $rs[0]; |
| | | $queryParams = array_merge($queryParams, $rs[1]); |
| | | } |
| | | |
| | | $sql .= " and link_table_name = '%s' "; |
| | | $queryParams[] = "$linkTableName"; |
| | | $sql .= " and link_data_id = '%s' "; |
| | | $queryParams[] = "$linkDataId"; |
| | | |
| | | $sql .= " and (a.status is null or a.status = 0) order by a.create_on desc "; |
| | | $data = $db->query($sql, $queryParams); |
| | | |
| | | $result = []; |
| | | foreach ($data as $v) { |
| | | $result[] = [ |
| | | "id" => $v["id"], |
| | | "file_name" => $v["file_name"], |
| | | "full_name" => $v["full_name"], |
| | | "file_type" => $v["file_type"], |
| | | "link_table_name" => $v["link_table_name"], |
| | | "link_data_id" => $v["link_data_id"], |
| | | "create_by" => $v["create_by"], |
| | | "create_on" => $v["create_on"], |
| | | "status" => $v["status"] |
| | | ]; |
| | | } |
| | | |
| | | return $result; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | <?php |
| | | |
| | | namespace Home\Service; |
| | | |
| | | use Home\DAO\AttachmentDAO; |
| | | |
| | | /** |
| | | * 附件 Service |
| | | * |
| | | * @author iem |
| | | */ |
| | | class AttachmentService extends PSIBaseExService |
| | | { |
| | | private $LOG_CATEGORY = "附件管理"; |
| | | |
| | | public function attachmentList($params) |
| | | { |
| | | if ($this->isNotOnline()) { |
| | | return $this->emptyResult(); |
| | | } |
| | | |
| | | $params["loginUserId"] = $this->getLoginUserId(); |
| | | |
| | | $dao = new AttachmentDAO($this->db()); |
| | | |
| | | return $dao->attachmentList($params); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | <layout name="layout" /> |
| | | |
| | | <script src="{$uri}Public/Scripts/PSI/Attachment/Attachment.js?dt={$dtFlag}" type="text/javascript"></script> |
| | | |
| | | <script> |
| | | Ext.onReady(function () { |
| | | var app = Ext.create("PSI.App", { |
| | | userName: "{$loginUserName}", |
| | | productionName: "{$productionName}", |
| | | appHeaderInfo: { |
| | | title: "{$title}", |
| | | iconCls: "PSI-fid-8996" |
| | | } |
| | | }); |
| | | |
| | | app.add(Ext.create("PSI.Attachment.AttachmentList", { |
| | | |
| | | })); |
| | | }); |
| | | </script> |
| | |
| | | |
| | | <script src="{$uri}Public/Lodop/LodopFuncs.js?dt={$dtFlag}" type="text/javascript"></script> |
| | | |
| | | <script src="{$uri}Public/Scripts/PSI/Attachment/AttachmentList.js?dt={$dtFlag}" type="text/javascript"></script> |
| | | |
| | | <script> |
| | | Ext.onReady(function () { |
| | | var app = Ext.create("PSI.App", { |
New file |
| | |
| | | /** |
| | | * 选择用户 |
| | | */ |
| | | Ext.define("PSI.Attachment.AttachmentList", { |
| | | extend: "PSI.AFX.BaseDialogForm", |
| | | |
| | | config: { |
| | | parentForm: null, |
| | | linkTableName: "", |
| | | linkDataId:"" |
| | | }, |
| | | |
| | | title: "附件列表", |
| | | width: 800, |
| | | height: 600, |
| | | modal: true, |
| | | layout: "fit", |
| | | |
| | | initComponent: function () { |
| | | var me = this; |
| | | Ext.define("PSIAttachment_AttachmentList", { |
| | | extend: "Ext.data.Model", |
| | | fields: ["id", "fileName", "fullName", "fileType","linkTableName","linkDataId","createOn"] |
| | | }); |
| | | |
| | | var userStore = Ext.create("Ext.data.Store", { |
| | | model: "PSIAttachment_AttachmentList", |
| | | autoLoad: false, |
| | | data: [] |
| | | }); |
| | | |
| | | var grid = Ext.create("Ext.grid.Panel", { |
| | | cls: "PSI", |
| | | header: { |
| | | height: 30, |
| | | title: me.formatGridHeaderTitle("附件") |
| | | }, |
| | | padding: 5, |
| | | selModel: { |
| | | mode: "MULTI" |
| | | }, |
| | | selType: "checkboxmodel", |
| | | viewConfig: { |
| | | deferEmptyText: false, |
| | | emptyText: "请选择附件。" |
| | | }, |
| | | store: userStore, |
| | | columnLines: true, |
| | | columns: [{ |
| | | header: "附件名", |
| | | dataIndex: "fileName", |
| | | width: 300, |
| | | menuDisabled: true |
| | | }, { |
| | | header: "附件类型", |
| | | dataIndex: "fileType", |
| | | width: 120, |
| | | menuDisabled: true |
| | | }, { |
| | | header: "上传时间", |
| | | dataIndex: "createOn", |
| | | width: 170, |
| | | menuDisabled: true |
| | | }] |
| | | }); |
| | | |
| | | me.__grid = grid; |
| | | |
| | | Ext.apply(me, { |
| | | items: [grid], |
| | | buttons: [{ |
| | | text: "添加附件", |
| | | formBind: true, |
| | | iconCls: "PSI-button-add", |
| | | handler: me.onOK, |
| | | scope: me |
| | | }, { |
| | | text: "关闭", |
| | | handler: function () { |
| | | me.close(); |
| | | }, |
| | | scope: me |
| | | }], |
| | | listeners: { |
| | | show: { |
| | | fn: me.onWndShow, |
| | | scope: me |
| | | } |
| | | } |
| | | }); |
| | | |
| | | me.callParent(arguments); |
| | | }, |
| | | |
| | | onWndShow: function () { |
| | | var me = this; |
| | | var pLinkTableName = me.getLinkTableName(); |
| | | var pLinkDataId = me.getLinkDataId(); |
| | | var userStore = me.__grid.getStore(); |
| | | |
| | | var el = me.getEl() || Ext.getBody(); |
| | | el.mask("数据加载中..."); |
| | | Ext.Ajax.request({ |
| | | url: PSI.Const.BASE_URL |
| | | + "Home/Attachment/attachmentList", |
| | | params: { |
| | | linkTableName: pLinkTableName, |
| | | linkDataId:pLinkDataId |
| | | }, |
| | | method: "POST", |
| | | callback: function (options, success, response) { |
| | | if (success) { |
| | | var data = Ext.JSON |
| | | .decode(response.responseText); |
| | | |
| | | for (var i = 0; i < data.length; i++) { |
| | | var item = data[i]; |
| | | userStore.add({ |
| | | id: item.id, |
| | | fileName: item.file_name, |
| | | fullName: item.full_Name, |
| | | fileType: item.file_type, |
| | | linkTableName:item.link_table_name, |
| | | linkDataId:item.link_data_id, |
| | | createOn:item.create_on |
| | | }); |
| | | } |
| | | } |
| | | |
| | | el.unmask(); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | onOK: function () { |
| | | var grid = this.__grid; |
| | | |
| | | var items = grid.getSelectionModel().getSelection(); |
| | | if (items == null || items.length == 0) { |
| | | PSI.MsgBox.showInfo("没有选择用户"); |
| | | |
| | | return; |
| | | } |
| | | |
| | | if (this.getParentForm()) { |
| | | this.getParentForm().setSelectedUsers(items); |
| | | } |
| | | |
| | | this.close(); |
| | | } |
| | | }); |
| | |
| | | scope: me, |
| | | handler: me.onCommit |
| | | }, { |
| | | text: "附件", |
| | | // hidden: me.getPermission().commit == "0", |
| | | id: "buttonAttachment", |
| | | scope: me, |
| | | handler: me.onAttachment |
| | | }, { |
| | | hidden: me.getPermission().commit == "0", |
| | | xtype: "tbseparator" |
| | | }, { |
| | |
| | | }); |
| | | }, |
| | | |
| | | onAttachment: function () { |
| | | var item = this.getMainGrid().getSelectionModel().getSelection(); |
| | | if (item == null || item.length != 1) { |
| | | PSI.MsgBox.showInfo("请选择一条出库单"); |
| | | return; |
| | | } |
| | | var bill = item[0]; |
| | | |
| | | var form = Ext.create("PSI.Attachment.AttachmentList", { |
| | | parentForm: this, |
| | | linkTableName: "t_ws_bill", |
| | | linkDataId:bill.get("id") |
| | | }); |
| | | form.show(); |
| | | }, |
| | | |
| | | gotoMainGridRecord: function (id) { |
| | | var me = this; |
| | | var grid = me.getMainGrid(); |