gongdanziliao.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746
  1. <template>
  2. <div>
  3. <el-container>
  4. <!-- 左侧树形结构 -->
  5. <el-aside width="170px">
  6. <div class="JKWTree-tree" style="width: 100%;height: 746px">
  7. <h3>工单管理</h3>
  8. <el-tree :data="treeData.data" :props="defaultProps" @node-click="handleNodeClick">
  9. </el-tree>
  10. </div>
  11. </el-aside>
  12. <!-- 右侧内容区域 -->
  13. <el-container>
  14. <el-main>
  15. <!-- 搜索框 -->
  16. <div class="gva-search-box">
  17. <el-form ref="elSearchFormRef" :inline="true" :model="searchInfo" class="demo-form-inline" :rules="searchRule" @keyup.enter="onSubmit">
  18. <!-- 左侧查询输入框 -->
  19. <el-form-item>
  20. <el-input v-model="searchInfo.keyword" placeholder="请输入工单编号或印品名称" clearable style="width: 200px;"></el-input>
  21. </el-form-item>
  22. <!-- 右侧查询和重置按钮 -->
  23. <el-form-item>
  24. <el-button type="primary" icon="search" @click="onSubmit">查询</el-button>
  25. <!-- <el-button icon="refresh" @click="onReset">重置</el-button>-->
  26. <!-- <el-button type="primary" icon="plus" @click="openDialog">新增</el-button>-->
  27. <!-- <el-button type="primary" icon="Download" @click="exportToExcel" style="float: right;">导出到Excel</el-button>-->
  28. <!-- <el-dialog v-model="dialogexportToExcel" title="导出到Excel" width="50%">-->
  29. <el-button type="primary" icon="edit" @click="onhqcpzlclick" style="margin-left: 10px">印用产品资料</el-button>
  30. <el-dialog v-model="onhqcpzllist" title="获取产品资料" width="50%">
  31. <div style="display: flex; flex-direction: column; align-items: center; height: 100%;">
  32. <!-- 其他内容 -->
  33. <el-form-item label=" " prop="processName">
  34. <el-input v-model="hqcpzlformData['gdbh']" disabled :clearable="true" placeholder="" style="width: 100%;" />
  35. </el-form-item>
  36. <div style="width: 100%; display: flex; justify-content: center; align-items: flex-end; height: 35%;">
  37. <div slot="footer" class="dialog-footer" style="text-align: center;">
  38. <el-button type="primary" @click="hqcpzlhandleConfirm">执行</el-button>
  39. <el-button @click="hqcpzlhandleCancel">放弃</el-button>
  40. </div>
  41. </div>
  42. </div>
  43. </el-dialog>
  44. <!-- </el-dialog>-->
  45. </el-form-item>
  46. </el-form>
  47. </div>
  48. <!-- 表格及操作按钮 -->
  49. <div class="gva-table-box">
  50. <!-- 表格 -->
  51. <el-table ref="multipleTable"
  52. style="width: 100%;height: 40vh"
  53. :row-style="{ height: '20px' }"
  54. :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
  55. :header-cell-style="{ padding: '0px' }"
  56. border
  57. tooltip-effect="dark"
  58. :data="tableData"
  59. row-key="ID"
  60. @row-click="tableRowClick"
  61. highlight-current-row="true"
  62. @row-dblclick="updateCompanyFunc"
  63. @selection-change="handleSelectionChange"
  64. :show-overflow-tooltip="true">
  65. <el-table-column type="selection" width="55"/>
  66. <el-table-column align="left" label="工单编号" prop="工单编号" width="100" />
  67. <el-table-column align="left" label="生产分类" prop="生产分类" width="100" />
  68. <el-table-column align="left" label="销售订单号" prop="销售订单号" width="290" />
  69. <el-table-column align="left" label="产品代号" prop="产品代号" width="100" />
  70. <el-table-column align="left" label="产品名称" prop="产品名称" width="670" />
  71. <el-table-column align="left" label="订单数量" prop="订单数量" width="120" />
  72. <el-table-column align="left" label="单位" prop="单位" />
  73. <el-table-column align="left" label="折合大箱" prop="折合大箱" width="90" />
  74. <el-table-column align="left" label="投料率" prop="投料率" />
  75. <el-table-column align="left" label="平均合格率" prop="平均合格率" width="100" />
  76. <el-table-column align="left" label="开单日期" prop="开单日期" width="100" />
  77. <el-table-column align="left" label="交货日期" prop="交货日期" width="100" />
  78. <el-table-column align="left" label="工单类型" prop="工单类型" width="100" />
  79. <el-table-column align="left" label="工单状态" prop="工单状态" width="100" />
  80. <el-table-column align="left" label="当前生产工序" prop="当前生产工序" width="120" />
  81. <el-table-column align="left" label="产量提交时间" prop="产量提交时间" width="120" />
  82. <el-table-column align="left" label="建档用户" prop="建档用户" width="120" />
  83. <el-table-column align="left" label="建档时间" prop="建档时间" width="170" />
  84. <el-table-column align="left" label="更新时间" prop="更新时间" width="170" />
  85. </el-table>
  86. <!-- 分页 -->
  87. <!-- <div class="gva-pagination">-->
  88. <!-- <el-pagination layout="total, sizes, prev, pager, next, jumper" :current-page="page"-->
  89. <!-- :page-size="pageSize" :page-sizes="[10, 30, 50, 100]" :total="total"-->
  90. <!-- @current-change="handleCurrentChange" @size-change="handleSizeChange" />-->
  91. <!-- </div>-->
  92. </div>
  93. <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
  94. <el-tab-pane label="印件资料" @click="showTable('印件资料')" name="first">
  95. <el-table ref="multipleTable"
  96. :row-style="{ height: '20px' }"
  97. :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
  98. :header-cell-style="{ padding: '0px' }"
  99. :show-overflow-tooltip="true"
  100. highlight-current-row="true"
  101. style="width: 100%;height: 400px" border tooltip-effect="dark" :data="yjtableData" row-key="ID" @selection-change="handleSelectionChange">
  102. <el-table-column type="selection" width="55" />
  103. <el-table-column align="left" label="印件号" prop="印件号" width="80"/>
  104. <el-table-column align="left" label="印件代号" prop="印件代号" width="120"/>
  105. <el-table-column align="left" label="印件名称" prop="印件名称" width="340"/>
  106. <el-table-column align="left" label="纸张代号" prop="纸张代号" width="100"/>
  107. <el-table-column align="left" label="纸张名称" prop="纸张名称" width="340"/>
  108. <el-table-column align="left" label="投料规格" prop="投料规格" width="100"/>
  109. <el-table-column align="left" label="平张投料" prop="平张投料" width="100"/>
  110. <el-table-column align="left" label="开料规格" prop="开料规格" width="100"/>
  111. <el-table-column align="left" label="开数*联数" prop="开数*联数" width="100"/>
  112. <el-table-column align="left" label="建档用户" prop="建档用户" width="120"/>
  113. <el-table-column align="left" label="建档时间" prop="建档时间" width="160"/>
  114. <el-table-column align="left" label="更新时间" prop="更新时间" width="160"/>
  115. </el-table>
  116. </el-tab-pane>
  117. <el-tab-pane label="工艺资料" @click="showTable('工艺资料')" name="second">
  118. <el-table ref="multipleTable"
  119. :row-style="{ height: '20px' }"
  120. :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
  121. :header-cell-style="{ padding: '0px' }"
  122. highlight-current-row="true"
  123. :show-overflow-tooltip="true"
  124. style="width: 100%;height: 400px" border tooltip-effect="dark" :data="gytableData" row-key="ID" @selection-change="handleSelectionChange">
  125. <el-table-column type="selection" width="55" />
  126. <el-table-column align="left" label="重点工序" prop="重点工序" width="100"/>
  127. <el-table-column align="left" label="印件-工序" prop="印件-工序" width="100"/>
  128. <el-table-column align="left" label="备选工序" prop="备选工序" width="100"/>
  129. <el-table-column align="left" label="工序名称" prop="工序名称" width="340"/>
  130. <el-table-column align="left" label="计划产量" prop="计划产量" width="100"/>
  131. <el-table-column align="left" label="基础损耗" prop="基础损耗" width="100"/>
  132. <el-table-column align="left" label="报废定额" prop="报废定额" width="100"/>
  133. <el-table-column align="left" label="允损比例" prop="允损比例" width="100"/>
  134. <el-table-column align="left" label="难度系数" prop="难度系数" width="100"/>
  135. <el-table-column align="left" label="损耗系数" prop="损耗系数" width="100"/>
  136. <el-table-column align="left" label="人工检_次品板" prop="人工检_次品板" width="160"/>
  137. <el-table-column align="left" label="人工检_废检" prop="人工检_废检" width="160"/>
  138. <el-table-column align="left" label="机检_正品板" prop="机检_正品板" width="160"/>
  139. <el-table-column align="left" label="机检_次品板" prop="机检_次品板" width="160"/>
  140. <el-table-column align="left" label="机检_废检" prop="机检_废检" width="100"/>
  141. <el-table-column align="left" label="开数*联数" prop="开数*联数" width="100"/>
  142. <el-table-column align="left" label="备注" prop="备注" width="450"/>
  143. <el-table-column align="left" label="印刷方式" prop="印刷方式" width="100"/>
  144. <el-table-column align="left" label="版距" prop="版距" width="100"/>
  145. <el-table-column align="left" label="建档用户" prop="建档用户" width="160"/>
  146. <el-table-column align="left" label="建档日期" prop="建档日期" width="160"/>
  147. <el-table-column align="left" label="更新时间" prop="更新时间" width="160"/>
  148. </el-table>
  149. </el-tab-pane>
  150. <el-tab-pane label="BOM资料" @click="showTable('BOM资料')" name="third">
  151. <el-table ref="multipleTable"
  152. :row-style="{ height: '20px' }"
  153. :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
  154. :header-cell-style="{ padding: '0px' }"
  155. :show-overflow-tooltip="true"
  156. highlight-current-row="true"
  157. style="width: 100%;height: 400px" border tooltip-effect="dark" :data="bomtableData" row-key="ID" @selection-change="handleSelectionChange">
  158. <el-table-column type="selection" width="55" />
  159. <el-table-column align="left" label="方案" prop="方案" width="120"/>
  160. <el-table-column align="left" label="物料编号" prop="物料编号" width="100"/>
  161. <el-table-column align="left" label="物料名称" prop="物料名称" width="400"/>
  162. <el-table-column align="left" label="计划用量" prop="计划用量" width="100"/>
  163. <el-table-column align="left" label="建档用户" prop="建档用户" width="120"/>
  164. <el-table-column align="left" label="建档时间" prop="建档时间" width="160"/>
  165. <el-table-column align="left" label="更新时间" prop="更新时间" width="160"/>
  166. <el-table-column align="left" label="消耗定量" prop="消耗定量" width="210"/>
  167. </el-table>
  168. </el-tab-pane>
  169. </el-tabs>
  170. <!-- 弹窗 -->
  171. <el-dialog v-model="dialogFormVisible"
  172. :before-close="closeDialog"
  173. style="width: 1000px;" :title="type==='create'?'添加工单资料':'修改工单资料'" destroy-on-close>
  174. <el-row>
  175. <el-form :model="scgdformData" label-position="right" ref="elFormRef" :rules="rule" >
  176. <!-- 第一排 -->
  177. <el-row :gutter="20">
  178. <el-col :span="6">
  179. <el-form-item label="重点工单:" prop="keyOrder">
  180. <el-input v-model="scgdformData['重点工单']" :clearable="true" placeholder=""/>
  181. </el-form-item>
  182. </el-col>
  183. <el-col :span="7">
  184. <el-form-item label="开单日期" prop="orderDate">
  185. <el-date-picker v-model="scgdformData['开单日期']" type="date" placeholder="选择日期" :clearable="true" />
  186. </el-form-item>
  187. </el-col>
  188. <el-col :span="5">
  189. <el-form-item label="工单编号:" prop="orderNumber">
  190. <el-input v-model="scgdformData['工单编号']" :clearable="true" placeholder="" />
  191. </el-form-item>
  192. </el-col>
  193. <el-col :span="5">
  194. <el-form-item label="生产类型:" prop="productionType">
  195. <el-input v-model="scgdformData['生产类型']" :clearable="true" placeholder="" />
  196. </el-form-item>
  197. </el-col>
  198. </el-row>
  199. <!-- 第二排 -->
  200. <el-row :gutter="20">
  201. <el-col :span="6">
  202. <el-form-item label="客户代号:" prop="customerCode">
  203. <el-input v-model="scgdformData['客户代号']" :clearable="true" placeholder="" />
  204. </el-form-item>
  205. </el-col>
  206. <el-col :span="14">
  207. <el-form-item label="客户名称:" prop="customerName">
  208. <el-input v-model="scgdformData['客户名称']" :clearable="true" placeholder="" />
  209. </el-form-item>
  210. </el-col>
  211. </el-row>
  212. <!-- 第三排 -->
  213. <el-row :gutter="20">
  214. <el-col :span="6">
  215. <el-form-item label="产品代码:" prop="productCode">
  216. <el-input v-model="scgdformData['产品代号']" :clearable="true" placeholder=""/>
  217. </el-form-item>
  218. </el-col>
  219. <el-col :span="14">
  220. <el-form-item label="产品名称:" prop="productName">
  221. <el-input v-model="scgdformData['产品名称']" :clearable="true" placeholder="" />
  222. </el-form-item>
  223. </el-col>
  224. </el-row>
  225. <!-- 第四排 -->
  226. <el-row :gutter="20">
  227. <el-col :span="6">
  228. <el-form-item label="印件代码:" prop="customerCode">
  229. <el-input v-model="scgdformData['印件代号']" :clearable="true" placeholder="" />
  230. </el-form-item>
  231. </el-col>
  232. <el-col :span="14">
  233. <el-form-item label="印件名称:" prop="customerName">
  234. <el-input v-model="scgdformData['印件名称']" :clearable="true" placeholder="" />
  235. </el-form-item>
  236. </el-col>
  237. </el-row>
  238. <!-- 第五排 -->
  239. <el-row :gutter="20">
  240. <el-col :span="6">
  241. <el-form-item label="订单数量:" prop="orderQuantity">
  242. <el-input v-model="scgdformData['订单数量']" :clearable="true" placeholder="" style="width: 140px;" />
  243. </el-form-item>
  244. </el-col>
  245. <el-col :span="6">
  246. <el-form-item label="交货日期:" prop="deliveryDate">
  247. <el-input v-model="scgdformData['交货日期']" :clearable="true" placeholder="" style="width: 140px;" />
  248. </el-form-item>
  249. </el-col>
  250. <el-col :span="6">
  251. <el-form-item label="投料率:" prop="feedRate">
  252. <el-input v-model="scgdformData['投料率']" :clearable="true" placeholder="" style="width: 140px;" />
  253. </el-form-item>
  254. </el-col>
  255. <el-col :span="6">
  256. <el-form-item label="平均合格率:" prop="passRate">
  257. <el-input v-model="scgdformData['平均合格率']" :clearable="true" placeholder="" style="width: 140px;" />
  258. </el-form-item>
  259. </el-col>
  260. </el-row>
  261. <!-- 第六排 -->
  262. <el-row :gutter="20">
  263. <el-col :span="6">
  264. <el-form-item label="平张投料:" prop="flatFeed">
  265. <el-input v-model="scgdformData['平张投料']" :clearable="true" placeholder="" style="width: 140px;" />
  266. </el-form-item>
  267. </el-col>
  268. <el-col :span="6">
  269. <el-form-item label="万小张:" prop="perTenThousand">
  270. <el-input v-model="scgdformData['万小张']" :clearable="true" placeholder="" style="width: 140px;" />
  271. <el-input v-model="scgdformData['单位']" :clearable="true" placeholder="" style="width: 140px;" />
  272. </el-form-item>
  273. </el-col>
  274. <el-col :span="6">
  275. <el-form-item label="投料大箱:" prop="feedBox">
  276. <el-input v-model="scgdformData['折合大箱']" :clearable="true" placeholder="" style="width: 140px;" />
  277. </el-form-item>
  278. </el-col>
  279. <el-col :span="6">
  280. <el-form-item label="库存大箱:" prop="stockBox">
  281. <el-input v-model="scgdformData['库存大箱']" :clearable="true" placeholder="" style="width: 140px;" />
  282. </el-form-item>
  283. </el-col>
  284. </el-row>
  285. <!-- 第七排 -->
  286. <el-row :gutter="20">
  287. <el-col :span="20">
  288. <el-form-item label="销售订单号:" prop="salesOrder">
  289. <el-input v-model="scgdformData['销售订单号']" :clearable="true" placeholder="" />
  290. </el-form-item>
  291. </el-col>
  292. </el-row>
  293. <!-- 第八排 -->
  294. <el-row :gutter="20">
  295. <el-col :span="20">
  296. <el-form-item label="警语版面:" prop="warningLayout">
  297. <el-input v-model="scgdformData['警语版面']" :clearable="true" placeholder="" />
  298. </el-form-item>
  299. </el-col>
  300. </el-row>
  301. <!-- 第九排 -->
  302. <el-row :gutter="20">
  303. <el-col :span="6">
  304. <el-form-item label="版本号:" prop="versionNumber">
  305. <el-input v-model="scgdformData['版本号']" :clearable="true" placeholder="" />
  306. </el-form-item>
  307. </el-col>
  308. <el-col :span="14">
  309. <el-form-item label="客户ERP编码:" prop="customerErpCode">
  310. <el-input v-model="scgdformData['客户ERP编码']" :clearable="true" placeholder="" />
  311. </el-form-item>
  312. </el-col>
  313. </el-row>
  314. <!-- 第十排 -->
  315. <el-row :gutter="20">
  316. <el-col :span="8">
  317. <el-form-item label="码源数量:" prop="codeSourceQuantity">
  318. <el-input v-model="scgdformData['码源数量']" :clearable="true" placeholder="" style="width: 170px;" />
  319. </el-form-item>
  320. </el-col>
  321. </el-row>
  322. <!-- 第十一排 -->
  323. <el-row :gutter="20">
  324. <el-col :span="20">
  325. <el-form-item label="进程备注:" prop="processNote">
  326. <el-input v-model="scgdformData['进程备注']" :clearable="true" placeholder="" />
  327. </el-form-item>
  328. </el-col>
  329. </el-row>
  330. <!-- 第十二排 -->
  331. <el-row :gutter="20">
  332. <el-col :span="20">
  333. <el-form-item label="备注说明:" prop="remark">
  334. <el-input type="textarea" v-model="scgdformData['备注']" :rows="4" :clearable="true" placeholder="请输入备注说明" style="width: 100%;" />
  335. </el-form-item>
  336. </el-col>
  337. </el-row>
  338. </el-form>
  339. </el-row>
  340. <!-- 添加 编辑页面 取消 确定 -->
  341. <template #footer>
  342. <div class="dialog-footer">
  343. <el-button @click="closeDialog">取 消</el-button>
  344. <el-button type="primary" @click="enterDialog">确 定</el-button>
  345. </div>
  346. </template>
  347. </el-dialog>
  348. </el-main>
  349. </el-container>
  350. </el-container>
  351. </div>
  352. </template>
  353. <script>
  354. //点击按钮显示下方表格
  355. export default {
  356. data() {
  357. return {
  358. currentTable: '', // 当前展示的表格
  359. activeName: 'first',
  360. // 其他表格数据...
  361. };
  362. },
  363. methods: {
  364. showTable(tableName) {
  365. // console.log(tableName)
  366. // 根据点击的按钮设置当前展示的表格
  367. this.currentTable = tableName;
  368. },
  369. showTableChange() {
  370. // 处理表格选中事件
  371. },
  372. // 其他方法...
  373. }
  374. };
  375. </script>
  376. <script setup>
  377. // 全量引入格式化工具 请按需保留
  378. import {createCompany, deleteCompany, deleteCompanyByIds, updateCompany, findCompany, getCompanyList} from '@/api/company'
  379. import { getDictFunc, formatDate, formatBoolean, filterDict, ReturnArrImg, onDownloadFile } from '@/utils/format'
  380. import { ElMessage, ElMessageBox } from 'element-plus'
  381. import { ref, reactive } from 'vue'
  382. import {DataList, WorkList, Craft, Printed, Bom, DataCorrection, setProductStatus} from "@/api/yunyin/yunying";
  383. defineOptions({name: 'Company'})
  384. // =========== 导出Excel表格 ===========
  385. // const exportToExcel = () => {
  386. // console.log('点击了导出按钮')
  387. // dialogexportToExcel.value = true;
  388. // }
  389. // // 导出Excel弹窗
  390. // const dialogexportToExcel = ref(false)
  391. // =========== 印用产品资料 ===========
  392. const onhqcpzllist = ref(false);
  393. const hqcpzlformData = reactive({
  394. gdbh: '',//当工单编号
  395. });
  396. const DataLists = async () => {
  397. const DataListss = await DataList({Gd_gdbh:_Gd_gdbh.value});
  398. // hqcpzlformData.gdbh = DataListss
  399. console.log(DataListss)
  400. };
  401. // const onhqcpzlclick = () => {
  402. const onhqcpzlclick = async () => {
  403. onhqcpzllist.value = true;
  404. DataLists()
  405. // try {
  406. // const data = await DataList(Gd_gdbh:_Gd_gdbh.value);
  407. // console.log(data);
  408. // } catch (error) {
  409. // console.error(error);
  410. // }
  411. // if(_Gd_gdbh.value == null){
  412. // onstatuslist.value = false;
  413. // alert('请选择具体的工单后,再操作此功能');
  414. // }else{
  415. // hqcpzlformData.process = _Gd_gdbh.value;
  416. // onstatuslist.value = true;
  417. // }
  418. };
  419. // 获取产品资料放弃
  420. const hqcpzlhandleCancel = () => {
  421. onhqcpzllist.value = false;
  422. };
  423. //获取产品资料执行
  424. const hqcpzlhandleConfirm = async () => {
  425. onhqcpzllist.value = false;
  426. };
  427. // =========== 左侧树侧形结构 ===========
  428. const treeData = reactive({data:[]});
  429. // const treeData = reactive({});
  430. const defaultProps = {
  431. children: 'children',
  432. label: 'label'
  433. };
  434. const DataListdata = async () => {
  435. try {
  436. const data = await DataList();
  437. for(let key in data.data)
  438. {
  439. let temp = data.data[key].split('【');
  440. // console.log('tree data list:>>',temp)
  441. let object = {};
  442. object.id = temp[0];
  443. object.label = data.data[key]
  444. object.chaildren = []
  445. treeData.data.push(object)
  446. }
  447. } catch (error) {
  448. console.error(error);
  449. }
  450. };
  451. DataListdata();
  452. //点击左侧树形获取编号
  453. const tableData = reactive([])
  454. const handleNodeClick = async (node) => {
  455. const Gd_khdh = '0201';
  456. try {
  457. const WorkListdata = await WorkList({ Gd_khdh:Gd_khdh});//接口调用函数
  458. tableData.splice(0,tableData.length,...WorkListdata.data);//表格数据
  459. total.value = tableData.length;//共多少条
  460. } catch (error) {
  461. console.error(error);
  462. }
  463. };
  464. //印件资料
  465. const yjtableData = ref([])
  466. //工艺资料
  467. const gytableData = ref([])
  468. //BOM资料
  469. const bomtableData = ref([])
  470. //全局调用工单编号
  471. const _Gd_gdbh = ref(null)
  472. //点击表格行 获取下方表格数据列表
  473. const tableRowClick = async (row) => {
  474. _Gd_gdbh.value = row.工单编号;
  475. const Gd_gdbh = row.工单编号;
  476. const yjres = await Printed({ Gd_gdbh:Gd_gdbh});
  477. const gyres = await Craft({ Gd_gdbh:Gd_gdbh });
  478. const bomres = await Bom({ Gd_gdbh:Gd_gdbh});
  479. yjtableData.value = yjres.data;
  480. gytableData.value = gyres.data;
  481. bomtableData.value = bomres.data;
  482. };
  483. // 分页
  484. const handleCurrentChange = (val) => {
  485. page.value = val;
  486. // console.log(page)
  487. DataListdata();
  488. };
  489. // 修改页面容量 点击多少条/页
  490. const handleSizeChange = (val) => {
  491. page.value = 10;//默认十条
  492. pageSize.value = val;
  493. DataListdata();
  494. };
  495. // // 自动化生成的字典(可能为空)以及字段
  496. // const formData = ref({
  497. // address: '',
  498. // image: '',
  499. // name: '',
  500. // })
  501. // 验证规则
  502. const rule = reactive({
  503. })
  504. const searchRule = reactive({
  505. createdAt: [
  506. { validator: (rule, value, callback) => {
  507. if (searchInfo.value.startCreatedAt && !searchInfo.value.endCreatedAt) {
  508. callback(new Error('请填写结束日期'))
  509. } else if (!searchInfo.value.startCreatedAt && searchInfo.value.endCreatedAt) {
  510. callback(new Error('请填写开始日期'))
  511. } else if (searchInfo.value.startCreatedAt && searchInfo.value.endCreatedAt && (searchInfo.value.startCreatedAt.getTime() === searchInfo.value.endCreatedAt.getTime() || searchInfo.value.startCreatedAt.getTime() > searchInfo.value.endCreatedAt.getTime())) {
  512. callback(new Error('开始日期应当早于结束日期'))
  513. } else {
  514. callback()
  515. }
  516. }, trigger: 'change' }
  517. ],
  518. })
  519. const elFormRef = ref()
  520. const elSearchFormRef = ref()
  521. // =========== 表格控制部分 ===========
  522. const page = ref(1)
  523. const total = ref(0)
  524. const pageSize = ref(10)
  525. const searchInfo = ref({})
  526. // 重置
  527. const onReset = () => {
  528. searchInfo.value = {}
  529. getTableData()
  530. }
  531. // 搜索
  532. const onSubmit = () => {
  533. elSearchFormRef.value?.validate(async(valid) => {
  534. if (!valid) return
  535. page.value = 1
  536. pageSize.value = 10
  537. getTableData()
  538. })
  539. }
  540. // 查询
  541. const getTableData = async() => {
  542. const table = await getCompanyList({ page: page.value, pageSize: pageSize.value, ...searchInfo.value })
  543. console.log(table)
  544. // if (table.code === 0) {
  545. // tableData.value = table.data.lis t
  546. // total.value = table.data.total
  547. // page.value = table.data.page
  548. // pageSize.value = table.data.pageSize
  549. // }
  550. }
  551. getTableData()
  552. // ============== 表格控制部分结束 ===============
  553. // 获取需要的字典 可能为空 按需保留
  554. const setOptions = async () =>{}
  555. // 获取需要的字典 可能为空 按需保留
  556. setOptions()
  557. // 多选数据
  558. const multipleSelection = ref([])
  559. // 多选
  560. const handleSelectionChange = (val) => {
  561. multipleSelection.value = val
  562. }
  563. // 行为控制标记(弹窗内部需要增还是改)
  564. const type = ref('')
  565. //=========表格列表修改========
  566. let scgdformData = reactive({})
  567. const updateCompanyFunc = async(row) => {
  568. const Gd_gdbh = row['工单编号'];
  569. const tableCompanyList = await DataCorrection({ Gd_gdbh: Gd_gdbh})
  570. scgdformData = tableCompanyList.data;
  571. console.log(scgdformData);
  572. console.log(scgdformData['万小张']);
  573. dialogFormVisible.value = true
  574. }
  575. // 弹窗控制标记
  576. const dialogFormVisible = ref(false)
  577. // 打开弹窗
  578. const openDialog = () => {
  579. type.value = 'create'
  580. dialogFormVisible.value = true
  581. }
  582. // 关闭弹窗
  583. const closeDialog = () => {
  584. dialogFormVisible.value = false
  585. formData.value = {
  586. address: '',
  587. image: '',
  588. name: '',
  589. }
  590. }
  591. // // 查看详情控制标记
  592. // const detailShow = ref(false)
  593. //
  594. // // 打开详情弹窗
  595. // const openDetailShow = () => {
  596. // detailShow.value = true
  597. // }
  598. //
  599. // // 打开详情
  600. // const getDetails = async (row) => {
  601. // detailShow.value = true
  602. // }
  603. //
  604. // // 关闭详情弹窗
  605. // const closeDetailShow = () => {
  606. // detailShow.value = false
  607. // formData.value = {
  608. // address: '',
  609. // image: '',
  610. // name: '',
  611. // }
  612. // }
  613. // // 打开弹窗
  614. // const openDialog = () => {
  615. // type.value = 'create'
  616. // dialogFormVisible.value = true
  617. // }
  618. //
  619. // // 关闭弹窗
  620. // const closeDialog = () => {
  621. // dialogFormVisible.value = false
  622. // formData.value = {
  623. // address: '',
  624. // image: '',
  625. // name: '',
  626. // }
  627. // }
  628. // 弹窗确定
  629. const enterDialog = async () => {
  630. elFormRef.value?.validate( async (valid) => {
  631. if (!valid) return
  632. let res
  633. switch (type.value) {
  634. case 'create':
  635. res = await createCompany(formData.value)
  636. break
  637. case 'update':
  638. res = await updateCompany(formData.value)
  639. break
  640. default:
  641. res = await createCompany(formData.value)
  642. break
  643. }
  644. if (res.code === 0) {
  645. ElMessage({
  646. type: 'success',
  647. message: '创建/更改成功'
  648. })
  649. closeDialog()
  650. getTableData()
  651. }
  652. })
  653. }
  654. </script>
  655. <style>
  656. .JKWTree-container {
  657. display: flex;
  658. }
  659. .JKWTree-tree {
  660. width: 300px;
  661. background-color: #fff;
  662. padding: 10px;
  663. margin-right: 20px;
  664. }
  665. .JKWTree-tree h3 {
  666. font-size: 15px;
  667. font-weight: 700;
  668. margin: 10px 0;
  669. }
  670. .JKWTree-content {
  671. flex: 1;
  672. }
  673. /* 选中某行时的背景色*/
  674. .el-table__body tr.current-row>td {
  675. background: #ff80ff !important;
  676. }
  677. </style>