|
@@ -0,0 +1,254 @@
|
|
|
+var form, table;
|
|
|
+layui.config({
|
|
|
+ base: 'js/encryption/'
|
|
|
+}).use(['layer', 'form', 'jquery', 'table', 'laydate', 'upload', 'ajax'], function () {
|
|
|
+ layer = layui.layer;
|
|
|
+ laydate = layui.laydate;
|
|
|
+ upload = layui.upload;
|
|
|
+ table = layui.table;
|
|
|
+ form = layui.form;
|
|
|
+ $ = layui.jquery;
|
|
|
+ ly = layui.ajax;
|
|
|
+
|
|
|
+ // 主要表格
|
|
|
+ table.render({
|
|
|
+ elem: '#transcriptionTable',
|
|
|
+ url: PAGE_BASIC + '/commandTranscription/getCommandTranscriptionListByPage',
|
|
|
+ toolbar: '#transcriptionTable_toolbar', //开启头部工具栏,并为其绑定左侧模板
|
|
|
+ page: true,
|
|
|
+ cols: [
|
|
|
+ [{
|
|
|
+ type: 'numbers',
|
|
|
+ title: '序号'
|
|
|
+ }, {
|
|
|
+ field: 'content',
|
|
|
+ title: '指挥内容',
|
|
|
+ }, {
|
|
|
+ field: 'answer',
|
|
|
+ title: '回复内容',
|
|
|
+ }, {
|
|
|
+ field: 'create_time',
|
|
|
+ title: '创建时间'
|
|
|
+ }, {
|
|
|
+ fixed: 'right',
|
|
|
+ title: '操作',
|
|
|
+ toolbar: '#transcriptionTable_bar',
|
|
|
+ width: 250
|
|
|
+ }]
|
|
|
+ ]
|
|
|
+ });
|
|
|
+
|
|
|
+ //头工具栏事件(主要表格)
|
|
|
+ table.on('toolbar(transcriptionTable)', function (obj) {
|
|
|
+ var checkStatus = table.checkStatus(obj.config.id);
|
|
|
+ switch (obj.event) {
|
|
|
+ case 'add': //新增
|
|
|
+ $(".main").addClass("layui-hide").removeClass("layui-show");
|
|
|
+ $(".add").addClass("layui-show").removeClass("layui-hide");
|
|
|
+ $('#submit').attr('submitType', 'insert');
|
|
|
+ $(".add .header_title span").html("新增");
|
|
|
+ $('.planCode').addClass("layui-show").removeClass("layui-hide");
|
|
|
+ $('#transcriptionInfo')[0].reset();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //监听行工具事件(主要表格)
|
|
|
+ table.on('tool(transcriptionTable)', function (obj) {
|
|
|
+ var data = obj.data;
|
|
|
+ //console.log(obj)
|
|
|
+ if (obj.event === 'del') {
|
|
|
+ layer.confirm('是否确认删除', function (index) {
|
|
|
+ deletePlan(data.id);
|
|
|
+ layer.close(index);
|
|
|
+ });
|
|
|
+ } else if (obj.event === 'edit') {
|
|
|
+ $(".main").addClass("layui-hide").removeClass("layui-show");
|
|
|
+ $(".add").addClass("layui-show").removeClass("layui-hide");
|
|
|
+ $(".add .header_title span").html("编辑");
|
|
|
+ $('#submit').attr('submitType', 'update');
|
|
|
+ $('#transcriptionInfo')[0].reset();
|
|
|
+ $('#commandContent').attr('readonly', false);
|
|
|
+ $('#uploadBtn').addClass('layui-hide');
|
|
|
+ // 数据初始化
|
|
|
+ initPlan(data.record_id);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 监听提交按钮
|
|
|
+ form.on('submit(submit)', function (data) {
|
|
|
+ var submitType = data.elem.getAttribute("submitType");
|
|
|
+ // 新增
|
|
|
+ if (submitType == 'insert') {
|
|
|
+ addPlan();
|
|
|
+ return false;
|
|
|
+ } else if (submitType == 'update') {
|
|
|
+ updatePlan();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 查询
|
|
|
+ $(".search_btn").click(function () {
|
|
|
+ var queryValue = $.trim($("#queryValue").val());
|
|
|
+ table.reload('transcriptionTable', {
|
|
|
+ where: {
|
|
|
+ "queryVal": queryValue
|
|
|
+ },
|
|
|
+ page: {
|
|
|
+ curr: 1 //重新从第 1 页开始
|
|
|
+ }
|
|
|
+ }); //只重载数据
|
|
|
+ });
|
|
|
+
|
|
|
+ //基础数据搜索回车事件
|
|
|
+ $('#queryValue').bind('keypress', function (event) {
|
|
|
+ if (event.keyCode == "13") {
|
|
|
+ var queryValue = $.trim($("#queryValue").val());
|
|
|
+ table.reload('transcriptionTable', {
|
|
|
+ where: {
|
|
|
+ "queryVal": queryValue
|
|
|
+ },
|
|
|
+ page: {
|
|
|
+ curr: 1 //重新从第 1 页开始
|
|
|
+ }
|
|
|
+ }); //只重载数据
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 返回
|
|
|
+ $(".back").click(function () {
|
|
|
+ $(".main").addClass("layui-show").removeClass("layui-hide");
|
|
|
+ $(".add").addClass("layui-hide").removeClass("layui-show");
|
|
|
+ })
|
|
|
+
|
|
|
+});
|
|
|
+
|
|
|
+/**
|
|
|
+ * 新增会议转写
|
|
|
+ */
|
|
|
+function addPlan() {
|
|
|
+ var postData = form.val('transcriptionInfo');
|
|
|
+ var index = layer.load(2);
|
|
|
+ ly.ajax({
|
|
|
+ type: 'POST',
|
|
|
+ url: PAGE_BASIC + '/commandTranscription/insertCommandTranscription',
|
|
|
+ dataType: 'json',
|
|
|
+ data: {
|
|
|
+ jsonStr:JSON.stringify(postData)
|
|
|
+ },
|
|
|
+ success: function (json) {
|
|
|
+ console.info(json)
|
|
|
+ if (json.result) {
|
|
|
+ layer.msg("新增成功");
|
|
|
+ $(".main").addClass("layui-show").removeClass("layui-hide");
|
|
|
+ $(".add").addClass("layui-hide").removeClass("layui-show");
|
|
|
+ reloadTable();
|
|
|
+ } else {
|
|
|
+ layer.msg("新增失败");
|
|
|
+ }
|
|
|
+ layer.close(index);
|
|
|
+ },
|
|
|
+ error: function (msg) {
|
|
|
+ layer.close(index);
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 编辑会议转写
|
|
|
+ */
|
|
|
+function updatePlan() {
|
|
|
+ var postData = form.val('transcriptionInfo');
|
|
|
+ var index = layer.load(2);
|
|
|
+ ly.ajax({
|
|
|
+ type: 'POST',
|
|
|
+ url: PAGE_BASIC + '/commandTranscription/updateCommandTranscription',
|
|
|
+ dataType: 'json',
|
|
|
+ data: postData,
|
|
|
+ success: function (json) {
|
|
|
+ if (json.result) {
|
|
|
+ layer.msg("编辑成功");
|
|
|
+ $(".main").addClass("layui-show").removeClass("layui-hide");
|
|
|
+ $(".add").addClass("layui-hide").removeClass("layui-show");
|
|
|
+ reloadTable();
|
|
|
+ } else {
|
|
|
+ layer.msg("编辑失败");
|
|
|
+ }
|
|
|
+ layer.close(index);
|
|
|
+ },
|
|
|
+ error: function (msg) {
|
|
|
+ layer.close(index);
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 回显会议转写详情
|
|
|
+ * @param recordId
|
|
|
+ */
|
|
|
+function initPlan(recordId) {
|
|
|
+ var index = layer.load(2);
|
|
|
+ ly.ajax({
|
|
|
+ type: 'GET',
|
|
|
+ url: PAGE_BASIC + '/commandTranscription/getCommandTranscriptionById',
|
|
|
+ dataType: 'json',
|
|
|
+ data: {
|
|
|
+ "recordId": recordId,
|
|
|
+ },
|
|
|
+ success: function (json) {
|
|
|
+ if (json.result) {
|
|
|
+ $('#recordId').empty().val(recordId);
|
|
|
+ $('#commandName').empty().val(json.data.command_name);
|
|
|
+ $('#startTime').empty().val(json.data.start_time);
|
|
|
+ $('#commandContent').val(json.data.command_content);
|
|
|
+ form.render();
|
|
|
+ } else {
|
|
|
+ layer.msg("数据获取失败");
|
|
|
+ }
|
|
|
+ layer.close(index);
|
|
|
+ },
|
|
|
+ error: function (msg) {
|
|
|
+ layer.close(index);
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 删除会议转写
|
|
|
+ * @param recordId
|
|
|
+ */
|
|
|
+function deletePlan(recordId) {
|
|
|
+ var index = layer.load(2);
|
|
|
+ ly.ajax({
|
|
|
+ type: 'POST',
|
|
|
+ url: PAGE_BASIC + '/commandTranscription/deleteCommandTranscription',
|
|
|
+ dataType: 'json',
|
|
|
+ data: {
|
|
|
+ "recordId": recordId,
|
|
|
+ },
|
|
|
+ success: function (json) {
|
|
|
+ if (json.result) {
|
|
|
+ layer.msg("删除成功");
|
|
|
+ reloadTable();
|
|
|
+ } else {
|
|
|
+ layer.msg("删除失败");
|
|
|
+ }
|
|
|
+ layer.close(index);
|
|
|
+ },
|
|
|
+ error: function (msg) {
|
|
|
+ layer.close(index);
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 重载数据表格
|
|
|
+ */
|
|
|
+function reloadTable() {
|
|
|
+ table.reload('transcriptionTable', {
|
|
|
+ page: {
|
|
|
+ curr: 1 //重新从第 1 页开始
|
|
|
+ }
|
|
|
+ }); //只重载数据
|
|
|
+}
|