Sfoglia il codice sorgente

feat:商品价目表增加工艺路线,价格有效期

liujt 1 giorno fa
parent
commit
a4c1cf897a

+ 198 - 126
src/views/commodityManagement/commodityPriceList/components/productTable.vue

@@ -1,139 +1,186 @@
 <template>
-  <el-form ref="form" :model="form">
-    <ele-pro-table
-      ref="table"
-      :needPage="false"
-      :columns="columns"
-      :datasource="form.datasource"
-      class="time-form"
-      :toolkit="[]"
-    >
-      <!-- 表头工具栏 -->
-      <template v-slot:toolbar>
-        <div class="headbox">
-          <el-button
-            size="small"
-            type="primary"
-            icon="el-icon-plus"
-            class="ele-btn-icon"
-            @click="handParent()"
-            v-if="type != 'view'"
+  <div>
+    <el-form ref="form" :model="form">
+      <ele-pro-table
+        ref="table"
+        :needPage="false"
+        :columns="columns"
+        :datasource="form.datasource"
+        class="time-form"
+        :toolkit="[]"
+      >
+        <!-- 表头工具栏 -->
+        <template v-slot:toolbar>
+          <div class="headbox">
+            <el-button
+              size="small"
+              type="primary"
+              icon="el-icon-plus"
+              class="ele-btn-icon"
+              @click="handParent()"
+              v-if="type != 'view'"
+            >
+              新增
+            </el-button>
+          </div>
+        </template>
+        <template v-slot:unitPrice="scope" v-if="type != 'view'">
+          <el-form-item
+            style="margin-bottom: 20px"
+            :prop="'datasource.' + scope.$index + '.unitPrice'"
+            :rules="{
+              required: true,
+              message: '请输入正确的单价',
+              trigger: 'change'
+            }"
           >
-            新增
-          </el-button>
-        </div>
-      </template>
-      <template v-slot:unitPrice="scope" v-if="type != 'view'">
-        <el-form-item
-          style="margin-bottom: 20px"
-          :prop="'datasource.' + scope.$index + '.unitPrice'"
-          :rules="{
-            required: true,
-            message: '请输入正确的单价',
-            trigger: 'change'
-          }"
-        >
-          <el-input
-            v-model="scope.row.unitPrice"
-            placeholder="请输入"
-            @input="changeCount(scope.row, scope.$index)"
-            type="number"
+            <el-input
+              v-model="scope.row.unitPrice"
+              placeholder="请输入"
+              @input="changeCount(scope.row, scope.$index)"
+              type="number"
+            >
+              <template slot="append">元</template>
+            </el-input>
+          </el-form-item>
+        </template>
+        <template v-slot:taxRate="scope" v-if="type != 'view'">
+          <el-form-item
+            style="margin-bottom: 20px"
+            :prop="'datasource.' + scope.$index + '.taxRate'"
+            :rules="{
+              required: true,
+              message: '请输入税率',
+              trigger: 'change'
+            }"
           >
-            <template slot="append">元</template>
-          </el-input>
-        </el-form-item>
-      </template>
-      <template v-slot:taxRate="scope" v-if="type != 'view'">
-        <el-form-item
-          style="margin-bottom: 20px"
-          :prop="'datasource.' + scope.$index + '.taxRate'"
-          :rules="{
-            required: true,
-            message: '请输入税率',
-            trigger: 'change'
-          }"
-        >
-          <el-input
-            v-model="scope.row.taxRate"
-            placeholder="请输入"
-            type="number"
-            @input="changeCount(scope.row, scope.$index)"
+            <el-input
+              v-model="scope.row.taxRate"
+              placeholder="请输入"
+              type="number"
+              @input="changeCount(scope.row, scope.$index)"
+            >
+              <template slot="append">%</template>
+            </el-input>
+          </el-form-item>
+        </template>
+        <template v-slot:priceType="scope">
+          <el-form-item
+            style="margin-bottom: 20px"
+            :prop="'datasource.' + scope.$index + '.priceType'"
+            :rules="{
+              required: true,
+              message: '请选择价格类型',
+              trigger: 'change'
+            }"
           >
-            <template slot="append">%</template>
-          </el-input>
-        </el-form-item>
-      </template>
-      <template v-slot:priceType="scope">
-        <el-form-item
-          style="margin-bottom: 20px"
-          :prop="'datasource.' + scope.$index + '.priceType'"
-          :rules="{
-            required: true,
-            message: '请选择价格类型',
-            trigger: 'change'
-          }"
-        >
-          <DictSelection
-            dictName="商品价格类型"
-            clearable
-            v-model="scope.row.priceType"
-            :listFormatte="(data) => listFormatte(data, scope.row.priceType)"
-            :disabled="type == 'view'"
-          />
-        </el-form-item>
-      </template>
+            <DictSelection
+              dictName="商品价格类型"
+              clearable
+              v-model="scope.row.priceType"
+              :listFormatte="(data) => listFormatte(data, scope.row.priceType)"
+              :disabled="type == 'view'"
+            />
+          </el-form-item>
+        </template>
 
-      <template v-slot:headerPriceType="{ column }">
-        <span class="is-required">{{ column.label }}</span>
-      </template>
-      <template v-slot:headerTaxRate="{ column }">
-        <span class="is-required">{{ column.label }}</span>
-      </template>
-      <template v-slot:headerUnitPrice="{ column }">
-        <span class="is-required">{{ column.label }}</span>
-      </template>
-      <template v-slot:headerExcludeTaxPrice="{ column }">
-        <span class="is-required">{{ column.label }}</span>
-      </template>
+        <template v-slot:technologyRouteName="scope">
+          <el-form-item
+            :prop="'datasource.' + scope.$index + '.technologyRouteName'"
+            :rules="{
+              required: false,
+              message: '请选择',
+              trigger: 'change'
+            }"
+          >
+            <el-input
+              v-model="scope.row.technologyRouteName"
+              :disabled="isContractId"
+              placeholder="请选择"
+              @click.native="openVersion(scope.$index)"
+            ></el-input>
+          </el-form-item>
+        </template>
+        <template v-slot:validityPeriod="scope">
+          <el-form-item
+            :prop="'datasource.' + scope.$index + '.validityPeriod'"
+            :rules="{
+              required: false,
+              message: '请选择',
+              trigger: 'change'
+            }"
+          >
+            <el-date-picker
+              style="width: 100%"
+              clearable
+              v-model="scope.row.validityPeriod"
+              type="date"
+              value-format="yyyy-MM-dd"
+              placeholder="请选择日期"
+            >
+            </el-date-picker>
+          </el-form-item>
+        </template>
 
-      <template v-slot:action="scope" v-if="type != 'view'">
-        <el-link
-          :underline="false"
-          type="primary"
-          @click="setDefault(scope.row)"
-          :disabled="!scope.row.priceType || !scope.row.unitPrice"
-          v-if="!scope.row.isDefault"
-        >
-          设为默认价
-        </el-link>
+        <template v-slot:headerPriceType="{ column }">
+          <span class="is-required">{{ column.label }}</span>
+        </template>
+        <template v-slot:headerTaxRate="{ column }">
+          <span class="is-required">{{ column.label }}</span>
+        </template>
+        <template v-slot:headerUnitPrice="{ column }">
+          <span class="is-required">{{ column.label }}</span>
+        </template>
+        <template v-slot:headerExcludeTaxPrice="{ column }">
+          <span class="is-required">{{ column.label }}</span>
+        </template>
 
-        <el-popconfirm
-          class="ele-action"
-          title="确定要删除吗?"
-          @confirm="remove(scope.$index)"
-          :disabled="form.datasource.length <= 1"
-        >
-          <template v-slot:reference>
-            <el-link
-              :disabled="form.datasource.length <= 1"
-              type="danger"
-              :underline="false"
-              icon="el-icon-delete"
-            >
-              删除
-            </el-link>
-          </template>
-        </el-popconfirm>
-      </template>
-    </ele-pro-table>
-  </el-form>
+        <template v-slot:action="scope" v-if="type != 'view'">
+          <el-link
+            :underline="false"
+            type="primary"
+            @click="setDefault(scope.row)"
+            :disabled="!scope.row.priceType || !scope.row.unitPrice"
+            v-if="!scope.row.isDefault"
+          >
+            设为默认价
+          </el-link>
+
+          <el-popconfirm
+            class="ele-action"
+            title="确定要删除吗?"
+            @confirm="remove(scope.$index)"
+            :disabled="form.datasource.length <= 1"
+          >
+            <template v-slot:reference>
+              <el-link
+                :disabled="form.datasource.length <= 1"
+                type="danger"
+                :underline="false"
+                icon="el-icon-delete"
+              >
+                删除
+              </el-link>
+            </template>
+          </el-popconfirm>
+        </template>
+      </ele-pro-table>
+    </el-form>
+    <ProductionVersion
+      ref="versionRefs"
+      @changeProduct="changeProduct"
+    ></ProductionVersion>
+  </div>
 </template>
 <script>
 import dictMixins from '@/mixins/dictMixins';
 import { getCode } from '@/api/login/index';
+import ProductionVersion from '@/components/ProductionVersion2/index.vue';
 
 export default {
-  components: {},
+  components: {
+    ProductionVersion
+  },
   mixins: [dictMixins],
   props: {
     groupId: String,
@@ -158,7 +205,7 @@ export default {
     columns() {
       return [
         {
-          width: 80,
+          width: 50,
           type: 'index',
           columnKey: 'index',
           align: 'center',
@@ -190,10 +237,23 @@ export default {
           prop: 'excludeTaxPrice',
           label: '不含税单价',
           slot: 'excludeTaxPrice',
-          align: 'center'
+          align: 'center',
+          width: 110
         },
+        // {
+        //   prop: 'technologyRouteName',
+        //   label: '工艺路线',
+        //   slot: 'technologyRouteName',
+        //   align: 'center'
+        // },
+        // {
+        //   prop: 'validityPeriod',
+        //   label: '价格有效期',
+        //   slot: 'validityPeriod',
+        //   align: 'center'
+        // },
         {
-          width: 300,
+          width: 180,
           columnKey: 'action',
           label: '操作',
           align: 'center',
@@ -205,6 +265,18 @@ export default {
     }
   },
   methods: {
+    openVersion(index) {
+      this.$refs.versionRefs.open(index);
+    },
+    //工艺路线
+    changeProduct(data, index) {
+      this.$set(
+        this.form.datasource[index],
+        'technologyRouteName',
+        data.name
+      );
+      this.$set(this.form.datasource[index], 'technologyRouteId', data.id);
+    },
     changeCount(row, index) {
       if (row.unitPrice == null) return;
       const excludeTaxPrice = (