Packagingoutput.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998
  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. <el-button type="primary" :icon="Search" @click="positioningVisible">定位</el-button>
  23. <el-button type="primary" :icon="Search">查改</el-button>
  24. <el-button type="primary" :icon="Delete" @click="Del">删除</el-button>
  25. <div style="margin-left: auto;">
  26. <el-button type="primary" :icon="Download" @click="exportExcel">导出到Excel</el-button>
  27. </div>
  28. </div>
  29. <!-- 数据展示 -->
  30. <el-table ref="multipleTable" style="width: 100%" tooltip-effect="dark" :data="tableData" row-key="ID"
  31. highlight-current-row="true" :cell-style="cellStyle" border @selection-change="handleSelectionChange"
  32. :show-overflow-tooltip="true" @row-dblclick="doubleClick">
  33. <el-table-column type="selection" width="55" />
  34. <!-- <el-table-column align="left" label="创建用户" prop="sys_id" 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_PgCl" width="120"/>
  38. <el-table-column align="left" label="创建时间" prop="sys_rq" width="160"/>
  39. <el-table-column align="left" label="修改时间" prop="mod_rq" width="160"/>
  40. <el-table-column align="left" label="UNIQID" prop="UniqId" width="120"/> -->
  41. <!-- 循环渲染列 -->
  42. <el-table-column
  43. v-for=" column in tableColumns "
  44. :key="column.prop"
  45. :prop="column.prop"
  46. :label="column.label"
  47. :width="column.width"
  48. show-overflow-tooltip="true"
  49. />
  50. </el-table>
  51. <!-- 分页 -->
  52. <div class="gva-pagination">
  53. <el-pagination layout="total, sizes, prev, pager, next, jumper" v-model:current-page="page"
  54. v-model:page-size="limit"
  55. :page-sizes="[10, 30, 50, 100]" :total="total" @current-change="handleCurrentChange"
  56. @size-change="handleSizeChange" />
  57. </div>
  58. </div>
  59. <!-- 弹出框 -->
  60. <el-dialog v-model="dialogFormVisible" :before-close="closeDialog" :title="type === 'create' ? '添加' : '修改'"
  61. destroy-on-close width="1200px">
  62. <!-- <el-scrollbar height="500px"> -->
  63. <el-form :model="gdbhformData" label-position="left" ref="elFormRef" :rules="rule">
  64. <el-row :gutter="20">
  65. <el-col :span="6">
  66. <el-form-item label="日期" prop="name">
  67. <el-row :gutter="20">
  68. <el-col :span="12">
  69. <el-input v-model="sczl_rqValue" :clearable="true" placeholder="ZT01733" />
  70. </el-col>
  71. </el-row>
  72. </el-form-item>
  73. </el-col>
  74. </el-row>
  75. <el-table
  76. :data="detailData.table"
  77. border
  78. tooltip-effect="dark"
  79. :row-style="{ height: '20px' }"
  80. :cell-style="{ padding: '0px' }"
  81. :header-row-style="{ height: '20px' }"
  82. :header-cell-style="{ padding: '0px' }"
  83. >
  84. <el-table-column
  85. label="工单编号"
  86. width="100"
  87. >
  88. <template #default="{ row, $index }">
  89. <el-input
  90. v-model="row.sczl_gdbh"
  91. @keyup.enter="handleEnter($index, row)"
  92. />
  93. </template>
  94. </el-table-column>
  95. <el-table-column
  96. label="印件工序"
  97. width="100"
  98. >
  99. <template #default="{ row }">
  100. <el-input v-model="row.sczl_yjGx" />
  101. </template>
  102. </el-table-column>
  103. <el-table-column
  104. label="工序名称"
  105. width="100"
  106. >
  107. <template #default="{ row }">
  108. <el-input v-model="row.sczl_gxmc" />
  109. </template>
  110. </el-table-column>
  111. <el-table-column label="印件名称">
  112. <template #default="{ row }">
  113. <el-input v-model="row.Gd_cpmc" />
  114. </template>
  115. </el-table-column>
  116. <el-table-column
  117. label="包装产量"
  118. width="100"
  119. >
  120. <template #default="{ row }">
  121. <el-input v-model="row.sczl_cl" />
  122. </template>
  123. </el-table-column>
  124. <el-table-column
  125. label="每箱数量"
  126. width="100"
  127. >
  128. <template #default="{ row }">
  129. <el-input v-model="row.sczl_PgCl" />
  130. </template>
  131. </el-table-column>
  132. <el-table-column
  133. label="零头"
  134. width="100"
  135. >
  136. <template #default="{ row }">
  137. <el-input v-model="row.sczl_clAdd" />
  138. </template>
  139. </el-table-column>
  140. </el-table>
  141. <!-- 标题栏 -->
  142. <!-- <el-row :gutter="10">
  143. <el-col :span="3">
  144. <span>工单编号</span>
  145. </el-col>
  146. <el-col :span="3">
  147. <span>印件工序</span>
  148. </el-col>
  149. <el-col :span="3">
  150. <span>工序名称</span>
  151. </el-col>
  152. <el-col :span="9">
  153. <span>印件名称</span>
  154. </el-col>
  155. <el-col :span="2">
  156. <span>包装产量</span>
  157. </el-col>
  158. <el-col :span="2">
  159. <span>每箱数量</span>
  160. </el-col>
  161. <el-col :span="2">
  162. <span>零头</span>
  163. </el-col>
  164. </el-row> -->
  165. <!-- 员工1 -->
  166. <!-- <el-row :gutter="5" style="margin-top: 10px;">
  167. <el-col :span="3">
  168. <el-input v-model="formData.sczl_gdbh1" :clearable="true" @keyup.enter.native="getGxMcsubmit($event, '1')" placeholder="ZI00401" />
  169. </el-col>
  170. <el-col :span="3">
  171. <el-input v-model="formData.sczl_yjGx1" :clearable="true" placeholder="瞿春生" />
  172. </el-col>
  173. <el-col :span="3">
  174. <el-input v-model="formData.sczl_gxmc1" :clearable="true" placeholder="11.0" />
  175. </el-col>
  176. <el-col :span="9">
  177. <el-input v-model="formData.Gd_cpmc1" :clearable="true" placeholder="打包废纸" />
  178. </el-col>
  179. <el-col :span="2">
  180. <el-input v-model="formData.sczl_cl1" :clearable="true" placeholder="是" />
  181. </el-col>
  182. <el-col :span="2">
  183. <el-input v-model="formData.sczl_PgCl1" :clearable="true" placeholder="是" />
  184. </el-col>
  185. <el-col :span="2">
  186. <el-input v-model="formData.sczl_clAdd1" :clearable="true" placeholder="是" />
  187. </el-col>
  188. </el-row> -->
  189. <!-- 员工2 -->
  190. <!-- <el-row :gutter="5" style="margin-top: 10px;">
  191. <el-col :span="3">
  192. <el-input v-model="formData.sczl_gdbh2" :clearable="true" @keyup.enter.native="getGxMcsubmit($event, '2')" placeholder="ZI00401" />
  193. </el-col>
  194. <el-col :span="3">
  195. <el-input v-model="formData.sczl_yjGx2" :clearable="true" placeholder="瞿春生" data-="" />
  196. </el-col>
  197. <el-col :span="3">
  198. <el-input v-model="formData.sczl_gxmc2" :clearable="true" placeholder="11.0" />
  199. </el-col>
  200. <el-col :span="9">
  201. <el-input v-model="formData.Gd_cpmc2" :clearable="true" placeholder="打包废纸" />
  202. </el-col>
  203. <el-col :span="2">
  204. <el-input v-model="formData.sczl_cl2" :clearable="true" placeholder="是" />
  205. </el-col>
  206. <el-col :span="2">
  207. <el-input v-model="formData.sczl_PgCl2" :clearable="true" placeholder="是" />
  208. </el-col>
  209. <el-col :span="2">
  210. <el-input v-model="formData.sczl_clAdd2" :clearable="true" placeholder="是" />
  211. </el-col>
  212. </el-row> -->
  213. <!-- 员工3 -->
  214. <!-- <el-row :gutter="5" style="margin-top: 10px;">
  215. <el-col :span="3">
  216. <el-input v-model="formData.sczl_gdbh3" :clearable="true" @keyup.enter.native="getGxMcsubmit($event, '3')" placeholder="ZI00401" />
  217. </el-col>
  218. <el-col :span="3">
  219. <el-input v-model="formData.sczl_yjGx3" :clearable="true" placeholder="瞿春生" data-="" />
  220. </el-col>
  221. <el-col :span="3">
  222. <el-input v-model="formData.sczl_gxmc3" :clearable="true" placeholder="11.0" />
  223. </el-col>
  224. <el-col :span="9">
  225. <el-input v-model="formData.Gd_cpmc3" :clearable="true" placeholder="打包废纸" />
  226. </el-col>
  227. <el-col :span="2">
  228. <el-input v-model="formData.sczl_cl3" :clearable="true" placeholder="是" />
  229. </el-col>
  230. <el-col :span="2">
  231. <el-input v-model="formData.sczl_PgCl3" :clearable="true" placeholder="是" />
  232. </el-col>
  233. <el-col :span="2">
  234. <el-input v-model="formData.sczl_clAdd3" :clearable="true" placeholder="是" />
  235. </el-col>
  236. </el-row> -->
  237. <!-- 员工4 -->
  238. <!-- <el-row :gutter="5" style="margin-top: 10px;">
  239. <el-col :span="3">
  240. <el-input v-model="formData.sczl_gdbh4" :clearable="true" @keyup.enter.native="getGxMcsubmit($event, '4')" placeholder="ZI00401" />
  241. </el-col>
  242. <el-col :span="3">
  243. <el-input v-model="formData.sczl_yjGx4" :clearable="true" placeholder="瞿春生" data-="" />
  244. </el-col>
  245. <el-col :span="3">
  246. <el-input v-model="formData.sczl_gxmc4" :clearable="true" placeholder="11.0" />
  247. </el-col>
  248. <el-col :span="9">
  249. <el-input v-model="formData.Gd_cpmc4" :clearable="true" placeholder="打包废纸" />
  250. </el-col>
  251. <el-col :span="2">
  252. <el-input v-model="formData.sczl_cl4" :clearable="true" placeholder="是" />
  253. </el-col>
  254. <el-col :span="2">
  255. <el-input v-model="formData.sczl_PgCl4" :clearable="true" placeholder="是" />
  256. </el-col>
  257. <el-col :span="2">
  258. <el-input v-model="formData.sczl_clAdd4" :clearable="true" placeholder="是" />
  259. </el-col>
  260. </el-row>
  261. -->
  262. <!-- 员工5 -->
  263. <!-- <el-row :gutter="5" style="margin-top: 10px;">
  264. <el-col :span="3">
  265. <el-input v-model="formData.sczl_gdbh5" @keyup.enter.native="getGxMcsubmit($event, '5')" :clearable="true" placeholder="ZI00401" />
  266. </el-col>
  267. <el-col :span="3">
  268. <el-input v-model="formData.sczl_yjGx5" :clearable="true" placeholder="瞿春生" data-="" />
  269. </el-col>
  270. <el-col :span="3">
  271. <el-input v-model="formData.sczl_gxmc5" :clearable="true" placeholder="11.0" />
  272. </el-col>
  273. <el-col :span="9">
  274. <el-input v-model="formData.Gd_cpmc5" :clearable="true" placeholder="打包废纸" />
  275. </el-col>
  276. <el-col :span="2">
  277. <el-input v-model="formData.sczl_cl5" :clearable="true" placeholder="是" />
  278. </el-col>
  279. <el-col :span="2">
  280. <el-input v-model="formData.sczl_PgCl5" :clearable="true" placeholder="是" />
  281. </el-col>
  282. <el-col :span="2">
  283. <el-input v-model="formData.sczl_clAdd5" :clearable="true" placeholder="是" />
  284. </el-col>
  285. </el-row> -->
  286. <!-- 员工6 -->
  287. <!-- <el-row :gutter="5" style="margin-top: 10px;">
  288. <el-col :span="3">
  289. <el-input v-model="formData.sczl_gdbh6" :clearable="true" @keyup.enter.native="getGxMcsubmit($event, '6')" placeholder="ZI00401" />
  290. </el-col>
  291. <el-col :span="3">
  292. <el-input v-model="formData.sczl_yjGx6" :clearable="true" placeholder="瞿春生" data-="" />
  293. </el-col>
  294. <el-col :span="3">
  295. <el-input v-model="formData.sczl_gxmc6" :clearable="true" placeholder="11.0" />
  296. </el-col>
  297. <el-col :span="9">
  298. <el-input v-model="formData.Gd_cpmc6" :clearable="true" placeholder="打包废纸" />
  299. </el-col>
  300. <el-col :span="2">
  301. <el-input v-model="formData.sczl_cl6" :clearable="true" placeholder="是" />
  302. </el-col>
  303. <el-col :span="2">
  304. <el-input v-model="formData.sczl_PgCl6" :clearable="true" placeholder="是" />
  305. </el-col>
  306. <el-col :span="2">
  307. <el-input v-model="formData.sczl_clAdd6" :clearable="true" placeholder="是" />
  308. </el-col>
  309. </el-row> -->
  310. </el-form>
  311. <!-- </el-scrollbar> -->
  312. <template #footer>
  313. <div class="dialog-footer">
  314. <el-button @click="closeDialog">取 消</el-button>
  315. <el-button type="primary" @click="enterDialog">确 定</el-button>
  316. </div>
  317. </template>
  318. </el-dialog>
  319. <el-dialog v-model="positioningVisibleshow" :before-close="closepositioningVisible" :title="type==='create'?'添加':'修改'" destroy-on-close>
  320. <el-card>
  321. <el-form-item label="工单编号" prop="name">
  322. <el-row :gutter="20">
  323. <el-col :span="12">
  324. <el-input v-model="positionvalue" :clearable="true" placeholder="ZT01733" />
  325. </el-col>
  326. </el-row>
  327. </el-form-item>
  328. </el-card>
  329. <el-button type="primary" @click="enterpositioning">确 定</el-button>
  330. </el-dialog>
  331. <el-dialog v-model="getGxMcshow" :before-close="closegetGxMcshow" :title="type==='create'?'添加':'修改'" destroy-on-close>
  332. <el-table
  333. tooltip-effect="dark"
  334. :data="selectData"
  335. row-key="ID"
  336. highlight-current-row="true"
  337. border
  338. style="width:100%"
  339. @row-dblclick="handleSelectClick"
  340. >
  341. <el-table-column
  342. prop="Gd_cpmc"
  343. label="产品名称"
  344. width="300"
  345. />
  346. <el-table-column
  347. prop="Gy0_gxmc"
  348. label="产品名称"
  349. width="100"
  350. />
  351. <el-table-column
  352. prop="jyGx"
  353. label="产品名称"
  354. width="100"
  355. />
  356. </el-table>
  357. <template #footer>
  358. <div class="dialog-footer">
  359. <el-button @click="closegetGxMcshow">取 消</el-button>
  360. </div>
  361. </template>
  362. </el-dialog>
  363. </el-main>
  364. </el-container>
  365. </el-container>
  366. </div>
  367. </template>
  368. <script setup>
  369. import {
  370. getList,
  371. getTab,
  372. locate,
  373. getInfo,
  374. getGxMc,
  375. edit,
  376. del
  377. } from '@/api/jixiaoguanli/jitairibaobiao'
  378. // 全量引入格式化工具 请按需保留
  379. import { getDictFunc, formatDate, formatBoolean, filterDict, ReturnArrImg, onDownloadFile } from '@/utils/format'
  380. import { ElMessage, ElMessageBox, LAST_KEYS } from 'element-plus'
  381. import { Search, Refresh, Download } from '@element-plus/icons-vue'
  382. import { ref, reactive, onMounted, onBeforeMount } from 'vue'
  383. import { getPackingSideTable, getPackingTable } from '@/api/mes_api_gty/myapi'
  384. defineOptions({
  385. name: '06-packingDocuments'
  386. })
  387. // 侧边栏数据请求
  388. const treeData = reactive([]);
  389. const getTabdata = async () => {
  390. //接口调用函数
  391. const response = await getTab();
  392. console.log(response)
  393. const transformedData = response.data.map(item => ({
  394. label: `${item.date.replace(/-/g, '.')}【单据数: ${item.counts}张】`,
  395. children: item.sys.map(sysItem => ({
  396. label: `${sysItem.sys_id} 【记录数: ${sysItem.count}张】`,
  397. params: {
  398. date: item.date.replace(/\./g, '-'),
  399. sys_id: sysItem.sys_id,
  400. total: sysItem.count,
  401. },
  402. })),
  403. }));
  404. treeData.splice(0, treeData.length, ...transformedData);
  405. }
  406. getTabdata();
  407. // 自动化生成的字典(可能为空)以及字段
  408. const formData = ref({
  409. sczl_rq: '',
  410. sczl_gdbh1: '',
  411. sczl_gdbh2: '',
  412. sczl_gdbh3: '',
  413. sczl_gdbh4: '',
  414. sczl_gdbh5: '',
  415. sczl_gdbh6: '',
  416. sczl_yjGx1: '',
  417. sczl_yjGx2: '',
  418. sczl_yjGx3: '',
  419. sczl_yjGx4: '',
  420. sczl_yjGx5: '',
  421. sczl_yjGx6: '',
  422. sczl_cl1: '',
  423. sczl_cl2: '',
  424. sczl_cl3: '',
  425. sczl_cl4: '',
  426. sczl_cl5: '',
  427. sczl_cl6: '',
  428. sczl_PgCl1:'',
  429. sczl_PgCl2: '',
  430. sczl_PgCl3: '',
  431. sczl_PgCl4: '',
  432. sczl_PgCl5: '',
  433. sczl_PgCl6: '',
  434. Gd_cpmc1: '',
  435. Gd_cpmc2: '',
  436. Gd_cpmc3: '',
  437. Gd_cpmc4: '',
  438. Gd_cpmc5: '',
  439. Gd_cpmc6: '',
  440. sczl_clAdd1: '',
  441. sczl_clAdd2: '',
  442. sczl_clAdd3: '',
  443. sczl_clAdd4: '',
  444. sczl_clAdd5:'',
  445. sczl_clAdd6: '',
  446. UniqId:'000',
  447. })
  448. const formData2 = ref({
  449. UniqId:'0',
  450. sczl_rq: '2025-01-01 00:00:00',
  451. sczl_gdbh1: '2311232',
  452. sczl_gdbh2: '2311232',
  453. sczl_gdbh3: '2311232',
  454. sczl_gdbh4: '2311232',
  455. sczl_gdbh5: '2311232',
  456. sczl_gdbh6: '2311232',
  457. sczl_yjGx1: '01-71',
  458. sczl_yjGx2: '01-71',
  459. sczl_yjGx3: '01-71',
  460. sczl_yjGx4: '01-71',
  461. sczl_yjGx5: '01-71',
  462. sczl_yjGx6: '01-71',
  463. sczl_gxmc1: '包装',
  464. sczl_gxmc2: '包装',
  465. sczl_gxmc3: '包装',
  466. sczl_gxmc4: '包装',
  467. sczl_gxmc5: '包装',
  468. sczl_gxmc6: '包装',
  469. sczl_cl1: '6.00',
  470. sczl_cl2: '6.00',
  471. sczl_cl3: '6.00',
  472. sczl_cl4: '6.00',
  473. sczl_cl5: '6.00',
  474. sczl_cl6: '6.00',
  475. sczl_PgCl1:'500',
  476. sczl_PgCl2: '500',
  477. sczl_PgCl3: '500',
  478. sczl_PgCl4: '500',
  479. sczl_PgCl5: '500',
  480. sczl_PgCl6: '500',
  481. sczl_clAdd1: '500',
  482. sczl_clAdd2: '500',
  483. sczl_clAdd3: '500',
  484. sczl_clAdd4: '500',
  485. sczl_clAdd5:'500',
  486. sczl_clAdd6: '500',
  487. })
  488. // 验证规则
  489. const rule = reactive({
  490. })
  491. const elFormRef = ref()
  492. const elSearchFormRef = ref()
  493. // =========== 表格控制部分 ===========
  494. const tableData = reactive([])
  495. const GxMctableData = reactive([])
  496. const tableColumns = [
  497. { label: '创建用户', prop: 'sys_id', width: '240' },
  498. { label: '日期', prop: 'sczl_rq', width: '100' },
  499. { label: '包装产量', prop: 'sczl_cl', width: '100' },
  500. { label: '包装数量', prop: 'sczl_PgCl', width: '100' },
  501. { label: '创建时间', prop: 'sys_rq', width: '180' },
  502. { label: '修改时间', prop: 'mod_rq', width: '180' },
  503. { label: 'UNIQID', prop: 'UniqId', width: '100' },
  504. ]
  505. const detailData = reactive([])
  506. const total=ref(0)
  507. const inputname=ref(0)
  508. const page = ref(1)
  509. const limit = ref(10)
  510. const searchInfo = ref('')
  511. const params = {
  512. type: '',
  513. date: '',
  514. sys_id: '',
  515. gdbh: '',
  516. }
  517. const locatevalue={
  518. gdbh:'',
  519. cpmc:'',
  520. page:page.value.toString(),
  521. limit:limit.value.toString(),
  522. }
  523. let table=ref(5);
  524. let positionvalue=ref()
  525. let GxMcvalue=ref()
  526. // 分页设置
  527. const handleSizeChange = (val) => {
  528. switch (params.type) {
  529. case 'getTableData':
  530. getTableData()
  531. break
  532. case 'getLocateTable':
  533. GetmachineLocate()
  534. break
  535. default:
  536. break
  537. }
  538. }
  539. // 页面跳转
  540. const handleCurrentChange = (val) => {
  541. switch (params.type) {
  542. case 'getTableData':
  543. getTableData()
  544. break
  545. case 'getLocateTable':
  546. GetmachineLocate()
  547. break
  548. default:
  549. break
  550. }
  551. }
  552. // 查询
  553. const getTableData = async () => {
  554. const response = await getList(params);
  555. console.log(response.data.rows)
  556. if (response.code === 0) {
  557. tableData.splice(0, tableData.length, ...response.data.rows);
  558. }
  559. }
  560. const handleNodeClick = (node, check) => {
  561. //存放当前节点的nodeId
  562. if (node.params) {
  563. params.date = node.params.date;
  564. params.sys_id = node.params.sys_id;
  565. total.value = node.params.total;
  566. getTableData();
  567. }
  568. }
  569. const Getlocate = async () => {
  570. // const response = await locate(locatevalue);
  571. // console.log(locatevalue)
  572. // console.log(response)
  573. // if (response.code === 0) {
  574. // tableData.splice(0, tableData.length, ...response.data.rows);
  575. // }
  576. const response = await locate({
  577. gdbh: params.gdbh,
  578. page: page.value.toString(), limit: limit.value.toString(),
  579. })
  580. if (response.code === 0) {
  581. total.value = response.data.total
  582. tableData.splice(0, tableData.length, ...response.data.rows)
  583. }
  584. }
  585. const enterpositioning = async () => {
  586. locatevalue.gdbh=positionvalue.value;
  587. console.log(locatevalue.gdbh)
  588. Getlocate()
  589. closepositioningVisible()
  590. }
  591. // 处理回车
  592. const handleEnter = (index, row) => {
  593. GetGxMc(index, row)
  594. }
  595. let sczl_rqValue=ref()
  596. const getpickInfo = async (value) => {
  597. const response = await getInfo({UniqId:value});
  598. if (response.code === 0) {
  599. const { sczl_rq,...rest } = response.data
  600. // 直接赋值基础属性
  601. sczl_rqValue.value=response.data.sczl_rq
  602. console.log(response.data.sczl_rq)
  603. Object.assign(detailData, { sczl_rq,})
  604. // 生成表格数据
  605. detailData.table = Array.from({ length: 6 }, (_, i) => i + 1) // 创建一个长度为6的数组 [1, 2, 3, 4, 5, 6]
  606. .map(num => {
  607. return {
  608. sczl_gdbh: rest[`sczl_gdbh${num}`],
  609. sczl_yjGx: rest[`sczl_yjGx${num}`],
  610. sczl_gxmc: rest[`sczl_gxmc${num}`],
  611. Gd_cpmc: rest[`Gd_cpmc${num}`],
  612. sczl_cl: rest[`sczl_cl${num}`],
  613. sczl_PgCl: rest[`sczl_PgCl${num}`],
  614. sczl_clAdd: rest[`sczl_clAdd${num}`],
  615. }
  616. })
  617. // .filter(item => item.sczl_gdbh !== '') // 过滤掉空的工单编号
  618. dialogFormVisible.value = true
  619. }
  620. }
  621. // 更新数据
  622. const updateDetailData = async() => {
  623. const restoredData = {
  624. UniqId: lastCellValue,
  625. sczl_rq: detailData.sczl_rq,
  626. sczl_gdbh: detailData.sczl_gdbh,
  627. sczl_yjGx: detailData.sczl_yjGx,
  628. sczl_gxmc: detailData.sczl_gxmc,
  629. sczl_cl: detailData.sczl_cl,
  630. sczl_PgCl: detailData.sczl_PgCl,
  631. sczl_clAdd: detailData.sczl_clAdd,
  632. }
  633. detailData.table.forEach((item, index, array) => {
  634. const num = index + 1
  635. restoredData[`sczl_gdbh${num}`] = item.sczl_gdbh
  636. restoredData[`sczl_yjGx${num}`] = item.sczl_yjGx
  637. restoredData[`sczl_gxmc${num}`] = item.sczl_gxmc
  638. // restoredData[`Gd_cpmc${num}`] = item.Gd_cpmc
  639. restoredData[`sczl_cl${num}`] = item.sczl_cl
  640. restoredData[`sczl_PgCl${num}`] = item.sczl_PgCl
  641. restoredData[`sczl_clAdd${num}`] = item.sczl_clAdd
  642. })
  643. // restoredData.UniqId = 1
  644. // const res = await edit(restoredData)
  645. console.log(restoredData)
  646. console.log(res)
  647. }
  648. const GxMcdel = async () => {
  649. const response = await del({UniqId:lastCellValue});
  650. if (response.code === 0) {
  651. console.log(333)
  652. }
  653. getTableData()
  654. }
  655. const selectData = reactive([
  656. {
  657. Gd_cpmc: '黄金叶(乐途硬)小盒(二维码改版)',
  658. Gy0_gxmc: '包装',
  659. jyGx: '01-71',
  660. },
  661. ])
  662. let tableIndex = 0
  663. // 处理选择框
  664. const handleSelectClick = (row, column, event) => {
  665. const { Gd_cpmc, Gy0_gxmc, jyGx } = row
  666. detailData.table[tableIndex].Gd_cpmc = Gd_cpmc
  667. detailData.table[tableIndex].sczl_yjGx = jyGx
  668. detailData.table[tableIndex].sczl_gxmc = Gy0_gxmc
  669. getGxMcshow.value = false
  670. }
  671. const GetGxMc = async (index, row) => {
  672. console.log(row)
  673. const response = await getGxMc({gdbh: row.sczl_gdbh })
  674. if (response.code === 0) {
  675. const { Gd_cpmc, Gy0_gxmc, jyGx } = response.data[0]
  676. if (response.data.length === 1) {
  677. detailData.table[index].Gd_cpmc = Gd_cpmc
  678. detailData.table[index].sczl_yjGx = jyGx
  679. detailData.table[index].sczl_gxmc = Gy0_gxmc
  680. } else {
  681. selectData.splice(0, selectData.length, ...response.data)
  682. tableIndex = index
  683. getGxMcshow.value = true
  684. }
  685. }
  686. // const response = await getGxMc({gdbh: value});
  687. // console.log(response);
  688. // if (response.code === 0) {
  689. // if (response.data.length > 1) {
  690. // GxMctableData.splice(0, GxMctableData.length, ...response.data);
  691. // getGxMcshow.value = true;
  692. // }
  693. // // 取出 data 中的第一个元素
  694. // const item = response.data[0];
  695. // // 将数据拆分成变量名和内容
  696. // const variableName = Object.keys(item)[0]; // 变量名
  697. // const variableContent = item[variableName]; // 变量内容
  698. // const variableName1 = Object.keys(item)[1]; // 变量名
  699. // const variableContent1 = item[variableName1]; // 变量内容
  700. // const variableName2 = Object.keys(item)[2]; // 变量名
  701. // const variableContent2 = item[variableName2]; // 变量内容
  702. // console.log(variableContent2); // 输出生成的 Vue 代码
  703. // // 根据 response.data.length 的值动态给 formData 中的变量赋值
  704. // let Bname = 'Gd_cpmc' + num;
  705. // let Bname2= 'sczl_gxmc' + num;
  706. // let Bname3 = 'sczl_yjGx' + num;
  707. // formData.value[Bname] = variableContent; // 假设要赋的值是 123
  708. // formData.value[Bname2] = variableContent1;
  709. // formData.value[Bname3] = variableContent2;
  710. // console.log(formData.value[Bname]);
  711. // }
  712. }
  713. const getGxMcsubmit = (event, inputName) => {
  714. if(formData.value.sczl_gdbh6.length!=7||formData.value.sczl_gdbh5.length!=7||formData.value.sczl_gdbh3.length!=7||formData.value.sczl_gdbh4.length!=7||formData.value.sczl_gdbh2.length!=7||formData.value.sczl_gdbh1.length!=7){
  715. return false
  716. }
  717. // console.log(inputName);
  718. inputname.value=inputName
  719. console.log(inputname.value)
  720. let combinedString = 'formData.value.sczl_gdbh' + inputName;
  721. // console.log(combinedString)
  722. let variableName = 'sczl_gdbh'+inputName;
  723. let variableValue = eval('formData.value.' + variableName);
  724. console.log(variableValue)
  725. GetGxMc(variableValue,inputName)
  726. }
  727. // 搜索
  728. function onSearch() {
  729. params.gdbh = positionvalue.value
  730. params.type = 'getLocateTable'
  731. page.value = 1
  732. Getlocate()
  733. }
  734. // ============== 表格控制部分结束 ===============
  735. // 获取需要的字典 可能为空 按需保留
  736. const setOptions = async () => {
  737. }
  738. // 获取需要的字典 可能为空 按需保留
  739. setOptions()
  740. // 多选数据
  741. const multipleSelection = ref([])
  742. // 多选
  743. const handleSelectionChange = (val) => {
  744. if(val.length>0){
  745. multipleSelection.value = val
  746. const lenth=val.length
  747. lastCellValue=val[lenth-1].UniqId
  748. console.log(val)
  749. val.splice(0, val.length); // 清空 val 数组
  750. console.log(lastCellValue)
  751. }
  752. }
  753. // 批量删除控制标记
  754. const deleteVisible = ref(false)
  755. // 多选删除
  756. const onDelete = async () => {
  757. const ids = []
  758. if (multipleSelection.value.length === 0) {
  759. ElMessage({
  760. type: 'warning',
  761. message: '请选择要删除的数据'
  762. })
  763. return
  764. }
  765. multipleSelection.value &&
  766. multipleSelection.value.map(item => {
  767. ids.push(item.ID)
  768. })
  769. const res = await deleteCompanyByIds({ ids })
  770. if (res.code === 0) {
  771. ElMessage({
  772. type: 'success',
  773. message: '删除成功'
  774. })
  775. if (tableData.value.length === ids.length && page.value > 1) {
  776. page.value--
  777. }
  778. deleteVisible.value = false
  779. getTableData()
  780. }
  781. }
  782. // 弹窗控制标记
  783. const dialogFormVisible = ref(false)
  784. // 行为控制标记(弹窗内部需要增还是改)
  785. const type = ref('')
  786. // 更新行
  787. const updateCompanyFunc = async (row) => {
  788. const res = await findCompany({ ID: row.ID })
  789. type.value = 'update'
  790. if (res.code === 0) {
  791. formData.value = res.data.recompany
  792. dialogFormVisible.value = true
  793. }
  794. }
  795. // 弹窗控制标记
  796. const positioningVisibleshow = ref(false)
  797. const getGxMcshow = ref(false)
  798. const positioningVisible = () => {
  799. type.value = 'create'
  800. positioningVisibleshow.value = true
  801. }
  802. const Del = () => {
  803. GxMcdel()
  804. }
  805. const closepositioningVisible = () => {
  806. positioningVisibleshow.value = false
  807. formData.value = {
  808. address: '',
  809. image: '',
  810. name: '',
  811. }
  812. }
  813. const closegetGxMcshow = () => {
  814. getGxMcshow.value = false
  815. }
  816. // 打开弹窗
  817. const openDialog = () => {
  818. type.value = 'create'
  819. dialogFormVisible.value = true
  820. }
  821. // 关闭弹窗
  822. const closeDialog = () => {
  823. dialogFormVisible.value = false
  824. formData.value = {
  825. address: '',
  826. image: '',
  827. name: '',
  828. }
  829. }
  830. // 弹窗确定
  831. const enterDialog = async () => {
  832. // formData.value.UniqId=lastCellValue
  833. updateDetailData()
  834. // GxMcedit(lastCellValue)
  835. // closeDialog()
  836. // getTableData()
  837. }
  838. let lastCellValue=ref()
  839. // 双击表格操作
  840. function doubleClick(row) {
  841. // console.log(row, column, event);
  842. // updateCompanyFunc(row);
  843. type.value = 'update';
  844. lastCellValue= row['UniqId'];
  845. console.log(lastCellValue)
  846. table.value=lastCellValue
  847. getpickInfo(table.value)
  848. }
  849. function GxMcdoubleClick(row) {
  850. GxMcvalue=row
  851. closegetGxMcshow()
  852. console.log(GxMcvalue.Gd_cpmc)
  853. // 根据 response.data.length 的值动态给 formData 中的变量赋值
  854. let Bname = 'Gd_cpmc' + inputname.value;
  855. let Bname2= 'sczl_gxmc' + inputname.value;
  856. let Bname3 = 'sczl_yjGx' + inputname.value;
  857. formData.value[Bname] =GxMcvalue.Gd_cpmc; // 假设要赋的值是 123
  858. formData.value[Bname2] = GxMcvalue.Gy0_gxmc;
  859. formData.value[Bname3] = GxMcvalue.jyGx;
  860. }
  861. // 导出excel
  862. function exportExcel() {
  863. console.log('导出到excel');
  864. }
  865. // 生命周期钩子
  866. onMounted(async () => {
  867. });
  868. </script>
  869. <style>
  870. .JKWTree-container {
  871. display: flex;
  872. }
  873. .JKWTree-tree {
  874. width: 300px;
  875. background-color: #fff;
  876. padding: 10px;
  877. margin-right: 20px;
  878. }
  879. .JKWTree-tree h3 {
  880. font-size: 15px;
  881. font-weight: 700;
  882. margin: 10px 0;
  883. }
  884. .JKWTree-content {
  885. flex: 1;
  886. }
  887. /* 选中某行时的背景色*/
  888. .el-table__body tr.current-row>td {
  889. background: #ff80ff !important;
  890. /* 背景颜色 */
  891. }
  892. </style>