edit.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  1. <template>
  2. <div>
  3. <headerTitle title="基本信息" style="margin-top: 15px"></headerTitle>
  4. <el-form
  5. ref="form"
  6. :model="form"
  7. :rules="rules"
  8. label-width="100px"
  9. class="create-form"
  10. >
  11. <el-row :gutter="15">
  12. <el-col v-bind="styleResponsive ? { lg: 8, md: 12 } : { span: 8 }">
  13. <el-form-item label="处置方式:" prop="disposalType">
  14. <DictSelection
  15. dictName="设备处置方式"
  16. v-model="form.disposalType"
  17. :disabled="type == 'detail'"
  18. @change='disposalTypeChange'
  19. ></DictSelection>
  20. </el-form-item>
  21. </el-col>
  22. <el-col v-bind="styleResponsive ? { lg: 8, md: 12 } : { span: 8 }">
  23. <el-form-item label="编码:" prop="code">
  24. <el-input v-model="form.code" disabled />
  25. </el-form-item>
  26. </el-col>
  27. <el-col v-bind="styleResponsive ? { lg: 8, md: 12 } : { span: 8 }">
  28. <el-form-item label="名称:" prop="name">
  29. <el-input v-model="form.name" :disabled="type == 'detail'" />
  30. </el-form-item>
  31. </el-col>
  32. <el-col v-bind="styleResponsive ? { lg: 8, md: 12 } : { span: 8 }">
  33. <el-form-item label="管理类别:" prop="managementCategory">
  34. <DictSelection
  35. dictName="管理类别"
  36. v-model="form.managementCategory"
  37. :disabled="type == 'detail'"
  38. ></DictSelection>
  39. </el-form-item>
  40. </el-col> </el-row
  41. ></el-form>
  42. <headerTitle title="处置对象" style="margin-top: 15px"></headerTitle>
  43. <ele-pro-table
  44. ref="table"
  45. :columns="columns"
  46. :datasource="deviceList"
  47. row-key="id"
  48. height="30vh"
  49. :needPage="false"
  50. >
  51. <template v-slot:toolbar>
  52. <div class="add-product" @click="addEquipment" v-if="type != 'detail'">
  53. <i class="el-icon-circle-plus-outline"></i>
  54. </div>
  55. </template>
  56. <template v-slot:modelType="{ row }">
  57. <span>{{ row.category.modelType }}</span>
  58. </template>
  59. <template v-slot:specification="{ row }">
  60. <span>{{ row.category.specification }}</span>
  61. </template>
  62. <template v-slot:originalValue="{ row }">
  63. <el-input v-model="row.originalValue" :disabled="type == 'detail'" />
  64. </template>
  65. <template v-slot:netWorth="{ row }">
  66. <el-input v-model="row.netWorth" :disabled="type == 'detail'" />
  67. </template>
  68. <template v-slot:scrapValue="{ row }">
  69. <el-input v-model="row.scrapValue" :disabled="type == 'detail'" />
  70. </template>
  71. <template v-slot:action="{ row }">
  72. <el-popconfirm
  73. v-if="type != 'detail'"
  74. class="ele-action"
  75. title="确定要删除吗?"
  76. @confirm="del(row.id)"
  77. >
  78. <template v-slot:reference>
  79. <el-link type="danger" :underline="false" icon="el-icon-delete">
  80. 删除
  81. </el-link>
  82. </template>
  83. </el-popconfirm>
  84. </template>
  85. </ele-pro-table>
  86. <headerTitle title="处置业务" style="margin-top: 15px">
  87. </headerTitle>
  88. <el-form label-width="150px" class="create-form">
  89. <el-button
  90. size="small"
  91. type="primary"
  92. class="ele-btn-icon"
  93. style="margin-left: 15px; margin-bottom: 15px"
  94. @click="infoDisposalVisible = true"
  95. v-if="type != 'detail'"
  96. >
  97. 新增处置业务
  98. </el-button>
  99. <el-row :gutter="15">
  100. <el-col
  101. v-bind="styleResponsive ? { lg: 24, md: 24 } : { span: 24 }"
  102. v-for="item in disposalTypeList"
  103. :key="item.id"
  104. >
  105. <el-form-item :label="item.name + ':'">
  106. <div style="width: 95%; display: inline-block">
  107. <formContent
  108. :type="item.type"
  109. v-model="item.value"
  110. :disabled="type == 'detail'"
  111. />
  112. </div>
  113. <el-link
  114. type="danger"
  115. :underline="false"
  116. v-if="type != 'detail'"
  117. icon="el-icon-delete"
  118. style="display: inline-block"
  119. @click.native="delInfoDisposal(item.id)"
  120. >
  121. </el-link>
  122. </el-form-item>
  123. </el-col> </el-row
  124. ></el-form>
  125. <!-- 选择产品 -->
  126. <MaterialAdd ref="materialAddRef" @chooseEquipment="confirmChoose">
  127. </MaterialAdd>
  128. <ele-modal :visible.sync="infoDisposalVisible" width="50vw" append-to-body>
  129. <infoDisposalList
  130. :isModal="true"
  131. :disabledList="form.detailList"
  132. ref="infoDisposal"
  133. ></infoDisposalList>
  134. <template v-slot:footer>
  135. <el-button @click="infoDisposalVisible = false">取消</el-button>
  136. <el-button type="primary" @click="getInfoDisposalList">
  137. 确认
  138. </el-button>
  139. </template>
  140. </ele-modal>
  141. </div>
  142. </template>
  143. <script>
  144. // import AssetsDialog from './AssetsDialog.vue';
  145. import MaterialAdd from './MaterialAdd.vue';
  146. import formContent from './formContent.vue';
  147. import infoDisposalList from './infoDisposalList.vue';
  148. import { getById } from '@/api/bpm/components/equipmentDisposal';
  149. import deptSelect from '@/components/CommomSelect/dept-select.vue';
  150. const defForm = {
  151. name: '',
  152. id: '', //
  153. disposalType: '',
  154. managementCategory: '',
  155. processId: '',
  156. code: '',
  157. disposalTypeList: [],
  158. deviceList: []
  159. };
  160. export default {
  161. components: {
  162. // AssetsDialog,
  163. MaterialAdd,
  164. infoDisposalList,
  165. deptSelect,
  166. formContent
  167. // workList
  168. },
  169. props: {
  170. businessId: {
  171. default: ''
  172. },
  173. taskDefinitionKey: {
  174. default: ''
  175. }
  176. },
  177. data() {
  178. return {
  179. visible: false,
  180. loading: false,
  181. infoDisposalVisible: false,
  182. title: '物品处置',
  183. type: 'detail',
  184. form: { ...defForm },
  185. rules: {
  186. name: [{ required: true, message: '请选择', trigger: 'change' }],
  187. type: [{ required: true, message: '请选择', trigger: 'change' }],
  188. disposalType: [{ required: true, message: '请选择', trigger: 'change' }],
  189. },
  190. deviceList: [],
  191. disposalTypeList: [],
  192. columns: []
  193. };
  194. },
  195. computed: {
  196. // 是否开启响应式布局
  197. styleResponsive() {
  198. return this.$store.state.theme.styleResponsive;
  199. }
  200. },
  201. created() {
  202. this.open();
  203. this.type = this.taskDefinitionKey == 'fqr' ? 'edit' : 'detail';
  204. },
  205. methods: {
  206. async columnsInit(val) {
  207. this.columns = [
  208. {
  209. columnKey: 'index',
  210. label: '序号',
  211. type: 'index',
  212. width: 55,
  213. align: 'center',
  214. showOverflowTooltip: true,
  215. fixed: 'left'
  216. },
  217. {
  218. prop: 'fixCode',
  219. label: '固资编码',
  220. showOverflowTooltip: true,
  221. align: 'center'
  222. },
  223. {
  224. prop: 'codeNumber',
  225. label: '编码',
  226. showOverflowTooltip: true,
  227. align: 'center'
  228. },
  229. {
  230. prop: 'name',
  231. showOverflowTooltip: true,
  232. label: '名称',
  233. align: 'center'
  234. },
  235. {
  236. prop: 'modelType',
  237. showOverflowTooltip: true,
  238. slot: 'modelType',
  239. label: '型号',
  240. align: 'center'
  241. },
  242. {
  243. prop: 'specification',
  244. showOverflowTooltip: true,
  245. slot: 'specification',
  246. label: '规格',
  247. align: 'center'
  248. },
  249. {
  250. prop: 'sealingTime',
  251. showOverflowTooltip: true,
  252. label: '封存时间',
  253. show: val == 6,
  254. align: 'center'
  255. },
  256. {
  257. showOverflowTooltip: true,
  258. prop: 'postName',
  259. label: '使用部门',
  260. align: 'center'
  261. },
  262. {
  263. prop: 'usePerson',
  264. showOverflowTooltip: true,
  265. label: '使用人',
  266. align: 'center'
  267. },
  268. {
  269. prop: 'serviceLife',
  270. label: '耐用年限',
  271. showOverflowTooltip: true,
  272. align: 'center'
  273. },
  274. {
  275. prop: 'alreadyServiceLife',
  276. label: '已使用年限',
  277. showOverflowTooltip: true,
  278. align: 'center'
  279. },
  280. {
  281. prop: 'originalValue',
  282. label: '原值',
  283. slot: 'originalValue',
  284. showOverflowTooltip: true,
  285. align: 'center'
  286. },
  287. {
  288. prop: 'netWorth',
  289. slot: 'netWorth',
  290. label: '净值',
  291. showOverflowTooltip: true,
  292. align: 'center'
  293. },
  294. {
  295. slot: 'scrapValue',
  296. prop: 'scrapValue',
  297. label: '残值',
  298. showOverflowTooltip: true,
  299. align: 'center'
  300. },
  301. {
  302. prop: 'manufacturer',
  303. label: '生产厂家',
  304. showOverflowTooltip: true,
  305. align: 'center'
  306. },
  307. ,
  308. {
  309. prop: 'pathName',
  310. label: '位置',
  311. showOverflowTooltip: true,
  312. minWidth: 110,
  313. formatter: (_row) => {
  314. const positionDetail =
  315. _row.position &&
  316. _row.position.length != 0 &&
  317. _row.position[0].detailPosition
  318. ? _row.position[0].detailPosition
  319. : '-';
  320. return _row.deviceLocationName
  321. ? _row.deviceLocationName + '-' + positionDetail
  322. : '';
  323. }
  324. },
  325. {
  326. columnKey: 'action',
  327. label: '操作',
  328. width: 140,
  329. align: 'center',
  330. resizable: false,
  331. fixed: 'right',
  332. slot: 'action',
  333. showOverflowTooltip: true
  334. }
  335. ];
  336. },
  337. async open() {
  338. const data = await getById(this.businessId);
  339. this.form = data;
  340. this.columnsInit(this.form.disposalType);
  341. this.form.disposalType = this.form.disposalType + '';
  342. this.form.managementCategory = this.form.managementCategory + '';
  343. this.deviceList = this.form.deviceList;
  344. this.disposalTypeList = this.form.disposalTypeList;
  345. },
  346. disposalTypeChange(val) {
  347. this.columnsInit(val);
  348. },
  349. del(id) {
  350. this.deviceList = this.deviceList.filter((item) => item.id != id);
  351. },
  352. addEquipment() {
  353. this.$refs.materialAddRef.open(null, null, true, this.deviceList);
  354. },
  355. // 确定选择
  356. confirmChoose(data) {
  357. this.deviceList.push(...data);
  358. },
  359. getInfoDisposalList() {
  360. this.disposalTypeList.push(...this.$refs.infoDisposal.getValue());
  361. this.infoDisposalVisible = false;
  362. },
  363. delInfoDisposal(id) {
  364. this.disposalTypeList = this.disposalTypeList.filter(
  365. (item) => item.id != id
  366. );
  367. },
  368. /* 保存编辑 */
  369. getTableValue() {
  370. if (this.deviceList.length == 0) {
  371. this.$message.error('请选择处置对象!');
  372. return;
  373. }
  374. this.form.deviceList = this.deviceList;
  375. this.form.disposalTypeList = this.disposalTypeList;
  376. return this.form;
  377. }
  378. }
  379. };
  380. </script>
  381. <style lang="scss" scoped>
  382. .basic-details-title {
  383. margin: 10px 0;
  384. }
  385. .title {
  386. font-size: 16px;
  387. line-height: 45px;
  388. }
  389. .add-product {
  390. width: 100%;
  391. display: flex;
  392. align-items: center;
  393. // justify-content: flex-end;
  394. font-size: 30px;
  395. color: #1890ff;
  396. margin: 10px 0;
  397. cursor: pointer;
  398. }
  399. </style>