Просмотр исходного кода

1.备件申购新增备件查询弹窗;2.柴油用量接口对接

duanxiaoduan 1 год назад
Родитель
Сommit
b68501c3d7
2 измененных файлов с 122 добавлено и 64 удалено
  1. 56 62
      src/views/cost/diesel/index.vue
  2. 66 2
      src/views/custom/subscribe/index.vue

+ 56 - 62
src/views/cost/diesel/index.vue

@@ -317,7 +317,7 @@
 <script>
 // 引入
 require('script-loader!file-saver')
-import { GetDataByName, GetDataByNames, PostDataByName, checkButtons, ExecDataByConfig, failproccess, GetAccount,getJson } from '@/api/common'
+import { GetDataByName, GetDataByNames, PostDataByName,postJson, checkButtons, ExecDataByConfig, failproccess, GetAccount,getJson } from '@/api/common'
 // import {  DownloadExcel, GetDataByNameXlsx } from '@/api/common'
 import waves from '@/directive/waves'
 import { parseTime, sortChange } from '@/utils/index.js'
@@ -482,14 +482,14 @@ export default {
     uploadData() {
       return {
         name: 'importDiesel',
-        importParams: '牧场,油卡编号,设备名称,设备编号,加油日期,加油量(升),单价,录入人,加油人,加油工班,备注',
+        importParams: '牧场,油卡编号,设备名称,设备编号,加油日期,加油量(升),单价,录入人,加油人,加油工班,备注,柴油类型',
         sheetname: 'SheetJS'
       }
     },
     // 设置上传地址
     uploadExcelUrl() {
       // process.env.VUE_APP_BASE_API是服务器的路径,也是axios的基本路径
-      return process.env.VUE_APP_BASE_API + 'authdata/ImportExcel'
+      return process.env.VUE_APP_BASE_API + 'authdata/diese/import/excel'
     }
   },
   created() {
@@ -717,10 +717,10 @@ export default {
             const list1 = response.data.list
             console.log(list1,'list1')
             const tHeader = [
-              '编号', '牧场', '油卡编号', '设备名称', '设备编号', '加油日期', '加油量(升)', '单价', '录入人', '加油人', '加油工班', '备注'
+              '编号', '牧场', '油卡编号', '设备名称', '设备编号', '加油日期', '加油量(升)', '单价', '录入人', '加油人', '加油工班', '备注','柴油类型'
             ]
             const filterVal = [
-              'i', 'pastureName', 'cardNumber', 'assetName', 'assetNumber', 'day', '加油量(L)', '单价', 'name', '加油人', '加油工班', '备注'
+              'i', 'pastureName', 'cardNumber', 'assetName', 'assetNumber', 'day', '加油量(L)', '单价', 'name', '加油人', '加油工班', '备注','柴油类型'
             ]
             const data1 = this.formatJson(filterVal, list1)
             excel.export_json_to_excel({
@@ -907,34 +907,32 @@ export default {
             var oilName = this.dieselTypeList.find(obj => obj.value == this.temp.oilType).label
           }
           this.$set(this.temp,'oilName',oilName)
-          this.postDataPramas.common = { 'returnmap': '0' }
-          this.postDataPramas.data = []
-          this.postDataPramas.data[0] = { 'name': 'insertDiesel', 'type': 'e', 'parammaps': {
-            'pastureId': this.temp.pastureId,
-            'selTime': this.temp.selTime,
-            'oilClass': this.temp.oilClass,
-            'oilAmount': this.temp.oilAmount,
-            'eqId': this.temp.eqId,
-            'eqCode': this.temp.eqCode,
-            'departmentId': this.temp.departmentId,
-            'note': this.temp.note,
-            'nowPrice': this.temp.price * this.temp.oilAmount,
-            'oilcardId': this.temp.oilcardId,
-            'cardNumber': this.temp.cardNumber,
-            'price': this.temp.price,
-            'empId': this.temp.empId,
-            'inputId': this.temp.inputId,
-            'oilType':this.temp.oilType,
-            'oilName':this.temp.oilName,
-          }}
-          this.postDataPramas.data[1] = { 'name': 'updateOilCardExecData', 'type': 'e',
-            'parammaps': {
-              'id': this.temp.oilcardId,
-              'nowPrice': this.temp.price * this.temp.oilAmount
-
-            }}
-
-          ExecDataByConfig(this.postDataPramas).then(response => {
+          if(this.temp.eqId == '' || this.temp.eqId == null || this.temp.eqId == undefined){
+            this.temp.eqId = 0
+          }else{
+            this.temp.eqId = parseFloat(this.temp.eqId)
+          }
+          let url = 'authdata/diese/add'
+          let data = {
+            pastureId:this.temp.pastureId,
+            selTime: this.temp.selTime,
+            oilClass:this.temp.oilClass,
+            oilAmount: this.temp.oilAmount,
+            eqId: this.temp.eqId,
+            eqCode: this.temp.eqCode,
+            departmentId: this.temp.departmentId,
+            note: this.temp.note,
+            nowPrice: this.temp.price * this.temp.oilAmount,
+            oilcardId: this.temp.oilcardId,
+            cardNumber: this.temp.cardNumber,
+            price: this.temp.price,
+            empId: this.temp.empId,
+            inputId: this.temp.inputId,
+            oilType:this.temp.oilType,
+            oilName:this.temp.oilName,
+          }
+          postJson(url,data).then(response => {
+          // ExecDataByConfig(this.postDataPramas).then(response => {
             if (response.msg === 'fail') {
               this.$notify({
                 title: '保存失败',
@@ -969,35 +967,31 @@ export default {
             var oilName = this.dieselTypeList.find(obj => obj.value == this.temp.oilType).label
           }
           this.$set(this.temp,'oilName',oilName)
-          this.postDataPramas.common = { 'returnmap': '0' }
-          this.postDataPramas.data = []
-          this.postDataPramas.data[0] = { 'name': 'insertDiesel', 'type': 'e', 'parammaps': {
-
-            'pastureId': this.temp.pastureId,
-            'selTime': this.temp.selTime,
-            'oilClass': this.temp.oilClass,
-            'oilAmount': this.temp.oilAmount,
-            'eqId': this.temp.eqId,
-            'eqCode': this.temp.eqCode,
-            'departmentId': this.temp.departmentId,
-            'note': this.temp.note,
-            'nowPrice': this.temp.price * this.temp.oilAmount,
-            'oilcardId': this.temp.oilcardId,
-            'cardNumber': this.temp.cardNumber,
-            'price': this.temp.price,
-            'empId': this.temp.empId,
-            'inputId': this.temp.inputId,
-            'oilType':this.temp.oilType,
-            'oilName':this.temp.oilName,
-          }}
-
-          this.postDataPramas.data[1] = { 'name': 'updateOilCardExecData', 'type': 'e',
-            'parammaps': {
-              'id': this.temp.oilcardId,
-              'nowPrice': this.temp.price * this.temp.oilAmount
-            }}
-
-          ExecDataByConfig(this.postDataPramas).then(response => {
+          if(this.temp.eqId == '' || this.temp.eqId == null || this.temp.eqId == undefined){
+            this.temp.eqId = 0
+          }else{
+            this.temp.eqId = parseFloat(this.temp.eqId)
+          }
+          let url = 'authdata/diese/add'
+          let data = {
+            pastureId:this.temp.pastureId,
+            selTime: this.temp.selTime,
+            oilClass:this.temp.oilClass,
+            oilAmount: this.temp.oilAmount,
+            eqId: this.temp.eqId,
+            eqCode: this.temp.eqCode,
+            departmentId: this.temp.departmentId,
+            note: this.temp.note,
+            nowPrice: this.temp.price * this.temp.oilAmount,
+            oilcardId: this.temp.oilcardId,
+            cardNumber: this.temp.cardNumber,
+            price: this.temp.price,
+            empId: this.temp.empId,
+            inputId: this.temp.inputId,
+            oilType:this.temp.oilType,
+            oilName:this.temp.oilName,
+          }
+          postJson(url,data).then(response => {
             if (response.msg !== 'fail') {
               this.form_reset()
               this.$nextTick(() => {

+ 66 - 2
src/views/custom/subscribe/index.vue

@@ -228,6 +228,7 @@
                   :fetch-suggestions="sparePartSearch"
                   placeholder="请输入备件编号或备件名称或备件规格"
                   style="width:100%"
+                  ref="autocomplete"
                   @select="handleSelectSparePart"
                 >
                   <template slot-scope="{ item }">
@@ -570,6 +571,50 @@
     </el-dialog>
 
 
+    <!-- 查看备件 -->
+    <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible_seepart" :close-on-click-modal="false" width="90%">
+      <div>
+        <el-table
+          :key="tableKey"
+          v-loading="listLoading"
+          element-loading-text="给我一点时间"
+          :data="seepartList"
+          border
+          fit
+          highlight-current-row
+          style="width: 100%;margin-bottom:30px"
+          :row-style="rowStyle"
+          :cell-style="cellStyle"
+          class="elTable"
+          height="500"
+        >
+          <!-- table表格 -->
+          <el-table-column label="序号" align="center" type="index" width="50px" />
+          <el-table-column label="备件编号" prop="partCode" align="center" min-width="90" />
+          <el-table-column label="备件名称" prop="partCode" align="center" min-width="90" />
+          <el-table-column label="备件规格" prop="partCode" align="center" min-width="90" />
+          <el-table-column label="备件图片" prop="partCode" align="center" min-width="90">
+          <template slot-scope="scope">
+              <el-popover placement="right" title="" trigger="hover">
+                <img v-if="scope.row.picpath !== ''" :src="scope.row.picpath">
+                <img v-if="scope.row.picpath !== ''" slot="reference" :src="scope.row.picpath" :alt="scope.row.srcpath" style="height: 100px;width:100px;">
+              </el-popover>
+            </template>
+          </el-table-column>
+          <el-table-column label="备件品牌" prop="partCode" align="center" min-width="90" />
+          <el-table-column label="计量单位" prop="partCode" align="center" min-width="90" />
+          <el-table-column label="现有库存" prop="partCode" align="center" min-width="90" />
+          <el-table-column label="价格" prop="partCode" align="center" min-width="90" />
+          <el-table-column label="牧场" prop="partCode" align="center" min-width="90" />
+          <el-table-column label="负责人" prop="partCode" align="center" min-width="90" />
+          <el-table-column label="联系方式" prop="partCode" align="center" min-width="90" />
+        </el-table>
+      </div>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" :disabled="isokDisable" @click="apply_subscribe()">继续申购</el-button>
+        <el-button @click="dialogFormVisible_seepart = false;">取消</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -622,7 +667,8 @@ export default {
         examine3: '审核3',
         examine4: '审核4',
         examine5: '审核5',
-        special: '特殊申购'
+        special: '特殊申购',
+        seepart:'备件申购'
       },
       rules: {
         equipmentName: [{ required: true, message: '必填', trigger: 'blur' }]
@@ -736,6 +782,9 @@ export default {
         }
       },
       providerList:[],
+      dialogFormVisible_seepart:false,
+      seepartList:[],
+      apply_subscribeData:{},
       myHeight:document.documentElement.clientHeight - 85- 150
     }
   },
@@ -1049,6 +1098,21 @@ export default {
       if(this.dialogStatus==='special' && this.createTemp.purchaseType == '1' && this.createTemp.providerId == ''){
         this.createTemp.providerId = item.providerId
       }
+      if(this.dialogStatus==='special'){
+        this.public_select(item)
+      }else{
+        this.dialogStatus = 'seepart'
+        this.dialogFormVisible_seepart = true
+        this.$refs.autocomplete.activated = false;
+        this.seepartList = []
+        this.apply_subscribeData = item
+      }
+    },
+    apply_subscribe(){
+      this.public_select(this.apply_subscribeData)
+      this.dialogFormVisible_seepart = false
+    },
+    public_select(item){
       if (this.createTemp.providerId == '') {
         if (this.listAdd.length > 0) {
           if (this.listAdd.find(obj => obj.partId == item.partId)) {
@@ -1145,7 +1209,7 @@ export default {
         }
         this.$forceUpdate()
       }
-      console.log(this.listAdd,'this.listAdd')
+
     },
     add_dialog_save() {
       this.isokDisable = true