Jelajahi Sumber

服务商配置—开票内容配置

ZhangWenQiang 3 tahun lalu
induk
melakukan
7b7f5f3337

+ 220 - 200
src/components/dict/JSearchSelectTag.vue

@@ -1,201 +1,221 @@
-<template>
-
-  <a-select
-    v-if="async"
-    showSearch
-    labelInValue
-    :disabled="disabled"
-    :getPopupContainer="(node) => node.parentNode"
-    @search="loadData"
-    :placeholder="placeholder"
-    v-model="selectedAsyncValue"
-    style="width: 100%"
-    :filterOption="false"
-    @change="handleAsyncChange"
-    allowClear
-    :notFoundContent="loading ? undefined : null"
-  >
-    <a-spin v-if="loading" slot="notFoundContent" size="small"/>
-    <a-select-option v-for="d in options" :key="d.value" :value="d.value">{{ d.text }}</a-select-option>
-  </a-select>
-
-  <a-select
-    v-else
-    :getPopupContainer="(node) => node.parentNode"
-    showSearch
-    :disabled="disabled"
-    :placeholder="placeholder"
-    optionFilterProp="children"
-    style="width: 100%"
-    @change="handleChange"
-    :filterOption="filterOption"
-    v-model="selectedValue"
-    allowClear
-    :notFoundContent="loading ? undefined : null">
-    <a-spin v-if="loading" slot="notFoundContent" size="small"/>
-    <a-select-option v-for="d in options" :key="d.value" :value="d.value">{{ d.text }}</a-select-option>
-  </a-select>
-
-</template>
-
-<script>
-  import { ajaxGetDictItems,getDictItemsFromCache } from '@/api/api'
-  import debounce from 'lodash/debounce';
-  import { getAction } from '../../api/manage'
-
-  export default {
-    name: 'JSearchSelectTag',
-    props:{
-      disabled: Boolean,
-      value: [String, Number],
-      dict: String,
-      dictOptions: Array,
-      async: Boolean,
-      placeholder:{
-        type:String,
-        default:"请选择",
-        required:false
-      }
-    },
-    data(){
-      this.loadData = debounce(this.loadData, 800);//消抖
-      this.lastLoad = 0;
-      return {
-        loading:false,
-        selectedValue:[],
-        selectedAsyncValue:[],
-        options: [],
-      }
-    },
-    created(){
-      this.initDictData();
-    },
-    watch:{
-      "value":{
-        immediate:true,
-        handler(val){
-          if(!val){
-            if(val==0){
-              this.initSelectValue()
-            }else{
-              this.selectedValue=[]
-              this.selectedAsyncValue=[]
-            }
-          }else{
-            this.initSelectValue()
-          }
-        }
-      },
-      "dict":{
-        handler(){
-          this.initDictData()
-        }
-      }
-    },
-    methods:{
-      initSelectValue(){
-        if(this.async){
-          if(!this.selectedAsyncValue || !this.selectedAsyncValue.key || this.selectedAsyncValue.key!=this.value){
-            console.log("这才请求后台")
-            getAction(`/sys/dict/loadDictItem/${this.dict}`,{key:this.value}).then(res=>{
-              if(res.success){
-                let obj = {
-                  key:this.value,
-                  label:res.result
-                }
-                this.selectedAsyncValue = {...obj}
-              }
-            })
-          }
-        }else{
-          this.selectedValue = this.value.toString()
-        }
-      },
-      loadData(value){
-        console.log("数据加载",value)
-        this.lastLoad +=1
-        const currentLoad = this.lastLoad
-        this.options = []
-        this.loading=true
-        // 字典code格式:table,text,code
-        getAction(`/sys/dict/loadDict/${this.dict}`,{keyword:value}).then(res=>{
-          this.loading=false
-          if(res.success){
-            if(currentLoad!=this.lastLoad){
-              return
-            }
-            this.options = res.result
-            console.log("我是第一个",res)
-          }else{
-            this.$message.warning(res.message)
-          }
-
-        })
-
-      },
-      initDictData(){
-        if(!this.async){
-          //如果字典项集合有数据
-          if(this.dictOptions && this.dictOptions.length>0){
-            this.options = [...this.dictOptions]
-          }else{
-            //根据字典Code, 初始化字典数组
-            let dictStr = ''
-            if(this.dict){
-                let arr = this.dict.split(',')
-                if(arr[0].indexOf('where')>0){
-                  let tbInfo = arr[0].split('where')
-                  dictStr = tbInfo[0].trim()+','+arr[1]+','+arr[2]+','+encodeURIComponent(tbInfo[1])
-                }else{
-                  dictStr = this.dict
-                }
-                if (this.dict.indexOf(",") == -1) {
-                  //优先从缓存中读取字典配置
-                  if (getDictItemsFromCache(this.dictCode)) {
-                    this.options = getDictItemsFromCache(this.dictCode);
-                    return
-                  }
-                }
-                ajaxGetDictItems(dictStr, null).then((res) => {
-                  if (res.success) {
-                    this.options = res.result;
-                  }
-                })
-            }
-          }
-        }
-      },
-      filterOption(input, option) {
-        return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
-      },
-      handleChange (selectedValue) {
-        console.log("selectedValue",selectedValue)
-        this.selectedValue = selectedValue
-        this.callback()
-      },
-      handleAsyncChange(selectedObj){
-        this.selectedAsyncValue = selectedObj
-        this.selectedValue = selectedObj.key
-        this.callback()
-      },
-      callback(){
-        this.$emit('change', this.selectedValue);
-      },
-      setCurrentDictOptions(dictOptions){
-        this.options = dictOptions
-      },
-      getCurrentDictOptions(){
-        return this.options
-      }
-
-    },
-    model: {
-      prop: 'value',
-      event: 'change'
-    }
-  }
-</script>
-
-<style scoped>
-
+<template>
+
+  <a-select
+    v-if="async"
+    showSearch
+    labelInValue
+    :disabled="disabled"
+    :getPopupContainer="getPopupContainer"
+    @search="loadData"
+    :placeholder="placeholder"
+    v-model="selectedAsyncValue"
+    style="width: 100%"
+    :filterOption="false"
+    @change="handleAsyncChange"
+    allowClear
+    :notFoundContent="loading ? undefined : null"
+  >
+    <a-spin v-if="loading" slot="notFoundContent" size="small"/>
+    <a-select-option :value="undefined">请选择</a-select-option>
+    <a-select-option v-for="d in options" :key="d.value" :value="d.value" v-if="deleteValue.indexOf(d.value) == -1">{{ d.text || d.label }}</a-select-option>
+  </a-select>
+
+  <a-select
+    v-else
+    :getPopupContainer="getPopupContainer"
+    showSearch
+    :disabled="disabled"
+    :placeholder="placeholder"
+    optionFilterProp="children"
+    style="width: 100%"
+    @change="handleChange"
+    :filterOption="filterOption"
+    v-model="selectedValue"
+    allowClear
+    :notFoundContent="loading ? undefined : null">
+    <a-spin v-if="loading" slot="notFoundContent" size="small"/>
+    <a-select-option :value="undefined">请选择</a-select-option>
+    <a-select-option v-for="d in options" :key="d.value" :value="d.value" v-if="deleteValue.indexOf(d.value) == -1">{{ d.text || d.label }}</a-select-option>
+  </a-select>
+
+</template>
+
+<script>
+  import { ajaxGetDictItems,getDictItemsFromCache } from '@/api/api'
+  import debounce from 'lodash/debounce';
+  import { getAction } from '../../api/manage'
+
+  export default {
+    name: 'JSearchSelectTag',
+    props:{
+      disabled: Boolean,
+      value: [String, Number],
+      dict: String,
+      dictCode: String,
+      dictOptions: Array,
+      async: Boolean,
+      placeholder:{
+        type:String,
+        default:"请选择",
+        required:false
+      },
+      getPopupContainer:{
+        type: Function,
+        default: (node) => node.parentNode
+      },
+      deleteValue:{
+        type: Array,
+        // 对象或数组默认值必须从一个工厂函数获取
+        default: function () {
+          return [];
+        },
+      }
+    },
+    data(){
+      this.loadData = debounce(this.loadData, 800);//消抖
+      this.lastLoad = 0;
+      return {
+        loading:false,
+        selectedValue:[],
+        selectedAsyncValue:[],
+        options: [],
+      }
+    },
+    created(){
+      this.initDictData();
+    },
+    watch:{
+      "value":{
+        immediate:true,
+        handler(val){
+          if(!val){
+            if(val==0){
+              this.initSelectValue()
+            }else{
+              this.selectedValue=[]
+              this.selectedAsyncValue=[]
+            }
+          }else{
+            this.initSelectValue()
+          }
+        }
+      },
+      "dict":{
+        handler(){
+          this.initDictData()
+        }
+      },
+      "dictOptions":{
+        handler(){
+          this.initDictData()
+        }
+      },
+    },
+    methods:{
+      initSelectValue(){
+        if(this.async){
+          if(!this.selectedAsyncValue || !this.selectedAsyncValue.key || this.selectedAsyncValue.key!=this.value){
+            console.log("这才请求后台")
+            getAction(`/sys/dict/loadDictItem/${this.dict}`,{key:this.value}).then(res=>{
+              if(res.success){
+                let obj = {
+                  key:this.value,
+                  label:res.result
+                }
+                this.selectedAsyncValue = {...obj}
+              }
+            })
+          }
+        }else{
+          this.selectedValue = this.value.toString()
+        }
+      },
+      loadData(value){
+        console.log("数据加载",value)
+        this.lastLoad +=1
+        const currentLoad = this.lastLoad
+        this.options = []
+        this.loading=true
+        // 字典code格式:table,text,code
+        getAction(`/sys/dict/loadDict/${this.dict}`,{keyword:value}).then(res=>{
+          this.loading=false
+          if(res.success){
+            if(currentLoad!=this.lastLoad){
+              return
+            }
+            this.options = res.result
+            console.log("我是第一个",res)
+          }else{
+            this.$message.warning(res.message)
+          }
+
+        })
+
+      },
+      initDictData(){
+        if(!this.async){
+          this.options = [];
+          //如果字典项集合有数据
+          if(this.dictOptions && this.dictOptions.length>0){
+            this.options = [...this.dictOptions]
+          }else{
+            //根据字典Code, 初始化字典数组
+            let dictStr = ''
+            if(this.dict){
+              let arr = this.dict.split(',')
+              if(arr[0].indexOf('where')>0){
+                let tbInfo = arr[0].split('where')
+                dictStr = tbInfo[0].trim()+','+arr[1]+','+arr[2]+','+encodeURIComponent(tbInfo[1])
+              }else{
+                dictStr = this.dict
+              }
+              if (this.dict.indexOf(",") == -1) {
+                //优先从缓存中读取字典配置
+                if (getDictItemsFromCache(this.dictCode)) {
+                  this.options = getDictItemsFromCache(this.dictCode);
+                  return
+                }
+              }
+              ajaxGetDictItems(dictStr, null).then((res) => {
+                if (res.success) {
+                  this.options = res.result;
+                }
+              })
+            }
+          }
+        }
+      },
+      filterOption(input, option) {
+        return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
+      },
+      handleChange (selectedValue) {
+        console.log("selectedValue",selectedValue)
+        this.selectedValue = selectedValue
+        this.callback()
+      },
+      handleAsyncChange(selectedObj){
+        this.selectedAsyncValue = selectedObj
+        this.selectedValue = selectedObj.key
+        this.callback()
+      },
+      callback(){
+        this.$emit('change', this.selectedValue);
+      },
+      setCurrentDictOptions(dictOptions){
+        this.options = dictOptions
+      },
+      getCurrentDictOptions(){
+        return this.options
+      }
+
+    },
+    model: {
+      prop: 'value',
+      event: 'change'
+    }
+  }
+</script>
+
+<style scoped>
+
 </style>

+ 87 - 67
src/views/hlwsubcontractor/modules/HlwSubcontractorForm.vue

@@ -29,36 +29,35 @@
         :scroll="{x:true}"
         :rowKey="(record,index)=>{return index}"
         :columns="columns"
-        :dataSource="model.resumeWorkExperienceList"
+        :dataSource="dataSource"
         :pagination="false"
         class="j-table-force-nowrap">
 
-        <span slot="action" slot-scope="text, record, index" v-if="!isView">
-          <a @click="handleEditWork(record,index)" v-has="'hcmResume:workExperience:edit'">编辑</a>
-          <a-divider type="vertical" v-has="'hcmResume:workExperience:delete'"/>
-          <a @click="handleDeleteWork(index)" v-has="'hcmResume:workExperience:delete'">删除</a>
+        <span slot="action" slot-scope="text, record, index">
+          <a @click="handleDelete(record)">删除</a>
+          <a-divider type="vertical"/>
+          <a @click="handleIsOn(record)">启用禁用</a>
         </span>
 
       </a-table>
 
-      <a-col :span="24" style="text-align: center;margin-top: 16px;" v-if="!isView">
-        <a-button @click="submitForm" type="primary" v-has="'hcmResume:save'">提交保存</a-button>
-      </a-col>
-
     </a-form-model>
+    <HlwSubcontractorInvoiceCategoryIsOnModal ref="isOnModalForm" @ok="modalFormOk"></HlwSubcontractorInvoiceCategoryIsOnModal>
   </a-spin>
 </template>
 
 <script>
 
-  import { httpAction, getAction } from '@/api/manage'
+  import { httpAction, getAction,deleteAction } from '@/api/manage'
   import pick from 'lodash.pick'
   import { validateDuplicateValue } from '@/utils/util'
   import moment from 'moment'
+  import HlwSubcontractorInvoiceCategoryIsOnModal from './HlwSubcontractorInvoiceCategoryIsOnModal'
 
   export default {
     name: "HcmResumeModal",
     components: {
+      HlwSubcontractorInvoiceCategoryIsOnModal
     },
     data () {
       return {
@@ -78,24 +77,43 @@
         confirmLoading: false,
         validatorRules: {
         },
+        dataSource:[],
         columns: [
           {
-            title:'公司姓名',
+            title:'开票内容',
+            align:"center",
+            dataIndex: 'invoiceCategoryName'
+          },
+          {
+            title:'启用状态',
+            align:"center",
+            dataIndex: 'isOn_dictText'
+          },
+          {
+            title:'创建时间',
+            align:"center",
+            dataIndex: 'createTime',
+            customRender:function (text) {
+              return text
+            }
+          },
+          {
+            title:'创建者',
             align:"center",
-            dataIndex: 'companyName'
+            dataIndex: 'createBy'
           },
           {
-            title:'任职时间',
+            title:'更新时间',
             align:"center",
-            dataIndex: 'workStartDate',
-            customRender:function (text,record) {
-              return record.workStartDate + ' ~ ' + (record.workEndDate?record.workEndDate : '至今')
+            dataIndex: 'updateTime',
+            customRender:function (text) {
+              return text
             }
           },
           {
-            title:'职位名称',
+            title:'更新者',
             align:"center",
-            dataIndex: 'position'
+            dataIndex: 'updateBy'
           },
           {
             title: '操作',
@@ -109,7 +127,9 @@
         url: {
           add: "/wisdom/hlwSubcontractor/add",
           edit: "/wisdom/hlwSubcontractor/edit",
-          get: '/wisdom/hlwSubcontractor/queryById'
+          get: '/wisdom/hlwSubcontractor/queryById',
+          findInvoiceList: '/wisdom/hlwSubcontractorInvoiceCategory/findInvoiceList',
+          delete: '/wisdom/hlwSubcontractorInvoiceCategory/delete'
         }
       }
     },
@@ -118,24 +138,17 @@
       if(id){
         //查询基本信息
         this.getDetail(id);
-      }else{
-        this.add();
       }
     },
     methods: {
-      add () {
-        this.edit(this.model);
-      },
-      edit (record) {
-        this.model = Object.assign({}, record);
-        this.visible = true;
-      },
       getDetail(id){
         let that = this;
         that.confirmLoading = true;
         getAction(that.url.get,{id: id}).then((res)=>{
           if(res.success){
             this.model = Object.assign({}, res.result);
+            //开票内容
+            this.findInvoiceList();
           }else{
             console.log('查询失败');
           }
@@ -143,52 +156,59 @@
           that.confirmLoading = false;
         })
       },
-      submitForm () {
-        const that = this;
-        // 触发表单验证
-        this.$refs.form.validate(valid => {
-          if (valid) {
-            that.confirmLoading = true;
-            let httpurl = '';
-            let method = '';
-            if(!this.model.id){
-              httpurl+=this.url.add;
-              method = 'post';
-            }else{
-              httpurl+=this.url.edit;
-              method = 'put';
-            }
-            let formData = this.model;
-            console.log("表单提交数据",formData)
-            httpAction(httpurl,formData,method).then((res)=>{
-              if(res.success){
-                that.$message.success(res.message);
-                that.$emit('ok');
-              }else{
-                that.$warning({
-                  title: '提示',
-                  content: res.message,
-                });
-              }
-            }).finally(() => {
-              that.confirmLoading = false;
-            })
-          } else {
-            return false;
+      findInvoiceList(){
+        let that = this;
+        that.confirmLoading = true;
+        getAction(that.url.findInvoiceList,{subcontractorId: that.model.id}).then((res)=>{
+          if(res.success){
+            this.dataSource = res.result;
+          }else{
+            console.log('查询失败');
           }
-
+        }).finally(() => {
+          that.confirmLoading = false;
         })
       },
       handleCancel () {
         this.close()
       },
-      handleEditWork(record,index){
-        this.$refs.modalForm.edit(record, index);
-        this.$refs.modalForm.title = "编辑工作经历";
-        this.$refs.modalForm.disableSubmit = false;
+      handleAddWork(){
+        this.$refs.isOnModalForm.add({subcontractorId: this.model.id});
+        this.$refs.isOnModalForm.title = "添加开票内容";
+        this.$refs.isOnModalForm.disableSubmit = false;
       },
-      modalFormOk(record,editIndex){
-
+      modalFormOk(){
+        this.findInvoiceList();
+      },
+      handleDelete(record){
+        var that = this;
+        const modal = that.$confirm({
+          title: '删除开票内容',
+          closable: true,
+          keyboard: false,
+          maskClosable: true,
+          content: '确定要删除该开票内容吗?',
+          okText: '确定删除',
+          cancelText: '取消',
+          onOk: function() {
+            deleteAction(that.url.delete, {id: record.id}).then((res) => {
+              if (res.success) {
+                that.$message.success(res.message);
+                that.findInvoiceList();
+              } else {
+                that.$message.warning(res.message);
+              }
+            });
+          },
+          onCancel(e) {
+            modal.destroy()
+          }
+        })
+      },
+      handleIsOn(record){
+        this.$refs.isOnModalForm.edit(record);
+        this.$refs.isOnModalForm.title = "开票内容启用禁用";
+        this.$refs.isOnModalForm.disableSubmit = false;
       },
     }
   }

+ 150 - 0
src/views/hlwsubcontractor/modules/HlwSubcontractorInvoiceCategoryIsOnModal.vue

@@ -0,0 +1,150 @@
+<template>
+  <j-modal
+    :title="title"
+    :width="width"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    @ok="handleOk"
+    @cancel="handleCancel"
+    cancelText="关闭">
+    <a-spin :spinning="confirmLoading">
+      <a-form-model ref="form" :model="model" :rules="validatorRules">
+
+        <a-form-model-item label="开票内容" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="invoiceCategoryId">
+          <j-search-select-tag placeholder="请选择开票内容" v-model="model.invoiceCategoryId" :dictOptions="invoiceCategoryOptions" :disabled="model.id ? true : false"/>
+        </a-form-model-item>
+        <a-form-model-item label="启用状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="isOn">
+          <j-dict-select-tag type="radio" v-model="model.isOn" placeholder="请选择"
+                             dictCode="is_on"></j-dict-select-tag>
+        </a-form-model-item>
+
+      </a-form-model>
+    </a-spin>
+  </j-modal>
+</template>
+
+<script>
+
+  import { httpAction, getAction } from '@/api/manage'
+  import pick from 'lodash.pick'
+  import { validateDuplicateValue } from '@/utils/util'
+  import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
+
+  export default {
+    name: "HcwInvoiceCategoryModal",
+    components: {
+      JSearchSelectTag
+    },
+    data () {
+      return {
+        title:"操作",
+        width:680,
+        visible: false,
+        model: {
+          isOn: 1
+        },
+        labelCol: {
+          xs: { span: 24 },
+          sm: { span: 5 },
+        },
+        wrapperCol: {
+          xs: { span: 24 },
+          sm: { span: 16 },
+        },
+        confirmLoading: false,
+        validatorRules: {
+          invoiceCategoryId: [
+            { required: true, message: '请选择开票内容!'},
+          ],
+          isOn: [
+                  { required: true, message: '请选择启用状态!'},
+            ],
+        },
+        url: {
+          add: "/wisdom/hlwSubcontractorInvoiceCategory/add",
+          edit: "/wisdom/hlwSubcontractorInvoiceCategory/edit",
+          findAllList: '/wisdom/hlwInvoiceCategory/findAllList'
+        },
+        invoiceCategoryOptions: [],
+      }
+    },
+    created () {
+    },
+    methods: {
+      add (record) {
+        this.edit({
+          isOn: 1,
+          subcontractorId: record.subcontractorId
+        });
+      },
+      edit (record) {
+        this.model = Object.assign({}, record);
+        this.findAllList();
+        this.visible = true;
+      },
+      close () {
+        this.$emit('close');
+        this.visible = false;
+      },
+      handleOk () {
+        const that = this;
+        // 触发表单验证
+        this.$refs.form.validate(valid => {
+          if (valid) {
+            that.confirmLoading = true;
+            let httpurl = '';
+            let method = '';
+            if(!this.model.id){
+              httpurl+=this.url.add;
+              method = 'post';
+            }else{
+              httpurl+=this.url.edit;
+               method = 'put';
+            }
+            let formData = this.model;
+            console.log("表单提交数据",formData)
+            httpAction(httpurl,formData,method).then((res)=>{
+              if(res.success){
+                that.$message.success(res.message);
+                that.$emit('ok');
+                that.close();
+              }else{
+                that.$message.warning(res.message);
+              }
+            }).finally(() => {
+              that.confirmLoading = false;
+            })
+          } else {
+            return false;
+          }
+         
+        })
+      },
+      handleCancel () {
+        this.close()
+      },
+      popupCallback(row){
+        this.model = Object.assign(this.model, row);
+      },
+      findAllList(){
+        let that = this;
+        that.confirmLoading = true;
+        getAction(that.url.findAllList,{}).then((res)=>{
+          if(res.success){
+            this.invoiceCategoryOptions=[]
+            for(let i = 0;i<res.result.length;i++){
+              var name = res.result[i].invoiceCategoryName;
+              var value = res.result[i].id.toString()
+              this.invoiceCategoryOptions.push({label: name, value:value})
+            }
+          }else{
+            console.log('查询失败');
+          }
+        }).finally(() => {
+          that.confirmLoading = false;
+        })
+      },
+      
+    }
+  }
+</script>