edit.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904
  1. <!-- 用户编辑弹窗 -->
  2. <template>
  3. <ele-modal
  4. class="ele-dialog-form"
  5. :title="title"
  6. :visible.sync="visible"
  7. :before-close="handleClose"
  8. :close-on-click-modal="false"
  9. :close-on-press-escape="false"
  10. width="1200px"
  11. :maxable="true"
  12. >
  13. <el-form ref="form" :model="form" :rules="rules" label-width="110px">
  14. <el-card
  15. shadow="never"
  16. header="基本信息"
  17. body-style="padding: 22px 22px 0 22px;"
  18. >
  19. <el-row>
  20. <el-col :span="8">
  21. <el-form-item label="工位编码:" prop="code">
  22. <el-input
  23. clearable
  24. @click.native="openCode"
  25. v-model="form.code"
  26. placeholder="请输入"
  27. :disabled="type === 'edit'"
  28. />
  29. </el-form-item>
  30. </el-col>
  31. <el-col :span="8">
  32. <el-form-item label="工位名称:" prop="name">
  33. <el-input
  34. clearable
  35. :maxlength="20"
  36. v-model="form.name"
  37. placeholder="请输入"
  38. />
  39. </el-form-item>
  40. </el-col>
  41. <el-col :span="8">
  42. <el-form-item label="工位类型:" prop="extInfo.type">
  43. <el-select class="ele-fluid" v-model="form.extInfo.type">
  44. <el-option
  45. label="设备"
  46. :value="1"
  47. @click.native="form.extInfo.teamId = null"
  48. />
  49. <el-option
  50. label="工位"
  51. :value="3"
  52. @click.native="
  53. form.extInfo.assetName = null;
  54. form.extInfo.assetCode = null;
  55. "
  56. />
  57. </el-select>
  58. </el-form-item>
  59. </el-col>
  60. <el-col :span="8">
  61. <el-form-item
  62. label="设备编码:"
  63. prop="extInfo.assetCode"
  64. v-if="form.extInfo.type == 1"
  65. >
  66. <el-input
  67. v-model="form.extInfo.assetCode"
  68. readonly
  69. @click.native="chooseAsset"
  70. />
  71. </el-form-item>
  72. </el-col>
  73. <el-col :span="8">
  74. <el-form-item
  75. label="设备名称:"
  76. prop="extInfo.assetName"
  77. v-if="form.extInfo.type == 1"
  78. >
  79. <el-input disabled v-model="form.extInfo.assetName" />
  80. </el-form-item>
  81. </el-col>
  82. <el-col :span="8">
  83. <el-form-item
  84. label="班组:"
  85. prop="extInfo.teamId"
  86. v-if="form.extInfo.type == 3"
  87. >
  88. <el-select
  89. style="width: 100%"
  90. v-model="form.extInfo.teamId"
  91. clearable
  92. :filterable="true"
  93. @change="userListFn"
  94. >
  95. <el-option
  96. v-for="item in teamPagerList"
  97. :key="item.id"
  98. :label="item.name"
  99. :value="item.id"
  100. />
  101. </el-select>
  102. </el-form-item>
  103. </el-col>
  104. <el-col :span="8">
  105. <el-form-item
  106. label="人员:"
  107. prop="extInfo.teamId"
  108. v-if="form.extInfo.type == 3"
  109. >
  110. <el-select
  111. style="width: 100%"
  112. v-model="form.extInfo.userIds"
  113. multiple
  114. >
  115. <el-option
  116. v-for="item in userList"
  117. :key="item.id"
  118. :label="item.name"
  119. :value="item.id"
  120. />
  121. </el-select>
  122. </el-form-item>
  123. </el-col>
  124. <el-col :span="8">
  125. <el-form-item label="所属区域:" prop="location_city">
  126. <area-select
  127. v-model="form.areaId"
  128. @checkedKeys="getAreaInfo"
  129. :data="areaTreeList"
  130. ref="tree"
  131. />
  132. </el-form-item>
  133. </el-col>
  134. <el-col :span="8">
  135. <el-form-item label="所属工厂:" prop="extInfo.factoryId">
  136. <el-select
  137. v-model="form.extInfo.factoryId"
  138. placeholder="请选择"
  139. @change="change_factoryId"
  140. style="width: 100%"
  141. >
  142. <el-option
  143. v-for="item in factoryList"
  144. :key="item.id"
  145. :label="item.name"
  146. :value="item.id"
  147. >
  148. </el-option>
  149. </el-select>
  150. </el-form-item>
  151. </el-col>
  152. <el-col :span="8">
  153. <el-form-item label="所属厂房:" prop="extInfo.workshopPlanId">
  154. <el-select
  155. v-model="form.extInfo.workshopPlanId"
  156. placeholder="请选择"
  157. @change="getListWorkshopByParentId(false)"
  158. style="width: 100%"
  159. >
  160. <el-option
  161. v-for="item in workshopPlanList"
  162. :key="item.id"
  163. :label="item.workshopPlanName"
  164. :value="item.id"
  165. >
  166. </el-option>
  167. </el-select>
  168. </el-form-item>
  169. </el-col>
  170. <el-col :span="8">
  171. <el-form-item label="所属车间:" prop="extInfo.workshopId">
  172. <el-select
  173. v-model="form.extInfo.workshopId"
  174. placeholder="请选择"
  175. style="width: 100%"
  176. @change="change_workshop"
  177. >
  178. <el-option
  179. v-for="item in options.workshopId"
  180. :key="item.id"
  181. :label="item.name"
  182. :value="item.id"
  183. >
  184. </el-option>
  185. </el-select>
  186. </el-form-item>
  187. </el-col>
  188. <el-col :span="8">
  189. <el-form-item label="所属产线:" prop="productionLineId">
  190. <el-select
  191. v-model="form.productionLineId"
  192. placeholder="请选择"
  193. style="width: 100%"
  194. @change="change_productionLineId"
  195. >
  196. <el-option
  197. v-for="item in options.productionLineId"
  198. :key="item.id"
  199. :label="item.name"
  200. :value="item.id"
  201. >
  202. </el-option>
  203. </el-select>
  204. </el-form-item>
  205. </el-col>
  206. <el-col :span="8">
  207. <el-form-item label="负责人部门:" prop="extInfo.principalDep">
  208. <ele-tree-select
  209. clearable
  210. :data="groupList"
  211. filterable
  212. v-model="form.extInfo.principalDep"
  213. valueKey="id"
  214. labelKey="name"
  215. placeholder="请选择"
  216. @change="change_principalDep"
  217. default-expand-all
  218. />
  219. </el-form-item>
  220. </el-col>
  221. <el-col :span="8">
  222. <el-form-item label="负责人:" prop="leaderId">
  223. <el-select
  224. v-model="form.leaderId"
  225. placeholder="请选择"
  226. style="width: 100%"
  227. >
  228. <el-option
  229. v-for="item in options.leaderId"
  230. :key="item.id"
  231. :label="item.name"
  232. :value="item.id"
  233. >
  234. </el-option>
  235. </el-select>
  236. </el-form-item>
  237. </el-col>
  238. <el-col :span="8">
  239. <el-form-item label="可执行工序:" prop="taskNames">
  240. <el-input
  241. :value="form.taskNames"
  242. placeholder="请选择"
  243. @click.native="handleProduce"
  244. ></el-input>
  245. </el-form-item>
  246. </el-col>
  247. <el-col :span="8">
  248. <el-form-item label="所属工作中心:" prop="extInfo.workCenterId">
  249. <el-select
  250. v-model="form.extInfo.workCenterId"
  251. filterable
  252. disabled
  253. placeholder="请选择"
  254. style="width: 100%"
  255. >
  256. <el-option
  257. v-for="item in options.workCenterList"
  258. :key="item.id"
  259. :label="item.name"
  260. :value="item.id"
  261. >
  262. </el-option>
  263. </el-select>
  264. </el-form-item>
  265. </el-col>
  266. <el-col :span="8">
  267. <el-form-item label="状态:" prop="enabled">
  268. <el-select
  269. v-model="form.enabled"
  270. placeholder="请选择"
  271. style="width: 100%"
  272. >
  273. <el-option
  274. v-for="item in options.enabled"
  275. :key="item.value"
  276. :label="item.label"
  277. :value="item.value"
  278. >
  279. </el-option>
  280. </el-select>
  281. </el-form-item>
  282. </el-col>
  283. <el-col :span="14">
  284. <el-form-item label="节拍时间:" prop="extInfo.meterTime">
  285. <div class="workMeter-warp">
  286. <el-input
  287. class="s1"
  288. clearable
  289. :maxlength="20"
  290. v-model="form.extInfo.meterTime"
  291. placeholder="请输入"
  292. />
  293. <DictSelection
  294. style="width: 30%"
  295. dictName="计量单位"
  296. clearable
  297. v-model="form.extInfo.meterMeasuringUnit"
  298. >
  299. </DictSelection>
  300. <span class="s3">/</span>
  301. <el-select
  302. class="s2"
  303. v-model="form.extInfo.meterTimeUnit"
  304. placeholder="请选择"
  305. >
  306. <el-option
  307. v-for="item in options.meterTimeUnit"
  308. :key="item.value"
  309. :label="item.label"
  310. :value="item.value"
  311. >
  312. </el-option>
  313. </el-select>
  314. </div>
  315. </el-form-item>
  316. </el-col>
  317. <el-col :span="24">
  318. <el-form-item label="备注:" prop="remark">
  319. <el-input
  320. clearable
  321. :maxlength="100"
  322. type="textarea"
  323. v-model="form.remark"
  324. placeholder="请输入"
  325. />
  326. </el-form-item>
  327. </el-col>
  328. </el-row>
  329. </el-card>
  330. <!-- <el-card
  331. shadow="never"
  332. header="关联设备"
  333. body-style="padding: 22px 22px 0 22px;"
  334. >
  335. <equipmentTable ref="equipmentTable"></equipmentTable>
  336. </el-card> -->
  337. </el-form>
  338. <template v-slot:footer>
  339. <el-button @click="handleClose">取消</el-button>
  340. <el-button type="primary" :loading="loading" @click="save">
  341. 保存
  342. </el-button>
  343. </template>
  344. <!-- 选择设备 -->
  345. <ProductModal
  346. ref="productRefs"
  347. :isLedger="true"
  348. @changeProduct="determineChoose"
  349. />
  350. <ProduceDialog ref="produceRef" @changeProduct="produceConfirm" />
  351. <!-- 自定义编码 -->
  352. <CodeDialog
  353. ref="codeRefs"
  354. v-if="codeShow"
  355. @close="codeShow = false"
  356. @chooseCode="chooseCode"
  357. ></CodeDialog>
  358. </ele-modal>
  359. </template>
  360. <script>
  361. import {
  362. listWorkshopByParentId,
  363. saveOrUpdate_gw,
  364. listFactoryLine,
  365. getById
  366. } from '@/api/factoryModel';
  367. import { getUserPage } from '@/api/system/organization';
  368. import ProductModal from './ProductModal.vue';
  369. import producetask from '@/api/technology/production';
  370. import work from '@/api/technology/work';
  371. import ProduceDialog from './ProduceDialog';
  372. import CodeDialog from './codeDialog.vue';
  373. import AreaSelect from '@/views/enterpriseModel/regionalManage/components/area-cascader.vue';
  374. import { basicAreaPageAPI } from '@/api/regionalManage';
  375. import { listOrganizations } from '@/api/system/organization';
  376. import { getFactoryarea } from '@/api/factoryModel';
  377. import { getteampage, listUserByIds } from '@/api/workforceManagement/team';
  378. import { getCode } from '@/api/codeManagement/index.js';
  379. export default {
  380. components: {
  381. AreaSelect,
  382. ProductModal,
  383. ProduceDialog,
  384. CodeDialog
  385. },
  386. props: {
  387. options_groupId: Array
  388. },
  389. watch: {
  390. options_groupId(nval) {
  391. this.toTreeData(nval);
  392. }
  393. },
  394. data() {
  395. const defaultForm = function () {
  396. return {
  397. code: '',
  398. enabled: 1,
  399. extInfo: {
  400. factoryId: '', // 工厂
  401. workshopPlanId: '', // 厂房
  402. workshopId: '', // 车间
  403. principalDep: '', // 负责人部门
  404. meterTimeUnit: '时', // 节拍时间单位
  405. meterTime: '', // 节拍时间
  406. assetCode: '', //设备编码
  407. assetName: '', //设备名称
  408. meterMeasuringUnit: '', // 节拍计量单位
  409. workCenterId: null, //所属工作中心
  410. produceId: null, //可执行工序
  411. type: null,
  412. teamId: null
  413. },
  414. id: '',
  415. leaderId: '', // 负责人
  416. name: '',
  417. productionLineId: '',
  418. remark: '',
  419. taskIds: [],
  420. taskNames: [],
  421. workstationSubstanceList: []
  422. };
  423. };
  424. return {
  425. defaultForm,
  426. // 表单数据
  427. form: defaultForm(),
  428. factoryList: [],
  429. workshopPlanList: [],
  430. areaTreeList: [],
  431. teamPagerList: [],
  432. userList: [],
  433. // 表单验证规则
  434. rules: {
  435. code: [{ required: true, message: '请输入', trigger: 'blur' }],
  436. name: [{ required: true, message: '请输入', trigger: 'blur' }],
  437. workCenterId: [
  438. { required: true, message: '请选择', trigger: 'change' }
  439. ],
  440. processId: [{ required: true, message: '请选择', trigger: 'change' }],
  441. 'extInfo.factoryId': [
  442. { required: true, message: '请输入', trigger: 'change' }
  443. ],
  444. 'extInfo.workshopPlanId': [
  445. { required: true, message: '请输入', trigger: 'blur' }
  446. ],
  447. 'extInfo.principalDep': [
  448. { required: true, message: '请输入', trigger: 'change' }
  449. ],
  450. 'extInfo.assetCode': [
  451. { required: true, message: '请选择', trigger: 'change' }
  452. ],
  453. 'extInfo.assetName': [
  454. { required: true, message: '请选择', trigger: 'change' }
  455. ],
  456. 'extInfo.workshopId': {
  457. required: true,
  458. message: '请输入',
  459. trigger: 'change'
  460. },
  461. 'extInfo.workCenterId': {
  462. required: true,
  463. message: '请输入',
  464. trigger: 'change'
  465. },
  466. taskNames: {
  467. required: true,
  468. message: '请选择',
  469. trigger: 'change'
  470. },
  471. productionLineId: {
  472. required: true,
  473. message: '请输入',
  474. trigger: 'change'
  475. },
  476. leaderId: {
  477. required: true,
  478. message: '请输入',
  479. trigger: 'change'
  480. }
  481. },
  482. visible: false,
  483. type: '', // add/edit
  484. loading: false,
  485. codeShow: false,
  486. options: {
  487. leaderId: [],
  488. workshopId: [],
  489. workCenterList: [],
  490. produceList: [],
  491. enabled: [
  492. {
  493. label: '生效',
  494. value: 1
  495. },
  496. {
  497. label: '未生效',
  498. value: 0
  499. }
  500. ],
  501. meterTimeUnit: [
  502. {
  503. value: '时',
  504. label: '时'
  505. },
  506. {
  507. value: '分',
  508. label: '分'
  509. },
  510. {
  511. value: '秒',
  512. label: '秒'
  513. },
  514. {
  515. value: '日',
  516. label: '日'
  517. }
  518. ],
  519. productionLineId: [],
  520. areaList: []
  521. },
  522. groupList: []
  523. };
  524. },
  525. computed: {
  526. title() {
  527. switch (this.type) {
  528. case 'add':
  529. return '新增工位';
  530. case 'copy':
  531. return '新增工位';
  532. case 'edit':
  533. return '编辑工位';
  534. default:
  535. break;
  536. }
  537. }
  538. },
  539. created() {
  540. this.getGs();
  541. this.getFactoryList();
  542. this.getBasicAreaList();
  543. this.getteampagerList();
  544. },
  545. methods: {
  546. chooseAsset() {
  547. this.$refs.productRefs.open(this.form.extInfo, '选择设备', '4');
  548. },
  549. userListFn(e) {
  550. console.log(e);
  551. let that = this;
  552. listUserByIds([e]).then((res) => {
  553. console.log(res, '5263', that.userList);
  554. that.userList = res;
  555. // this.$set(this, 'userList', res);
  556. });
  557. // listUserByIds
  558. // userList
  559. // console.log(this.userList);
  560. },
  561. // 选择可执行工序
  562. handleProduce() {
  563. let param = {
  564. taskIds: this.form.taskIds && this.form.taskIds[0],
  565. taskNames: this.form.taskNames && this.form.taskNames[0]
  566. };
  567. this.$refs.produceRef.open(param);
  568. },
  569. produceConfirm(data) {
  570. console.log(data, '555555');
  571. this.form.taskIds = [data.id];
  572. this.form.taskNames = [data.name];
  573. this.form.extInfo.workCenterId = data.workCenterId;
  574. },
  575. determineChoose(title, row) {
  576. if (title == '选择设备') {
  577. this.form.extInfo.assetCode = row.code;
  578. this.form.extInfo.assetName = row.name;
  579. this.form.extInfo.assetId = row.id;
  580. }
  581. },
  582. openCode() {
  583. this.codeShow = true;
  584. },
  585. chooseCode(code) {
  586. this.$set(this.form, 'code', code);
  587. this.codeShow = false;
  588. this.$forceUpdate();
  589. },
  590. async open(type, row) {
  591. this.type = type;
  592. this.visible = true;
  593. if (type == 'edit' || type == 'copy') {
  594. for (const key of Object.keys(this.form)) {
  595. if (key !== 'extInfo') {
  596. this.form[key] = row[key];
  597. } else {
  598. for (const el of Object.keys(this.form.extInfo)) {
  599. this.form.extInfo[el] = row.extInfo[el];
  600. }
  601. }
  602. }
  603. await this.getData(row.id);
  604. // 请求下拉数据
  605. if (this.form.extInfo.factoryId) {
  606. this.getlistCf();
  607. }
  608. this.userList = [];
  609. if (this.form.extInfo.workshopPlanId) {
  610. this.getListWorkshopByParentId(true);
  611. }
  612. if (this.form.extInfo.workshopId) {
  613. this.getlistFactoryLineByParentId();
  614. }
  615. if (this.form.extInfo.principalDep) {
  616. this.getUserPage();
  617. }
  618. }
  619. if (this.type != 'edit') {
  620. this.form.code = await getCode('station_code');
  621. }
  622. this.getListWorkCenter();
  623. this.getListProduce();
  624. },
  625. getteampagerList() {
  626. let param = {
  627. pageNum: 1,
  628. size: -1
  629. };
  630. getteampage(param).then((res) => {
  631. this.teamPagerList = res.list || [];
  632. });
  633. },
  634. async getFactoryList() {
  635. const { list } = await getFactoryarea({
  636. pageNum: 1,
  637. size: 999,
  638. type: 1
  639. });
  640. this.factoryList = list || [];
  641. },
  642. /* 获取区域集合 */
  643. async getBasicAreaList() {
  644. this.areaList = await basicAreaPageAPI({
  645. pageNum: 1,
  646. size: 9999
  647. });
  648. this.areaTreeList = this.$util.toTreeData({
  649. data: this.areaList,
  650. idField: 'id',
  651. parentIdField: 'parentId'
  652. });
  653. },
  654. getAreaInfo(nodeInfo) {
  655. this.form.areaName = nodeInfo[0]?.pathLabels.join('/') || '';
  656. this.form.areaId = this.form.areaId || '';
  657. },
  658. /* 保存编辑 */
  659. save() {
  660. this.$refs.form.validate((valid) => {
  661. if (!valid) {
  662. return false;
  663. }
  664. this.loading = true;
  665. if (this.type != 'edit') {
  666. delete this.form.id;
  667. }
  668. // this.form.workstationSubstanceList =
  669. // this.$refs.equipmentTable.datasource.map((n) => {
  670. // return {
  671. // type: 1,
  672. // substanceId: n.id
  673. // };
  674. // });
  675. this.form.workstationSubstanceList = [
  676. {
  677. type: 1,
  678. substanceId: this.form.extInfo.assetId
  679. }
  680. ];
  681. saveOrUpdate_gw(this.form)
  682. .then((msg) => {
  683. this.loading = false;
  684. this.$message.success(msg);
  685. this.handleClose();
  686. this.$emit('done');
  687. })
  688. .catch((e) => {
  689. this.loading = false;
  690. this.$message.error(e.message);
  691. });
  692. });
  693. },
  694. restForm() {
  695. this.form = { ...this.defaultForm() };
  696. this.$nextTick(() => {
  697. this.$refs.form.clearValidate();
  698. });
  699. },
  700. handleClose() {
  701. this.restForm();
  702. this.loading = false;
  703. this.visible = false;
  704. },
  705. // 格式化公司数据
  706. toTreeData(val) {
  707. this.options.principalDep = this.$util.toTreeData({
  708. data: JSON.parse(JSON.stringify(val)),
  709. idField: 'id',
  710. parentIdField: 'parentId'
  711. });
  712. },
  713. // 获取工作中心
  714. getListWorkCenter() {
  715. work.list({ pageNum: 1, size: -1 }).then((res) => {
  716. this.options.workCenterList = res.list;
  717. });
  718. },
  719. // 获取工序
  720. getListProduce() {
  721. producetask.list({ pageNum: 1, size: -1 }).then((res) => {
  722. this.options.produceList = res.list;
  723. });
  724. },
  725. // 获取车间
  726. getListWorkshopByParentId(bol) {
  727. if (!bol) {
  728. this.form.extInfo.workshopId = '';
  729. this.options.workshopId = [];
  730. this.form.productionLineId = '';
  731. this.options.productionLineId = [];
  732. }
  733. listWorkshopByParentId(this.form.extInfo.workshopPlanId).then((res) => {
  734. this.options.workshopId = res;
  735. });
  736. },
  737. // 获取产线
  738. getlistFactoryLineByParentId() {
  739. listFactoryLine([this.form.extInfo.workshopId]).then((res) => {
  740. console.log(res);
  741. this.options.productionLineId = res;
  742. });
  743. },
  744. // 获取人员
  745. getUserPage() {
  746. if (!this.form.extInfo.principalDep)
  747. return (this.options.leaderId = []);
  748. let par = {
  749. groupId: this.form.extInfo.principalDep,
  750. size: 999
  751. };
  752. getUserPage(par).then((res) => {
  753. this.options.leaderId = res.list;
  754. });
  755. },
  756. // 选择工厂
  757. change_factoryId() {
  758. this.form.extInfo.workshopPlanId = '';
  759. this.workshopPlanList = [];
  760. this.form.extInfo.workshopId = '';
  761. this.options.workshopId = [];
  762. this.form.productionLineId = '';
  763. this.options.productionLineId = [];
  764. this.getlistCf();
  765. },
  766. getlistCf() {
  767. let par = {
  768. type: 2,
  769. parentId: this.form.extInfo.factoryId,
  770. size: 9999
  771. };
  772. getFactoryarea(par).then((res) => {
  773. this.workshopPlanList = res.list;
  774. });
  775. },
  776. // 选择负责人部门
  777. change_principalDep() {
  778. this.form.leaderId = '';
  779. this.getUserPage();
  780. },
  781. // 选择车间
  782. change_workshop() {
  783. this.form.leaderId = '';
  784. this.options.leaderId = [];
  785. this.getlistFactoryLineByParentId();
  786. },
  787. // 获取公司数据
  788. getGs() {
  789. listOrganizations().then((list) => {
  790. this.groupList = this.$util.toTreeData({
  791. data: list,
  792. idField: 'id',
  793. parentIdField: 'parentId'
  794. });
  795. });
  796. },
  797. // 选择产线
  798. change_productionLineId() {},
  799. // 请求详情
  800. getData(id) {
  801. return getById(id).then((res) => {
  802. if (
  803. res.workstationSubstanceList &&
  804. res.workstationSubstanceList.length > 0
  805. ) {
  806. let list = res.workstationSubstanceList.map((n) => {
  807. return n.substance;
  808. });
  809. // if (list.length > 0) {
  810. // this.$refs.equipmentTable.datasource = list;
  811. // }
  812. }
  813. this.form = Object.assign({}, this.form, res);
  814. if (res.taskList?.length) {
  815. this.form.taskNames = res.taskList.map((i) => i.name);
  816. }
  817. });
  818. }
  819. }
  820. };
  821. </script>
  822. <style lang="scss" scoped>
  823. .location-warp {
  824. display: flex;
  825. .detail {
  826. margin-left: 10px;
  827. }
  828. }
  829. .workMeter-warp {
  830. .s1 {
  831. width: 30%;
  832. margin-right: 10px;
  833. }
  834. .s2 {
  835. width: 20%;
  836. margin-left: 10px;
  837. }
  838. .s3 {
  839. margin-left: 10px;
  840. }
  841. }
  842. :deep(
  843. .el-dialog:not(.ele-dialog-form)
  844. .el-dialog__body
  845. .el-form
  846. .el-form-item:last-child
  847. ) {
  848. margin-bottom: 22px;
  849. }
  850. </style>