huang_an 2 سال پیش
والد
کامیت
c2169a9b7d

+ 157 - 158
src/views/maintenance/repair/planRepair/index.vue

@@ -1,27 +1,26 @@
 <template>
   <div class="ele-body">
-     <el-card shadow="never" v-loading="loading">
-	   <maintenance-search @search="reload">
-	   </maintenance-search>
-	   <!-- 数据表格 -->
-	   <ele-pro-table
-	     ref="table"
-	     :columns="columns"
-	     :datasource="datasource"
-	     cache-key="systemRoleTable"
-	   >
-	     <!-- 表头工具栏 -->
-	     <template v-slot:toolbar>
-	       <el-button
-	         size="small"
-	         type="primary"
-	         icon="el-icon-plus"
-	         class="ele-btn-icon"
-	         @click="jumpAdd()"
-	       >
-	         新增维修计划
-	       </el-button>
-<!-- 		   <el-button
+    <el-card shadow="never" v-loading="loading">
+      <maintenance-search @search="reload"> </maintenance-search>
+      <!-- 数据表格 -->
+      <ele-pro-table
+        ref="table"
+        :columns="columns"
+        :datasource="datasource"
+        cache-key="systemRoleTable"
+      >
+        <!-- 表头工具栏 -->
+        <template v-slot:toolbar>
+          <el-button
+            size="small"
+            type="primary"
+            icon="el-icon-plus"
+            class="ele-btn-icon"
+            @click="jumpAdd()"
+          >
+            新增维修计划
+          </el-button>
+          <!-- 		   <el-button
 		     size="small"
 		     type="primary"
 		     class="ele-btn-icon"
@@ -29,8 +28,8 @@
 		   >
 		     详情
 		   </el-button> -->
-	     </template>
-<!-- 	     <template v-slot:enable="{ row }">
+        </template>
+        <!-- 	     <template v-slot:enable="{ row }">
 	       <el-switch
 	         v-model="row.enable"
 	         active-color="#13ce66"
@@ -41,135 +40,138 @@
 	       >
 	       </el-switch>
 	     </template> -->
-	     <!-- 操作列 -->
-	     <template v-slot:action="{ row }">
-	       <el-link
-	         type="primary"
-	         :underline="false"
-	         icon="el-icon-edit"
-	         @click="toEdit(row)"
-	       >
-	         编辑
-	       </el-link>
-				 <el-popconfirm
-				   class="ele-action"
-				   title="确认撤销这条报修记录吗?"
-				   @confirm="cancel(row)"
-				 >
-				   <template v-slot:reference>
-				     <el-link type="danger" :underline="false" icon="el-icon-delete">
-				       撤回
-				     </el-link>
-				   </template>
-				 </el-popconfirm>
-	     </template>
-	   </ele-pro-table>
-     </el-card>
-	 
-	 <!-- 详情 -->
-	 <DetailDialog ref="detailDialogRef" />
+        <!-- 操作列 -->
+        <template v-slot:action="{ row }">
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-edit"
+            @click="toEdit(row)"
+          >
+            编辑
+          </el-link>
+          <el-popconfirm
+            class="ele-action"
+            title="确认撤销这条报修记录吗?"
+            @confirm="cancel(row)"
+          >
+            <template v-slot:reference>
+              <el-link type="danger" :underline="false" icon="el-icon-delete">
+                撤回
+              </el-link>
+            </template>
+          </el-popconfirm>
+        </template>
+      </ele-pro-table>
+    </el-card>
 
+    <!-- 详情 -->
+    <DetailDialog ref="detailDialogRef" />
   </div>
 </template>
 
 <script>
   import MaintenanceSearch from './components/maintenance-search.vue';
   import DetailDialog from './components/detailDialog.vue';
-  import { getPlanList , removePlan } from '@/api/maintenance/repair_report';
+  import { getPlanList, removePlan } from '@/api/maintenance/repair_report';
   import dictMixins from '@/mixins/dictMixins';
   export default {
-	mixins: [dictMixins],
+    mixins: [dictMixins],
     components: {
       MaintenanceSearch,
-	  DetailDialog
+      DetailDialog
     },
-    data () {
+    data() {
       return {
-		// 表格列配置
-		columns: [
-		  {
-		    columnKey: 'index',
-		    label: '序号',
-		    type: 'index',
-		    width: 55,
-		    align: 'center',
-		    showOverflowTooltip: true,
-		    fixed: 'left'
-		  },
-		  {
-		    prop: 'code',
-		    label: '计划单号',
-		    align: 'center',	
-		    showOverflowTooltip: true,
-		    minWidth: 110
-		  },
-		  {
-		    prop: 'name',
-		    label: '计划名称',
-		    align: 'center',
-		    showOverflowTooltip: true,
-		    minWidth: 110
-		  },
-		  {
-		    prop: 'number',
-		    label: '报修设备数量',
-		    align: 'center',	
-		    showOverflowTooltip: true,
-		    minWidth: 110
-		  },
-		  {
-		    prop: 'planStatus',
-		    label: '状态',
-		    align: 'center',	
-		    showOverflowTooltip: true,
-		    minWidth: 110,
-			formatter: (_row, _column, cellValue) => {
-			  return this.getDictValue('维修计划状态', _row.planStatus);
-			}
-		  },
-		  {
-		    prop: 'executor',
-		    label: '创建人',
-		    align: 'center',	
-		    showOverflowTooltip: true,
-		    minWidth: 110
-		  },
-		  {
-		    prop: 'createTime',
-		    label: '创建时间',
-		    align: 'center',
-		    showOverflowTooltip: true,
-		    minWidth: 110,
-		    formatter: (_row, _column, cellValue) => {
-		      return this.$util.toDateString(cellValue);
-		    }
-		  },
-		  {
-		    columnKey: 'action',
-		    label: '操作',
-		    width: 150,
-		    align: 'center',
-		    resizable: false,
-		    slot: 'action',
-		    showOverflowTooltip: true
-		  }
-		],
+        // 表格列配置
+        columns: [
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            prop: 'code',
+            label: '维修计划单号',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'name',
+            label: '维修计划名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          // {
+          //   prop: 'number',
+          //   label: '报修设备数量',
+          //   align: 'center',
+          //   showOverflowTooltip: true,
+          //   minWidth: 110
+          // },
+          {
+            prop: 'planStatus',
+            label: '状态',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            formatter: (_row, _column, cellValue) => {
+              return this.getDictValue('维修计划状态', _row.planStatus);
+            }
+          },
+          {
+            prop: 'number',
+            label: '维修人员',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'executor',
+            label: '创建人',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            formatter: (_row, _column, cellValue) => {
+              return this.$util.toDateString(cellValue);
+            }
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 150,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true
+          }
+        ],
         // 加载状态
         loading: false,
         infoData: {},
         repairInfoLogs: [],
         addDialogTitle: '新增报修记录',
         detailsDialogTitle: '报修记录详情',
-        deviceInfo: {}, //设备信息
-		
+        deviceInfo: {} //设备信息
       };
     },
-    computed: {
-
+    computed: {},
+    created() {
+      this.requestDict('维修计划状态');
     },
-	created () {
-	  this.requestDict('维修计划状态')
-	},
     methods: {
       /* 表格数据源 */
       datasource({ page, limit, where, order }) {
@@ -190,34 +192,31 @@
       reload(where) {
         this.$refs.table.reload({ page: 1, where });
       },
-	  
-	  jumpAdd(){
-		  this.$router.push({
-			path: '/maintenance/repair/maintenancePlan/add'
-		  })
-	  },
-	  toEdit({id}){
-		  this.$router.push({
-		    path: '/maintenance/repair/maintenancePlan/add',
-		  	query: {id}
-		  })
-	  },
-	  
-	  goDetail(row){
-		  this.$refs.detailDialogRef.openDeatailDialog(row)
-	  },
-		// 撤销
-		cancel(row){
-			removePlan([row.id]).then(res=>{
-				this.$message.success('撤销成功!')
-				this.reload()
-			})	  
-		}
-	  
+
+      jumpAdd() {
+        this.$router.push({
+          path: '/maintenance/repair/maintenancePlan/add'
+        });
+      },
+      toEdit({ id }) {
+        this.$router.push({
+          path: '/maintenance/repair/maintenancePlan/add',
+          query: { id }
+        });
+      },
+
+      goDetail(row) {
+        this.$refs.detailDialogRef.openDeatailDialog(row);
+      },
+      // 撤销
+      cancel(row) {
+        removePlan([row.id]).then((res) => {
+          this.$message.success('撤销成功!');
+          this.reload();
+        });
+      }
     }
   };
 </script>
 
-<style lang="scss" scoped>
-
-</style>
+<style lang="scss" scoped></style>

+ 118 - 106
src/views/maintenance/repair/repairNotes/components/addDialog.vue

@@ -92,16 +92,26 @@
               ></el-input>
             </el-form-item>
           </el-col>
-		  <el-col :span="12">
-		    <el-form-item label="维修部门:" prop="repairGroupName">
-		      <dept-select v-model="addForm.repairGroupName" placeholder="选择设备带出" disabled/>
-		    </el-form-item>
-		  </el-col>
-		  <el-col :span="12">
-		    <el-form-item label="维修人:" prop="repairUserName">
-		      <person-select v-model="addForm.repairUserName" multiple clearable placeholder="选择设备带出" disabled/>
-		    </el-form-item>
-		  </el-col>
+          <el-col :span="12">
+            <el-form-item label="维修部门:" prop="repairGroupName">
+              <dept-select
+                v-model="addForm.repairGroupName"
+                placeholder="选择设备带出"
+                disabled
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="维修人:" prop="repairUserName">
+              <person-select
+                v-model="addForm.repairUserName"
+                multiple
+                clearable
+                placeholder="选择设备带出"
+                disabled
+              />
+            </el-form-item>
+          </el-col>
         </el-row>
         <el-row>
           <el-col :span="12">
@@ -124,7 +134,11 @@
 
           <el-col :span="12">
             <el-form-item label="接收人:" prop="repairUserId">
-              <person-select v-model="addForm.repairUserId" clearable @change="changeUser"/>
+              <person-select
+                v-model="addForm.repairUserId"
+                clearable
+                @change="changeUser"
+              />
             </el-form-item>
           </el-col>
           <el-col :span="24">
@@ -140,7 +154,7 @@
               ></el-input>
             </el-form-item>
           </el-col>
-<!--          <el-col :span="24">
+          <!--          <el-col :span="24">
             <el-form-item label="图片:" prop="repairsImg">
                <SelectUpload
                 multiple
@@ -158,7 +172,9 @@
       </el-form>
     </div>
     <div class="btns">
-      <el-button type="primary" @click="submitAdd" :loading="loading">提交</el-button>
+      <el-button type="primary" @click="submitAdd" :loading="loading"
+        >提交</el-button
+      >
       <el-button @click="handleClose">关闭</el-button>
     </div>
     <CategoryDialog
@@ -174,7 +190,7 @@
   import DeptSelect from '@/components/CommomSelect/dept-select.vue';
   import PersonSelect from '@/components/CommomSelect/person-select.vue';
   import { getAssetInfo } from '@/api/ledgerAssets';
-  import { save , update } from '@/api/maintenance/repair_report';
+  import { save, update } from '@/api/maintenance/repair_report';
   import { getUserPage } from '@/api/system/organization';
   export default {
     props: {
@@ -193,133 +209,129 @@
       PersonSelect
     },
     watch: {
-      infoData (val) {
-        let id = val.id
+      infoData(val) {
+        let id = val.id;
         this.selectedEquipment(id);
-      },
+      }
     },
-    data () {
+    data() {
       return {
         addRepairNotesDialog: false,
-        addForm: { },
+        addForm: {},
         initData: [],
         addFormRules: {},
-		loading:false,
-		row:null,
-		receiverList:[]
+        loading: false,
+        row: null,
+        receiverList: []
       };
     },
-    created () {
-		this.getUserList()
+    created() {
+      this.getUserList();
     },
     methods: {
-	  init(row){
-		  this.addRepairNotesDialog = true;
-		  this.row = row
-		  if(row){
-			  this.selectedEquipment(row.deviceId)
-		  }else{
-			  
-		  } 
-	  },
-		
-      handleClose () {
+      init(row) {
+        this.addRepairNotesDialog = true;
+        this.row = row;
+        if (row) {
+          this.selectedEquipment(row.deviceId);
+        } else {
+        }
+      },
+
+      handleClose() {
         this.initData = [];
         this.addRepairNotesDialog = false;
-        this.addForm = {}
+        this.addForm = {};
       },
       // 打开选择设备弹窗
-      selectEquipment () {
+      selectEquipment() {
         this.$refs.equipmentDialogRef.open();
       },
       // 上传图片
-      getImgs (list) {
+      getImgs(list) {
         this.addForm.repairsImg = list.map((item) => item.accessUrl).join(',');
         console.log('上传的图片:', this.addForm.repairsImg);
       },
 
       // 获取接收人列表
-      async getUserList (deptCode) {
+      async getUserList(deptCode) {
         let data = { pageNum: 1, size: -1 };
         const res = await getUserPage(data);
         this.receiverList = res.list;
       },
-	  
-	  changeUser(data){
-		  this.receiverList.map(item=>{
-			  if(item.id==data){
-				  this.addForm.repairUserName = item.name
-			  }
-		  })
-	  },
-	  
+
+      changeUser(data) {
+        this.receiverList.map((item) => {
+          if (item.id == data) {
+            this.addForm.repairUserName = item.name;
+          }
+        });
+      },
 
       // 选择的设备
-      selectedEquipment (id) {
+      selectedEquipment(id) {
         getAssetInfo(id).then((res) => {
-			this.addForm = res
-			this.addForm.equiLocation = res.positionList[0].pathName
-			const model = res.category.modelType ? res.category.modelType : "";
-			const specification = res.category.specification
-				? res.category.specification + "|"
-				: res.category.modelType
-				? "|"
-				: "";
-			this.addForm.equiModel = specification + model; // 规格型号
-			if(this.row){				
-				this.$set(this.addForm,'repairDeptId',this.row.repairDeptId)
-						this.$set(this.addForm,'repairUserId',this.row.repairUserId)  
-				this.$set(this.addForm,'expectedTime',this.row.expectedTime)
-				this.$set(this.addForm,'remark',this.row.remark)
-			}
+          this.addForm = res;
+          this.addForm.equiLocation = res.positionList[0].pathName;
+          const model = res.category.modelType ? res.category.modelType : '';
+          const specification = res.category.specification
+            ? res.category.specification + '|'
+            : res.category.modelType
+            ? '|'
+            : '';
+          this.addForm.equiModel = specification + model; // 规格型号
+          if (this.row) {
+            this.$set(this.addForm, 'repairDeptId', this.row.repairDeptId);
+            this.$set(this.addForm, 'repairUserId', this.row.repairUserId);
+            this.$set(this.addForm, 'expectedTime', this.row.expectedTime);
+            this.$set(this.addForm, 'remark', this.row.remark);
+          }
         });
       },
       // 提交新增
-     submitAdd () {
+      submitAdd() {
         if (!this.addForm.code) {
           return this.$message.warning('请选择报修设备!');
         }
-		const params = {
-			deviceId: this.addForm.id,
-			expectedTime : this.addForm.expectedTime,
-			remark: this.addForm.remark,
-			repairDeptId: this.addForm.repairDeptId,
-			repairUserId: this.addForm.repairUserId,
-			status:0,
-			sourceType:1,
-			deviceCode: this.addForm.code,
-			deviceName: this.addForm.name,			
-			repairUserName: this.addForm.repairUserName
-		}
-		this.loading = true;
-		if(this.row){
-			params.id = this.row.id
-			params.code = this.row.code
-			update(params).then(res=>{
-				this.$message.success('修改成功!');
-			    this.$emit('refresh');
-				this.loading = false;
-				this.handleClose()
-			})
-			.catch((e) => {
-			  this.loading = false;
-			});
-		}else{
-			save(params).then(res=>{
-				this.$message.success('新增成功!');
-			    this.$emit('refresh');
-				this.loading = false;
-				this.handleClose()
-			})
-			.catch((e) => {
-			  this.loading = false;
-			});
-		}
-		
-      },
-
-
-
+        const params = {
+          deviceId: this.addForm.id,
+          expectedTime: new Date(this.addForm.expectedTime),
+          remark: this.addForm.remark,
+          repairDeptId: this.addForm.repairDeptId,
+          repairUserId: this.addForm.repairUserId,
+          status: 0,
+          sourceType: 1,
+          deviceCode: this.addForm.code,
+          deviceName: this.addForm.name,
+          repairUserName: this.addForm.repairUserName
+        };
+        this.loading = true;
+        if (this.row) {
+          params.id = this.row.id;
+          params.code = this.row.code;
+          update(params)
+            .then((res) => {
+              this.$message.success('修改成功!');
+              this.$emit('refresh');
+              this.loading = false;
+              this.handleClose();
+            })
+            .catch((e) => {
+              this.loading = false;
+            });
+        } else {
+          save(params)
+            .then((res) => {
+              this.$message.success('新增成功!');
+              this.$emit('refresh');
+              this.loading = false;
+              this.handleClose();
+            })
+            .catch((e) => {
+              this.loading = false;
+            });
+        }
+      }
     }
   };
 </script>

+ 56 - 63
src/views/maintenance/repair/repairNotes/index.vue

@@ -33,7 +33,7 @@
             :underline="false"
             icon="el-icon-edit"
             @click="appoint(row)"
-			v-if="row.status==0||row.status==6"
+            v-if="row.status == 0 || row.status == 6"
           >
             委外
           </el-link>
@@ -45,17 +45,17 @@
           >
             修改
           </el-link>
-			<el-popconfirm
-			  class="ele-action"
-			  title="确定要撤销此报修记录吗?"
-			  @confirm="remove(row)"
-			>
-			  <template v-slot:reference>
-				<el-link type="danger" :underline="false" icon="el-icon-delete">
-				  撤销
-				</el-link>
-			  </template>
-			</el-popconfirm>
+          <el-popconfirm
+            class="ele-action"
+            title="确定要撤销此报修记录吗?"
+            @confirm="remove(row)"
+          >
+            <template v-slot:reference>
+              <el-link type="danger" :underline="false" icon="el-icon-delete">
+                撤销
+              </el-link>
+            </template>
+          </el-popconfirm>
         </template>
       </ele-pro-table>
     </el-card>
@@ -69,34 +69,28 @@
       @refresh="reload"
     />
 
-    <DetailsDialog
-      ref="detailsDialogRef"
-      :dialogTitle="detailsDialogTitle"
-    />
-	<!-- 委外弹窗 -->
-	<EntrustDialog
-	  ref="entDialogRef"	 
-	  @refresh="reload"
-	/>
+    <DetailsDialog ref="detailsDialogRef" :dialogTitle="detailsDialogTitle" />
+    <!-- 委外弹窗 -->
+    <EntrustDialog ref="entDialogRef" @refresh="reload" />
   </div>
 </template>
 
 <script>
-  import { getPage , removeRequest } from '@/api/maintenance/repair_report';
+  import { getPage, removeRequest } from '@/api/maintenance/repair_report';
   import NotesSearch from './components/notes-search.vue';
   import AddDialog from './components/addDialog.vue';
   import EntrustDialog from './components/entrustDialog.vue';
   import DetailsDialog from '../components/RepairDetailsDialog.vue';
   import dictMixins from '@/mixins/dictMixins';
   export default {
-	mixins: [dictMixins],
+    mixins: [dictMixins],
     components: {
       NotesSearch,
       AddDialog,
       DetailsDialog,
       EntrustDialog
     },
-    data () {
+    data() {
       return {
         // 表格列配置
         columns: [
@@ -138,19 +132,19 @@
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 110,
-			formatter: (_row, _column, cellValue) => {
-			  return _row.sourceType==3?'自动报修':'人工报修'
-			}
+            formatter: (_row, _column, cellValue) => {
+              return _row.sourceType == 3 ? '自动报修' : '人工报修';
+            }
           },
           {
             prop: 'sourceType',
-            label: '来源',
+            label: '报修来源',
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 110,
-			formatter: (_row, _column, cellValue) => {
-			  return this.getDictValue('报修来源', _row.sourceType);
-			}
+            formatter: (_row, _column, cellValue) => {
+              return this.getDictValue('报修来源', _row.sourceType);
+            }
           },
           {
             prop: 'sourceCode',
@@ -165,9 +159,9 @@
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 110,
-			formatter: (_row, _column, cellValue) => {
-			  return this.getDictValue('报修状态', _row.status);
-			}
+            formatter: (_row, _column, cellValue) => {
+              return this.getDictValue('报修状态', _row.status);
+            }
           },
           {
             prop: 'requestUserName',
@@ -206,16 +200,16 @@
       };
     },
     computed: {},
-	created () {
-	  this.requestDict('报修来源');
-	  this.requestDict('报修状态');
-	},
+    created() {
+      this.requestDict('报修来源');
+      this.requestDict('报修状态');
+    },
     methods: {
       /* 表格数据源 */
-      datasource ({ page, limit, where, order }) {
+      datasource({ page, limit, where, order }) {
         return getPage({ pageNum: page, size: limit, ...where });
       },
-      async changeEnable (row) {
+      async changeEnable(row) {
         const res = await putRoles(row);
         if (res.code == 0) {
           this.$message({
@@ -227,20 +221,20 @@
         }
       },
       /* 刷新表格 */
-      reload (where) {
+      reload(where) {
         this.$refs.table.reload({ page: 1, where });
       },
 
-      openEdit (row) {
-		  if(row){
-			 this.addDialogTitle = '编辑报修记录'; 
-		  }else{
-			  this.addDialogTitle = '新增报修记录';
-		  }
-		this.$refs.addDialogRef.init(row)
+      openEdit(row) {
+        if (row) {
+          this.addDialogTitle = '编辑报修记录';
+        } else {
+          this.addDialogTitle = '新增报修记录';
+        }
+        this.$refs.addDialogRef.init(row);
       },
 
-      goDetail (row) {
+      goDetail(row) {
         row.tabLabel = '维修信息';
         row.title = '报修记录详情';
         row.workOrderCode = row.id;
@@ -252,20 +246,19 @@
         //   // }
         // })
       },
-	  
-	  // 委外
-	  appoint(row) {
-	    this.$refs.entDialogRef.init(row);
-	  },
-	  
-	  // 撤销
-	  remove(row){
-		  removeRequest(row.id).then((res) => {
-		    this.$message.success('撤销成功!');
-		    this.reload();
-		  });
-	  }
-	  
+
+      // 委外
+      appoint(row) {
+        this.$refs.entDialogRef.init(row);
+      },
+
+      // 撤销
+      remove(row) {
+        removeRequest(row.id).then((res) => {
+          this.$message.success('撤销成功!');
+          this.reload();
+        });
+      }
     }
   };
 </script>