schangxiang@126.com
2024-11-21 60735779c303c2dd10feea45d7fd761103b225e0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
<template>
  <div class="adapterCategories-container">
    <el-card shadow="hover" :body-style="{ paddingBottom: '0' }"> 
      <el-form :model="queryParamsAdapterCategories" ref="queryForm" labelWidth="90">
        <el-row>
          <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10">
            <el-form-item label="关键字">
              <el-input v-model="queryParamsAdapterCategories.searchKey" clearable="" placeholder="单据大类名称,创建人,修改人"/>
              
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUIAdapterCategories">
            <el-form-item label="单据大类名称">
              <el-input v-model="queryParamsAdapterCategories.categoryName" clearable="" placeholder="请输入单据大类名称"/>
              
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUIAdapterCategories">
            <el-form-item label="适配器数量">
              <el-input-number v-model="queryParamsAdapterCategories.adapterNumber"  clearable="" placeholder="请输入适配器数量"/>
              
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" class="mb10">
            <el-form-item>
              <el-button-group style="display: flex; align-items: center;">
                <el-button type="primary"  icon="ele-Search" @click="handleQueryAdapterCategories" v-auth="'adapterCategories:page'" :disabled="disabled_btnAdapterCategories"> 查询 </el-button>
                      <el-button icon="ele-Refresh" @click="resetAdapterCategories"> 重置 </el-button>
                        <el-button icon="ele-ZoomIn" @click="changeAdvanceQueryUIAdapterCategories" v-if="!showAdvanceQueryUIAdapterCategories" style="margin-left:5px;"> 高级查询 </el-button>
                        <el-button icon="ele-ZoomOut" @click="changeAdvanceQueryUIAdapterCategories" v-if="showAdvanceQueryUIAdapterCategories" style="margin-left:5px;"> 隐藏 </el-button>
                <el-button type="primary" style="margin-left:5px;" icon="ele-Plus" @click="openAddAdapterCategories" v-auth="'adapterCategories:add'"> 新增 </el-button>
                <el-button type="primary" style="margin-left:5px;" icon="ele-Upload" @click="openImportExcelAdapterCategories"  v-auth="'adapterCategories:importExcel'" > 导入 </el-button>
                <el-button type="primary" style="margin-left:5px;" icon="ele-Download" @click="handleExportExcelAdapterCategories"  v-auth="'adapterCategories:exportExcel'" > 导出 </el-button>
              </el-button-group>
            </el-form-item>
            
          </el-col>
        </el-row>
      </el-form>
    </el-card>
    <el-card class="full-table" shadow="hover" style="margin-top: 5px">
      <el-table
                ref="tableRefAdapterCategories"
                :data="tableDataAdapterCategories"
                style="width: 100%"
                v-loading="loadingAdapterCategories"
                tooltip-effect="light"
                                row-key="id"
                @sort-change="sortChangeAdapterCategories"
                   :summary-method="getExportTitle" show-summary border="">
        <el-table-column fixed="left" type="index" label="序号" width="55" align="center"/>
        
        <el-table-column fixed="left" label="适配器使用记录" prop="purchaseNo" width="130" align="left" show-overflow-tooltip>
          <template #default="scope">
            <span class="under_line" @click="openDrawer(1, scope.row)">
              {{ scope.row.id }}
            </span>
          </template>
        </el-table-column>
        
        <el-table-column prop="categoryName" label="单据大类名称"  show-overflow-tooltip="" />
        <el-table-column prop="adapterNumber" label="适配器数量"  show-overflow-tooltip="" />
         <el-table-column prop="createTime" label="创建时间" width="130" :formatter="formatDate_T_Time"  show-overflow-tooltip="" />
         <el-table-column prop="updateTime" label="修改时间" width="130" :formatter="formatDate_T_Time"  show-overflow-tooltip="" />
        <el-table-column prop="createUserName" label="创建人"  show-overflow-tooltip="" />
        <el-table-column prop="updateUserName" label="修改人"  show-overflow-tooltip="" />
        <el-table-column label="操作" width="140" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('adapterCategories:update') || auth('adapterCategories:delete')">
          <template #default="scope">
            <el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditAdapterCategories(scope.row)" v-auth="'adapterCategories:update'"> 编辑 </el-button>
            <el-button icon="ele-Delete" size="small" text="" type="primary" @click="delAdapterCategories(scope.row)" v-auth="'adapterCategories:delete'"> 删除 </el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
                v-model:currentPage="tableParamsAdapterCategories.page"
                v-model:page-size="tableParamsAdapterCategories.pageSize"
                :total="tableParamsAdapterCategories.total"
                :page-sizes="[10, 20, 50, 100, 200, 500]"
                small=""
                background=""
                @size-change="handleSizeChangeAdapterCategories"
                @current-change="handleCurrentChangeAdapterCategories"
                layout="total, sizes, prev, pager, next, jumper"
    />
      <printDialogAdapterCategories
        ref="printDialogRefAdapterCategories"
        :title="printAdapterCategoriesTitle"
        @reloadTable="handleQueryAdapterCategories" />
      <editDialogAdapterCategories
        ref="editDialogRefAdapterCategories"
        :title="editAdapterCategoriesTitle"
        @reloadTable="handleQueryAdapterCategories"
      />
      <importExcelDialog
        ref="importExcelDialogRefAdapterCategories"
        :title="importExcelTitleAdapterCategories"
        @parentUploadFun="handleImportExcelAdapterCategories"
        @parentDownFun="handleDownExcelAdapterCategories"
      />
    </el-card>
     <open-allprop titleAuthor="1" hexiao="0" ref="propALlProp" @getTabelData="handleQuery"></open-allprop>
  </div>
</template>
 
<script lang="ts" setup="" name="adapterCategories">
  import { ref , getCurrentInstance, nextTick, onMounted} from "vue";
  import { ElMessageBox, ElMessage } from "element-plus";
  import { auth } from '/@/utils/authFunction';
  import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
  import { formatDate,formatDate_T_Date,formatDate_T_Time,defaultTimeRange } from '/@/utils/formatTime';
  import importExcelDialog from '/@/components/importExcel/index.vue' //引入导入组件
  import { exportPageExcel } from '/@/utils/exportPageExcel' //引入导出方法
 
  import { ExcellTableDataExport } from "/@/hooks/exportTableDataExcell";
import OpenAllprop from "./component/openAllprop.vue";
 
  import printDialogAdapterCategories from '/@/views/system/print/component/hiprint/preview.vue'
  import editDialogAdapterCategories from '/@/views/main/SoftwareAdapterService/adapterCategories/component/editDialog.vue'
  import { pageAdapterCategories, deleteAdapterCategories,importExcelAdapterCategories,downloadExcelTemplateAdapterCategories,getRecordAdapterList } from '/@/api/main/SoftwareAdapterService/adapterCategories';
  const { proxy }: any = getCurrentInstance();
 
  
  /***************************************************[适配器大类管理操作]开始***************************************************/
  const showAdvanceQueryUIAdapterCategories = ref(false);
  const tableRefAdapterCategories = ref(null);
  const printDialogRefAdapterCategories = ref();
  const editDialogRefAdapterCategories = ref();
  const loadingAdapterCategories = ref(false);
  const disabled_btnAdapterCategories = ref(false);
  const tableDataAdapterCategories = ref<any>([]);
  const queryParamsAdapterCategories = ref<any>({});
  const getRecordAdapterListData = ref<any>({});
  const tableParamsAdapterCategories = ref({
    page: 1,
    pageSize: 10,
    total: 0,
  });
 
  const printAdapterCategoriesTitle = ref("");
  const editAdapterCategoriesTitle = ref("");
 
  // 改变高级查询的控件显示状态
  const changeAdvanceQueryUIAdapterCategories = () => {
    showAdvanceQueryUIAdapterCategories.value = !showAdvanceQueryUIAdapterCategories.value;
  }
 
  // 查询适配器大类管理
  const handleQueryAdapterCategories = async () => {
    loadingAdapterCategories.value = true;
    disabled_btnAdapterCategories.value = true;
    var res = await pageAdapterCategories(Object.assign(queryParamsAdapterCategories.value, tableParamsAdapterCategories.value));
    if(res.data.type=="success"){
      tableDataAdapterCategories.value = res.data.result?.items ?? [];
      tableParamsAdapterCategories.value.total = res.data.result?.total;
    }
    loadingAdapterCategories.value = false;
    disabled_btnAdapterCategories.value = false;
  };
  //通过适配器大类id获取适配器使用记录详情
  // const getAdapterLogDetails = async() =>{
     //  var ddd = await getRecordAdapterList();
     //  //getRecordAdapterListData.value = await getRecordAdapterList();
  // };
  
  // 重置适配器大类管理查询
  const resetAdapterCategories = async () => {
    queryParamsAdapterCategories.value = {}
  };
 
  // 适配器大类管理列排序
  const sortChangeAdapterCategories = async (column: any) => {
    queryParamsAdapterCategories.value.field = column.prop;
    queryParamsAdapterCategories.value.order = column.order;
    await handleQueryAdapterCategories();
  };
 
  // 打开新增适配器大类管理页面
  const openAddAdapterCategories = () => {
    editAdapterCategoriesTitle.value = '添加适配器大类管理';
    editDialogRefAdapterCategories.value.openDialog(1,{});
  };
 
  // 打开打印适配器大类管理页面
  const openPrintAdapterCategories = async (row: any) => {
    printAdapterCategoriesTitle.value = '打印适配器大类管理';
  }
  
  // 打开编辑适配器大类管理页面
  const openEditAdapterCategories = (row: any) => {
    editAdapterCategoriesTitle.value = '编辑适配器大类管理';
    editDialogRefAdapterCategories.value.openDialog(2,row);
  };
 
  // 删除适配器大类管理
  const delAdapterCategories = (row: any) => {
    ElMessageBox.confirm(`确定要删除吗?`, "提示", {
    confirmButtonText: "确定",
    cancelButtonText: "取消",
    type: "warning",
  })
  .then(async () => {
    loadingAdapterCategories.value = true;
    var ret = await deleteAdapterCategories(row);
    if(ret.data.type=="success"){
        ElMessage.success("删除成功");
    }
    loadingAdapterCategories.value = false;
    handleQueryAdapterCategories();
  })
  .catch(() => {});
  };
 
  // 改变适配器大类管理页面容量
  const handleSizeChangeAdapterCategories = (val: number) => {
    tableParamsAdapterCategories.value.pageSize = val;
    handleQueryAdapterCategories();
  };
  
 
const moveType = 10;//移动类型 入库
// ------------封装导出功能--前端导出+表格标题---------------
const jsonExcellTableExport = {
  titleName: "", //导出表格名称
  interfaceListName: '',//导出接口名称
}
const { getExportTitle, handleExportExcell, formExport, entozhExcell } = ExcellTableDataExport(jsonExcellTableExport)
// --------------end 封装导出功能--前端导出+表格标题-----------------
// ---------------新增-----------------------
const showProp = (item?: any) => {
  if (item == 1) {
    proxy.$refs['propALlProp'].openDialog(1);
  } else {
    proxy.$refs['propALlProp'].openDialog(2, item);
  }
}
// ---------------详情-----------------------
const openDrawer = (type: number, item?: any) => {
    
  proxy.$refs['propALlProp'].openDrawer(type, item, entozhExcell);
}
 
  // 改变适配器大类管理页码序号
  const handleCurrentChangeAdapterCategories = (val: number) => {
    tableParamsAdapterCategories.value.page = val;
    handleQueryAdapterCategories();
  };
 
/***************************************************[适配器大类管理操作]结束***************************************************/
/***************************************************[适配器大类管理导入]开始***************************************************/
const importExcelTitleAdapterCategories = ref("");
const importExcelDialogRefAdapterCategories = ref();
//打开导入界面
const openImportExcelAdapterCategories = () => {
    importExcelTitleAdapterCategories.value = '导入适配器大类管理';
    importExcelDialogRefAdapterCategories.value.openDialog({});
};
//导入数据
const handleImportExcelAdapterCategories = async (formData:Blob) => {
   var result = await importExcelAdapterCategories(formData);
   importExcelDialogRefAdapterCategories.value.callBackUploadFun(result.data);//回调导入子页面的方法
   if(result.data.type=="success"){
    handleQueryAdapterCategories();
   }
};
//下载导入模板
const handleDownExcelAdapterCategories = async () => {
   var result = await downloadExcelTemplateAdapterCategories();
   importExcelDialogRefAdapterCategories.value.callBackDownFun(result);//回调导入子页面的方法
};
/***************************************************[适配器大类管理导入]结束***************************************************/
/***************************************************[适配器大类管理导出]开始***************************************************/
//定义当前页面的方法组
const functionMapAdapterCategories = {
      formatDate_T_Date,
      formatDate_T_Time
};
//点击导出按钮
const handleExportExcelAdapterCategories = async (formData:Blob) => {
    loadingAdapterCategories.value = true;
    disabled_btnAdapterCategories.value = true;
    var new_tableParamsAdapterCategories=JSON.parse(JSON.stringify(tableParamsAdapterCategories.value));
    new_tableParamsAdapterCategories.page = 1;
    new_tableParamsAdapterCategories.pageSize = 100000;
    var res = await pageAdapterCategories(Object.assign(queryParamsAdapterCategories.value, new_tableParamsAdapterCategories));
    if(res.data.type=="success"){
      exportExcelAdapterCategories(res.data.result?.items ?? []);
    }
    loadingAdapterCategories.value = false;
    disabled_btnAdapterCategories.value = false;
};
//导出
const exportExcelAdapterCategories  = async (exportDataList:Array) => {
  exportPageExcel(exportDataList, tableRefAdapterCategories,"适配器大类管理",functionMapAdapterCategories);
};
/***************************************************[适配器大类管理导出]结束***************************************************/
  // 适配器大类管理页面加载时
  onMounted(async () => {
  });
 
  handleQueryAdapterCategories();
</script>
<style scoped>
:deep(.el-input),
:deep(.el-select),
:deep(.el-input-number) {
  width: 100%;
}
 
.under_line {
  color: #F18201;
  text-decoration: underline;
  cursor: pointer;
}
</style>