dictionaries.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734
  1. <template>
  2. <div>
  3. <el-container>
  4. <el-aside width="350px">
  5. <div class="JKWTree-tree">
  6. <h3>其他常用字典查询</h3>
  7. <el-tree :data="treeData" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
  8. </div>
  9. </el-aside>
  10. <el-container>
  11. <el-main>
  12. <div class="gva-search-box">
  13. <!-- <el-form ref="elSearchFormRef" :inline="true" :model="searchInfo" class="demo-form-inline" :rules="searchRule" @keyup.enter="onSubmit">
  14. <el-form-item label="创建日期" prop="createdAt">
  15. <template #label>
  16. <span>
  17. 创建日期
  18. <el-tooltip content="搜索范围是开始日期(包含)至结束日期(不包含)">
  19. <el-icon><QuestionFilled /></el-icon>
  20. </el-tooltip>
  21. </span>
  22. </template>
  23. <el-date-picker v-model="searchInfo.startCreatedAt" type="datetime" placeholder="开始日期" :disabled-date="time=> searchInfo.endCreatedAt ? time.getTime() > searchInfo.endCreatedAt.getTime() : false"></el-date-picker>
  24. <el-date-picker v-model="searchInfo.endCreatedAt" type="datetime" placeholder="结束日期" :disabled-date="time=> searchInfo.startCreatedAt ? time.getTime() < searchInfo.startCreatedAt.getTime() : false"></el-date-picker>
  25. </el-form-item>
  26. <el-form-item>
  27. <el-button type="primary" icon="search" @click="onSubmit">查询</el-button>
  28. <el-button icon="refresh" @click="onReset">重置</el-button>
  29. </el-form-item>
  30. </el-form> -->
  31. <!-- <div class="gva-btn-list">-->
  32. <!-- <el-button type="primary" icon="upload" @click="bacthEditClick">定额参数批量修改excel</el-button>-->
  33. <!-- <el-button type="primary" icon="plus" @click="bacthSubmit">更新</el-button>-->
  34. <!-- </div>-->
  35. <!-- </div>-->
  36. <!-- <div class="gva-table-box">-->
  37. <!-- &lt;!&ndash; <div class="gva-btn-list">-->
  38. <!-- <el-button type="primary" icon="upload" @click="">导出到excel</el-button>-->
  39. <!-- <el-button type="primary" icon="plus" @click="getDetails(2)">详情</el-button>-->
  40. <!-- </div> &ndash;&gt;-->
  41. <!-- <el-table-->
  42. <!-- ref="multipleTable"-->
  43. <!-- stripe-->
  44. <!-- border-->
  45. <!-- style="width: 100%"-->
  46. <!-- tooltip-effect="dark"-->
  47. <!-- :data="tableData"-->
  48. <!-- row-key="ID"-->
  49. <!-- @selection-change="handleSelectionChange"-->
  50. <!-- @row-dblclick="updateCompanyFunc"-->
  51. <!-- :show-overflow-tooltip="true"-->
  52. <!-- highlight-current-row="true"-->
  53. <!-- >-->
  54. <!-- <el-table-column align="left" label="定额代号" prop="sys_bh" width="120" />-->
  55. <!-- <el-table-column align="left" label="名称备注" prop="sys_mc" width="210" />-->
  56. <!-- <el-table-column align="left" label="使用工序" prop="use_gx" width="88" />-->
  57. <!-- <el-table-column align="left" label="适用机型" prop="use_machine" width="88" />-->
  58. <!-- <el-table-column fixed="right" v-slot="scope" align="left" label="日定额" width="100" >-->
  59. <!-- <el-input @input="inputClick" v-model="scope.row.daily_quota" :clearable="false"/>-->
  60. <!-- </el-table-column>-->
  61. <!-- <el-table-column fixed="right" v-slot="scope" align="left" label="千件工价" width="100" >-->
  62. <!-- <el-input @input="inputClick" v-model="scope.row.thousand_piece" :clearable="false"/>-->
  63. <!-- </el-table-column>-->
  64. <!-- <el-table-column fixed="right" v-slot="scope" align="left" label="补产标准" width="100" >-->
  65. <!-- <el-input @input="inputClick" v-model="scope.row.production_standard" :clearable="false"/>-->
  66. <!-- </el-table-column>-->
  67. <!-- &lt;!&ndash; <el-table-column align="left" label="原日定额" prop="daily_quota" width="90" />-->
  68. <!-- <el-table-column align="left" label="原千件工价" prop="thousand_piece" width="100" />-->
  69. <!-- <el-table-column align="left" label="原补产标准" prop="production_standard" width="100" /> &ndash;&gt;-->
  70. <!-- &lt;!&ndash; <el-table-column fixed="right" v-slot="scope" align="left" label="新日定额" width="100" >-->
  71. <!-- <el-input @input="inputClick" v-model="scope.row.daily_quota" :clearable="false"/>-->
  72. <!-- </el-table-column>-->
  73. <!-- <el-table-column fixed="right" v-slot="scope" align="left" label="新千件工价" width="100" >-->
  74. <!-- <el-input @input="inputClick" v-model="scope.row.thousand_piece" :clearable="false"/>-->
  75. <!-- </el-table-column>-->
  76. <!-- <el-table-column fixed="right" v-slot="scope" align="left" label="新补产标准" width="100" >-->
  77. <!-- <el-input @input="inputClick" v-model="scope.row.production_standard" :clearable="false"/>-->
  78. <!-- </el-table-column> &ndash;&gt;-->
  79. <!-- &lt;!&ndash; <el-table-column v-slot="scope" align="left" label="新补产标准" width="100">-->
  80. <!-- <el-form-item :prop="'tableData.'+scope.row+'.production_standard'">-->
  81. <!-- <el-input v-model="scope.row.production_standard" :clearable="true"/>-->
  82. <!-- </el-form-item>-->
  83. <!-- </el-table-column> &ndash;&gt;-->
  84. <!-- <el-table-column v-slot="scope" v-if="false" align="left" label="UniqId" width="100" >-->
  85. <!-- <el-input v-model="scope.row.UniqId" :clearable="false"/>-->
  86. <!-- </el-table-column>-->
  87. <!-- </el-table>-->
  88. <!-- <div class="gva-pagination">
  89. <el-pagination
  90. layout="total, sizes, prev, pager, next, jumper"
  91. :current-page="page"
  92. :page-size="pageSize"
  93. :page-sizes="[10, 30, 50, 100]"
  94. :total="total"
  95. @current-change="handleCurrentChange"
  96. @size-change="handleSizeChange"
  97. :row-style="{ height: '20px' }"
  98. :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
  99. :header-cell-style="{ padding: '0px' }"
  100. />
  101. </div> -->
  102. </div>
  103. <el-dialog v-model="dialogFormVisible" :before-close="closeDialog" :title="type==='create'?'添加':'修改'" destroy-on-close>
  104. <el-scrollbar height="500px">
  105. <el-form :model="formData" label-position="right" ref="elFormRef" :rules="rule" label-width="80px">
  106. <el-form-item label="address字段:" prop="address" >
  107. <el-input v-model="formData.address" :clearable="true" placeholder="请输入address字段" />
  108. </el-form-item>
  109. <el-form-item label="image字段:" prop="image" >
  110. <el-input v-model="formData.image" :clearable="true" placeholder="请输入image字段" />
  111. </el-form-item>
  112. <el-form-item label="name字段:" prop="name" >
  113. <el-input v-model="formData.name" :clearable="true" placeholder="请输入name字段" />
  114. </el-form-item>
  115. </el-form>
  116. </el-scrollbar>
  117. <template #footer>
  118. <div class="dialog-footer">
  119. <el-button @click="closeDialog">取 消</el-button>
  120. <el-button type="primary" @click="enterDialog">确 定</el-button>
  121. </div>
  122. </template>
  123. </el-dialog>
  124. <el-dialog v-model="detailShow" style="width: 800px" lock-scroll :before-close="closeDetailShow" :title="`当前编码:${pieceData.sys_bh}`" destroy-on-close>
  125. <el-scrollbar height="300px">
  126. <el-descriptions column="1" border>
  127. <el-descriptions-item label="编号">
  128. {{ pieceData.sys_bh }}
  129. </el-descriptions-item>
  130. <el-descriptions-item label="名称">
  131. {{ pieceData.sys_mc }}
  132. </el-descriptions-item>
  133. <el-descriptions-item label="适用工序">
  134. {{ pieceData.sygx }}
  135. </el-descriptions-item>
  136. <el-descriptions-item label="适用机型">
  137. {{ pieceData.syjx }}
  138. </el-descriptions-item>
  139. </el-descriptions>
  140. <el-descriptions column="3" border>
  141. <el-descriptions-item label="日定额">
  142. {{ pieceData.daily_quota }}
  143. </el-descriptions-item>
  144. <el-descriptions-item label="千件工价">
  145. {{ pieceData.thousand_piece }}
  146. </el-descriptions-item>
  147. <el-descriptions-item label="小时补产标准">
  148. {{ pieceData.production_standard }}
  149. </el-descriptions-item>
  150. </el-descriptions>
  151. <el-descriptions column="10" direction="vertical" border>
  152. <el-descriptions-item label="机长">
  153. {{ pieceData.fir_proportion }}
  154. </el-descriptions-item>
  155. <el-descriptions-item label="副机">
  156. {{ pieceData.sec_proportion }}
  157. </el-descriptions-item>
  158. <el-descriptions-item label="调墨">
  159. {{ pieceData.ink_proportion }}
  160. </el-descriptions-item>
  161. <el-descriptions-item label="二手">
  162. {{ pieceData.second_hand_proportion }}
  163. </el-descriptions-item>
  164. <el-descriptions-item label="飞达">
  165. {{ pieceData.feeder_proportion }}
  166. </el-descriptions-item>
  167. <el-descriptions-item label="辅助">
  168. {{ pieceData.auxiliary_proportion }}
  169. </el-descriptions-item>
  170. <el-descriptions-item label="放卷">
  171. {{ pieceData.unwinder_proportion }}
  172. </el-descriptions-item>
  173. <el-descriptions-item label="分切1">
  174. {{ pieceData.cutting_one_proportion }}
  175. </el-descriptions-item>
  176. <el-descriptions-item label="分切2">
  177. {{ pieceData.cutting_two_proportion }}
  178. </el-descriptions-item>
  179. <el-descriptions-item label="检验">
  180. {{ pieceData.inspect_proportion }}
  181. </el-descriptions-item>
  182. </el-descriptions>
  183. </el-scrollbar>
  184. </el-dialog>
  185. </el-main>
  186. </el-container>
  187. </el-container>
  188. </div>
  189. </template>
  190. <script setup>
  191. import {
  192. dictionaryTab,
  193. dictionaryList,
  194. dictionaryEdit,
  195. getOnePieceWork,
  196. getPieceWork,
  197. getPieceParams,
  198. editAllParams
  199. } from '@/api/mes/job'
  200. import {
  201. createCompany,
  202. deleteCompany,
  203. deleteCompanyByIds,
  204. updateCompany,
  205. findCompany,
  206. getCompanyList
  207. } from '@/api/company'
  208. // 全量引入格式化工具 请按需保留
  209. import { getDictFunc, formatDate, formatBoolean, filterDict, ReturnArrImg, onDownloadFile } from '@/utils/format'
  210. import { ElMessage, ElMessageBox } from 'element-plus'
  211. import { ref, reactive } from 'vue'
  212. defineOptions({
  213. name: 'Company'
  214. })
  215. // const process_data = async(data) => {
  216. // tree_data = []
  217. // for(key, values in data.items()){
  218. // node = {
  219. // 'label': key,
  220. // 'children': []
  221. // }
  222. // if(isinstance(values, dict)){
  223. // for(sub_key, sub_values in values.items()){
  224. // if(isinstance(sub_values, list)){
  225. // children = list(filter(None, sub_values))
  226. // if(children){
  227. // node_children = {
  228. // 'label': sub_key,
  229. // 'children': [{'label': child} for child in children]
  230. // }
  231. // node['children'].append(node_children)
  232. // }else if(isinstance(sub_values, dict)){
  233. // grandchildren = process_data(sub_values)
  234. // if(grandchildren){
  235. // node_children = {
  236. // 'label': sub_key,
  237. // 'children': grandchildren
  238. // }
  239. // node['children'].append(node_children)
  240. // }
  241. // }
  242. // tree_data.append(node)
  243. // }
  244. // }
  245. // }
  246. // }
  247. // }
  248. var mzstr = ''
  249. var mzarr=[]
  250. var gystr = ''
  251. var gyarr=[]
  252. var fpstr = ''
  253. var fparr=[]
  254. var gzstr = ''
  255. var gzarr=[]
  256. var jbstr = ''
  257. var jbarr=[]
  258. var xlstr = ''
  259. var xlarr=[]
  260. const treeData=ref([])
  261. const treeTab = async() => {
  262. const dictionaryTabs = await dictionaryTab()
  263. if (dictionaryTabs.code === 0) {
  264. for(let key in dictionaryTabs.data.民族){
  265. mzstr+=key+','
  266. }
  267. mzstr=mzstr.substring(0,mzstr.length-1)
  268. mzarr=mzstr.split(',')
  269. const 民族=mzarr.map(item=>({
  270. label:item,
  271. cate:`民族`
  272. }))
  273. for(let key in dictionaryTabs.data.标准工艺){
  274. gystr+=key+'-'
  275. for(let keys in dictionaryTabs.data.标准工艺[key]){
  276. gystr+=dictionaryTabs.data.标准工艺[key][keys]+'-'
  277. }
  278. gystr+=','
  279. }
  280. gystr=gystr.substring(0,gystr.length-1)
  281. gyarr=gystr.split(',')
  282. const 标准工艺=gyarr.map(item=>({
  283. label:item.substring(0,gystr.length-1).split('-')[0],
  284. cate:`标准工艺`,
  285. children:item.substring(0,gystr.length-1).split('-').splice(1,item.substring(0,gystr.length-1).split('-').length-2).map(items=>({
  286. label:items,
  287. cate:`标准工艺`,
  288. }))
  289. }))
  290. for(let key in dictionaryTabs.data.废品分类){
  291. fpstr+=key+'+'
  292. for(let keys in dictionaryTabs.data.废品分类[key]){
  293. fpstr+=dictionaryTabs.data.废品分类[key][keys]+'+'
  294. }
  295. fpstr+=','
  296. }
  297. fpstr=fpstr.substring(0,fpstr.length-1)
  298. fparr=fpstr.split(',')
  299. const 废品分类=fparr.map(item=>({
  300. label:item.substring(0,fpstr.length-1).split('+')[0],
  301. cate:`废品分类`,
  302. children:item.substring(0,fpstr.length-1).split('+').splice(1,item.substring(0,fpstr.length-1).split('+').length-2).map(items=>({
  303. label:items,
  304. cate:`废品分类`,
  305. }))
  306. }))
  307. for(let key in dictionaryTabs.data.工资表){
  308. gzstr+=key+','
  309. }
  310. gzstr=gzstr.substring(0,gzstr.length-1)
  311. gzarr=gzstr.split(',')
  312. const 工资表=gzarr.map(item=>({
  313. label:item,
  314. cate:`工资表`
  315. }))
  316. for(let key in dictionaryTabs.data.级别){
  317. jbstr+=key+','
  318. }
  319. jbstr=jbstr.substring(0,jbstr.length-1)
  320. jbarr=jbstr.split(',')
  321. const 级别=jbarr.map(item=>({
  322. label:item,
  323. cate:`级别`
  324. }))
  325. for(let key in dictionaryTabs.data.学历){
  326. xlstr+=key+','
  327. }
  328. xlstr=xlstr.substring(0,xlstr.length-1)
  329. xlarr=xlstr.split(',')
  330. const 学历=xlarr.map(item=>({
  331. label:item,
  332. cate:`学历`
  333. }))
  334. // console.log(dictionaryTabs.data.标准工艺.外发加工.map(items=>({
  335. // lable:items
  336. // })))
  337. // const 标准工艺=gyarr.map(item=>({
  338. // lable:item,
  339. // cate:`标准工艺`,
  340. // children:dictionaryTabs.data.标准工艺.item.map(items=>({
  341. // lable:items
  342. // }))
  343. // }))
  344. treeData.value = [
  345. {
  346. label: '民族',
  347. children:民族,
  348. cate:'民族'
  349. },
  350. {
  351. label: '标准工艺',
  352. children:标准工艺,
  353. cate:'标准工艺'
  354. },
  355. {
  356. label: '废品分类',
  357. children:废品分类,
  358. cate:'废品分类'
  359. },
  360. {
  361. label: '工资表',
  362. children:工资表,
  363. cate:'工资表'
  364. },
  365. {
  366. label: '级别',
  367. children:级别,
  368. cate:'级别'
  369. },
  370. {
  371. label: '学历',
  372. children:学历,
  373. cate:'学历'
  374. }
  375. ]
  376. }
  377. }
  378. treeTab()
  379. const handleNodeClick = (node,check) => {
  380. //存放当前节点的nodeId
  381. // if (node.paramss) {
  382. // sys_bh.value = node.paramss.code;
  383. // getDetails();
  384. // return false;
  385. // }
  386. // if (node.params) {
  387. // sys_bh.value = node.params.code;
  388. // getDetails();
  389. // }
  390. // if(node.children==null){
  391. // sys_bh.value = node.params.code;
  392. // getDetails();
  393. // }else{
  394. // if(node.children.length==0){
  395. // sys_bh.value = node.params.code;
  396. // getDetails();
  397. // }
  398. // }
  399. if(node){
  400. cate.value=node.cate
  401. search.value=node.label
  402. }
  403. // console.log(class.value);
  404. // console.log(node,check);
  405. }
  406. // 自动化生成的字典(可能为空)以及字段
  407. const formData = ref({
  408. address: '',
  409. image: '',
  410. name: '',
  411. })
  412. // 验证规则
  413. const rule = reactive({
  414. })
  415. const searchRule = reactive({
  416. createdAt: [
  417. { validator: (rule, value, callback) => {
  418. if (searchInfo.value.startCreatedAt && !searchInfo.value.endCreatedAt) {
  419. callback(new Error('请填写结束日期'))
  420. } else if (!searchInfo.value.startCreatedAt && searchInfo.value.endCreatedAt) {
  421. callback(new Error('请填写开始日期'))
  422. } else if (searchInfo.value.startCreatedAt && searchInfo.value.endCreatedAt && (searchInfo.value.startCreatedAt.getTime() === searchInfo.value.endCreatedAt.getTime() || searchInfo.value.startCreatedAt.getTime() > searchInfo.value.endCreatedAt.getTime())) {
  423. callback(new Error('开始日期应当早于结束日期'))
  424. } else {
  425. callback()
  426. }
  427. }, trigger: 'change' }
  428. ],
  429. })
  430. const elFormRef = ref()
  431. const elSearchFormRef = ref()
  432. // =========== 表格控制部分 ===========
  433. const page = ref(1)
  434. const total = ref(0)
  435. const pageSize = ref(10)
  436. const tableData = ref([])
  437. const searchInfo = ref({})
  438. const sys_bh = ref()
  439. const cate = ref()
  440. const search = ref()
  441. const pieceData = ref([])
  442. const isSubmit = ref(0)
  443. // 重置
  444. const onReset = () => {
  445. searchInfo.value = {}
  446. getTableData()
  447. }
  448. // 搜索
  449. const onSubmit = () => {
  450. elSearchFormRef.value?.validate(async(valid) => {
  451. if (!valid) return
  452. page.value = 1
  453. pageSize.value = 10
  454. getTableData()
  455. })
  456. }
  457. // 分页
  458. const handleSizeChange = (val) => {
  459. pageSize.value = val
  460. getTableData()
  461. }
  462. // 修改页面容量
  463. const handleCurrentChange = (val) => {
  464. page.value = val
  465. getTableData()
  466. }
  467. const inputClick = async() => {
  468. isSubmit.value=1
  469. }
  470. const bacthEditClick = async() => {
  471. const dictionaryLists = await dictionaryList({class:cate.value,search:search.value})
  472. if (dictionaryLists.code === 0) {
  473. tableData.value = dictionaryLists.data
  474. isSubmit.value=0
  475. }
  476. }
  477. const bacthSubmit = async() => {
  478. if(isSubmit.value===1){
  479. const dictionaryEdits = await dictionaryEdit(tableData.value)
  480. if (dictionaryEdits.code === 0) {
  481. ElMessage({
  482. type: 'success',
  483. message: '更新成功'
  484. })
  485. isSubmit.value=0
  486. }
  487. // console.log(tableData.value)
  488. }
  489. }
  490. // 查询
  491. // const getTableData = async() => {
  492. // const table = await getCompanyList({ page: page.value, pageSize: pageSize.value, ...searchInfo.value })
  493. // if (table.code === 0) {
  494. // tableData.value = table.data.list
  495. // total.value = table.data.total
  496. // page.value = table.data.page
  497. // pageSize.value = table.data.pageSize
  498. // }
  499. // }
  500. // getTableData()
  501. // ============== 表格控制部分结束 ===============
  502. // 获取需要的字典 可能为空 按需保留
  503. const setOptions = async () =>{
  504. }
  505. // 获取需要的字典 可能为空 按需保留
  506. setOptions()
  507. // 多选数据
  508. const multipleSelection = ref([])
  509. // 多选
  510. const handleSelectionChange = (val) => {
  511. multipleSelection.value = val
  512. }
  513. // 删除行
  514. const deleteRow = (row) => {
  515. ElMessageBox.confirm('确定要删除吗?', '提示', {
  516. confirmButtonText: '确定',
  517. cancelButtonText: '取消',
  518. type: 'warning'
  519. }).then(() => {
  520. deleteCompanyFunc(row)
  521. })
  522. }
  523. // 批量删除控制标记
  524. const deleteVisible = ref(false)
  525. // 多选删除
  526. const onDelete = async() => {
  527. const ids = []
  528. if (multipleSelection.value.length === 0) {
  529. ElMessage({
  530. type: 'warning',
  531. message: '请选择要删除的数据'
  532. })
  533. return
  534. }
  535. multipleSelection.value &&
  536. multipleSelection.value.map(item => {
  537. ids.push(item.ID)
  538. })
  539. const res = await deleteCompanyByIds({ ids })
  540. if (res.code === 0) {
  541. ElMessage({
  542. type: 'success',
  543. message: '删除成功'
  544. })
  545. if (tableData.value.length === ids.length && page.value > 1) {
  546. page.value--
  547. }
  548. deleteVisible.value = false
  549. getTableData()
  550. }
  551. }
  552. // 行为控制标记(弹窗内部需要增还是改)
  553. const type = ref('')
  554. // 更新行
  555. const updateCompanyFunc = async(row) => {
  556. // const res = await findCompany({ ID: row.ID })
  557. // type.value = 'update'
  558. // if (res.code === 0) {
  559. // formData.value = res.data.recompany
  560. // dialogFormVisible.value = true
  561. // }
  562. }
  563. // 删除行
  564. const deleteCompanyFunc = async (row) => {
  565. const res = await deleteCompany({ ID: row.ID })
  566. if (res.code === 0) {
  567. ElMessage({
  568. type: 'success',
  569. message: '删除成功'
  570. })
  571. if (tableData.value.length === 1 && page.value > 1) {
  572. page.value--
  573. }
  574. getTableData()
  575. }
  576. }
  577. // 弹窗控制标记
  578. const dialogFormVisible = ref(false)
  579. // 查看详情控制标记
  580. const detailShow = ref(false)
  581. // 打开详情弹窗
  582. const openDetailShow = () => {
  583. detailShow.value = true
  584. }
  585. // 打开详情
  586. const getDetails = async () => {
  587. const getOnePieceWorks = await getOnePieceWork({code:sys_bh.value})
  588. if (getOnePieceWorks.code === 0) {
  589. // getProcessLosss.data[0].forEach(function(i,index){
  590. // console.log(i)
  591. // })
  592. pieceData.value=getOnePieceWorks.data[0]
  593. openDetailShow()
  594. }
  595. openDetailShow()
  596. // 打开弹窗
  597. // const res = await findCompany({ ID: row })
  598. // if (res.code === 0) {
  599. // formData.value = res.data.recompany
  600. // openDetailShow()
  601. // }
  602. }
  603. // 关闭详情弹窗
  604. const closeDetailShow = () => {
  605. detailShow.value = false
  606. formData.value = {
  607. address: '',
  608. image: '',
  609. name: '',
  610. }
  611. }
  612. // 打开弹窗
  613. const openDialog = () => {
  614. // type.value = 'create'
  615. dialogFormVisible.value = true
  616. }
  617. // 关闭弹窗
  618. const closeDialog = () => {
  619. dialogFormVisible.value = false
  620. formData.value = {
  621. address: '',
  622. image: '',
  623. name: '',
  624. }
  625. }
  626. // 弹窗确定
  627. const enterDialog = async () => {
  628. elFormRef.value?.validate( async (valid) => {
  629. if (!valid) return
  630. let res
  631. switch (type.value) {
  632. case 'create':
  633. res = await createCompany(formData.value)
  634. break
  635. case 'update':
  636. res = await updateCompany(formData.value)
  637. break
  638. default:
  639. res = await createCompany(formData.value)
  640. break
  641. }
  642. if (res.code === 0) {
  643. ElMessage({
  644. type: 'success',
  645. message: '创建/更改成功'
  646. })
  647. closeDialog()
  648. getTableData()
  649. }
  650. })
  651. }
  652. </script>
  653. <style>
  654. .JKWTree-container {
  655. display: flex;
  656. }
  657. .JKWTree-tree {
  658. width: 350px;
  659. background-color: #fff;
  660. padding: 10px;
  661. margin-right: 20px;
  662. }
  663. .JKWTree-tree h3 {
  664. font-size: 15px;
  665. font-weight: 700;
  666. margin: 10px 0;
  667. }
  668. .JKWTree-content {
  669. flex: 1;
  670. }
  671. </style>