yuangongrigongzi.vue 27 KB

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