Lijy пре 2 месеци
родитељ
комит
87fde0c12c

+ 209 - 39
fhKeeper/formulahousekeeper/timesheet/src/views/expense/expense.vue

@@ -59,6 +59,8 @@
             v-if="permissions.costAll">{{ $t('expensetypemanagement') }}</el-button></p>
         <p style="float: right;margin-right: 25px;"><el-button type="primary" @click="expenseTypeOp" size="mini"
             v-if="permissions.costAll">{{ $t('feiYongZhuLeiXingGuanLi') }}</el-button></p>
+        <p style="float: right;margin-right: 25px;"><el-button type="primary" @click="equipmentOwner" size="mini"
+            v-if="user.isMachineCost == 2">设备归属人管理</el-button></p>
       </div>
       <!-- 上面部分 -->
       <div ref="staff" style="margin: 20px 20px 0 220px; width: 81.5%">
@@ -71,7 +73,7 @@
               <el-form-item :label="$t('peopleconcerned')" prop="ownerId">
                 <!--普通员工只能自己填报自己的 -->
                 <el-select v-if="user.userNameNeedTranslate != '1'" v-model="addForm.ownerId"
-                  :placeholder="$t('pleaseselecttheapplicant')" style="width: 150px" :disabled="!permissions.costAudit"
+                  :placeholder="$t('pleaseselecttheapplicant')" style="width: 150px" :disabled="!permissions.costAudit && expenseMainTypeValue != 14454"
                   filterable="true">
                   <span v-for="(item, index) in users" :key="index">
                     <el-option :label="item.name" :value="item.id"></el-option>
@@ -91,7 +93,7 @@
                 </el-col>
               </el-form-item>
               <!-- 发票张数 -->
-              <el-form-item :label="$t('invoicenumber')" v-if="this.user.timeType.easyExpense == 0">
+              <el-form-item :label="$t('invoicenumber')" v-if="this.user.timeType.easyExpense == 0 && (expenseMainTypeValue != 14454)">
                 <el-input v-model="addForm.ticketNum" style="width: 150px"></el-input>
               </el-form-item>
               <!-- 费用主类型 -->
@@ -116,10 +118,10 @@
                   @selectCal="selectCal"></selectCat>
               </el-form-item>
               <!-- 第二审核人 -->
-              <el-form-item :label="$t('di-er-shen-he-ren')" v-if="auditTypeItem.auditType == 2 && user.companyId != 4811">
+              <el-form-item :label="$t('di-er-shen-he-ren')" v-if="auditTypeItem.auditType == 2">
                 <el-select v-if="user.userNameNeedTranslate != '1'" v-model="addForm.secondCheckerId"
                   :placeholder="$t('message.Pleaseselectareviewer')" style="width: 150px"
-                  filterable="true">
+                  filterable="true" :disabled="expenseMainTypeValue == 14454">
                   <span v-for="(item, index) in usersNoInfo" :key="index">
                     <el-option :label="item.name" :value="item.id"></el-option>
                   </span>
@@ -129,23 +131,22 @@
                   :subject="usersNoInfo" :subjectId="addForm.secondCheckerId" ref="selectCat" 
                   @selectCal="selectCal"></selectCat>
               </el-form-item>
-              <el-form-item :label="$t('di-er-shen-he-ren')" v-if="auditTypeItem.auditType == 2 && user.companyId == 4811 && expenseMainTypeValue != 14454">
-                <el-select v-if="user.userNameNeedTranslate != '1'" v-model="addForm.secondCheckerId"
-                  :placeholder="$t('message.Pleaseselectareviewer')" style="width: 150px"
+
+              <!-- 设备归属人 -->
+              <el-form-item label="设备归属人" v-if="expenseMainTypeValue == 14454">
+                <el-select v-model="addForm.equipmentOwnerId"
+                  placeholder="请选择设备归属人" style="width: 150px"
                   filterable="true">
-                  <span v-for="(item, index) in usersNoInfo" :key="index">
-                    <el-option :label="item.name" :value="item.id"></el-option>
+                  <span v-for="(item, index) in equipmentOwnerList" :key="index">
+                    <el-option :label="item.equipmentOwner" :value="item.id"></el-option>
                   </span>
                 </el-select>
-
-                <selectCat v-if="user.userNameNeedTranslate == '1'" :size="'medium'" :widthStr="'150'" :distinction="'5'"
-                  :subject="usersNoInfo" :subjectId="addForm.secondCheckerId" ref="selectCat" 
-                  @selectCal="selectCal"></selectCat>
               </el-form-item>
+
               <!-- 备注 -->
               <el-form-item :label="$t('bei-zhu')" style="display: block; width: 70%">
                 <el-input type="textarea" v-model="addForm.remark" :autosize="{ minRows: 2, maxRows: 2 }"
-                  maxlength="100"></el-input>
+                  maxlength="100" :disabled="expenseMainTypeValue == 14454"></el-input>
               </el-form-item>
               <!-- 总费用 -->
               <!-- <div style="float: left; line-height: 55px;margin-left:20px">总费用 <el-link disabled v-model="addForm.totalAmount">{{addForm.totalAmount}}</el-link> 元</div> -->
@@ -187,7 +188,7 @@
               <el-table-column :label="$t('invoices')" width="175px" v-if="this.user.timeType.easyExpense == 0">
                 <template slot-scope="scope">
                   <el-select size="small" v-model="scope.row.invoiceType" :placeholder="$t('pleaseselectthetypeoffee')"
-                    style="width: 150px;">
+                    style="width: 150px;" :disabled="user.companyId == 4811 && user.id != addForm.ownerId && expenseMainTypeValue == 14454">
                     <el-option :label="$t('vATspecialinvoice')" value="0"></el-option>
                     <el-option :label="$t('vATgeneralinvoice')" value="1"></el-option>
                   </el-select>
@@ -211,13 +212,13 @@
               <el-table-column prop="invoiceNo" :label="$t('invoiceno')" width="135px"
                 v-if="this.user.timeType.easyExpense == 0">
                 <template slot-scope="scope">
-                  <el-input size="small" v-model.number="scope.row.invoiceNo"></el-input>
+                  <el-input size="small" v-model.number="scope.row.invoiceNo" :disabled="user.companyId == 4811 && user.id != addForm.ownerId && expenseMainTypeValue == 14454"></el-input>
                 </template>
               </el-table-column>
               <el-table-column :label="$t('shui-shuai')" width="135px" v-if="this.user.timeType.easyExpense == 0">
                 <template slot-scope="scope">
                   <el-input size="small" type="number" v-model="scope.row.taxPercent"
-                    @input="zhi(scope.$index)"></el-input>
+                    @input="zhi(scope.$index)" :disabled="user.companyId == 4811 && user.id != addForm.ownerId && expenseMainTypeValue == 14454"></el-input>
                 </template>
               </el-table-column>
               <el-table-column :label="$t('taxs')" width="135px" v-if="this.user.timeType.easyExpense == 0">
@@ -375,6 +376,7 @@
             :summary-method="getSummaries" show-summary>
             <el-table-column type="selection" width="55"></el-table-column>
             <el-table-column prop="code" :label="$t('ticketnumber')" width="120"></el-table-column>
+            <el-table-column prop="engineeringName" label="工程名称" width="200" v-if="user.companyId == 4811"></el-table-column>
             <el-table-column prop="totalAmount" :label="$t('amountof') + '(' + $t('yuan') + ')'" align="center" width="120">
               <template slot-scope="scope">
                 <span style="float:right;margin-right:20px">{{ scope.row.totalAmount ? scope.row.totalAmount.toFixed(2) :
@@ -395,12 +397,13 @@
             </el-table-column>
             <el-table-column prop="createDate" :label="$t('fillinthedate')" width="100"></el-table-column>
             <el-table-column prop="ticketNum" :label="$t('invoicenumber')"
-              v-if="this.user.timeType.easyExpense == 0"></el-table-column>
+              v-if="this.user.timeType.easyExpense == 0 && user.companyId != 4811"></el-table-column>
             <el-table-column prop="type" :label="$t('ppertype')" v-if="this.user.timeType.easyExpense == 0">
               <template slot-scope="scope">
                 {{ scope.row.expenseMainTypeName }}
               </template>
             </el-table-column>
+            <el-table-column prop="equipmentOwnerName" label="设备归属人" v-if="user.companyId == 4811" width="150"></el-table-column>
             <el-table-column prop="remark" :label="$t('bei-zhu')" width="180">
               <template slot-scope="scope">
                 <span style="font-size:12px;">{{ scope.row.remark }}</span>
@@ -496,7 +499,7 @@
 
           </el-form-item>
           <!-- 第一审核人 -->
-          <el-form-item :label="$t('di-yi-shen-he-ren')" v-if="auditTypeItem.auditType == 2">
+          <el-form-item :label="$t('di-yi-shen-he-ren')" v-if="auditTypeItem.auditType == 2 && user.companyId != 4811">
             <el-select v-if="user.userNameNeedTranslate != '1'" v-model="ParticularsList.firstCheckerId"
               :placeholder="$t('message.Pleaseselectareviewer')" style="width: 150px" :disabled="ParticularsList.reviewProcess > 0 || (flg || ParticularsList.ownerId == ParticularsList.operatorId)"
               filterable="true">
@@ -509,8 +512,22 @@
               :subject="users" :subjectId="ParticularsList.firstCheckerId" ref="selectCat" :disabled="ParticularsList.reviewProcess > 0 || (flg || ParticularsList.ownerId == ParticularsList.operatorId)"
               @selectCal="selectCal"></selectCat>
           </el-form-item>
+
+          <el-form-item :label="$t('di-yi-shen-he-ren')" v-if="auditTypeItem.auditType == 2 && user.companyId == 4811">
+            <el-select v-if="user.userNameNeedTranslate != '1'" v-model="ParticularsList.firstCheckerId"
+              :placeholder="$t('message.Pleaseselectareviewer')" style="width: 150px" :disabled="user.id != ParticularsList.ownerId"
+              filterable="true">
+              <span v-for="(item, index) in users" :key="index">
+                <el-option :label="item.name" :value="item.id"></el-option>
+              </span>
+            </el-select>
+
+            <selectCat v-if="user.userNameNeedTranslate == '1'" :size="'medium'" :widthStr="'150'" :distinction="'6'"
+              :subject="users" :subjectId="ParticularsList.firstCheckerId" ref="selectCat" :disabled="user.id != ParticularsList.ownerId"
+              @selectCal="selectCal"></selectCat>
+          </el-form-item>
           <!-- 第二审核人 -->
-          <el-form-item :label="$t('di-er-shen-he-ren')" v-if="auditTypeItem.auditType == 2">
+          <el-form-item :label="$t('di-er-shen-he-ren')" v-if="auditTypeItem.auditType == 2 && user.companyId != 4811">
             <el-select v-if="user.userNameNeedTranslate != '1'" v-model="ParticularsList.secondCheckerId"
               :placeholder="$t('message.Pleaseselectareviewer')" style="width: 150px" :disabled="ParticularsList.reviewProcess > 1 || (flg || ParticularsList.ownerId == ParticularsList.operatorId)"
               filterable="true">
@@ -524,18 +541,47 @@
               @selectCal="selectCal"></selectCat>
           </el-form-item>
 
+          <el-form-item :label="$t('di-er-shen-he-ren')" v-if="auditTypeItem.auditType == 2 && user.companyId == 4811">
+            <el-select v-if="user.userNameNeedTranslate != '1'" v-model="ParticularsList.secondCheckerId"
+              :placeholder="$t('message.Pleaseselectareviewer')" style="width: 150px" :disabled="user.id != ParticularsList.ownerId"
+              filterable="true">
+              <span v-for="(item, index) in users" :key="index">
+                <el-option :label="item.name" :value="item.id"></el-option>
+              </span>
+            </el-select>
+
+            <selectCat v-if="user.userNameNeedTranslate == '1'" :size="'medium'" :widthStr="'150'" :distinction="'7'"
+              :subject="users" :subjectId="ParticularsList.secondCheckerId" ref="selectCat" :disabled="user.id != ParticularsList.ownerId"
+              @selectCal="selectCal"></selectCat>
+          </el-form-item>
+
+          <el-form-item label="设备归属人" v-if="ParticularsList.type == 14454">
+            <el-select v-model="ParticularsList.equipmentOwnerId"
+              placeholder="请选择设备归属人" style="width: 150px"
+              filterable="true" :disabled="(ParticularsList.type == 14454 && user.companyId == 4811)">
+              <span v-for="(item, index) in equipmentOwnerList" :key="index">
+                <el-option :label="item.equipmentOwner" :value="item.id"></el-option>
+              </span>
+            </el-select>
+          </el-form-item>
+
           <el-form-item :label="$t('fillinthedate')">
             <!-- <el-input v-model="ParticularsList.createDate" :disabled="flg"></el-input> -->
-            <el-date-picker type="date" :disabled="flg" :placeholder="$t('optiondate')"
+            <el-date-picker type="date" :disabled="flg || (ParticularsList.type == 14454 && user.companyId == 4811)" :placeholder="$t('optiondate')"
               v-model="ParticularsList.createDate" value-format="yyyy-MM-dd" style="width: 200px;"></el-date-picker>
           </el-form-item>
-          <el-form-item :label="$t('invoicenumber')">
+          <el-form-item :label="$t('invoicenumber')" v-if="user.companyId == 4811 && ParticularsList.type != 14454">
             <el-input v-enter-number v-model="ParticularsList.ticketNum" :disabled="flg"></el-input>
           </el-form-item>
           <el-form-item :label="$t('costtype')" style="width: 270px">
-            <el-select size="small" v-model="ParticularsList.type" style="width: 150px" :disabled="flg">
-              <el-option v-for="item in expenseMainTypes" :key="item.id" :label="item.name" :value="item.id"></el-option>
-            </el-select>
+            <template v-if="user.companyId == 4811 && ParticularsList.type == 14454">
+              机械费用
+            </template>
+            <template v-else>
+              <el-select size="small" v-model="ParticularsList.type" style="width: 150px" :disabled="flg || (ParticularsList.type == 14454 && user.companyId == 4811)">
+                <el-option v-for="item in expenseMainTypes" :key="item.id" :label="item.name" :value="item.id"></el-option>
+              </el-select>
+            </template>
           </el-form-item>
           <el-form-item :label="$t('bei-zhu')" style="width: 280px">
             <el-input v-model="ParticularsList.remark" :disabled="flg" maxlength="100"></el-input>
@@ -567,7 +613,7 @@
           <el-table-column prop="projectId" :label="$t('other.project')" width="155">
             <template slot-scope="scope">
               <el-select size="small" v-if="!flg" v-model="scope.row.projectId" :placeholder="$t('other.project')"
-                style="width: 130px">
+                style="width: 130px" :disabled="(ParticularsList.type == 14454 && user.companyId == 4811)">
                 <el-option v-for="(item, index) in projectList" :key="index" :label="item.projectName + item.projectCode"
                   :value="item.id" @click="ok(item)">
                   <span style="float: left;color: #8492a6; font-size: 13px">{{ item.projectCode }}</span>
@@ -582,7 +628,7 @@
           <el-table-column prop="happenDate" :label="$t('forthedate')" width="172">
             <template slot-scope="scope">
               <el-date-picker size="small" v-if="!flg" v-model="scope.row.happenDate" type="date" style=" width: 145px"
-                value-format="yyyy-MM-dd" :placeholder="$t('optiondate')">
+                value-format="yyyy-MM-dd" :placeholder="$t('optiondate')" :disabled="(ParticularsList.type == 14454 && user.companyId == 4811)">
               </el-date-picker>
               <span v-else>{{ scope.row.happenDate }}</span>
             </template>
@@ -601,7 +647,7 @@
           <el-table-column prop="invoiceType" :label="$t('costtype')" width="172">
             <template slot-scope="scope">
               <el-select v-if="!flg" size="small" v-model="scope.row.expenseType"
-                :placeholder="$t('pleaseselectthetypeoffee')" style="width: 150px">
+                :placeholder="$t('pleaseselectthetypeoffee')" style="width: 150px" :disabled="(ParticularsList.type == 14454 && user.companyId == 4811)">
                 <el-option v-for="(item, index) in expenseTypeList" :key="index" :label="item.typeName"
                   :value="item.typeName"></el-option>
               </el-select>
@@ -854,7 +900,7 @@
             <span class="detail-item-title"><span class="printBox">{{ $t('tianBaoShiJian') }}</span></span>
             <span class="detail-item-content">{{ ParticularsList.createDate }}</span>
           </div>
-          <div class="detail-item">
+          <div class="detail-item" v-if="ParticularsList.type != 14454">
             <span class="detail-item-title"><span class="printBox">{{ $t('invoicenumber') }}</span></span>
             <span class="detail-item-content">{{ ParticularsList.ticketNum }} {{ $t('zhang') }}</span>
           </div>
@@ -862,6 +908,10 @@
             <span class="detail-item-title"><span class="printBox">{{ $t('feiYongLeiXing') }}</span></span>
             <span class="detail-item-content">{{ detaExpenseMainTypeName }}</span>
           </div>
+          <div class="detail-item" v-if="ParticularsList.type == 14454">
+            <span class="detail-item-title"><span class="printBox">设备归属人</span></span>
+            <span class="detail-item-content">{{ ParticularsList.equipmentOwnerName }}</span>
+          </div>
           <div class="detail-item">
             <span class="detail-item-title"><span class="printBox">{{ $t('totalcostos') }}</span></span>
             <span class="detail-item-content">¥ {{ ParticularsList.totalAmount | numberToCurrency }}</span>
@@ -1099,6 +1149,36 @@
         <el-button type="primary" @click="callingInterface(1, releaseData.data)">{{ $t('queDing') }}</el-button>
       </span>
     </el-dialog>
+
+    <!-- 设备归属人管理 -->
+    <el-dialog title="设备归属人管理" :visible.sync="equipmentOwnerVisable" width="600" :before-close="handleClose">
+      <el-table :data="equipmentOwnerList" style="width: 100%" height="40vh">
+        <el-table-column label="序号" width="180">
+          <template slot-scope="scope">
+            {{ scope.$index + 1 }}
+          </template>
+        </el-table-column>
+        <el-table-column prop="equipmentOwner" label="姓名"></el-table-column>
+        <el-table-column label="操作" width="240">
+          <template slot-scope="scope">
+            <el-button type="primary" size="small" @click="updateOwner(scope.row)">编辑</el-button>
+            <el-button type="danger" size="small" @click="deleteOwner(scope.row)">删除</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="equipmentOwnerVisable = false">取 消</el-button>
+        <el-button type="primary" @click="updateOwner()">新增归属人</el-button>
+      </span>
+    </el-dialog>
+
+    <el-dialog :title="`${equipmentOwnerValue.id ? '编辑' : '新增'}归属人`" :visible.sync="equipmentOwnertextVisable" width="600" :before-close="handleClose">
+      <el-input v-model.trim="equipmentOwnerValue.equipmentOwner" placeholder="请输入归属人名称" clearable></el-input>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="equipmentOwnertextVisable = false">取 消</el-button>
+        <el-button type="primary" @click="addEditorOwner()" :disabled="!equipmentOwnerValue.equipmentOwner">确 定</el-button>
+      </span>
+    </el-dialog>
   </section>
 </template>
 
@@ -1129,6 +1209,7 @@ export default {
         reason: '',
         id: null
       },
+      copyUsers: [],
       basecostSettingList: [],
       exportingData:false,
       fileList: [],
@@ -1223,6 +1304,11 @@ export default {
       dialogVisibleRelease: false, // 发放弹出框
 
       selectProject: null, // 项目选择
+
+      equipmentOwnerVisable: false,
+      equipmentOwnerList: [],
+      equipmentOwnertextVisable: false,
+      equipmentOwnerValue: { equipmentOwner: '' }
     };
   },
   computed: {
@@ -1256,6 +1342,9 @@ export default {
     this.getBasecostItemList();
     this.getAuditType();
     this.getSendStateList();
+    if(this.user.companyId == 4811) {
+      this.getEquipmentOwnerList()
+    }
   },
   filters: {
     numberToCurrency(value) {
@@ -1274,6 +1363,66 @@ export default {
     }
   },
   methods: {
+    updateOwner(row) {
+      if(!row) {
+        this.equipmentOwnerValue = { equipmentOwner: '' }
+      } else {
+        this.equipmentOwnerValue = { equipmentOwner: row.equipmentOwner, id: row.id }
+      }
+      this.equipmentOwnertextVisable = true
+    },
+    equipmentOwner() {
+      this.equipmentOwnerVisable = true
+    }, 
+    deleteOwner(row) {
+      this.$confirm(`此操作将删除【${row.equipmentOwner}】设备归属人, 是否继续?`, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.http.post('/equipment-owner/removeEquipmentOwner', {
+          id: row.id
+        },
+        res => {
+          if (res.code == 'ok') {
+            this.$message({ message: '删除成功', type: 'success' })
+            this.getEquipmentOwnerList()
+          } else {
+            this.$message({ message: res.msg, type: 'error'})
+          }
+        }, err => {
+          this.$message({ message: err, type: 'error' })
+        })
+      })
+    },
+    addEditorOwner() {
+      this.http.post('/equipment-owner/addOrUpdate', {
+        ...this.equipmentOwnerValue
+      },
+      res => {
+        if (res.code == 'ok') {
+          this.$message({ message: '添加成功', type: 'success' })
+          this.equipmentOwnertextVisable = false
+          this.getEquipmentOwnerList()
+        } else {
+          this.$message({ message: res.msg, type: 'error'})
+        }
+      }, err => {
+        this.$message({ message: err, type: 'error' })
+      })
+    },
+    getEquipmentOwnerList() {
+      this.http.post('/equipment-owner/getList', {},
+      res => {
+        if (res.code == 'ok') {
+          this.equipmentOwnerList = res.data || [];
+        } else {
+          this.$message({ message: res.msg, type: 'error'})
+        }
+      }, err => {
+        this.$message({ message: err, type: 'error' })
+      })
+    },
     getBasecostItemList() {
       this.http.post('/project-basecost-setting/list', {},
         res => {
@@ -1645,8 +1794,18 @@ export default {
         });
     },
     costMainTypeSwitching() {
-      if(this.user.companyId == 4811 && this.expenseMainTypeValue == 14454) {
-        this.addForm.firstCheckerId = this.user.id
+      if(this.user.companyId == 4811) {
+        if(this.expenseMainTypeValue == 14454) {
+          this.users = JSON.parse(JSON.stringify(this.copyUsers)).filter(item => item.id != this.user.id)
+          this.addForm.firstCheckerId = ''
+          this.addForm.secondCheckerId = ''
+          if(this.addForm.ownerId == this.user.id) {
+            this.addForm.ownerId = ''
+          }
+        } else {
+          this.addForm.ownerId = this.user.id
+          this.users = JSON.parse(JSON.stringify(this.copyUsers))
+        }
       }
       this.getExpList()
     },
@@ -1689,11 +1848,11 @@ export default {
       },
         res => {
           if (res.code == "ok") {
-            if(this.user.roleName == '费用管理员') {
-              this.expenseMainTypes = res.data.filter(item => item.id == 14454)
-              this.addForm.firstCheckerId = this.user.id
-            } else {
+            if(this.user.isMachineCost != 2) {
               this.expenseMainTypes = res.data.filter(item => item.id != 14454)
+              // this.addForm.firstCheckerId = this.user.id
+            } else {
+              this.expenseMainTypes = res.data
             }
             this.expenseMainTypeValue = this.expenseMainTypes[0].id
           } else {
@@ -1748,6 +1907,16 @@ export default {
       this.displayTable = true;
     },
     present() {
+      if(this.user.companyId == 4811) {
+        if(!this.ParticularsList.firstCheckerId || !this.ParticularsList.secondCheckerId) {
+          this.$message({
+            message: !this.ParticularsList.firstCheckerId ? this.$t('qingXuanZeDiYiShenHeRen') : this.$t('qingXuanZeDiErShenHeRen'),
+            type: "error"
+          });
+          return;
+        }
+      }
+
       this.adds();
     },
     // 删除操作
@@ -1820,8 +1989,9 @@ export default {
             // this.users = res.data.records;
             const { id } = JSON.parse(sessionStorage.getItem('user'))
             this.users = res.data;
-            // this.usersNoInfo = res.data.filter(item => item.id != id)
-            this.usersNoInfo = res.data
+            this.usersNoInfo = res.data.filter(item => item.id != id)
+            this.copyUsers = JSON.parse(JSON.stringify(res.data))
+            // this.usersNoInfo = res.data
             if (!this.permissions.costAudit) {
               this.addForm.ownerId = this.user.id;
               this.addForm.status = 1;
@@ -1846,7 +2016,7 @@ export default {
       this.$refs.mainAddForm.validate(valid => {
         if (valid) {
           if(this.auditTypeItem.auditType == 2 && (!this.addForm.firstCheckerId || !this.addForm.secondCheckerId)) {
-            if(this.user.id != 4811 && this.expenseMainTypeValue != 14454) {
+            if(this.user.companyId != 4811 && this.expenseMainTypeValue != 14454) {
               this.$message({
                 message: !this.addForm.firstCheckerId ? this.$t('qingXuanZeDiYiShenHeRen') : this.$t('qingXuanZeDiErShenHeRen'),
                 type: "error"
@@ -2048,7 +2218,7 @@ export default {
             });
             this.addForm = {
               code: null,
-              ownerId: this.user.id,
+              ownerId: this.expenseMainTypeValue == 14454 ? '' : this.user.id,
               createDate: null,
               type: this.expenseMainTypeValue,
               ticketNum: 1, remark: null, totalAmount: 0,

+ 111 - 3
fhKeeper/formulahousekeeper/timesheet/src/views/settings/timetype.vue

@@ -246,7 +246,7 @@
                     <div class="underpanel">
                         <div class="whiteList_head">
                             <span style="float:left;color:#999">{{ $t('personneltoset') }}</span>
-                            <el-link type="primary" style="float:left;margin-left:15px" :underline="false" @click="addWhite">{{ $t('addTian') }}</el-link>
+                            <el-link type="primary" style="float:left;margin-left:15px" :underline="false" @click="addWhite('personnel')">{{ $t('addTian') }}</el-link>
                         </div>
                         <div class="whiteList_content">
                             <el-tag style="margin:10px 0 0 10px" v-for="item in whiteList" :key="item.id" closable @close="whiteDelete(item)">
@@ -284,6 +284,30 @@
                 </div>
             </el-col>
         </el-row>
+
+        <!-- 机械费用下发设置 -->
+        <template v-if="user.companyId == 4811">
+            <p style="margin-left:10px;color:#666;">机械费用下发设置</p>
+            <el-row :gutter="20" style="padding-top:10px;width:100%;margin:0 auto;padding-left:10px;padding-right:10px;">
+                <el-col :span="24" >
+                    <div class="panel" >
+                        <div class="underpanel">
+                            <div class="whiteList_head">
+                                <span style="float:left;color:#999">机械费用下发人员</span>
+                                <el-link type="primary" style="float:left;margin-left:15px" :underline="false" @click="addWhite('mechanics')">{{ $t('addTian') }}</el-link>
+                            </div>
+                            <div class="whiteList_content">
+                                <el-tag style="margin:10px 0 0 10px" v-for="item in mechanicalPersonnelList" :key="item.id" closable @close="mechanicsDeleteItem(item)">
+                                    <span v-if="user.userNameNeedTranslate != '1'">{{item.name}}</span>
+                                    <span v-if="user.userNameNeedTranslate == '1'"><TranslationOpenDataText type='userName' :openid='item.name'></TranslationOpenDataText></span>
+                                </el-tag>
+                            </div>
+                        </div>
+                    </div>
+                </el-col>
+            </el-row>
+        </template>
+
 <!-- 设置员工可补填的时间 -->
         <p style="margin-left:10px;color:#666;">{{ $t('timesetting') }}</p>
         <el-row :gutter="20" style="padding-top:10px;width:100%;margin:0 auto;padding-left:10px;padding-right:10px;">
@@ -734,7 +758,8 @@
             <!-- <div>已选中&nbsp;{{chosenMembCount}}&nbsp;人</div>         :default-checked-keys="alreadyPartArray"  @check-change="onTreeItemChange" -->
             <div slot="footer" class="dialog-footer">
                 <el-button  @click="whiteListDialog = false, resetechartDepartment()">{{ $t('btn.cancel') }}</el-button>
-                <el-button type="primary" @click="setWhiteList()">{{ $t('btn.determine') }}</el-button>
+                <!-- <el-button type="primary" @click="setWhiteList()">{{ $t('btn.determine') }}</el-button> -->
+                <el-button type="primary" @click="personnelDetermination()">{{ $t('btn.determine') }}</el-button>
             </div>
         </el-dialog>
 
@@ -951,6 +976,8 @@
                         return false;
                     }
                 },
+                mechanicalPersonnelList: [],
+                selectPersonnelType: 'personnel',
             };
         },
         watch: {
@@ -988,6 +1015,9 @@
             setTimeout(() => {
                 // thats.$tours['myTour'].start()
             }, 1000)
+            if(this.user.companyId == 4811) {
+                this.getMechanicalPersonnelList()
+            }
         },
          methods: {
             startSynchronizing() {
@@ -1701,12 +1731,35 @@
             //     var list = chosenList.filter(item=>item.isUser == 1);
             //     // this.chosenMembCount = list.length;
             // },
-            addWhite(){
+            addWhite(type = 'personnel'){
                 this.specialHolidays = 0
                 this.whiteListDialog = true
                 this.filterText = ''
+                this.selectPersonnelType = type
                 this.getWhiteListAll()
             },
+            mechanicsDeleteItem(item) {
+                const id = item.id
+                this.http.post('/user/removeUserIsMachine',{ id },res => {
+                    if(res.code == 'ok'){
+                        this.$message({
+                            message: this.$t('message.successfullyDeleted'),
+                            type: 'success'
+                        })
+                        this.getMechanicalPersonnelList()
+                    }else {
+                        this.$message({
+                            message: res.msg,
+                            type: 'error'
+                        })
+                    }
+                },err => {
+                    this.$message({
+                        message: err,
+                        type: 'error'
+                    })
+                })
+            },  
             whiteDelete(item){
                 
                 this.whiteList.splice(this.whiteList.indexOf(item),1)
@@ -1732,6 +1785,44 @@
                     })
                 })
             },
+            personnelDetermination() {
+                if(this.selectPersonnelType == 'mechanics') {
+                    this.setUpMechanicalPersonnel()
+                } else {
+                    this.setWhiteList()
+                }
+            },
+            setUpMechanicalPersonnel() {
+                let chosenList = this.$refs.whiteListTree.getCheckedNodes();
+                let chose2 = chosenList.filter(item=>item.isUser == 1)
+                let chose3 = ''
+                for(let i=0;i<chose2.length;i++){chose3 += chose2[i].id + ','}
+                chose3 = chose3.substring(0,chose3.length - 1)
+
+                this.http.post('/user/addUserIsMachine',{
+                    ids: chose3
+                },res => {
+                    if(res.code == 'ok'){
+                        this.$message({
+                            message: this.$t('addsuccessful'),
+                            type: 'success'
+                        })
+                        this.getMechanicalPersonnelList()
+                        this.resetechartDepartment()
+                        this.whiteListDialog = false
+                    }else {
+                        this.$message({
+                            message: res.msg,
+                            type: 'error'
+                        })
+                    }
+                },error => {
+                    this.$message({
+                        message: error,
+                        type: 'error'
+                    })
+                })
+            },
             setWhiteList(){
                 let chosenList = this.$refs.whiteListTree.getCheckedNodes();
                 let chose2 = chosenList.filter(item=>item.isUser == 1)
@@ -2060,6 +2151,23 @@
                 this.searchPersonnelFlg = false
                 this.getWhiteListAll()
             },
+            getMechanicalPersonnelList() {
+                this.http.post('/user/getUserIsMachineList', {}, res => {
+                    if(res.code == 'ok'){
+                        this.mechanicalPersonnelList = res.data || []
+                    }else {
+                        this.$message({
+                            message: res.msg,
+                            type: 'error'
+                        })
+                    }
+                },error => {
+                    this.$message({
+                        message: error,
+                        type: 'error'
+                    })
+                })
+            },
             // 重置企业微信选人搜索
             resetechartDepartment() {
                 this.wxFilterText = ''