yuangongrigongzi.vue 27 KB

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