MachineDocuments.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904
  1. <template>
  2. <div>
  3. <!-- 左侧树形结构 -->
  4. <el-container>
  5. <el-aside width="250px">
  6. <div class="JKWTree-tree">
  7. <h3>机器检验计件单据维护</h3>
  8. <el-tree :data="treeData" :props="defaultProps" highlight-current="true"
  9. @node-click="handleNodeClick"></el-tree>
  10. </div>
  11. </el-aside>
  12. <el-container>
  13. <el-main>
  14. <!-- 按钮区域 -->
  15. <div class="gva-table-box">
  16. <div class="gva-btn-list">
  17. <el-row :span="6">
  18. <el-input v-model="positionvalue" placeholder="输入工单编号或产品名称" />
  19. </el-row>
  20. <el-button type="primary" :icon="Search" @click="onSearch">搜索</el-button>
  21. <el-button type="primary" :icon="Refresh">重置</el-button>
  22. <div style="margin-left: auto;">
  23. <el-button type="primary" :icon="Download" @click="exportExcel">导出到Excel</el-button>
  24. </div>
  25. </div>
  26. <!-- 数据展示 -->
  27. <el-table ref="multipleTable" style="width: 100%" tooltip-effect="dark" :data="tableData" row-key="ID"
  28. highlight-current-row="true" border @selection-change="handleSelectionChange" :show-overflow-tooltip="true" @row-dblclick="doubleClick">
  29. <el-table-column type="selection" width="55" />
  30. <el-table-column align="left" label="分类" prop="sczl_单据类型" width="120"/>
  31. <el-table-column align="left" label="工单印件" prop="combinedProp"width="340"/>
  32. <el-table-column align="left" label="印件工序" prop="combinedProp2" width="220"/>
  33. <el-table-column align="left" label="机台编号" prop="sczl_jtbh" width="120"/>
  34. <el-table-column align="left" label="机台" prop="sczl_jtbh" width="120"/>
  35. <el-table-column align="left" label="日期" prop="sczl_rq" width="120"/>
  36. <el-table-column align="left" label="计件产量" prop="sczl_cl" width="120"/>
  37. <el-table-column align="left" label="检验类别" prop="sczl_检验类别" width="120"/>
  38. <el-table-column align="left" label="废品率系数" prop="sczl_废品率系数" width="120"/>
  39. <el-table-column align="left" label="日定额" prop="日定额" width="120"/>
  40. <el-table-column align="left" label="员工姓名1" prop="sczl_bh1_name" width="120"/>
  41. <el-table-column align="left" label="员工姓名2" prop="sczl_bh2_name"width="120" />
  42. <el-table-column align="left" label="员工姓名3" prop="sczl_bh3_name" width="120"/>
  43. <el-table-column align="left" label="员工姓名4" prop="sczl_bh4_name"width="120" />
  44. <el-table-column align="left" label="班组代号" prop="sczl_bzdh" width="120"/>
  45. <el-table-column align="left" label="千件工价" prop="千件工价" width="120"/>
  46. <el-table-column align="left" label="日通电工时" prop="sczl_设备运行工时" width="120"/>
  47. <el-table-column align="left" label="流程单备注" prop="qczl_NumDesc" width="120"/>
  48. <el-table-column align="left" label="创建用户" prop="sys_id" width="120"/>
  49. <el-table-column align="left" label="创建时间" prop="sys_rq" width="160"/>
  50. <el-table-column align="left" label="修改时间" prop="mod_rq" width="160"/>
  51. <el-table-column align="left" label="UNIQID" prop="UniqId" width="120"/>
  52. </el-table>
  53. <!-- 分页 -->
  54. <div class="gva-pagination">
  55. <el-pagination layout="total, sizes, prev, pager, next, jumper" v-model:current-page="page"
  56. v-model:page-size="limit"
  57. :page-sizes="[10, 30, 50, 100]" :total="total" @current-change="handleCurrentChange"
  58. @size-change="handleSizeChange" />
  59. </div>
  60. </div>
  61. <!-- 弹出框 -->
  62. <el-dialog v-model="dialogFormVisible" :before-close="closeDialog" :title="type === 'create' ? '添加' : '修改'"
  63. destroy-on-close width="1200px">
  64. <!-- <el-scrollbar height="500px"> -->
  65. <el-form :model="formData" label-position="left" ref="elFormRef" :rules="rule">
  66. <el-row :gutter="20">
  67. <el-col :span="4">
  68. <el-form-item label="日期" prop="id">
  69. <el-input v-model="formData.sczl_rq" :clearable="true" placeholder="2023.12.14" />
  70. </el-form-item>
  71. </el-col>
  72. <el-col :span="6">
  73. <el-form-item label="组别" prop="name">
  74. <el-row :gutter="20">
  75. <el-col :span="12">
  76. <el-input v-model="formData.sczl_bzdh" :clearable="true" placeholder="ZT01733" />
  77. </el-col>
  78. </el-row>
  79. </el-form-item>
  80. </el-col>
  81. </el-row>
  82. <el-row :gutter="20">
  83. <el-col :span="20">
  84. <el-row :gutter="20">
  85. <el-col :span="5">
  86. <el-form-item label="工单编号" prop="id">
  87. <el-input v-model="formData.sczl_gdbh" :clearable="true" placeholder="0.00" />
  88. </el-form-item>
  89. </el-col>
  90. <el-col :span="5">
  91. <el-input v-model="formData.sczl_yjgx" :clearable="true" placeholder="是" />
  92. </el-col>
  93. <el-col :span="5">
  94. <el-input v-model="formData.sczl_gxmc" :clearable="true" placeholder="是" />
  95. </el-col>
  96. <el-col :span="5">
  97. <el-input v-model="formData.yj_yjmc" :clearable="true" placeholder="是" />
  98. </el-col>
  99. </el-row>
  100. </el-col>
  101. </el-row>
  102. <el-row :gutter="20">
  103. <el-col :span="4">
  104. <el-form-item label="机台编号" prop="id">
  105. <el-input v-model="formData.sczl_jtbh" :clearable="true" placeholder="2023.12.14" />
  106. </el-form-item>
  107. </el-col>
  108. <el-col :span="6">
  109. <el-row :gutter="20">
  110. <el-col :span="12">
  111. <el-form-item label="检验类型" prop="id">
  112. <el-input v-model="formData.sczl_单据类型" :clearable="true" placeholder="ZT01733" />
  113. </el-form-item>
  114. </el-col>
  115. </el-row>
  116. </el-col>
  117. <el-col :span="3">
  118. <el-form-item label="检验类别" prop="name">
  119. <el-input v-model="formData.sczl_检验类别" :clearable="true" placeholder="A班" />
  120. </el-form-item>
  121. </el-col>
  122. <el-col :span="3">
  123. <el-form-item label="废品率系数" prop="name">
  124. <el-input v-model="formData.sczl_废品率系数" :clearable="true" placeholder="A班" />
  125. </el-form-item>
  126. </el-col>
  127. </el-row>
  128. <el-row :gutter="20">
  129. <el-col :span="4">
  130. <el-form-item label="计件箱数" prop="id">
  131. <el-input v-model="formData.sczl_cl" :clearable="true" placeholder="2023.12.14" />
  132. </el-form-item>
  133. </el-col>
  134. <el-col :span="3">
  135. <el-form-item label="每箱数量" prop="name">
  136. <el-input v-model="formData.sczl_PgCl" :clearable="true" placeholder="A班" />
  137. </el-form-item>
  138. </el-col>
  139. <el-col :span="3">
  140. <el-form-item label="定额代号" prop="name">
  141. <el-input v-model="formData.sczl_dedh" :clearable="true" placeholder="A班" />
  142. </el-form-item>
  143. </el-col>
  144. </el-row>
  145. <el-row :gutter="1">
  146. <el-col :span="4">
  147. <el-form-item label="流程单号" prop="id">
  148. <el-input v-model="formData.address" :clearable="true" placeholder="2023.12.14" />
  149. </el-form-item>
  150. </el-col>
  151. <el-col :span="1">
  152. <el-input v-model="formData.流程单号1" :clearable="true" placeholder="ZT01733" />
  153. </el-col>
  154. <el-col :span="1">
  155. <el-input v-model="formData.流程单号2" :clearable="true" placeholder="ZT01733" />
  156. </el-col>
  157. <el-col :span="1">
  158. <el-input v-model="formData.流程单号3" :clearable="true" placeholder="ZT01733" />
  159. </el-col>
  160. <el-col :span="1">
  161. <el-input v-model="formData.流程单号4" :clearable="true" placeholder="ZT01733" />
  162. </el-col>
  163. <el-col :span="1">
  164. <el-input v-model="formData.流程单号5" :clearable="true" placeholder="ZT01733" />
  165. </el-col>
  166. <el-col :span="1">
  167. <el-input v-model="formData.流程单号6" :clearable="true" placeholder="ZT01733" />
  168. </el-col>
  169. <el-col :span="1">
  170. <el-input v-model="formData.流程单号7" :clearable="true" placeholder="ZT01733" />
  171. </el-col>
  172. <el-col :span="1">
  173. <el-input v-model="formData.流程单号8" :clearable="true" placeholder="ZT01733" />
  174. </el-col>
  175. <el-col :span="1">
  176. <el-input v-model="formData.流程单号9" :clearable="true" placeholder="ZT01733" />
  177. </el-col>
  178. <el-col :span="6">
  179. <el-row :gutter="20">
  180. <el-col :span="12">
  181. <el-form-item label="备注" prop="id">
  182. <el-input v-model="formData.qczl_NumDesc" :clearable="true" placeholder="ZT01733" />
  183. </el-form-item>
  184. </el-col>
  185. </el-row>
  186. </el-col>
  187. </el-row>
  188. <el-row :gutter="20">
  189. <el-col :span="4">
  190. <el-form-item label="换模补产工时" prop="id">
  191. <el-input v-model="formData.sczl_装版工时" :clearable="true" placeholder="2023.12.14" />
  192. </el-form-item>
  193. </el-col>
  194. <el-col :span="6">
  195. <el-row :gutter="20">
  196. <el-col :span="12">
  197. <el-form-item label="设备保养工时" prop="id">
  198. <el-input v-model="formData.sczl_保养工时" :clearable="true" placeholder="ZT01733" />
  199. </el-form-item>
  200. </el-col>
  201. </el-row>
  202. </el-col>
  203. <el-col :span="3">
  204. <el-form-item label="异常停机" prop="name">
  205. <el-input v-model="formData.sczl_异常停机工时" :clearable="true" placeholder="A班" />
  206. </el-form-item>
  207. </el-col>
  208. <el-col :span="3">
  209. <el-form-item label="设备通电工时" prop="name">
  210. <el-input v-model="formData.sczl_设备运行工时" :clearable="true" placeholder="A班" />
  211. </el-form-item>
  212. </el-col>
  213. </el-row>
  214. <!-- <el-row :gutter="10" style="margin-top: 10px;">
  215. <el-col :span="2">
  216. <span>组员信息</span>
  217. </el-col>
  218. <el-col :span="2">
  219. <el-input v-model="formData.sczl_bh1" :clearable="true" placeholder="ZI00401" />
  220. </el-col>
  221. <el-col :span="2">
  222. <el-input v-model="formData.sczl_bh2" :clearable="true" placeholder="瞿春生" />
  223. </el-col>
  224. <el-col :span="2">
  225. <el-input v-model="formData.sczl_bh3" :clearable="true" placeholder="11.0" />
  226. </el-col>
  227. <el-col :span="2">
  228. <el-input v-model="formData.sczl_bh4" :clearable="true" placeholder="打包废纸" />
  229. </el-col>
  230. <el-col :span="2">
  231. <el-input v-model="formData.sczl_bh5" :clearable="true" placeholder="是" />
  232. </el-col>
  233. <el-col :span="2">
  234. <el-input v-model="formData.sczl_bh6" :clearable="true" placeholder="ZI00401" />
  235. </el-col>
  236. <el-col :span="2">
  237. <el-input v-model="formData.sczl_bh7" :clearable="true" placeholder="瞿春生" />
  238. </el-col>
  239. <el-col :span="2">
  240. <el-input v-model="formData.sczl_bh8" :clearable="true" placeholder="11.0" />
  241. </el-col>
  242. </el-row>
  243. </el-form> -->
  244. <!-- <el-row :gutter="10" style="margin-top: 10px;">
  245. <el-col :span="2">
  246. </el-col>
  247. <el-col :span="2">
  248. <el-input v-model="formData.sczl_bh1_name" :clearable="true" placeholder="ZI00401" />
  249. </el-col>
  250. <el-col :span="2">
  251. <el-input v-model="formData.sczl_bh2_name" :clearable="true" placeholder="瞿春生" />
  252. </el-col>
  253. <el-col :span="2">
  254. <el-input v-model="formData.sczl_bh3_name" :clearable="true" placeholder="11.0" />
  255. </el-col>
  256. <el-col :span="2">
  257. <el-input v-model="formData.sczl_bh4_name" :clearable="true" placeholder="打包废纸" />
  258. </el-col>
  259. <el-col :span="2">
  260. <el-input v-model="formData.sczl_bh5_name" :clearable="true" placeholder="是" />
  261. </el-col>
  262. <el-col :span="2">
  263. <el-input v-model="formData.sczl_bh6_name" :clearable="true" placeholder="ZI00401" />
  264. </el-col>
  265. <el-col :span="2">
  266. <el-input v-model="formData.sczl_bh7_name" :clearable="true" placeholder="瞿春生" />
  267. </el-col>
  268. <el-col :span="2">
  269. <el-input v-model="formData.sczl_bh8_name" :clearable="true" placeholder="11.0" />
  270. </el-col>
  271. </el-row> -->
  272. <!-- <el-row :gutter="10" style="margin-top: 10px;">
  273. <el-col :span="2">
  274. </el-col>
  275. <el-col :span="2">
  276. <el-input v-model="formData.流程单号1" :clearable="true" placeholder="ZI00401" />
  277. </el-col>
  278. <el-col :span="2">
  279. <el-input v-model="formData.流程单号1" :clearable="true" placeholder="瞿春生" />
  280. </el-col>
  281. <el-col :span="2">
  282. <el-input v-model="formData.流程单号1" :clearable="true" placeholder="11.0" />
  283. </el-col>
  284. <el-col :span="2">
  285. <el-input v-model="formData.流程单号1" :clearable="true" placeholder="打包废纸" />
  286. </el-col>
  287. <el-col :span="2">
  288. <el-input v-model="formData.流程单号1" :clearable="true" placeholder="是" />
  289. </el-col>
  290. <el-col :span="2">
  291. <el-input v-model="formData.流程单号1" :clearable="true" placeholder="ZI00401" />
  292. </el-col>
  293. <el-col :span="2">
  294. <el-input v-model="formData.流程单号1" :clearable="true" placeholder="瞿春生" />
  295. </el-col>
  296. <el-col :span="2">
  297. <el-input v-model="formData.流程单号1" :clearable="true" placeholder="11.0" />
  298. </el-col>
  299. </el-row> -->
  300. <el-table
  301. :data="detailData.table"
  302. border
  303. tooltip-effect="dark"
  304. :row-style="{ height: '20px' }"
  305. :cell-style="{ padding: '0px' }"
  306. :header-row-style="{ height: '20px' }"
  307. :header-cell-style="{ padding: '0px' }"
  308. >
  309. <el-form-item label="11111" prop="name">
  310. <el-input v-model="formData.sczl_设备运行工时" :clearable="true" placeholder="A班" />
  311. </el-form-item>
  312. <el-table-column label="组员信息">
  313. <template #default="{ row }">
  314. <el-input v-model="row.Gd_cpmc" />
  315. </template>
  316. </el-table-column>
  317. <el-table-column label="组员信息">
  318. <template #default="{ row }">
  319. <el-input v-model="row.Gd_cpmc" />
  320. </template>
  321. </el-table-column>
  322. <el-table-column label="组员信息">
  323. <template #default="{ row }">
  324. <el-input v-model="row.Gd_cpmc" />
  325. </template>
  326. </el-table-column>
  327. <el-table-column label="组员信息">
  328. <template #default="{ row }">
  329. <el-input v-model="row.Gd_cpmc" />
  330. </template>
  331. </el-table-column>
  332. <el-table-column label="组员信息">
  333. <template #default="{ row }">
  334. <el-input v-model="row.Gd_cpmc" />
  335. </template>
  336. </el-table-column>
  337. <el-table-column label="组员信息">
  338. <template #default="{ row }">
  339. <el-input v-model="row.Gd_cpmc" />
  340. </template>
  341. </el-table-column>
  342. <el-table-column label="组员信息">
  343. <template #default="{ row }">
  344. <el-input v-model="row.Gd_cpmc" />
  345. </template>
  346. </el-table-column>
  347. <el-table-column label="组员信息">
  348. <template #default="{ row }">
  349. <el-input v-model="row.Gd_cpmc" />
  350. </template>
  351. </el-table-column>
  352. </el-table>
  353. </el-form>
  354. <el-row :gutter="20">
  355. <el-col :span="20">
  356. <el-form-item label="其他备注" prop="id">
  357. <el-input v-model="formData.流程单号" :clearable="true" placeholder="2023.12.14" />
  358. </el-form-item>
  359. </el-col>
  360. </el-row>
  361. <template #footer>
  362. <div class="dialog-footer">
  363. <el-button @click="closeDialog">取 消</el-button>
  364. <el-button type="primary" @click="enterDialog">确 定</el-button>
  365. </div>
  366. </template>
  367. </el-dialog>
  368. </el-main>
  369. </el-container>
  370. </el-container>
  371. </div>
  372. </template>
  373. <script setup>
  374. import {
  375. getMachineCount,
  376. getDateMachine,
  377. machineLocate,
  378. MachineInfo,
  379. getYg
  380. } from '@/api/jixiaoguanli/jitairibaobiao'
  381. // 全量引入格式化工具 请按需保留
  382. import { getDictFunc, formatDate, formatBoolean, filterDict, ReturnArrImg, onDownloadFile } from '@/utils/format'
  383. import { ElMessage, ElMessageBox } from 'element-plus'
  384. import { Search, Refresh, Download } from '@element-plus/icons-vue'
  385. import { ref, reactive, onMounted, onBeforeMount } from 'vue'
  386. import { getPackingSideTable, getPackingTable } from '@/api/mes_api_gty/myapi'
  387. defineOptions({
  388. name: '06-packingDocuments'
  389. })
  390. // 侧边栏数据请求
  391. const treeData = reactive([]);
  392. const getTabdata = async () => {
  393. //接口调用函数
  394. const response = await getMachineCount();
  395. console.log(response)
  396. const transformedData = response.data.map(item => ({
  397. label: `${item.sys_rq.replace(/-/g, '.')}【单据数: ${item.count}张】`,
  398. children: item.sys.map(sysItem => ({
  399. label: `${sysItem.sys_id} 【记录数: ${sysItem.count}张】`,
  400. params: {
  401. date: item.sys_rq.replace(/\./g, '-'),
  402. sys_id: sysItem.sys_id,
  403. total: sysItem.count,
  404. },
  405. })),
  406. }));
  407. treeData.splice(0, treeData.length, ...transformedData);
  408. }
  409. getTabdata();
  410. // 自动化生成的字典(可能为空)以及字段
  411. const formData = ref({
  412. sczl_gdbh: '',
  413. sczl_yjgx: '',
  414. sczl_gxmc: '',
  415. sczl_jtbh: '',
  416. sczl_bzdh: '',
  417. sczl_rq: '',
  418. sczl_cl: '',
  419. sczl_PgCl: '',
  420. sczl_单据类型: '',
  421. sczl_dedh: '',
  422. sczl_装版工时: '',
  423. sczl_保养工时: '',
  424. sczl_异常停机工时: '',
  425. sczl_设备运行工时: '',
  426. sczl_废品率系数: '',
  427. sczl_检验类别: '',
  428. sczl_bh1: '',
  429. sczl_bh2: '',
  430. sczl_bh3: '',
  431. sczl_bh4: '',
  432. sczl_bh5: '',
  433. sczl_bh6: '',
  434. sczl_bh7: '',
  435. sczl_bh8: '',
  436. 流程单号 :'',
  437. 流程单号2: '',
  438. 流程单号3: '',
  439. 流程单号4: '',
  440. 流程单号5: '',
  441. 流程单号6: '',
  442. 流程单号7: '',
  443. 流程单号8: '',
  444. 流程单号9:'',
  445. qczl_NumDesc:'',
  446. sczl_desc:'',
  447. sczl_bh1_name:'',
  448. sczl_bh2_name:'',
  449. sczl_bh3_name: '',
  450. sczl_bh4_name: '',
  451. sczl_bh5_name: '',
  452. sczl_bh6_name: '',
  453. sczl_bh7_name: '',
  454. sczl_bh8_name: '',
  455. yj_yjmc: ''
  456. })
  457. // 验证规则
  458. const rule = reactive({
  459. })
  460. const elFormRef = ref()
  461. const elSearchFormRef = ref()
  462. // =========== 表格控制部分 ===========
  463. const tableData = reactive([])
  464. const detailData = reactive([
  465. {
  466. gdbh: '2311736',
  467. yjgx: '01-15',
  468. gxmc: '包装(圆切)',
  469. yjmc: '利群(新)小《降焦改版)',
  470. bzcl: '13.00',
  471. fgcl: '0.00',
  472. mxsl: '2500',
  473. jcxs: '1.000',
  474. ly: '',
  475. dedh: '030002002',
  476. },
  477. {
  478. gdbh: '2311736',
  479. yjgx: '01-15',
  480. gxmc: '包装(圆切)',
  481. yjmc: '利群(新)小《降焦改版)',
  482. bzcl: '13.00',
  483. fgcl: '0.00',
  484. mxsl: '2500',
  485. jcxs: '1.000',
  486. ly: '',
  487. dedh: '030002002',
  488. },
  489. {
  490. gdbh: '2311736',
  491. yjgx: '01-15',
  492. gxmc: '包装(圆切)',
  493. yjmc: '利群(新)小《降焦改版)',
  494. bzcl: '13.00',
  495. fgcl: '0.00',
  496. mxsl: '2500',
  497. jcxs: '1.000',
  498. ly: '',
  499. dedh: '030002002',
  500. },
  501. {
  502. gdbh: '2311736',
  503. yjgx: '01-15',
  504. gxmc: '包装(圆切)',
  505. yjmc: '利群(新)小《降焦改版)',
  506. bzcl: '13.00',
  507. fgcl: '0.00',
  508. mxsl: '2500',
  509. jcxs: '1.000',
  510. ly: '',
  511. dedh: '030002002',
  512. },
  513. {
  514. gdbh: '2311736',
  515. yjgx: '01-15',
  516. gxmc: '包装(圆切)',
  517. yjmc: '利群(新)小《降焦改版)',
  518. bzcl: '13.00',
  519. fgcl: '0.00',
  520. mxsl: '2500',
  521. jcxs: '1.000',
  522. ly: '',
  523. dedh: '030002002',
  524. },
  525. {
  526. gdbh: '2311736',
  527. yjgx: '01-15',
  528. gxmc: '包装(圆切)',
  529. yjmc: '利群(新)小《降焦改版)',
  530. bzcl: '13.00',
  531. fgcl: '0.00',
  532. mxsl: '2500',
  533. jcxs: '1.000',
  534. ly: '',
  535. dedh: '030002002',
  536. },
  537. {
  538. gdbh: '2311736',
  539. yjgx: '01-15',
  540. gxmc: '包装(圆切)',
  541. yjmc: '利群(新)小《降焦改版)',
  542. bzcl: '13.00',
  543. fgcl: '0.00',
  544. mxsl: '2500',
  545. jcxs: '1.000',
  546. ly: '',
  547. dedh: '030002002',
  548. },
  549. {
  550. gdbh: '2311736',
  551. yjgx: '01-15',
  552. gxmc: '包装(圆切)',
  553. yjmc: '利群(新)小《降焦改版)',
  554. bzcl: '13.00',
  555. fgcl: '0.00',
  556. mxsl: '2500',
  557. jcxs: '1.000',
  558. ly: '',
  559. dedh: '030002002',
  560. },
  561. {
  562. gdbh: '2311736',
  563. yjgx: '01-15',
  564. gxmc: '包装(圆切)',
  565. yjmc: '利群(新)小《降焦改版)',
  566. bzcl: '13.00',
  567. fgcl: '0.00',
  568. mxsl: '2500',
  569. jcxs: '1.000',
  570. ly: '',
  571. dedh: '030002002',
  572. },
  573. {
  574. gdbh: '2311736',
  575. yjgx: '01-15',
  576. gxmc: '包装(圆切)',
  577. yjmc: '利群(新)小《降焦改版)',
  578. bzcl: '13.00',
  579. fgcl: '0.00',
  580. mxsl: '2500',
  581. jcxs: '1.000',
  582. ly: '',
  583. dedh: '030002002',
  584. },
  585. ])
  586. const total = ref(0)
  587. const page = ref(1)
  588. const limit = ref(10)
  589. const searchInfo = ref('')
  590. const params = {
  591. type: '',
  592. date: '',
  593. sys_id: '',
  594. gdbh: '',
  595. }
  596. // 分页设置
  597. const handleSizeChange = (val) => {
  598. switch (params.type) {
  599. case 'getTableData':
  600. getTableData()
  601. break
  602. case 'getLocateTable':
  603. GetmachineLocate()
  604. break
  605. default:
  606. break
  607. }
  608. }
  609. // 页面跳转
  610. const handleCurrentChange = (val) => {
  611. switch (params.type) {
  612. case 'getTableData':
  613. getTableData()
  614. break
  615. case 'getLocateTable':
  616. GetmachineLocate()
  617. break
  618. default:
  619. break
  620. }
  621. }
  622. const getTableData = async() => {
  623. const response = await getDateMachine({
  624. date: params.date, sys_id: params.sys_id,
  625. page: page.value.toString(), limit: limit.value.toString(),
  626. })
  627. if (response.code === 0) {
  628. const processedData = response.data.data.map(item => {
  629. return {
  630. ...item,
  631. combinedProp: item.sczl_gdbh + '--'+item.yj_yjmc,
  632. combinedProp2: item.sczl_yjgx + '-'+item.sczl_gxmc
  633. };
  634. });
  635. tableData.splice(0, tableData.length, ...processedData);
  636. }
  637. // const response = await getDateMachine(params);
  638. // console.log(response)
  639. // if (response.code === 0) {
  640. // const processedData = response.data.data.map(item => {
  641. // return {
  642. // ...item,
  643. // combinedProp: item.sczl_gdbh + '--'+item.yj_yjmc,
  644. // combinedProp2: item.sczl_yjgx + '-'+item.sczl_gxmc
  645. // };
  646. // });
  647. // tableData.splice(0, tableData.length, ...processedData);
  648. // }
  649. }
  650. const GetmachineLocate = async () => {
  651. const response = await machineLocate({
  652. gdbh: params.gdbh,
  653. page: page.value.toString(), limit: limit.value.toString(),
  654. })
  655. if (response.code === 0) {
  656. total.value = response.data.total
  657. tableData.splice(0, tableData.length, ...response.data.rows)
  658. }
  659. // const response = await machineLocate(locatevalue);
  660. // console.log(locatevalue)
  661. // console.log(response)
  662. // if (response.code === 0) {
  663. // tableData.splice(0, tableData.length, ...response.data.rows);
  664. // }
  665. }
  666. const GetMachineInfo = async (value) => {
  667. const response = await MachineInfo({UniqId:value});
  668. console.log(response)
  669. if (response.code === 0) {
  670. formData.value=response.data;
  671. }
  672. }
  673. const handleNodeClick = (node,check) => {
  674. //存放当前节点的nodeId
  675. //存放当前节点的nodeId
  676. if (node.params) {
  677. params.date = node.params.date;
  678. params.sys_id = node.params.sys_id;
  679. total.value = node.params.total;
  680. params.type = 'getTableData'
  681. page.value = 1
  682. getTableData();
  683. }
  684. }
  685. const locatevalue={
  686. gdbh:'',
  687. cpmc:'',
  688. page:'5',
  689. limit:'10',
  690. }
  691. let positionvalue=ref()
  692. // 搜索
  693. function onSearch() {
  694. params.gdbh = positionvalue.value
  695. params.type = 'getLocateTable'
  696. page.value = 1
  697. GetmachineLocate()
  698. }
  699. // ============== 表格控制部分结束 ===============
  700. // 获取需要的字典 可能为空 按需保留
  701. const setOptions = async () => {
  702. }
  703. // 获取需要的字典 可能为空 按需保留
  704. setOptions()
  705. // 多选数据
  706. const multipleSelection = ref([])
  707. // 多选
  708. const handleSelectionChange = (val) => {
  709. multipleSelection.value = val
  710. }
  711. // 批量删除控制标记
  712. const deleteVisible = ref(false)
  713. // 多选删除
  714. const onDelete = async () => {
  715. const ids = []
  716. if (multipleSelection.value.length === 0) {
  717. ElMessage({
  718. type: 'warning',
  719. message: '请选择要删除的数据'
  720. })
  721. return
  722. }
  723. multipleSelection.value &&
  724. multipleSelection.value.map(item => {
  725. ids.push(item.ID)
  726. })
  727. const res = await deleteCompanyByIds({ ids })
  728. if (res.code === 0) {
  729. ElMessage({
  730. type: 'success',
  731. message: '删除成功'
  732. })
  733. if (tableData.value.length === ids.length && page.value > 1) {
  734. page.value--
  735. }
  736. deleteVisible.value = false
  737. getTableData()
  738. }
  739. }
  740. // 行为控制标记(弹窗内部需要增还是改)
  741. const type = ref('')
  742. // 更新行
  743. const updateCompanyFunc = async (row) => {
  744. const res = await findCompany({ ID: row.ID })
  745. type.value = 'update'
  746. if (res.code === 0) {
  747. formData.value = res.data.recompany
  748. dialogFormVisible.value = true
  749. }
  750. }
  751. // 弹窗控制标记
  752. const dialogFormVisible = ref(false)
  753. // 打开弹窗
  754. const openDialog = () => {
  755. type.value = 'create'
  756. dialogFormVisible.value = true
  757. }
  758. // 关闭弹窗
  759. const closeDialog = () => {
  760. dialogFormVisible.value = false
  761. formData.value = {
  762. address: '',
  763. image: '',
  764. name: '',
  765. }
  766. }
  767. // 弹窗确定
  768. const enterDialog = async () => {
  769. elFormRef.value?.validate(async (valid) => {
  770. if (!valid) return
  771. let res
  772. switch (type.value) {
  773. case 'create':
  774. res = await createCompany(formData.value)
  775. break
  776. case 'update':
  777. res = await updateCompany(formData.value)
  778. break
  779. default:
  780. res = await createCompany(formData.value)
  781. break
  782. }
  783. if (res.code === 0) {
  784. ElMessage({
  785. type: 'success',
  786. message: '创建/更改成功'
  787. })
  788. closeDialog()
  789. getTableData()
  790. }
  791. })
  792. }
  793. let table=ref(5);
  794. let lastCellValue=ref()
  795. // 双击表格操作
  796. function doubleClick(row) {
  797. type.value = 'update';
  798. dialogFormVisible.value = true
  799. lastCellValue= row['UniqId'];
  800. console.log(lastCellValue)
  801. table.value=lastCellValue
  802. GetMachineInfo(table.value)
  803. }
  804. // 导出excel
  805. function exportExcel() {
  806. console.log('导出到excel');
  807. }
  808. // 生命周期钩子
  809. onMounted(async () => {
  810. });
  811. </script>
  812. <style>
  813. .JKWTree-container {
  814. display: flex;
  815. }
  816. .JKWTree-tree {
  817. width: 300px;
  818. background-color: #fff;
  819. padding: 10px;
  820. margin-right: 20px;
  821. }
  822. .JKWTree-tree h3 {
  823. font-size: 15px;
  824. font-weight: 700;
  825. margin: 10px 0;
  826. }
  827. .JKWTree-content {
  828. flex: 1;
  829. }
  830. /* 选中某行时的背景色*/
  831. .el-table__body tr.current-row>td {
  832. background: #ff80ff !important;
  833. /* 背景颜色 */
  834. }
  835. </style>