Преглед изворни кода

物料领用修改功能优化

ysc пре 1 година
родитељ
комит
9e74629120
3 измењених фајлова са 106 додато и 9 уклоњено
  1. 13 3
      src/views/material/asset.vue
  2. 91 4
      src/views/material/receive.vue
  3. 2 2
      src/views/task/view.vue

+ 13 - 3
src/views/material/asset.vue

@@ -339,9 +339,11 @@
                 </div>
                 <div style="margin-top: 5px" v-if="transfer.accessoryList.length>0">
                   <span style="font-size: 10px">配件:</span>
-                  <el-tag v-for="(item,index) in transfer.accessoryList" :key="index" size="mini"
-                          style="margin-left: 5px">{{ item.assetName }}
-                  </el-tag>
+                  <template v-for="(item,index) in transfer.accessoryList">
+                    <el-tooltip :content="item.deptAssetNumber" placement="top">
+                      <el-tag size="mini" style="margin-left: 5px">{{ item.assetName }}</el-tag>
+                    </el-tooltip>
+                  </template>
                 </div>
               </el-timeline-item>
             </el-timeline>
@@ -389,6 +391,7 @@ export default {
   dicts: ['asset_type', 'asset_status', 's_source', 'transfer_type'],
   data() {
     return {
+      selectCategoryId: undefined,
       queryParams: {
         pageNum: 1,
         pageSize: 10
@@ -441,6 +444,7 @@ export default {
   },
   methods: {
     selectCategory(data) {
+      this.selectCategoryId = data
       this.queryParams.categoryId = data;
       this.handleQuery();
     },
@@ -489,6 +493,9 @@ export default {
     /** 搜索按钮操作 */
     handleQuery() {
       this.queryParams.pageNum = 1;
+      if (this.selectCategoryId) {
+        this.queryParams.categoryId = this.selectCategoryId
+      }
       this.getList();
     },
     /** 重置按钮操作 */
@@ -505,6 +512,9 @@ export default {
       this.getCategoryTree()
       getDeptAssetNumber().then(res => {
         this.form.deptAssetNumber = res.data
+        if (this.selectCategoryId) {
+          this.form.categoryId = this.selectCategoryId
+        }
         this.open = true;
         this.title = "新增入库";
       });

+ 91 - 4
src/views/material/receive.vue

@@ -149,7 +149,7 @@
       <el-form ref="addForm" :model="addForm" :rules="rules" size="mini" inline>
         <el-row>
           <el-col :span="22">
-            <el-form-item label="数据周期">
+            <el-form-item label="数据周期" prop="date">
               <div v-if="addForm.monthOrWeek==='1'">
                 <el-date-picker
                   v-model="addForm.date"
@@ -181,48 +181,85 @@
       </el-form>
       <el-table :data="addList" class="add-table" border size="mini">
         <el-table-column label="物料名称" prop="materialName">
+          <template slot="header" slot-scope="scope">
+            <span style="color: red">*</span><span>物料名称</span>
+          </template>
           <template slot-scope="scope">
             <el-input v-model="scope.row.materialName" size="mini" placeholder="请输入物料名称"
                       :disabled="addForm.monthOrWeek==='2'"/>
           </template>
         </el-table-column>
         <el-table-column label="规格" prop="specification">
+          <template slot="header" slot-scope="scope">
+            <span style="color: red">*</span><span>规格</span>
+          </template>
           <template slot-scope="scope">
             <el-input v-model="scope.row.specification" size="mini" placeholder="请输入物料规格"
                       :disabled="addForm.monthOrWeek==='2'"/>
           </template>
         </el-table-column>
         <el-table-column label="品牌/货号" prop="articleNo">
+          <template slot="header" slot-scope="scope">
+            <span style="color: red">*</span><span>品牌/货号</span>
+          </template>
           <template slot-scope="scope">
             <el-input v-model="scope.row.articleNo" size="mini" placeholder="请输入品牌/货号"
                       :disabled="addForm.monthOrWeek==='2'"/>
           </template>
         </el-table-column>
         <el-table-column label="厂商" prop="factory">
+          <template slot="header" slot-scope="scope">
+            <span style="color: red">*</span><span>厂商</span>
+          </template>
           <template slot-scope="scope">
             <el-input v-model="scope.row.factory" size="mini" placeholder="请输入厂商"
                       :disabled="addForm.monthOrWeek==='2'"/>
           </template>
         </el-table-column>
         <el-table-column label="单位" prop="unit" width="120px">
+          <template slot="header" slot-scope="scope">
+            <span style="color: red">*</span><span>单位</span>
+          </template>
           <template slot-scope="scope">
-            <el-input v-model="scope.row.unit" size="mini" placeholder="请输入单位" :disabled="addForm.monthOrWeek==='2'"
-                      style="width: 100%"/>
+            <el-select
+              v-model="scope.row.unit"
+              filterable
+              allow-create
+              default-first-option
+              :disabled="addForm.monthOrWeek==='2'"
+              style="width: 100%">
+              <el-option v-for="item in unitOptions"
+                         :key="item"
+                         :label="item"
+                         :value="item">
+              </el-option>
+            </el-select>
+            <!--            <el-input v-model="scope.row.unit" size="mini" placeholder="请输入单位" :disabled="addForm.monthOrWeek==='2'"-->
+            <!--                      style="width: 100%"/>-->
           </template>
         </el-table-column>
         <el-table-column label="价格" prop="price" width="120px">
+          <template slot="header" slot-scope="scope">
+            <span style="color: red">*</span><span>价格</span>
+          </template>
           <template slot-scope="scope">
             <el-input v-model="scope.row.price" size="mini" placeholder="请输入单价" :disabled="addForm.monthOrWeek==='2'"
                       style="width: 100%"/>
           </template>
         </el-table-column>
         <el-table-column label="领取量" prop="num" width="100px">
+          <template slot="header" slot-scope="scope">
+            <span style="color: red">*</span><span>领取量</span>
+          </template>
           <template slot-scope="scope">
             <el-input-number v-model="scope.row.num" size="mini" controls-position="right" :min="0"
                              placeholder="请输入领取量" style="width: 100%"/>
           </template>
         </el-table-column>
         <el-table-column label="物料类型" prop="materialType" width="100px">
+          <template slot="header" slot-scope="scope">
+            <span style="color: red">*</span><span>物料类型</span>
+          </template>
           <template slot-scope="scope">
             <el-select v-model="scope.row.materialType" size="mini" :disabled="addForm.monthOrWeek==='2'"
                        style="width: 100%">
@@ -265,6 +302,28 @@
     <el-dialog title="修改" :visible.sync="editOpen" @close="dialogClose" width="500px" append-to-body
                :close-on-click-modal="false">
       <el-form ref="editForm" :model="editForm" :rules="rules" size="mini" label-width="100px">
+        <el-form-item label="数据周期" prop="date">
+          <div v-if="editForm.monthOrWeek==='1'">
+            <el-date-picker
+              v-model="editForm.date"
+              type="month"
+              value-format="yyyy-MM"
+              placeholder="选择月份"
+              :picker-options="getPickerOptions('month')"
+              clearable>
+            </el-date-picker>
+          </div>
+          <div v-else>
+            <el-date-picker
+              v-model="editForm.date"
+              type="week"
+              format="yyyy 第 WW 周"
+              placeholder="选择周"
+              :picker-options="getPickerOptions('week')"
+              clearable>
+            </el-date-picker>
+          </div>
+        </el-form-item>
         <el-form-item label="物料名称" prop="materialName">
           <el-input v-model="editForm.materialName" placeholder="请输入物料名称" :disabled="editForm.monthOrWeek==='2'"/>
         </el-form-item>
@@ -372,6 +431,9 @@ export default {
 
       // 表单校验
       rules: {
+        date: [
+          {required: true, message: "数据周期不能为空", trigger: "change"}
+        ],
         materialName: [
           {required: true, message: "物料名称不能为空", trigger: "blur"}
         ],
@@ -396,7 +458,8 @@ export default {
         monthOrWeek: [
           {required: true, message: "月/周数据不能为空", trigger: "change"}
         ]
-      }
+      },
+      unitOptions: ['个', '张', '卷', '支']
     };
   },
   created() {
@@ -619,11 +682,35 @@ export default {
     /** 修改按钮操作 */
     handleUpdate(row) {
       this.editForm = row
+      if (this.editForm.monthOrWeek === '1') {
+        this.$set(this.editForm, 'date', row.recordDate)
+      } else {
+        let split = row.recordDate.split('~');
+        this.$set(this.editForm, 'date', split[0])
+      }
       this.editOpen = true
     },
 
     /** 提交按钮 */
     submitForm() {
+      if (this.addList.length === 0) {
+        return
+      }
+      let checkKeys = ['materialName', 'specification', 'articleNo', 'factory', 'unit', 'num', 'materialType']
+      let validFlag = true
+      this.addList.forEach(item => {
+        for (let key in item) {
+          if (checkKeys.indexOf(key) > -1) {
+            if (item[key] === null || item[key] === undefined || item[key] === '' || item[key] === 0) {
+              validFlag = false
+            }
+          }
+        }
+      })
+      if (!validFlag) {
+        this.$message.error("必填项不能为空")
+        return;
+      }
       this.$refs["addForm"].validate(valid => {
         if (valid) {
           let data = {

+ 2 - 2
src/views/task/view.vue

@@ -238,8 +238,8 @@ export default {
       if (text === '') {
         return callback(new Error('反馈描述不能为空'));
       }
-      if (text.length < 5 || text.length > 900) {
-        return callback(new Error('反馈描述字符数需在5到500之间'));
+      if (text.length < 5) {
+        return callback(new Error('反馈描述字符数不足'));
       }
       return callback();
     };