|
|
|
var mock=require('../../public/javascripts/mock')
|
|
|
|
const multipart = require("connect-multiparty");
|
|
|
|
var multipartMiddleware = multipart();
|
|
|
|
module.exports= {
|
|
|
|
//**通用右键菜单接口
|
|
|
|
addContextMenu:function (router,prefix, label)
|
|
|
|
{
|
|
|
|
router.post(`/${prefix}/:y/addEmpty`, function (req, res, next) {
|
|
|
|
return res.json(mock.ok(`${label}插入第${+req.params.y + 1}空白行成功`))
|
|
|
|
})
|
|
|
|
|
|
|
|
router.post(`/${prefix}/:y/copy`, function (req, res, next) {
|
|
|
|
return res.json(mock.ok(`拷贝${+req.params.y + 1}行${label}并插入到下一行成功`))
|
|
|
|
})
|
|
|
|
|
|
|
|
router.delete(`/${prefix}/:y/del`, function (req, res, next) {
|
|
|
|
return res.json(mock.ok(`删除第${+req.params.y + 1}行${label}成功`))
|
|
|
|
})
|
|
|
|
|
|
|
|
router.delete(`/${prefix}/:y/clean`, function (req, res, next) {
|
|
|
|
return res.json(mock.ok(`清空第${+req.params.y + 1}行${label}成功`))
|
|
|
|
})
|
|
|
|
|
|
|
|
router.patch(`/${prefix}/:y/up`, function (req, res, next) {
|
|
|
|
return res.json(mock.ok(`${label}第${+req.params.y + 1}行跟第${+req.params.y}行交换位置`))
|
|
|
|
})
|
|
|
|
|
|
|
|
router.patch(`/${prefix}/:y/down`, function (req, res, next) {
|
|
|
|
return res.json(mock.ok(`${label}第${+req.params.y + 1}行跟第${+req.params.y + 2}行交换位置`))
|
|
|
|
})
|
|
|
|
|
|
|
|
router.put(`/${prefix}/:y/:column`, multipartMiddleware,function (req, res, next) {
|
|
|
|
return res.json(mock.ok(`${label}第${+req.params.y + 1}行${label}:列${req.params.column}更新值:${req.body.value}成功`))
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|