yuangongrigongzi.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774
  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. <layout-sider
  13. :resize-directions="['right']"
  14. :width="220"
  15. style="margin-right: 10px;"
  16. >
  17. <div
  18. class="JKWTree-tree"
  19. style="height: 70vh;"
  20. >
  21. <h3>员工日工资查询</h3>
  22. <el-tree
  23. :data="treeData"
  24. highlight-current
  25. @node-click="handleNodeClick"
  26. />
  27. </div>
  28. </layout-sider>
  29. <el-container>
  30. <el-main>
  31. <!-- 按钮区域 -->
  32. <div class="gva-table-box">
  33. <div class="gva-btn-list">
  34. <el-row :span="6">
  35. <el-input v-model="searchInfo" placeholder="输入工单编号或产品名称" />
  36. </el-row>
  37. <el-button type="primary" :icon="Search" @click="onSearch">搜索</el-button>
  38. <el-button type="primary" :icon="Refresh">重置</el-button>
  39. <el-button type="primary" :icon="Search" @click="onposition">定位</el-button>
  40. <el-button type="primary" :icon="Search">查改</el-button>
  41. <el-button type="primary" @click="handlePrint">员工计件明细</el-button>
  42. <div style="margin-left: auto;">
  43. <el-button type="primary" :icon="Download" @click="exportExcel">导出到Excel</el-button>
  44. </div>
  45. </div>
  46. <!-- 数据展示 -->
  47. <el-table ref="multipleTable" style="width: 100%;height: 40vh;" tooltip-effect="dark" :data="tableData" row-key="ID"
  48. highlight-current-row="true" border @selection-change="handleSelectionChange" :show-overflow-tooltip="true"
  49. :row-style="{ height: '20px' }"
  50. :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
  51. :header-cell-style="{ padding: '0px' }"
  52. @row-click="ontable" @row-dblclick="doubleClick">
  53. <el-table-column type="selection" width="40" />
  54. <el-table-column align="left" sortable label="员工编号" prop="bh" width="105"/>
  55. <el-table-column align="left" sortable label="员工姓名" prop="员工姓名" width="105"/>
  56. <el-table-column align="left" sortable label="日期" prop="sczl_rq" width="105"/>
  57. <el-table-column align="left" sortable label="计件工资" prop="计件工资" width="105"/>
  58. <el-table-column align="left" sortable label="加班工资" prop="加班工资" width="105"/>
  59. <el-table-column align="left" sortable label="计时时数" prop="计时时数" width="105"/>
  60. <el-table-column align="left" sortable label="计时工资" prop="计时工资" width="105"/>
  61. <el-table-column align="left" sortable label="日工资合计" prop="日工资合计" width="120"/>
  62. </el-table>
  63. <!-- 分页 -->
  64. <!-- <div class="gva-pagination">
  65. <el-pagination layout="total, sizes, prev, pager, next, jumper" :current-page="page" :page-size="limit"
  66. :page-sizes="[10, 30, 50, 100]" :total="total" @current-change="handleCurrentChange"
  67. @size-change="handleSizeChange" />
  68. </div> -->
  69. </div>
  70. <div class="gva-table-box">
  71. <!-- 数据展示 -->
  72. <el-table ref="multipleTable" style="width: 100%;height: 40vh;" tooltip-effect="dark" :data="tableData2" row-key="ID"
  73. highlight-current-row="true" border
  74. :row-style="{ height: '20px' }"
  75. :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
  76. :header-cell-style="{ padding: '0px' }"
  77. @selection-change="handleSelectionChange"
  78. :show-overflow-tooltip="true"
  79. @row-dblclick="doubleClick">
  80. <el-table-column type="selection" width="40" />
  81. <el-table-column align="left" sortable label="日期" prop="sczl_rq" width="105"/>
  82. <el-table-column align="left" sortable label="工单编号" prop="sczl_gdbh" width="105"/>
  83. <el-table-column align="left" sortable label="产品名称" prop="Gd_cpmc" width="120"/>
  84. <el-table-column align="left" sortable label="印件及工序" prop="sczl_type" width="120"/>
  85. <el-table-column align="left" sortable label="机台编号" prop="sczl_jtbh" width="105"/>
  86. <el-table-column align="left" sortable label="班组车头产量" prop="班组车头产量" width="135"/>
  87. <el-table-column align="left" sortable label="班组换算产量" prop="班组换算产量" width="135"/>
  88. <el-table-column align="left" sortable label="工序难度系数" prop="工序难度系数" width="135"/>
  89. <el-table-column align="left" sortable label="个人计件工资" prop="个人计件工资" width="135"/>
  90. <el-table-column align="left" sortable label="个人加班工资" prop="个人加班工资" width="135"/>
  91. <el-table-column align="left" sortable label="装版工时" prop="装版工时" width="105"/>
  92. <el-table-column align="left" sortable label="保养工时" prop="保养工时" width="105"/>
  93. <el-table-column align="left" sortable label="打样工时" prop="打样工时" width="105"/>
  94. <el-table-column align="left" sortable label="异常停机工时" prop="异常停机工时" width="135"/>
  95. <el-table-column align="left" sortable label="车头产量占用机时" prop="车头产量占用机时" width="165"/>
  96. <el-table-column align="left" sortable label="日定额" prop="日定额" width="91"/>
  97. <el-table-column align="left" sortable label="达标定额" prop="达标定额" width="105"/>
  98. <el-table-column align="left" sortable label="千件工价" prop="千件工价" width="105"/>
  99. <el-table-column align="left" sortable label="补产标准" prop="补产标准" width="105"/>
  100. <el-table-column align="left" sortable label="员工编号" prop="bh" width="105"/>
  101. <el-table-column align="left" sortable label="姓名" prop="xm" width="105"/>
  102. <el-table-column align="left" sortable label="比例" prop="Rate" width="78"/>
  103. </el-table>
  104. <!-- 分页 -->
  105. <!-- <div class="gva-pagination">
  106. <el-pagination layout="total, sizes, prev, pager, next, jumper" :current-page="page" :page-size="limit"
  107. :page-sizes="[10, 30, 50, 100]" :total="total" @current-change="handleCurrentChange"
  108. @size-change="handleSizeChange" />
  109. </div> -->
  110. </div>
  111. <!-- 弹出框 -->
  112. <el-dialog v-model="dialogFormVisible" :before-close="closeDialog" :title="type === 'create' ? '添加' : '修改'"
  113. destroy-on-close width="1200px">
  114. <!-- <el-scrollbar height="500px"> -->
  115. <el-form :model="formData" label-position="left" ref="elFormRef" :rules="rule">
  116. <el-row :gutter="20">
  117. <el-col :span="6">
  118. <el-form-item label="日期" prop="name">
  119. <el-row :gutter="20">
  120. <el-col :span="12">
  121. <el-input v-model="formData.code" :clearable="true" placeholder="ZT01733" />
  122. </el-col>
  123. </el-row>
  124. </el-form-item>
  125. </el-col>
  126. </el-row>
  127. <!-- 标题栏 -->
  128. <el-row :gutter="10">
  129. <el-col :span="3">
  130. <span>工单编号</span>
  131. </el-col>
  132. <el-col :span="3">
  133. <span>印件工序</span>
  134. </el-col>
  135. <el-col :span="3">
  136. <span>工序名称</span>
  137. </el-col>
  138. <el-col :span="9">
  139. <span>印件名称</span>
  140. </el-col>
  141. <el-col :span="2">
  142. <span>包装产量</span>
  143. </el-col>
  144. <el-col :span="2">
  145. <span>每箱数量</span>
  146. </el-col>
  147. <el-col :span="2">
  148. <span>零头</span>
  149. </el-col>
  150. </el-row>
  151. <!-- 员工1 -->
  152. <el-row :gutter="5" style="margin-top: 10px;">
  153. <el-col :span="3">
  154. <el-input v-model="formData.image" :clearable="true" placeholder="ZI00401" />
  155. </el-col>
  156. <el-col :span="3">
  157. <el-input v-model="formData.image" :clearable="true" placeholder="瞿春生" />
  158. </el-col>
  159. <el-col :span="3">
  160. <el-input v-model="formData.image" :clearable="true" placeholder="11.0" />
  161. </el-col>
  162. <el-col :span="9">
  163. <el-input v-model="formData.image" :clearable="true" placeholder="打包废纸" />
  164. </el-col>
  165. <el-col :span="2">
  166. <el-input v-model="formData.image" :clearable="true" placeholder="是" />
  167. </el-col>
  168. <el-col :span="2">
  169. <el-input v-model="formData.image" :clearable="true" placeholder="是" />
  170. </el-col>
  171. <el-col :span="2">
  172. <el-input v-model="formData.image" :clearable="true" placeholder="是" />
  173. </el-col>
  174. </el-row>
  175. <!-- 员工2 -->
  176. <el-row :gutter="5" style="margin-top: 10px;">
  177. <el-col :span="3">
  178. <el-input v-model="formData.image" :clearable="true" placeholder="ZI00401" />
  179. </el-col>
  180. <el-col :span="3">
  181. <el-input v-model="formData.image" :clearable="true" placeholder="瞿春生" />
  182. </el-col>
  183. <el-col :span="3">
  184. <el-input v-model="formData.image" :clearable="true" placeholder="11.0" />
  185. </el-col>
  186. <el-col :span="9">
  187. <el-input v-model="formData.image" :clearable="true" placeholder="打包废纸" />
  188. </el-col>
  189. <el-col :span="2">
  190. <el-input v-model="formData.image" :clearable="true" placeholder="是" />
  191. </el-col>
  192. <el-col :span="2">
  193. <el-input v-model="formData.image" :clearable="true" placeholder="是" />
  194. </el-col>
  195. <el-col :span="2">
  196. <el-input v-model="formData.image" :clearable="true" placeholder="是" />
  197. </el-col>
  198. </el-row>
  199. <!-- 员工3 -->
  200. <el-row :gutter="5" style="margin-top: 10px;">
  201. <el-col :span="3">
  202. <el-input v-model="formData.image" :clearable="true" placeholder="ZI00401" />
  203. </el-col>
  204. <el-col :span="3">
  205. <el-input v-model="formData.image" :clearable="true" placeholder="瞿春生" />
  206. </el-col>
  207. <el-col :span="3">
  208. <el-input v-model="formData.image" :clearable="true" placeholder="11.0" />
  209. </el-col>
  210. <el-col :span="9">
  211. <el-input v-model="formData.image" :clearable="true" placeholder="打包废纸" />
  212. </el-col>
  213. <el-col :span="2">
  214. <el-input v-model="formData.image" :clearable="true" placeholder="是" />
  215. </el-col>
  216. <el-col :span="2">
  217. <el-input v-model="formData.image" :clearable="true" placeholder="是" />
  218. </el-col>
  219. <el-col :span="2">
  220. <el-input v-model="formData.image" :clearable="true" placeholder="是" />
  221. </el-col>
  222. </el-row>
  223. <!-- 员工4 -->
  224. <el-row :gutter="5" style="margin-top: 10px;">
  225. <el-col :span="3">
  226. <el-input v-model="formData.image" :clearable="true" placeholder="ZI00401" />
  227. </el-col>
  228. <el-col :span="3">
  229. <el-input v-model="formData.image" :clearable="true" placeholder="瞿春生" />
  230. </el-col>
  231. <el-col :span="3">
  232. <el-input v-model="formData.image" :clearable="true" placeholder="11.0" />
  233. </el-col>
  234. <el-col :span="9">
  235. <el-input v-model="formData.image" :clearable="true" placeholder="打包废纸" />
  236. </el-col>
  237. <el-col :span="2">
  238. <el-input v-model="formData.image" :clearable="true" placeholder="是" />
  239. </el-col>
  240. <el-col :span="2">
  241. <el-input v-model="formData.image" :clearable="true" placeholder="是" />
  242. </el-col>
  243. <el-col :span="2">
  244. <el-input v-model="formData.image" :clearable="true" placeholder="是" />
  245. </el-col>
  246. </el-row>
  247. <!-- 员工5 -->
  248. <el-row :gutter="5" style="margin-top: 10px;">
  249. <el-col :span="3">
  250. <el-input v-model="formData.image" :clearable="true" placeholder="ZI00401" />
  251. </el-col>
  252. <el-col :span="3">
  253. <el-input v-model="formData.image" :clearable="true" placeholder="瞿春生" />
  254. </el-col>
  255. <el-col :span="3">
  256. <el-input v-model="formData.image" :clearable="true" placeholder="11.0" />
  257. </el-col>
  258. <el-col :span="9">
  259. <el-input v-model="formData.image" :clearable="true" placeholder="打包废纸" />
  260. </el-col>
  261. <el-col :span="2">
  262. <el-input v-model="formData.image" :clearable="true" placeholder="是" />
  263. </el-col>
  264. <el-col :span="2">
  265. <el-input v-model="formData.image" :clearable="true" placeholder="是" />
  266. </el-col>
  267. <el-col :span="2">
  268. <el-input v-model="formData.image" :clearable="true" placeholder="是" />
  269. </el-col>
  270. </el-row>
  271. <!-- 员工6 -->
  272. <el-row :gutter="5" style="margin-top: 10px;">
  273. <el-col :span="3">
  274. <el-input v-model="formData.image" :clearable="true" placeholder="ZI00401" />
  275. </el-col>
  276. <el-col :span="3">
  277. <el-input v-model="formData.image" :clearable="true" placeholder="瞿春生" />
  278. </el-col>
  279. <el-col :span="3">
  280. <el-input v-model="formData.image" :clearable="true" placeholder="11.0" />
  281. </el-col>
  282. <el-col :span="9">
  283. <el-input v-model="formData.image" :clearable="true" placeholder="打包废纸" />
  284. </el-col>
  285. <el-col :span="2">
  286. <el-input v-model="formData.image" :clearable="true" placeholder="是" />
  287. </el-col>
  288. <el-col :span="2">
  289. <el-input v-model="formData.image" :clearable="true" placeholder="是" />
  290. </el-col>
  291. <el-col :span="2">
  292. <el-input v-model="formData.image" :clearable="true" placeholder="是" />
  293. </el-col>
  294. </el-row>
  295. </el-form>
  296. <!-- </el-scrollbar> -->
  297. <template #footer>
  298. <div class="dialog-footer">
  299. <el-button @click="closeDialog">取 消</el-button>
  300. <el-button type="primary" @click="enterDialog">确 定</el-button>
  301. </div>
  302. </template>
  303. </el-dialog>
  304. <el-dialog v-model="positioningVisibleshow" :before-close="closepositioningVisible" :title="type==='create'?'添加':'修改'" destroy-on-close>
  305. <el-card>
  306. <el-form-item label="员工编号" prop="name">
  307. <el-row :gutter="20">
  308. <el-col :span="12">
  309. <el-input v-model="positionvalue" :clearable="true" placeholder="ZT01733" />
  310. </el-col>
  311. </el-row>
  312. </el-form-item>
  313. </el-card>
  314. <el-button type="primary" @click="enterpositioning">确 定</el-button>
  315. </el-dialog>
  316. </el-main>
  317. </el-container>
  318. </el-container>
  319. <!-- 员工计件明细 -->
  320. <el-dialog
  321. v-model="dialogYgjjmx"
  322. title="员工计件明细"
  323. destroy-on-close
  324. >
  325. <Ygjjmx :ygbh="currentRow?.['bh']" />
  326. </el-dialog>
  327. </div>
  328. </template>
  329. <script setup>
  330. import {
  331. getList,
  332. getTab,
  333. dailygetTab,
  334. dailygetList,
  335. dailygetAllList,
  336. dailygetDetail,
  337. dailysearch
  338. } from '@/api/jixiaoguanli/jitairibaobiao'
  339. // 全量引入格式化工具 请按需保留
  340. import { getDictFunc, formatDate, formatBoolean, filterDict, ReturnArrImg, onDownloadFile } from '@/utils/format'
  341. import { ElMessage, ElMessageBox } from 'element-plus'
  342. import { Search, Refresh, Download } from '@element-plus/icons-vue'
  343. import { ref, reactive, onMounted, onBeforeMount } from 'vue'
  344. import { getPackingSideTable, getPackingTable } from '@/api/mes_api_gty/myapi'
  345. import { Layout, LayoutContent, LayoutHeader, LayoutSider } from '@arco-design/web-vue'
  346. import Ygjjmx from './printYgjjmx.vue'
  347. defineOptions({
  348. name: '06-packingDocuments'
  349. })
  350. // 侧边栏数据请求
  351. const treeData = reactive([]);
  352. const getTabdata = async () => {
  353. //接口调用函数
  354. const response = await dailygetTab();
  355. console.log(response)
  356. const transformedData = response.data.map(item => ({
  357. label: `${item.label}`,
  358. children: item.children.map(sysItem => ({
  359. label: `${sysItem.label}`,
  360. params: {
  361. date: item.label,
  362. sys_id: sysItem.label,
  363. total:'',
  364. },
  365. })),
  366. }));
  367. treeData.splice(0, treeData.length, ...transformedData);
  368. }
  369. getTabdata();
  370. // 自动化生成的字典(可能为空)以及字段
  371. const formData = ref({
  372. id: '',
  373. name: '',
  374. date: '',
  375. group: '',
  376. packingOutput: '',
  377. reworkOutput: '',
  378. pieceOutput: '',
  379. order: '',
  380. user: '',
  381. createTime: '',
  382. updateTime: '',
  383. uniqid: '',
  384. })
  385. // 验证规则
  386. const rule = reactive({
  387. })
  388. const elFormRef = ref()
  389. const elSearchFormRef = ref()
  390. // =========== 表格控制部分 ===========
  391. const tableData = reactive([])
  392. const tableData2 = reactive([])
  393. const detailData = reactive([])
  394. const total = ref(0)
  395. const page = ref(1)
  396. const limit = ref(10)
  397. const searchInfo = ref('')
  398. const params = {
  399. date: '',
  400. sys_id: '',
  401. page: page.value.toString(),
  402. limit: limit.value.toString(),
  403. }
  404. // 分页设置
  405. const handleSizeChange = (val) => {
  406. limit.value = val;
  407. params.limit = val.toString();
  408. getTableData();
  409. }
  410. // 页面跳转
  411. const handleCurrentChange = (val) => {
  412. page.value = val
  413. params.page = val.toString();
  414. getTableData()
  415. }
  416. // 查询
  417. const getTableData = async () => {
  418. const response = await dailygetList({
  419. date: params.date, department: params.sys_id,});
  420. // console.log(response)
  421. if (response.code === 0) {
  422. const originalData = response.data;
  423. const summaryData = generateSummaryData(originalData);
  424. // 将合计数据插入到原始数据中
  425. const combinedData = [];
  426. originalData.forEach((item, index) => {
  427. combinedData.push(item);
  428. const nextItem = originalData[index + 1];
  429. if (nextItem && nextItem['员工姓名'] !== item['员工姓名']) {
  430. // 如果下一个员工姓名与当前不同,插入合计数据
  431. const currentSummary = summaryData.shift();
  432. combinedData.push(currentSummary);
  433. console.log(currentSummary)
  434. }
  435. });
  436. // console.log(combinedData)
  437. // 更新表格数据
  438. tableData.splice(0, tableData.length, ...combinedData);
  439. }
  440. }
  441. const generateSummaryData = (data) => {
  442. const summaryData = [];
  443. let currentName = null;
  444. let currentSummary = null;
  445. data.forEach((item) => {
  446. const name = item['员工姓名'].trim(); // 获取员工姓名并去除空格
  447. if (name !== currentName) {
  448. // 如果员工姓名发生改变,说明需要插入合计数据
  449. if (currentSummary) {
  450. // 将上一个员工的合计数据插入到数组中
  451. summaryData.push(currentSummary);
  452. }
  453. // 创建新的合计数据
  454. currentSummary = {
  455. '员工姓名': name,
  456. '日期': 0,
  457. '计件工资': 0,
  458. '加班工资': 0,
  459. '计时时数': 0,
  460. '计时工资': 0,
  461. '日工资合计': 0
  462. };
  463. currentName = name;
  464. }
  465. // 更新合计数据
  466. currentSummary['日期']++;
  467. currentSummary['计件工资'] += parseFloat(item['计件工资']);
  468. currentSummary['加班工资'] += parseFloat(item['加班工资']);
  469. currentSummary['计时时数'] += parseFloat(item['计时时数']);
  470. currentSummary['计时工资'] += parseFloat(item['计时工资']);
  471. currentSummary['日工资合计'] += parseFloat(item['日工资合计']);
  472. currentSummary['员工姓名']='合计('+currentSummary['日期']+'天)';
  473. });
  474. // 将最后一个员工的合计数据插入到数组中
  475. if (currentSummary) {
  476. summaryData.push(currentSummary);
  477. }
  478. // 将日期填充到表格中
  479. summaryData.forEach((summary) => {
  480. summary['计件工资'] = summary['计件工资'].toFixed(2); // 保留两位小数
  481. summary['加班工资'] = summary['加班工资'].toFixed(2);
  482. summary['计时时数'] = summary['计时时数'].toFixed(2);
  483. summary['计时工资'] = summary['计时工资'].toFixed(2);
  484. summary['日工资合计'] = summary['日工资合计'].toFixed(2);
  485. });
  486. return summaryData;
  487. };
  488. const handleNodeClick = (node, check) => {
  489. //存放当前节点的nodeId
  490. if (node.params) {
  491. params.date = node.params.date;
  492. params.sys_id = node.params.sys_id;
  493. total.value = node.params.total;
  494. getTableData();
  495. }
  496. }
  497. // 定位
  498. function onposition() {
  499. positioningVisibleshow.value=true
  500. }
  501. const enterpositioning = async () => {
  502. console.log(params.date)
  503. let parts = params.date.split('-')
  504. // # 截取第一个"-"之前的内容并赋值给新变量1
  505. let new_variable1 = parts[0]
  506. console.log(new_variable1)
  507. // # 截取第一个"-"之后到第二个"-"之前的内容并赋值给新变量2
  508. let new_variable2 = parts[1]
  509. console.log(new_variable1+new_variable2)
  510. Getlocate(new_variable1+new_variable2)
  511. positioningVisibleshow.value=false
  512. }
  513. let positionvalue=ref()
  514. const Getlocate = async (value) => {
  515. // const response = await locate(locatevalue);
  516. // console.log(locatevalue)
  517. // console.log(response)
  518. // if (response.code === 0) {
  519. // tableData.splice(0, tableData.length, ...response.data.rows);
  520. // }
  521. const response = await dailysearch({
  522. date: value,
  523. search:positionvalue.value
  524. })
  525. if (response.code === 0) {
  526. console.log(params.data+positionvalue.value)
  527. tableData.splice(0, tableData.length, ...response.data)
  528. }
  529. console.log(response)
  530. console.log(params.data+positionvalue.value)
  531. }
  532. // 搜索
  533. function onSearch() {
  534. }
  535. // ============== 表格控制部分结束 ===============
  536. // 获取需要的字典 可能为空 按需保留
  537. const setOptions = async () => {
  538. }
  539. // 获取需要的字典 可能为空 按需保留
  540. setOptions()
  541. // 多选数据
  542. const multipleSelection = ref([])
  543. // 多选
  544. const handleSelectionChange = (val) => {
  545. // multipleSelection.value = val
  546. }
  547. // 批量删除控制标记
  548. const deleteVisible = ref(false)
  549. // 多选删除
  550. const onDelete = async () => {
  551. const ids = []
  552. if (multipleSelection.value.length === 0) {
  553. ElMessage({
  554. type: 'warning',
  555. message: '请选择要删除的数据'
  556. })
  557. return
  558. }
  559. multipleSelection.value &&
  560. multipleSelection.value.map(item => {
  561. ids.push(item.ID)
  562. })
  563. const res = await deleteCompanyByIds({ ids })
  564. if (res.code === 0) {
  565. ElMessage({
  566. type: 'success',
  567. message: '删除成功'
  568. })
  569. if (tableData.value.length === ids.length && page.value > 1) {
  570. page.value--
  571. }
  572. deleteVisible.value = false
  573. getTableData()
  574. }
  575. }
  576. // 行为控制标记(弹窗内部需要增还是改)
  577. const type = ref('')
  578. // 更新行
  579. const updateCompanyFunc = async (row) => {
  580. const res = await findCompany({ ID: row.ID })
  581. type.value = 'update'
  582. if (res.code === 0) {
  583. formData.value = res.data.recompany
  584. dialogFormVisible.value = true
  585. }
  586. }
  587. // 弹窗控制标记
  588. const dialogFormVisible = ref(false)
  589. const positioningVisibleshow = ref(false)
  590. // 打开弹窗
  591. const openDialog = () => {
  592. type.value = 'create'
  593. dialogFormVisible.value = true
  594. }
  595. // 关闭弹窗
  596. const closeDialog = () => {
  597. dialogFormVisible.value = false
  598. formData.value = {
  599. address: '',
  600. image: '',
  601. name: '',
  602. }
  603. }
  604. // 弹窗确定
  605. const enterDialog = async () => {
  606. elFormRef.value?.validate(async (valid) => {
  607. if (!valid) return
  608. let res
  609. switch (type.value) {
  610. case 'create':
  611. res = await createCompany(formData.value)
  612. break
  613. case 'update':
  614. res = await updateCompany(formData.value)
  615. break
  616. default:
  617. res = await createCompany(formData.value)
  618. break
  619. }
  620. if (res.code === 0) {
  621. ElMessage({
  622. type: 'success',
  623. message: '创建/更改成功'
  624. })
  625. closeDialog()
  626. getTableData()
  627. }
  628. })
  629. }
  630. // 单击表格操作
  631. function ontable(row, column, event) {
  632. currentRow.value = row
  633. console.log(params.date)
  634. let parts = params.date.split('-')
  635. // # 截取第一个"-"之前的内容并赋值给新变量1
  636. let new_variable1 = parts[0]
  637. console.log(new_variable1)
  638. // # 截取第一个"-"之后到第二个"-"之前的内容并赋值给新变量2
  639. let new_variable2 = parts[1]
  640. console.log(new_variable1+new_variable2)
  641. console.log(new_variable1)
  642. console.log(row.bh)
  643. Getundertable(new_variable1,row.bh)
  644. }
  645. //获取下列表
  646. const Getundertable = async (date,bh) => {
  647. const response = await dailygetAllList({date:date,code:bh});
  648. if(response.code==0){
  649. console.log(response)
  650. tableData2.splice(0, tableData2.length, ...response.data);
  651. // console.log(response.data.num)
  652. // const rowIndex = tableData.findIndex(row => row.UniqId === lastCellValue);
  653. // console.log(rowIndex)
  654. // tableData[rowIndex].sczl_废品率系数 = response.data.num;
  655. }
  656. // console.log(response)
  657. // const rowIndex = tableData.findIndex(row => row.UniqId === 123);
  658. }
  659. // 双击表格操作
  660. function doubleClick(row, column, event) {
  661. console.log(row, column, event);
  662. // updateCompanyFunc(row);
  663. type.value = 'update';
  664. // dialogFormVisible.value = true
  665. }
  666. // 导出excel
  667. function exportExcel() {
  668. console.log('导出到excel');
  669. }
  670. const currentRow = ref()
  671. const dialogYgjjmx = ref(false)
  672. function handlePrint() {
  673. dialogYgjjmx.value = true
  674. console.log(currentRow.value);
  675. }
  676. // 生命周期钩子
  677. onMounted(async () => {
  678. });
  679. </script>
  680. <style>
  681. .JKWTree-container {
  682. display: flex;
  683. }
  684. .JKWTree-tree {
  685. width: 300px;
  686. background-color: #fff;
  687. padding: 10px;
  688. margin-right: 20px;
  689. }
  690. .JKWTree-tree h3 {
  691. font-size: 15px;
  692. font-weight: 700;
  693. margin: 10px 0;
  694. }
  695. .JKWTree-content {
  696. flex: 1;
  697. }
  698. /* 选中某行时的背景色*/
  699. .el-table__body tr.current-row>td {
  700. background: #ff80ff !important;
  701. /* 背景颜色 */
  702. }
  703. </style>