Browse Source

后台模修编辑修改

moshaorui 1 month ago
parent
commit
a4995662d9
3 changed files with 24 additions and 17 deletions
  1. 12 6
      app/Admin/Forms/AceLeft.php
  2. 1 1
      config/admin.php
  3. 11 10
      resources/views/admin/pages-custom/ace.blade.php

+ 12 - 6
app/Admin/Forms/AceLeft.php

@@ -7,19 +7,25 @@ use App\Models\DistAdminDistributor;
 use Symfony\Component\HttpFoundation\Response;
 use Dcat\Admin\Widgets\Form;
 use App\Admin\Repositories\DistAppearance;
+use App\Admin\Repositories\DistAdminDistributor as DistAdminDistributorRepository;
 
 class AceLeft extends Form
 {
     public function form()
     {
         //供应商选择
-        $this->selectTable('dist_id', 'Select Distributor')
+//        $this->selectTable('dist_id', 'Select Distributor')
+//            ->width(12,12)
+//            ->setLabelClass('d-flex')
+//            ->title('Select Distributor')
+//            ->placeholder('Select Distributor')
+//            ->model(DistAdminDistributor::class, 'id', 'client_code')
+//            ->from(DistDistributorTable::make());
+
+        $this->select('dist_id', 'Select Distributor')
+            ->options(DistAdminDistributorRepository::selectOptionsNew(1000))
             ->width(12,12)
-            ->setLabelClass('d-flex')
-            ->title('Select Distributor')
-            ->placeholder('Select Distributor')
-            ->model(DistAdminDistributor::class, 'id', 'client_code')
-            ->from(DistDistributorTable::make());
+            ->setLabelClass('d-flex');
 
         //主题选择
         $this->select('appearance_id','Select Appearance')

+ 1 - 1
config/admin.php

@@ -213,7 +213,7 @@ return [
     |--------------------------------------------------------------------------
     */
     'helpers' => [
-        'enable' => true,
+        'enable' => false,
     ],
 
     /*

+ 11 - 10
resources/views/admin/pages-custom/ace.blade.php

@@ -282,7 +282,7 @@
 
         var changeIframeUrl = function() {
             appearance_id = $('select[name="appearance_id"]').val();
-            dist_id = $('input[name="dist_id"]').val();
+            dist_id = $('select[name="dist_id"]').val();
             var iframeUrl = '/prime-control/dist-template-var?templateCode=' + fileId + '&appearanceId=' + appearance_id+'&distId=' + dist_id;
             $('#iframeModal iframe').attr('src', iframeUrl);
         }
@@ -302,7 +302,7 @@
                     shade: [0.5, '#000'] // 设置遮罩层
                 });
                 var appearance_id = $('select[name="appearance_id"]').val();
-                var dist_id = $('input[name="dist_id"]').val();
+                var dist_id = $('select[name="dist_id"]').val();
                 fileId = $(this).attr('file_id');
                 //得到文件名
                 fileName = $(this).html();
@@ -337,7 +337,7 @@
         // 加载代码树
         var postData = function () {
             var appearance_id = $('select[name="appearance_id"]').val();
-            var dist_id = $('input[name="dist_id"]').val();
+            var dist_id = $('select[name="dist_id"]').val();
             //改变iframe的url
             changeIframeUrl();
             $.ajax({
@@ -373,7 +373,7 @@
             postData();
         });
         //分销商选择
-        $('input[name="dist_id"]').change(function() {
+        $('select[name="dist_id"]').change(function() {
             //console.log('-------0-----')
             loadingIndex = layer.load(1, {
                 shade: [0.5, '#000'] // 设置遮罩层
@@ -413,7 +413,8 @@
         // 模版编辑保存
         $("#save-btn").click(function() {
             var appearance_id = $('select[name="appearance_id"]').val();
-            var dist_id = $('input[name="dist_id"]').val();
+            var dist_id = $('select[name="dist_id"]').val();
+            // console.log(dist_id);
             var template_id = $("#template_id").val();
             var content = editor.getValue();
             if (template_id == '') {
@@ -452,7 +453,7 @@
         // 模版发布
         $("#publish-btn").click(function() {
             var appearance_id = $('select[name="appearance_id"]').val();
-            var dist_id = $('input[name="dist_id"]').val();
+            var dist_id = $('select[name="dist_id"]').val();
 
             if (appearance_id == '') {
                 Dcat.error('操作失败:请先选择主题');
@@ -516,7 +517,7 @@
             var filePathName = $('#file_path_name').val();
             var fileInputName = $('#file_name_input').val();
             var appearanceId = $('select[name="appearance_id"]').val();
-            var distId = $('input[name="dist_id"]').val();
+            var distId = $('select[name="dist_id"]').val();
             if (fileInputName == '') {
                 Dcat.error('文件名不能为空');
                 return false;
@@ -533,7 +534,7 @@
                     var filePathName = "";
                     var fileInputName = "";
                     var appearanceId = $('select[name="appearance_id"]').val();
-                    var distId = $('input[name="dist_id"]').val();
+                    var distId = $('select[name="dist_id"]').val();
                     var fileId = $(this).attr('file_id');
                     var fileName = $(this).attr('file_name');
                     msg = '确定要删除'+fileName+'吗?';
@@ -551,7 +552,7 @@
                 shade: [0.5, '#000'] // 设置遮罩层
             });
             var appearanceId = $('select[name="appearance_id"]').val();
-            var distId = $('input[name="dist_id"]').val();
+            var distId = $('select[name="dist_id"]').val();
             if (fileId == '') {
                 Dcat.error('操作失败:请先选择模板');
                 return false;
@@ -604,7 +605,7 @@
             //
             var logId = $(this).attr('log_id');
             var appearanceId = $('select[name="appearance_id"]').val();
-            var distId = $('input[name="dist_id"]').val();
+            var distId = $('select[name="dist_id"]').val();
             $.ajax({
                 url: '/prime-control/dist-template/ace',
                 method: 'POST',