This commit is contained in:
dingguodong
2021-08-19 10:39:34 +08:00
2 changed files with 60 additions and 34 deletions
+32 -15
View File
@@ -255,21 +255,8 @@ class docModel extends model
->fetchAll('id');
}
$projects = $this->dao->select('t1.id, t1.name')->from(TABLE_PROJECT)->alias('t1')
->leftJoin(TABLE_DOC)->alias('t2')->on('t1.id=t2.project')
->where('t2.id')->in(array_keys($docs))
->andWhere('t2.execution')->eq(0)
->fetchPairs();
$executions = $this->dao->select('t1.id, t1.name')->from(TABLE_EXECUTION)->alias('t1')
->leftJoin(TABLE_DOC)->alias('t2')->on('t1.id=t2.execution')
->where('t2.id')->in(array_keys($docs))
->fetchPairs();
$products = $this->dao->select('t1.id, t1.name')->from(TABLE_PRODUCT)->alias('t1')
->leftJoin(TABLE_DOC)->alias('t2')->on('t1.id=t2.product')
->where('t2.id')->in(array_keys($docs))
->fetchPairs();
/* Get projects, executions and products by docIdList. */
list($projects, $executions, $products) = $this->getObjectsByDoc(array_keys($docs));
$docContents = $this->dao->select('*')->from(TABLE_DOCCONTENT)->where('doc')->in(array_keys($docs))->orderBy('version,doc')->fetchAll('doc');
@@ -322,6 +309,36 @@ class docModel extends model
return $docs;
}
/**
* Get projects, executions and products by docIdList.
*
* @param array $docIdList
* @access public
* @return array
*/
public function getObjectsByDoc($docIdList = array())
{
if(empty($docIdList)) return array();
$projects = $this->dao->select('t1.id, t1.name')->from(TABLE_PROJECT)->alias('t1')
->leftJoin(TABLE_DOC)->alias('t2')->on('t1.id=t2.project')
->where('t2.id')->in($docIdList)
->andWhere('t2.execution')->eq(0)
->fetchPairs();
$executions = $this->dao->select('t1.id, t1.name')->from(TABLE_EXECUTION)->alias('t1')
->leftJoin(TABLE_DOC)->alias('t2')->on('t1.id=t2.execution')
->where('t2.id')->in($docIdList)
->fetchPairs();
$products = $this->dao->select('t1.id, t1.name')->from(TABLE_PRODUCT)->alias('t1')
->leftJoin(TABLE_DOC)->alias('t2')->on('t1.id=t2.product')
->where('t2.id')->in($docIdList)
->fetchPairs();
return array($projects, $executions, $products);
}
/**
* Get docs.
*
+28 -19
View File
@@ -9,33 +9,42 @@
*/
function deleteMemeber(projectID, account, userID)
{
if(confirm(confirmUnlinkMember))
bootbox.confirm(confirmUnlinkMember, function(result)
{
if(!result) return true;
var removeConfirm = '';
var tipsLink = createLink('project', 'ajaxGetUnlinkTips', 'projectID=' + projectID + '&account=' + account);
$.get(tipsLink, function(tips)
{
if(!tips)
var unlinkURL = createLink('project', 'unlinkMember', 'projectID=' + projectID + '&userID=' + userID + '&confirm=yes');
if(!tips) unlinkMember(unlinkURL);
if(tips)
{
var unlinkURL = createLink('project', 'unlinkMember', 'projectID=' + projectID + '&userID=' + userID + '&confirm=yes&removeExecution=no');
}
else
{
if(confirm(tips))
bootbox.confirm(tips, function(result)
{
var unlinkURL = createLink('project', 'unlinkMember', 'projectID=' + projectID + '&userID=' + userID + '&confirm=yes&removeExecution=yes');
}
else
{
var unlinkURL = createLink('project', 'unlinkMember', 'projectID=' + projectID + '&userID=' + userID + '&confirm=yes&removeExecution=no');
}
if(result) unlinkURL = createLink('project', 'unlinkMember', 'projectID=' + projectID + '&userID=' + userID + '&confirm=yes&removeExecution=yes');
unlinkMember(unlinkURL);
})
}
$.get(unlinkURL, function(data)
{
data = JSON.parse(data);
if(data.result == 'success') window.location.reload();
});
})
}
})
}
/**
* Unlink member from project.
*
* @param unlinkURL $unlinkURL
* @access public
* @return void
*/
function unlinkMember(unlinkURL)
{
$.get(unlinkURL, function(data)
{
data = JSON.parse(data);
if(data.result == 'success') window.location.reload();
});
}