/// <summary>
/// 生成数字字典Js文件
/// </summary>
/// <returns></returns>
public ActionResult GenerateDictJs()
{
var path = Path.Combine(HttpRuntime.AppDomainAppPath, @"KScripts\_wisdomsite\dictionary.js");
if (System.IO.File.Exists(path))
{
System.IO.File.Delete(path);
}
using (var tt = new RealNameSystemEntities())
{
var ts = tt.sys_dict_type.Where(p => p.is_selectable == 0).ToDictionary(p => p.type_code, p => p.type_name);
using (StreamWriter sw = System.IO.File.AppendText(path))
{
sw.WriteLine("window.dictTransfer = {");
foreach (var t in ts)
{
sw.WriteLine(" /** {0} **/", t.Value);
sw.WriteLine(" {0}: [", t.Key);
foreach (var item in tt.sys_dict_item.Where(p => p.type_code == t.Key && p.del_flag == 0).ToList())
{
sw.WriteLine(" {{ text: '{0}', value: '{1}' }},", item.name, item.code);
}
sw.WriteLine(" ],");
}
sw.WriteLine("}");
sw.Flush();
}
}
return Json("生成成功", JsonRequestBehavior.AllowGet);
/// 生成数字字典Js文件
/// </summary>
/// <returns></returns>
public ActionResult GenerateDictJs()
{
var path = Path.Combine(HttpRuntime.AppDomainAppPath, @"KScripts\_wisdomsite\dictionary.js");
if (System.IO.File.Exists(path))
{
System.IO.File.Delete(path);
}
using (var tt = new RealNameSystemEntities())
{
var ts = tt.sys_dict_type.Where(p => p.is_selectable == 0).ToDictionary(p => p.type_code, p => p.type_name);
using (StreamWriter sw = System.IO.File.AppendText(path))
{
sw.WriteLine("window.dictTransfer = {");
foreach (var t in ts)
{
sw.WriteLine(" /** {0} **/", t.Value);
sw.WriteLine(" {0}: [", t.Key);
foreach (var item in tt.sys_dict_item.Where(p => p.type_code == t.Key && p.del_flag == 0).ToList())
{
sw.WriteLine(" {{ text: '{0}', value: '{1}' }},", item.name, item.code);
}
sw.WriteLine(" ],");
}
sw.WriteLine("}");
sw.Flush();
}
}
return Json("生成成功", JsonRequestBehavior.AllowGet);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
window.dictTransfer = {
/** 是否 **/
SYS_YES_NO: [
{ text: '是', value: 'YES' },
{ text: '否', value: 'NO' },
]
}